Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_answer_target_act_uninformed_n4.json +0 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_answer_target_act_uninformed_n4.md +246 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_official_rules_act_uninformed_n4.json +0 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_official_rules_act_uninformed_n4.md +246 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_derivation_n8.json +0 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_derivation_n8.md +226 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_rules_n8.json +0 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_rules_n8.md +226 -0
- benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_hakhun_manual_derivation_n4.json +0 -0
- benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/summary.json +14 -0
- benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/train.jsonl +0 -0
- benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/val.jsonl +0 -0
- benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v11_clean_prompt/summary.json +10 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_dummy_thread/__init__.py +10 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_markupbase/__init__.py +10 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/cacheprovider.py +438 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/capture.py +850 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/compat.py +457 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/debugging.py +334 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/future-0.17.1.dist-info/WHEEL +5 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/future-0.17.1.dist-info/top_level.txt +17 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/__init__.py +9 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/entities.py +7 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/parser.py +8 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/__init__.py +9 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/client.py +91 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/cookiejar.py +6 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/cookies.py +7 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/server.py +18 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/idna/codec.py +118 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/idna/compat.py +12 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/api.py +158 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/auth.py +305 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/certs.py +18 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/compat.py +70 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/cookies.py +549 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/exceptions.py +126 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/help.py +119 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/hooks.py +34 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/models.py +953 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/cli-32.exe +0 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/cli-64.exe +0 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/script (dev).tmpl +6 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/script.tmpl +3 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/site-patch.py +74 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/ssl_support.py +260 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/unicode_utils.py +44 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/version.py +6 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/urllib3-1.25.3.dist-info/RECORD +104 -0
- benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/urllib3-1.25.3.dist-info/WHEEL +6 -0
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_answer_target_act_uninformed_n4.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_answer_target_act_uninformed_n4.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Answer-Given Rationale Probe
|
| 2 |
+
|
| 3 |
+
- generated: `2026-07-11T23:36:51.389454+00:00`
|
| 4 |
+
- model: `Qwen/Qwen3-4B-Instruct-2507`
|
| 5 |
+
- data: `data/rl/ioling_qwen3_4b_manual_v11_clean_prompt`
|
| 6 |
+
- samples: `96` across `24` records
|
| 7 |
+
- exact final-box samples: `0.938`
|
| 8 |
+
- valid final-box samples: `0.948`
|
| 9 |
+
- truncation rate: `0.000`
|
| 10 |
+
- mean rationale chars: `1256.9`
|
| 11 |
+
|
| 12 |
+
## Per Record
|
| 13 |
+
|
| 14 |
+
| record | samples | exact boxes | valid boxes | best score | mean rationale chars |
|
| 15 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 16 |
+
| iol-2015-individual-p1-sub-b-atomic-b.1 | 4 | 4 | 4 | 1.000 | 1114.8 |
|
| 17 |
+
| iol-2015-individual-p1-sub-b-atomic-b.2 | 4 | 4 | 4 | 1.000 | 1104.2 |
|
| 18 |
+
| iol-2015-individual-p1-sub-c-atomic-c.1 | 4 | 4 | 4 | 1.000 | 868.0 |
|
| 19 |
+
| iol-2015-individual-p1-sub-c-atomic-c.2 | 4 | 4 | 4 | 1.000 | 927.5 |
|
| 20 |
+
| iol-2016-individual-p3-sub-a-atomic-a.1 | 4 | 4 | 4 | 1.000 | 881.0 |
|
| 21 |
+
| iol-2016-individual-p3-sub-a-atomic-a.2 | 4 | 4 | 4 | 1.000 | 1331.5 |
|
| 22 |
+
| iol-2016-individual-p3-sub-a-atomic-a.3 | 4 | 4 | 4 | 1.000 | 3546.2 |
|
| 23 |
+
| iol-2016-individual-p3-sub-a-atomic-a.4 | 4 | 4 | 4 | 1.000 | 1148.8 |
|
| 24 |
+
| iol-2016-individual-p3-sub-a-atomic-a.5 | 4 | 4 | 4 | 1.000 | 1148.0 |
|
| 25 |
+
| iol-2016-individual-p3-sub-b-atomic-b.1 | 4 | 2 | 3 | 1.000 | 1061.2 |
|
| 26 |
+
| iol-2016-individual-p3-sub-b-atomic-b.2 | 4 | 3 | 3 | 1.000 | 1311.0 |
|
| 27 |
+
| iol-2016-individual-p3-sub-b-atomic-b.3 | 4 | 4 | 4 | 1.000 | 1133.2 |
|
| 28 |
+
| iol-2016-individual-p3-sub-b-atomic-b.4 | 4 | 4 | 4 | 1.000 | 1240.0 |
|
| 29 |
+
| iol-2016-individual-p3-sub-b-atomic-b.5 | 4 | 4 | 4 | 1.000 | 1246.5 |
|
| 30 |
+
| iol-2021-individual-p3-sub-a-atomic-a.1 | 4 | 4 | 4 | 1.000 | 1159.2 |
|
| 31 |
+
| iol-2021-individual-p3-sub-a-atomic-a.2 | 4 | 4 | 4 | 1.000 | 1126.5 |
|
| 32 |
+
| iol-2021-individual-p3-sub-a-atomic-a.3 | 4 | 4 | 4 | 1.000 | 1142.2 |
|
| 33 |
+
| iol-2021-individual-p3-sub-a-atomic-a.4 | 4 | 4 | 4 | 1.000 | 1290.0 |
|
| 34 |
+
| iol-2021-individual-p3-sub-a-atomic-a.5 | 4 | 4 | 4 | 1.000 | 1334.0 |
|
| 35 |
+
| iol-2021-individual-p3-sub-b-atomic-b.1 | 4 | 3 | 3 | 1.000 | 1173.5 |
|
| 36 |
+
| iol-2021-individual-p3-sub-b-atomic-b.2 | 4 | 2 | 2 | 1.000 | 1120.0 |
|
| 37 |
+
| iol-2021-individual-p3-sub-b-atomic-b.3 | 4 | 4 | 4 | 1.000 | 1100.2 |
|
| 38 |
+
| iol-2021-individual-p3-sub-b-atomic-b.4 | 4 | 4 | 4 | 1.000 | 1398.8 |
|
| 39 |
+
| iol-2021-individual-p3-sub-b-atomic-b.5 | 4 | 4 | 4 | 1.000 | 1259.2 |
|
| 40 |
+
|
| 41 |
+
## Sample Outputs
|
| 42 |
+
|
| 43 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `0`
|
| 44 |
+
|
| 45 |
+
- score: `1.0`
|
| 46 |
+
- exact: `1.0`
|
| 47 |
+
- final box valid: `True`
|
| 48 |
+
|
| 49 |
+
```text
|
| 50 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating multiplication of mahtlactli yields a structure with pöhualli and mahtlactli components.
|
| 51 |
+
- Equation (4) confirms mäcuïlli + öme = chicöme, establishing that mäcuïlli and öme combine to form chicöme, suggesting additive decomposition of chicöme.
|
| 52 |
+
- Equation (3) demonstrates yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, showing that the addition of pöhualli and chicöme structures leads to pöhualli-on-cë with a nested structure.
|
| 53 |
+
- Equation (2) reveals cem-pöhualli × öme = öm-pöhualli, indicating that cem-pöhualli multiplied by öme results in öm-pöhualli, supporting a morpheme shift from cem to öm under multiplication.
|
| 54 |
+
- Equation (5) shows mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, implying multiplication of a base with ëyi produces components with cem-pöhualli, caxtölli, and nähui.
|
| 55 |
+
- Equation (6) confirms mäcuïlli × ëyi = caxtölli, indicating that mäcuïlli times ëyi directly yields caxtölli, reinforcing the multiplicative rule involving mäcuïlli and ëyi.
|
| 56 |
+
|
| 57 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `1`
|
| 61 |
+
|
| 62 |
+
- score: `1.0`
|
| 63 |
+
- exact: `1.0`
|
| 64 |
+
- final box valid: `True`
|
| 65 |
+
|
| 66 |
+
```text
|
| 67 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating multiplication produces a compound with pöhualli and om, suggesting pöhualli relates to 20.
|
| 68 |
+
- Equation (2) gives cem-pöhualli × öme = öm-pöhualli, implying cem-pöhualli × öme = öm-pöhualli shows öme acts as a unit multiplier, consistent with öme = 1.
|
| 69 |
+
- Equation (4) states mäcuïlli + öme = chicöme, and (1) shows mahtlactli × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating mäcuïlli = 20, so 20 + 1 = chicöme.
|
| 70 |
+
- Equation (3) has yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, showing addition combines components with pöhualli, indicating cumulative structure.
|
| 71 |
+
- Equation (5) shows mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, and (6) gives mäcuïlli × ëyi = caxtölli; since mäcuïlli = 20, 20 × ëyi = caxtölli, so ëyi = 5, as 20 × 5 = 100.
|
| 72 |
+
- From (1): mahtlactli × mahtlactli = mäcuïl-pöhualli-om-mahtlactli; if mahtlactli = 20, then 20 × 20 = 400, and mäcuïl-pöhualli-om-mahtlactli = 400, so 400 = 400, supporting the base system.
|
| 73 |
+
|
| 74 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `2`
|
| 78 |
+
|
| 79 |
+
- score: `1.0`
|
| 80 |
+
- exact: `1.0`
|
| 81 |
+
- final box valid: `True`
|
| 82 |
+
|
| 83 |
+
```text
|
| 84 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating multiplication yields a compound structure where one factor is replicated with a base morpheme.
|
| 85 |
+
- Equation (4) confirms mäcuïlli + öme = chicöme, showing that adding a base unit to a modified form produces a known compound, allowing reconstruction via component addition.
|
| 86 |
+
- Equation (2) reveals cem-pöhualli × öme = öm-pöhualli, demonstrating a reversal of order due to multiplication with öme, implying öme acts as a unit that inverts constituent order.
|
| 87 |
+
- Equation (3) shows yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, confirming that adding two structures yields a new compound with preserved morpheme sequences and balanced components.
|
| 88 |
+
- Equation (5) demonstrates mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, revealing that multiplication generates a longer structure with nested units, suggesting a pattern where base × factor = derived structure.
|
| 89 |
+
- Equation (6) shows mäcuïlli × ëyi = caxtölli, indicating multiplication of base units produces a direct result, establishing a consistent multiplicative rule for base morphemes.
|
| 90 |
+
|
| 91 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `3`
|
| 95 |
+
|
| 96 |
+
- score: `1.0`
|
| 97 |
+
- exact: `1.0`
|
| 98 |
+
- final box valid: `True`
|
| 99 |
+
|
| 100 |
+
```text
|
| 101 |
+
- Equation (1) shows that mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli; the product of two mahtlactli units is a composite with pöhualli and mahtlactli.
|
| 102 |
+
- Equation (4) establishes that mäcuïlli + öme = chicöme, indicating that both mäcuïlli and öme are components of chicöme, suggesting additive structure.
|
| 103 |
+
- Equation (2) demonstrates cem-pöhualli × öme = öm-pöhualli, showing that multiplication by öme results in a reversal of the initial component, implying symmetry in operations.
|
| 104 |
+
- Equation (5) reveals mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, indicating that multilayered compound multiplication yields a specific structured output with cem and caxtölli.
|
| 105 |
+
- Equation (6) shows mäcuïlli × ëyi = caxtölli, confirming a direct multiplicative component that maps to caxtölli, supporting number decomposition via multiplication.
|
| 106 |
+
- Equation (13) expresses yë-tzontli-on-näuh-pöhualli-on-caxtölli-on-cë = ndamno, linking compound structure involving pöhualli and caxtölli to a known value, implying pöhualli-based counts are part of a base-14 system.
|
| 107 |
+
|
| 108 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `0`
|
| 112 |
+
|
| 113 |
+
- score: `1.0`
|
| 114 |
+
- exact: `1.0`
|
| 115 |
+
- final box valid: `True`
|
| 116 |
+
|
| 117 |
+
```text
|
| 118 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli; comparing to (2), cem-pöhualli × öme = öm-pöhualli confirms multiplicative structure with öme as unit.
|
| 119 |
+
- Equation (4) establishes mäcuïlli + öme = chicöme, supporting the additive base of cem-pöhualli in (2), where cem-pöhualli × öme yields öm-pöhualli.
|
| 120 |
+
- Equation (3) demonstrates yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, showing that adding mahtlactli-on-nähui yields the result on the right, confirming nähui’s role in additive chains.
|
| 121 |
+
- Equation (6) shows mäcuïlli × ëyi = caxtölli, and (5) gives mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, aligning the multiplication of a compound with ëyi producing a term with caxtölli and nähui.
|
| 122 |
+
- Equation (14) states cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, implying the structure cen-tzontli on compound terms matches the additive-multiplicative expansion of known values.
|
| 123 |
+
- Equation (15) gives cen-tzontli = tarumba tambaroy fete asàr; since tarumba = nimbo × fete and tambaroy = ngámbi + asàr, this confirms that cen-tzontli is a derived value based on known multiplicative combinations.
|
| 124 |
+
|
| 125 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `1`
|
| 129 |
+
|
| 130 |
+
- score: `1.0`
|
| 131 |
+
- exact: `1.0`
|
| 132 |
+
- final box valid: `True`
|
| 133 |
+
|
| 134 |
+
```text
|
| 135 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating multiplication of compound forms involving mahtlactli and cë.
|
| 136 |
+
- Equation (2) demonstrates cem-pöhualli × öme = öm-pöhualli, showing that cem-pöhualli × öme yields a form with öm- prefix, implying öme is compatible with multiplication and prefix shifting.
|
| 137 |
+
- Equation (3) reveals yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, confirming additive composition where suffixes like -on and -nähui group with specific roots.
|
| 138 |
+
- Equation (4) establishes mäcuïlli + öme = chicöme, showing that the sum of mäcuïlli and öme forms chicöme, a key component in building larger numerals.
|
| 139 |
+
- Equation (5) displays mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, indicating that multiplication with ëyi produces a chain of compound forms involving cem-pöhualli and caxtölli.
|
| 140 |
+
- Equation (6) shows mäcuïlli × ëyi = caxtölli, directly mapping multiplication of mäcuïlli and ëyi to form caxtölli, a component used in constructing 494 via multiplicative decomposition.
|
| 141 |
+
|
| 142 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `2`
|
| 146 |
+
|
| 147 |
+
- score: `1.0`
|
| 148 |
+
- exact: `1.0`
|
| 149 |
+
- final box valid: `True`
|
| 150 |
+
|
| 151 |
+
```text
|
| 152 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating multiplication of units with additive components.
|
| 153 |
+
- Equation (2) confirms cem-pöhualli × öme = öm-pöhualli, showing that cem-pöhualli × öme results in a term with only öm-pöhualli, implying öme acts as a multiplicative unit.
|
| 154 |
+
- Equation (4) mäcuïlli + öme = chicöme demonstrates that adding mäcuïlli and öme yields chicöme, establishing a core additive relationship.
|
| 155 |
+
- Equation (6) mäcuïlli × ëyi = caxtölli shows that multiplication produces a distinct morpheme, unlike addition, revealing multiplicative derivation rules.
|
| 156 |
+
- Equation (13) yë-tzontli-on-näuh-pöhualli-on-caxtölli-on-cë = ndamno establishes that tzontli, pöhualli, and caxtölli components are multiplicative units tied to specific values.
|
| 157 |
+
- Equation (14) cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba links cen-tzontli with cem-pöhualli and öme, showing that cen-tzontli units scale multiplicatively via known components.
|
| 158 |
+
|
| 159 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `3`
|
| 163 |
+
|
| 164 |
+
- score: `1.0`
|
| 165 |
+
- exact: `1.0`
|
| 166 |
+
- final box valid: `True`
|
| 167 |
+
|
| 168 |
+
```text
|
| 169 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, implying multiplication of compound terms follows a pattern where "on-cë" and "öme" are components tied to counts.
|
| 170 |
+
- Equation (2) confirms cem-pöhualli × öme = öm-pöhualli, indicating that multiplying cem-pöhualli by öme results in öm-pöhualli, establishing öme as a unit of 1.
|
| 171 |
+
- Equation (3) reveals that yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, showing addition of compound terms with additive structure tied to specific morphemes.
|
| 172 |
+
- Equation (5) demonstrates mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, supporting that multiplying a term containing ëyi yields a compound with cem-pöhualli and caxtölli, suggesting ëyi = 7.
|
| 173 |
+
- Equation (6) confirms mäcuïlli × ëyi = caxtölli, so if mäcuïlli × 7 = caxtölli, then mäcuïlli = 14 (since caxtölli is a known composite).
|
| 174 |
+
- Equation (14) states cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, and from (2), öme = 1, so the multiplier of mäcuïl-pöhualli is derived and tied to 42 via addition and multiplication patterns.
|
| 175 |
+
|
| 176 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `0`
|
| 180 |
+
|
| 181 |
+
- score: `1.0`
|
| 182 |
+
- exact: `1.0`
|
| 183 |
+
- final box valid: `True`
|
| 184 |
+
|
| 185 |
+
```text
|
| 186 |
+
- Equation (11) shows nimbo × fete = tarumba, indicating multiplicative composition where nimbo and fete produce tarumba.
|
| 187 |
+
- Equation (12) shows nimbo + yànparo tàxwo = yenówe tàxwo, establishing addition as a distinct operation from multiplication.
|
| 188 |
+
- Equation (9) shows yànparo tàxwo + fete asàr tàxwo = yànparo fete, implying that combining terms with tàxwo yields a compound with no tàxwo marker.
|
| 189 |
+
- Equation (10) shows yenówe × yenówe tàxwo = fete yenówe tàxwo, indicating that repeated multiplication produces a product with both fete and retained tàxwo.
|
| 190 |
+
- Equation (7) shows ngámbi + ngámbi = ngámbi × yànparo, asserting that addition of two ngámbi units equals multiplication involving yànparo.
|
| 191 |
+
- Equation (8) shows ngámbi + asàr = tambaroy, establishing a direct additive rule that produces a compound value.
|
| 192 |
+
|
| 193 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `1`
|
| 197 |
+
|
| 198 |
+
- score: `1.0`
|
| 199 |
+
- exact: `1.0`
|
| 200 |
+
- final box valid: `True`
|
| 201 |
+
|
| 202 |
+
```text
|
| 203 |
+
- Equation (11) shows nimbo × fete = tarumba, establishing a multiplication rule where nimbo and fete combine to form tarumba.
|
| 204 |
+
- Equation (12) shows nimbo + yànparo tàxwo = yenówe tàxwo, linking addition to a transformation involving yànparo and yenówe.
|
| 205 |
+
- Equation (9) states yànparo tàxwo + fete asàr tàxwo = yànparo fete, indicating that addition of components with tàxwo suffixes yields a product without the suffix.
|
| 206 |
+
- Equation (8) shows ngámbi + asàr = tambaroy, demonstrating that specific morphemes combine to form a compound unit.
|
| 207 |
+
- Equation (7) shows ngámbi + ngámbi = ngámbi × yànparo, indicating that doubling ngámbi results in a multiplication involving yànparo, implying ngámbi acts as a unit in multiplication.
|
| 208 |
+
- Equation (15) gives cen-tzontli = tarumba tambaroy fete asàr, which indicates tarumba, tambaroy, and fete asàr are additive components, supporting that tarumba = nimbo × fete from (11).
|
| 209 |
+
|
| 210 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `2`
|
| 214 |
+
|
| 215 |
+
- score: `1.0`
|
| 216 |
+
- exact: `1.0`
|
| 217 |
+
- final box valid: `True`
|
| 218 |
+
|
| 219 |
+
```text
|
| 220 |
+
- Equation (11) shows nimbo × fete = tarumba, indicating a multiplicative relationship between nimbo, fete, and tarumba.
|
| 221 |
+
- Equation (12) states nimbo + yànparo tàxwo = yenówe tàxwo, showing addition and a component structure with tàxwo.
|
| 222 |
+
- Equation (9) demonstrates yànparo tàxwo + fete asàr tàxwo = yànparo fete, confirming that combinations of elements with tàxwo yield a simplified form.
|
| 223 |
+
- Equation (10) reveals yenówe × yenówe tàxwo = fete yenówe tàxwo, indicating fete emerges from multiplication involving yenówe.
|
| 224 |
+
- Equation (13) links yë-tzontli-on-näuh-pöhualli-on-caxtölli-on-cë to ndamno, where cumulative components imply a recursive structure tied to counts.
|
| 225 |
+
- Equation (15) gives cen-tzontli = tarumba tambaroy fete asàr, showing tarumba, tambaroy, and fete are components of a base value corresponding to 1.
|
| 226 |
+
|
| 227 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `3`
|
| 231 |
+
|
| 232 |
+
- score: `1.0`
|
| 233 |
+
- exact: `1.0`
|
| 234 |
+
- final box valid: `True`
|
| 235 |
+
|
| 236 |
+
```text
|
| 237 |
+
- Equation (11) shows nimbo × fete = tarumba, indicating multiplication yields tarumba when nimbo and fete are combined.
|
| 238 |
+
- Equation (12) shows nimbo + yànparo tàxwo = yenówe tàxwo, establishing addition as a distinct operation from multiplication.
|
| 239 |
+
- Equation (9) shows yànparo tàxwo + fete asàr tàxwo = yànparo fete, demonstrating that adding a unit to a structured form produces a merged form.
|
| 240 |
+
- Equation (10) shows yenówe × yenówe tàxwo = fete yenówe tàxwo, indicating a multiplicative rule where yenówe and its version with tàxwo yield fete + yenówe tàxwo.
|
| 241 |
+
- Equation (13) equates a complex Nahuatl expression to ndamno, suggesting a known equivalent in Arammba that can be used to derive values.
|
| 242 |
+
- Equation (14) shows cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, linking a compound Nahuatl structure to yànparo tarumba, which appears in Arammba multiplication.
|
| 243 |
+
|
| 244 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 245 |
+
```
|
| 246 |
+
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_official_rules_act_uninformed_n4.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v11_official_rules_act_uninformed_n4.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Answer-Given Rationale Probe
|
| 2 |
+
|
| 3 |
+
- generated: `2026-07-11T23:38:24.533112+00:00`
|
| 4 |
+
- model: `Qwen/Qwen3-4B-Instruct-2507`
|
| 5 |
+
- data: `data/rl/ioling_qwen3_4b_manual_v11_clean_prompt`
|
| 6 |
+
- samples: `96` across `24` records
|
| 7 |
+
- exact final-box samples: `0.927`
|
| 8 |
+
- valid final-box samples: `0.927`
|
| 9 |
+
- truncation rate: `0.000`
|
| 10 |
+
- mean rationale chars: `1131.2`
|
| 11 |
+
|
| 12 |
+
## Per Record
|
| 13 |
+
|
| 14 |
+
| record | samples | exact boxes | valid boxes | best score | mean rationale chars |
|
| 15 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 16 |
+
| iol-2015-individual-p1-sub-b-atomic-b.1 | 4 | 4 | 4 | 1.000 | 925.0 |
|
| 17 |
+
| iol-2015-individual-p1-sub-b-atomic-b.2 | 4 | 4 | 4 | 1.000 | 1003.2 |
|
| 18 |
+
| iol-2015-individual-p1-sub-c-atomic-c.1 | 4 | 4 | 4 | 1.000 | 744.0 |
|
| 19 |
+
| iol-2015-individual-p1-sub-c-atomic-c.2 | 4 | 4 | 4 | 1.000 | 819.2 |
|
| 20 |
+
| iol-2016-individual-p3-sub-a-atomic-a.1 | 4 | 3 | 3 | 1.000 | 1223.5 |
|
| 21 |
+
| iol-2016-individual-p3-sub-a-atomic-a.2 | 4 | 4 | 4 | 1.000 | 1594.8 |
|
| 22 |
+
| iol-2016-individual-p3-sub-a-atomic-a.3 | 4 | 4 | 4 | 1.000 | 1230.0 |
|
| 23 |
+
| iol-2016-individual-p3-sub-a-atomic-a.4 | 4 | 4 | 4 | 1.000 | 1233.2 |
|
| 24 |
+
| iol-2016-individual-p3-sub-a-atomic-a.5 | 4 | 4 | 4 | 1.000 | 1072.8 |
|
| 25 |
+
| iol-2016-individual-p3-sub-b-atomic-b.1 | 4 | 2 | 2 | 1.000 | 1203.2 |
|
| 26 |
+
| iol-2016-individual-p3-sub-b-atomic-b.2 | 4 | 4 | 4 | 1.000 | 1293.5 |
|
| 27 |
+
| iol-2016-individual-p3-sub-b-atomic-b.3 | 4 | 3 | 3 | 1.000 | 1062.8 |
|
| 28 |
+
| iol-2016-individual-p3-sub-b-atomic-b.4 | 4 | 3 | 3 | 1.000 | 1264.5 |
|
| 29 |
+
| iol-2016-individual-p3-sub-b-atomic-b.5 | 4 | 3 | 3 | 1.000 | 1130.2 |
|
| 30 |
+
| iol-2021-individual-p3-sub-a-atomic-a.1 | 4 | 4 | 4 | 1.000 | 1293.0 |
|
| 31 |
+
| iol-2021-individual-p3-sub-a-atomic-a.2 | 4 | 4 | 4 | 1.000 | 1087.2 |
|
| 32 |
+
| iol-2021-individual-p3-sub-a-atomic-a.3 | 4 | 4 | 4 | 1.000 | 1089.5 |
|
| 33 |
+
| iol-2021-individual-p3-sub-a-atomic-a.4 | 4 | 4 | 4 | 1.000 | 1261.2 |
|
| 34 |
+
| iol-2021-individual-p3-sub-a-atomic-a.5 | 4 | 4 | 4 | 1.000 | 1093.8 |
|
| 35 |
+
| iol-2021-individual-p3-sub-b-atomic-b.1 | 4 | 4 | 4 | 1.000 | 1051.2 |
|
| 36 |
+
| iol-2021-individual-p3-sub-b-atomic-b.2 | 4 | 4 | 4 | 1.000 | 1208.8 |
|
| 37 |
+
| iol-2021-individual-p3-sub-b-atomic-b.3 | 4 | 4 | 4 | 1.000 | 1093.8 |
|
| 38 |
+
| iol-2021-individual-p3-sub-b-atomic-b.4 | 4 | 4 | 4 | 1.000 | 1119.8 |
|
| 39 |
+
| iol-2021-individual-p3-sub-b-atomic-b.5 | 4 | 3 | 3 | 1.000 | 1050.2 |
|
| 40 |
+
|
| 41 |
+
## Sample Outputs
|
| 42 |
+
|
| 43 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `0`
|
| 44 |
+
|
| 45 |
+
- score: `1.0`
|
| 46 |
+
- exact: `1.0`
|
| 47 |
+
- final box valid: `True`
|
| 48 |
+
|
| 49 |
+
```text
|
| 50 |
+
- Equation (1) shows that mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, indicating that cë acts as a unit multiplier for 20, aligning with pöhualli as a base unit.
|
| 51 |
+
- Equation (2) demonstrates cem-pöhualli × öme = öm-pöhualli, showing öme functions as a multiplicative factor of 20, consistent with pöhualli as a 20-based unit.
|
| 52 |
+
- Equation (3) reveals yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, showing that nähui is a component in addition that integrates with multiplicative units.
|
| 53 |
+
- Equation (4) states mäcuïlli + öme = chicöme, confirming that mäcuïlli (a 10-unit) combines with öme (a 20-unit) to form a compound value, supporting a 20-based numeral system with additive components.
|
| 54 |
+
- Equation (5) shows mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, indicating that mahtlactli (base unit) multiplied by ëyi (a 400-unit multiplier) produces a structure with tzontli and caxtölli, confirming 400 as a unit for 10-fold increments.
|
| 55 |
+
- Equation (13) establishes yë-tzontli-on-näuh-pöhualli-on-caxtölli-on-cë = ndamno, where 1296 = 3×400 + 4×20 + (15+1), confirming that 400 and 20 are fundamental units used in representing larger numbers.
|
| 56 |
+
|
| 57 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `1`
|
| 61 |
+
|
| 62 |
+
- score: `1.0`
|
| 63 |
+
- exact: `1.0`
|
| 64 |
+
- final box valid: `True`
|
| 65 |
+
|
| 66 |
+
```text
|
| 67 |
+
- Equation (1) shows that 20 × cë = mäcuïl-pöhualli-om-mahtlactli, supporting 20 as a base unit in the numeral system.
|
| 68 |
+
- Equation (2) demonstrates that cem-pöhualli × öme = öm-pöhualli, indicating that öme doubles a unit when combined with cem-pöhualli.
|
| 69 |
+
- Equation (3) reveals that yë-pöhualli-on-chicöme + mahtlactli-on-nähui produces näuh-pöhualli-on-cë, confirming the additive structure with nähui as a component.
|
| 70 |
+
- Equation (4) shows mäcuïlli + öme = chicöme, establishing that mäcuïlli and öme combine to form a compound numeral unit.
|
| 71 |
+
- Equation (5) exhibits mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, confirming that multiplication of mahtlactli-om-ëyi by ëyi yields a compound with caxtölli.
|
| 72 |
+
- Equation (13) shows 10 + 1 = 11 × 10 = 110, with 13 × 3 = 39 and 3 × 400 + 4 × 20 + (15 + 1) = 1296, confirming the base-400 system where 400 is tzontli and 20 is pöhualli.
|
| 73 |
+
|
| 74 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `2`
|
| 78 |
+
|
| 79 |
+
- score: `1.0`
|
| 80 |
+
- exact: `1.0`
|
| 81 |
+
- final box valid: `True`
|
| 82 |
+
|
| 83 |
+
```text
|
| 84 |
+
- Equation (1) shows that 20 × 20 = 400, supporting that pöhualli corresponds to 20 in the Nahuatl base system.
|
| 85 |
+
- Equation (2) demonstrates öme × 20 = pöhualli, confirming öme = 1 and pöhualli = 20.
|
| 86 |
+
- Equation (4) states mäcuïlli + öme = chicöme; with öme = 1, mäcuïlli = 19, so 19 + 1 = 20, indicating a hybrid base system.
|
| 87 |
+
- In equation (13), 10 + 1 = 11, mapped as 1 × 400 + 1 × 20 + (10 + 2), validating that 400 = 10 × 40 and 20 = 1 × 20.
|
| 88 |
+
- 42 = 2 × 20 + 2, directly derived from 2 × 20 = 40 and 40 + 2 = 42, matching the known form öm-pöhualli-om-öme.
|
| 89 |
+
- In equation (14), 432 = 1 × 400 + 1 × 20 + (10 + 2), confirming the additive structure with 400, 20, and remainder, consistent with 42’s decomposition.
|
| 90 |
+
|
| 91 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.1` sample `3`
|
| 95 |
+
|
| 96 |
+
- score: `1.0`
|
| 97 |
+
- exact: `1.0`
|
| 98 |
+
- final box valid: `True`
|
| 99 |
+
|
| 100 |
+
```text
|
| 101 |
+
- Equation (1) shows that 20 × 20 = 400, and mäcuïl-pöhualli-om-mahtlactli corresponds to 400, confirming the base unit of 20.
|
| 102 |
+
- Equation (2) demonstrates that cem-pöhualli × öme = öm-pöhualli, showing öme as a unit value of 20, and the inversion rule for multiplication.
|
| 103 |
+
- Equation (13) confirms that 1296 = 3×400 + 4×20 + (15+1), establishing that 400 and 20 are base values in the system.
|
| 104 |
+
- In equation (4), mäcuïlli + öme = chicöme, indicating that 20 + 1 = 21 is not simple addition, and full decomposition requires context from multiplication tables.
|
| 105 |
+
- Equation (5) shows mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, indicating that 20×20 = 400 and 1×20 = 20 are embedded in compound multiplicative terms.
|
| 106 |
+
- The structure öm-pöhualli-om-öme appears in (2), where öme = 20, and the pattern 2×20 + 2 matches the decomposition of 42 as 2×20 + 2.
|
| 107 |
+
|
| 108 |
+
\boxed{b.1: öm-pöhualli-om-öme}
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `0`
|
| 112 |
+
|
| 113 |
+
- score: `1.0`
|
| 114 |
+
- exact: `1.0`
|
| 115 |
+
- final box valid: `True`
|
| 116 |
+
|
| 117 |
+
```text
|
| 118 |
+
- Equation (1) shows that mahtlactli-on-cë × mahtlactli yields mäcuïl-pöhualli-om-mahtlactli, aligning number decomposition where cë (1) and mahtlactli (20) form a multiplicative base.
|
| 119 |
+
- Equation (3) confirms yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë; here, the addition of 400 and 8000 units with nähui (4) and cë (1) indicates that 400 + 4 = 404 maps to tzontli-on-nähui.
|
| 120 |
+
- Equation (5) demonstrates mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, establishing that mahtlactli (20) × ëyi (1) yields a result with caxtölli (400), proving that 20 × 1 = 20 gives the component caxtölli-on-nähui.
|
| 121 |
+
- From equation (14), cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, and given that tarumba = 216, correspondence between 1×400 + 4×20 + 10 + 4 = 494 and the base structure confirms the required syntactic order.
|
| 122 |
+
- In equation (15), cen-tzontli = tarumba tambaroy fete asàr, where 400 → cen-tzontli and 216 + 36 + 4 = 256, but 400 alone is 400, verifying that units are expressed as base-20 units with additive supplements.
|
| 123 |
+
- Equation (13) shows yë-tzontli-on-näuh-pöhualli-on-caxtölli-on-cë = ndamno, and 1296 = 3×400 + 4×20 + (15+1) = 1200 + 80 + 16 = 1296, validating the decomposition of 494 as 1×400 + 4×20 + 10 + 4 with components on-nähui and on-pöhualli.
|
| 124 |
+
|
| 125 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `1`
|
| 129 |
+
|
| 130 |
+
- score: `1.0`
|
| 131 |
+
- exact: `1.0`
|
| 132 |
+
- final box valid: `True`
|
| 133 |
+
|
| 134 |
+
```text
|
| 135 |
+
- Equation (14) shows that 432 = 1×400 + 1×20 + (10+2), mapping to cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui via consistent digit positioning and additive rule.
|
| 136 |
+
- The structure of 494 = 1×400 + 4×20 + 10 + 4 mirrors the pattern in (13) and (14), where 400 is represented by tzontli and 20 by pöhualli.
|
| 137 |
+
- In (15), 400 = 1×400 confirms that the base 400 value is always cen-tzontli, maintaining consistency in magnitude and form.
|
| 138 |
+
- Equation (3) demonstrates that adding units to a base like pöhualli with a base of 20 requires attaching -on- and incrementing the suffix, supporting the -on- linkage in derived forms.
|
| 139 |
+
- The decomposition 494 = 400 + 180 + 14 matches the additive pattern in (9) and (10), where 180 = 4×20 + 10 and 14 = 10 + 4, enforcing correct morpheme ordering.
|
| 140 |
+
- In (16), 8000 = 1×8000 shows that xiquipilli is a fixed base, linked to 8000, ensuring that 494’s part 4×20 + 10 aligns with pöhualli and nähui despite the larger base.
|
| 141 |
+
|
| 142 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `2`
|
| 146 |
+
|
| 147 |
+
- score: `1.0`
|
| 148 |
+
- exact: `1.0`
|
| 149 |
+
- final box valid: `True`
|
| 150 |
+
|
| 151 |
+
```text
|
| 152 |
+
- Equation (1) shows mahtlactli-on-cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, confirming cë represents 20 and mahtlactli represents 1.
|
| 153 |
+
- Equation (2) shows cem-pöhualli × öme = öm-pöhualli, supporting öme as 1 and cem as 20.
|
| 154 |
+
- Equation (3) reveals yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, indicating nähui = 100 and cë = 20.
|
| 155 |
+
- Equation (5) demonstrates mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, showing ëyi = 2 and caxtölli = 10.
|
| 156 |
+
- Equation (14) establishes cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, where tarumba = 216 = 6³, supporting 1×400 + 1×20 + (10+2) = 432.
|
| 157 |
+
- Equation (15) shows cen-tzontli = tarumba tambaroy fete asàr, confirming 400 = 1×400, consistent with base 1 and units in 100s, 20s, and units.
|
| 158 |
+
|
| 159 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
### `iol-2015-individual-p1-sub-b-atomic-b.2` sample `3`
|
| 163 |
+
|
| 164 |
+
- score: `1.0`
|
| 165 |
+
- exact: `1.0`
|
| 166 |
+
- final box valid: `True`
|
| 167 |
+
|
| 168 |
+
```text
|
| 169 |
+
- Equation (1) shows that cë × mahtlactli = mäcuïl-pöhualli-om-mahtlactli, confirming that cë acts as a unit multiplier in multiplication.
|
| 170 |
+
- Equation (3) reveals yë-pöhualli-on-chicöme + mahtlactli-on-nähui = näuh-pöhualli-on-cë, indicating that nähui combines with mahtlactli in additive formation.
|
| 171 |
+
- Equation (4) establishes mäcuïlli + öme = chicöme, showing öme is a direct additive component in compound numbers.
|
| 172 |
+
- Equation (5) demonstrates mahtlactli-om-ëyi × ëyi = cem-pöhualli-on-caxtölli-on-nähui, linking caxtölli to multiplication involving mahtlactli and ëyi.
|
| 173 |
+
- Equation (14) shows cen-tzontli-on-cem-pöhualli-om-mahtlactli-om-öme = yànparo tarumba, mapping 42 to öm-pöhualli-om-öme and confirming the structure for units of 400 and 20.
|
| 174 |
+
- Equation (16) confirms cen-xiquipilli = weremeke tarumba nimbo yànparo, revealing xiquipilli as 8000 and anchoring the decomposition of 494 as 400 + 80 + 10 + 4.
|
| 175 |
+
|
| 176 |
+
\boxed{b.2: cen-tzontli-on-näuh-pöhualli-om-mahtlactli-on-nähui.}
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `0`
|
| 180 |
+
|
| 181 |
+
- score: `1.0`
|
| 182 |
+
- exact: `1.0`
|
| 183 |
+
- final box valid: `True`
|
| 184 |
+
|
| 185 |
+
```text
|
| 186 |
+
- Equation (11) shows 6³ = 216 = tarumba, establishing that 216 corresponds to tarumba in Arammba.
|
| 187 |
+
- Equation (9) demonstrates that 36 + 4×6 = 60 + 36 = 96, but 6² = 36, confirming that fete = 6².
|
| 188 |
+
- Equation (8) shows ngámbi + asàr = tambaroy, and since 6² = 36 and 6⁰ = 1, asàr = 6, thus asàr = 6.
|
| 189 |
+
- Equation (12) shows nimbo + yànparo tàxwo = yenówe tàxwo, indicating nimbo = 6, as 6×1 = 6.
|
| 190 |
+
- Equation (15) reveals tarumba tambaroy fete asàr = 400 + 216 + 36 + 6, matching 43 = 36 + 6 + 1.
|
| 191 |
+
- In equation (14), 432 = 400 + 32 yields 400 + 36 + (4×6) = 1×400 + 36 + 24 = 1×400 + 6×6, confirming 43 = 36 + 6 + 1.
|
| 192 |
+
|
| 193 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `1`
|
| 197 |
+
|
| 198 |
+
- score: `1.0`
|
| 199 |
+
- exact: `1.0`
|
| 200 |
+
- final box valid: `True`
|
| 201 |
+
|
| 202 |
+
```text
|
| 203 |
+
- Equation (11) shows that 6³ = 216 corresponds to tarumba, establishing that 36 → fete and 216 → tarumba.
|
| 204 |
+
- Equation (9) proves that α × 6β + δ with α=1, β=2, δ=4 yields fete yànparo, supporting base-6 expansion.
|
| 205 |
+
- Equation (7) confirms ngámbi + ngámbi = ngámbi × yànparo, showing ngámbi acts as a unit with multiplicative identity.
|
| 206 |
+
- Equation (15) confirms 400 = 1×400, indicating 400 is a base unit in the Arammba numeral system.
|
| 207 |
+
- Equation (14) verifies 432 = 1×400 + 1×20 + (10+2), matching 432 = 400 + 20 + 12, implying 43 = 36 + 6 + 1.
|
| 208 |
+
- The decomposition 43 = 36 + 6 + 1 maps to fete (6²), nimbo (6¹), and ngámbi (1), aligning with (c) derivation via additive structuring.
|
| 209 |
+
|
| 210 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `2`
|
| 214 |
+
|
| 215 |
+
- score: `1.0`
|
| 216 |
+
- exact: `1.0`
|
| 217 |
+
- final box valid: `True`
|
| 218 |
+
|
| 219 |
+
```text
|
| 220 |
+
- Equation (10) shows that yenówe × yenówe tàxwo = fete yenówe tàxwo, indicating fete is the product of yenówe × yenówe in a specific structure.
|
| 221 |
+
- Equation (11) confirms nimbo × fete = tarumba, establishing that tarumba is derived from nimbo and fete.
|
| 222 |
+
- Equation (12) shows nimbo + yànparo tàxwo = yenówe tàxwo, linking nimbo, yànparo, and yenówe via addition.
|
| 223 |
+
- Equation (9) demonstrates yànparo tàxwo + fete asàr tàxwo = yànparo fete, showing that fete asàr tàxwo is a component added to yànparo tàxwo.
|
| 224 |
+
- Equation (14) supports 432 = 1×400 + 1×20 + (10 + 2), which maps to 43 in the form of 36 + 6 + 1, corresponding to fete, nimbo, and ngámbi.
|
| 225 |
+
- The decomposition 43 = 36 + 6 + 1 aligns with the Arammba numeral system where 36 = fete, 6 = nimbo, and 1 = ngámbi, as verified by the consistent structure in the examples.
|
| 226 |
+
|
| 227 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
### `iol-2015-individual-p1-sub-c-atomic-c.1` sample `3`
|
| 231 |
+
|
| 232 |
+
- score: `1.0`
|
| 233 |
+
- exact: `1.0`
|
| 234 |
+
- final box valid: `True`
|
| 235 |
+
|
| 236 |
+
```text
|
| 237 |
+
- Equation (9) shows that 1 + 1 = 1 × 2 in Arammba, establishing that fete (6²) is the base unit for multiplicative expressions.
|
| 238 |
+
- Equation (11) confirms 6³ = 216 corresponds to tarumba, indicating that powers of 6 define core numerals in Arammba.
|
| 239 |
+
- Equation (12) demonstrates that nimbo + yànparo tàxwo = yenówe tàxwo, showing that nimbo (6⁺¹) functions as a subunit in additive combinations.
|
| 240 |
+
- Equation (7) establishes that ngámbi + ngámbi = ngámbi × yànparo, proving ngámbi is a unit that combines multiplicatively via yànparo.
|
| 241 |
+
- 43 = 36 + 6 + 1 corresponds to fete (6²) + nimbo (6¹) + ngámbi (6⁰), directly matching the breakdown in the provided arithmetic.
|
| 242 |
+
- The additive construction in equation (9) and the multiplicative rules in equations (7) and (8) confirm the pattern α × 6β + δ is used to derive numeral forms.
|
| 243 |
+
|
| 244 |
+
\boxed{c.1: fete nimbo ngámbi}
|
| 245 |
+
```
|
| 246 |
+
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_derivation_n8.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_derivation_n8.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Answer-Given Rationale Probe
|
| 2 |
+
|
| 3 |
+
- generated: `2026-07-12T02:13:14.932209+00:00`
|
| 4 |
+
- model: `Qwen/Qwen3-4B-Instruct-2507`
|
| 5 |
+
- data: `data/rl/ioling_qwen3_4b_manual_v14_expanded_clean`
|
| 6 |
+
- samples: `32` across `4` records
|
| 7 |
+
- exact final-box samples: `1.000`
|
| 8 |
+
- valid final-box samples: `1.000`
|
| 9 |
+
- truncation rate: `0.000`
|
| 10 |
+
- mean rationale chars: `922.8`
|
| 11 |
+
|
| 12 |
+
## Per Record
|
| 13 |
+
|
| 14 |
+
| record | samples | exact boxes | valid boxes | best score | mean rationale chars |
|
| 15 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 16 |
+
| iol-2017-individual-p3-sub-a-atomic-a.2 | 8 | 8 | 8 | 1.000 | 979.9 |
|
| 17 |
+
| iol-2017-individual-p3-sub-a-atomic-a.3 | 8 | 8 | 8 | 1.000 | 901.6 |
|
| 18 |
+
| iol-2018-individual-p2-sub-a-atomic-a.5 | 8 | 8 | 8 | 1.000 | 886.5 |
|
| 19 |
+
| iol-2018-individual-p3-sub-a-atomic-a.5 | 8 | 8 | 8 | 1.000 | 923.1 |
|
| 20 |
+
|
| 21 |
+
## Sample Outputs
|
| 22 |
+
|
| 23 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `0`
|
| 24 |
+
|
| 25 |
+
- score: `1.0`
|
| 26 |
+
- exact: `1.0`
|
| 27 |
+
- final box valid: `True`
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
- The phrase ʒìtéténbwá 'stars' is plural, established by the noun-class marker ʒì- from the plural form in item 4, where múdjúlù mwálà ʒìtéténbwà means "There are stars in the sky".
|
| 31 |
+
- The verb ʒjálà is a plural present tense form meaning "are", verified in item 4 where mùdjúlù ʒìtéténbwà is a statement of existence with the same structure.
|
| 32 |
+
- In item 13, the word order ʒìtéténbwá ʒjálà mùdjúlù mirrors the construction of item 4, where existence is marked by verb placement after the subject and place.
|
| 33 |
+
- The place phrase mùdjúlù 'in the sky' is structurally consistent with item 4, where it appears after the verb in a statement of existence.
|
| 34 |
+
- The derived English translation "There are stars in the sky" matches the established pattern of subject-verb-place order with plural noun-class concord.
|
| 35 |
+
- The low tone at the end of the sentence aligns with a declarative statement, as contrasted with questions in items 6 and 10, where high tone marks interrogative syntax.
|
| 36 |
+
|
| 37 |
+
\boxed{a.2: There are stars in the sky.}
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `1`
|
| 41 |
+
|
| 42 |
+
- score: `1.0`
|
| 43 |
+
- exact: `1.0`
|
| 44 |
+
- final box valid: `True`
|
| 45 |
+
|
| 46 |
+
```text
|
| 47 |
+
- The phrase ʒìtéténbwá 'stars' appears in plural noun-class form with ʒì-, confirmed by item 4 where múdjúlù mwálà ʒìtéténbwà indicates "There are stars in the sky."
|
| 48 |
+
- In item 13, ʒìtéténbwá is not modified by a possessive, showing it functions as an unpossessed plural noun independent of possessive pronouns.
|
| 49 |
+
- Place phrase mùdjúlù 'in the sky' follows the verb ʒjálà 'are', aligning with the fronting rule where X V L = L V X, as seen in item 4 and 8.
|
| 50 |
+
- The verb ʒjálà used in 13 is equivalent to ʒjálà in item 2, indicating "are" in the plural and used as a copula in statements.
|
| 51 |
+
- The final tone of ʒìtéténbwá is low, assimilating to the first tone of ʒjálà, consistent with the tonal rule that the last tone of a word matches the first tone of the next.
|
| 52 |
+
- The structure ʒìtéténbwá ʒjálà mùdjúlù mirrors item 4's "There are stars in the sky," confirming that "are" is the copula and the place phrase is post-verbal.
|
| 53 |
+
|
| 54 |
+
\boxed{a.2: There are stars in the sky.}
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `2`
|
| 58 |
+
|
| 59 |
+
- score: `1.0`
|
| 60 |
+
- exact: `1.0`
|
| 61 |
+
- final box valid: `True`
|
| 62 |
+
|
| 63 |
+
```text
|
| 64 |
+
- The word ʒìtéténbwá functions as a plural verb "are" in the context of existential presence, confirmed by its use in "There are stars in the sky" (sentence 4).
|
| 65 |
+
- The phrase mùdjúlù 'in the sky' appears as a place expression with the prefix mú-, consistent with place phrases in Kimbundu carrying the mù- prefix.
|
| 66 |
+
- In sentence 4, "There are stars in the sky" uses the structure L V X (place-verb-subject), validated by example 8 and 9 where place phrases follow the verb core.
|
| 67 |
+
- The verb ʒìtéténbwá in sentence 13 is not conjugated for person, indicating a general existential or state verb, matching the structure of "There are" in sentence 4.
|
| 68 |
+
- The word order ʒìtéténbwá ʒjálà mùdjúlù follows the pattern of place-fronting (L V X), directly mirrored in sentence 4 and sentence 10.
|
| 69 |
+
- Tone contrast confirms the low tone at the end of ʒìtéténbwá and the high tone of ʒjálà, aligning with the rule that sentence-final tone indicates questions, but in this case the sentence is declarative, so final tone must be low, contradicting the presence of high tone in the question form.
|
| 70 |
+
|
| 71 |
+
\boxed{a.2: There are stars in the sky.}
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `3`
|
| 75 |
+
|
| 76 |
+
- score: `1.0`
|
| 77 |
+
- exact: `1.0`
|
| 78 |
+
- final box valid: `True`
|
| 79 |
+
|
| 80 |
+
```text
|
| 81 |
+
- The phrase ʒìtéténbwá 'stars' is plural, requiring the noun-class prefix ʒì- and matching the plural class in the noun-concord system.
|
| 82 |
+
- The verb ʒjálà functions as "are" and agrees in class with the plural noun ʒìtéténbwá, confirming a plural state in the sentence.
|
| 83 |
+
- The place phrase mùdjúlù 'in the sky' appears after the verb, aligning with the option of placing the location at the end of the sentence.
|
| 84 |
+
- A fronted place phrase like "in the sky" is grammatically valid in Kimbundu, where X V L is syntactically equivalent to L V X.
|
| 85 |
+
- The sentence structure "are stars in the sky" matches the English translation of the word order and grammar from example 4: "mùdjúlù mwálà ʒìtéténbwà — There are stars in the sky."
|
| 86 |
+
- The tone pattern shows a low final tone indicating a declarative statement, consistent with the lack of question markers or interrogative markers in the sentence.
|
| 87 |
+
|
| 88 |
+
\boxed{a.2: There are stars in the sky.}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `4`
|
| 92 |
+
|
| 93 |
+
- score: `1.0`
|
| 94 |
+
- exact: `1.0`
|
| 95 |
+
- final box valid: `True`
|
| 96 |
+
|
| 97 |
+
```text
|
| 98 |
+
- The phrase ʒìtéténbwá 'stars' is plural, matching the plural noun-class marker ʒì- in Kimbundu, confirming its use in place-based statements.
|
| 99 |
+
- The verb ʒjálà 'are' functions as a linking verb, structurally equivalent to the verb in "There are stars in the sky," supporting the existential interpretation.
|
| 100 |
+
- The place phrase mùdjúlù 'in the sky' follows the standard pattern of being postposed after the verb, consistent with the grammatical order of subject-verb-place.
|
| 101 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" means "There are stars in the sky," directly establishing the lexical and syntactic pattern of existential constructions.
|
| 102 |
+
- The verb ʒjálà is in a finite state with a low tone, as required for declarative statements, contrasting with high-tone verbs in questions.
|
| 103 |
+
- The structure ʒìtéténbwá ʒjálà mùdjúlù mirrors sentence 4's form and order, showing consistent alignment between word order and semantic content in existential clauses.
|
| 104 |
+
|
| 105 |
+
\boxed{a.2: There are stars in the sky.}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `5`
|
| 109 |
+
|
| 110 |
+
- score: `1.0`
|
| 111 |
+
- exact: `1.0`
|
| 112 |
+
- final box valid: `True`
|
| 113 |
+
|
| 114 |
+
```text
|
| 115 |
+
- The phrase ʒìtéténbwá ʒjálà mùdjúlù follows a place-fronting pattern where the location mùdjúlù 'in the sky' appears before the verb phrase.
|
| 116 |
+
- In sentence 4, mùdjúlù mwálà ʒìtéténbwà demonstrates that "in the sky" precedes the verb "there are stars" when used as a location marker.
|
| 117 |
+
- The verb ʒjálà in ʒìtéténbwá ʒjálà mùdjúlù matches the structure of "are" in sentence 4, where the copula is used with a plural noun to indicate existence.
|
| 118 |
+
- The noun ʒìtéténbwá in the target matches the plural form of "star" in sentence 4, where "stars" is marked with the plural class -ʒì- and is not singular.
|
| 119 |
+
- The tonal pattern shows that the final tone of ʒìtéténbwá is low, consistent with a statement, not a question, supporting a declarative translation.
|
| 120 |
+
- Sentence 13 contrasts with sentence 10, both using place phrases with the same structure, confirming that the verb "are" (ʒjálà) applies to the plural noun "stars" in a locative context.
|
| 121 |
+
|
| 122 |
+
\boxed{a.2: There are stars in the sky.}
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `6`
|
| 126 |
+
|
| 127 |
+
- score: `1.0`
|
| 128 |
+
- exact: `1.0`
|
| 129 |
+
- final box valid: `True`
|
| 130 |
+
|
| 131 |
+
```text
|
| 132 |
+
- The phrase ʒìtéténbwá 'stars' is plural, confirmed by the noun class ʒì- in ʒìtéténbwá, matching the plural marker in ʒìtéténbwá ʒjálà mùdjúlù.
|
| 133 |
+
- The verb ʒjálà means "are" and is used in a descriptive statement, as in ʒìtéténbwá ʒjálà mùdjúlù, which translates to "There are stars in the sky."
|
| 134 |
+
- The place phrase mùdjúlù 'in the sky' is not fronted and remains at the end, aligning with standard word order where place is post-verbal in descriptive sentences.
|
| 135 |
+
- The tone pattern shows a low final tone in the statement, consistent with declarative sentences as opposed to questions, proving it is not a query.
|
| 136 |
+
- The structure "NOUN VERB PLACE" matches the known pattern in sentence 4, "mùdjúlù mwálà ʒìtéténbwà — There are stars in the sky."
|
| 137 |
+
- The verb ʒjálà is grammatically parallel to ʒìtéténbwá in construction, verifying it functions as a copula in possessive or state descriptions.
|
| 138 |
+
|
| 139 |
+
\boxed{a.2: There are stars in the sky.}
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `7`
|
| 143 |
+
|
| 144 |
+
- score: `1.0`
|
| 145 |
+
- exact: `1.0`
|
| 146 |
+
- final box valid: `True`
|
| 147 |
+
|
| 148 |
+
```text
|
| 149 |
+
- In sentence 4, "mùdjúlù ʒìtéténbwà" means "There are stars in the sky", confirming that "mùdjúlù" is the place phrase and "ʒìtéténbwà" is the plural noun for stars.
|
| 150 |
+
- In sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù" mirrors sentence 4's structure but with place fronting: place phrase "mùdjúlù" moves to the end, showing that place can be fronted without altering meaning.
|
| 151 |
+
- Sentence 4 uses "ʒìtéténbwà" as a plural noun (class ʒì-) and "mùdjúlù" as the place, directly supporting the interpretation of "ʒìtéténbwá" as "stars" in plural.
|
| 152 |
+
- Sentence 13's word order "ʒìtéténbwá ʒjálà mùdjúlù" parallels the statement in (a)13, where "are" (ʒjálà) is used with the noun and place, confirming that "ʒjálà" is the verb "to be" in present tense.
|
| 153 |
+
- The tone pattern in sentence 4 ends with a low tone, indicating a statement, while sentence 10 (question) ends with a high tone, establishing tone as a reliability marker for question vs. statement.
|
| 154 |
+
- In sentence 5, "djámí djáʃíkà" implies "sang and danced" with verb sequence indicating action order, supporting that verb placement and sequence reflect event progression in Kimbundu.
|
| 155 |
+
|
| 156 |
+
\boxed{a.2: There are stars in the sky.}
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `0`
|
| 160 |
+
|
| 161 |
+
- score: `1.0`
|
| 162 |
+
- exact: `1.0`
|
| 163 |
+
- final box valid: `True`
|
| 164 |
+
|
| 165 |
+
```text
|
| 166 |
+
- The word ŋgákínà contains the ŋg- prefix, which denotes first-person singular subject in Kimbundu.
|
| 167 |
+
- The root kínà directly corresponds to "dance" based on parallel forms like djámí (sang) and djáʃíkà (danced) in example 5.
|
| 168 |
+
- Example 5 shows djáʃíkà meaning "danced," confirming that kínà is a distinct verb form for "to dance."
|
| 169 |
+
- The absence of a place or object in ŋgákínà aligns with the standalone verb structure where first-person subject is implied.
|
| 170 |
+
- In example 6, ŋgámónà dìkúŋgú djámí is a question, while ŋgákínà has a low final tone—indicating a declarative statement.
|
| 171 |
+
- The low tone at the end of ŋgákínà, consistent with declarative sentence tone rules, confirms it is not a question.
|
| 172 |
+
|
| 173 |
+
\boxed{a.3: I danced.}
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `1`
|
| 177 |
+
|
| 178 |
+
- score: `1.0`
|
| 179 |
+
- exact: `1.0`
|
| 180 |
+
- final box valid: `True`
|
| 181 |
+
|
| 182 |
+
```text
|
| 183 |
+
- The root kínà means "dance" and appears in sentence 3 where ŋgádjà dìhónʒó djámì translates to "I ate my banana", showing that kínà is a standalone verb.
|
| 184 |
+
- The form ŋgákínà uses the first-person singular prefix ŋg- as seen in sentence 1, where ŋgámónà means "I saw", establishing ŋg- as subject marker for "I".
|
| 185 |
+
- In sentence 5, "dìkámbá djámí djáʃíkà nì djákínà", "djákínà" appears in a list of actions with "sang and danced", confirming "kínà" as the verb for "dance" in a compound sequence.
|
| 186 |
+
- The word ŋgákínà lacks a place or object and is structured as subject-verb, matching the pattern of declarative statements in items like 1 and 7.
|
| 187 |
+
- The absence of tone markers in the given form implies a low-final tone, consistent with declarative statements, as contrasted with question sentences like 10 and 11 which have high final tones.
|
| 188 |
+
- Comparing to sentence 13, where ʒìtéténbwá ʒjálà mùdjúlù translates to "There are stars in the sky", the verb form ʒìtéténbwá is a separate clause; thus, ŋgákínà must be a simple declarative "I danced" with no additional elements.
|
| 189 |
+
|
| 190 |
+
\boxed{a.3: I danced.}
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `2`
|
| 194 |
+
|
| 195 |
+
- score: `1.0`
|
| 196 |
+
- exact: `1.0`
|
| 197 |
+
- final box valid: `True`
|
| 198 |
+
|
| 199 |
+
```text
|
| 200 |
+
- The word ŋgákínà contains the first-person singular prefix ŋg- indicating "I" and the verb root kínà meaning "dance".
|
| 201 |
+
- In sentence 3, "ĩgádjà dìhónʒó djámì" shows "I ate my banana", confirming that ŋg- with a verb root forms first-person actions.
|
| 202 |
+
- The absence of a place or object in ŋgákínà suggests a simple statement about a first-person action without additional context.
|
| 203 |
+
- Comparing to sentence 5, "dìkámbá djámí djáʃíkà nì djákínà" where "djákínà" appears with a high tone and separate from others, confirms kínà as a standalone verb.
|
| 204 |
+
- The low tone at the end of ŋgákínà matches the sentence-final low tone in declarative statements, as seen in sentence 1, which ends with a low tone.
|
| 205 |
+
- Unlike interrogative forms in 10 and 11, which begin with "Did", ŋgákínà lacks a question prefix, confirming it is a declarative sentence.
|
| 206 |
+
|
| 207 |
+
\boxed{a.3: I danced.}
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `3`
|
| 211 |
+
|
| 212 |
+
- score: `1.0`
|
| 213 |
+
- exact: `1.0`
|
| 214 |
+
- final box valid: `True`
|
| 215 |
+
|
| 216 |
+
```text
|
| 217 |
+
- The root kínà means "dance" and appears in the verb form ŋgákínà, where ŋg- indicates first-person singular subject.
|
| 218 |
+
- In sentence 3, ŋgádjà dìhónʒó djámì means "I ate my banana," confirming ŋg- as first-person singular with a verb meaning "to eat."
|
| 219 |
+
- The verb form kínà in ŋgákínà matches the translation of "I danced" based on parallel structure with ŋgámónà in sentence 1 meaning "I saw."
|
| 220 |
+
- In sentence 5, dìkámbá djámí djáʃíkà nì djákínà shows "sang and danced," where djákínà is a separate verb, indicating that kínà is a distinct verb for "dance."
|
| 221 |
+
- Sentence 6, ŋgámónà dìkúŋgú djámí, asks "Did I see my cave?" confirming that ŋg- marks first-person subject and negates the action, showing verb alignment with subject.
|
| 222 |
+
- The final tone is low, indicating a declarative sentence, consistent with the declarative nature of "I danced" and contrasting with high-tone questions like in item 11.
|
| 223 |
+
|
| 224 |
+
\boxed{a.3: I danced.}
|
| 225 |
+
```
|
| 226 |
+
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_rules_n8.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_exact_trace_repair_manual_rules_n8.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Answer-Given Rationale Probe
|
| 2 |
+
|
| 3 |
+
- generated: `2026-07-12T02:11:16.347619+00:00`
|
| 4 |
+
- model: `Qwen/Qwen3-4B-Instruct-2507`
|
| 5 |
+
- data: `data/rl/ioling_qwen3_4b_manual_v14_expanded_clean`
|
| 6 |
+
- samples: `32` across `4` records
|
| 7 |
+
- exact final-box samples: `1.000`
|
| 8 |
+
- valid final-box samples: `1.000`
|
| 9 |
+
- truncation rate: `0.000`
|
| 10 |
+
- mean rationale chars: `1204.1`
|
| 11 |
+
|
| 12 |
+
## Per Record
|
| 13 |
+
|
| 14 |
+
| record | samples | exact boxes | valid boxes | best score | mean rationale chars |
|
| 15 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 16 |
+
| iol-2017-individual-p3-sub-a-atomic-a.2 | 8 | 8 | 8 | 1.000 | 1180.4 |
|
| 17 |
+
| iol-2017-individual-p3-sub-a-atomic-a.3 | 8 | 8 | 8 | 1.000 | 1176.0 |
|
| 18 |
+
| iol-2018-individual-p2-sub-a-atomic-a.5 | 8 | 8 | 8 | 1.000 | 1166.4 |
|
| 19 |
+
| iol-2018-individual-p3-sub-a-atomic-a.5 | 8 | 8 | 8 | 1.000 | 1293.6 |
|
| 20 |
+
|
| 21 |
+
## Sample Outputs
|
| 22 |
+
|
| 23 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `0`
|
| 24 |
+
|
| 25 |
+
- score: `1.0`
|
| 26 |
+
- exact: `1.0`
|
| 27 |
+
- final box valid: `True`
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" is stated as "There are stars in the sky," confirming that "ʒìtéténbwà" means "stars" and "mùdjúlù" means "in the sky."
|
| 31 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù," follows the place-fronting pattern seen in sentence 8, where "mùdjúlù" (in the sky) appears after the place marker, indicating "in the sky" is a fixed phrase.
|
| 32 |
+
- The word order in sentence 13 places "ʒìtéténbwá" (stars) before the place phrase, matching the pattern in sentence 4 where "stars in the sky" appears as "ʒìtéténbwà mùdjúlù" but is restructured.
|
| 33 |
+
- In sentence 12, "múlóʒí mwámónà ʒìtéténbwá," the subject "múlóʒí" (the sorcerer) precedes the verb "mwámónà" (saw), and "ʒìtéténbwá" is the object, showing that possessed nouns follow possessors.
|
| 34 |
+
- Contrast between sentence 9 ("mùkìtándà mwálá djálá djámì") and sentence 13 reveals that when a place is fronted, the verb must remain in a form that allows the object to follow the place, validating object placement.
|
| 35 |
+
- Sentence 11, "àtú ádjà dìhónʒò mùlwándá," shows that "dìhónʒò" (the banana) is the object, confirming that "ʒìtéténbwá" is a noun that takes the same grammatical role as "dìhónʒò" in object position.
|
| 36 |
+
|
| 37 |
+
\boxed{a.2: There are stars in the sky.}
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `1`
|
| 41 |
+
|
| 42 |
+
- score: `1.0`
|
| 43 |
+
- exact: `1.0`
|
| 44 |
+
- final box valid: `True`
|
| 45 |
+
|
| 46 |
+
```text
|
| 47 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" meaning "There are stars in the sky" shows that the place phrase "in the sky" follows the verb, confirming place postverbal placement in statements.
|
| 48 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù", mirrors sentence 4's structure but with reversed word order, indicating that "in the sky" can be fronted as a place phrase.
|
| 49 |
+
- Sentence 5, "dìkámbá djámí djáʃíkà nì djákínà", features a verb sequence with "and" implied by "djáʃíkà nì djákínà", showing parallel action verbs with spatial or temporal separators.
|
| 50 |
+
- Sentence 3, "ŋgádjà dìhónʒó djámì" and sentence 12, "múlóʒí mwámónà ʒìtéténbwá", demonstrate that "see" and "saw" are expressed with the ŋg- or mú- verb prefixes, with first-person subjects requiring ŋg- or a subject-specific prefix.
|
| 51 |
+
- Sentence 8, "ŋgásáŋgá múlóʒí mwámì mùlwándà", and sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù", confirm that subject-verb-object (SVO) order is maintained when a place phrase is fronted, validating alignment with SVO base.
|
| 52 |
+
- In sentence 10, "mùdìkúŋgù ŋgámónà màkòlómbóló", the question form uses high final tone, contrasting with sentence 4's low final tone, confirming tone patterns indicate questions versus statements.
|
| 53 |
+
|
| 54 |
+
\boxed{a.2: There are stars in the sky.}
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `2`
|
| 58 |
+
|
| 59 |
+
- score: `1.0`
|
| 60 |
+
- exact: `1.0`
|
| 61 |
+
- final box valid: `True`
|
| 62 |
+
|
| 63 |
+
```text
|
| 64 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" translates to "There are stars in the sky", confirming that "ʒìtéténbwà" refers to stars and is used in declarative statements with a low final tone.
|
| 65 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù", mirrors the word order of sentence 4 but with place fronted, showing that "ʒìtéténbwá" (stars) can be relocated before the place phrase without altering meaning.
|
| 66 |
+
- Sentence 12, "múlóʒí mwámónà ʒìtéténbwá", has "múlóʒí" (the sorcerer) as subject and "mwámónà" (saw) as verb, with "ʒìtéténbwá" as object, aligning with the subject-verb-object structure in Kimbundu.
|
| 67 |
+
- Contrasting sentence 3 ("ĩgádjà dìhónʒó djámì" = I ate my banana) with sentence 12 shows that "djámì" and "mwámónà" are verbs of perception, confirming "mwámónà" means "saw" and can be used with "stars".
|
| 68 |
+
- Sentence 11, "àtú ádjà dìhónʒò mùlwándá", uses "ádjà" (ate) with object and place, confirming that object-verb-place order is permissible when place is not fronted.
|
| 69 |
+
- In sentence 13, the fronting of "ʒìtéténbwá" to before "ʒjálà mùdjúlù" preserves semantic equivalence to "There are stars in the sky", confirming that the noun phrase must remain associated with the place despite word order shifts.
|
| 70 |
+
|
| 71 |
+
\boxed{a.2: There are stars in the sky.}
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `3`
|
| 75 |
+
|
| 76 |
+
- score: `1.0`
|
| 77 |
+
- exact: `1.0`
|
| 78 |
+
- final box valid: `True`
|
| 79 |
+
|
| 80 |
+
```text
|
| 81 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" means "There are stars in the sky," confirming that "ʒìtéténbwà" is the noun for "stars" and "mùdjúlù" is the linking verb for existence.
|
| 82 |
+
- In sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù" structurally mirrors sentence 4 with place fronting, where "ʒjálà" (in the sky) replaces "mwálà" (on the plate), showing place phrases can precede the verb.
|
| 83 |
+
- Sentence 5 shows "djámí djáʃíkà" (sang and danced) with verb sequence, indicating "djámí" is "sang" and "djáʃíkà" is "danced," supporting that "djámí" is a verb that acts as a standalone action.
|
| 84 |
+
- Sentence 12, "múlóʒí mwámónà ʒìtéténbwá," follows the pattern of "subject + verb + object," where "múlóʒí" (the sorcerer) is subject, "mwámónà" (saw) is verb, and "ʒìtéténbwá" (stars) is object—aligning with parallel structure to sentence 1.
|
| 85 |
+
- In sentence 11, "àtú ádjà dìhónʒò mùlwándá" questions past action with "àtú" as "did," showing "dìhónʒò" (eat) and "mùlwándá" (in Luanda) only when coordinated by a question marker, indicating object placement in questions.
|
| 86 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù," when compared to 4, confirms the syntactic equivalence of place-fronting in declarative and non-declarative contexts, maintaining verb-object structure while shifting focus to location.
|
| 87 |
+
|
| 88 |
+
\boxed{a.2: There are stars in the sky.}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `4`
|
| 92 |
+
|
| 93 |
+
- score: `1.0`
|
| 94 |
+
- exact: `1.0`
|
| 95 |
+
- final box valid: `True`
|
| 96 |
+
|
| 97 |
+
```text
|
| 98 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" translates to "There are stars in the sky," confirming that "ʒìtéténbwà" means "stars" and appears as the object in a location-based existential clause.
|
| 99 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù," mirrors sentence 4 in structure, showing that "ʒìtéténbwá" is the subject and "mùdjúlù" is the place, supporting the interpretation that "ʒìtéténbwá" is the entity being located.
|
| 100 |
+
- Contrasting sentence 12 ("múlóʒí mwámónà ʒìtéténbwá") with sentence 4, the verb "mwámónà" (to see) is used with "ʒìtéténbwá," confirming that "ʒìtéténbwá" is the object of the verb and not a location.
|
| 101 |
+
- In sentence 9, "mùkìtándà mwálá djálá djámì" aligns with "mùkìtándà" (is in) followed by a place, indicating that place phrases follow after verbs when not positioned at the front.
|
| 102 |
+
- Sentence 11, "àtú ádjà dìhónʒò mùlwándá," uses "dìhónʒò" (the banana) as object after "àtú" (the people), showing that objects follow verbs in simple clauses when not fronted.
|
| 103 |
+
- In sentence 10, "mùdìkúŋgù ŋgámónà màkòlómbóló," the verb "ŋgámónà" (saw) is fronted with "mùdìkúŋgù" (the cave) as the object, confirming that object placement depends on syntactic structure and not default order.
|
| 104 |
+
|
| 105 |
+
\boxed{a.2: There are stars in the sky.}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `5`
|
| 109 |
+
|
| 110 |
+
- score: `1.0`
|
| 111 |
+
- exact: `1.0`
|
| 112 |
+
- final box valid: `True`
|
| 113 |
+
|
| 114 |
+
```text
|
| 115 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" means "There are stars in the sky," confirming that "ʒìtéténbwà" denotes "stars" and "mùdjúlù" refers to the existential "there are."
|
| 116 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù," follows the place-fronting pattern seen in sentence 8 ("mùkìtándà mwálá djálá djámì"), where "ʒjálà" (in the cave) precedes the verb and location is fronted.
|
| 117 |
+
- The order "ʒìtéténbwá ʒjálà mùdjúlù" mirrors the structure of sentence 4 (place after verb), showing that place phrases follow the verb when not fronted.
|
| 118 |
+
- Contrasting with sentence 3 ("ŋgádjà dìhónʒó djámì"), where "djà" is the verb and object appears afterward, sentence 13 places the noun first, indicating a shift to a locative focus.
|
| 119 |
+
- In sentence 10 ("mùdìkúŋgù ŋgámónà màkòlómbóló"), the question marker "mùdìkúŋgù" precedes the verb, but in 13, the absence of a question marker and verb-first order indicates a declarative statement.
|
| 120 |
+
- The tone pattern in "ʒìtéténbwá" ending with a high tone, followed by a low tone in "ʒjálà," aligns with the rule that sentence-final tone is low in statements, ensuring the declarative nature of the sentence.
|
| 121 |
+
|
| 122 |
+
\boxed{a.2: There are stars in the sky.}
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `6`
|
| 126 |
+
|
| 127 |
+
- score: `1.0`
|
| 128 |
+
- exact: `1.0`
|
| 129 |
+
- final box valid: `True`
|
| 130 |
+
|
| 131 |
+
```text
|
| 132 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" translates to "There are stars in the sky," showing that "ʒìtéténbwà" is the noun for "stars" and "mùdjúlù" is the existential verb.
|
| 133 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù," mirrors sentence 4's structure but with place fronting: "ʒjálà" (in the sky) precedes the verb, confirming that place phrases can be moved to the front.
|
| 134 |
+
- The word "ʒìtéténbwà" appears in both sentence 4 and 13, demonstrating consistent use as the noun for "stars" regardless of position or question status.
|
| 135 |
+
- Sentence 13 starts with "ʒìtéténbwá," with a low final tone, indicating a declarative statement, matching the low tone pattern in statements from the tone rules.
|
| 136 |
+
- In sentence 11, "àtú ádjà dìhónʒò mùlwándá" asks if people ate the banana in Luanda, showing that a question begins with “Did” and contains a verb (ádjà) and object (dìhónʒò), confirming that question markers are fronted with verb shifts.
|
| 137 |
+
- Sentence 13 has no do-support verb, yet is declarative, unlike questions, showing that noun phrases precede verb-place structures when the sentence is a statement rather than a question.
|
| 138 |
+
|
| 139 |
+
\boxed{a.2: There are stars in the sky.}
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.2` sample `7`
|
| 143 |
+
|
| 144 |
+
- score: `1.0`
|
| 145 |
+
- exact: `1.0`
|
| 146 |
+
- final box valid: `True`
|
| 147 |
+
|
| 148 |
+
```text
|
| 149 |
+
- In sentence 4, "mùdjúlù mwálà ʒìtéténbwà" means "There are stars in the sky", confirming that "ʒìtéténbwà" is a direct translation of "stars".
|
| 150 |
+
- Sentence 13, "ʒìtéténbwá ʒjálà mùdjúlù", follows the pattern of place fronting: "L V X" becomes "X V L" with "ʒjálà" (in the cave) placing "mùdjúlù" (there are stars) as the clause endpoint.
|
| 151 |
+
- The verb "ʒìtéténbwá" appears in item 4 as "there are stars", indicating it is a declarative "there is/are" construction used for existence.
|
| 152 |
+
- In sentence 5, "dìkámbá djámí djáʃíkà nì djákínà", "djáʃíkà" and "djákínà" are separated by "nì", showing that "nì" introduces a parallel action, but does not alter word order of the core verb-object.
|
| 153 |
+
- Sentence 13 has "ʒjálà" before "mùdjúlù", identical in structure to sentence 2 ("àlóʒí ásáŋgá djálà mùdìkúŋgù"), where "met the man in the cave" implies place fronting of "djálà" to "in the cave".
|
| 154 |
+
- The presence of "ʒìtéténbwá" in both 4 and 13, with consistent structure and tone patterns, supports its role as a star noun phrase, not a verb or action.
|
| 155 |
+
|
| 156 |
+
\boxed{a.2: There are stars in the sky.}
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `0`
|
| 160 |
+
|
| 161 |
+
- score: `1.0`
|
| 162 |
+
- exact: `1.0`
|
| 163 |
+
- final box valid: `True`
|
| 164 |
+
|
| 165 |
+
```text
|
| 166 |
+
- In example 1, "ŋgámónà dìhónʒò mùdìlóŋgà" (I saw the banana on the plate) shows that "on the plate" follows the verb, confirming that place phrases follow the verb in basic order.
|
| 167 |
+
- Example 6, "ŋgámónà dìkúŋgú djámí" (Did I see my cave?), contrasts with 5, where "sang and danced" is a verb compound, indicating that "did" questions use the same verb structure but shift to a question tone.
|
| 168 |
+
- Example 13, "ʒìtéténbwá ʒjálà mùdjúlù", establishes that "there are stars in the sky" has the place phrase after the verb, confirming fronted location syntax where place phrases can invert structure.
|
| 169 |
+
- Example 4, "mudjúlù mwálà ʒìtéténbwà", shows place-initial structure with "in the sky" at the end, indicating that when place is at the beginning, it is constructed as a copular or existential phrase.
|
| 170 |
+
- Example 14, "ŋgákínà", contains only a verb root without subject or object, and no grammatical markers, suggesting a first-person singular verb (based on ŋg-) with a missing subject, thus implying "I sang" or "I did it".
|
| 171 |
+
- Comparing with example 3, "ŋgádjà dìhónʒó djámì" (I ate my banana), the verb "djà" is first-person singular, and "ŋg-" indicates subject, so "ŋgákínà" logically must be "I sang" in this context.
|
| 172 |
+
|
| 173 |
+
\boxed{a.3: I danced.}
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `1`
|
| 177 |
+
|
| 178 |
+
- score: `1.0`
|
| 179 |
+
- exact: `1.0`
|
| 180 |
+
- final box valid: `True`
|
| 181 |
+
|
| 182 |
+
```text
|
| 183 |
+
- In sentence 14, 'ŋgákínà', the verb 'kínà' (to eat) appears without a subject, but the context and parallels with 'àlóʒí ásáŋgá djálà' (the sorcerers met...) show that the subject must be implied as "I" due to first-person prefix absence in non-vocalic contexts.
|
| 184 |
+
- Sentence 3, 'ŋgádjà dìhónʒó djámì' (I ate my banana), confirms that "my" is marked by the possessive pronoun 'djámì' and that first person is marked by the verb without prefix in present tense.
|
| 185 |
+
- Sentence 6, 'ŋgámónà dìkúŋgú djámí' (Did I see my cave?), shows that first-person subject is encoded with 'ŋgámónà' and that the present tense question form retains the subject prefix.
|
| 186 |
+
- In sentence 14, the lack of a subject prefix and the presence of the verb 'kínà' with no object or place, contrast with 'ŋgámónà dìhónʒò' (I saw the banana), suggesting the subject is "I" and the verb is "ate".
|
| 187 |
+
- Sentence 11, 'àtú ádjà dìhónʒò mùlwándá' (Did the people eat the banana in Luanda?), confirms that "did" is used in questions with third-person plural, implying first-person questions use "did I" only when structure requires auxiliary.
|
| 188 |
+
- Sentence 14’s structure mirrors 'ŋgámónà dìhónʒò' in form and tone, and no verb affix or place follows, confirming it is a simple first-person statement of eating, thus translating to "I ate".
|
| 189 |
+
|
| 190 |
+
\boxed{a.3: I danced.}
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `2`
|
| 194 |
+
|
| 195 |
+
- score: `1.0`
|
| 196 |
+
- exact: `1.0`
|
| 197 |
+
- final box valid: `True`
|
| 198 |
+
|
| 199 |
+
```text
|
| 200 |
+
- In sentence 14, 'ŋgákínà', the noun 'ŋgákínà' corresponds to 'I saw' based on morpheme alignment with 'ŋgámónà' (I saw) in sentence 1.
|
| 201 |
+
- The verb 'kínà' appears in 'ŋgámónà' (I saw) and 'ŋgákínà', indicating that the verb root 'kínà' means 'to see' regardless of possessive prefix.
|
| 202 |
+
- Structurally, 'ŋgákínà' mirrors sentence 1 where the first-person prefix ŋg- is replaced by ŋgá- indicating a contracted or possessive form, still denoting 'I'.
|
| 203 |
+
- Comparison with sentence 3, 'ŋgádjà dìhónʒó djámì' (I ate my banana), confirms that first-person verb forms retain the ŋg- prefix and are used as standalone clauses.
|
| 204 |
+
- Sentence 10, 'mùdìkúŋgù ŋgámónà màkòlómbóló' (Did I see the roosters in the cave?), uses a question structure with high tone and verb prefix, confirming that standalone 'ŋgámónà' means 'I saw' in statements or questions.
|
| 205 |
+
- In sentence 14, absence of object or place implies a minimal clause, consistent with 'I saw' being a stand-alone declarative, supported by tone pattern where final tone is low in statements, as per sentence 1’s tone marking.
|
| 206 |
+
|
| 207 |
+
\boxed{a.3: I danced.}
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
### `iol-2017-individual-p3-sub-a-atomic-a.3` sample `3`
|
| 211 |
+
|
| 212 |
+
- score: `1.0`
|
| 213 |
+
- exact: `1.0`
|
| 214 |
+
- final box valid: `True`
|
| 215 |
+
|
| 216 |
+
```text
|
| 217 |
+
- In sentence 14, 'ŋgákínà', the root 'ŋgákínà' corresponds to 'I saw' due to the presence of the first-person prefix ŋg- and the verb 'kínà' meaning 'to see'.
|
| 218 |
+
- Sentence 3 states 'ŋgádjà dìhónʒó djámì — I ate my banana', confirming that 'ŋgá-' marks first-person subject and 'dìhónʒó' means 'ate', showing consistent subject-verb structure.
|
| 219 |
+
- The verb in 'ŋgákínà' follows the same pattern as 'ŋgámónà' in sentence 1, where 'ŋgá-' denotes first person and the verb 'kínà' functions as 'to see'.
|
| 220 |
+
- Sentence 6, 'ŋgámónà dìkúŋgú djámí — Did I see my cave?', shows that 'ŋgámónà' is a first-person subject with a question marker, validating that 'ŋgákínà' must mean 'I saw' in a declarative form.
|
| 221 |
+
- In sentence 11, 'àtú ádjà dìhónʒò mùlwándá — Did the people eat the banana in Luanda?', the verb comes after the subject and object, supporting the subject-verb-object order where the verb is central and contextually recoverable.
|
| 222 |
+
- The absence of a place or object in 'ŋgákínà' indicates a minimal statement with only subject-verb, confirming that 'I saw' is the only logical translation given the morpheme base and prior verb patterns.
|
| 223 |
+
|
| 224 |
+
\boxed{a.3: I danced.}
|
| 225 |
+
```
|
| 226 |
+
|
benchmark/IOL/ioling_hf/reports/answer_given_rationale/Qwen_Qwen3-4B-Instruct-2507__v14_hakhun_manual_derivation_n4.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/summary.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "ioling_rl_manual_expanded_v10",
|
| 3 |
+
"parent_data": "data/rl/ioling_qwen3_4b_manual_v9_atomic_with_prior",
|
| 4 |
+
"manual_expansion_ledger": "data/manual_overrides/train_expansion_v10.json",
|
| 5 |
+
"train_count": 61,
|
| 6 |
+
"val_count": 24,
|
| 7 |
+
"total_count": 85,
|
| 8 |
+
"expansion_count": 23,
|
| 9 |
+
"train_source_problem_count": 9,
|
| 10 |
+
"val_source_problem_count": 3,
|
| 11 |
+
"source_overlap": [],
|
| 12 |
+
"prompt_style": "strict_keyed_atomic_with_prior_v10",
|
| 13 |
+
"note": "Adds three manually transcribed source problems and 23 fact-checked atomic targets to v9 train; validation is unchanged."
|
| 14 |
+
}
|
benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/train.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v10_expanded/val.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOL/ioling_hf/rl/ioling_qwen3_4b_manual_v11_clean_prompt/summary.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"train_count": 61,
|
| 3 |
+
"train_source_problem_count": 9,
|
| 4 |
+
"val_count": 24,
|
| 5 |
+
"val_source_problem_count": 3,
|
| 6 |
+
"schema_version": "ioling_rl_manual_clean_prompt_v11",
|
| 7 |
+
"parent_data": "data/rl/ioling_qwen3_4b_manual_v10_expanded",
|
| 8 |
+
"prompt_style": "strict_keyed_atomic_clean_v11",
|
| 9 |
+
"note": "Same manually checked tasks and labels as v10; only the reasoning and answer-contract wording is simplified."
|
| 10 |
+
}
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_dummy_thread/__init__.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
__future_module__ = True
|
| 4 |
+
|
| 5 |
+
if sys.version_info[0] < 3:
|
| 6 |
+
from dummy_thread import *
|
| 7 |
+
else:
|
| 8 |
+
raise ImportError('This package should not be accessible on Python 3. '
|
| 9 |
+
'Either you are trying to run from the python-future src folder '
|
| 10 |
+
'or your installation of python-future is corrupted.')
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_markupbase/__init__.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
__future_module__ = True
|
| 4 |
+
|
| 5 |
+
if sys.version_info[0] < 3:
|
| 6 |
+
from markupbase import *
|
| 7 |
+
else:
|
| 8 |
+
raise ImportError('This package should not be accessible on Python 3. '
|
| 9 |
+
'Either you are trying to run from the python-future src folder '
|
| 10 |
+
'or your installation of python-future is corrupted.')
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/cacheprovider.py
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
merged implementation of the cache provider
|
| 4 |
+
|
| 5 |
+
the name cache was not chosen to ensure pluggy automatically
|
| 6 |
+
ignores the external pytest-cache
|
| 7 |
+
"""
|
| 8 |
+
from __future__ import absolute_import
|
| 9 |
+
from __future__ import division
|
| 10 |
+
from __future__ import print_function
|
| 11 |
+
|
| 12 |
+
import json
|
| 13 |
+
import os
|
| 14 |
+
from collections import OrderedDict
|
| 15 |
+
|
| 16 |
+
import attr
|
| 17 |
+
import py
|
| 18 |
+
import six
|
| 19 |
+
|
| 20 |
+
import pytest
|
| 21 |
+
from .compat import _PY2 as PY2
|
| 22 |
+
from .pathlib import Path
|
| 23 |
+
from .pathlib import resolve_from_str
|
| 24 |
+
from .pathlib import rm_rf
|
| 25 |
+
|
| 26 |
+
README_CONTENT = u"""\
|
| 27 |
+
# pytest cache directory #
|
| 28 |
+
|
| 29 |
+
This directory contains data from the pytest's cache plugin,
|
| 30 |
+
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
| 31 |
+
|
| 32 |
+
**Do not** commit this to version control.
|
| 33 |
+
|
| 34 |
+
See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information.
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
CACHEDIR_TAG_CONTENT = b"""\
|
| 38 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
| 39 |
+
# This file is a cache directory tag created by pytest.
|
| 40 |
+
# For information about cache directory tags, see:
|
| 41 |
+
# http://www.bford.info/cachedir/spec.html
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
@attr.s
|
| 46 |
+
class Cache(object):
|
| 47 |
+
_cachedir = attr.ib(repr=False)
|
| 48 |
+
_config = attr.ib(repr=False)
|
| 49 |
+
|
| 50 |
+
@classmethod
|
| 51 |
+
def for_config(cls, config):
|
| 52 |
+
cachedir = cls.cache_dir_from_config(config)
|
| 53 |
+
if config.getoption("cacheclear") and cachedir.exists():
|
| 54 |
+
rm_rf(cachedir)
|
| 55 |
+
cachedir.mkdir()
|
| 56 |
+
return cls(cachedir, config)
|
| 57 |
+
|
| 58 |
+
@staticmethod
|
| 59 |
+
def cache_dir_from_config(config):
|
| 60 |
+
return resolve_from_str(config.getini("cache_dir"), config.rootdir)
|
| 61 |
+
|
| 62 |
+
def warn(self, fmt, **args):
|
| 63 |
+
from _pytest.warnings import _issue_warning_captured
|
| 64 |
+
from _pytest.warning_types import PytestCacheWarning
|
| 65 |
+
|
| 66 |
+
_issue_warning_captured(
|
| 67 |
+
PytestCacheWarning(fmt.format(**args) if args else fmt),
|
| 68 |
+
self._config.hook,
|
| 69 |
+
stacklevel=3,
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
def makedir(self, name):
|
| 73 |
+
""" return a directory path object with the given name. If the
|
| 74 |
+
directory does not yet exist, it will be created. You can use it
|
| 75 |
+
to manage files likes e. g. store/retrieve database
|
| 76 |
+
dumps across test sessions.
|
| 77 |
+
|
| 78 |
+
:param name: must be a string not containing a ``/`` separator.
|
| 79 |
+
Make sure the name contains your plugin or application
|
| 80 |
+
identifiers to prevent clashes with other cache users.
|
| 81 |
+
"""
|
| 82 |
+
name = Path(name)
|
| 83 |
+
if len(name.parts) > 1:
|
| 84 |
+
raise ValueError("name is not allowed to contain path separators")
|
| 85 |
+
res = self._cachedir.joinpath("d", name)
|
| 86 |
+
res.mkdir(exist_ok=True, parents=True)
|
| 87 |
+
return py.path.local(res)
|
| 88 |
+
|
| 89 |
+
def _getvaluepath(self, key):
|
| 90 |
+
return self._cachedir.joinpath("v", Path(key))
|
| 91 |
+
|
| 92 |
+
def get(self, key, default):
|
| 93 |
+
""" return cached value for the given key. If no value
|
| 94 |
+
was yet cached or the value cannot be read, the specified
|
| 95 |
+
default is returned.
|
| 96 |
+
|
| 97 |
+
:param key: must be a ``/`` separated value. Usually the first
|
| 98 |
+
name is the name of your plugin or your application.
|
| 99 |
+
:param default: must be provided in case of a cache-miss or
|
| 100 |
+
invalid cache values.
|
| 101 |
+
|
| 102 |
+
"""
|
| 103 |
+
path = self._getvaluepath(key)
|
| 104 |
+
try:
|
| 105 |
+
with path.open("r") as f:
|
| 106 |
+
return json.load(f)
|
| 107 |
+
except (ValueError, IOError, OSError):
|
| 108 |
+
return default
|
| 109 |
+
|
| 110 |
+
def set(self, key, value):
|
| 111 |
+
""" save value for the given key.
|
| 112 |
+
|
| 113 |
+
:param key: must be a ``/`` separated value. Usually the first
|
| 114 |
+
name is the name of your plugin or your application.
|
| 115 |
+
:param value: must be of any combination of basic
|
| 116 |
+
python types, including nested types
|
| 117 |
+
like e. g. lists of dictionaries.
|
| 118 |
+
"""
|
| 119 |
+
path = self._getvaluepath(key)
|
| 120 |
+
try:
|
| 121 |
+
if path.parent.is_dir():
|
| 122 |
+
cache_dir_exists_already = True
|
| 123 |
+
else:
|
| 124 |
+
cache_dir_exists_already = self._cachedir.exists()
|
| 125 |
+
path.parent.mkdir(exist_ok=True, parents=True)
|
| 126 |
+
except (IOError, OSError):
|
| 127 |
+
self.warn("could not create cache path {path}", path=path)
|
| 128 |
+
return
|
| 129 |
+
if not cache_dir_exists_already:
|
| 130 |
+
self._ensure_supporting_files()
|
| 131 |
+
try:
|
| 132 |
+
f = path.open("wb" if PY2 else "w")
|
| 133 |
+
except (IOError, OSError):
|
| 134 |
+
self.warn("cache could not write path {path}", path=path)
|
| 135 |
+
else:
|
| 136 |
+
with f:
|
| 137 |
+
json.dump(value, f, indent=2, sort_keys=True)
|
| 138 |
+
|
| 139 |
+
def _ensure_supporting_files(self):
|
| 140 |
+
"""Create supporting files in the cache dir that are not really part of the cache."""
|
| 141 |
+
readme_path = self._cachedir / "README.md"
|
| 142 |
+
readme_path.write_text(README_CONTENT)
|
| 143 |
+
|
| 144 |
+
gitignore_path = self._cachedir.joinpath(".gitignore")
|
| 145 |
+
msg = u"# Created by pytest automatically.\n*"
|
| 146 |
+
gitignore_path.write_text(msg, encoding="UTF-8")
|
| 147 |
+
|
| 148 |
+
cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
|
| 149 |
+
cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class LFPlugin(object):
|
| 153 |
+
""" Plugin which implements the --lf (run last-failing) option """
|
| 154 |
+
|
| 155 |
+
def __init__(self, config):
|
| 156 |
+
self.config = config
|
| 157 |
+
active_keys = "lf", "failedfirst"
|
| 158 |
+
self.active = any(config.getoption(key) for key in active_keys)
|
| 159 |
+
self.lastfailed = config.cache.get("cache/lastfailed", {})
|
| 160 |
+
self._previously_failed_count = None
|
| 161 |
+
self._report_status = None
|
| 162 |
+
self._skipped_files = 0 # count skipped files during collection due to --lf
|
| 163 |
+
|
| 164 |
+
def last_failed_paths(self):
|
| 165 |
+
"""Returns a set with all Paths()s of the previously failed nodeids (cached).
|
| 166 |
+
"""
|
| 167 |
+
try:
|
| 168 |
+
return self._last_failed_paths
|
| 169 |
+
except AttributeError:
|
| 170 |
+
rootpath = Path(self.config.rootdir)
|
| 171 |
+
result = {rootpath / nodeid.split("::")[0] for nodeid in self.lastfailed}
|
| 172 |
+
result = {x for x in result if x.exists()}
|
| 173 |
+
self._last_failed_paths = result
|
| 174 |
+
return result
|
| 175 |
+
|
| 176 |
+
def pytest_ignore_collect(self, path):
|
| 177 |
+
"""
|
| 178 |
+
Ignore this file path if we are in --lf mode and it is not in the list of
|
| 179 |
+
previously failed files.
|
| 180 |
+
"""
|
| 181 |
+
if self.active and self.config.getoption("lf") and path.isfile():
|
| 182 |
+
last_failed_paths = self.last_failed_paths()
|
| 183 |
+
if last_failed_paths:
|
| 184 |
+
skip_it = Path(path) not in self.last_failed_paths()
|
| 185 |
+
if skip_it:
|
| 186 |
+
self._skipped_files += 1
|
| 187 |
+
return skip_it
|
| 188 |
+
|
| 189 |
+
def pytest_report_collectionfinish(self):
|
| 190 |
+
if self.active and self.config.getoption("verbose") >= 0:
|
| 191 |
+
return "run-last-failure: %s" % self._report_status
|
| 192 |
+
|
| 193 |
+
def pytest_runtest_logreport(self, report):
|
| 194 |
+
if (report.when == "call" and report.passed) or report.skipped:
|
| 195 |
+
self.lastfailed.pop(report.nodeid, None)
|
| 196 |
+
elif report.failed:
|
| 197 |
+
self.lastfailed[report.nodeid] = True
|
| 198 |
+
|
| 199 |
+
def pytest_collectreport(self, report):
|
| 200 |
+
passed = report.outcome in ("passed", "skipped")
|
| 201 |
+
if passed:
|
| 202 |
+
if report.nodeid in self.lastfailed:
|
| 203 |
+
self.lastfailed.pop(report.nodeid)
|
| 204 |
+
self.lastfailed.update((item.nodeid, True) for item in report.result)
|
| 205 |
+
else:
|
| 206 |
+
self.lastfailed[report.nodeid] = True
|
| 207 |
+
|
| 208 |
+
def pytest_collection_modifyitems(self, session, config, items):
|
| 209 |
+
if not self.active:
|
| 210 |
+
return
|
| 211 |
+
|
| 212 |
+
if self.lastfailed:
|
| 213 |
+
previously_failed = []
|
| 214 |
+
previously_passed = []
|
| 215 |
+
for item in items:
|
| 216 |
+
if item.nodeid in self.lastfailed:
|
| 217 |
+
previously_failed.append(item)
|
| 218 |
+
else:
|
| 219 |
+
previously_passed.append(item)
|
| 220 |
+
self._previously_failed_count = len(previously_failed)
|
| 221 |
+
|
| 222 |
+
if not previously_failed:
|
| 223 |
+
# Running a subset of all tests with recorded failures
|
| 224 |
+
# only outside of it.
|
| 225 |
+
self._report_status = "%d known failures not in selected tests" % (
|
| 226 |
+
len(self.lastfailed),
|
| 227 |
+
)
|
| 228 |
+
else:
|
| 229 |
+
if self.config.getoption("lf"):
|
| 230 |
+
items[:] = previously_failed
|
| 231 |
+
config.hook.pytest_deselected(items=previously_passed)
|
| 232 |
+
else: # --failedfirst
|
| 233 |
+
items[:] = previously_failed + previously_passed
|
| 234 |
+
|
| 235 |
+
noun = "failure" if self._previously_failed_count == 1 else "failures"
|
| 236 |
+
suffix = " first" if self.config.getoption("failedfirst") else ""
|
| 237 |
+
self._report_status = "rerun previous {count} {noun}{suffix}".format(
|
| 238 |
+
count=self._previously_failed_count, suffix=suffix, noun=noun
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
if self._skipped_files > 0:
|
| 242 |
+
files_noun = "file" if self._skipped_files == 1 else "files"
|
| 243 |
+
self._report_status += " (skipped {files} {files_noun})".format(
|
| 244 |
+
files=self._skipped_files, files_noun=files_noun
|
| 245 |
+
)
|
| 246 |
+
else:
|
| 247 |
+
self._report_status = "no previously failed tests, "
|
| 248 |
+
if self.config.getoption("last_failed_no_failures") == "none":
|
| 249 |
+
self._report_status += "deselecting all items."
|
| 250 |
+
config.hook.pytest_deselected(items=items)
|
| 251 |
+
items[:] = []
|
| 252 |
+
else:
|
| 253 |
+
self._report_status += "not deselecting items."
|
| 254 |
+
|
| 255 |
+
def pytest_sessionfinish(self, session):
|
| 256 |
+
config = self.config
|
| 257 |
+
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
| 258 |
+
return
|
| 259 |
+
|
| 260 |
+
saved_lastfailed = config.cache.get("cache/lastfailed", {})
|
| 261 |
+
if saved_lastfailed != self.lastfailed:
|
| 262 |
+
config.cache.set("cache/lastfailed", self.lastfailed)
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
class NFPlugin(object):
|
| 266 |
+
""" Plugin which implements the --nf (run new-first) option """
|
| 267 |
+
|
| 268 |
+
def __init__(self, config):
|
| 269 |
+
self.config = config
|
| 270 |
+
self.active = config.option.newfirst
|
| 271 |
+
self.cached_nodeids = config.cache.get("cache/nodeids", [])
|
| 272 |
+
|
| 273 |
+
def pytest_collection_modifyitems(self, session, config, items):
|
| 274 |
+
if self.active:
|
| 275 |
+
new_items = OrderedDict()
|
| 276 |
+
other_items = OrderedDict()
|
| 277 |
+
for item in items:
|
| 278 |
+
if item.nodeid not in self.cached_nodeids:
|
| 279 |
+
new_items[item.nodeid] = item
|
| 280 |
+
else:
|
| 281 |
+
other_items[item.nodeid] = item
|
| 282 |
+
|
| 283 |
+
items[:] = self._get_increasing_order(
|
| 284 |
+
six.itervalues(new_items)
|
| 285 |
+
) + self._get_increasing_order(six.itervalues(other_items))
|
| 286 |
+
self.cached_nodeids = [x.nodeid for x in items if isinstance(x, pytest.Item)]
|
| 287 |
+
|
| 288 |
+
def _get_increasing_order(self, items):
|
| 289 |
+
return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)
|
| 290 |
+
|
| 291 |
+
def pytest_sessionfinish(self, session):
|
| 292 |
+
config = self.config
|
| 293 |
+
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
| 294 |
+
return
|
| 295 |
+
|
| 296 |
+
config.cache.set("cache/nodeids", self.cached_nodeids)
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
def pytest_addoption(parser):
|
| 300 |
+
group = parser.getgroup("general")
|
| 301 |
+
group.addoption(
|
| 302 |
+
"--lf",
|
| 303 |
+
"--last-failed",
|
| 304 |
+
action="store_true",
|
| 305 |
+
dest="lf",
|
| 306 |
+
help="rerun only the tests that failed "
|
| 307 |
+
"at the last run (or all if none failed)",
|
| 308 |
+
)
|
| 309 |
+
group.addoption(
|
| 310 |
+
"--ff",
|
| 311 |
+
"--failed-first",
|
| 312 |
+
action="store_true",
|
| 313 |
+
dest="failedfirst",
|
| 314 |
+
help="run all tests but run the last failures first. "
|
| 315 |
+
"This may re-order tests and thus lead to "
|
| 316 |
+
"repeated fixture setup/teardown",
|
| 317 |
+
)
|
| 318 |
+
group.addoption(
|
| 319 |
+
"--nf",
|
| 320 |
+
"--new-first",
|
| 321 |
+
action="store_true",
|
| 322 |
+
dest="newfirst",
|
| 323 |
+
help="run tests from new files first, then the rest of the tests "
|
| 324 |
+
"sorted by file mtime",
|
| 325 |
+
)
|
| 326 |
+
group.addoption(
|
| 327 |
+
"--cache-show",
|
| 328 |
+
action="append",
|
| 329 |
+
nargs="?",
|
| 330 |
+
dest="cacheshow",
|
| 331 |
+
help=(
|
| 332 |
+
"show cache contents, don't perform collection or tests. "
|
| 333 |
+
"Optional argument: glob (default: '*')."
|
| 334 |
+
),
|
| 335 |
+
)
|
| 336 |
+
group.addoption(
|
| 337 |
+
"--cache-clear",
|
| 338 |
+
action="store_true",
|
| 339 |
+
dest="cacheclear",
|
| 340 |
+
help="remove all cache contents at start of test run.",
|
| 341 |
+
)
|
| 342 |
+
cache_dir_default = ".pytest_cache"
|
| 343 |
+
if "TOX_ENV_DIR" in os.environ:
|
| 344 |
+
cache_dir_default = os.path.join(os.environ["TOX_ENV_DIR"], cache_dir_default)
|
| 345 |
+
parser.addini("cache_dir", default=cache_dir_default, help="cache directory path.")
|
| 346 |
+
group.addoption(
|
| 347 |
+
"--lfnf",
|
| 348 |
+
"--last-failed-no-failures",
|
| 349 |
+
action="store",
|
| 350 |
+
dest="last_failed_no_failures",
|
| 351 |
+
choices=("all", "none"),
|
| 352 |
+
default="all",
|
| 353 |
+
help="which tests to run with no previously (known) failures.",
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def pytest_cmdline_main(config):
|
| 358 |
+
if config.option.cacheshow:
|
| 359 |
+
from _pytest.main import wrap_session
|
| 360 |
+
|
| 361 |
+
return wrap_session(config, cacheshow)
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
@pytest.hookimpl(tryfirst=True)
|
| 365 |
+
def pytest_configure(config):
|
| 366 |
+
config.cache = Cache.for_config(config)
|
| 367 |
+
config.pluginmanager.register(LFPlugin(config), "lfplugin")
|
| 368 |
+
config.pluginmanager.register(NFPlugin(config), "nfplugin")
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
@pytest.fixture
|
| 372 |
+
def cache(request):
|
| 373 |
+
"""
|
| 374 |
+
Return a cache object that can persist state between testing sessions.
|
| 375 |
+
|
| 376 |
+
cache.get(key, default)
|
| 377 |
+
cache.set(key, value)
|
| 378 |
+
|
| 379 |
+
Keys must be a ``/`` separated value, where the first part is usually the
|
| 380 |
+
name of your plugin or application to avoid clashes with other cache users.
|
| 381 |
+
|
| 382 |
+
Values can be any object handled by the json stdlib module.
|
| 383 |
+
"""
|
| 384 |
+
return request.config.cache
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
def pytest_report_header(config):
|
| 388 |
+
"""Display cachedir with --cache-show and if non-default."""
|
| 389 |
+
if config.option.verbose > 0 or config.getini("cache_dir") != ".pytest_cache":
|
| 390 |
+
cachedir = config.cache._cachedir
|
| 391 |
+
# TODO: evaluate generating upward relative paths
|
| 392 |
+
# starting with .., ../.. if sensible
|
| 393 |
+
|
| 394 |
+
try:
|
| 395 |
+
displaypath = cachedir.relative_to(config.rootdir)
|
| 396 |
+
except ValueError:
|
| 397 |
+
displaypath = cachedir
|
| 398 |
+
return "cachedir: {}".format(displaypath)
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
def cacheshow(config, session):
|
| 402 |
+
from pprint import pformat
|
| 403 |
+
|
| 404 |
+
tw = py.io.TerminalWriter()
|
| 405 |
+
tw.line("cachedir: " + str(config.cache._cachedir))
|
| 406 |
+
if not config.cache._cachedir.is_dir():
|
| 407 |
+
tw.line("cache is empty")
|
| 408 |
+
return 0
|
| 409 |
+
|
| 410 |
+
glob = config.option.cacheshow[0]
|
| 411 |
+
if glob is None:
|
| 412 |
+
glob = "*"
|
| 413 |
+
|
| 414 |
+
dummy = object()
|
| 415 |
+
basedir = config.cache._cachedir
|
| 416 |
+
vdir = basedir / "v"
|
| 417 |
+
tw.sep("-", "cache values for %r" % glob)
|
| 418 |
+
for valpath in sorted(x for x in vdir.rglob(glob) if x.is_file()):
|
| 419 |
+
key = valpath.relative_to(vdir)
|
| 420 |
+
val = config.cache.get(key, dummy)
|
| 421 |
+
if val is dummy:
|
| 422 |
+
tw.line("%s contains unreadable content, will be ignored" % key)
|
| 423 |
+
else:
|
| 424 |
+
tw.line("%s contains:" % key)
|
| 425 |
+
for line in pformat(val).splitlines():
|
| 426 |
+
tw.line(" " + line)
|
| 427 |
+
|
| 428 |
+
ddir = basedir / "d"
|
| 429 |
+
if ddir.is_dir():
|
| 430 |
+
contents = sorted(ddir.rglob(glob))
|
| 431 |
+
tw.sep("-", "cache directories for %r" % glob)
|
| 432 |
+
for p in contents:
|
| 433 |
+
# if p.check(dir=1):
|
| 434 |
+
# print("%s/" % p.relto(basedir))
|
| 435 |
+
if p.is_file():
|
| 436 |
+
key = p.relative_to(basedir)
|
| 437 |
+
tw.line("{} is a file of length {:d}".format(key, p.stat().st_size))
|
| 438 |
+
return 0
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/capture.py
ADDED
|
@@ -0,0 +1,850 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
per-test stdout/stderr capturing mechanism.
|
| 4 |
+
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import absolute_import
|
| 7 |
+
from __future__ import division
|
| 8 |
+
from __future__ import print_function
|
| 9 |
+
|
| 10 |
+
import collections
|
| 11 |
+
import contextlib
|
| 12 |
+
import io
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
from io import UnsupportedOperation
|
| 16 |
+
from tempfile import TemporaryFile
|
| 17 |
+
|
| 18 |
+
import six
|
| 19 |
+
|
| 20 |
+
import pytest
|
| 21 |
+
from _pytest.compat import _PY3
|
| 22 |
+
from _pytest.compat import CaptureIO
|
| 23 |
+
|
| 24 |
+
patchsysdict = {0: "stdin", 1: "stdout", 2: "stderr"}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def pytest_addoption(parser):
|
| 28 |
+
group = parser.getgroup("general")
|
| 29 |
+
group._addoption(
|
| 30 |
+
"--capture",
|
| 31 |
+
action="store",
|
| 32 |
+
default="fd" if hasattr(os, "dup") else "sys",
|
| 33 |
+
metavar="method",
|
| 34 |
+
choices=["fd", "sys", "no"],
|
| 35 |
+
help="per-test capturing method: one of fd|sys|no.",
|
| 36 |
+
)
|
| 37 |
+
group._addoption(
|
| 38 |
+
"-s",
|
| 39 |
+
action="store_const",
|
| 40 |
+
const="no",
|
| 41 |
+
dest="capture",
|
| 42 |
+
help="shortcut for --capture=no.",
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 47 |
+
def pytest_load_initial_conftests(early_config, parser, args):
|
| 48 |
+
ns = early_config.known_args_namespace
|
| 49 |
+
if ns.capture == "fd":
|
| 50 |
+
_py36_windowsconsoleio_workaround(sys.stdout)
|
| 51 |
+
_colorama_workaround()
|
| 52 |
+
_readline_workaround()
|
| 53 |
+
pluginmanager = early_config.pluginmanager
|
| 54 |
+
capman = CaptureManager(ns.capture)
|
| 55 |
+
pluginmanager.register(capman, "capturemanager")
|
| 56 |
+
|
| 57 |
+
# make sure that capturemanager is properly reset at final shutdown
|
| 58 |
+
early_config.add_cleanup(capman.stop_global_capturing)
|
| 59 |
+
|
| 60 |
+
# finally trigger conftest loading but while capturing (issue93)
|
| 61 |
+
capman.start_global_capturing()
|
| 62 |
+
outcome = yield
|
| 63 |
+
capman.suspend_global_capture()
|
| 64 |
+
if outcome.excinfo is not None:
|
| 65 |
+
out, err = capman.read_global_capture()
|
| 66 |
+
sys.stdout.write(out)
|
| 67 |
+
sys.stderr.write(err)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class CaptureManager(object):
|
| 71 |
+
"""
|
| 72 |
+
Capture plugin, manages that the appropriate capture method is enabled/disabled during collection and each
|
| 73 |
+
test phase (setup, call, teardown). After each of those points, the captured output is obtained and
|
| 74 |
+
attached to the collection/runtest report.
|
| 75 |
+
|
| 76 |
+
There are two levels of capture:
|
| 77 |
+
* global: which is enabled by default and can be suppressed by the ``-s`` option. This is always enabled/disabled
|
| 78 |
+
during collection and each test phase.
|
| 79 |
+
* fixture: when a test function or one of its fixture depend on the ``capsys`` or ``capfd`` fixtures. In this
|
| 80 |
+
case special handling is needed to ensure the fixtures take precedence over the global capture.
|
| 81 |
+
"""
|
| 82 |
+
|
| 83 |
+
def __init__(self, method):
|
| 84 |
+
self._method = method
|
| 85 |
+
self._global_capturing = None
|
| 86 |
+
self._current_item = None
|
| 87 |
+
|
| 88 |
+
def __repr__(self):
|
| 89 |
+
return "<CaptureManager _method=%r _global_capturing=%r _current_item=%r>" % (
|
| 90 |
+
self._method,
|
| 91 |
+
self._global_capturing,
|
| 92 |
+
self._current_item,
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
def _getcapture(self, method):
|
| 96 |
+
if method == "fd":
|
| 97 |
+
return MultiCapture(out=True, err=True, Capture=FDCapture)
|
| 98 |
+
elif method == "sys":
|
| 99 |
+
return MultiCapture(out=True, err=True, Capture=SysCapture)
|
| 100 |
+
elif method == "no":
|
| 101 |
+
return MultiCapture(out=False, err=False, in_=False)
|
| 102 |
+
raise ValueError("unknown capturing method: %r" % method) # pragma: no cover
|
| 103 |
+
|
| 104 |
+
def is_capturing(self):
|
| 105 |
+
if self.is_globally_capturing():
|
| 106 |
+
return "global"
|
| 107 |
+
capture_fixture = getattr(self._current_item, "_capture_fixture", None)
|
| 108 |
+
if capture_fixture is not None:
|
| 109 |
+
return (
|
| 110 |
+
"fixture %s" % self._current_item._capture_fixture.request.fixturename
|
| 111 |
+
)
|
| 112 |
+
return False
|
| 113 |
+
|
| 114 |
+
# Global capturing control
|
| 115 |
+
|
| 116 |
+
def is_globally_capturing(self):
|
| 117 |
+
return self._method != "no"
|
| 118 |
+
|
| 119 |
+
def start_global_capturing(self):
|
| 120 |
+
assert self._global_capturing is None
|
| 121 |
+
self._global_capturing = self._getcapture(self._method)
|
| 122 |
+
self._global_capturing.start_capturing()
|
| 123 |
+
|
| 124 |
+
def stop_global_capturing(self):
|
| 125 |
+
if self._global_capturing is not None:
|
| 126 |
+
self._global_capturing.pop_outerr_to_orig()
|
| 127 |
+
self._global_capturing.stop_capturing()
|
| 128 |
+
self._global_capturing = None
|
| 129 |
+
|
| 130 |
+
def resume_global_capture(self):
|
| 131 |
+
# During teardown of the python process, and on rare occasions, capture
|
| 132 |
+
# attributes can be `None` while trying to resume global capture.
|
| 133 |
+
if self._global_capturing is not None:
|
| 134 |
+
self._global_capturing.resume_capturing()
|
| 135 |
+
|
| 136 |
+
def suspend_global_capture(self, in_=False):
|
| 137 |
+
cap = getattr(self, "_global_capturing", None)
|
| 138 |
+
if cap is not None:
|
| 139 |
+
cap.suspend_capturing(in_=in_)
|
| 140 |
+
|
| 141 |
+
def suspend(self, in_=False):
|
| 142 |
+
# Need to undo local capsys-et-al if it exists before disabling global capture.
|
| 143 |
+
self.suspend_fixture(self._current_item)
|
| 144 |
+
self.suspend_global_capture(in_)
|
| 145 |
+
|
| 146 |
+
def resume(self):
|
| 147 |
+
self.resume_global_capture()
|
| 148 |
+
self.resume_fixture(self._current_item)
|
| 149 |
+
|
| 150 |
+
def read_global_capture(self):
|
| 151 |
+
return self._global_capturing.readouterr()
|
| 152 |
+
|
| 153 |
+
# Fixture Control (it's just forwarding, think about removing this later)
|
| 154 |
+
|
| 155 |
+
def activate_fixture(self, item):
|
| 156 |
+
"""If the current item is using ``capsys`` or ``capfd``, activate them so they take precedence over
|
| 157 |
+
the global capture.
|
| 158 |
+
"""
|
| 159 |
+
fixture = getattr(item, "_capture_fixture", None)
|
| 160 |
+
if fixture is not None:
|
| 161 |
+
fixture._start()
|
| 162 |
+
|
| 163 |
+
def deactivate_fixture(self, item):
|
| 164 |
+
"""Deactivates the ``capsys`` or ``capfd`` fixture of this item, if any."""
|
| 165 |
+
fixture = getattr(item, "_capture_fixture", None)
|
| 166 |
+
if fixture is not None:
|
| 167 |
+
fixture.close()
|
| 168 |
+
|
| 169 |
+
def suspend_fixture(self, item):
|
| 170 |
+
fixture = getattr(item, "_capture_fixture", None)
|
| 171 |
+
if fixture is not None:
|
| 172 |
+
fixture._suspend()
|
| 173 |
+
|
| 174 |
+
def resume_fixture(self, item):
|
| 175 |
+
fixture = getattr(item, "_capture_fixture", None)
|
| 176 |
+
if fixture is not None:
|
| 177 |
+
fixture._resume()
|
| 178 |
+
|
| 179 |
+
# Helper context managers
|
| 180 |
+
|
| 181 |
+
@contextlib.contextmanager
|
| 182 |
+
def global_and_fixture_disabled(self):
|
| 183 |
+
"""Context manager to temporarily disable global and current fixture capturing."""
|
| 184 |
+
self.suspend()
|
| 185 |
+
try:
|
| 186 |
+
yield
|
| 187 |
+
finally:
|
| 188 |
+
self.resume()
|
| 189 |
+
|
| 190 |
+
@contextlib.contextmanager
|
| 191 |
+
def item_capture(self, when, item):
|
| 192 |
+
self.resume_global_capture()
|
| 193 |
+
self.activate_fixture(item)
|
| 194 |
+
try:
|
| 195 |
+
yield
|
| 196 |
+
finally:
|
| 197 |
+
self.deactivate_fixture(item)
|
| 198 |
+
self.suspend_global_capture(in_=False)
|
| 199 |
+
|
| 200 |
+
out, err = self.read_global_capture()
|
| 201 |
+
item.add_report_section(when, "stdout", out)
|
| 202 |
+
item.add_report_section(when, "stderr", err)
|
| 203 |
+
|
| 204 |
+
# Hooks
|
| 205 |
+
|
| 206 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 207 |
+
def pytest_make_collect_report(self, collector):
|
| 208 |
+
if isinstance(collector, pytest.File):
|
| 209 |
+
self.resume_global_capture()
|
| 210 |
+
outcome = yield
|
| 211 |
+
self.suspend_global_capture()
|
| 212 |
+
out, err = self.read_global_capture()
|
| 213 |
+
rep = outcome.get_result()
|
| 214 |
+
if out:
|
| 215 |
+
rep.sections.append(("Captured stdout", out))
|
| 216 |
+
if err:
|
| 217 |
+
rep.sections.append(("Captured stderr", err))
|
| 218 |
+
else:
|
| 219 |
+
yield
|
| 220 |
+
|
| 221 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 222 |
+
def pytest_runtest_protocol(self, item):
|
| 223 |
+
self._current_item = item
|
| 224 |
+
yield
|
| 225 |
+
self._current_item = None
|
| 226 |
+
|
| 227 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 228 |
+
def pytest_runtest_setup(self, item):
|
| 229 |
+
with self.item_capture("setup", item):
|
| 230 |
+
yield
|
| 231 |
+
|
| 232 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 233 |
+
def pytest_runtest_call(self, item):
|
| 234 |
+
with self.item_capture("call", item):
|
| 235 |
+
yield
|
| 236 |
+
|
| 237 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 238 |
+
def pytest_runtest_teardown(self, item):
|
| 239 |
+
with self.item_capture("teardown", item):
|
| 240 |
+
yield
|
| 241 |
+
|
| 242 |
+
@pytest.hookimpl(tryfirst=True)
|
| 243 |
+
def pytest_keyboard_interrupt(self, excinfo):
|
| 244 |
+
self.stop_global_capturing()
|
| 245 |
+
|
| 246 |
+
@pytest.hookimpl(tryfirst=True)
|
| 247 |
+
def pytest_internalerror(self, excinfo):
|
| 248 |
+
self.stop_global_capturing()
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
capture_fixtures = {"capfd", "capfdbinary", "capsys", "capsysbinary"}
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
def _ensure_only_one_capture_fixture(request, name):
|
| 255 |
+
fixtures = set(request.fixturenames) & capture_fixtures - {name}
|
| 256 |
+
if fixtures:
|
| 257 |
+
fixtures = sorted(fixtures)
|
| 258 |
+
fixtures = fixtures[0] if len(fixtures) == 1 else fixtures
|
| 259 |
+
raise request.raiseerror(
|
| 260 |
+
"cannot use {} and {} at the same time".format(fixtures, name)
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
@pytest.fixture
|
| 265 |
+
def capsys(request):
|
| 266 |
+
"""Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
| 267 |
+
|
| 268 |
+
The captured output is made available via ``capsys.readouterr()`` method
|
| 269 |
+
calls, which return a ``(out, err)`` namedtuple.
|
| 270 |
+
``out`` and ``err`` will be ``text`` objects.
|
| 271 |
+
"""
|
| 272 |
+
_ensure_only_one_capture_fixture(request, "capsys")
|
| 273 |
+
with _install_capture_fixture_on_item(request, SysCapture) as fixture:
|
| 274 |
+
yield fixture
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
@pytest.fixture
|
| 278 |
+
def capsysbinary(request):
|
| 279 |
+
"""Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
| 280 |
+
|
| 281 |
+
The captured output is made available via ``capsysbinary.readouterr()``
|
| 282 |
+
method calls, which return a ``(out, err)`` namedtuple.
|
| 283 |
+
``out`` and ``err`` will be ``bytes`` objects.
|
| 284 |
+
"""
|
| 285 |
+
_ensure_only_one_capture_fixture(request, "capsysbinary")
|
| 286 |
+
# Currently, the implementation uses the python3 specific `.buffer`
|
| 287 |
+
# property of CaptureIO.
|
| 288 |
+
if sys.version_info < (3,):
|
| 289 |
+
raise request.raiseerror("capsysbinary is only supported on Python 3")
|
| 290 |
+
with _install_capture_fixture_on_item(request, SysCaptureBinary) as fixture:
|
| 291 |
+
yield fixture
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
@pytest.fixture
|
| 295 |
+
def capfd(request):
|
| 296 |
+
"""Enable text capturing of writes to file descriptors ``1`` and ``2``.
|
| 297 |
+
|
| 298 |
+
The captured output is made available via ``capfd.readouterr()`` method
|
| 299 |
+
calls, which return a ``(out, err)`` namedtuple.
|
| 300 |
+
``out`` and ``err`` will be ``text`` objects.
|
| 301 |
+
"""
|
| 302 |
+
_ensure_only_one_capture_fixture(request, "capfd")
|
| 303 |
+
if not hasattr(os, "dup"):
|
| 304 |
+
pytest.skip(
|
| 305 |
+
"capfd fixture needs os.dup function which is not available in this system"
|
| 306 |
+
)
|
| 307 |
+
with _install_capture_fixture_on_item(request, FDCapture) as fixture:
|
| 308 |
+
yield fixture
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
@pytest.fixture
|
| 312 |
+
def capfdbinary(request):
|
| 313 |
+
"""Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
|
| 314 |
+
|
| 315 |
+
The captured output is made available via ``capfd.readouterr()`` method
|
| 316 |
+
calls, which return a ``(out, err)`` namedtuple.
|
| 317 |
+
``out`` and ``err`` will be ``byte`` objects.
|
| 318 |
+
"""
|
| 319 |
+
_ensure_only_one_capture_fixture(request, "capfdbinary")
|
| 320 |
+
if not hasattr(os, "dup"):
|
| 321 |
+
pytest.skip(
|
| 322 |
+
"capfdbinary fixture needs os.dup function which is not available in this system"
|
| 323 |
+
)
|
| 324 |
+
with _install_capture_fixture_on_item(request, FDCaptureBinary) as fixture:
|
| 325 |
+
yield fixture
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
@contextlib.contextmanager
|
| 329 |
+
def _install_capture_fixture_on_item(request, capture_class):
|
| 330 |
+
"""
|
| 331 |
+
Context manager which creates a ``CaptureFixture`` instance and "installs" it on
|
| 332 |
+
the item/node of the given request. Used by ``capsys`` and ``capfd``.
|
| 333 |
+
|
| 334 |
+
The CaptureFixture is added as attribute of the item because it needs to accessed
|
| 335 |
+
by ``CaptureManager`` during its ``pytest_runtest_*`` hooks.
|
| 336 |
+
"""
|
| 337 |
+
request.node._capture_fixture = fixture = CaptureFixture(capture_class, request)
|
| 338 |
+
capmanager = request.config.pluginmanager.getplugin("capturemanager")
|
| 339 |
+
# Need to active this fixture right away in case it is being used by another fixture (setup phase).
|
| 340 |
+
# If this fixture is being used only by a test function (call phase), then we wouldn't need this
|
| 341 |
+
# activation, but it doesn't hurt.
|
| 342 |
+
capmanager.activate_fixture(request.node)
|
| 343 |
+
yield fixture
|
| 344 |
+
fixture.close()
|
| 345 |
+
del request.node._capture_fixture
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
class CaptureFixture(object):
|
| 349 |
+
"""
|
| 350 |
+
Object returned by :py:func:`capsys`, :py:func:`capsysbinary`, :py:func:`capfd` and :py:func:`capfdbinary`
|
| 351 |
+
fixtures.
|
| 352 |
+
"""
|
| 353 |
+
|
| 354 |
+
def __init__(self, captureclass, request):
|
| 355 |
+
self.captureclass = captureclass
|
| 356 |
+
self.request = request
|
| 357 |
+
self._capture = None
|
| 358 |
+
self._captured_out = self.captureclass.EMPTY_BUFFER
|
| 359 |
+
self._captured_err = self.captureclass.EMPTY_BUFFER
|
| 360 |
+
|
| 361 |
+
def _start(self):
|
| 362 |
+
if self._capture is None:
|
| 363 |
+
self._capture = MultiCapture(
|
| 364 |
+
out=True, err=True, in_=False, Capture=self.captureclass
|
| 365 |
+
)
|
| 366 |
+
self._capture.start_capturing()
|
| 367 |
+
|
| 368 |
+
def close(self):
|
| 369 |
+
if self._capture is not None:
|
| 370 |
+
out, err = self._capture.pop_outerr_to_orig()
|
| 371 |
+
self._captured_out += out
|
| 372 |
+
self._captured_err += err
|
| 373 |
+
self._capture.stop_capturing()
|
| 374 |
+
self._capture = None
|
| 375 |
+
|
| 376 |
+
def readouterr(self):
|
| 377 |
+
"""Read and return the captured output so far, resetting the internal buffer.
|
| 378 |
+
|
| 379 |
+
:return: captured content as a namedtuple with ``out`` and ``err`` string attributes
|
| 380 |
+
"""
|
| 381 |
+
captured_out, captured_err = self._captured_out, self._captured_err
|
| 382 |
+
if self._capture is not None:
|
| 383 |
+
out, err = self._capture.readouterr()
|
| 384 |
+
captured_out += out
|
| 385 |
+
captured_err += err
|
| 386 |
+
self._captured_out = self.captureclass.EMPTY_BUFFER
|
| 387 |
+
self._captured_err = self.captureclass.EMPTY_BUFFER
|
| 388 |
+
return CaptureResult(captured_out, captured_err)
|
| 389 |
+
|
| 390 |
+
def _suspend(self):
|
| 391 |
+
"""Suspends this fixture's own capturing temporarily."""
|
| 392 |
+
if self._capture is not None:
|
| 393 |
+
self._capture.suspend_capturing()
|
| 394 |
+
|
| 395 |
+
def _resume(self):
|
| 396 |
+
"""Resumes this fixture's own capturing temporarily."""
|
| 397 |
+
if self._capture is not None:
|
| 398 |
+
self._capture.resume_capturing()
|
| 399 |
+
|
| 400 |
+
@contextlib.contextmanager
|
| 401 |
+
def disabled(self):
|
| 402 |
+
"""Temporarily disables capture while inside the 'with' block."""
|
| 403 |
+
capmanager = self.request.config.pluginmanager.getplugin("capturemanager")
|
| 404 |
+
with capmanager.global_and_fixture_disabled():
|
| 405 |
+
yield
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
def safe_text_dupfile(f, mode, default_encoding="UTF8"):
|
| 409 |
+
""" return an open text file object that's a duplicate of f on the
|
| 410 |
+
FD-level if possible.
|
| 411 |
+
"""
|
| 412 |
+
encoding = getattr(f, "encoding", None)
|
| 413 |
+
try:
|
| 414 |
+
fd = f.fileno()
|
| 415 |
+
except Exception:
|
| 416 |
+
if "b" not in getattr(f, "mode", "") and hasattr(f, "encoding"):
|
| 417 |
+
# we seem to have a text stream, let's just use it
|
| 418 |
+
return f
|
| 419 |
+
else:
|
| 420 |
+
newfd = os.dup(fd)
|
| 421 |
+
if "b" not in mode:
|
| 422 |
+
mode += "b"
|
| 423 |
+
f = os.fdopen(newfd, mode, 0) # no buffering
|
| 424 |
+
return EncodedFile(f, encoding or default_encoding)
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
class EncodedFile(object):
|
| 428 |
+
errors = "strict" # possibly needed by py3 code (issue555)
|
| 429 |
+
|
| 430 |
+
def __init__(self, buffer, encoding):
|
| 431 |
+
self.buffer = buffer
|
| 432 |
+
self.encoding = encoding
|
| 433 |
+
|
| 434 |
+
def write(self, obj):
|
| 435 |
+
if isinstance(obj, six.text_type):
|
| 436 |
+
obj = obj.encode(self.encoding, "replace")
|
| 437 |
+
elif _PY3:
|
| 438 |
+
raise TypeError(
|
| 439 |
+
"write() argument must be str, not {}".format(type(obj).__name__)
|
| 440 |
+
)
|
| 441 |
+
self.buffer.write(obj)
|
| 442 |
+
|
| 443 |
+
def writelines(self, linelist):
|
| 444 |
+
data = "".join(linelist)
|
| 445 |
+
self.write(data)
|
| 446 |
+
|
| 447 |
+
@property
|
| 448 |
+
def name(self):
|
| 449 |
+
"""Ensure that file.name is a string."""
|
| 450 |
+
return repr(self.buffer)
|
| 451 |
+
|
| 452 |
+
@property
|
| 453 |
+
def mode(self):
|
| 454 |
+
return self.buffer.mode.replace("b", "")
|
| 455 |
+
|
| 456 |
+
def __getattr__(self, name):
|
| 457 |
+
return getattr(object.__getattribute__(self, "buffer"), name)
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
CaptureResult = collections.namedtuple("CaptureResult", ["out", "err"])
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
class MultiCapture(object):
|
| 464 |
+
out = err = in_ = None
|
| 465 |
+
_state = None
|
| 466 |
+
|
| 467 |
+
def __init__(self, out=True, err=True, in_=True, Capture=None):
|
| 468 |
+
if in_:
|
| 469 |
+
self.in_ = Capture(0)
|
| 470 |
+
if out:
|
| 471 |
+
self.out = Capture(1)
|
| 472 |
+
if err:
|
| 473 |
+
self.err = Capture(2)
|
| 474 |
+
|
| 475 |
+
def __repr__(self):
|
| 476 |
+
return "<MultiCapture out=%r err=%r in_=%r _state=%r _in_suspended=%r>" % (
|
| 477 |
+
self.out,
|
| 478 |
+
self.err,
|
| 479 |
+
self.in_,
|
| 480 |
+
self._state,
|
| 481 |
+
getattr(self, "_in_suspended", "<UNSET>"),
|
| 482 |
+
)
|
| 483 |
+
|
| 484 |
+
def start_capturing(self):
|
| 485 |
+
self._state = "started"
|
| 486 |
+
if self.in_:
|
| 487 |
+
self.in_.start()
|
| 488 |
+
if self.out:
|
| 489 |
+
self.out.start()
|
| 490 |
+
if self.err:
|
| 491 |
+
self.err.start()
|
| 492 |
+
|
| 493 |
+
def pop_outerr_to_orig(self):
|
| 494 |
+
""" pop current snapshot out/err capture and flush to orig streams. """
|
| 495 |
+
out, err = self.readouterr()
|
| 496 |
+
if out:
|
| 497 |
+
self.out.writeorg(out)
|
| 498 |
+
if err:
|
| 499 |
+
self.err.writeorg(err)
|
| 500 |
+
return out, err
|
| 501 |
+
|
| 502 |
+
def suspend_capturing(self, in_=False):
|
| 503 |
+
self._state = "suspended"
|
| 504 |
+
if self.out:
|
| 505 |
+
self.out.suspend()
|
| 506 |
+
if self.err:
|
| 507 |
+
self.err.suspend()
|
| 508 |
+
if in_ and self.in_:
|
| 509 |
+
self.in_.suspend()
|
| 510 |
+
self._in_suspended = True
|
| 511 |
+
|
| 512 |
+
def resume_capturing(self):
|
| 513 |
+
self._state = "resumed"
|
| 514 |
+
if self.out:
|
| 515 |
+
self.out.resume()
|
| 516 |
+
if self.err:
|
| 517 |
+
self.err.resume()
|
| 518 |
+
if hasattr(self, "_in_suspended"):
|
| 519 |
+
self.in_.resume()
|
| 520 |
+
del self._in_suspended
|
| 521 |
+
|
| 522 |
+
def stop_capturing(self):
|
| 523 |
+
""" stop capturing and reset capturing streams """
|
| 524 |
+
if self._state == "stopped":
|
| 525 |
+
raise ValueError("was already stopped")
|
| 526 |
+
self._state = "stopped"
|
| 527 |
+
if self.out:
|
| 528 |
+
self.out.done()
|
| 529 |
+
if self.err:
|
| 530 |
+
self.err.done()
|
| 531 |
+
if self.in_:
|
| 532 |
+
self.in_.done()
|
| 533 |
+
|
| 534 |
+
def readouterr(self):
|
| 535 |
+
""" return snapshot unicode value of stdout/stderr capturings. """
|
| 536 |
+
return CaptureResult(
|
| 537 |
+
self.out.snap() if self.out is not None else "",
|
| 538 |
+
self.err.snap() if self.err is not None else "",
|
| 539 |
+
)
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
class NoCapture(object):
|
| 543 |
+
EMPTY_BUFFER = None
|
| 544 |
+
__init__ = start = done = suspend = resume = lambda *args: None
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
class FDCaptureBinary(object):
|
| 548 |
+
"""Capture IO to/from a given os-level filedescriptor.
|
| 549 |
+
|
| 550 |
+
snap() produces `bytes`
|
| 551 |
+
"""
|
| 552 |
+
|
| 553 |
+
EMPTY_BUFFER = b""
|
| 554 |
+
_state = None
|
| 555 |
+
|
| 556 |
+
def __init__(self, targetfd, tmpfile=None):
|
| 557 |
+
self.targetfd = targetfd
|
| 558 |
+
try:
|
| 559 |
+
self.targetfd_save = os.dup(self.targetfd)
|
| 560 |
+
except OSError:
|
| 561 |
+
self.start = lambda: None
|
| 562 |
+
self.done = lambda: None
|
| 563 |
+
else:
|
| 564 |
+
if targetfd == 0:
|
| 565 |
+
assert not tmpfile, "cannot set tmpfile with stdin"
|
| 566 |
+
tmpfile = open(os.devnull, "r")
|
| 567 |
+
self.syscapture = SysCapture(targetfd)
|
| 568 |
+
else:
|
| 569 |
+
if tmpfile is None:
|
| 570 |
+
f = TemporaryFile()
|
| 571 |
+
with f:
|
| 572 |
+
tmpfile = safe_text_dupfile(f, mode="wb+")
|
| 573 |
+
if targetfd in patchsysdict:
|
| 574 |
+
self.syscapture = SysCapture(targetfd, tmpfile)
|
| 575 |
+
else:
|
| 576 |
+
self.syscapture = NoCapture()
|
| 577 |
+
self.tmpfile = tmpfile
|
| 578 |
+
self.tmpfile_fd = tmpfile.fileno()
|
| 579 |
+
|
| 580 |
+
def __repr__(self):
|
| 581 |
+
return "<FDCapture %s oldfd=%s _state=%r>" % (
|
| 582 |
+
self.targetfd,
|
| 583 |
+
getattr(self, "targetfd_save", None),
|
| 584 |
+
self._state,
|
| 585 |
+
)
|
| 586 |
+
|
| 587 |
+
def start(self):
|
| 588 |
+
""" Start capturing on targetfd using memorized tmpfile. """
|
| 589 |
+
try:
|
| 590 |
+
os.fstat(self.targetfd_save)
|
| 591 |
+
except (AttributeError, OSError):
|
| 592 |
+
raise ValueError("saved filedescriptor not valid anymore")
|
| 593 |
+
os.dup2(self.tmpfile_fd, self.targetfd)
|
| 594 |
+
self.syscapture.start()
|
| 595 |
+
self._state = "started"
|
| 596 |
+
|
| 597 |
+
def snap(self):
|
| 598 |
+
self.tmpfile.seek(0)
|
| 599 |
+
res = self.tmpfile.read()
|
| 600 |
+
self.tmpfile.seek(0)
|
| 601 |
+
self.tmpfile.truncate()
|
| 602 |
+
return res
|
| 603 |
+
|
| 604 |
+
def done(self):
|
| 605 |
+
""" stop capturing, restore streams, return original capture file,
|
| 606 |
+
seeked to position zero. """
|
| 607 |
+
targetfd_save = self.__dict__.pop("targetfd_save")
|
| 608 |
+
os.dup2(targetfd_save, self.targetfd)
|
| 609 |
+
os.close(targetfd_save)
|
| 610 |
+
self.syscapture.done()
|
| 611 |
+
_attempt_to_close_capture_file(self.tmpfile)
|
| 612 |
+
self._state = "done"
|
| 613 |
+
|
| 614 |
+
def suspend(self):
|
| 615 |
+
self.syscapture.suspend()
|
| 616 |
+
os.dup2(self.targetfd_save, self.targetfd)
|
| 617 |
+
self._state = "suspended"
|
| 618 |
+
|
| 619 |
+
def resume(self):
|
| 620 |
+
self.syscapture.resume()
|
| 621 |
+
os.dup2(self.tmpfile_fd, self.targetfd)
|
| 622 |
+
self._state = "resumed"
|
| 623 |
+
|
| 624 |
+
def writeorg(self, data):
|
| 625 |
+
""" write to original file descriptor. """
|
| 626 |
+
if isinstance(data, six.text_type):
|
| 627 |
+
data = data.encode("utf8") # XXX use encoding of original stream
|
| 628 |
+
os.write(self.targetfd_save, data)
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
class FDCapture(FDCaptureBinary):
|
| 632 |
+
"""Capture IO to/from a given os-level filedescriptor.
|
| 633 |
+
|
| 634 |
+
snap() produces text
|
| 635 |
+
"""
|
| 636 |
+
|
| 637 |
+
EMPTY_BUFFER = str()
|
| 638 |
+
|
| 639 |
+
def snap(self):
|
| 640 |
+
res = super(FDCapture, self).snap()
|
| 641 |
+
enc = getattr(self.tmpfile, "encoding", None)
|
| 642 |
+
if enc and isinstance(res, bytes):
|
| 643 |
+
res = six.text_type(res, enc, "replace")
|
| 644 |
+
return res
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
class SysCapture(object):
|
| 648 |
+
|
| 649 |
+
EMPTY_BUFFER = str()
|
| 650 |
+
_state = None
|
| 651 |
+
|
| 652 |
+
def __init__(self, fd, tmpfile=None):
|
| 653 |
+
name = patchsysdict[fd]
|
| 654 |
+
self._old = getattr(sys, name)
|
| 655 |
+
self.name = name
|
| 656 |
+
if tmpfile is None:
|
| 657 |
+
if name == "stdin":
|
| 658 |
+
tmpfile = DontReadFromInput()
|
| 659 |
+
else:
|
| 660 |
+
tmpfile = CaptureIO()
|
| 661 |
+
self.tmpfile = tmpfile
|
| 662 |
+
|
| 663 |
+
def __repr__(self):
|
| 664 |
+
return "<SysCapture %s _old=%r, tmpfile=%r _state=%r>" % (
|
| 665 |
+
self.name,
|
| 666 |
+
self._old,
|
| 667 |
+
self.tmpfile,
|
| 668 |
+
self._state,
|
| 669 |
+
)
|
| 670 |
+
|
| 671 |
+
def start(self):
|
| 672 |
+
setattr(sys, self.name, self.tmpfile)
|
| 673 |
+
self._state = "started"
|
| 674 |
+
|
| 675 |
+
def snap(self):
|
| 676 |
+
res = self.tmpfile.getvalue()
|
| 677 |
+
self.tmpfile.seek(0)
|
| 678 |
+
self.tmpfile.truncate()
|
| 679 |
+
return res
|
| 680 |
+
|
| 681 |
+
def done(self):
|
| 682 |
+
setattr(sys, self.name, self._old)
|
| 683 |
+
del self._old
|
| 684 |
+
_attempt_to_close_capture_file(self.tmpfile)
|
| 685 |
+
self._state = "done"
|
| 686 |
+
|
| 687 |
+
def suspend(self):
|
| 688 |
+
setattr(sys, self.name, self._old)
|
| 689 |
+
self._state = "suspended"
|
| 690 |
+
|
| 691 |
+
def resume(self):
|
| 692 |
+
setattr(sys, self.name, self.tmpfile)
|
| 693 |
+
self._state = "resumed"
|
| 694 |
+
|
| 695 |
+
def writeorg(self, data):
|
| 696 |
+
self._old.write(data)
|
| 697 |
+
self._old.flush()
|
| 698 |
+
|
| 699 |
+
|
| 700 |
+
class SysCaptureBinary(SysCapture):
|
| 701 |
+
EMPTY_BUFFER = b""
|
| 702 |
+
|
| 703 |
+
def snap(self):
|
| 704 |
+
res = self.tmpfile.buffer.getvalue()
|
| 705 |
+
self.tmpfile.seek(0)
|
| 706 |
+
self.tmpfile.truncate()
|
| 707 |
+
return res
|
| 708 |
+
|
| 709 |
+
|
| 710 |
+
class DontReadFromInput(six.Iterator):
|
| 711 |
+
"""Temporary stub class. Ideally when stdin is accessed, the
|
| 712 |
+
capturing should be turned off, with possibly all data captured
|
| 713 |
+
so far sent to the screen. This should be configurable, though,
|
| 714 |
+
because in automated test runs it is better to crash than
|
| 715 |
+
hang indefinitely.
|
| 716 |
+
"""
|
| 717 |
+
|
| 718 |
+
encoding = None
|
| 719 |
+
|
| 720 |
+
def read(self, *args):
|
| 721 |
+
raise IOError("reading from stdin while output is captured")
|
| 722 |
+
|
| 723 |
+
readline = read
|
| 724 |
+
readlines = read
|
| 725 |
+
__next__ = read
|
| 726 |
+
|
| 727 |
+
def __iter__(self):
|
| 728 |
+
return self
|
| 729 |
+
|
| 730 |
+
def fileno(self):
|
| 731 |
+
raise UnsupportedOperation("redirected stdin is pseudofile, has no fileno()")
|
| 732 |
+
|
| 733 |
+
def isatty(self):
|
| 734 |
+
return False
|
| 735 |
+
|
| 736 |
+
def close(self):
|
| 737 |
+
pass
|
| 738 |
+
|
| 739 |
+
@property
|
| 740 |
+
def buffer(self):
|
| 741 |
+
if sys.version_info >= (3, 0):
|
| 742 |
+
return self
|
| 743 |
+
else:
|
| 744 |
+
raise AttributeError("redirected stdin has no attribute buffer")
|
| 745 |
+
|
| 746 |
+
|
| 747 |
+
def _colorama_workaround():
|
| 748 |
+
"""
|
| 749 |
+
Ensure colorama is imported so that it attaches to the correct stdio
|
| 750 |
+
handles on Windows.
|
| 751 |
+
|
| 752 |
+
colorama uses the terminal on import time. So if something does the
|
| 753 |
+
first import of colorama while I/O capture is active, colorama will
|
| 754 |
+
fail in various ways.
|
| 755 |
+
"""
|
| 756 |
+
if sys.platform.startswith("win32"):
|
| 757 |
+
try:
|
| 758 |
+
import colorama # noqa: F401
|
| 759 |
+
except ImportError:
|
| 760 |
+
pass
|
| 761 |
+
|
| 762 |
+
|
| 763 |
+
def _readline_workaround():
|
| 764 |
+
"""
|
| 765 |
+
Ensure readline is imported so that it attaches to the correct stdio
|
| 766 |
+
handles on Windows.
|
| 767 |
+
|
| 768 |
+
Pdb uses readline support where available--when not running from the Python
|
| 769 |
+
prompt, the readline module is not imported until running the pdb REPL. If
|
| 770 |
+
running pytest with the --pdb option this means the readline module is not
|
| 771 |
+
imported until after I/O capture has been started.
|
| 772 |
+
|
| 773 |
+
This is a problem for pyreadline, which is often used to implement readline
|
| 774 |
+
support on Windows, as it does not attach to the correct handles for stdout
|
| 775 |
+
and/or stdin if they have been redirected by the FDCapture mechanism. This
|
| 776 |
+
workaround ensures that readline is imported before I/O capture is setup so
|
| 777 |
+
that it can attach to the actual stdin/out for the console.
|
| 778 |
+
|
| 779 |
+
See https://github.com/pytest-dev/pytest/pull/1281
|
| 780 |
+
"""
|
| 781 |
+
if sys.platform.startswith("win32"):
|
| 782 |
+
try:
|
| 783 |
+
import readline # noqa: F401
|
| 784 |
+
except ImportError:
|
| 785 |
+
pass
|
| 786 |
+
|
| 787 |
+
|
| 788 |
+
def _py36_windowsconsoleio_workaround(stream):
|
| 789 |
+
"""
|
| 790 |
+
Python 3.6 implemented unicode console handling for Windows. This works
|
| 791 |
+
by reading/writing to the raw console handle using
|
| 792 |
+
``{Read,Write}ConsoleW``.
|
| 793 |
+
|
| 794 |
+
The problem is that we are going to ``dup2`` over the stdio file
|
| 795 |
+
descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
|
| 796 |
+
handles used by Python to write to the console. Though there is still some
|
| 797 |
+
weirdness and the console handle seems to only be closed randomly and not
|
| 798 |
+
on the first call to ``CloseHandle``, or maybe it gets reopened with the
|
| 799 |
+
same handle value when we suspend capturing.
|
| 800 |
+
|
| 801 |
+
The workaround in this case will reopen stdio with a different fd which
|
| 802 |
+
also means a different handle by replicating the logic in
|
| 803 |
+
"Py_lifecycle.c:initstdio/create_stdio".
|
| 804 |
+
|
| 805 |
+
:param stream: in practice ``sys.stdout`` or ``sys.stderr``, but given
|
| 806 |
+
here as parameter for unittesting purposes.
|
| 807 |
+
|
| 808 |
+
See https://github.com/pytest-dev/py/issues/103
|
| 809 |
+
"""
|
| 810 |
+
if not sys.platform.startswith("win32") or sys.version_info[:2] < (3, 6):
|
| 811 |
+
return
|
| 812 |
+
|
| 813 |
+
# bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666)
|
| 814 |
+
if not hasattr(stream, "buffer"):
|
| 815 |
+
return
|
| 816 |
+
|
| 817 |
+
buffered = hasattr(stream.buffer, "raw")
|
| 818 |
+
raw_stdout = stream.buffer.raw if buffered else stream.buffer
|
| 819 |
+
|
| 820 |
+
if not isinstance(raw_stdout, io._WindowsConsoleIO):
|
| 821 |
+
return
|
| 822 |
+
|
| 823 |
+
def _reopen_stdio(f, mode):
|
| 824 |
+
if not buffered and mode[0] == "w":
|
| 825 |
+
buffering = 0
|
| 826 |
+
else:
|
| 827 |
+
buffering = -1
|
| 828 |
+
|
| 829 |
+
return io.TextIOWrapper(
|
| 830 |
+
open(os.dup(f.fileno()), mode, buffering),
|
| 831 |
+
f.encoding,
|
| 832 |
+
f.errors,
|
| 833 |
+
f.newlines,
|
| 834 |
+
f.line_buffering,
|
| 835 |
+
)
|
| 836 |
+
|
| 837 |
+
sys.stdin = _reopen_stdio(sys.stdin, "rb")
|
| 838 |
+
sys.stdout = _reopen_stdio(sys.stdout, "wb")
|
| 839 |
+
sys.stderr = _reopen_stdio(sys.stderr, "wb")
|
| 840 |
+
|
| 841 |
+
|
| 842 |
+
def _attempt_to_close_capture_file(f):
|
| 843 |
+
"""Suppress IOError when closing the temporary file used for capturing streams in py27 (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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
python version compatibility code
|
| 4 |
+
"""
|
| 5 |
+
from __future__ import absolute_import
|
| 6 |
+
from __future__ import division
|
| 7 |
+
from __future__ import print_function
|
| 8 |
+
|
| 9 |
+
import codecs
|
| 10 |
+
import functools
|
| 11 |
+
import inspect
|
| 12 |
+
import re
|
| 13 |
+
import sys
|
| 14 |
+
from contextlib import contextmanager
|
| 15 |
+
|
| 16 |
+
import py
|
| 17 |
+
import six
|
| 18 |
+
from six import text_type
|
| 19 |
+
|
| 20 |
+
import _pytest
|
| 21 |
+
from _pytest._io.saferepr import saferepr
|
| 22 |
+
from _pytest.outcomes import fail
|
| 23 |
+
from _pytest.outcomes import TEST_OUTCOME
|
| 24 |
+
|
| 25 |
+
try:
|
| 26 |
+
import enum
|
| 27 |
+
except ImportError: # pragma: no cover
|
| 28 |
+
# Only available in Python 3.4+ or as a backport
|
| 29 |
+
enum = None
|
| 30 |
+
|
| 31 |
+
_PY3 = sys.version_info > (3, 0)
|
| 32 |
+
_PY2 = not _PY3
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
if _PY3:
|
| 36 |
+
from inspect import signature, Parameter as Parameter
|
| 37 |
+
else:
|
| 38 |
+
from funcsigs import signature, Parameter as Parameter
|
| 39 |
+
|
| 40 |
+
NOTSET = object()
|
| 41 |
+
|
| 42 |
+
PY35 = sys.version_info[:2] >= (3, 5)
|
| 43 |
+
PY36 = sys.version_info[:2] >= (3, 6)
|
| 44 |
+
MODULE_NOT_FOUND_ERROR = "ModuleNotFoundError" if PY36 else "ImportError"
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
if _PY3:
|
| 48 |
+
from collections.abc import MutableMapping as MappingMixin
|
| 49 |
+
from collections.abc import Iterable, Mapping, Sequence, Sized
|
| 50 |
+
else:
|
| 51 |
+
# those raise DeprecationWarnings in Python >=3.7
|
| 52 |
+
from collections import MutableMapping as MappingMixin # noqa
|
| 53 |
+
from collections import Iterable, Mapping, Sequence, Sized # noqa
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
if sys.version_info >= (3, 4):
|
| 57 |
+
from importlib.util import spec_from_file_location
|
| 58 |
+
else:
|
| 59 |
+
|
| 60 |
+
def spec_from_file_location(*_, **__):
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _format_args(func):
|
| 65 |
+
return str(signature(func))
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
isfunction = inspect.isfunction
|
| 69 |
+
isclass = inspect.isclass
|
| 70 |
+
# used to work around a python2 exception info leak
|
| 71 |
+
exc_clear = getattr(sys, "exc_clear", lambda: None)
|
| 72 |
+
# The type of re.compile objects is not exposed in Python.
|
| 73 |
+
REGEX_TYPE = type(re.compile(""))
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def is_generator(func):
|
| 77 |
+
genfunc = inspect.isgeneratorfunction(func)
|
| 78 |
+
return genfunc and not iscoroutinefunction(func)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def iscoroutinefunction(func):
|
| 82 |
+
"""Return True if func is a decorated coroutine function.
|
| 83 |
+
|
| 84 |
+
Note: copied and modified from Python 3.5's builtin couroutines.py to avoid import asyncio directly,
|
| 85 |
+
which in turns also initializes the "logging" module as side-effect (see issue #8).
|
| 86 |
+
"""
|
| 87 |
+
return getattr(func, "_is_coroutine", False) or (
|
| 88 |
+
hasattr(inspect, "iscoroutinefunction") and inspect.iscoroutinefunction(func)
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def getlocation(function, curdir):
|
| 93 |
+
function = get_real_func(function)
|
| 94 |
+
fn = py.path.local(inspect.getfile(function))
|
| 95 |
+
lineno = function.__code__.co_firstlineno
|
| 96 |
+
if fn.relto(curdir):
|
| 97 |
+
fn = fn.relto(curdir)
|
| 98 |
+
return "%s:%d" % (fn, lineno + 1)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def num_mock_patch_args(function):
|
| 102 |
+
""" return number of arguments used up by mock arguments (if any) """
|
| 103 |
+
patchings = getattr(function, "patchings", None)
|
| 104 |
+
if not patchings:
|
| 105 |
+
return 0
|
| 106 |
+
mock_modules = [sys.modules.get("mock"), sys.modules.get("unittest.mock")]
|
| 107 |
+
if any(mock_modules):
|
| 108 |
+
sentinels = [m.DEFAULT for m in mock_modules if m is not None]
|
| 109 |
+
return len(
|
| 110 |
+
[p for p in patchings if not p.attribute_name and p.new in sentinels]
|
| 111 |
+
)
|
| 112 |
+
return len(patchings)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def getfuncargnames(function, is_method=False, cls=None):
|
| 116 |
+
"""Returns the names of a function's mandatory arguments.
|
| 117 |
+
|
| 118 |
+
This should return the names of all function arguments that:
|
| 119 |
+
* Aren't bound to an instance or type as in instance or class methods.
|
| 120 |
+
* Don't have default values.
|
| 121 |
+
* Aren't bound with functools.partial.
|
| 122 |
+
* Aren't replaced with mocks.
|
| 123 |
+
|
| 124 |
+
The is_method and cls arguments indicate that the function should
|
| 125 |
+
be treated as a bound method even though it's not unless, only in
|
| 126 |
+
the case of cls, the function is a static method.
|
| 127 |
+
|
| 128 |
+
@RonnyPfannschmidt: This function should be refactored when we
|
| 129 |
+
revisit fixtures. The fixture mechanism should ask the node for
|
| 130 |
+
the fixture names, and not try to obtain directly from the
|
| 131 |
+
function object well after collection has occurred.
|
| 132 |
+
|
| 133 |
+
"""
|
| 134 |
+
# The parameters attribute of a Signature object contains an
|
| 135 |
+
# ordered mapping of parameter names to Parameter instances. This
|
| 136 |
+
# creates a tuple of the names of the parameters that don't have
|
| 137 |
+
# defaults.
|
| 138 |
+
try:
|
| 139 |
+
parameters = signature(function).parameters
|
| 140 |
+
except (ValueError, TypeError) as e:
|
| 141 |
+
fail(
|
| 142 |
+
"Could not determine arguments of {!r}: {}".format(function, e),
|
| 143 |
+
pytrace=False,
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
arg_names = tuple(
|
| 147 |
+
p.name
|
| 148 |
+
for p in parameters.values()
|
| 149 |
+
if (
|
| 150 |
+
p.kind is Parameter.POSITIONAL_OR_KEYWORD
|
| 151 |
+
or p.kind is Parameter.KEYWORD_ONLY
|
| 152 |
+
)
|
| 153 |
+
and p.default is Parameter.empty
|
| 154 |
+
)
|
| 155 |
+
# If this function should be treated as a bound method even though
|
| 156 |
+
# it's passed as an unbound method or function, remove the first
|
| 157 |
+
# parameter name.
|
| 158 |
+
if is_method or (
|
| 159 |
+
cls and not isinstance(cls.__dict__.get(function.__name__, None), staticmethod)
|
| 160 |
+
):
|
| 161 |
+
arg_names = arg_names[1:]
|
| 162 |
+
# Remove any names that will be replaced with mocks.
|
| 163 |
+
if hasattr(function, "__wrapped__"):
|
| 164 |
+
arg_names = arg_names[num_mock_patch_args(function) :]
|
| 165 |
+
return arg_names
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
@contextmanager
|
| 169 |
+
def dummy_context_manager():
|
| 170 |
+
"""Context manager that does nothing, useful in situations where you might need an actual context manager or not
|
| 171 |
+
depending on some condition. Using this allow to keep the same code"""
|
| 172 |
+
yield
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
def get_default_arg_names(function):
|
| 176 |
+
# Note: this code intentionally mirrors the code at the beginning of getfuncargnames,
|
| 177 |
+
# to get the arguments which were excluded from its result because they had default values
|
| 178 |
+
return tuple(
|
| 179 |
+
p.name
|
| 180 |
+
for p in signature(function).parameters.values()
|
| 181 |
+
if p.kind in (Parameter.POSITIONAL_OR_KEYWORD, Parameter.KEYWORD_ONLY)
|
| 182 |
+
and p.default is not Parameter.empty
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
_non_printable_ascii_translate_table = {
|
| 187 |
+
i: u"\\x{:02x}".format(i) for i in range(128) if i not in range(32, 127)
|
| 188 |
+
}
|
| 189 |
+
_non_printable_ascii_translate_table.update(
|
| 190 |
+
{ord("\t"): u"\\t", ord("\r"): u"\\r", ord("\n"): u"\\n"}
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def _translate_non_printable(s):
|
| 195 |
+
return s.translate(_non_printable_ascii_translate_table)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
if _PY3:
|
| 199 |
+
STRING_TYPES = bytes, str
|
| 200 |
+
UNICODE_TYPES = six.text_type
|
| 201 |
+
|
| 202 |
+
if PY35:
|
| 203 |
+
|
| 204 |
+
def _bytes_to_ascii(val):
|
| 205 |
+
return val.decode("ascii", "backslashreplace")
|
| 206 |
+
|
| 207 |
+
else:
|
| 208 |
+
|
| 209 |
+
def _bytes_to_ascii(val):
|
| 210 |
+
if val:
|
| 211 |
+
# source: http://goo.gl/bGsnwC
|
| 212 |
+
encoded_bytes, _ = codecs.escape_encode(val)
|
| 213 |
+
return encoded_bytes.decode("ascii")
|
| 214 |
+
else:
|
| 215 |
+
# empty bytes crashes codecs.escape_encode (#1087)
|
| 216 |
+
return ""
|
| 217 |
+
|
| 218 |
+
def ascii_escaped(val):
|
| 219 |
+
"""If val is pure ascii, returns it as a str(). Otherwise, escapes
|
| 220 |
+
bytes objects into a sequence of escaped bytes:
|
| 221 |
+
|
| 222 |
+
b'\xc3\xb4\xc5\xd6' -> u'\\xc3\\xb4\\xc5\\xd6'
|
| 223 |
+
|
| 224 |
+
and escapes unicode objects into a sequence of escaped unicode
|
| 225 |
+
ids, e.g.:
|
| 226 |
+
|
| 227 |
+
'4\\nV\\U00043efa\\x0eMXWB\\x1e\\u3028\\u15fd\\xcd\\U0007d944'
|
| 228 |
+
|
| 229 |
+
note:
|
| 230 |
+
the obvious "v.decode('unicode-escape')" will return
|
| 231 |
+
valid utf-8 unicode if it finds them in bytes, but we
|
| 232 |
+
want to return escaped bytes for any byte, even if they match
|
| 233 |
+
a utf-8 string.
|
| 234 |
+
|
| 235 |
+
"""
|
| 236 |
+
if isinstance(val, bytes):
|
| 237 |
+
ret = _bytes_to_ascii(val)
|
| 238 |
+
else:
|
| 239 |
+
ret = val.encode("unicode_escape").decode("ascii")
|
| 240 |
+
return _translate_non_printable(ret)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
else:
|
| 244 |
+
STRING_TYPES = six.string_types
|
| 245 |
+
UNICODE_TYPES = six.text_type
|
| 246 |
+
|
| 247 |
+
def ascii_escaped(val):
|
| 248 |
+
"""In py2 bytes and str are the same type, so return if it's a bytes
|
| 249 |
+
object, return it unchanged if it is a full ascii string,
|
| 250 |
+
otherwise escape it into its binary form.
|
| 251 |
+
|
| 252 |
+
If it's a unicode string, change the unicode characters into
|
| 253 |
+
unicode escapes.
|
| 254 |
+
|
| 255 |
+
"""
|
| 256 |
+
if isinstance(val, bytes):
|
| 257 |
+
try:
|
| 258 |
+
ret = val.decode("ascii")
|
| 259 |
+
except UnicodeDecodeError:
|
| 260 |
+
ret = val.encode("string-escape").decode("ascii")
|
| 261 |
+
else:
|
| 262 |
+
ret = val.encode("unicode-escape").decode("ascii")
|
| 263 |
+
return _translate_non_printable(ret)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
class _PytestWrapper(object):
|
| 267 |
+
"""Dummy wrapper around a function object for internal use only.
|
| 268 |
+
|
| 269 |
+
Used to correctly unwrap the underlying function object
|
| 270 |
+
when we are creating fixtures, because we wrap the function object ourselves with a decorator
|
| 271 |
+
to issue warnings when the fixture function is called directly.
|
| 272 |
+
"""
|
| 273 |
+
|
| 274 |
+
def __init__(self, obj):
|
| 275 |
+
self.obj = obj
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
def get_real_func(obj):
|
| 279 |
+
""" gets the real function object of the (possibly) wrapped object by
|
| 280 |
+
functools.wraps or functools.partial.
|
| 281 |
+
"""
|
| 282 |
+
start_obj = obj
|
| 283 |
+
for i in range(100):
|
| 284 |
+
# __pytest_wrapped__ is set by @pytest.fixture when wrapping the fixture function
|
| 285 |
+
# to trigger a warning if it gets called directly instead of by pytest: we don't
|
| 286 |
+
# want to unwrap further than this otherwise we lose useful wrappings like @mock.patch (#3774)
|
| 287 |
+
new_obj = getattr(obj, "__pytest_wrapped__", None)
|
| 288 |
+
if isinstance(new_obj, _PytestWrapper):
|
| 289 |
+
obj = new_obj.obj
|
| 290 |
+
break
|
| 291 |
+
new_obj = getattr(obj, "__wrapped__", None)
|
| 292 |
+
if new_obj is None:
|
| 293 |
+
break
|
| 294 |
+
obj = new_obj
|
| 295 |
+
else:
|
| 296 |
+
raise ValueError(
|
| 297 |
+
("could not find real function of {start}\nstopped at {current}").format(
|
| 298 |
+
start=saferepr(start_obj), current=saferepr(obj)
|
| 299 |
+
)
|
| 300 |
+
)
|
| 301 |
+
if isinstance(obj, functools.partial):
|
| 302 |
+
obj = obj.func
|
| 303 |
+
return obj
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
def get_real_method(obj, holder):
|
| 307 |
+
"""
|
| 308 |
+
Attempts to obtain the real function object that might be wrapping ``obj``, while at the same time
|
| 309 |
+
returning a bound method to ``holder`` if the original object was a bound method.
|
| 310 |
+
"""
|
| 311 |
+
try:
|
| 312 |
+
is_method = hasattr(obj, "__func__")
|
| 313 |
+
obj = get_real_func(obj)
|
| 314 |
+
except Exception:
|
| 315 |
+
return obj
|
| 316 |
+
if is_method and hasattr(obj, "__get__") and callable(obj.__get__):
|
| 317 |
+
obj = obj.__get__(holder)
|
| 318 |
+
return obj
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
def getfslineno(obj):
|
| 322 |
+
# xxx let decorators etc specify a sane ordering
|
| 323 |
+
obj = get_real_func(obj)
|
| 324 |
+
if hasattr(obj, "place_as"):
|
| 325 |
+
obj = obj.place_as
|
| 326 |
+
fslineno = _pytest._code.getfslineno(obj)
|
| 327 |
+
assert isinstance(fslineno[1], int), obj
|
| 328 |
+
return fslineno
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
def getimfunc(func):
|
| 332 |
+
try:
|
| 333 |
+
return func.__func__
|
| 334 |
+
except AttributeError:
|
| 335 |
+
return func
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
def safe_getattr(object, name, default):
|
| 339 |
+
""" Like getattr but return default upon any Exception or any OutcomeException.
|
| 340 |
+
|
| 341 |
+
Attribute access can potentially fail for 'evil' Python objects.
|
| 342 |
+
See issue #214.
|
| 343 |
+
It catches OutcomeException because of #2490 (issue #580), new outcomes are derived from BaseException
|
| 344 |
+
instead of Exception (for more details check #2707)
|
| 345 |
+
"""
|
| 346 |
+
try:
|
| 347 |
+
return getattr(object, name, default)
|
| 348 |
+
except TEST_OUTCOME:
|
| 349 |
+
return default
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
def safe_isclass(obj):
|
| 353 |
+
"""Ignore any exception via isinstance on Python 3."""
|
| 354 |
+
try:
|
| 355 |
+
return isclass(obj)
|
| 356 |
+
except Exception:
|
| 357 |
+
return False
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
def _is_unittest_unexpected_success_a_failure():
|
| 361 |
+
"""Return if the test suite should fail if an @expectedFailure unittest test PASSES.
|
| 362 |
+
|
| 363 |
+
From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
|
| 364 |
+
Changed in version 3.4: Returns False if there were any
|
| 365 |
+
unexpectedSuccesses from tests marked with the expectedFailure() decorator.
|
| 366 |
+
"""
|
| 367 |
+
return sys.version_info >= (3, 4)
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
if _PY3:
|
| 371 |
+
|
| 372 |
+
def safe_str(v):
|
| 373 |
+
"""returns v as string"""
|
| 374 |
+
return str(v)
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
else:
|
| 378 |
+
|
| 379 |
+
def safe_str(v):
|
| 380 |
+
"""returns v as string, converting to utf-8 if necessary"""
|
| 381 |
+
try:
|
| 382 |
+
return str(v)
|
| 383 |
+
except UnicodeError:
|
| 384 |
+
if not isinstance(v, text_type):
|
| 385 |
+
v = text_type(v)
|
| 386 |
+
errors = "replace"
|
| 387 |
+
return v.encode("utf-8", errors)
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
COLLECT_FAKEMODULE_ATTRIBUTES = (
|
| 391 |
+
"Collector",
|
| 392 |
+
"Module",
|
| 393 |
+
"Function",
|
| 394 |
+
"Instance",
|
| 395 |
+
"Session",
|
| 396 |
+
"Item",
|
| 397 |
+
"Class",
|
| 398 |
+
"File",
|
| 399 |
+
"_fillfuncargs",
|
| 400 |
+
)
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
def _setup_collect_fakemodule():
|
| 404 |
+
from types import ModuleType
|
| 405 |
+
import pytest
|
| 406 |
+
|
| 407 |
+
pytest.collect = ModuleType("pytest.collect")
|
| 408 |
+
pytest.collect.__all__ = [] # used for setns
|
| 409 |
+
for attr in COLLECT_FAKEMODULE_ATTRIBUTES:
|
| 410 |
+
setattr(pytest.collect, attr, getattr(pytest, attr))
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
if _PY2:
|
| 414 |
+
# Without this the test_dupfile_on_textio will fail, otherwise CaptureIO could directly inherit from StringIO.
|
| 415 |
+
from py.io import TextIO
|
| 416 |
+
|
| 417 |
+
class CaptureIO(TextIO):
|
| 418 |
+
@property
|
| 419 |
+
def encoding(self):
|
| 420 |
+
return getattr(self, "_encoding", "UTF-8")
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
else:
|
| 424 |
+
import io
|
| 425 |
+
|
| 426 |
+
class CaptureIO(io.TextIOWrapper):
|
| 427 |
+
def __init__(self):
|
| 428 |
+
super(CaptureIO, self).__init__(
|
| 429 |
+
io.BytesIO(), encoding="UTF-8", newline="", write_through=True
|
| 430 |
+
)
|
| 431 |
+
|
| 432 |
+
def getvalue(self):
|
| 433 |
+
return self.buffer.getvalue().decode("UTF-8")
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
class FuncargnamesCompatAttr(object):
|
| 437 |
+
""" helper class so that Metafunc, Function and FixtureRequest
|
| 438 |
+
don't need to each define the "funcargnames" compatibility attribute.
|
| 439 |
+
"""
|
| 440 |
+
|
| 441 |
+
@property
|
| 442 |
+
def funcargnames(self):
|
| 443 |
+
""" alias attribute for ``fixturenames`` for pre-2.3 compatibility"""
|
| 444 |
+
return self.fixturenames
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
if six.PY2:
|
| 448 |
+
|
| 449 |
+
def lru_cache(*_, **__):
|
| 450 |
+
def dec(fn):
|
| 451 |
+
return fn
|
| 452 |
+
|
| 453 |
+
return dec
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
else:
|
| 457 |
+
from functools import lru_cache # noqa: F401
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/_pytest/debugging.py
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
""" interactive debugging with PDB, the Python Debugger. """
|
| 3 |
+
from __future__ import absolute_import
|
| 4 |
+
from __future__ import division
|
| 5 |
+
from __future__ import print_function
|
| 6 |
+
|
| 7 |
+
import argparse
|
| 8 |
+
import pdb
|
| 9 |
+
import sys
|
| 10 |
+
from doctest import UnexpectedException
|
| 11 |
+
|
| 12 |
+
from _pytest import outcomes
|
| 13 |
+
from _pytest.config import hookimpl
|
| 14 |
+
from _pytest.config.exceptions import UsageError
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _validate_usepdb_cls(value):
|
| 18 |
+
"""Validate syntax of --pdbcls option."""
|
| 19 |
+
try:
|
| 20 |
+
modname, classname = value.split(":")
|
| 21 |
+
except ValueError:
|
| 22 |
+
raise argparse.ArgumentTypeError(
|
| 23 |
+
"{!r} is not in the format 'modname:classname'".format(value)
|
| 24 |
+
)
|
| 25 |
+
return (modname, classname)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def pytest_addoption(parser):
|
| 29 |
+
group = parser.getgroup("general")
|
| 30 |
+
group._addoption(
|
| 31 |
+
"--pdb",
|
| 32 |
+
dest="usepdb",
|
| 33 |
+
action="store_true",
|
| 34 |
+
help="start the interactive Python debugger on errors or KeyboardInterrupt.",
|
| 35 |
+
)
|
| 36 |
+
group._addoption(
|
| 37 |
+
"--pdbcls",
|
| 38 |
+
dest="usepdb_cls",
|
| 39 |
+
metavar="modulename:classname",
|
| 40 |
+
type=_validate_usepdb_cls,
|
| 41 |
+
help="start a custom interactive Python debugger on errors. "
|
| 42 |
+
"For example: --pdbcls=IPython.terminal.debugger:TerminalPdb",
|
| 43 |
+
)
|
| 44 |
+
group._addoption(
|
| 45 |
+
"--trace",
|
| 46 |
+
dest="trace",
|
| 47 |
+
action="store_true",
|
| 48 |
+
help="Immediately break when running each test.",
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def pytest_configure(config):
|
| 53 |
+
if config.getvalue("trace"):
|
| 54 |
+
config.pluginmanager.register(PdbTrace(), "pdbtrace")
|
| 55 |
+
if config.getvalue("usepdb"):
|
| 56 |
+
config.pluginmanager.register(PdbInvoke(), "pdbinvoke")
|
| 57 |
+
|
| 58 |
+
pytestPDB._saved.append(
|
| 59 |
+
(pdb.set_trace, pytestPDB._pluginmanager, pytestPDB._config)
|
| 60 |
+
)
|
| 61 |
+
pdb.set_trace = pytestPDB.set_trace
|
| 62 |
+
pytestPDB._pluginmanager = config.pluginmanager
|
| 63 |
+
pytestPDB._config = config
|
| 64 |
+
|
| 65 |
+
# NOTE: not using pytest_unconfigure, since it might get called although
|
| 66 |
+
# pytest_configure was not (if another plugin raises UsageError).
|
| 67 |
+
def fin():
|
| 68 |
+
(
|
| 69 |
+
pdb.set_trace,
|
| 70 |
+
pytestPDB._pluginmanager,
|
| 71 |
+
pytestPDB._config,
|
| 72 |
+
) = pytestPDB._saved.pop()
|
| 73 |
+
|
| 74 |
+
config._cleanup.append(fin)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class pytestPDB(object):
|
| 78 |
+
""" Pseudo PDB that defers to the real pdb. """
|
| 79 |
+
|
| 80 |
+
_pluginmanager = None
|
| 81 |
+
_config = None
|
| 82 |
+
_saved = []
|
| 83 |
+
_recursive_debug = 0
|
| 84 |
+
_wrapped_pdb_cls = None
|
| 85 |
+
|
| 86 |
+
@classmethod
|
| 87 |
+
def _is_capturing(cls, capman):
|
| 88 |
+
if capman:
|
| 89 |
+
return capman.is_capturing()
|
| 90 |
+
return False
|
| 91 |
+
|
| 92 |
+
@classmethod
|
| 93 |
+
def _import_pdb_cls(cls, capman):
|
| 94 |
+
if not cls._config:
|
| 95 |
+
# Happens when using pytest.set_trace outside of a test.
|
| 96 |
+
return pdb.Pdb
|
| 97 |
+
|
| 98 |
+
usepdb_cls = cls._config.getvalue("usepdb_cls")
|
| 99 |
+
|
| 100 |
+
if cls._wrapped_pdb_cls and cls._wrapped_pdb_cls[0] == usepdb_cls:
|
| 101 |
+
return cls._wrapped_pdb_cls[1]
|
| 102 |
+
|
| 103 |
+
if usepdb_cls:
|
| 104 |
+
modname, classname = usepdb_cls
|
| 105 |
+
|
| 106 |
+
try:
|
| 107 |
+
__import__(modname)
|
| 108 |
+
mod = sys.modules[modname]
|
| 109 |
+
|
| 110 |
+
# Handle --pdbcls=pdb:pdb.Pdb (useful e.g. with pdbpp).
|
| 111 |
+
parts = classname.split(".")
|
| 112 |
+
pdb_cls = getattr(mod, parts[0])
|
| 113 |
+
for part in parts[1:]:
|
| 114 |
+
pdb_cls = getattr(pdb_cls, part)
|
| 115 |
+
except Exception as exc:
|
| 116 |
+
value = ":".join((modname, classname))
|
| 117 |
+
raise UsageError(
|
| 118 |
+
"--pdbcls: could not import {!r}: {}".format(value, exc)
|
| 119 |
+
)
|
| 120 |
+
else:
|
| 121 |
+
pdb_cls = pdb.Pdb
|
| 122 |
+
|
| 123 |
+
wrapped_cls = cls._get_pdb_wrapper_class(pdb_cls, capman)
|
| 124 |
+
cls._wrapped_pdb_cls = (usepdb_cls, wrapped_cls)
|
| 125 |
+
return wrapped_cls
|
| 126 |
+
|
| 127 |
+
@classmethod
|
| 128 |
+
def _get_pdb_wrapper_class(cls, pdb_cls, capman):
|
| 129 |
+
import _pytest.config
|
| 130 |
+
|
| 131 |
+
class PytestPdbWrapper(pdb_cls, object):
|
| 132 |
+
_pytest_capman = capman
|
| 133 |
+
_continued = False
|
| 134 |
+
|
| 135 |
+
def do_debug(self, arg):
|
| 136 |
+
cls._recursive_debug += 1
|
| 137 |
+
ret = super(PytestPdbWrapper, self).do_debug(arg)
|
| 138 |
+
cls._recursive_debug -= 1
|
| 139 |
+
return ret
|
| 140 |
+
|
| 141 |
+
def do_continue(self, arg):
|
| 142 |
+
ret = super(PytestPdbWrapper, self).do_continue(arg)
|
| 143 |
+
if cls._recursive_debug == 0:
|
| 144 |
+
tw = _pytest.config.create_terminal_writer(cls._config)
|
| 145 |
+
tw.line()
|
| 146 |
+
|
| 147 |
+
capman = self._pytest_capman
|
| 148 |
+
capturing = pytestPDB._is_capturing(capman)
|
| 149 |
+
if capturing:
|
| 150 |
+
if capturing == "global":
|
| 151 |
+
tw.sep(">", "PDB continue (IO-capturing resumed)")
|
| 152 |
+
else:
|
| 153 |
+
tw.sep(
|
| 154 |
+
">",
|
| 155 |
+
"PDB continue (IO-capturing resumed for %s)"
|
| 156 |
+
% capturing,
|
| 157 |
+
)
|
| 158 |
+
capman.resume()
|
| 159 |
+
else:
|
| 160 |
+
tw.sep(">", "PDB continue")
|
| 161 |
+
cls._pluginmanager.hook.pytest_leave_pdb(config=cls._config, pdb=self)
|
| 162 |
+
self._continued = True
|
| 163 |
+
return ret
|
| 164 |
+
|
| 165 |
+
do_c = do_cont = do_continue
|
| 166 |
+
|
| 167 |
+
def do_quit(self, arg):
|
| 168 |
+
"""Raise Exit outcome when quit command is used in pdb.
|
| 169 |
+
|
| 170 |
+
This is a bit of a hack - it would be better if BdbQuit
|
| 171 |
+
could be handled, but this would require to wrap the
|
| 172 |
+
whole pytest run, and adjust the report etc.
|
| 173 |
+
"""
|
| 174 |
+
ret = super(PytestPdbWrapper, self).do_quit(arg)
|
| 175 |
+
|
| 176 |
+
if cls._recursive_debug == 0:
|
| 177 |
+
outcomes.exit("Quitting debugger")
|
| 178 |
+
|
| 179 |
+
return ret
|
| 180 |
+
|
| 181 |
+
do_q = do_quit
|
| 182 |
+
do_exit = do_quit
|
| 183 |
+
|
| 184 |
+
def setup(self, f, tb):
|
| 185 |
+
"""Suspend on setup().
|
| 186 |
+
|
| 187 |
+
Needed after do_continue resumed, and entering another
|
| 188 |
+
breakpoint again.
|
| 189 |
+
"""
|
| 190 |
+
ret = super(PytestPdbWrapper, self).setup(f, tb)
|
| 191 |
+
if not ret and self._continued:
|
| 192 |
+
# pdb.setup() returns True if the command wants to exit
|
| 193 |
+
# from the interaction: do not suspend capturing then.
|
| 194 |
+
if self._pytest_capman:
|
| 195 |
+
self._pytest_capman.suspend_global_capture(in_=True)
|
| 196 |
+
return ret
|
| 197 |
+
|
| 198 |
+
def get_stack(self, f, t):
|
| 199 |
+
stack, i = super(PytestPdbWrapper, self).get_stack(f, t)
|
| 200 |
+
if f is None:
|
| 201 |
+
# Find last non-hidden frame.
|
| 202 |
+
i = max(0, len(stack) - 1)
|
| 203 |
+
while i and stack[i][0].f_locals.get("__tracebackhide__", False):
|
| 204 |
+
i -= 1
|
| 205 |
+
return stack, i
|
| 206 |
+
|
| 207 |
+
return PytestPdbWrapper
|
| 208 |
+
|
| 209 |
+
@classmethod
|
| 210 |
+
def _init_pdb(cls, method, *args, **kwargs):
|
| 211 |
+
""" Initialize PDB debugging, dropping any IO capturing. """
|
| 212 |
+
import _pytest.config
|
| 213 |
+
|
| 214 |
+
if cls._pluginmanager is not None:
|
| 215 |
+
capman = cls._pluginmanager.getplugin("capturemanager")
|
| 216 |
+
else:
|
| 217 |
+
capman = None
|
| 218 |
+
if capman:
|
| 219 |
+
capman.suspend(in_=True)
|
| 220 |
+
|
| 221 |
+
if cls._config:
|
| 222 |
+
tw = _pytest.config.create_terminal_writer(cls._config)
|
| 223 |
+
tw.line()
|
| 224 |
+
|
| 225 |
+
if cls._recursive_debug == 0:
|
| 226 |
+
# Handle header similar to pdb.set_trace in py37+.
|
| 227 |
+
header = kwargs.pop("header", None)
|
| 228 |
+
if header is not None:
|
| 229 |
+
tw.sep(">", header)
|
| 230 |
+
else:
|
| 231 |
+
capturing = cls._is_capturing(capman)
|
| 232 |
+
if capturing == "global":
|
| 233 |
+
tw.sep(">", "PDB %s (IO-capturing turned off)" % (method,))
|
| 234 |
+
elif capturing:
|
| 235 |
+
tw.sep(
|
| 236 |
+
">",
|
| 237 |
+
"PDB %s (IO-capturing turned off for %s)"
|
| 238 |
+
% (method, capturing),
|
| 239 |
+
)
|
| 240 |
+
else:
|
| 241 |
+
tw.sep(">", "PDB %s" % (method,))
|
| 242 |
+
|
| 243 |
+
_pdb = cls._import_pdb_cls(capman)(**kwargs)
|
| 244 |
+
|
| 245 |
+
if cls._pluginmanager:
|
| 246 |
+
cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config, pdb=_pdb)
|
| 247 |
+
return _pdb
|
| 248 |
+
|
| 249 |
+
@classmethod
|
| 250 |
+
def set_trace(cls, *args, **kwargs):
|
| 251 |
+
"""Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing."""
|
| 252 |
+
frame = sys._getframe().f_back
|
| 253 |
+
_pdb = cls._init_pdb("set_trace", *args, **kwargs)
|
| 254 |
+
_pdb.set_trace(frame)
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
class PdbInvoke(object):
|
| 258 |
+
def pytest_exception_interact(self, node, call, report):
|
| 259 |
+
capman = node.config.pluginmanager.getplugin("capturemanager")
|
| 260 |
+
if capman:
|
| 261 |
+
capman.suspend_global_capture(in_=True)
|
| 262 |
+
out, err = capman.read_global_capture()
|
| 263 |
+
sys.stdout.write(out)
|
| 264 |
+
sys.stdout.write(err)
|
| 265 |
+
_enter_pdb(node, call.excinfo, report)
|
| 266 |
+
|
| 267 |
+
def pytest_internalerror(self, excrepr, excinfo):
|
| 268 |
+
tb = _postmortem_traceback(excinfo)
|
| 269 |
+
post_mortem(tb)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
class PdbTrace(object):
|
| 273 |
+
@hookimpl(hookwrapper=True)
|
| 274 |
+
def pytest_pyfunc_call(self, pyfuncitem):
|
| 275 |
+
_test_pytest_function(pyfuncitem)
|
| 276 |
+
yield
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
def _test_pytest_function(pyfuncitem):
|
| 280 |
+
_pdb = pytestPDB._init_pdb("runcall")
|
| 281 |
+
testfunction = pyfuncitem.obj
|
| 282 |
+
pyfuncitem.obj = _pdb.runcall
|
| 283 |
+
if "func" in pyfuncitem._fixtureinfo.argnames: # pragma: no branch
|
| 284 |
+
raise ValueError("--trace can't be used with a fixture named func!")
|
| 285 |
+
pyfuncitem.funcargs["func"] = testfunction
|
| 286 |
+
new_list = list(pyfuncitem._fixtureinfo.argnames)
|
| 287 |
+
new_list.append("func")
|
| 288 |
+
pyfuncitem._fixtureinfo.argnames = tuple(new_list)
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
def _enter_pdb(node, excinfo, rep):
|
| 292 |
+
# XXX we re-use the TerminalReporter's terminalwriter
|
| 293 |
+
# because this seems to avoid some encoding related troubles
|
| 294 |
+
# for not completely clear reasons.
|
| 295 |
+
tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
|
| 296 |
+
tw.line()
|
| 297 |
+
|
| 298 |
+
showcapture = node.config.option.showcapture
|
| 299 |
+
|
| 300 |
+
for sectionname, content in (
|
| 301 |
+
("stdout", rep.capstdout),
|
| 302 |
+
("stderr", rep.capstderr),
|
| 303 |
+
("log", rep.caplog),
|
| 304 |
+
):
|
| 305 |
+
if showcapture in (sectionname, "all") and content:
|
| 306 |
+
tw.sep(">", "captured " + sectionname)
|
| 307 |
+
if content[-1:] == "\n":
|
| 308 |
+
content = content[:-1]
|
| 309 |
+
tw.line(content)
|
| 310 |
+
|
| 311 |
+
tw.sep(">", "traceback")
|
| 312 |
+
rep.toterminal(tw)
|
| 313 |
+
tw.sep(">", "entering PDB")
|
| 314 |
+
tb = _postmortem_traceback(excinfo)
|
| 315 |
+
rep._pdbshown = True
|
| 316 |
+
post_mortem(tb)
|
| 317 |
+
return rep
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
def _postmortem_traceback(excinfo):
|
| 321 |
+
if isinstance(excinfo.value, UnexpectedException):
|
| 322 |
+
# A doctest.UnexpectedException is not useful for post_mortem.
|
| 323 |
+
# Use the underlying exception instead:
|
| 324 |
+
return excinfo.value.exc_info[2]
|
| 325 |
+
else:
|
| 326 |
+
return excinfo._excinfo[2]
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
def post_mortem(t):
|
| 330 |
+
p = pytestPDB._init_pdb("post_mortem")
|
| 331 |
+
p.reset()
|
| 332 |
+
p.interaction(None, t)
|
| 333 |
+
if p.quitting:
|
| 334 |
+
outcomes.exit("Quitting debugger")
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/future-0.17.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.33.6)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: cp27-none-any
|
| 5 |
+
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/future-0.17.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_dummy_thread
|
| 2 |
+
_markupbase
|
| 3 |
+
_thread
|
| 4 |
+
builtins
|
| 5 |
+
copyreg
|
| 6 |
+
future
|
| 7 |
+
html
|
| 8 |
+
http
|
| 9 |
+
libfuturize
|
| 10 |
+
libpasteurize
|
| 11 |
+
past
|
| 12 |
+
queue
|
| 13 |
+
reprlib
|
| 14 |
+
socketserver
|
| 15 |
+
tkinter
|
| 16 |
+
winreg
|
| 17 |
+
xmlrpc
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
if sys.version_info[0] < 3:
|
| 5 |
+
from future.moves.html import *
|
| 6 |
+
else:
|
| 7 |
+
raise ImportError('This package should not be accessible on Python 3. '
|
| 8 |
+
'Either you are trying to run from the python-future src folder '
|
| 9 |
+
'or your installation of python-future is corrupted.')
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/entities.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
from future.utils import PY3
|
| 3 |
+
|
| 4 |
+
if PY3:
|
| 5 |
+
from html.entities import *
|
| 6 |
+
else:
|
| 7 |
+
from future.moves.html.entities import *
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/html/parser.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
__future_module__ = True
|
| 4 |
+
|
| 5 |
+
if sys.version_info[0] == 3:
|
| 6 |
+
raise ImportError('Cannot import module from python-future source folder')
|
| 7 |
+
else:
|
| 8 |
+
from future.moves.html.parser import *
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
if sys.version_info[0] < 3:
|
| 5 |
+
pass
|
| 6 |
+
else:
|
| 7 |
+
raise ImportError('This package should not be accessible on Python 3. '
|
| 8 |
+
'Either you are trying to run from the python-future src folder '
|
| 9 |
+
'or your installation of python-future is corrupted.')
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/client.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
assert sys.version_info[0] < 3
|
| 5 |
+
|
| 6 |
+
from httplib import *
|
| 7 |
+
from httplib import HTTPMessage
|
| 8 |
+
|
| 9 |
+
# These constants aren't included in __all__ in httplib.py:
|
| 10 |
+
|
| 11 |
+
from httplib import (HTTP_PORT,
|
| 12 |
+
HTTPS_PORT,
|
| 13 |
+
|
| 14 |
+
_CS_IDLE,
|
| 15 |
+
_CS_REQ_STARTED,
|
| 16 |
+
_CS_REQ_SENT,
|
| 17 |
+
|
| 18 |
+
CONTINUE,
|
| 19 |
+
SWITCHING_PROTOCOLS,
|
| 20 |
+
PROCESSING,
|
| 21 |
+
|
| 22 |
+
OK,
|
| 23 |
+
CREATED,
|
| 24 |
+
ACCEPTED,
|
| 25 |
+
NON_AUTHORITATIVE_INFORMATION,
|
| 26 |
+
NO_CONTENT,
|
| 27 |
+
RESET_CONTENT,
|
| 28 |
+
PARTIAL_CONTENT,
|
| 29 |
+
MULTI_STATUS,
|
| 30 |
+
IM_USED,
|
| 31 |
+
|
| 32 |
+
MULTIPLE_CHOICES,
|
| 33 |
+
MOVED_PERMANENTLY,
|
| 34 |
+
FOUND,
|
| 35 |
+
SEE_OTHER,
|
| 36 |
+
NOT_MODIFIED,
|
| 37 |
+
USE_PROXY,
|
| 38 |
+
TEMPORARY_REDIRECT,
|
| 39 |
+
|
| 40 |
+
BAD_REQUEST,
|
| 41 |
+
UNAUTHORIZED,
|
| 42 |
+
PAYMENT_REQUIRED,
|
| 43 |
+
FORBIDDEN,
|
| 44 |
+
NOT_FOUND,
|
| 45 |
+
METHOD_NOT_ALLOWED,
|
| 46 |
+
NOT_ACCEPTABLE,
|
| 47 |
+
PROXY_AUTHENTICATION_REQUIRED,
|
| 48 |
+
REQUEST_TIMEOUT,
|
| 49 |
+
CONFLICT,
|
| 50 |
+
GONE,
|
| 51 |
+
LENGTH_REQUIRED,
|
| 52 |
+
PRECONDITION_FAILED,
|
| 53 |
+
REQUEST_ENTITY_TOO_LARGE,
|
| 54 |
+
REQUEST_URI_TOO_LONG,
|
| 55 |
+
UNSUPPORTED_MEDIA_TYPE,
|
| 56 |
+
REQUESTED_RANGE_NOT_SATISFIABLE,
|
| 57 |
+
EXPECTATION_FAILED,
|
| 58 |
+
UNPROCESSABLE_ENTITY,
|
| 59 |
+
LOCKED,
|
| 60 |
+
FAILED_DEPENDENCY,
|
| 61 |
+
UPGRADE_REQUIRED,
|
| 62 |
+
|
| 63 |
+
INTERNAL_SERVER_ERROR,
|
| 64 |
+
NOT_IMPLEMENTED,
|
| 65 |
+
BAD_GATEWAY,
|
| 66 |
+
SERVICE_UNAVAILABLE,
|
| 67 |
+
GATEWAY_TIMEOUT,
|
| 68 |
+
HTTP_VERSION_NOT_SUPPORTED,
|
| 69 |
+
INSUFFICIENT_STORAGE,
|
| 70 |
+
NOT_EXTENDED,
|
| 71 |
+
|
| 72 |
+
MAXAMOUNT,
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
# These are not available on Python 2.6.x:
|
| 76 |
+
try:
|
| 77 |
+
from httplib import LineTooLong, LineAndFileWrapper
|
| 78 |
+
except ImportError:
|
| 79 |
+
pass
|
| 80 |
+
|
| 81 |
+
# These may not be available on all versions of Python 2.6.x or 2.7.x
|
| 82 |
+
try:
|
| 83 |
+
from httplib import (
|
| 84 |
+
_MAXLINE,
|
| 85 |
+
_MAXHEADERS,
|
| 86 |
+
_is_legal_header_name,
|
| 87 |
+
_is_illegal_header_value,
|
| 88 |
+
_METHODS_EXPECTING_BODY
|
| 89 |
+
)
|
| 90 |
+
except ImportError:
|
| 91 |
+
pass
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/cookiejar.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
assert sys.version_info[0] < 3
|
| 5 |
+
|
| 6 |
+
from cookielib import *
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/cookies.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
assert sys.version_info[0] < 3
|
| 5 |
+
|
| 6 |
+
from Cookie import *
|
| 7 |
+
from Cookie import Morsel # left out of __all__ on Py2.7!
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/http/server.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
assert sys.version_info[0] < 3
|
| 5 |
+
|
| 6 |
+
from BaseHTTPServer import *
|
| 7 |
+
from CGIHTTPServer import *
|
| 8 |
+
from SimpleHTTPServer import *
|
| 9 |
+
try:
|
| 10 |
+
from CGIHTTPServer import _url_collapse_path # needed for a test
|
| 11 |
+
except ImportError:
|
| 12 |
+
try:
|
| 13 |
+
# Python 2.7.0 to 2.7.3
|
| 14 |
+
from CGIHTTPServer import (
|
| 15 |
+
_url_collapse_path_split as _url_collapse_path)
|
| 16 |
+
except ImportError:
|
| 17 |
+
# Doesn't exist on Python 2.6.x. Ignore it.
|
| 18 |
+
pass
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/idna/codec.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import encode, decode, alabel, ulabel, IDNAError
|
| 2 |
+
import codecs
|
| 3 |
+
import re
|
| 4 |
+
|
| 5 |
+
_unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]')
|
| 6 |
+
|
| 7 |
+
class Codec(codecs.Codec):
|
| 8 |
+
|
| 9 |
+
def encode(self, data, errors='strict'):
|
| 10 |
+
|
| 11 |
+
if errors != 'strict':
|
| 12 |
+
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
|
| 13 |
+
|
| 14 |
+
if not data:
|
| 15 |
+
return "", 0
|
| 16 |
+
|
| 17 |
+
return encode(data), len(data)
|
| 18 |
+
|
| 19 |
+
def decode(self, data, errors='strict'):
|
| 20 |
+
|
| 21 |
+
if errors != 'strict':
|
| 22 |
+
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
|
| 23 |
+
|
| 24 |
+
if not data:
|
| 25 |
+
return u"", 0
|
| 26 |
+
|
| 27 |
+
return decode(data), len(data)
|
| 28 |
+
|
| 29 |
+
class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
|
| 30 |
+
def _buffer_encode(self, data, errors, final):
|
| 31 |
+
if errors != 'strict':
|
| 32 |
+
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
|
| 33 |
+
|
| 34 |
+
if not data:
|
| 35 |
+
return ("", 0)
|
| 36 |
+
|
| 37 |
+
labels = _unicode_dots_re.split(data)
|
| 38 |
+
trailing_dot = u''
|
| 39 |
+
if labels:
|
| 40 |
+
if not labels[-1]:
|
| 41 |
+
trailing_dot = '.'
|
| 42 |
+
del labels[-1]
|
| 43 |
+
elif not final:
|
| 44 |
+
# Keep potentially unfinished label until the next call
|
| 45 |
+
del labels[-1]
|
| 46 |
+
if labels:
|
| 47 |
+
trailing_dot = '.'
|
| 48 |
+
|
| 49 |
+
result = []
|
| 50 |
+
size = 0
|
| 51 |
+
for label in labels:
|
| 52 |
+
result.append(alabel(label))
|
| 53 |
+
if size:
|
| 54 |
+
size += 1
|
| 55 |
+
size += len(label)
|
| 56 |
+
|
| 57 |
+
# Join with U+002E
|
| 58 |
+
result = ".".join(result) + trailing_dot
|
| 59 |
+
size += len(trailing_dot)
|
| 60 |
+
return (result, size)
|
| 61 |
+
|
| 62 |
+
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
| 63 |
+
def _buffer_decode(self, data, errors, final):
|
| 64 |
+
if errors != 'strict':
|
| 65 |
+
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
|
| 66 |
+
|
| 67 |
+
if not data:
|
| 68 |
+
return (u"", 0)
|
| 69 |
+
|
| 70 |
+
# IDNA allows decoding to operate on Unicode strings, too.
|
| 71 |
+
if isinstance(data, unicode):
|
| 72 |
+
labels = _unicode_dots_re.split(data)
|
| 73 |
+
else:
|
| 74 |
+
# Must be ASCII string
|
| 75 |
+
data = str(data)
|
| 76 |
+
unicode(data, "ascii")
|
| 77 |
+
labels = data.split(".")
|
| 78 |
+
|
| 79 |
+
trailing_dot = u''
|
| 80 |
+
if labels:
|
| 81 |
+
if not labels[-1]:
|
| 82 |
+
trailing_dot = u'.'
|
| 83 |
+
del labels[-1]
|
| 84 |
+
elif not final:
|
| 85 |
+
# Keep potentially unfinished label until the next call
|
| 86 |
+
del labels[-1]
|
| 87 |
+
if labels:
|
| 88 |
+
trailing_dot = u'.'
|
| 89 |
+
|
| 90 |
+
result = []
|
| 91 |
+
size = 0
|
| 92 |
+
for label in labels:
|
| 93 |
+
result.append(ulabel(label))
|
| 94 |
+
if size:
|
| 95 |
+
size += 1
|
| 96 |
+
size += len(label)
|
| 97 |
+
|
| 98 |
+
result = u".".join(result) + trailing_dot
|
| 99 |
+
size += len(trailing_dot)
|
| 100 |
+
return (result, size)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
class StreamWriter(Codec, codecs.StreamWriter):
|
| 104 |
+
pass
|
| 105 |
+
|
| 106 |
+
class StreamReader(Codec, codecs.StreamReader):
|
| 107 |
+
pass
|
| 108 |
+
|
| 109 |
+
def getregentry():
|
| 110 |
+
return codecs.CodecInfo(
|
| 111 |
+
name='idna',
|
| 112 |
+
encode=Codec().encode,
|
| 113 |
+
decode=Codec().decode,
|
| 114 |
+
incrementalencoder=IncrementalEncoder,
|
| 115 |
+
incrementaldecoder=IncrementalDecoder,
|
| 116 |
+
streamwriter=StreamWriter,
|
| 117 |
+
streamreader=StreamReader,
|
| 118 |
+
)
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/idna/compat.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import *
|
| 2 |
+
from .codec import *
|
| 3 |
+
|
| 4 |
+
def ToASCII(label):
|
| 5 |
+
return encode(label)
|
| 6 |
+
|
| 7 |
+
def ToUnicode(label):
|
| 8 |
+
return decode(label)
|
| 9 |
+
|
| 10 |
+
def nameprep(s):
|
| 11 |
+
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
|
| 12 |
+
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2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|
+
|
| 3 |
+
"""
|
| 4 |
+
requests.api
|
| 5 |
+
~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
This module implements the Requests API.
|
| 8 |
+
|
| 9 |
+
:copyright: (c) 2012 by Kenneth Reitz.
|
| 10 |
+
:license: Apache2, see LICENSE for more details.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from . import sessions
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def request(method, url, **kwargs):
|
| 17 |
+
"""Constructs and sends a :class:`Request <Request>`.
|
| 18 |
+
|
| 19 |
+
:param method: method for the new :class:`Request` object.
|
| 20 |
+
:param url: URL for the new :class:`Request` object.
|
| 21 |
+
:param params: (optional) Dictionary, list of tuples or bytes to send
|
| 22 |
+
in the query string for the :class:`Request`.
|
| 23 |
+
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
|
| 24 |
+
object to send in the body of the :class:`Request`.
|
| 25 |
+
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
|
| 26 |
+
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
|
| 27 |
+
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
|
| 28 |
+
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
|
| 29 |
+
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
|
| 30 |
+
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
|
| 31 |
+
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
|
| 32 |
+
to add for the file.
|
| 33 |
+
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
|
| 34 |
+
:param timeout: (optional) How many seconds to wait for the server to send data
|
| 35 |
+
before giving up, as a float, or a :ref:`(connect timeout, read
|
| 36 |
+
timeout) <timeouts>` tuple.
|
| 37 |
+
:type timeout: float or tuple
|
| 38 |
+
:param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
|
| 39 |
+
:type allow_redirects: bool
|
| 40 |
+
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
|
| 41 |
+
:param verify: (optional) Either a boolean, in which case it controls whether we verify
|
| 42 |
+
the server's TLS certificate, or a string, in which case it must be a path
|
| 43 |
+
to a CA bundle to use. Defaults to ``True``.
|
| 44 |
+
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
|
| 45 |
+
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
|
| 46 |
+
:return: :class:`Response <Response>` object
|
| 47 |
+
:rtype: requests.Response
|
| 48 |
+
|
| 49 |
+
Usage::
|
| 50 |
+
|
| 51 |
+
>>> import requests
|
| 52 |
+
>>> req = requests.request('GET', 'https://httpbin.org/get')
|
| 53 |
+
<Response [200]>
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
# By using the 'with' statement we are sure the session is closed, thus we
|
| 57 |
+
# avoid leaving sockets open which can trigger a ResourceWarning in some
|
| 58 |
+
# cases, and look like a memory leak in others.
|
| 59 |
+
with sessions.Session() as session:
|
| 60 |
+
return session.request(method=method, url=url, **kwargs)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def get(url, params=None, **kwargs):
|
| 64 |
+
r"""Sends a GET request.
|
| 65 |
+
|
| 66 |
+
:param url: URL for the new :class:`Request` object.
|
| 67 |
+
:param params: (optional) Dictionary, list of tuples or bytes to send
|
| 68 |
+
in the query string for the :class:`Request`.
|
| 69 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 70 |
+
:return: :class:`Response <Response>` object
|
| 71 |
+
:rtype: requests.Response
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
kwargs.setdefault('allow_redirects', True)
|
| 75 |
+
return request('get', url, params=params, **kwargs)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def options(url, **kwargs):
|
| 79 |
+
r"""Sends an OPTIONS request.
|
| 80 |
+
|
| 81 |
+
:param url: URL for the new :class:`Request` object.
|
| 82 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 83 |
+
:return: :class:`Response <Response>` object
|
| 84 |
+
:rtype: requests.Response
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
kwargs.setdefault('allow_redirects', True)
|
| 88 |
+
return request('options', url, **kwargs)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def head(url, **kwargs):
|
| 92 |
+
r"""Sends a HEAD request.
|
| 93 |
+
|
| 94 |
+
:param url: URL for the new :class:`Request` object.
|
| 95 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 96 |
+
:return: :class:`Response <Response>` object
|
| 97 |
+
:rtype: requests.Response
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
kwargs.setdefault('allow_redirects', False)
|
| 101 |
+
return request('head', url, **kwargs)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def post(url, data=None, json=None, **kwargs):
|
| 105 |
+
r"""Sends a POST request.
|
| 106 |
+
|
| 107 |
+
:param url: URL for the new :class:`Request` object.
|
| 108 |
+
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
|
| 109 |
+
object to send in the body of the :class:`Request`.
|
| 110 |
+
:param json: (optional) json data to send in the body of the :class:`Request`.
|
| 111 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 112 |
+
:return: :class:`Response <Response>` object
|
| 113 |
+
:rtype: requests.Response
|
| 114 |
+
"""
|
| 115 |
+
|
| 116 |
+
return request('post', url, data=data, json=json, **kwargs)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def put(url, data=None, **kwargs):
|
| 120 |
+
r"""Sends a PUT request.
|
| 121 |
+
|
| 122 |
+
:param url: URL for the new :class:`Request` object.
|
| 123 |
+
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
|
| 124 |
+
object to send in the body of the :class:`Request`.
|
| 125 |
+
:param json: (optional) json data to send in the body of the :class:`Request`.
|
| 126 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 127 |
+
:return: :class:`Response <Response>` object
|
| 128 |
+
:rtype: requests.Response
|
| 129 |
+
"""
|
| 130 |
+
|
| 131 |
+
return request('put', url, data=data, **kwargs)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def patch(url, data=None, **kwargs):
|
| 135 |
+
r"""Sends a PATCH request.
|
| 136 |
+
|
| 137 |
+
:param url: URL for the new :class:`Request` object.
|
| 138 |
+
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
|
| 139 |
+
object to send in the body of the :class:`Request`.
|
| 140 |
+
:param json: (optional) json data to send in the body of the :class:`Request`.
|
| 141 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 142 |
+
:return: :class:`Response <Response>` object
|
| 143 |
+
:rtype: requests.Response
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
return request('patch', url, data=data, **kwargs)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def delete(url, **kwargs):
|
| 150 |
+
r"""Sends a DELETE request.
|
| 151 |
+
|
| 152 |
+
:param url: URL for the new :class:`Request` object.
|
| 153 |
+
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
| 154 |
+
:return: :class:`Response <Response>` object
|
| 155 |
+
:rtype: requests.Response
|
| 156 |
+
"""
|
| 157 |
+
|
| 158 |
+
return request('delete', url, **kwargs)
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/auth.py
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
requests.auth
|
| 5 |
+
~~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
This module contains the authentication handlers for Requests.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
import re
|
| 12 |
+
import time
|
| 13 |
+
import hashlib
|
| 14 |
+
import threading
|
| 15 |
+
import warnings
|
| 16 |
+
|
| 17 |
+
from base64 import b64encode
|
| 18 |
+
|
| 19 |
+
from .compat import urlparse, str, basestring
|
| 20 |
+
from .cookies import extract_cookies_to_jar
|
| 21 |
+
from ._internal_utils import to_native_string
|
| 22 |
+
from .utils import parse_dict_header
|
| 23 |
+
|
| 24 |
+
CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
|
| 25 |
+
CONTENT_TYPE_MULTI_PART = 'multipart/form-data'
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _basic_auth_str(username, password):
|
| 29 |
+
"""Returns a Basic Auth string."""
|
| 30 |
+
|
| 31 |
+
# "I want us to put a big-ol' comment on top of it that
|
| 32 |
+
# says that this behaviour is dumb but we need to preserve
|
| 33 |
+
# it because people are relying on it."
|
| 34 |
+
# - Lukasa
|
| 35 |
+
#
|
| 36 |
+
# These are here solely to maintain backwards compatibility
|
| 37 |
+
# for things like ints. This will be removed in 3.0.0.
|
| 38 |
+
if not isinstance(username, basestring):
|
| 39 |
+
warnings.warn(
|
| 40 |
+
"Non-string usernames will no longer be supported in Requests "
|
| 41 |
+
"3.0.0. Please convert the object you've passed in ({!r}) to "
|
| 42 |
+
"a string or bytes object in the near future to avoid "
|
| 43 |
+
"problems.".format(username),
|
| 44 |
+
category=DeprecationWarning,
|
| 45 |
+
)
|
| 46 |
+
username = str(username)
|
| 47 |
+
|
| 48 |
+
if not isinstance(password, basestring):
|
| 49 |
+
warnings.warn(
|
| 50 |
+
"Non-string passwords will no longer be supported in Requests "
|
| 51 |
+
"3.0.0. Please convert the object you've passed in ({!r}) to "
|
| 52 |
+
"a string or bytes object in the near future to avoid "
|
| 53 |
+
"problems.".format(password),
|
| 54 |
+
category=DeprecationWarning,
|
| 55 |
+
)
|
| 56 |
+
password = str(password)
|
| 57 |
+
# -- End Removal --
|
| 58 |
+
|
| 59 |
+
if isinstance(username, str):
|
| 60 |
+
username = username.encode('latin1')
|
| 61 |
+
|
| 62 |
+
if isinstance(password, str):
|
| 63 |
+
password = password.encode('latin1')
|
| 64 |
+
|
| 65 |
+
authstr = 'Basic ' + to_native_string(
|
| 66 |
+
b64encode(b':'.join((username, password))).strip()
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
return authstr
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class AuthBase(object):
|
| 73 |
+
"""Base class that all auth implementations derive from"""
|
| 74 |
+
|
| 75 |
+
def __call__(self, r):
|
| 76 |
+
raise NotImplementedError('Auth hooks must be callable.')
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
class HTTPBasicAuth(AuthBase):
|
| 80 |
+
"""Attaches HTTP Basic Authentication to the given Request object."""
|
| 81 |
+
|
| 82 |
+
def __init__(self, username, password):
|
| 83 |
+
self.username = username
|
| 84 |
+
self.password = password
|
| 85 |
+
|
| 86 |
+
def __eq__(self, other):
|
| 87 |
+
return all([
|
| 88 |
+
self.username == getattr(other, 'username', None),
|
| 89 |
+
self.password == getattr(other, 'password', None)
|
| 90 |
+
])
|
| 91 |
+
|
| 92 |
+
def __ne__(self, other):
|
| 93 |
+
return not self == other
|
| 94 |
+
|
| 95 |
+
def __call__(self, r):
|
| 96 |
+
r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
|
| 97 |
+
return r
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class HTTPProxyAuth(HTTPBasicAuth):
|
| 101 |
+
"""Attaches HTTP Proxy Authentication to a given Request object."""
|
| 102 |
+
|
| 103 |
+
def __call__(self, r):
|
| 104 |
+
r.headers['Proxy-Authorization'] = _basic_auth_str(self.username, self.password)
|
| 105 |
+
return r
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class HTTPDigestAuth(AuthBase):
|
| 109 |
+
"""Attaches HTTP Digest Authentication to the given Request object."""
|
| 110 |
+
|
| 111 |
+
def __init__(self, username, password):
|
| 112 |
+
self.username = username
|
| 113 |
+
self.password = password
|
| 114 |
+
# Keep state in per-thread local storage
|
| 115 |
+
self._thread_local = threading.local()
|
| 116 |
+
|
| 117 |
+
def init_per_thread_state(self):
|
| 118 |
+
# Ensure state is initialized just once per-thread
|
| 119 |
+
if not hasattr(self._thread_local, 'init'):
|
| 120 |
+
self._thread_local.init = True
|
| 121 |
+
self._thread_local.last_nonce = ''
|
| 122 |
+
self._thread_local.nonce_count = 0
|
| 123 |
+
self._thread_local.chal = {}
|
| 124 |
+
self._thread_local.pos = None
|
| 125 |
+
self._thread_local.num_401_calls = None
|
| 126 |
+
|
| 127 |
+
def build_digest_header(self, method, url):
|
| 128 |
+
"""
|
| 129 |
+
:rtype: str
|
| 130 |
+
"""
|
| 131 |
+
|
| 132 |
+
realm = self._thread_local.chal['realm']
|
| 133 |
+
nonce = self._thread_local.chal['nonce']
|
| 134 |
+
qop = self._thread_local.chal.get('qop')
|
| 135 |
+
algorithm = self._thread_local.chal.get('algorithm')
|
| 136 |
+
opaque = self._thread_local.chal.get('opaque')
|
| 137 |
+
hash_utf8 = None
|
| 138 |
+
|
| 139 |
+
if algorithm is None:
|
| 140 |
+
_algorithm = 'MD5'
|
| 141 |
+
else:
|
| 142 |
+
_algorithm = algorithm.upper()
|
| 143 |
+
# lambdas assume digest modules are imported at the top level
|
| 144 |
+
if _algorithm == 'MD5' or _algorithm == 'MD5-SESS':
|
| 145 |
+
def md5_utf8(x):
|
| 146 |
+
if isinstance(x, str):
|
| 147 |
+
x = x.encode('utf-8')
|
| 148 |
+
return hashlib.md5(x).hexdigest()
|
| 149 |
+
hash_utf8 = md5_utf8
|
| 150 |
+
elif _algorithm == 'SHA':
|
| 151 |
+
def sha_utf8(x):
|
| 152 |
+
if isinstance(x, str):
|
| 153 |
+
x = x.encode('utf-8')
|
| 154 |
+
return hashlib.sha1(x).hexdigest()
|
| 155 |
+
hash_utf8 = sha_utf8
|
| 156 |
+
elif _algorithm == 'SHA-256':
|
| 157 |
+
def sha256_utf8(x):
|
| 158 |
+
if isinstance(x, str):
|
| 159 |
+
x = x.encode('utf-8')
|
| 160 |
+
return hashlib.sha256(x).hexdigest()
|
| 161 |
+
hash_utf8 = sha256_utf8
|
| 162 |
+
elif _algorithm == 'SHA-512':
|
| 163 |
+
def sha512_utf8(x):
|
| 164 |
+
if isinstance(x, str):
|
| 165 |
+
x = x.encode('utf-8')
|
| 166 |
+
return hashlib.sha512(x).hexdigest()
|
| 167 |
+
hash_utf8 = sha512_utf8
|
| 168 |
+
|
| 169 |
+
KD = lambda s, d: hash_utf8("%s:%s" % (s, d))
|
| 170 |
+
|
| 171 |
+
if hash_utf8 is None:
|
| 172 |
+
return None
|
| 173 |
+
|
| 174 |
+
# XXX not implemented yet
|
| 175 |
+
entdig = None
|
| 176 |
+
p_parsed = urlparse(url)
|
| 177 |
+
#: path is request-uri defined in RFC 2616 which should not be empty
|
| 178 |
+
path = p_parsed.path or "/"
|
| 179 |
+
if p_parsed.query:
|
| 180 |
+
path += '?' + p_parsed.query
|
| 181 |
+
|
| 182 |
+
A1 = '%s:%s:%s' % (self.username, realm, self.password)
|
| 183 |
+
A2 = '%s:%s' % (method, path)
|
| 184 |
+
|
| 185 |
+
HA1 = hash_utf8(A1)
|
| 186 |
+
HA2 = hash_utf8(A2)
|
| 187 |
+
|
| 188 |
+
if nonce == self._thread_local.last_nonce:
|
| 189 |
+
self._thread_local.nonce_count += 1
|
| 190 |
+
else:
|
| 191 |
+
self._thread_local.nonce_count = 1
|
| 192 |
+
ncvalue = '%08x' % self._thread_local.nonce_count
|
| 193 |
+
s = str(self._thread_local.nonce_count).encode('utf-8')
|
| 194 |
+
s += nonce.encode('utf-8')
|
| 195 |
+
s += time.ctime().encode('utf-8')
|
| 196 |
+
s += os.urandom(8)
|
| 197 |
+
|
| 198 |
+
cnonce = (hashlib.sha1(s).hexdigest()[:16])
|
| 199 |
+
if _algorithm == 'MD5-SESS':
|
| 200 |
+
HA1 = hash_utf8('%s:%s:%s' % (HA1, nonce, cnonce))
|
| 201 |
+
|
| 202 |
+
if not qop:
|
| 203 |
+
respdig = KD(HA1, "%s:%s" % (nonce, HA2))
|
| 204 |
+
elif qop == 'auth' or 'auth' in qop.split(','):
|
| 205 |
+
noncebit = "%s:%s:%s:%s:%s" % (
|
| 206 |
+
nonce, ncvalue, cnonce, 'auth', HA2
|
| 207 |
+
)
|
| 208 |
+
respdig = KD(HA1, noncebit)
|
| 209 |
+
else:
|
| 210 |
+
# XXX handle auth-int.
|
| 211 |
+
return None
|
| 212 |
+
|
| 213 |
+
self._thread_local.last_nonce = nonce
|
| 214 |
+
|
| 215 |
+
# XXX should the partial digests be encoded too?
|
| 216 |
+
base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
|
| 217 |
+
'response="%s"' % (self.username, realm, nonce, path, respdig)
|
| 218 |
+
if opaque:
|
| 219 |
+
base += ', opaque="%s"' % opaque
|
| 220 |
+
if algorithm:
|
| 221 |
+
base += ', algorithm="%s"' % algorithm
|
| 222 |
+
if entdig:
|
| 223 |
+
base += ', digest="%s"' % entdig
|
| 224 |
+
if qop:
|
| 225 |
+
base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)
|
| 226 |
+
|
| 227 |
+
return 'Digest %s' % (base)
|
| 228 |
+
|
| 229 |
+
def handle_redirect(self, r, **kwargs):
|
| 230 |
+
"""Reset num_401_calls counter on redirects."""
|
| 231 |
+
if r.is_redirect:
|
| 232 |
+
self._thread_local.num_401_calls = 1
|
| 233 |
+
|
| 234 |
+
def handle_401(self, r, **kwargs):
|
| 235 |
+
"""
|
| 236 |
+
Takes the given response and tries digest-auth, if needed.
|
| 237 |
+
|
| 238 |
+
:rtype: requests.Response
|
| 239 |
+
"""
|
| 240 |
+
|
| 241 |
+
# If response is not 4xx, do not auth
|
| 242 |
+
# See https://github.com/requests/requests/issues/3772
|
| 243 |
+
if not 400 <= r.status_code < 500:
|
| 244 |
+
self._thread_local.num_401_calls = 1
|
| 245 |
+
return r
|
| 246 |
+
|
| 247 |
+
if self._thread_local.pos is not None:
|
| 248 |
+
# Rewind the file position indicator of the body to where
|
| 249 |
+
# it was to resend the request.
|
| 250 |
+
r.request.body.seek(self._thread_local.pos)
|
| 251 |
+
s_auth = r.headers.get('www-authenticate', '')
|
| 252 |
+
|
| 253 |
+
if 'digest' in s_auth.lower() and self._thread_local.num_401_calls < 2:
|
| 254 |
+
|
| 255 |
+
self._thread_local.num_401_calls += 1
|
| 256 |
+
pat = re.compile(r'digest ', flags=re.IGNORECASE)
|
| 257 |
+
self._thread_local.chal = parse_dict_header(pat.sub('', s_auth, count=1))
|
| 258 |
+
|
| 259 |
+
# Consume content and release the original connection
|
| 260 |
+
# to allow our new request to reuse the same one.
|
| 261 |
+
r.content
|
| 262 |
+
r.close()
|
| 263 |
+
prep = r.request.copy()
|
| 264 |
+
extract_cookies_to_jar(prep._cookies, r.request, r.raw)
|
| 265 |
+
prep.prepare_cookies(prep._cookies)
|
| 266 |
+
|
| 267 |
+
prep.headers['Authorization'] = self.build_digest_header(
|
| 268 |
+
prep.method, prep.url)
|
| 269 |
+
_r = r.connection.send(prep, **kwargs)
|
| 270 |
+
_r.history.append(r)
|
| 271 |
+
_r.request = prep
|
| 272 |
+
|
| 273 |
+
return _r
|
| 274 |
+
|
| 275 |
+
self._thread_local.num_401_calls = 1
|
| 276 |
+
return r
|
| 277 |
+
|
| 278 |
+
def __call__(self, r):
|
| 279 |
+
# Initialize per-thread state, if needed
|
| 280 |
+
self.init_per_thread_state()
|
| 281 |
+
# If we have a saved nonce, skip the 401
|
| 282 |
+
if self._thread_local.last_nonce:
|
| 283 |
+
r.headers['Authorization'] = self.build_digest_header(r.method, r.url)
|
| 284 |
+
try:
|
| 285 |
+
self._thread_local.pos = r.body.tell()
|
| 286 |
+
except AttributeError:
|
| 287 |
+
# In the case of HTTPDigestAuth being reused and the body of
|
| 288 |
+
# the previous request was a file-like object, pos has the
|
| 289 |
+
# file position of the previous body. Ensure it's set to
|
| 290 |
+
# None.
|
| 291 |
+
self._thread_local.pos = None
|
| 292 |
+
r.register_hook('response', self.handle_401)
|
| 293 |
+
r.register_hook('response', self.handle_redirect)
|
| 294 |
+
self._thread_local.num_401_calls = 1
|
| 295 |
+
|
| 296 |
+
return r
|
| 297 |
+
|
| 298 |
+
def __eq__(self, other):
|
| 299 |
+
return all([
|
| 300 |
+
self.username == getattr(other, 'username', None),
|
| 301 |
+
self.password == getattr(other, 'password', None)
|
| 302 |
+
])
|
| 303 |
+
|
| 304 |
+
def __ne__(self, other):
|
| 305 |
+
return not self == other
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/certs.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
requests.certs
|
| 6 |
+
~~~~~~~~~~~~~~
|
| 7 |
+
|
| 8 |
+
This module returns the preferred default CA certificate bundle. There is
|
| 9 |
+
only one — the one from the certifi package.
|
| 10 |
+
|
| 11 |
+
If you are packaging Requests, e.g., for a Linux distribution or a managed
|
| 12 |
+
environment, you can change the definition of where() to return a separately
|
| 13 |
+
packaged CA bundle.
|
| 14 |
+
"""
|
| 15 |
+
from certifi import where
|
| 16 |
+
|
| 17 |
+
if __name__ == '__main__':
|
| 18 |
+
print(where())
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/compat.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
requests.compat
|
| 5 |
+
~~~~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
This module handles import compatibility issues between Python 2 and
|
| 8 |
+
Python 3.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import chardet
|
| 12 |
+
|
| 13 |
+
import sys
|
| 14 |
+
|
| 15 |
+
# -------
|
| 16 |
+
# Pythons
|
| 17 |
+
# -------
|
| 18 |
+
|
| 19 |
+
# Syntax sugar.
|
| 20 |
+
_ver = sys.version_info
|
| 21 |
+
|
| 22 |
+
#: Python 2.x?
|
| 23 |
+
is_py2 = (_ver[0] == 2)
|
| 24 |
+
|
| 25 |
+
#: Python 3.x?
|
| 26 |
+
is_py3 = (_ver[0] == 3)
|
| 27 |
+
|
| 28 |
+
try:
|
| 29 |
+
import simplejson as json
|
| 30 |
+
except ImportError:
|
| 31 |
+
import json
|
| 32 |
+
|
| 33 |
+
# ---------
|
| 34 |
+
# Specifics
|
| 35 |
+
# ---------
|
| 36 |
+
|
| 37 |
+
if is_py2:
|
| 38 |
+
from urllib import (
|
| 39 |
+
quote, unquote, quote_plus, unquote_plus, urlencode, getproxies,
|
| 40 |
+
proxy_bypass, proxy_bypass_environment, getproxies_environment)
|
| 41 |
+
from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag
|
| 42 |
+
from urllib2 import parse_http_list
|
| 43 |
+
import cookielib
|
| 44 |
+
from Cookie import Morsel
|
| 45 |
+
from StringIO import StringIO
|
| 46 |
+
from collections import Callable, Mapping, MutableMapping, OrderedDict
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
builtin_str = str
|
| 50 |
+
bytes = str
|
| 51 |
+
str = unicode
|
| 52 |
+
basestring = basestring
|
| 53 |
+
numeric_types = (int, long, float)
|
| 54 |
+
integer_types = (int, long)
|
| 55 |
+
|
| 56 |
+
elif is_py3:
|
| 57 |
+
from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag
|
| 58 |
+
from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment
|
| 59 |
+
from http import cookiejar as cookielib
|
| 60 |
+
from http.cookies import Morsel
|
| 61 |
+
from io import StringIO
|
| 62 |
+
from collections import OrderedDict
|
| 63 |
+
from collections.abc import Callable, Mapping, MutableMapping
|
| 64 |
+
|
| 65 |
+
builtin_str = str
|
| 66 |
+
str = str
|
| 67 |
+
bytes = bytes
|
| 68 |
+
basestring = (str, bytes)
|
| 69 |
+
numeric_types = (int, float)
|
| 70 |
+
integer_types = (int,)
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/cookies.py
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
requests.cookies
|
| 5 |
+
~~~~~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
Compatibility code to be able to use `cookielib.CookieJar` with requests.
|
| 8 |
+
|
| 9 |
+
requests.utils imports from here, so be careful with imports.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import copy
|
| 13 |
+
import time
|
| 14 |
+
import calendar
|
| 15 |
+
|
| 16 |
+
from ._internal_utils import to_native_string
|
| 17 |
+
from .compat import cookielib, urlparse, urlunparse, Morsel, MutableMapping
|
| 18 |
+
|
| 19 |
+
try:
|
| 20 |
+
import threading
|
| 21 |
+
except ImportError:
|
| 22 |
+
import dummy_threading as threading
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class MockRequest(object):
|
| 26 |
+
"""Wraps a `requests.Request` to mimic a `urllib2.Request`.
|
| 27 |
+
|
| 28 |
+
The code in `cookielib.CookieJar` expects this interface in order to correctly
|
| 29 |
+
manage cookie policies, i.e., determine whether a cookie can be set, given the
|
| 30 |
+
domains of the request and the cookie.
|
| 31 |
+
|
| 32 |
+
The original request object is read-only. The client is responsible for collecting
|
| 33 |
+
the new headers via `get_new_headers()` and interpreting them appropriately. You
|
| 34 |
+
probably want `get_cookie_header`, defined below.
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
def __init__(self, request):
|
| 38 |
+
self._r = request
|
| 39 |
+
self._new_headers = {}
|
| 40 |
+
self.type = urlparse(self._r.url).scheme
|
| 41 |
+
|
| 42 |
+
def get_type(self):
|
| 43 |
+
return self.type
|
| 44 |
+
|
| 45 |
+
def get_host(self):
|
| 46 |
+
return urlparse(self._r.url).netloc
|
| 47 |
+
|
| 48 |
+
def get_origin_req_host(self):
|
| 49 |
+
return self.get_host()
|
| 50 |
+
|
| 51 |
+
def get_full_url(self):
|
| 52 |
+
# Only return the response's URL if the user hadn't set the Host
|
| 53 |
+
# header
|
| 54 |
+
if not self._r.headers.get('Host'):
|
| 55 |
+
return self._r.url
|
| 56 |
+
# If they did set it, retrieve it and reconstruct the expected domain
|
| 57 |
+
host = to_native_string(self._r.headers['Host'], encoding='utf-8')
|
| 58 |
+
parsed = urlparse(self._r.url)
|
| 59 |
+
# Reconstruct the URL as we expect it
|
| 60 |
+
return urlunparse([
|
| 61 |
+
parsed.scheme, host, parsed.path, parsed.params, parsed.query,
|
| 62 |
+
parsed.fragment
|
| 63 |
+
])
|
| 64 |
+
|
| 65 |
+
def is_unverifiable(self):
|
| 66 |
+
return True
|
| 67 |
+
|
| 68 |
+
def has_header(self, name):
|
| 69 |
+
return name in self._r.headers or name in self._new_headers
|
| 70 |
+
|
| 71 |
+
def get_header(self, name, default=None):
|
| 72 |
+
return self._r.headers.get(name, self._new_headers.get(name, default))
|
| 73 |
+
|
| 74 |
+
def add_header(self, key, val):
|
| 75 |
+
"""cookielib has no legitimate use for this method; add it back if you find one."""
|
| 76 |
+
raise NotImplementedError("Cookie headers should be added with add_unredirected_header()")
|
| 77 |
+
|
| 78 |
+
def add_unredirected_header(self, name, value):
|
| 79 |
+
self._new_headers[name] = value
|
| 80 |
+
|
| 81 |
+
def get_new_headers(self):
|
| 82 |
+
return self._new_headers
|
| 83 |
+
|
| 84 |
+
@property
|
| 85 |
+
def unverifiable(self):
|
| 86 |
+
return self.is_unverifiable()
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def origin_req_host(self):
|
| 90 |
+
return self.get_origin_req_host()
|
| 91 |
+
|
| 92 |
+
@property
|
| 93 |
+
def host(self):
|
| 94 |
+
return self.get_host()
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class MockResponse(object):
|
| 98 |
+
"""Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
|
| 99 |
+
|
| 100 |
+
...what? Basically, expose the parsed HTTP headers from the server response
|
| 101 |
+
the way `cookielib` expects to see them.
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
def __init__(self, headers):
|
| 105 |
+
"""Make a MockResponse for `cookielib` to read.
|
| 106 |
+
|
| 107 |
+
:param headers: a httplib.HTTPMessage or analogous carrying the headers
|
| 108 |
+
"""
|
| 109 |
+
self._headers = headers
|
| 110 |
+
|
| 111 |
+
def info(self):
|
| 112 |
+
return self._headers
|
| 113 |
+
|
| 114 |
+
def getheaders(self, name):
|
| 115 |
+
self._headers.getheaders(name)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def extract_cookies_to_jar(jar, request, response):
|
| 119 |
+
"""Extract the cookies from the response into a CookieJar.
|
| 120 |
+
|
| 121 |
+
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
|
| 122 |
+
:param request: our own requests.Request object
|
| 123 |
+
:param response: urllib3.HTTPResponse object
|
| 124 |
+
"""
|
| 125 |
+
if not (hasattr(response, '_original_response') and
|
| 126 |
+
response._original_response):
|
| 127 |
+
return
|
| 128 |
+
# the _original_response field is the wrapped httplib.HTTPResponse object,
|
| 129 |
+
req = MockRequest(request)
|
| 130 |
+
# pull out the HTTPMessage with the headers and put it in the mock:
|
| 131 |
+
res = MockResponse(response._original_response.msg)
|
| 132 |
+
jar.extract_cookies(res, req)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def get_cookie_header(jar, request):
|
| 136 |
+
"""
|
| 137 |
+
Produce an appropriate Cookie header string to be sent with `request`, or None.
|
| 138 |
+
|
| 139 |
+
:rtype: str
|
| 140 |
+
"""
|
| 141 |
+
r = MockRequest(request)
|
| 142 |
+
jar.add_cookie_header(r)
|
| 143 |
+
return r.get_new_headers().get('Cookie')
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def remove_cookie_by_name(cookiejar, name, domain=None, path=None):
|
| 147 |
+
"""Unsets a cookie by name, by default over all domains and paths.
|
| 148 |
+
|
| 149 |
+
Wraps CookieJar.clear(), is O(n).
|
| 150 |
+
"""
|
| 151 |
+
clearables = []
|
| 152 |
+
for cookie in cookiejar:
|
| 153 |
+
if cookie.name != name:
|
| 154 |
+
continue
|
| 155 |
+
if domain is not None and domain != cookie.domain:
|
| 156 |
+
continue
|
| 157 |
+
if path is not None and path != cookie.path:
|
| 158 |
+
continue
|
| 159 |
+
clearables.append((cookie.domain, cookie.path, cookie.name))
|
| 160 |
+
|
| 161 |
+
for domain, path, name in clearables:
|
| 162 |
+
cookiejar.clear(domain, path, name)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class CookieConflictError(RuntimeError):
|
| 166 |
+
"""There are two cookies that meet the criteria specified in the cookie jar.
|
| 167 |
+
Use .get and .set and include domain and path args in order to be more specific.
|
| 168 |
+
"""
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
class RequestsCookieJar(cookielib.CookieJar, MutableMapping):
|
| 172 |
+
"""Compatibility class; is a cookielib.CookieJar, but exposes a dict
|
| 173 |
+
interface.
|
| 174 |
+
|
| 175 |
+
This is the CookieJar we create by default for requests and sessions that
|
| 176 |
+
don't specify one, since some clients may expect response.cookies and
|
| 177 |
+
session.cookies to support dict operations.
|
| 178 |
+
|
| 179 |
+
Requests does not use the dict interface internally; it's just for
|
| 180 |
+
compatibility with external client code. All requests code should work
|
| 181 |
+
out of the box with externally provided instances of ``CookieJar``, e.g.
|
| 182 |
+
``LWPCookieJar`` and ``FileCookieJar``.
|
| 183 |
+
|
| 184 |
+
Unlike a regular CookieJar, this class is pickleable.
|
| 185 |
+
|
| 186 |
+
.. warning:: dictionary operations that are normally O(1) may be O(n).
|
| 187 |
+
"""
|
| 188 |
+
|
| 189 |
+
def get(self, name, default=None, domain=None, path=None):
|
| 190 |
+
"""Dict-like get() that also supports optional domain and path args in
|
| 191 |
+
order to resolve naming collisions from using one cookie jar over
|
| 192 |
+
multiple domains.
|
| 193 |
+
|
| 194 |
+
.. warning:: operation is O(n), not O(1).
|
| 195 |
+
"""
|
| 196 |
+
try:
|
| 197 |
+
return self._find_no_duplicates(name, domain, path)
|
| 198 |
+
except KeyError:
|
| 199 |
+
return default
|
| 200 |
+
|
| 201 |
+
def set(self, name, value, **kwargs):
|
| 202 |
+
"""Dict-like set() that also supports optional domain and path args in
|
| 203 |
+
order to resolve naming collisions from using one cookie jar over
|
| 204 |
+
multiple domains.
|
| 205 |
+
"""
|
| 206 |
+
# support client code that unsets cookies by assignment of a None value:
|
| 207 |
+
if value is None:
|
| 208 |
+
remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path'))
|
| 209 |
+
return
|
| 210 |
+
|
| 211 |
+
if isinstance(value, Morsel):
|
| 212 |
+
c = morsel_to_cookie(value)
|
| 213 |
+
else:
|
| 214 |
+
c = create_cookie(name, value, **kwargs)
|
| 215 |
+
self.set_cookie(c)
|
| 216 |
+
return c
|
| 217 |
+
|
| 218 |
+
def iterkeys(self):
|
| 219 |
+
"""Dict-like iterkeys() that returns an iterator of names of cookies
|
| 220 |
+
from the jar.
|
| 221 |
+
|
| 222 |
+
.. seealso:: itervalues() and iteritems().
|
| 223 |
+
"""
|
| 224 |
+
for cookie in iter(self):
|
| 225 |
+
yield cookie.name
|
| 226 |
+
|
| 227 |
+
def keys(self):
|
| 228 |
+
"""Dict-like keys() that returns a list of names of cookies from the
|
| 229 |
+
jar.
|
| 230 |
+
|
| 231 |
+
.. seealso:: values() and items().
|
| 232 |
+
"""
|
| 233 |
+
return list(self.iterkeys())
|
| 234 |
+
|
| 235 |
+
def itervalues(self):
|
| 236 |
+
"""Dict-like itervalues() that returns an iterator of values of cookies
|
| 237 |
+
from the jar.
|
| 238 |
+
|
| 239 |
+
.. seealso:: iterkeys() and iteritems().
|
| 240 |
+
"""
|
| 241 |
+
for cookie in iter(self):
|
| 242 |
+
yield cookie.value
|
| 243 |
+
|
| 244 |
+
def values(self):
|
| 245 |
+
"""Dict-like values() that returns a list of values of cookies from the
|
| 246 |
+
jar.
|
| 247 |
+
|
| 248 |
+
.. seealso:: keys() and items().
|
| 249 |
+
"""
|
| 250 |
+
return list(self.itervalues())
|
| 251 |
+
|
| 252 |
+
def iteritems(self):
|
| 253 |
+
"""Dict-like iteritems() that returns an iterator of name-value tuples
|
| 254 |
+
from the jar.
|
| 255 |
+
|
| 256 |
+
.. seealso:: iterkeys() and itervalues().
|
| 257 |
+
"""
|
| 258 |
+
for cookie in iter(self):
|
| 259 |
+
yield cookie.name, cookie.value
|
| 260 |
+
|
| 261 |
+
def items(self):
|
| 262 |
+
"""Dict-like items() that returns a list of name-value tuples from the
|
| 263 |
+
jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
|
| 264 |
+
vanilla python dict of key value pairs.
|
| 265 |
+
|
| 266 |
+
.. seealso:: keys() and values().
|
| 267 |
+
"""
|
| 268 |
+
return list(self.iteritems())
|
| 269 |
+
|
| 270 |
+
def list_domains(self):
|
| 271 |
+
"""Utility method to list all the domains in the jar."""
|
| 272 |
+
domains = []
|
| 273 |
+
for cookie in iter(self):
|
| 274 |
+
if cookie.domain not in domains:
|
| 275 |
+
domains.append(cookie.domain)
|
| 276 |
+
return domains
|
| 277 |
+
|
| 278 |
+
def list_paths(self):
|
| 279 |
+
"""Utility method to list all the paths in the jar."""
|
| 280 |
+
paths = []
|
| 281 |
+
for cookie in iter(self):
|
| 282 |
+
if cookie.path not in paths:
|
| 283 |
+
paths.append(cookie.path)
|
| 284 |
+
return paths
|
| 285 |
+
|
| 286 |
+
def multiple_domains(self):
|
| 287 |
+
"""Returns True if there are multiple domains in the jar.
|
| 288 |
+
Returns False otherwise.
|
| 289 |
+
|
| 290 |
+
:rtype: bool
|
| 291 |
+
"""
|
| 292 |
+
domains = []
|
| 293 |
+
for cookie in iter(self):
|
| 294 |
+
if cookie.domain is not None and cookie.domain in domains:
|
| 295 |
+
return True
|
| 296 |
+
domains.append(cookie.domain)
|
| 297 |
+
return False # there is only one domain in jar
|
| 298 |
+
|
| 299 |
+
def get_dict(self, domain=None, path=None):
|
| 300 |
+
"""Takes as an argument an optional domain and path and returns a plain
|
| 301 |
+
old Python dict of name-value pairs of cookies that meet the
|
| 302 |
+
requirements.
|
| 303 |
+
|
| 304 |
+
:rtype: dict
|
| 305 |
+
"""
|
| 306 |
+
dictionary = {}
|
| 307 |
+
for cookie in iter(self):
|
| 308 |
+
if (
|
| 309 |
+
(domain is None or cookie.domain == domain) and
|
| 310 |
+
(path is None or cookie.path == path)
|
| 311 |
+
):
|
| 312 |
+
dictionary[cookie.name] = cookie.value
|
| 313 |
+
return dictionary
|
| 314 |
+
|
| 315 |
+
def __contains__(self, name):
|
| 316 |
+
try:
|
| 317 |
+
return super(RequestsCookieJar, self).__contains__(name)
|
| 318 |
+
except CookieConflictError:
|
| 319 |
+
return True
|
| 320 |
+
|
| 321 |
+
def __getitem__(self, name):
|
| 322 |
+
"""Dict-like __getitem__() for compatibility with client code. Throws
|
| 323 |
+
exception if there are more than one cookie with name. In that case,
|
| 324 |
+
use the more explicit get() method instead.
|
| 325 |
+
|
| 326 |
+
.. warning:: operation is O(n), not O(1).
|
| 327 |
+
"""
|
| 328 |
+
return self._find_no_duplicates(name)
|
| 329 |
+
|
| 330 |
+
def __setitem__(self, name, value):
|
| 331 |
+
"""Dict-like __setitem__ for compatibility with client code. Throws
|
| 332 |
+
exception if there is already a cookie of that name in the jar. In that
|
| 333 |
+
case, use the more explicit set() method instead.
|
| 334 |
+
"""
|
| 335 |
+
self.set(name, value)
|
| 336 |
+
|
| 337 |
+
def __delitem__(self, name):
|
| 338 |
+
"""Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
|
| 339 |
+
``remove_cookie_by_name()``.
|
| 340 |
+
"""
|
| 341 |
+
remove_cookie_by_name(self, name)
|
| 342 |
+
|
| 343 |
+
def set_cookie(self, cookie, *args, **kwargs):
|
| 344 |
+
if hasattr(cookie.value, 'startswith') and cookie.value.startswith('"') and cookie.value.endswith('"'):
|
| 345 |
+
cookie.value = cookie.value.replace('\\"', '')
|
| 346 |
+
return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)
|
| 347 |
+
|
| 348 |
+
def update(self, other):
|
| 349 |
+
"""Updates this jar with cookies from another CookieJar or dict-like"""
|
| 350 |
+
if isinstance(other, cookielib.CookieJar):
|
| 351 |
+
for cookie in other:
|
| 352 |
+
self.set_cookie(copy.copy(cookie))
|
| 353 |
+
else:
|
| 354 |
+
super(RequestsCookieJar, self).update(other)
|
| 355 |
+
|
| 356 |
+
def _find(self, name, domain=None, path=None):
|
| 357 |
+
"""Requests uses this method internally to get cookie values.
|
| 358 |
+
|
| 359 |
+
If there are conflicting cookies, _find arbitrarily chooses one.
|
| 360 |
+
See _find_no_duplicates if you want an exception thrown if there are
|
| 361 |
+
conflicting cookies.
|
| 362 |
+
|
| 363 |
+
:param name: a string containing name of cookie
|
| 364 |
+
:param domain: (optional) string containing domain of cookie
|
| 365 |
+
:param path: (optional) string containing path of cookie
|
| 366 |
+
:return: cookie.value
|
| 367 |
+
"""
|
| 368 |
+
for cookie in iter(self):
|
| 369 |
+
if cookie.name == name:
|
| 370 |
+
if domain is None or cookie.domain == domain:
|
| 371 |
+
if path is None or cookie.path == path:
|
| 372 |
+
return cookie.value
|
| 373 |
+
|
| 374 |
+
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
|
| 375 |
+
|
| 376 |
+
def _find_no_duplicates(self, name, domain=None, path=None):
|
| 377 |
+
"""Both ``__get_item__`` and ``get`` call this function: it's never
|
| 378 |
+
used elsewhere in Requests.
|
| 379 |
+
|
| 380 |
+
:param name: a string containing name of cookie
|
| 381 |
+
:param domain: (optional) string containing domain of cookie
|
| 382 |
+
:param path: (optional) string containing path of cookie
|
| 383 |
+
:raises KeyError: if cookie is not found
|
| 384 |
+
:raises CookieConflictError: if there are multiple cookies
|
| 385 |
+
that match name and optionally domain and path
|
| 386 |
+
:return: cookie.value
|
| 387 |
+
"""
|
| 388 |
+
toReturn = None
|
| 389 |
+
for cookie in iter(self):
|
| 390 |
+
if cookie.name == name:
|
| 391 |
+
if domain is None or cookie.domain == domain:
|
| 392 |
+
if path is None or cookie.path == path:
|
| 393 |
+
if toReturn is not None: # if there are multiple cookies that meet passed in criteria
|
| 394 |
+
raise CookieConflictError('There are multiple cookies with name, %r' % (name))
|
| 395 |
+
toReturn = cookie.value # we will eventually return this as long as no cookie conflict
|
| 396 |
+
|
| 397 |
+
if toReturn:
|
| 398 |
+
return toReturn
|
| 399 |
+
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
|
| 400 |
+
|
| 401 |
+
def __getstate__(self):
|
| 402 |
+
"""Unlike a normal CookieJar, this class is pickleable."""
|
| 403 |
+
state = self.__dict__.copy()
|
| 404 |
+
# remove the unpickleable RLock object
|
| 405 |
+
state.pop('_cookies_lock')
|
| 406 |
+
return state
|
| 407 |
+
|
| 408 |
+
def __setstate__(self, state):
|
| 409 |
+
"""Unlike a normal CookieJar, this class is pickleable."""
|
| 410 |
+
self.__dict__.update(state)
|
| 411 |
+
if '_cookies_lock' not in self.__dict__:
|
| 412 |
+
self._cookies_lock = threading.RLock()
|
| 413 |
+
|
| 414 |
+
def copy(self):
|
| 415 |
+
"""Return a copy of this RequestsCookieJar."""
|
| 416 |
+
new_cj = RequestsCookieJar()
|
| 417 |
+
new_cj.set_policy(self.get_policy())
|
| 418 |
+
new_cj.update(self)
|
| 419 |
+
return new_cj
|
| 420 |
+
|
| 421 |
+
def get_policy(self):
|
| 422 |
+
"""Return the CookiePolicy instance used."""
|
| 423 |
+
return self._policy
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
def _copy_cookie_jar(jar):
|
| 427 |
+
if jar is None:
|
| 428 |
+
return None
|
| 429 |
+
|
| 430 |
+
if hasattr(jar, 'copy'):
|
| 431 |
+
# We're dealing with an instance of RequestsCookieJar
|
| 432 |
+
return jar.copy()
|
| 433 |
+
# We're dealing with a generic CookieJar instance
|
| 434 |
+
new_jar = copy.copy(jar)
|
| 435 |
+
new_jar.clear()
|
| 436 |
+
for cookie in jar:
|
| 437 |
+
new_jar.set_cookie(copy.copy(cookie))
|
| 438 |
+
return new_jar
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
def create_cookie(name, value, **kwargs):
|
| 442 |
+
"""Make a cookie from underspecified parameters.
|
| 443 |
+
|
| 444 |
+
By default, the pair of `name` and `value` will be set for the domain ''
|
| 445 |
+
and sent on every request (this is sometimes called a "supercookie").
|
| 446 |
+
"""
|
| 447 |
+
result = {
|
| 448 |
+
'version': 0,
|
| 449 |
+
'name': name,
|
| 450 |
+
'value': value,
|
| 451 |
+
'port': None,
|
| 452 |
+
'domain': '',
|
| 453 |
+
'path': '/',
|
| 454 |
+
'secure': False,
|
| 455 |
+
'expires': None,
|
| 456 |
+
'discard': True,
|
| 457 |
+
'comment': None,
|
| 458 |
+
'comment_url': None,
|
| 459 |
+
'rest': {'HttpOnly': None},
|
| 460 |
+
'rfc2109': False,
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
badargs = set(kwargs) - set(result)
|
| 464 |
+
if badargs:
|
| 465 |
+
err = 'create_cookie() got unexpected keyword arguments: %s'
|
| 466 |
+
raise TypeError(err % list(badargs))
|
| 467 |
+
|
| 468 |
+
result.update(kwargs)
|
| 469 |
+
result['port_specified'] = bool(result['port'])
|
| 470 |
+
result['domain_specified'] = bool(result['domain'])
|
| 471 |
+
result['domain_initial_dot'] = result['domain'].startswith('.')
|
| 472 |
+
result['path_specified'] = bool(result['path'])
|
| 473 |
+
|
| 474 |
+
return cookielib.Cookie(**result)
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
def morsel_to_cookie(morsel):
|
| 478 |
+
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
|
| 479 |
+
|
| 480 |
+
expires = None
|
| 481 |
+
if morsel['max-age']:
|
| 482 |
+
try:
|
| 483 |
+
expires = int(time.time() + int(morsel['max-age']))
|
| 484 |
+
except ValueError:
|
| 485 |
+
raise TypeError('max-age: %s must be integer' % morsel['max-age'])
|
| 486 |
+
elif morsel['expires']:
|
| 487 |
+
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
|
| 488 |
+
expires = calendar.timegm(
|
| 489 |
+
time.strptime(morsel['expires'], time_template)
|
| 490 |
+
)
|
| 491 |
+
return create_cookie(
|
| 492 |
+
comment=morsel['comment'],
|
| 493 |
+
comment_url=bool(morsel['comment']),
|
| 494 |
+
discard=False,
|
| 495 |
+
domain=morsel['domain'],
|
| 496 |
+
expires=expires,
|
| 497 |
+
name=morsel.key,
|
| 498 |
+
path=morsel['path'],
|
| 499 |
+
port=None,
|
| 500 |
+
rest={'HttpOnly': morsel['httponly']},
|
| 501 |
+
rfc2109=False,
|
| 502 |
+
secure=bool(morsel['secure']),
|
| 503 |
+
value=morsel.value,
|
| 504 |
+
version=morsel['version'] or 0,
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True):
|
| 509 |
+
"""Returns a CookieJar from a key/value dictionary.
|
| 510 |
+
|
| 511 |
+
:param cookie_dict: Dict of key/values to insert into CookieJar.
|
| 512 |
+
:param cookiejar: (optional) A cookiejar to add the cookies to.
|
| 513 |
+
:param overwrite: (optional) If False, will not replace cookies
|
| 514 |
+
already in the jar with new ones.
|
| 515 |
+
:rtype: CookieJar
|
| 516 |
+
"""
|
| 517 |
+
if cookiejar is None:
|
| 518 |
+
cookiejar = RequestsCookieJar()
|
| 519 |
+
|
| 520 |
+
if cookie_dict is not None:
|
| 521 |
+
names_from_jar = [cookie.name for cookie in cookiejar]
|
| 522 |
+
for name in cookie_dict:
|
| 523 |
+
if overwrite or (name not in names_from_jar):
|
| 524 |
+
cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
|
| 525 |
+
|
| 526 |
+
return cookiejar
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
def merge_cookies(cookiejar, cookies):
|
| 530 |
+
"""Add cookies to cookiejar and returns a merged CookieJar.
|
| 531 |
+
|
| 532 |
+
:param cookiejar: CookieJar object to add the cookies to.
|
| 533 |
+
:param cookies: Dictionary or CookieJar object to be added.
|
| 534 |
+
:rtype: CookieJar
|
| 535 |
+
"""
|
| 536 |
+
if not isinstance(cookiejar, cookielib.CookieJar):
|
| 537 |
+
raise ValueError('You can only merge into CookieJar')
|
| 538 |
+
|
| 539 |
+
if isinstance(cookies, dict):
|
| 540 |
+
cookiejar = cookiejar_from_dict(
|
| 541 |
+
cookies, cookiejar=cookiejar, overwrite=False)
|
| 542 |
+
elif isinstance(cookies, cookielib.CookieJar):
|
| 543 |
+
try:
|
| 544 |
+
cookiejar.update(cookies)
|
| 545 |
+
except AttributeError:
|
| 546 |
+
for cookie_in_jar in cookies:
|
| 547 |
+
cookiejar.set_cookie(cookie_in_jar)
|
| 548 |
+
|
| 549 |
+
return cookiejar
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/exceptions.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
requests.exceptions
|
| 5 |
+
~~~~~~~~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
This module contains the set of Requests' exceptions.
|
| 8 |
+
"""
|
| 9 |
+
from urllib3.exceptions import HTTPError as BaseHTTPError
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class RequestException(IOError):
|
| 13 |
+
"""There was an ambiguous exception that occurred while handling your
|
| 14 |
+
request.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __init__(self, *args, **kwargs):
|
| 18 |
+
"""Initialize RequestException with `request` and `response` objects."""
|
| 19 |
+
response = kwargs.pop('response', None)
|
| 20 |
+
self.response = response
|
| 21 |
+
self.request = kwargs.pop('request', None)
|
| 22 |
+
if (response is not None and not self.request and
|
| 23 |
+
hasattr(response, 'request')):
|
| 24 |
+
self.request = self.response.request
|
| 25 |
+
super(RequestException, self).__init__(*args, **kwargs)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class HTTPError(RequestException):
|
| 29 |
+
"""An HTTP error occurred."""
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class ConnectionError(RequestException):
|
| 33 |
+
"""A Connection error occurred."""
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class ProxyError(ConnectionError):
|
| 37 |
+
"""A proxy error occurred."""
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class SSLError(ConnectionError):
|
| 41 |
+
"""An SSL error occurred."""
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class Timeout(RequestException):
|
| 45 |
+
"""The request timed out.
|
| 46 |
+
|
| 47 |
+
Catching this error will catch both
|
| 48 |
+
:exc:`~requests.exceptions.ConnectTimeout` and
|
| 49 |
+
:exc:`~requests.exceptions.ReadTimeout` errors.
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class ConnectTimeout(ConnectionError, Timeout):
|
| 54 |
+
"""The request timed out while trying to connect to the remote server.
|
| 55 |
+
|
| 56 |
+
Requests that produced this error are safe to retry.
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class ReadTimeout(Timeout):
|
| 61 |
+
"""The server did not send any data in the allotted amount of time."""
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class URLRequired(RequestException):
|
| 65 |
+
"""A valid URL is required to make a request."""
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class TooManyRedirects(RequestException):
|
| 69 |
+
"""Too many redirects."""
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class MissingSchema(RequestException, ValueError):
|
| 73 |
+
"""The URL schema (e.g. http or https) is missing."""
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class InvalidSchema(RequestException, ValueError):
|
| 77 |
+
"""See defaults.py for valid schemas."""
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class InvalidURL(RequestException, ValueError):
|
| 81 |
+
"""The URL provided was somehow invalid."""
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class InvalidHeader(RequestException, ValueError):
|
| 85 |
+
"""The header value provided was somehow invalid."""
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
class InvalidProxyURL(InvalidURL):
|
| 89 |
+
"""The proxy URL provided is invalid."""
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class ChunkedEncodingError(RequestException):
|
| 93 |
+
"""The server declared chunked encoding but sent an invalid chunk."""
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class ContentDecodingError(RequestException, BaseHTTPError):
|
| 97 |
+
"""Failed to decode response content"""
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class StreamConsumedError(RequestException, TypeError):
|
| 101 |
+
"""The content for this response was already consumed"""
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
class RetryError(RequestException):
|
| 105 |
+
"""Custom retries logic failed"""
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class UnrewindableBodyError(RequestException):
|
| 109 |
+
"""Requests encountered an error when trying to rewind a body"""
|
| 110 |
+
|
| 111 |
+
# Warnings
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class RequestsWarning(Warning):
|
| 115 |
+
"""Base warning for Requests."""
|
| 116 |
+
pass
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class FileModeWarning(RequestsWarning, DeprecationWarning):
|
| 120 |
+
"""A file was opened in text mode, but Requests determined its binary length."""
|
| 121 |
+
pass
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class RequestsDependencyWarning(RequestsWarning):
|
| 125 |
+
"""An imported dependency doesn't match the expected version range."""
|
| 126 |
+
pass
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/help.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Module containing bug report helper(s)."""
|
| 2 |
+
from __future__ import print_function
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import platform
|
| 6 |
+
import sys
|
| 7 |
+
import ssl
|
| 8 |
+
|
| 9 |
+
import idna
|
| 10 |
+
import urllib3
|
| 11 |
+
import chardet
|
| 12 |
+
|
| 13 |
+
from . import __version__ as requests_version
|
| 14 |
+
|
| 15 |
+
try:
|
| 16 |
+
from urllib3.contrib import pyopenssl
|
| 17 |
+
except ImportError:
|
| 18 |
+
pyopenssl = None
|
| 19 |
+
OpenSSL = None
|
| 20 |
+
cryptography = None
|
| 21 |
+
else:
|
| 22 |
+
import OpenSSL
|
| 23 |
+
import cryptography
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _implementation():
|
| 27 |
+
"""Return a dict with the Python implementation and version.
|
| 28 |
+
|
| 29 |
+
Provide both the name and the version of the Python implementation
|
| 30 |
+
currently running. For example, on CPython 2.7.5 it will return
|
| 31 |
+
{'name': 'CPython', 'version': '2.7.5'}.
|
| 32 |
+
|
| 33 |
+
This function works best on CPython and PyPy: in particular, it probably
|
| 34 |
+
doesn't work for Jython or IronPython. Future investigation should be done
|
| 35 |
+
to work out the correct shape of the code for those platforms.
|
| 36 |
+
"""
|
| 37 |
+
implementation = platform.python_implementation()
|
| 38 |
+
|
| 39 |
+
if implementation == 'CPython':
|
| 40 |
+
implementation_version = platform.python_version()
|
| 41 |
+
elif implementation == 'PyPy':
|
| 42 |
+
implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,
|
| 43 |
+
sys.pypy_version_info.minor,
|
| 44 |
+
sys.pypy_version_info.micro)
|
| 45 |
+
if sys.pypy_version_info.releaselevel != 'final':
|
| 46 |
+
implementation_version = ''.join([
|
| 47 |
+
implementation_version, sys.pypy_version_info.releaselevel
|
| 48 |
+
])
|
| 49 |
+
elif implementation == 'Jython':
|
| 50 |
+
implementation_version = platform.python_version() # Complete Guess
|
| 51 |
+
elif implementation == 'IronPython':
|
| 52 |
+
implementation_version = platform.python_version() # Complete Guess
|
| 53 |
+
else:
|
| 54 |
+
implementation_version = 'Unknown'
|
| 55 |
+
|
| 56 |
+
return {'name': implementation, 'version': implementation_version}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def info():
|
| 60 |
+
"""Generate information for a bug report."""
|
| 61 |
+
try:
|
| 62 |
+
platform_info = {
|
| 63 |
+
'system': platform.system(),
|
| 64 |
+
'release': platform.release(),
|
| 65 |
+
}
|
| 66 |
+
except IOError:
|
| 67 |
+
platform_info = {
|
| 68 |
+
'system': 'Unknown',
|
| 69 |
+
'release': 'Unknown',
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
implementation_info = _implementation()
|
| 73 |
+
urllib3_info = {'version': urllib3.__version__}
|
| 74 |
+
chardet_info = {'version': chardet.__version__}
|
| 75 |
+
|
| 76 |
+
pyopenssl_info = {
|
| 77 |
+
'version': None,
|
| 78 |
+
'openssl_version': '',
|
| 79 |
+
}
|
| 80 |
+
if OpenSSL:
|
| 81 |
+
pyopenssl_info = {
|
| 82 |
+
'version': OpenSSL.__version__,
|
| 83 |
+
'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
|
| 84 |
+
}
|
| 85 |
+
cryptography_info = {
|
| 86 |
+
'version': getattr(cryptography, '__version__', ''),
|
| 87 |
+
}
|
| 88 |
+
idna_info = {
|
| 89 |
+
'version': getattr(idna, '__version__', ''),
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
system_ssl = ssl.OPENSSL_VERSION_NUMBER
|
| 93 |
+
system_ssl_info = {
|
| 94 |
+
'version': '%x' % system_ssl if system_ssl is not None else ''
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
'platform': platform_info,
|
| 99 |
+
'implementation': implementation_info,
|
| 100 |
+
'system_ssl': system_ssl_info,
|
| 101 |
+
'using_pyopenssl': pyopenssl is not None,
|
| 102 |
+
'pyOpenSSL': pyopenssl_info,
|
| 103 |
+
'urllib3': urllib3_info,
|
| 104 |
+
'chardet': chardet_info,
|
| 105 |
+
'cryptography': cryptography_info,
|
| 106 |
+
'idna': idna_info,
|
| 107 |
+
'requests': {
|
| 108 |
+
'version': requests_version,
|
| 109 |
+
},
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def main():
|
| 114 |
+
"""Pretty-print the bug information as JSON."""
|
| 115 |
+
print(json.dumps(info(), sort_keys=True, indent=2))
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
if __name__ == '__main__':
|
| 119 |
+
main()
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/hooks.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
requests.hooks
|
| 5 |
+
~~~~~~~~~~~~~~
|
| 6 |
+
|
| 7 |
+
This module provides the capabilities for the Requests hooks system.
|
| 8 |
+
|
| 9 |
+
Available hooks:
|
| 10 |
+
|
| 11 |
+
``response``:
|
| 12 |
+
The response generated from a Request.
|
| 13 |
+
"""
|
| 14 |
+
HOOKS = ['response']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def default_hooks():
|
| 18 |
+
return {event: [] for event in HOOKS}
|
| 19 |
+
|
| 20 |
+
# TODO: response is the only one
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def dispatch_hook(key, hooks, hook_data, **kwargs):
|
| 24 |
+
"""Dispatches a hook dictionary on a given piece of data."""
|
| 25 |
+
hooks = hooks or {}
|
| 26 |
+
hooks = hooks.get(key)
|
| 27 |
+
if hooks:
|
| 28 |
+
if hasattr(hooks, '__call__'):
|
| 29 |
+
hooks = [hooks]
|
| 30 |
+
for hook in hooks:
|
| 31 |
+
_hook_data = hook(hook_data, **kwargs)
|
| 32 |
+
if _hook_data is not None:
|
| 33 |
+
hook_data = _hook_data
|
| 34 |
+
return hook_data
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/requests/models.py
ADDED
|
@@ -0,0 +1,953 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ains the primary objects that power Requests.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import datetime
|
| 11 |
+
import sys
|
| 12 |
+
|
| 13 |
+
# Import encoding now, to avoid implicit import later.
|
| 14 |
+
# Implicit import within threads may cause LookupError when standard library is in a ZIP,
|
| 15 |
+
# such as in Embedded Python. See https://github.com/requests/requests/issues/3578.
|
| 16 |
+
import encodings.idna
|
| 17 |
+
|
| 18 |
+
from urllib3.fields import RequestField
|
| 19 |
+
from urllib3.filepost import encode_multipart_formdata
|
| 20 |
+
from urllib3.util import parse_url
|
| 21 |
+
from urllib3.exceptions import (
|
| 22 |
+
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
|
| 23 |
+
|
| 24 |
+
from io import UnsupportedOperation
|
| 25 |
+
from .hooks import default_hooks
|
| 26 |
+
from .structures import CaseInsensitiveDict
|
| 27 |
+
|
| 28 |
+
from .auth import HTTPBasicAuth
|
| 29 |
+
from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
|
| 30 |
+
from .exceptions import (
|
| 31 |
+
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
|
| 32 |
+
ContentDecodingError, ConnectionError, StreamConsumedError)
|
| 33 |
+
from ._internal_utils import to_native_string, unicode_is_ascii
|
| 34 |
+
from .utils import (
|
| 35 |
+
guess_filename, get_auth_from_url, requote_uri,
|
| 36 |
+
stream_decode_response_unicode, to_key_val_list, parse_header_links,
|
| 37 |
+
iter_slices, guess_json_utf, super_len, check_header_validity)
|
| 38 |
+
from .compat import (
|
| 39 |
+
Callable, Mapping,
|
| 40 |
+
cookielib, urlunparse, urlsplit, urlencode, str, bytes,
|
| 41 |
+
is_py2, chardet, builtin_str, basestring)
|
| 42 |
+
from .compat import json as complexjson
|
| 43 |
+
from .status_codes import codes
|
| 44 |
+
|
| 45 |
+
#: The set of HTTP status codes that indicate an automatically
|
| 46 |
+
#: processable redirect.
|
| 47 |
+
REDIRECT_STATI = (
|
| 48 |
+
codes.moved, # 301
|
| 49 |
+
codes.found, # 302
|
| 50 |
+
codes.other, # 303
|
| 51 |
+
codes.temporary_redirect, # 307
|
| 52 |
+
codes.permanent_redirect, # 308
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
DEFAULT_REDIRECT_LIMIT = 30
|
| 56 |
+
CONTENT_CHUNK_SIZE = 10 * 1024
|
| 57 |
+
ITER_CHUNK_SIZE = 512
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class RequestEncodingMixin(object):
|
| 61 |
+
@property
|
| 62 |
+
def path_url(self):
|
| 63 |
+
"""Build the path URL to use."""
|
| 64 |
+
|
| 65 |
+
url = []
|
| 66 |
+
|
| 67 |
+
p = urlsplit(self.url)
|
| 68 |
+
|
| 69 |
+
path = p.path
|
| 70 |
+
if not path:
|
| 71 |
+
path = '/'
|
| 72 |
+
|
| 73 |
+
url.append(path)
|
| 74 |
+
|
| 75 |
+
query = p.query
|
| 76 |
+
if query:
|
| 77 |
+
url.append('?')
|
| 78 |
+
url.append(query)
|
| 79 |
+
|
| 80 |
+
return ''.join(url)
|
| 81 |
+
|
| 82 |
+
@staticmethod
|
| 83 |
+
def _encode_params(data):
|
| 84 |
+
"""Encode parameters in a piece of data.
|
| 85 |
+
|
| 86 |
+
Will successfully encode parameters when passed as a dict or a list of
|
| 87 |
+
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
|
| 88 |
+
if parameters are supplied as a dict.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
if isinstance(data, (str, bytes)):
|
| 92 |
+
return data
|
| 93 |
+
elif hasattr(data, 'read'):
|
| 94 |
+
return data
|
| 95 |
+
elif hasattr(data, '__iter__'):
|
| 96 |
+
result = []
|
| 97 |
+
for k, vs in to_key_val_list(data):
|
| 98 |
+
if isinstance(vs, basestring) or not hasattr(vs, '__iter__'):
|
| 99 |
+
vs = [vs]
|
| 100 |
+
for v in vs:
|
| 101 |
+
if v is not None:
|
| 102 |
+
result.append(
|
| 103 |
+
(k.encode('utf-8') if isinstance(k, str) else k,
|
| 104 |
+
v.encode('utf-8') if isinstance(v, str) else v))
|
| 105 |
+
return urlencode(result, doseq=True)
|
| 106 |
+
else:
|
| 107 |
+
return data
|
| 108 |
+
|
| 109 |
+
@staticmethod
|
| 110 |
+
def _encode_files(files, data):
|
| 111 |
+
"""Build the body for a multipart/form-data request.
|
| 112 |
+
|
| 113 |
+
Will successfully encode files when passed as a dict or a list of
|
| 114 |
+
tuples. Order is retained if data is a list of tuples but arbitrary
|
| 115 |
+
if parameters are supplied as a dict.
|
| 116 |
+
The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype)
|
| 117 |
+
or 4-tuples (filename, fileobj, contentype, custom_headers).
|
| 118 |
+
"""
|
| 119 |
+
if (not files):
|
| 120 |
+
raise ValueError("Files must be provided.")
|
| 121 |
+
elif isinstance(data, basestring):
|
| 122 |
+
raise ValueError("Data must not be a string.")
|
| 123 |
+
|
| 124 |
+
new_fields = []
|
| 125 |
+
fields = to_key_val_list(data or {})
|
| 126 |
+
files = to_key_val_list(files or {})
|
| 127 |
+
|
| 128 |
+
for field, val in fields:
|
| 129 |
+
if isinstance(val, basestring) or not hasattr(val, '__iter__'):
|
| 130 |
+
val = [val]
|
| 131 |
+
for v in val:
|
| 132 |
+
if v is not None:
|
| 133 |
+
# Don't call str() on bytestrings: in Py3 it all goes wrong.
|
| 134 |
+
if not isinstance(v, bytes):
|
| 135 |
+
v = str(v)
|
| 136 |
+
|
| 137 |
+
new_fields.append(
|
| 138 |
+
(field.decode('utf-8') if isinstance(field, bytes) else field,
|
| 139 |
+
v.encode('utf-8') if isinstance(v, str) else v))
|
| 140 |
+
|
| 141 |
+
for (k, v) in files:
|
| 142 |
+
# support for explicit filename
|
| 143 |
+
ft = None
|
| 144 |
+
fh = None
|
| 145 |
+
if isinstance(v, (tuple, list)):
|
| 146 |
+
if len(v) == 2:
|
| 147 |
+
fn, fp = v
|
| 148 |
+
elif len(v) == 3:
|
| 149 |
+
fn, fp, ft = v
|
| 150 |
+
else:
|
| 151 |
+
fn, fp, ft, fh = v
|
| 152 |
+
else:
|
| 153 |
+
fn = guess_filename(v) or k
|
| 154 |
+
fp = v
|
| 155 |
+
|
| 156 |
+
if isinstance(fp, (str, bytes, bytearray)):
|
| 157 |
+
fdata = fp
|
| 158 |
+
elif hasattr(fp, 'read'):
|
| 159 |
+
fdata = fp.read()
|
| 160 |
+
elif fp is None:
|
| 161 |
+
continue
|
| 162 |
+
else:
|
| 163 |
+
fdata = fp
|
| 164 |
+
|
| 165 |
+
rf = RequestField(name=k, data=fdata, filename=fn, headers=fh)
|
| 166 |
+
rf.make_multipart(content_type=ft)
|
| 167 |
+
new_fields.append(rf)
|
| 168 |
+
|
| 169 |
+
body, content_type = encode_multipart_formdata(new_fields)
|
| 170 |
+
|
| 171 |
+
return body, content_type
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
class RequestHooksMixin(object):
|
| 175 |
+
def register_hook(self, event, hook):
|
| 176 |
+
"""Properly register a hook."""
|
| 177 |
+
|
| 178 |
+
if event not in self.hooks:
|
| 179 |
+
raise ValueError('Unsupported event specified, with event name "%s"' % (event))
|
| 180 |
+
|
| 181 |
+
if isinstance(hook, Callable):
|
| 182 |
+
self.hooks[event].append(hook)
|
| 183 |
+
elif hasattr(hook, '__iter__'):
|
| 184 |
+
self.hooks[event].extend(h for h in hook if isinstance(h, Callable))
|
| 185 |
+
|
| 186 |
+
def deregister_hook(self, event, hook):
|
| 187 |
+
"""Deregister a previously registered hook.
|
| 188 |
+
Returns True if the hook existed, False if not.
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
try:
|
| 192 |
+
self.hooks[event].remove(hook)
|
| 193 |
+
return True
|
| 194 |
+
except ValueError:
|
| 195 |
+
return False
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
class Request(RequestHooksMixin):
|
| 199 |
+
"""A user-created :class:`Request <Request>` object.
|
| 200 |
+
|
| 201 |
+
Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
|
| 202 |
+
|
| 203 |
+
:param method: HTTP method to use.
|
| 204 |
+
:param url: URL to send.
|
| 205 |
+
:param headers: dictionary of headers to send.
|
| 206 |
+
:param files: dictionary of {filename: fileobject} files to multipart upload.
|
| 207 |
+
:param data: the body to attach to the request. If a dictionary or
|
| 208 |
+
list of tuples ``[(key, value)]`` is provided, form-encoding will
|
| 209 |
+
take place.
|
| 210 |
+
:param json: json for the body to attach to the request (if files or data is not specified).
|
| 211 |
+
:param params: URL parameters to append to the URL. If a dictionary or
|
| 212 |
+
list of tuples ``[(key, value)]`` is provided, form-encoding will
|
| 213 |
+
take place.
|
| 214 |
+
:param auth: Auth handler or (user, pass) tuple.
|
| 215 |
+
:param cookies: dictionary or CookieJar of cookies to attach to this request.
|
| 216 |
+
:param hooks: dictionary of callback hooks, for internal usage.
|
| 217 |
+
|
| 218 |
+
Usage::
|
| 219 |
+
|
| 220 |
+
>>> import requests
|
| 221 |
+
>>> req = requests.Request('GET', 'https://httpbin.org/get')
|
| 222 |
+
>>> req.prepare()
|
| 223 |
+
<PreparedRequest [GET]>
|
| 224 |
+
"""
|
| 225 |
+
|
| 226 |
+
def __init__(self,
|
| 227 |
+
method=None, url=None, headers=None, files=None, data=None,
|
| 228 |
+
params=None, auth=None, cookies=None, hooks=None, json=None):
|
| 229 |
+
|
| 230 |
+
# Default empty dicts for dict params.
|
| 231 |
+
data = [] if data is None else data
|
| 232 |
+
files = [] if files is None else files
|
| 233 |
+
headers = {} if headers is None else headers
|
| 234 |
+
params = {} if params is None else params
|
| 235 |
+
hooks = {} if hooks is None else hooks
|
| 236 |
+
|
| 237 |
+
self.hooks = default_hooks()
|
| 238 |
+
for (k, v) in list(hooks.items()):
|
| 239 |
+
self.register_hook(event=k, hook=v)
|
| 240 |
+
|
| 241 |
+
self.method = method
|
| 242 |
+
self.url = url
|
| 243 |
+
self.headers = headers
|
| 244 |
+
self.files = files
|
| 245 |
+
self.data = data
|
| 246 |
+
self.json = json
|
| 247 |
+
self.params = params
|
| 248 |
+
self.auth = auth
|
| 249 |
+
self.cookies = cookies
|
| 250 |
+
|
| 251 |
+
def __repr__(self):
|
| 252 |
+
return '<Request [%s]>' % (self.method)
|
| 253 |
+
|
| 254 |
+
def prepare(self):
|
| 255 |
+
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it."""
|
| 256 |
+
p = PreparedRequest()
|
| 257 |
+
p.prepare(
|
| 258 |
+
method=self.method,
|
| 259 |
+
url=self.url,
|
| 260 |
+
headers=self.headers,
|
| 261 |
+
files=self.files,
|
| 262 |
+
data=self.data,
|
| 263 |
+
json=self.json,
|
| 264 |
+
params=self.params,
|
| 265 |
+
auth=self.auth,
|
| 266 |
+
cookies=self.cookies,
|
| 267 |
+
hooks=self.hooks,
|
| 268 |
+
)
|
| 269 |
+
return p
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
| 273 |
+
"""The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
|
| 274 |
+
containing the exact bytes that will be sent to the server.
|
| 275 |
+
|
| 276 |
+
Generated from either a :class:`Request <Request>` object or manually.
|
| 277 |
+
|
| 278 |
+
Usage::
|
| 279 |
+
|
| 280 |
+
>>> import requests
|
| 281 |
+
>>> req = requests.Request('GET', 'https://httpbin.org/get')
|
| 282 |
+
>>> r = req.prepare()
|
| 283 |
+
<PreparedRequest [GET]>
|
| 284 |
+
|
| 285 |
+
>>> s = requests.Session()
|
| 286 |
+
>>> s.send(r)
|
| 287 |
+
<Response [200]>
|
| 288 |
+
"""
|
| 289 |
+
|
| 290 |
+
def __init__(self):
|
| 291 |
+
#: HTTP verb to send to the server.
|
| 292 |
+
self.method = None
|
| 293 |
+
#: HTTP URL to send the request to.
|
| 294 |
+
self.url = None
|
| 295 |
+
#: dictionary of HTTP headers.
|
| 296 |
+
self.headers = None
|
| 297 |
+
# The `CookieJar` used to create the Cookie header will be stored here
|
| 298 |
+
# after prepare_cookies is called
|
| 299 |
+
self._cookies = None
|
| 300 |
+
#: request body to send to the server.
|
| 301 |
+
self.body = None
|
| 302 |
+
#: dictionary of callback hooks, for internal usage.
|
| 303 |
+
self.hooks = default_hooks()
|
| 304 |
+
#: integer denoting starting position of a readable file-like body.
|
| 305 |
+
self._body_position = None
|
| 306 |
+
|
| 307 |
+
def prepare(self,
|
| 308 |
+
method=None, url=None, headers=None, files=None, data=None,
|
| 309 |
+
params=None, auth=None, cookies=None, hooks=None, json=None):
|
| 310 |
+
"""Prepares the entire request with the given parameters."""
|
| 311 |
+
|
| 312 |
+
self.prepare_method(method)
|
| 313 |
+
self.prepare_url(url, params)
|
| 314 |
+
self.prepare_headers(headers)
|
| 315 |
+
self.prepare_cookies(cookies)
|
| 316 |
+
self.prepare_body(data, files, json)
|
| 317 |
+
self.prepare_auth(auth, url)
|
| 318 |
+
|
| 319 |
+
# Note that prepare_auth must be last to enable authentication schemes
|
| 320 |
+
# such as OAuth to work on a fully prepared request.
|
| 321 |
+
|
| 322 |
+
# This MUST go after prepare_auth. Authenticators could add a hook
|
| 323 |
+
self.prepare_hooks(hooks)
|
| 324 |
+
|
| 325 |
+
def __repr__(self):
|
| 326 |
+
return '<PreparedRequest [%s]>' % (self.method)
|
| 327 |
+
|
| 328 |
+
def copy(self):
|
| 329 |
+
p = PreparedRequest()
|
| 330 |
+
p.method = self.method
|
| 331 |
+
p.url = self.url
|
| 332 |
+
p.headers = self.headers.copy() if self.headers is not None else None
|
| 333 |
+
p._cookies = _copy_cookie_jar(self._cookies)
|
| 334 |
+
p.body = self.body
|
| 335 |
+
p.hooks = self.hooks
|
| 336 |
+
p._body_position = self._body_position
|
| 337 |
+
return p
|
| 338 |
+
|
| 339 |
+
def prepare_method(self, method):
|
| 340 |
+
"""Prepares the given HTTP method."""
|
| 341 |
+
self.method = method
|
| 342 |
+
if self.method is not None:
|
| 343 |
+
self.method = to_native_string(self.method.upper())
|
| 344 |
+
|
| 345 |
+
@staticmethod
|
| 346 |
+
def _get_idna_encoded_host(host):
|
| 347 |
+
import idna
|
| 348 |
+
|
| 349 |
+
try:
|
| 350 |
+
host = idna.encode(host, uts46=True).decode('utf-8')
|
| 351 |
+
except idna.IDNAError:
|
| 352 |
+
raise UnicodeError
|
| 353 |
+
return host
|
| 354 |
+
|
| 355 |
+
def prepare_url(self, url, params):
|
| 356 |
+
"""Prepares the given HTTP URL."""
|
| 357 |
+
#: Accept objects that have string representations.
|
| 358 |
+
#: We're unable to blindly call unicode/str functions
|
| 359 |
+
#: as this will include the bytestring indicator (b'')
|
| 360 |
+
#: on python 3.x.
|
| 361 |
+
#: https://github.com/requests/requests/pull/2238
|
| 362 |
+
if isinstance(url, bytes):
|
| 363 |
+
url = url.decode('utf8')
|
| 364 |
+
else:
|
| 365 |
+
url = unicode(url) if is_py2 else str(url)
|
| 366 |
+
|
| 367 |
+
# Remove leading whitespaces from url
|
| 368 |
+
url = url.lstrip()
|
| 369 |
+
|
| 370 |
+
# Don't do any URL preparation for non-HTTP schemes like `mailto`,
|
| 371 |
+
# `data` etc to work around exceptions from `url_parse`, which
|
| 372 |
+
# handles RFC 3986 only.
|
| 373 |
+
if ':' in url and not url.lower().startswith('http'):
|
| 374 |
+
self.url = url
|
| 375 |
+
return
|
| 376 |
+
|
| 377 |
+
# Support for unicode domain names and paths.
|
| 378 |
+
try:
|
| 379 |
+
scheme, auth, host, port, path, query, fragment = parse_url(url)
|
| 380 |
+
except LocationParseError as e:
|
| 381 |
+
raise InvalidURL(*e.args)
|
| 382 |
+
|
| 383 |
+
if not scheme:
|
| 384 |
+
error = ("Invalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?")
|
| 385 |
+
error = error.format(to_native_string(url, 'utf8'))
|
| 386 |
+
|
| 387 |
+
raise MissingSchema(error)
|
| 388 |
+
|
| 389 |
+
if not host:
|
| 390 |
+
raise InvalidURL("Invalid URL %r: No host supplied" % url)
|
| 391 |
+
|
| 392 |
+
# In general, we want to try IDNA encoding the hostname if the string contains
|
| 393 |
+
# non-ASCII characters. This allows users to automatically get the correct IDNA
|
| 394 |
+
# behaviour. For strings containing only ASCII characters, we need to also verify
|
| 395 |
+
# it doesn't start with a wildcard (*), before allowing the unencoded hostname.
|
| 396 |
+
if not unicode_is_ascii(host):
|
| 397 |
+
try:
|
| 398 |
+
host = self._get_idna_encoded_host(host)
|
| 399 |
+
except UnicodeError:
|
| 400 |
+
raise InvalidURL('URL has an invalid label.')
|
| 401 |
+
elif host.startswith(u'*'):
|
| 402 |
+
raise InvalidURL('URL has an invalid label.')
|
| 403 |
+
|
| 404 |
+
# Carefully reconstruct the network location
|
| 405 |
+
netloc = auth or ''
|
| 406 |
+
if netloc:
|
| 407 |
+
netloc += '@'
|
| 408 |
+
netloc += host
|
| 409 |
+
if port:
|
| 410 |
+
netloc += ':' + str(port)
|
| 411 |
+
|
| 412 |
+
# Bare domains aren't valid URLs.
|
| 413 |
+
if not path:
|
| 414 |
+
path = '/'
|
| 415 |
+
|
| 416 |
+
if is_py2:
|
| 417 |
+
if isinstance(scheme, str):
|
| 418 |
+
scheme = scheme.encode('utf-8')
|
| 419 |
+
if isinstance(netloc, str):
|
| 420 |
+
netloc = netloc.encode('utf-8')
|
| 421 |
+
if isinstance(path, str):
|
| 422 |
+
path = path.encode('utf-8')
|
| 423 |
+
if isinstance(query, str):
|
| 424 |
+
query = query.encode('utf-8')
|
| 425 |
+
if isinstance(fragment, str):
|
| 426 |
+
fragment = fragment.encode('utf-8')
|
| 427 |
+
|
| 428 |
+
if isinstance(params, (str, bytes)):
|
| 429 |
+
params = to_native_string(params)
|
| 430 |
+
|
| 431 |
+
enc_params = self._encode_params(params)
|
| 432 |
+
if enc_params:
|
| 433 |
+
if query:
|
| 434 |
+
query = '%s&%s' % (query, enc_params)
|
| 435 |
+
else:
|
| 436 |
+
query = enc_params
|
| 437 |
+
|
| 438 |
+
url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment]))
|
| 439 |
+
self.url = url
|
| 440 |
+
|
| 441 |
+
def prepare_headers(self, headers):
|
| 442 |
+
"""Prepares the given HTTP headers."""
|
| 443 |
+
|
| 444 |
+
self.headers = CaseInsensitiveDict()
|
| 445 |
+
if headers:
|
| 446 |
+
for header in headers.items():
|
| 447 |
+
# Raise exception on invalid header value.
|
| 448 |
+
check_header_validity(header)
|
| 449 |
+
name, value = header
|
| 450 |
+
self.headers[to_native_string(name)] = value
|
| 451 |
+
|
| 452 |
+
def prepare_body(self, data, files, json=None):
|
| 453 |
+
"""Prepares the given HTTP body data."""
|
| 454 |
+
|
| 455 |
+
# Check if file, fo, generator, iterator.
|
| 456 |
+
# If not, run through normal process.
|
| 457 |
+
|
| 458 |
+
# Nottin' on you.
|
| 459 |
+
body = None
|
| 460 |
+
content_type = None
|
| 461 |
+
|
| 462 |
+
if not data and json is not None:
|
| 463 |
+
# urllib3 requires a bytes-like body. Python 2's json.dumps
|
| 464 |
+
# provides this natively, but Python 3 gives a Unicode string.
|
| 465 |
+
content_type = 'application/json'
|
| 466 |
+
body = complexjson.dumps(json)
|
| 467 |
+
if not isinstance(body, bytes):
|
| 468 |
+
body = body.encode('utf-8')
|
| 469 |
+
|
| 470 |
+
is_stream = all([
|
| 471 |
+
hasattr(data, '__iter__'),
|
| 472 |
+
not isinstance(data, (basestring, list, tuple, Mapping))
|
| 473 |
+
])
|
| 474 |
+
|
| 475 |
+
try:
|
| 476 |
+
length = super_len(data)
|
| 477 |
+
except (TypeError, AttributeError, UnsupportedOperation):
|
| 478 |
+
length = None
|
| 479 |
+
|
| 480 |
+
if is_stream:
|
| 481 |
+
body = data
|
| 482 |
+
|
| 483 |
+
if getattr(body, 'tell', None) is not None:
|
| 484 |
+
# Record the current file position before reading.
|
| 485 |
+
# This will allow us to rewind a file in the event
|
| 486 |
+
# of a redirect.
|
| 487 |
+
try:
|
| 488 |
+
self._body_position = body.tell()
|
| 489 |
+
except (IOError, OSError):
|
| 490 |
+
# This differentiates from None, allowing us to catch
|
| 491 |
+
# a failed `tell()` later when trying to rewind the body
|
| 492 |
+
self._body_position = object()
|
| 493 |
+
|
| 494 |
+
if files:
|
| 495 |
+
raise NotImplementedError('Streamed bodies and files are mutually exclusive.')
|
| 496 |
+
|
| 497 |
+
if length:
|
| 498 |
+
self.headers['Content-Length'] = builtin_str(length)
|
| 499 |
+
else:
|
| 500 |
+
self.headers['Transfer-Encoding'] = 'chunked'
|
| 501 |
+
else:
|
| 502 |
+
# Multi-part file uploads.
|
| 503 |
+
if files:
|
| 504 |
+
(body, content_type) = self._encode_files(files, data)
|
| 505 |
+
else:
|
| 506 |
+
if data:
|
| 507 |
+
body = self._encode_params(data)
|
| 508 |
+
if isinstance(data, basestring) or hasattr(data, 'read'):
|
| 509 |
+
content_type = None
|
| 510 |
+
else:
|
| 511 |
+
content_type = 'application/x-www-form-urlencoded'
|
| 512 |
+
|
| 513 |
+
self.prepare_content_length(body)
|
| 514 |
+
|
| 515 |
+
# Add content-type if it wasn't explicitly provided.
|
| 516 |
+
if content_type and ('content-type' not in self.headers):
|
| 517 |
+
self.headers['Content-Type'] = content_type
|
| 518 |
+
|
| 519 |
+
self.body = body
|
| 520 |
+
|
| 521 |
+
def prepare_content_length(self, body):
|
| 522 |
+
"""Prepare Content-Length header based on request method and body"""
|
| 523 |
+
if body is not None:
|
| 524 |
+
length = super_len(body)
|
| 525 |
+
if length:
|
| 526 |
+
# If length exists, set it. Otherwise, we fallback
|
| 527 |
+
# to Transfer-Encoding: chunked.
|
| 528 |
+
self.headers['Content-Length'] = builtin_str(length)
|
| 529 |
+
elif self.method not in ('GET', 'HEAD') and self.headers.get('Content-Length') is None:
|
| 530 |
+
# Set Content-Length to 0 for methods that can have a body
|
| 531 |
+
# but don't provide one. (i.e. not GET or HEAD)
|
| 532 |
+
self.headers['Content-Length'] = '0'
|
| 533 |
+
|
| 534 |
+
def prepare_auth(self, auth, url=''):
|
| 535 |
+
"""Prepares the given HTTP auth data."""
|
| 536 |
+
|
| 537 |
+
# If no Auth is explicitly provided, extract it from the URL first.
|
| 538 |
+
if auth is None:
|
| 539 |
+
url_auth = get_auth_from_url(self.url)
|
| 540 |
+
auth = url_auth if any(url_auth) else None
|
| 541 |
+
|
| 542 |
+
if auth:
|
| 543 |
+
if isinstance(auth, tuple) and len(auth) == 2:
|
| 544 |
+
# special-case basic HTTP auth
|
| 545 |
+
auth = HTTPBasicAuth(*auth)
|
| 546 |
+
|
| 547 |
+
# Allow auth to make its changes.
|
| 548 |
+
r = auth(self)
|
| 549 |
+
|
| 550 |
+
# Update self to reflect the auth changes.
|
| 551 |
+
self.__dict__.update(r.__dict__)
|
| 552 |
+
|
| 553 |
+
# Recompute Content-Length
|
| 554 |
+
self.prepare_content_length(self.body)
|
| 555 |
+
|
| 556 |
+
def prepare_cookies(self, cookies):
|
| 557 |
+
"""Prepares the given HTTP cookie data.
|
| 558 |
+
|
| 559 |
+
This function eventually generates a ``Cookie`` header from the
|
| 560 |
+
given cookies using cookielib. Due to cookielib's design, the header
|
| 561 |
+
will not be regenerated if it already exists, meaning this function
|
| 562 |
+
can only be called once for the life of the
|
| 563 |
+
:class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
|
| 564 |
+
to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
|
| 565 |
+
header is removed beforehand.
|
| 566 |
+
"""
|
| 567 |
+
if isinstance(cookies, cookielib.CookieJar):
|
| 568 |
+
self._cookies = cookies
|
| 569 |
+
else:
|
| 570 |
+
self._cookies = cookiejar_from_dict(cookies)
|
| 571 |
+
|
| 572 |
+
cookie_header = get_cookie_header(self._cookies, self)
|
| 573 |
+
if cookie_header is not None:
|
| 574 |
+
self.headers['Cookie'] = cookie_header
|
| 575 |
+
|
| 576 |
+
def prepare_hooks(self, hooks):
|
| 577 |
+
"""Prepares the given hooks."""
|
| 578 |
+
# hooks can be passed as None to the prepare method and to this
|
| 579 |
+
# method. To prevent iterating over None, simply use an empty list
|
| 580 |
+
# if hooks is False-y
|
| 581 |
+
hooks = hooks or []
|
| 582 |
+
for event in hooks:
|
| 583 |
+
self.register_hook(event, hooks[event])
|
| 584 |
+
|
| 585 |
+
|
| 586 |
+
class Response(object):
|
| 587 |
+
"""The :class:`Response <Response>` object, which contains a
|
| 588 |
+
server's response to an HTTP request.
|
| 589 |
+
"""
|
| 590 |
+
|
| 591 |
+
__attrs__ = [
|
| 592 |
+
'_content', 'status_code', 'headers', 'url', 'history',
|
| 593 |
+
'encoding', 'reason', 'cookies', 'elapsed', 'request'
|
| 594 |
+
]
|
| 595 |
+
|
| 596 |
+
def __init__(self):
|
| 597 |
+
self._content = False
|
| 598 |
+
self._content_consumed = False
|
| 599 |
+
self._next = None
|
| 600 |
+
|
| 601 |
+
#: Integer Code of responded HTTP Status, e.g. 404 or 200.
|
| 602 |
+
self.status_code = None
|
| 603 |
+
|
| 604 |
+
#: Case-insensitive Dictionary of Response Headers.
|
| 605 |
+
#: For example, ``headers['content-encoding']`` will return the
|
| 606 |
+
#: value of a ``'Content-Encoding'`` response header.
|
| 607 |
+
self.headers = CaseInsensitiveDict()
|
| 608 |
+
|
| 609 |
+
#: File-like object representation of response (for advanced usage).
|
| 610 |
+
#: Use of ``raw`` requires that ``stream=True`` be set on the request.
|
| 611 |
+
# This requirement does not apply for use internally to Requests.
|
| 612 |
+
self.raw = None
|
| 613 |
+
|
| 614 |
+
#: Final URL location of Response.
|
| 615 |
+
self.url = None
|
| 616 |
+
|
| 617 |
+
#: Encoding to decode with when accessing r.text.
|
| 618 |
+
self.encoding = None
|
| 619 |
+
|
| 620 |
+
#: A list of :class:`Response <Response>` objects from
|
| 621 |
+
#: the history of the Request. Any redirect responses will end
|
| 622 |
+
#: up here. The list is sorted from the oldest to the most recent request.
|
| 623 |
+
self.history = []
|
| 624 |
+
|
| 625 |
+
#: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK".
|
| 626 |
+
self.reason = None
|
| 627 |
+
|
| 628 |
+
#: A CookieJar of Cookies the server sent back.
|
| 629 |
+
self.cookies = cookiejar_from_dict({})
|
| 630 |
+
|
| 631 |
+
#: The amount of time elapsed between sending the request
|
| 632 |
+
#: and the arrival of the response (as a timedelta).
|
| 633 |
+
#: This property specifically measures the time taken between sending
|
| 634 |
+
#: the first byte of the request and finishing parsing the headers. It
|
| 635 |
+
#: is therefore unaffected by consuming the response content or the
|
| 636 |
+
#: value of the ``stream`` keyword argument.
|
| 637 |
+
self.elapsed = datetime.timedelta(0)
|
| 638 |
+
|
| 639 |
+
#: The :class:`PreparedRequest <PreparedRequest>` object to which this
|
| 640 |
+
#: is a response.
|
| 641 |
+
self.request = None
|
| 642 |
+
|
| 643 |
+
def __enter__(self):
|
| 644 |
+
return self
|
| 645 |
+
|
| 646 |
+
def __exit__(self, *args):
|
| 647 |
+
self.close()
|
| 648 |
+
|
| 649 |
+
def __getstate__(self):
|
| 650 |
+
# Consume everything; accessing the content attribute makes
|
| 651 |
+
# sure the content has been fully read.
|
| 652 |
+
if not self._content_consumed:
|
| 653 |
+
self.content
|
| 654 |
+
|
| 655 |
+
return {attr: getattr(self, attr, None) for attr in self.__attrs__}
|
| 656 |
+
|
| 657 |
+
def __setstate__(self, state):
|
| 658 |
+
for name, value in state.items():
|
| 659 |
+
setattr(self, name, value)
|
| 660 |
+
|
| 661 |
+
# pickled objects do not have .raw
|
| 662 |
+
setattr(self, '_content_consumed', True)
|
| 663 |
+
setattr(self, 'raw', None)
|
| 664 |
+
|
| 665 |
+
def __repr__(self):
|
| 666 |
+
return '<Response [%s]>' % (self.status_code)
|
| 667 |
+
|
| 668 |
+
def __bool__(self):
|
| 669 |
+
"""Returns True if :attr:`status_code` is less than 400.
|
| 670 |
+
|
| 671 |
+
This attribute checks if the status code of the response is between
|
| 672 |
+
400 and 600 to see if there was a client error or a server error. If
|
| 673 |
+
the status code, is between 200 and 400, this will return True. This
|
| 674 |
+
is **not** a check to see if the response code is ``200 OK``.
|
| 675 |
+
"""
|
| 676 |
+
return self.ok
|
| 677 |
+
|
| 678 |
+
def __nonzero__(self):
|
| 679 |
+
"""Returns True if :attr:`status_code` is less than 400.
|
| 680 |
+
|
| 681 |
+
This attribute checks if the status code of the response is between
|
| 682 |
+
400 and 600 to see if there was a client error or a server error. If
|
| 683 |
+
the status code, is between 200 and 400, this will return True. This
|
| 684 |
+
is **not** a check to see if the response code is ``200 OK``.
|
| 685 |
+
"""
|
| 686 |
+
return self.ok
|
| 687 |
+
|
| 688 |
+
def __iter__(self):
|
| 689 |
+
"""Allows you to use a response as an iterator."""
|
| 690 |
+
return self.iter_content(128)
|
| 691 |
+
|
| 692 |
+
@property
|
| 693 |
+
def ok(self):
|
| 694 |
+
"""Returns True if :attr:`status_code` is less than 400, False if not.
|
| 695 |
+
|
| 696 |
+
This attribute checks if the status code of the response is between
|
| 697 |
+
400 and 600 to see if there was a client error or a server error. If
|
| 698 |
+
the status code is between 200 and 400, this will return True. This
|
| 699 |
+
is **not** a check to see if the response code is ``200 OK``.
|
| 700 |
+
"""
|
| 701 |
+
try:
|
| 702 |
+
self.raise_for_status()
|
| 703 |
+
except HTTPError:
|
| 704 |
+
return False
|
| 705 |
+
return True
|
| 706 |
+
|
| 707 |
+
@property
|
| 708 |
+
def is_redirect(self):
|
| 709 |
+
"""True if this Response is a well-formed HTTP redirect that could have
|
| 710 |
+
been processed automatically (by :meth:`Session.resolve_redirects`).
|
| 711 |
+
"""
|
| 712 |
+
return ('location' in self.headers and self.status_code in REDIRECT_STATI)
|
| 713 |
+
|
| 714 |
+
@property
|
| 715 |
+
def is_permanent_redirect(self):
|
| 716 |
+
"""True if this Response one of the permanent versions of redirect."""
|
| 717 |
+
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
|
| 718 |
+
|
| 719 |
+
@property
|
| 720 |
+
def next(self):
|
| 721 |
+
"""Returns a PreparedRequest for the next request in a redirect chain, if there is one."""
|
| 722 |
+
return self._next
|
| 723 |
+
|
| 724 |
+
@property
|
| 725 |
+
def apparent_encoding(self):
|
| 726 |
+
"""The apparent encoding, provided by the chardet library."""
|
| 727 |
+
return chardet.detect(self.content)['encoding']
|
| 728 |
+
|
| 729 |
+
def iter_content(self, chunk_size=1, decode_unicode=False):
|
| 730 |
+
"""Iterates over the response data. When stream=True is set on the
|
| 731 |
+
request, this avoids reading the content at once into memory for
|
| 732 |
+
large responses. The chunk size is the number of bytes it should
|
| 733 |
+
read into memory. This is not necessarily the length of each item
|
| 734 |
+
returned as decoding can take place.
|
| 735 |
+
|
| 736 |
+
chunk_size must be of type int or None. A value of None will
|
| 737 |
+
function differently depending on the value of `stream`.
|
| 738 |
+
stream=True will read data as it arrives in whatever size the
|
| 739 |
+
chunks are received. If stream=False, data is returned as
|
| 740 |
+
a single chunk.
|
| 741 |
+
|
| 742 |
+
If decode_unicode is True, content will be decoded using the best
|
| 743 |
+
available encoding based on the response.
|
| 744 |
+
"""
|
| 745 |
+
|
| 746 |
+
def generate():
|
| 747 |
+
# Special case for urllib3.
|
| 748 |
+
if hasattr(self.raw, 'stream'):
|
| 749 |
+
try:
|
| 750 |
+
for chunk in self.raw.stream(chunk_size, decode_content=True):
|
| 751 |
+
yield chunk
|
| 752 |
+
except ProtocolError as e:
|
| 753 |
+
raise ChunkedEncodingError(e)
|
| 754 |
+
except DecodeError as e:
|
| 755 |
+
raise ContentDecodingError(e)
|
| 756 |
+
except ReadTimeoutError as e:
|
| 757 |
+
raise ConnectionError(e)
|
| 758 |
+
else:
|
| 759 |
+
# Standard file-like object.
|
| 760 |
+
while True:
|
| 761 |
+
chunk = self.raw.read(chunk_size)
|
| 762 |
+
if not chunk:
|
| 763 |
+
break
|
| 764 |
+
yield chunk
|
| 765 |
+
|
| 766 |
+
self._content_consumed = True
|
| 767 |
+
|
| 768 |
+
if self._content_consumed and isinstance(self._content, bool):
|
| 769 |
+
raise StreamConsumedError()
|
| 770 |
+
elif chunk_size is not None and not isinstance(chunk_size, int):
|
| 771 |
+
raise TypeError("chunk_size must be an int, it is instead a %s." % type(chunk_size))
|
| 772 |
+
# simulate reading small chunks of the content
|
| 773 |
+
reused_chunks = iter_slices(self._content, chunk_size)
|
| 774 |
+
|
| 775 |
+
stream_chunks = generate()
|
| 776 |
+
|
| 777 |
+
chunks = reused_chunks if self._content_consumed else stream_chunks
|
| 778 |
+
|
| 779 |
+
if decode_unicode:
|
| 780 |
+
chunks = stream_decode_response_unicode(chunks, self)
|
| 781 |
+
|
| 782 |
+
return chunks
|
| 783 |
+
|
| 784 |
+
def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None):
|
| 785 |
+
"""Iterates over the response data, one line at a time. When
|
| 786 |
+
stream=True is set on the request, this avoids reading the
|
| 787 |
+
content at once into memory for large responses.
|
| 788 |
+
|
| 789 |
+
.. note:: This method is not reentrant safe.
|
| 790 |
+
"""
|
| 791 |
+
|
| 792 |
+
pending = None
|
| 793 |
+
|
| 794 |
+
for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
|
| 795 |
+
|
| 796 |
+
if pending is not None:
|
| 797 |
+
chunk = pending + chunk
|
| 798 |
+
|
| 799 |
+
if delimiter:
|
| 800 |
+
lines = chunk.split(delimiter)
|
| 801 |
+
else:
|
| 802 |
+
lines = chunk.splitlines()
|
| 803 |
+
|
| 804 |
+
if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]:
|
| 805 |
+
pending = lines.pop()
|
| 806 |
+
else:
|
| 807 |
+
pending = None
|
| 808 |
+
|
| 809 |
+
for line in lines:
|
| 810 |
+
yield line
|
| 811 |
+
|
| 812 |
+
if pending is not None:
|
| 813 |
+
yield pending
|
| 814 |
+
|
| 815 |
+
@property
|
| 816 |
+
def content(self):
|
| 817 |
+
"""Content of the response, in bytes."""
|
| 818 |
+
|
| 819 |
+
if self._content is False:
|
| 820 |
+
# Read the contents.
|
| 821 |
+
if self._content_consumed:
|
| 822 |
+
raise RuntimeError(
|
| 823 |
+
'The content for this response was already consumed')
|
| 824 |
+
|
| 825 |
+
if self.status_code == 0 or self.raw is None:
|
| 826 |
+
self._content = None
|
| 827 |
+
else:
|
| 828 |
+
self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
|
| 829 |
+
|
| 830 |
+
self._content_consumed = True
|
| 831 |
+
# don't need to release the connection; that's been handled by urllib3
|
| 832 |
+
# since we exhausted the data.
|
| 833 |
+
return self._content
|
| 834 |
+
|
| 835 |
+
@property
|
| 836 |
+
def text(self):
|
| 837 |
+
"""Content of the response, in unicode.
|
| 838 |
+
|
| 839 |
+
If Response.encoding is None, encoding will be guessed using
|
| 840 |
+
``chardet``.
|
| 841 |
+
|
| 842 |
+
The encoding of the response content is determined based solely on HTTP
|
| 843 |
+
headers, following RFC 2616 to the letter. If you can take advantage of
|
| 844 |
+
non-HTTP knowledge to make a better guess at the encoding, you should
|
| 845 |
+
set ``r.encoding`` appropriately before accessing this property.
|
| 846 |
+
"""
|
| 847 |
+
|
| 848 |
+
# Try charset from content-type
|
| 849 |
+
content = None
|
| 850 |
+
encoding = self.encoding
|
| 851 |
+
|
| 852 |
+
if not self.content:
|
| 853 |
+
return str('')
|
| 854 |
+
|
| 855 |
+
# Fallback to auto-detected encoding.
|
| 856 |
+
if self.encoding is None:
|
| 857 |
+
encoding = self.apparent_encoding
|
| 858 |
+
|
| 859 |
+
# Decode unicode from given encoding.
|
| 860 |
+
try:
|
| 861 |
+
content = str(self.content, encoding, errors='replace')
|
| 862 |
+
except (LookupError, TypeError):
|
| 863 |
+
# A LookupError is raised if the encoding was not found which could
|
| 864 |
+
# indicate a misspelling or similar mistake.
|
| 865 |
+
#
|
| 866 |
+
# A TypeError can be raised if encoding is None
|
| 867 |
+
#
|
| 868 |
+
# So we try blindly encoding.
|
| 869 |
+
content = str(self.content, errors='replace')
|
| 870 |
+
|
| 871 |
+
return content
|
| 872 |
+
|
| 873 |
+
def json(self, **kwargs):
|
| 874 |
+
r"""Returns the json-encoded content of a response, if any.
|
| 875 |
+
|
| 876 |
+
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
|
| 877 |
+
:raises ValueError: If the response body does not contain valid json.
|
| 878 |
+
"""
|
| 879 |
+
|
| 880 |
+
if not self.encoding and self.content and len(self.content) > 3:
|
| 881 |
+
# No encoding set. JSON RFC 4627 section 3 states we should expect
|
| 882 |
+
# UTF-8, -16 or -32. Detect which one to use; If the detection or
|
| 883 |
+
# decoding fails, fall back to `self.text` (using chardet to make
|
| 884 |
+
# a best guess).
|
| 885 |
+
encoding = guess_json_utf(self.content)
|
| 886 |
+
if encoding is not None:
|
| 887 |
+
try:
|
| 888 |
+
return complexjson.loads(
|
| 889 |
+
self.content.decode(encoding), **kwargs
|
| 890 |
+
)
|
| 891 |
+
except UnicodeDecodeError:
|
| 892 |
+
# Wrong UTF codec detected; usually because it's not UTF-8
|
| 893 |
+
# but some other 8-bit codec. This is an RFC violation,
|
| 894 |
+
# and the server didn't bother to tell us what codec *was*
|
| 895 |
+
# used.
|
| 896 |
+
pass
|
| 897 |
+
return complexjson.loads(self.text, **kwargs)
|
| 898 |
+
|
| 899 |
+
@property
|
| 900 |
+
def links(self):
|
| 901 |
+
"""Returns the parsed header links of the response, if any."""
|
| 902 |
+
|
| 903 |
+
header = self.headers.get('link')
|
| 904 |
+
|
| 905 |
+
# l = MultiDict()
|
| 906 |
+
l = {}
|
| 907 |
+
|
| 908 |
+
if header:
|
| 909 |
+
links = parse_header_links(header)
|
| 910 |
+
|
| 911 |
+
for link in links:
|
| 912 |
+
key = link.get('rel') or link.get('url')
|
| 913 |
+
l[key] = link
|
| 914 |
+
|
| 915 |
+
return l
|
| 916 |
+
|
| 917 |
+
def raise_for_status(self):
|
| 918 |
+
"""Raises stored :class:`HTTPError`, if one occurred."""
|
| 919 |
+
|
| 920 |
+
http_error_msg = ''
|
| 921 |
+
if isinstance(self.reason, bytes):
|
| 922 |
+
# We attempt to decode utf-8 first because some servers
|
| 923 |
+
# choose to localize their reason strings. If the string
|
| 924 |
+
# isn't utf-8, we fall back to iso-8859-1 for all other
|
| 925 |
+
# encodings. (See PR #3538)
|
| 926 |
+
try:
|
| 927 |
+
reason = self.reason.decode('utf-8')
|
| 928 |
+
except UnicodeDecodeError:
|
| 929 |
+
reason = self.reason.decode('iso-8859-1')
|
| 930 |
+
else:
|
| 931 |
+
reason = self.reason
|
| 932 |
+
|
| 933 |
+
if 400 <= self.status_code < 500:
|
| 934 |
+
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
|
| 935 |
+
|
| 936 |
+
elif 500 <= self.status_code < 600:
|
| 937 |
+
http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
|
| 938 |
+
|
| 939 |
+
if http_error_msg:
|
| 940 |
+
raise HTTPError(http_error_msg, response=self)
|
| 941 |
+
|
| 942 |
+
def close(self):
|
| 943 |
+
"""Releases the connection back to the pool. Once this method has been
|
| 944 |
+
called the underlying ``raw`` object must not be accessed again.
|
| 945 |
+
|
| 946 |
+
*Note: Should not normally need to be called explicitly.*
|
| 947 |
+
"""
|
| 948 |
+
if not self._content_consumed:
|
| 949 |
+
self.raw.close()
|
| 950 |
+
|
| 951 |
+
release_conn = getattr(self.raw, 'release_conn', None)
|
| 952 |
+
if release_conn is not None:
|
| 953 |
+
release_conn()
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/cli-32.exe
ADDED
|
Binary file (65.5 kB). View file
|
|
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/cli-64.exe
ADDED
|
Binary file (74.8 kB). View file
|
|
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/script (dev).tmpl
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r
|
| 2 |
+
__requires__ = %(spec)r
|
| 3 |
+
__import__('pkg_resources').require(%(spec)r)
|
| 4 |
+
__file__ = %(dev_path)r
|
| 5 |
+
with open(__file__) as f:
|
| 6 |
+
exec(compile(f.read(), __file__, 'exec'))
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/script.tmpl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r
|
| 2 |
+
__requires__ = %(spec)r
|
| 3 |
+
__import__('pkg_resources').run_script(%(spec)r, %(script_name)r)
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/site-patch.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def __boot():
|
| 2 |
+
import sys
|
| 3 |
+
import os
|
| 4 |
+
PYTHONPATH = os.environ.get('PYTHONPATH')
|
| 5 |
+
if PYTHONPATH is None or (sys.platform == 'win32' and not PYTHONPATH):
|
| 6 |
+
PYTHONPATH = []
|
| 7 |
+
else:
|
| 8 |
+
PYTHONPATH = PYTHONPATH.split(os.pathsep)
|
| 9 |
+
|
| 10 |
+
pic = getattr(sys, 'path_importer_cache', {})
|
| 11 |
+
stdpath = sys.path[len(PYTHONPATH):]
|
| 12 |
+
mydir = os.path.dirname(__file__)
|
| 13 |
+
|
| 14 |
+
for item in stdpath:
|
| 15 |
+
if item == mydir or not item:
|
| 16 |
+
continue # skip if current dir. on Windows, or my own directory
|
| 17 |
+
importer = pic.get(item)
|
| 18 |
+
if importer is not None:
|
| 19 |
+
loader = importer.find_module('site')
|
| 20 |
+
if loader is not None:
|
| 21 |
+
# This should actually reload the current module
|
| 22 |
+
loader.load_module('site')
|
| 23 |
+
break
|
| 24 |
+
else:
|
| 25 |
+
try:
|
| 26 |
+
import imp # Avoid import loop in Python 3
|
| 27 |
+
stream, path, descr = imp.find_module('site', [item])
|
| 28 |
+
except ImportError:
|
| 29 |
+
continue
|
| 30 |
+
if stream is None:
|
| 31 |
+
continue
|
| 32 |
+
try:
|
| 33 |
+
# This should actually reload the current module
|
| 34 |
+
imp.load_module('site', stream, path, descr)
|
| 35 |
+
finally:
|
| 36 |
+
stream.close()
|
| 37 |
+
break
|
| 38 |
+
else:
|
| 39 |
+
raise ImportError("Couldn't find the real 'site' module")
|
| 40 |
+
|
| 41 |
+
known_paths = dict([(makepath(item)[1], 1) for item in sys.path]) # 2.2 comp
|
| 42 |
+
|
| 43 |
+
oldpos = getattr(sys, '__egginsert', 0) # save old insertion position
|
| 44 |
+
sys.__egginsert = 0 # and reset the current one
|
| 45 |
+
|
| 46 |
+
for item in PYTHONPATH:
|
| 47 |
+
addsitedir(item)
|
| 48 |
+
|
| 49 |
+
sys.__egginsert += oldpos # restore effective old position
|
| 50 |
+
|
| 51 |
+
d, nd = makepath(stdpath[0])
|
| 52 |
+
insert_at = None
|
| 53 |
+
new_path = []
|
| 54 |
+
|
| 55 |
+
for item in sys.path:
|
| 56 |
+
p, np = makepath(item)
|
| 57 |
+
|
| 58 |
+
if np == nd and insert_at is None:
|
| 59 |
+
# We've hit the first 'system' path entry, so added entries go here
|
| 60 |
+
insert_at = len(new_path)
|
| 61 |
+
|
| 62 |
+
if np in known_paths or insert_at is None:
|
| 63 |
+
new_path.append(item)
|
| 64 |
+
else:
|
| 65 |
+
# new path after the insert point, back-insert it
|
| 66 |
+
new_path.insert(insert_at, item)
|
| 67 |
+
insert_at += 1
|
| 68 |
+
|
| 69 |
+
sys.path[:] = new_path
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
if __name__ == 'site':
|
| 73 |
+
__boot()
|
| 74 |
+
del __boot
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/ssl_support.py
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 9 |
+
from pkg_resources import ResolutionError, ExtractionError
|
| 10 |
+
|
| 11 |
+
try:
|
| 12 |
+
import ssl
|
| 13 |
+
except ImportError:
|
| 14 |
+
ssl = None
|
| 15 |
+
|
| 16 |
+
__all__ = [
|
| 17 |
+
'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_available', 'cert_paths',
|
| 18 |
+
'opener_for'
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
cert_paths = """
|
| 22 |
+
/etc/pki/tls/certs/ca-bundle.crt
|
| 23 |
+
/etc/ssl/certs/ca-certificates.crt
|
| 24 |
+
/usr/share/ssl/certs/ca-bundle.crt
|
| 25 |
+
/usr/local/share/certs/ca-root.crt
|
| 26 |
+
/etc/ssl/cert.pem
|
| 27 |
+
/System/Library/OpenSSL/certs/cert.pem
|
| 28 |
+
/usr/local/share/certs/ca-root-nss.crt
|
| 29 |
+
/etc/ssl/ca-bundle.pem
|
| 30 |
+
""".strip().split()
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
HTTPSHandler = urllib.request.HTTPSHandler
|
| 34 |
+
HTTPSConnection = http_client.HTTPSConnection
|
| 35 |
+
except AttributeError:
|
| 36 |
+
HTTPSHandler = HTTPSConnection = object
|
| 37 |
+
|
| 38 |
+
is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
try:
|
| 42 |
+
from ssl import CertificateError, match_hostname
|
| 43 |
+
except ImportError:
|
| 44 |
+
try:
|
| 45 |
+
from backports.ssl_match_hostname import CertificateError
|
| 46 |
+
from backports.ssl_match_hostname import match_hostname
|
| 47 |
+
except ImportError:
|
| 48 |
+
CertificateError = None
|
| 49 |
+
match_hostname = None
|
| 50 |
+
|
| 51 |
+
if not CertificateError:
|
| 52 |
+
|
| 53 |
+
class CertificateError(ValueError):
|
| 54 |
+
pass
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
if not match_hostname:
|
| 58 |
+
|
| 59 |
+
def _dnsname_match(dn, hostname, max_wildcards=1):
|
| 60 |
+
"""Matching according to RFC 6125, section 6.4.3
|
| 61 |
+
|
| 62 |
+
https://tools.ietf.org/html/rfc6125#section-6.4.3
|
| 63 |
+
"""
|
| 64 |
+
pats = []
|
| 65 |
+
if not dn:
|
| 66 |
+
return False
|
| 67 |
+
|
| 68 |
+
# Ported from python3-syntax:
|
| 69 |
+
# leftmost, *remainder = dn.split(r'.')
|
| 70 |
+
parts = dn.split(r'.')
|
| 71 |
+
leftmost = parts[0]
|
| 72 |
+
remainder = parts[1:]
|
| 73 |
+
|
| 74 |
+
wildcards = leftmost.count('*')
|
| 75 |
+
if wildcards > max_wildcards:
|
| 76 |
+
# Issue #17980: avoid denials of service by refusing more
|
| 77 |
+
# than one wildcard per fragment. A survey of established
|
| 78 |
+
# policy among SSL implementations showed it to be a
|
| 79 |
+
# reasonable choice.
|
| 80 |
+
raise CertificateError(
|
| 81 |
+
"too many wildcards in certificate DNS name: " + repr(dn))
|
| 82 |
+
|
| 83 |
+
# speed up common case w/o wildcards
|
| 84 |
+
if not wildcards:
|
| 85 |
+
return dn.lower() == hostname.lower()
|
| 86 |
+
|
| 87 |
+
# RFC 6125, section 6.4.3, subitem 1.
|
| 88 |
+
# The client SHOULD NOT attempt to match a presented identifier in which
|
| 89 |
+
# the wildcard character comprises a label other than the left-most label.
|
| 90 |
+
if leftmost == '*':
|
| 91 |
+
# When '*' is a fragment by itself, it matches a non-empty dotless
|
| 92 |
+
# fragment.
|
| 93 |
+
pats.append('[^.]+')
|
| 94 |
+
elif leftmost.startswith('xn--') or hostname.startswith('xn--'):
|
| 95 |
+
# RFC 6125, section 6.4.3, subitem 3.
|
| 96 |
+
# The client SHOULD NOT attempt to match a presented identifier
|
| 97 |
+
# where the wildcard character is embedded within an A-label or
|
| 98 |
+
# U-label of an internationalized domain name.
|
| 99 |
+
pats.append(re.escape(leftmost))
|
| 100 |
+
else:
|
| 101 |
+
# Otherwise, '*' matches any dotless string, e.g. www*
|
| 102 |
+
pats.append(re.escape(leftmost).replace(r'\*', '[^.]*'))
|
| 103 |
+
|
| 104 |
+
# add the remaining fragments, ignore any wildcards
|
| 105 |
+
for frag in remainder:
|
| 106 |
+
pats.append(re.escape(frag))
|
| 107 |
+
|
| 108 |
+
pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE)
|
| 109 |
+
return pat.match(hostname)
|
| 110 |
+
|
| 111 |
+
def match_hostname(cert, hostname):
|
| 112 |
+
"""Verify that *cert* (in decoded format as returned by
|
| 113 |
+
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
|
| 114 |
+
rules are followed, but IP addresses are not accepted for *hostname*.
|
| 115 |
+
|
| 116 |
+
CertificateError is raised on failure. On success, the function
|
| 117 |
+
returns nothing.
|
| 118 |
+
"""
|
| 119 |
+
if not cert:
|
| 120 |
+
raise ValueError("empty or no certificate")
|
| 121 |
+
dnsnames = []
|
| 122 |
+
san = cert.get('subjectAltName', ())
|
| 123 |
+
for key, value in san:
|
| 124 |
+
if key == 'DNS':
|
| 125 |
+
if _dnsname_match(value, hostname):
|
| 126 |
+
return
|
| 127 |
+
dnsnames.append(value)
|
| 128 |
+
if not dnsnames:
|
| 129 |
+
# The subject is only checked when there is no dNSName entry
|
| 130 |
+
# in subjectAltName
|
| 131 |
+
for sub in cert.get('subject', ()):
|
| 132 |
+
for key, value in sub:
|
| 133 |
+
# XXX according to RFC 2818, the most specific Common Name
|
| 134 |
+
# must be used.
|
| 135 |
+
if key == 'commonName':
|
| 136 |
+
if _dnsname_match(value, hostname):
|
| 137 |
+
return
|
| 138 |
+
dnsnames.append(value)
|
| 139 |
+
if len(dnsnames) > 1:
|
| 140 |
+
raise CertificateError("hostname %r "
|
| 141 |
+
"doesn't match either of %s"
|
| 142 |
+
% (hostname, ', '.join(map(repr, dnsnames))))
|
| 143 |
+
elif len(dnsnames) == 1:
|
| 144 |
+
raise CertificateError("hostname %r "
|
| 145 |
+
"doesn't match %r"
|
| 146 |
+
% (hostname, dnsnames[0]))
|
| 147 |
+
else:
|
| 148 |
+
raise CertificateError("no appropriate commonName or "
|
| 149 |
+
"subjectAltName fields were found")
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class VerifyingHTTPSHandler(HTTPSHandler):
|
| 153 |
+
"""Simple verifying handler: no auth, subclasses, timeouts, etc."""
|
| 154 |
+
|
| 155 |
+
def __init__(self, ca_bundle):
|
| 156 |
+
self.ca_bundle = ca_bundle
|
| 157 |
+
HTTPSHandler.__init__(self)
|
| 158 |
+
|
| 159 |
+
def https_open(self, req):
|
| 160 |
+
return self.do_open(
|
| 161 |
+
lambda host, **kw: VerifyingHTTPSConn(host, self.ca_bundle, **kw), req
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class VerifyingHTTPSConn(HTTPSConnection):
|
| 166 |
+
"""Simple verifying connection: no auth, subclasses, timeouts, etc."""
|
| 167 |
+
|
| 168 |
+
def __init__(self, host, ca_bundle, **kw):
|
| 169 |
+
HTTPSConnection.__init__(self, host, **kw)
|
| 170 |
+
self.ca_bundle = ca_bundle
|
| 171 |
+
|
| 172 |
+
def connect(self):
|
| 173 |
+
sock = socket.create_connection(
|
| 174 |
+
(self.host, self.port), getattr(self, 'source_address', None)
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
# Handle the socket if a (proxy) tunnel is present
|
| 178 |
+
if hasattr(self, '_tunnel') and getattr(self, '_tunnel_host', None):
|
| 179 |
+
self.sock = sock
|
| 180 |
+
self._tunnel()
|
| 181 |
+
# http://bugs.python.org/issue7776: Python>=3.4.1 and >=2.7.7
|
| 182 |
+
# change self.host to mean the proxy server host when tunneling is
|
| 183 |
+
# being used. Adapt, since we are interested in the destination
|
| 184 |
+
# host for the match_hostname() comparison.
|
| 185 |
+
actual_host = self._tunnel_host
|
| 186 |
+
else:
|
| 187 |
+
actual_host = self.host
|
| 188 |
+
|
| 189 |
+
if hasattr(ssl, 'create_default_context'):
|
| 190 |
+
ctx = ssl.create_default_context(cafile=self.ca_bundle)
|
| 191 |
+
self.sock = ctx.wrap_socket(sock, server_hostname=actual_host)
|
| 192 |
+
else:
|
| 193 |
+
# This is for python < 2.7.9 and < 3.4?
|
| 194 |
+
self.sock = ssl.wrap_socket(
|
| 195 |
+
sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=self.ca_bundle
|
| 196 |
+
)
|
| 197 |
+
try:
|
| 198 |
+
match_hostname(self.sock.getpeercert(), actual_host)
|
| 199 |
+
except CertificateError:
|
| 200 |
+
self.sock.shutdown(socket.SHUT_RDWR)
|
| 201 |
+
self.sock.close()
|
| 202 |
+
raise
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def opener_for(ca_bundle=None):
|
| 206 |
+
"""Get a urlopen() replacement that uses ca_bundle for verification"""
|
| 207 |
+
return urllib.request.build_opener(
|
| 208 |
+
VerifyingHTTPSHandler(ca_bundle or find_ca_bundle())
|
| 209 |
+
).open
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
# from jaraco.functools
|
| 213 |
+
def once(func):
|
| 214 |
+
@functools.wraps(func)
|
| 215 |
+
def wrapper(*args, **kwargs):
|
| 216 |
+
if not hasattr(func, 'always_returns'):
|
| 217 |
+
func.always_returns = func(*args, **kwargs)
|
| 218 |
+
return func.always_returns
|
| 219 |
+
return wrapper
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
@once
|
| 223 |
+
def get_win_certfile():
|
| 224 |
+
try:
|
| 225 |
+
import wincertstore
|
| 226 |
+
except ImportError:
|
| 227 |
+
return None
|
| 228 |
+
|
| 229 |
+
class CertFile(wincertstore.CertFile):
|
| 230 |
+
def __init__(self):
|
| 231 |
+
super(CertFile, self).__init__()
|
| 232 |
+
atexit.register(self.close)
|
| 233 |
+
|
| 234 |
+
def close(self):
|
| 235 |
+
try:
|
| 236 |
+
super(CertFile, self).close()
|
| 237 |
+
except OSError:
|
| 238 |
+
pass
|
| 239 |
+
|
| 240 |
+
_wincerts = CertFile()
|
| 241 |
+
_wincerts.addstore('CA')
|
| 242 |
+
_wincerts.addstore('ROOT')
|
| 243 |
+
return _wincerts.name
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
def find_ca_bundle():
|
| 247 |
+
"""Return an existing CA bundle path, or None"""
|
| 248 |
+
extant_cert_paths = filter(os.path.isfile, cert_paths)
|
| 249 |
+
return (
|
| 250 |
+
get_win_certfile()
|
| 251 |
+
or next(extant_cert_paths, None)
|
| 252 |
+
or _certifi_where()
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
def _certifi_where():
|
| 257 |
+
try:
|
| 258 |
+
return __import__('certifi').where()
|
| 259 |
+
except (ImportError, ResolutionError, ExtractionError):
|
| 260 |
+
pass
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/unicode_utils.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import unicodedata
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from setuptools.extern import six
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# HFS Plus uses decomposed UTF-8
|
| 8 |
+
def decompose(path):
|
| 9 |
+
if isinstance(path, six.text_type):
|
| 10 |
+
return unicodedata.normalize('NFD', path)
|
| 11 |
+
try:
|
| 12 |
+
path = path.decode('utf-8')
|
| 13 |
+
path = unicodedata.normalize('NFD', path)
|
| 14 |
+
path = path.encode('utf-8')
|
| 15 |
+
except UnicodeError:
|
| 16 |
+
pass # Not UTF-8
|
| 17 |
+
return path
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def filesys_decode(path):
|
| 21 |
+
"""
|
| 22 |
+
Ensure that the given path is decoded,
|
| 23 |
+
NONE when no expected encoding works
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
if isinstance(path, six.text_type):
|
| 27 |
+
return path
|
| 28 |
+
|
| 29 |
+
fs_enc = sys.getfilesystemencoding() or 'utf-8'
|
| 30 |
+
candidates = fs_enc, 'utf-8'
|
| 31 |
+
|
| 32 |
+
for enc in candidates:
|
| 33 |
+
try:
|
| 34 |
+
return path.decode(enc)
|
| 35 |
+
except UnicodeDecodeError:
|
| 36 |
+
continue
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def try_encode(string, enc):
|
| 40 |
+
"turn unicode encoding into a functional routine"
|
| 41 |
+
try:
|
| 42 |
+
return string.encode(enc)
|
| 43 |
+
except UnicodeEncodeError:
|
| 44 |
+
return None
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/setuptools/version.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pkg_resources
|
| 2 |
+
|
| 3 |
+
try:
|
| 4 |
+
__version__ = pkg_resources.get_distribution('setuptools').version
|
| 5 |
+
except Exception:
|
| 6 |
+
__version__ = 'unknown'
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/urllib3-1.25.3.dist-info/RECORD
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
urllib3-1.25.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
urllib3-1.25.3.dist-info/LICENSE.txt,sha256=fA0TbuBYU4mt8tJWcbuZaHofdZKfRlt_Fu4_Ado3JV4,1115
|
| 3 |
+
urllib3-1.25.3.dist-info/METADATA,sha256=-vMFvKG4xU5dyqUjifQsJska14qY3WzU696KyN-R-PQ,38346
|
| 4 |
+
urllib3-1.25.3.dist-info/RECORD,,
|
| 5 |
+
urllib3-1.25.3.dist-info/WHEEL,sha256=HX-v9-noUkyUoxyZ1PMSuS7auUxDAR4VBdoYLqD0xws,110
|
| 6 |
+
urllib3-1.25.3.dist-info/top_level.txt,sha256=EMiXL2sKrTcmrMxIHTqdc3ET54pQI2Y072LexFEemvo,8
|
| 7 |
+
urllib3/__init__.py,sha256=dW1kWCz7bYGr-1q7xbDvJ_0_GwfyJtWq4VaLIzMcviA,2721
|
| 8 |
+
urllib3/__init__.pyc,,
|
| 9 |
+
urllib3/_collections.py,sha256=-CAKsDE-WdubAjlBSZLx7b0e7WKenaNGwWvGLDEF1TM,10746
|
| 10 |
+
urllib3/_collections.pyc,,
|
| 11 |
+
urllib3/connection.py,sha256=hdUK2hwFNWlKxpm7JbY_YxGYJWbe6s0AYUSt9wguHk0,15001
|
| 12 |
+
urllib3/connection.pyc,,
|
| 13 |
+
urllib3/connectionpool.py,sha256=jkmLBXUD8wB0exYjDoEsg_cXVZUv-iDbhC3vAUUH82Q,35307
|
| 14 |
+
urllib3/connectionpool.pyc,,
|
| 15 |
+
urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 16 |
+
urllib3/contrib/__init__.pyc,,
|
| 17 |
+
urllib3/contrib/_appengine_environ.py,sha256=lhYXvB5_oGKSeurX7za3XhcGyERvNjXRQ3eJp2GmQ3M,717
|
| 18 |
+
urllib3/contrib/_appengine_environ.pyc,,
|
| 19 |
+
urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 20 |
+
urllib3/contrib/_securetransport/__init__.pyc,,
|
| 21 |
+
urllib3/contrib/_securetransport/bindings.py,sha256=6ZRejHBpquHtJaXPDm0cBsEwOBe2l9bTnDvVzd0HwJw,17576
|
| 22 |
+
urllib3/contrib/_securetransport/bindings.pyc,,
|
| 23 |
+
urllib3/contrib/_securetransport/low_level.py,sha256=Umy5u-3Z957GirdapnicXVOpHaM4xdOZABJuJxfaeJA,12162
|
| 24 |
+
urllib3/contrib/_securetransport/low_level.pyc,,
|
| 25 |
+
urllib3/contrib/appengine.py,sha256=lB2Fame05OAlaSJs1a86QYF84v7Oymbqjs0OIcexq_s,10914
|
| 26 |
+
urllib3/contrib/appengine.pyc,,
|
| 27 |
+
urllib3/contrib/ntlmpool.py,sha256=5ZpMF7N9B6NEjVU-r-xjDOV_-hkNvsDoNc84J2yqauI,4459
|
| 28 |
+
urllib3/contrib/ntlmpool.pyc,,
|
| 29 |
+
urllib3/contrib/pyopenssl.py,sha256=p8nTcDp8cFBx-GPcldZqUpTR3_5KlqfTBmF-QLixH1s,16451
|
| 30 |
+
urllib3/contrib/pyopenssl.pyc,,
|
| 31 |
+
urllib3/contrib/securetransport.py,sha256=IfPZ2wA3x3NXxHjKr--Q7Xz4A37ZSyWHn_1WvGxvTKQ,32826
|
| 32 |
+
urllib3/contrib/securetransport.pyc,,
|
| 33 |
+
urllib3/contrib/socks.py,sha256=ZJ7lEUlErvAgQkd4xo_xvfx-acym2tDtJqyE0It4VRI,7012
|
| 34 |
+
urllib3/contrib/socks.pyc,,
|
| 35 |
+
urllib3/exceptions.py,sha256=rFeIfBNKC8KJ61ux-MtJyJlEC9G9ggkmCeF751JwVR4,6604
|
| 36 |
+
urllib3/exceptions.pyc,,
|
| 37 |
+
urllib3/fields.py,sha256=0EYvHsgnUflhb-UhMMVjAwiRp1InCe-uy1McDD6nhPU,8575
|
| 38 |
+
urllib3/fields.pyc,,
|
| 39 |
+
urllib3/filepost.py,sha256=40CROlpRKVBpFUkD0R6wJf_PpvbcRQRFUu0OOQlFkKM,2436
|
| 40 |
+
urllib3/filepost.pyc,,
|
| 41 |
+
urllib3/packages/__init__.py,sha256=nlChrGzkjCkmhCX9HrF_qHPUgosfsPQkVIJxiiLhk9g,109
|
| 42 |
+
urllib3/packages/__init__.pyc,,
|
| 43 |
+
urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 44 |
+
urllib3/packages/backports/__init__.pyc,,
|
| 45 |
+
urllib3/packages/backports/makefile.py,sha256=so2z9BiNM8kh38Ve5tomQP_mp2_ubEqzdlCpLZKzzCI,1456
|
| 46 |
+
urllib3/packages/backports/makefile.pyc,,
|
| 47 |
+
urllib3/packages/rfc3986/__init__.py,sha256=Y2dGb08ZJuqIrAqfmrGMpNi2zjzKVTxfeZ8iF-Db338,1562
|
| 48 |
+
urllib3/packages/rfc3986/__init__.pyc,,
|
| 49 |
+
urllib3/packages/rfc3986/_mixin.py,sha256=fnxYtuAQwo6RlGZzsawcICxUhLqQ_Tyob_Kamy-92QU,13214
|
| 50 |
+
urllib3/packages/rfc3986/_mixin.pyc,,
|
| 51 |
+
urllib3/packages/rfc3986/abnf_regexp.py,sha256=0cPq-UrpihByHkDsZd_7p6ruqYh2MuqCqIjc67PFHCs,9081
|
| 52 |
+
urllib3/packages/rfc3986/abnf_regexp.pyc,,
|
| 53 |
+
urllib3/packages/rfc3986/api.py,sha256=5wYJ3IvszICEY5cgeLTtLRWCyc9mJhgZ_4QZVtYoSKI,3887
|
| 54 |
+
urllib3/packages/rfc3986/api.pyc,,
|
| 55 |
+
urllib3/packages/rfc3986/builder.py,sha256=BFbuFFZUcAnGJzvtQ0n7ffHqgG-CBf-Xi_6aU68n-OA,9577
|
| 56 |
+
urllib3/packages/rfc3986/builder.pyc,,
|
| 57 |
+
urllib3/packages/rfc3986/compat.py,sha256=jnSGxU4M13w5vuLldgKmXmpxcZBxmUwg8dBzNQEWzYc,1513
|
| 58 |
+
urllib3/packages/rfc3986/compat.pyc,,
|
| 59 |
+
urllib3/packages/rfc3986/exceptions.py,sha256=dadexlPfwsYbcbFdbR1lp5WyuF8PMsSmx2gA3nrger4,3775
|
| 60 |
+
urllib3/packages/rfc3986/exceptions.pyc,,
|
| 61 |
+
urllib3/packages/rfc3986/iri.py,sha256=8WHJ7ujzatPHfbfxv0MXQT-zd9LLBYQIo1zbg4ZI74w,5466
|
| 62 |
+
urllib3/packages/rfc3986/iri.pyc,,
|
| 63 |
+
urllib3/packages/rfc3986/misc.py,sha256=MbL7MgqbTef5VddkaaPKkLpe0hPRNCEx0-kKhJfRyk8,4094
|
| 64 |
+
urllib3/packages/rfc3986/misc.pyc,,
|
| 65 |
+
urllib3/packages/rfc3986/normalizers.py,sha256=L6DOXDi7vZ_BDoXS8IUl9CW21E-siDJluK2mmImljtY,5259
|
| 66 |
+
urllib3/packages/rfc3986/normalizers.pyc,,
|
| 67 |
+
urllib3/packages/rfc3986/parseresult.py,sha256=cdmsiBExo5o2A2jWI-TtGFeXTPenyXQbGf5Nmv7nh6M,14654
|
| 68 |
+
urllib3/packages/rfc3986/parseresult.pyc,,
|
| 69 |
+
urllib3/packages/rfc3986/uri.py,sha256=r_KhSNmvWfoBGRPBf1dnlwWnCwuM-JHFtGa-6DH_jH4,5227
|
| 70 |
+
urllib3/packages/rfc3986/uri.pyc,,
|
| 71 |
+
urllib3/packages/rfc3986/validators.py,sha256=jbJGdqUcoeSD2E_gmuFbrujLsVtEpjhJg7oxpiFeyY4,13854
|
| 72 |
+
urllib3/packages/rfc3986/validators.pyc,,
|
| 73 |
+
urllib3/packages/six.py,sha256=A6hdJZVjI3t_geebZ9BzUvwRrIXo0lfwzQlM2LcKyas,30098
|
| 74 |
+
urllib3/packages/six.pyc,,
|
| 75 |
+
urllib3/packages/ssl_match_hostname/__init__.py,sha256=WBVbxQBojNAxfZwNavkox3BgJiMA9BJmm-_fwd0jD_o,688
|
| 76 |
+
urllib3/packages/ssl_match_hostname/__init__.pyc,,
|
| 77 |
+
urllib3/packages/ssl_match_hostname/_implementation.py,sha256=_foKOc3Los_n21TCW4IpjTTRHppsjw35vnu7dRBv-88,5683
|
| 78 |
+
urllib3/packages/ssl_match_hostname/_implementation.pyc,,
|
| 79 |
+
urllib3/poolmanager.py,sha256=GrUSFRcQbhxPMRlePxOUbXvmsOgGTiNrxQpICmXd30I,17050
|
| 80 |
+
urllib3/poolmanager.pyc,,
|
| 81 |
+
urllib3/request.py,sha256=OfelFYzPnxGlU3amEz9uBLjCBOriwgJh4QC_aW9SF3U,5991
|
| 82 |
+
urllib3/request.pyc,,
|
| 83 |
+
urllib3/response.py,sha256=GxiW6sI0NZgdlDL4hzPfKDZmH7OFTiGZosaXu2DMG7k,27171
|
| 84 |
+
urllib3/response.pyc,,
|
| 85 |
+
urllib3/util/__init__.py,sha256=P-VlwgBFaga7i1BTWPNHGK4TN-SES0VoexbeIPIKs_0,1082
|
| 86 |
+
urllib3/util/__init__.pyc,,
|
| 87 |
+
urllib3/util/connection.py,sha256=-AyqcRTuNUHuo5ndtsU0Og_nMyCGATC-kYqOUdBHwIQ,4639
|
| 88 |
+
urllib3/util/connection.pyc,,
|
| 89 |
+
urllib3/util/queue.py,sha256=myTX3JDHntglKQNBf3b6dasHH-uF-W59vzGSQiFdAfI,497
|
| 90 |
+
urllib3/util/queue.pyc,,
|
| 91 |
+
urllib3/util/request.py,sha256=_pmOHJWpOHk7w8BDz6WZkmMunNmplEPBmh2-5bl3Do4,3832
|
| 92 |
+
urllib3/util/request.pyc,,
|
| 93 |
+
urllib3/util/response.py,sha256=028PNXDZhwBtnm2uXvnAHi_l9_AAGrAMH2Igh2AbgWg,2586
|
| 94 |
+
urllib3/util/response.pyc,,
|
| 95 |
+
urllib3/util/retry.py,sha256=1m-XI9_LORj1FLbwOzgWC6pTt2deycyGl4BWRI9r4Zc,15150
|
| 96 |
+
urllib3/util/retry.pyc,,
|
| 97 |
+
urllib3/util/ssl_.py,sha256=PkKRHaKZkZ4wH9u7edPsG7mkaUSLLHQB52UOKlF_PBg,13786
|
| 98 |
+
urllib3/util/ssl_.pyc,,
|
| 99 |
+
urllib3/util/timeout.py,sha256=dTF-iEp8DZiPd-8g2X7CVucDoBWJBn221T8ghg-tjkQ,9768
|
| 100 |
+
urllib3/util/timeout.pyc,,
|
| 101 |
+
urllib3/util/url.py,sha256=itUnJsty1UZDeahrqH9WkH2ESTj4yHElQyCA8_P6rRM,9810
|
| 102 |
+
urllib3/util/url.pyc,,
|
| 103 |
+
urllib3/util/wait.py,sha256=p4BZo_Ukp5JF0Dn6jro7cUfqIjnU6WFtuoA6poaV5Jk,5403
|
| 104 |
+
urllib3/util/wait.pyc,,
|
benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/urllib3-1.25.3.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.33.1)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py2-none-any
|
| 5 |
+
Tag: py3-none-any
|
| 6 |
+
|