repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringclasses
981 values
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
input_ids
listlengths
1.02k
1.02k
labels
listlengths
1.02k
1.02k
attention_mask
listlengths
1.02k
1.02k
pscedu/slash2-stable
slash2/utils/tsuite2/slash2_tests/citrus_tests/nested_directories.py
1
2102
# %PSCGPL_START_COPYRIGHT% # ----------------------------------------------------------------------------- # Copyright (c) 2009-2013, Pittsburgh Supercomputing Center (PSC). # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License contained in the file # `COPYING-GPL' at the top of this distribution or at # https://www.gnu.org/licenses/gpl-2.0.html for more details. # # Pittsburgh Supercomputing Center phone: 412.268.4960 fax: 412.268.5832 # 300 S. Craig Street e-mail: remarks@psc.edu # Pittsburgh, PA 15213 web: http://www.psc.edu/ # ----------------------------------------------------------------------------- # %PSC_END_COPYRIGHT% import os, shutil from stat import * test_file = "" # sets up files and returns dictionary of results def setup(directory): results = {} global base_directory base_directory = directory + '/a' global full_path full_path = directory + "/a/a/a/a/a/a/a/a" results["pass"] = True try: os.makedirs(full_path) except: results["pass"] = False results["error"] = 'Could not create the directory' return results # implements test logic and returns dictionary of results def operate(max_size=3): results = {} #verify that the directory exists try: results["pass"] = S_ISDIR(os.stat(full_path).st_mode) except: results["pass"] = False results["error"] = "Could not stat the directory" return results # cleans up files and returns dictionary of results def cleanup(): results = {} results["pass"] = True try: shutil.rmtree(base_directory) except: results["pass"] = False results["error"] = 'Could not remove file' return results
isc
[ 3, 450, 5067, 4064, 2749, 63, 7363, 63, 32324, 5716, 5, 199, 3, 13722, 199, 3, 1898, 334, 67, 9, 8937, 13, 6965, 12, 510, 390, 1086, 30735, 3561, 17897, 863, 4655, 24699, 334, 5067, 35, 680, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 199, 3, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 2428, 1821, 3408, 27, 1928, 2755, 314, 199, 3, 2478, 3750, 402, 3169, 503, 3092, 2381, 437, 3115, 199, 3, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 10470, 315, 314, 570, 199, 3, 658, 16188, 1206, 13, 12006, 7, 737, 314, 2746, 402, 642, 4084, 503, 737, 199, 3, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 18, 14, 16, 14, 1360, 367, 1655, 2436, 14, 199, 3, 199, 3, 510, 390, 1086, 30735, 3561, 17897, 863, 4655, 24699, 198, 9339, 26, 841, 713, 14, 13731, 14, 1887, 2259, 221, 289, 1219, 26, 841, 713, 14, 13731, 14, 2010, 708, 199, 3, 9601, 428, 14, 445, 345, 528, 14259, 1057, 198, 69, 13, 1198, 26, 295, 10375, 32, 80, 551, 14, 8654, 199, 3, 510, 390, 1086, 30735, 3561, 12, 510, 33, 413, 2528, 969, 1057, 198, 2520, 26, 1455, 921, 1544, 14, 80, 551, 14, 8654, 15, 199, 3, 13722, 199, 3, 450, 5067, 35, 63, 3902, 63, 32324, 5716, 5, 421, 199, 646, 747, 12, 5145, 199, 504, 5672, 492, 627, 199, 199, 396, 63, 493, 275, 3087, 199, 199, 3, 5951, 1536, 1584, 436, 2529, 2600, 402, 2058, 199, 318, 3272, 8, 3619, 304, 272, 2058, 275, 1052, 339, 2288, 1300, 63, 3619, 272, 1300, 63, 3619, 275, 2082, 435, 1994, 65, 7, 339, 2288, 2615, 63, 515, 272, 2615, 63, 515, 275, 2082, 435, 3286, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 2, 272, 2058, 905, 1529, 937, 275, 715, 339, 862, 26, 267, 747, 14, 8347, 8, 2861, 63, 515, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 283, 6531, 440, 1218, 314, 2082, 7, 339, 372, 2058, 199, 199, 3, 9031, 511, 9661, 436, 2529, 2600, 402, 2058, 199, 318, 19218, 8, 988, 63, 890, 29, 19, 304, 272, 2058, 275, 1052, 339, 327, 4712, 626, 314, 2082, 3495, 272, 862, 26, 267, 2058, 905, 1529, 937, 275, 428, 63, 1311, 3022, 8, 736, 14, 3736, 8, 2861, 63, 515, 680, 270, 63, 632, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 298, 6531, 440, 5672, 314, 2082, 2, 339, 372, 2058, 199, 199, 3, 15158, 796, 1536, 1584, 436, 2529, 2600, 402, 2058, 199, 318, 9058, 837, 272, 2058, 275, 1052, 339, 2058, 905, 1529, 937, 275, 715, 339, 862, 26, 267, 5145, 14, 9242, 8, 1095, 63, 3619, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 283, 6531, 440, 2813, 570, 7, 339, 372, 2058, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 450, 5067, 4064, 2749, 63, 7363, 63, 32324, 5716, 5, 199, 3, 13722, 199, 3, 1898, 334, 67, 9, 8937, 13, 6965, 12, 510, 390, 1086, 30735, 3561, 17897, 863, 4655, 24699, 334, 5067, 35, 680, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 199, 3, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 2428, 1821, 3408, 27, 1928, 2755, 314, 199, 3, 2478, 3750, 402, 3169, 503, 3092, 2381, 437, 3115, 199, 3, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 10470, 315, 314, 570, 199, 3, 658, 16188, 1206, 13, 12006, 7, 737, 314, 2746, 402, 642, 4084, 503, 737, 199, 3, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 18, 14, 16, 14, 1360, 367, 1655, 2436, 14, 199, 3, 199, 3, 510, 390, 1086, 30735, 3561, 17897, 863, 4655, 24699, 198, 9339, 26, 841, 713, 14, 13731, 14, 1887, 2259, 221, 289, 1219, 26, 841, 713, 14, 13731, 14, 2010, 708, 199, 3, 9601, 428, 14, 445, 345, 528, 14259, 1057, 198, 69, 13, 1198, 26, 295, 10375, 32, 80, 551, 14, 8654, 199, 3, 510, 390, 1086, 30735, 3561, 12, 510, 33, 413, 2528, 969, 1057, 198, 2520, 26, 1455, 921, 1544, 14, 80, 551, 14, 8654, 15, 199, 3, 13722, 199, 3, 450, 5067, 35, 63, 3902, 63, 32324, 5716, 5, 421, 199, 646, 747, 12, 5145, 199, 504, 5672, 492, 627, 199, 199, 396, 63, 493, 275, 3087, 199, 199, 3, 5951, 1536, 1584, 436, 2529, 2600, 402, 2058, 199, 318, 3272, 8, 3619, 304, 272, 2058, 275, 1052, 339, 2288, 1300, 63, 3619, 272, 1300, 63, 3619, 275, 2082, 435, 1994, 65, 7, 339, 2288, 2615, 63, 515, 272, 2615, 63, 515, 275, 2082, 435, 3286, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 2, 272, 2058, 905, 1529, 937, 275, 715, 339, 862, 26, 267, 747, 14, 8347, 8, 2861, 63, 515, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 283, 6531, 440, 1218, 314, 2082, 7, 339, 372, 2058, 199, 199, 3, 9031, 511, 9661, 436, 2529, 2600, 402, 2058, 199, 318, 19218, 8, 988, 63, 890, 29, 19, 304, 272, 2058, 275, 1052, 339, 327, 4712, 626, 314, 2082, 3495, 272, 862, 26, 267, 2058, 905, 1529, 937, 275, 428, 63, 1311, 3022, 8, 736, 14, 3736, 8, 2861, 63, 515, 680, 270, 63, 632, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 298, 6531, 440, 5672, 314, 2082, 2, 339, 372, 2058, 199, 199, 3, 15158, 796, 1536, 1584, 436, 2529, 2600, 402, 2058, 199, 318, 9058, 837, 272, 2058, 275, 1052, 339, 2058, 905, 1529, 937, 275, 715, 339, 862, 26, 267, 5145, 14, 9242, 8, 1095, 63, 3619, 9, 272, 871, 26, 267, 2058, 905, 1529, 937, 275, 756, 267, 2058, 905, 705, 937, 275, 283, 6531, 440, 2813, 570, 7, 339, 372, 2058, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
StuartMacKay/checklists_scrapers
checklists_scrapers/tests/spiders/worldbirds/test_checklist_parser.py
1
7400
"""Tests for parsing the WorldBirds page containing the checklist.""" from datetime import datetime from unittest import TestCase from checklists_scrapers.spiders import DOWNLOAD_FORMAT, DOWNLOAD_LANGUAGE from checklists_scrapers.spiders.worldbirds_spider import ChecklistParser from checklists_scrapers.tests.utils import response_for_content class ChecklistParserTestCase(TestCase): """Verify the spider can extract data from the checklist page.""" def setUp(self): """Initialize the test.""" self.response = response_for_content(""" <div id="popupwrapper" style="width: 600px; height: 370px; top: 160px; left: 533.5px;"> <div id="popupheader" style="width: 600px;"> <a href="javascript:doShowInfo(false,%200,%200,%200);"> <div id="ico_close"></div> </a> </div> <div id="popupscroll" style="width: 600px; height: 350px;"> <div id="popupbody" style="width: 560px;"><p></p> <div id="popupcontent"><br> <table cellspacing="0" class="PopupTable"> <tr> <td width="60%"><label>Location</label></td> <td width="40%">Location A</td></tr> <tr> <td><label>Region</label></td> <td>Region A</td> </tr> <tr> <td><label>Start date</label></td> <td>23-05-2013</td> </tr> <tr> <td><label>Time</label></td> <td>11:00 - 12:05</td> </tr> <tr> <td><label>Time spent birding</label></td> <td>1 Hrs 5 Mins</td> </tr> <tr> <td><label>Observers</label></td> <td>1</td> </tr> <tr> <td><label>Were all birds seen recorded?</label></td> <td><img src="images/theme_blue/tick.gif"></td> </tr> <tr> <td><label>Were no birds seen?</label></td> <td><img src="images/theme_blue/cross.gif"></td> </tr> <tr> <td><label>Did weather, visibility, disturbance etc affect your counts?</label></td> <td><img src="images/theme_blue/cross.gif"></td> </tr> <tr> <td><label>Purpose</label></td> <td>Birdwatching, with no specific purpose</td><td></td> </tr> <tr valign="top"> <td><label>Other notes for the visit</label></td> <td></td> <td></td> </tr> <tr valign="top"> <td><label>Observers</label></td> <td>Observer A, Observer B</td><td></td> </tr> <tr> <td><label>Total species observed during visit</label></td> <td>3 <a ;="" onclick="doHighlights(1, 00001, 0, 0)" href="javascript:void(0);">Hide list</a></td> </tr> </table> <br><br> <b>Confidential entries are hidden from the list displayed below.</b><br><br> <table cellspacing="0" class="TableThin"> <tr> <th width="30%" align="left">Species</th> <th width="10%">Count</th> <th width="20%">Activity</th> <th width="35%" align="left">Notes</th> <th width="5%">Status</th> </tr> <tr> <td>Species A</td> <td align="center">10</td> <td>activity</td> <td>notes</td> <td>status</td> </tr> <tr> <td>Species B</td> <td align="center">2</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>Species C</td> <td align="center"><img src="images/theme_blue/tick.gif"></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table><br> </div><p></p> </div> </div> </div> """, 'utf-8', metadata={'identifiers': (1, 2, 3), 'country': 'pt'}) self.parser = ChecklistParser(self.response) def test_checklist_version(self): """Verify the version number for the checklist format is defined.""" self.assertEqual(DOWNLOAD_FORMAT, self.parser.get_checklist()['meta']['version']) def test_checklist_language(self): """Verify the language used for the checklist format is defined.""" self.assertEqual(DOWNLOAD_LANGUAGE, self.parser.get_checklist()['meta']['language']) def test_checklist_identifier(self): """Verify the checklist identifier is extracted.""" self.assertEqual('PT1', self.parser.get_checklist()['identifier']) def test_source_name(self): """Verify the name of the source is extracted.""" actual = self.parser.get_checklist()['source']['name'] self.assertEqual('WorldBirds', actual) def test_source_url(self): """Verify the checklist url is extracted.""" actual = self.parser.get_checklist()['source']['url'] self.assertEqual('http://example.com', actual) def test_checklist_date(self): """Verify the checklist date is extracted.""" self.assertEqual('2013-05-23', self.parser.get_checklist()['date']) def test_checklist_time(self): """Verify the checklist time is extracted.""" actual = self.parser.get_checklist()['protocol']['time'] self.assertEqual('11:00', actual) def test_observer_names(self): """Verify the list of observers is extracted.""" self.assertEqual(['Observer A', 'Observer B'], self.parser.get_checklist()['observers']['names']) def test_observers_count(self): """Verify the number of observers is extracted.""" self.assertEqual(2, self.parser.get_checklist()['observers']['count']) def test_activity(self): """Verify the activity is extracted.""" self.assertEqual('Birdwatching, with no specific purpose', self.parser.get_checklist()['activity']) def test_location_name(self): """Verify the location name is extracted.""" self.assertEqual('Location A', self.parser.get_location()['name']) def test_protocol_type(self): """Verify the protocol name is extracted.""" self.assertEqual('Timed visit', self.parser.get_protocol()['name']) def test_protocol_duration_hours(self): """Verify the duration hours of the visit is extracted.""" self.assertEqual(1, self.parser.get_protocol()['duration_hours']) def test_protocol_duration_minutes(self): """Verify the duration minutes of the visit is extracted.""" self.assertEqual(5, self.parser.get_protocol()['duration_minutes']) def test_entry_count(self): """Verify the number of entries.""" self.assertEqual(3, len(self.parser.get_entries())) def test_entries(self): """Verify the entries.""" expected = [{ 'identifier': 'PT1000', 'species': {'name': 'Species A'}, 'count': 10, 'comment': 'notes', }, { 'identifier': 'PT1001', 'species': {'name': 'Species B'}, 'count': 2, 'comment': '', }, { 'identifier': 'PT1002', 'species': {'name': 'Species C'}, 'count': 0, 'comment': '', }] self.assertEqual(expected, self.parser.get_entries())
bsd-3-clause
[ 624, 2925, 367, 6057, 314, 13064, 34, 723, 795, 2034, 3035, 314, 1104, 513, 1041, 199, 504, 2197, 492, 2197, 199, 504, 2882, 492, 7640, 199, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 8721, 7735, 492, 10163, 7405, 63, 4807, 12, 10163, 7405, 63, 13947, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 8721, 7735, 14, 584, 15793, 723, 795, 63, 12856, 492, 2670, 513, 2842, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 2219, 14, 1208, 492, 1177, 63, 509, 63, 1317, 421, 199, 533, 2670, 513, 2842, 1746, 8, 1746, 304, 272, 408, 7496, 314, 18094, 883, 5536, 666, 687, 314, 1104, 513, 2034, 1041, 339, 347, 3613, 8, 277, 304, 267, 408, 9345, 314, 511, 1041, 267, 291, 14, 1310, 275, 1177, 63, 509, 63, 1317, 4852, 267, 665, 3015, 1305, 628, 16020, 5029, 2, 3449, 628, 2063, 26, 11624, 5326, 27, 4569, 26, 650, 2760, 5326, 27, 2746, 26, 21235, 5326, 27, 3602, 26, 959, 1153, 14, 21, 5326, 31328, 267, 665, 3015, 1305, 628, 16020, 1291, 2, 3449, 628, 2063, 26, 11624, 5326, 31328, 288, 665, 65, 4369, 628, 9554, 26, 1117, 6824, 2354, 8, 3910, 8719, 1840, 8719, 1840, 8719, 1840, 2736, 1743, 355, 665, 3015, 1305, 628, 12802, 63, 1600, 10070, 3015, 30, 288, 3068, 65, 30, 267, 3068, 3015, 30, 267, 665, 3015, 1305, 628, 16020, 6755, 2, 3449, 628, 2063, 26, 11624, 5326, 27, 4569, 26, 31921, 5326, 31328, 267, 665, 3015, 1305, 628, 16020, 2030, 2, 3449, 628, 2063, 26, 959, 2259, 5326, 27, 8186, 80, 2957, 80, 30, 267, 665, 3015, 1305, 628, 16020, 1317, 8186, 3289, 30, 267, 665, 1224, 10106, 29277, 628, 16, 2, 1021, 628, 26168, 3186, 1743, 267, 665, 454, 30, 881, 665, 2076, 3462, 628, 2259, 5, 8186, 1302, 30, 6592, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 3462, 628, 2167, 5, 1743, 6592, 437, 1108, 2076, 2957, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 10708, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 10708, 437, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 3162, 1434, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 1789, 13, 1717, 13, 6965, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 1366, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 845, 26, 383, 446, 3144, 26, 1717, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 1366, 2249, 484, 330, 723, 1098, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 17, 869, 2393, 959, 603, 3617, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 11394, 5871, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 17, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 6004, 264, 1006, 330, 723, 795, 6775, 18894, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 8284, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 6004, 264, 949, 330, 723, 795, 6775, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 7925, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 17366, 29643, 12, 6887, 12, 2917, 30395, 554, 5423, 12787, 2195, 8242, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 7925, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 14959, 4070, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 34, 5428, 6821, 316, 12, 543, 949, 2488, 12016, 1108, 2076, 2535, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 27554, 628, 2119, 1743, 881, 665, 2076, 2535, 1302, 30, 8632, 12681, 367, 314, 5684, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2957, 2076, 30, 881, 665, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 27554, 628, 2119, 1743, 881, 665, 2076, 2535, 1302, 30, 11394, 5871, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 22715, 437, 12, 17985, 1000, 699, 1108, 2076, 2535, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 7316, 20340, 20802, 5309, 5684, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 19, 665, 65, 8700, 9287, 31156, 628, 1117, 11688, 27227, 8, 17, 12, 378, 4183, 12, 378, 12, 378, 2924, 4369, 628, 9554, 26, 1647, 8, 16, 2736, 1743, 18224, 769, 1108, 65, 2957, 2076, 30, 267, 3068, 454, 30, 267, 3068, 1224, 30, 267, 665, 3289, 2535, 3289, 30, 267, 665, 66, 30, 714, 329, 3256, 4811, 787, 8752, 687, 314, 769, 9080, 5084, 9758, 66, 2535, 3289, 2535, 3289, 30, 267, 665, 1224, 10106, 29277, 628, 16, 2, 1021, 628, 3186, 2719, 262, 1743, 267, 665, 454, 30, 881, 665, 273, 3462, 628, 1216, 5, 2, 6998, 628, 3039, 1743, 6154, 397, 1108, 273, 30, 881, 665, 273, 3462, 628, 709, 5, 1743, 2353, 1108, 273, 30, 881, 665, 273, 3462, 628, 1165, 5, 1743, 14350, 1108, 273, 30, 881, 665, 273, 3462, 628, 1276, 5, 2, 6998, 628, 3039, 1743, 18685, 1108, 273, 30, 881, 665, 273, 3462, 628, 21, 5, 1743, 3694, 1108, 273, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 30, 6154, 397, 437, 1108, 2076, 30, 881, 665, 2076, 6998, 628, 4218, 1743, 709, 1108, 2076, 30, 881, 665, 2076, 30, 8240, 1108, 2076, 30, 881, 665, 2076, 30, 5983, 1108, 2076, 30, 881, 665, 2076, 30, 1205, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 30, 6154, 397, 699, 1108, 2076, 30, 881, 665, 2076, 6998, 628, 4218, 1743, 18, 1108, 2076, 30, 881, 665, 2076, 18181, 10758, 12279, 2076, 30, 881, 665, 2076, 18181, 10758 ]
[ 2925, 367, 6057, 314, 13064, 34, 723, 795, 2034, 3035, 314, 1104, 513, 1041, 199, 504, 2197, 492, 2197, 199, 504, 2882, 492, 7640, 199, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 8721, 7735, 492, 10163, 7405, 63, 4807, 12, 10163, 7405, 63, 13947, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 8721, 7735, 14, 584, 15793, 723, 795, 63, 12856, 492, 2670, 513, 2842, 199, 504, 1104, 6717, 63, 12865, 32206, 14, 2219, 14, 1208, 492, 1177, 63, 509, 63, 1317, 421, 199, 533, 2670, 513, 2842, 1746, 8, 1746, 304, 272, 408, 7496, 314, 18094, 883, 5536, 666, 687, 314, 1104, 513, 2034, 1041, 339, 347, 3613, 8, 277, 304, 267, 408, 9345, 314, 511, 1041, 267, 291, 14, 1310, 275, 1177, 63, 509, 63, 1317, 4852, 267, 665, 3015, 1305, 628, 16020, 5029, 2, 3449, 628, 2063, 26, 11624, 5326, 27, 4569, 26, 650, 2760, 5326, 27, 2746, 26, 21235, 5326, 27, 3602, 26, 959, 1153, 14, 21, 5326, 31328, 267, 665, 3015, 1305, 628, 16020, 1291, 2, 3449, 628, 2063, 26, 11624, 5326, 31328, 288, 665, 65, 4369, 628, 9554, 26, 1117, 6824, 2354, 8, 3910, 8719, 1840, 8719, 1840, 8719, 1840, 2736, 1743, 355, 665, 3015, 1305, 628, 12802, 63, 1600, 10070, 3015, 30, 288, 3068, 65, 30, 267, 3068, 3015, 30, 267, 665, 3015, 1305, 628, 16020, 6755, 2, 3449, 628, 2063, 26, 11624, 5326, 27, 4569, 26, 31921, 5326, 31328, 267, 665, 3015, 1305, 628, 16020, 2030, 2, 3449, 628, 2063, 26, 959, 2259, 5326, 27, 8186, 80, 2957, 80, 30, 267, 665, 3015, 1305, 628, 16020, 1317, 8186, 3289, 30, 267, 665, 1224, 10106, 29277, 628, 16, 2, 1021, 628, 26168, 3186, 1743, 267, 665, 454, 30, 881, 665, 2076, 3462, 628, 2259, 5, 8186, 1302, 30, 6592, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 3462, 628, 2167, 5, 1743, 6592, 437, 1108, 2076, 2957, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 10708, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 10708, 437, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 3162, 1434, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 1789, 13, 1717, 13, 6965, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 1366, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 845, 26, 383, 446, 3144, 26, 1717, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 1366, 2249, 484, 330, 723, 1098, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 17, 869, 2393, 959, 603, 3617, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 11394, 5871, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 17, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 6004, 264, 1006, 330, 723, 795, 6775, 18894, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 8284, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 6004, 264, 949, 330, 723, 795, 6775, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 7925, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 17366, 29643, 12, 6887, 12, 2917, 30395, 554, 5423, 12787, 2195, 8242, 31, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2535, 4060, 2928, 628, 4782, 15, 7915, 63, 6304, 15, 7925, 14, 14513, 10070, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 14959, 4070, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 34, 5428, 6821, 316, 12, 543, 949, 2488, 12016, 1108, 2076, 2535, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 27554, 628, 2119, 1743, 881, 665, 2076, 2535, 1302, 30, 8632, 12681, 367, 314, 5684, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 2957, 2076, 30, 881, 665, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 27554, 628, 2119, 1743, 881, 665, 2076, 2535, 1302, 30, 11394, 5871, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 22715, 437, 12, 17985, 1000, 699, 1108, 2076, 2535, 2076, 2957, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 2535, 1302, 30, 7316, 20340, 20802, 5309, 5684, 1108, 1302, 2957, 2076, 30, 881, 665, 2076, 30, 19, 665, 65, 8700, 9287, 31156, 628, 1117, 11688, 27227, 8, 17, 12, 378, 4183, 12, 378, 12, 378, 2924, 4369, 628, 9554, 26, 1647, 8, 16, 2736, 1743, 18224, 769, 1108, 65, 2957, 2076, 30, 267, 3068, 454, 30, 267, 3068, 1224, 30, 267, 665, 3289, 2535, 3289, 30, 267, 665, 66, 30, 714, 329, 3256, 4811, 787, 8752, 687, 314, 769, 9080, 5084, 9758, 66, 2535, 3289, 2535, 3289, 30, 267, 665, 1224, 10106, 29277, 628, 16, 2, 1021, 628, 3186, 2719, 262, 1743, 267, 665, 454, 30, 881, 665, 273, 3462, 628, 1216, 5, 2, 6998, 628, 3039, 1743, 6154, 397, 1108, 273, 30, 881, 665, 273, 3462, 628, 709, 5, 1743, 2353, 1108, 273, 30, 881, 665, 273, 3462, 628, 1165, 5, 1743, 14350, 1108, 273, 30, 881, 665, 273, 3462, 628, 1276, 5, 2, 6998, 628, 3039, 1743, 18685, 1108, 273, 30, 881, 665, 273, 3462, 628, 21, 5, 1743, 3694, 1108, 273, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 30, 6154, 397, 437, 1108, 2076, 30, 881, 665, 2076, 6998, 628, 4218, 1743, 709, 1108, 2076, 30, 881, 665, 2076, 30, 8240, 1108, 2076, 30, 881, 665, 2076, 30, 5983, 1108, 2076, 30, 881, 665, 2076, 30, 1205, 1108, 2076, 30, 267, 3068, 454, 30, 267, 665, 454, 30, 881, 665, 2076, 30, 6154, 397, 699, 1108, 2076, 30, 881, 665, 2076, 6998, 628, 4218, 1743, 18, 1108, 2076, 30, 881, 665, 2076, 18181, 10758, 12279, 2076, 30, 881, 665, 2076, 18181, 10758, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
koenedaele/pyramid_skosprovider
tests/test_functional.py
1
14118
# -*- coding: utf8 -*- from __future__ import unicode_literals from pyramid.config import Configurator from pyramid.compat import ( ascii_native_, string_types ) import json from webtest import TestApp import unittest from .fixtures.data import ( trees ) def skosmain(global_config, **settings): """ This function returns a Pyramid WSGI application. """ # Set up pyramid config = Configurator(settings=settings) config.include('pyramid_skosprovider') skosregis = config.get_skos_registry() skosregis.register_provider(trees) return config.make_wsgi_app() class FunctionalTests(unittest.TestCase): def setUp(self): settings = { 'skosprovider.skosregistry_location': 'registry' } app = skosmain({}, **settings) self.testapp = TestApp(app) def tearDown(self): del self.testapp class RestFunctionalTests(FunctionalTests): def test_get_context_json(self): res = self.testapp.get( '/jsonld/context/skos', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) assert res.status == '200 OK' assert 'application/json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) assert isinstance(data, dict) assert 'skos' in data assert 'dct' in data def test_get_context_jsonld(self): res = self.testapp.get( '/jsonld/context/skos', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')} ) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) assert isinstance(data, dict) assert 'skos' in data assert 'dct' in data def test_get_uri_cs_json(self): res = self.testapp.get( '/uris?uri=http://python.com/trees', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, dict) self.assertIn('uri', data) self.assertIn('id', data) self.assertIn('type', data) def test_get_uri_c_json(self): res = self.testapp.get( '/uris?uri=http%3A%2F%2Fpython.com%2Ftrees%2Flarch', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, dict) self.assertIn('uri', data) self.assertIn('id', data) self.assertIn('type', data) self.assertIn('concept_scheme', data) def test_get_uri_deprecated_way(self): res1 = self.testapp.get( '/uris?uri=http://python.com/trees', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) res2 = self.testapp.get( '/uris/http://python.com/trees', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual(res1.body, res2.body) def test_get_uri_no_uri(self): res = self.testapp.get( '/uris', {}, {ascii_native_('Accept'): ascii_native_('application/json')}, status=400 ) self.assertEqual('400 Bad Request', res.status) def test_get_conceptschemes_json(self): res = self.testapp.get( '/conceptschemes', {}, {ascii_native_('Accept'): ascii_native_('application/json')}) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(len(data), 1) def test_get_conceptscheme_json(self): res = self.testapp.get( '/conceptschemes/TREES', {}, {ascii_native_('Accept'): ascii_native_('application/json')}) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, dict) self.assertIn('id', data) self.assertIn('uri', data) self.assertIn('subject', data) self.assertIn('label', data) self.assertIn('labels', data) self.assertIn('sources', data) self.assertEqual(len(data['labels']), 2) for l in data['labels']: self.assertIsInstance(l, dict) self.assertIn('notes', data) def test_get_conceptscheme_jsonld(self): res = self.testapp.get( '/conceptschemes/TREES', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')}) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) assert isinstance(data, dict) assert 'id' in data assert 'uri'in data assert 'label' in data assert 'labels' in data assert 'sources' in data assert 'notes' in data assert 'type' in data assert '@context' in data assert '/jsonld/context/skos' in data['@context'] def test_get_conceptscheme_jsonld_url(self): res = self.testapp.get( '/conceptschemes/TREES.jsonld' ) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) res2 = self.testapp.get( '/conceptschemes/TREES', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')}) data2 = json.loads(res2.body.decode('utf-8')) assert data == data2 def test_get_conceptschemes_trees_cs_json(self): res = self.testapp.get( '/conceptschemes/TREES/c', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) self.assertIsInstance(res.headers['Content-Range'], string_types) self.assertEqual('items 0-2/3', res.headers['Content-Range']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(len(data), 3) def test_get_conceptschemes_trees_cs_slice_json(self): res = self.testapp.get( '/conceptschemes/TREES/c', {}, { ascii_native_('Accept'): ascii_native_('application/json'), ascii_native_('Range'): ascii_native_('items=2-2') } ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) self.assertIsInstance(res.headers['Content-Range'], string_types) self.assertEqual('items 2-2/3', res.headers['Content-Range']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(len(data), 1) def test_get_conceptschemes_trees_larch_json(self): res = self.testapp.get( '/conceptschemes/TREES/c/1', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, dict) self.assertIn('id', data) self.assertIn('label', data) self.assertIn('labels', data) self.assertIn('notes', data) self.assertIn('sources', data) self.assertEqual('concept', data['type']) self.assertIn('narrower', data) self.assertIn('broader', data) self.assertIn('related', data) self.assertNotIn('members', data) self.assertIn('member_of', data) def test_get_conceptschemes_trees_larch_jsonld(self): res = self.testapp.get( '/conceptschemes/TREES/c/1', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')} ) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) assert isinstance(data, dict) assert 'id' in data assert 'label' in data assert 'uri' in data assert 'type' in data assert '@context' in data assert '/jsonld/context/skos' in data['@context'] def test_get_conceptschemes_trees_species_json(self): res = self.testapp.get( '/conceptschemes/TREES/c/3', {}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, dict) self.assertIn('id', data) self.assertIn('label', data) self.assertIn('labels', data) self.assertIn('notes', data) self.assertEqual('collection', data['type']) self.assertNotIn('narrower', data) self.assertNotIn('broader', data) self.assertNotIn('related', data) self.assertIn('members', data) self.assertIn('member_of', data) def test_get_conceptschemes_trees_species_jsonld(self): res = self.testapp.get( '/conceptschemes/TREES/c/3', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')} ) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) assert isinstance(data, dict) assert 'id' in data assert 'label' in data assert 'uri' in data assert 'type' in data assert '@context' in data assert '/jsonld/context/skos' in data['@context'] def test_get_conceptschemes_trees_species_jsonld_url(self): res = self.testapp.get( '/conceptschemes/TREES/c/3.jsonld' ) assert res.status == '200 OK' assert 'application/ld+json' in res.headers['Content-Type'] data = json.loads(res.body.decode('utf-8')) res2 = self.testapp.get( '/conceptschemes/TREES/c/3', {}, {ascii_native_('Accept'): ascii_native_('application/ld+json')} ) data2 = json.loads(res2.body.decode('utf-8')) assert data == data2 def test_get_conceptscheme_concepts_search_dfs_label_star_postfix(self): res = self.testapp.get( '/conceptschemes/TREES/c?language=nl-BE', { 'mode': 'dijitFilteringSelect', 'label': 'de *' }, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(2, len(data)) def test_get_conceptscheme_concepts_search_dfs_label_star_prefix(self): res = self.testapp.get( '/conceptschemes/TREES/c?language=en', { 'mode': 'dijitFilteringSelect', 'label': '*nut' }, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(1, len(data)) def test_get_conceptscheme_concepts_search_dfs_label_star_prepostfix(self): res = self.testapp.get( '/conceptschemes/TREES/c?language=nl-BE', { 'mode': 'dijitFilteringSelect', 'label': '*Lariks*' }, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(1, len(data)) def test_get_conceptscheme_concepts_search_dfs_all(self): res = self.testapp.get( '/conceptschemes/TREES/c', {'mode': 'dijitFilteringSelect', 'label': '*'}, {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(3, len(data)) def test_get_top_concepts(self): res = self.testapp.get( '/conceptschemes/TREES/topconcepts', {ascii_native_('Accept'): ascii_native_('application/json')} ) self.assertEqual('200 OK', res.status) self.assertIn('application/json', res.headers['Content-Type']) data = json.loads(res.body.decode('utf-8')) self.assertIsInstance(data, list) self.assertEqual(2, len(data)) for c in data: self.assertIn('id', c) self.assertIn('uri', c) self.assertIn('label', c) self.assertEqual('concept', c['type'])
mit
[ 3, 1882, 2803, 26, 2774, 24, 1882, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 30704, 14, 888, 492, 4094, 17320, 199, 199, 504, 30704, 14, 5819, 492, 334, 272, 13294, 63, 6106, 3131, 272, 1059, 63, 1313, 199, 9, 199, 199, 646, 2022, 199, 199, 504, 3330, 396, 492, 1379, 2640, 199, 199, 646, 2882, 199, 199, 504, 1275, 8769, 14, 576, 492, 334, 272, 14416, 199, 9, 421, 199, 318, 2386, 736, 973, 8, 2966, 63, 888, 12, 1011, 1751, 304, 272, 408, 272, 961, 805, 2529, 282, 1611, 20785, 9279, 4223, 14, 272, 408, 339, 327, 2494, 1536, 30704, 272, 1101, 275, 4094, 17320, 8, 1751, 29, 1751, 9, 339, 1101, 14, 2613, 360, 647, 20785, 63, 1339, 736, 3780, 358, 339, 2386, 736, 1135, 374, 275, 1101, 14, 362, 63, 1339, 736, 63, 5189, 342, 272, 2386, 736, 1135, 374, 14, 2683, 63, 3780, 8, 14635, 9, 339, 372, 1101, 14, 1875, 63, 6508, 63, 571, 342, 421, 199, 533, 6801, 279, 2925, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 2202, 275, 469, 288, 283, 1339, 736, 3780, 14, 1339, 736, 5189, 63, 1985, 356, 283, 5189, 7, 267, 789, 267, 1145, 275, 2386, 736, 973, 16037, 1011, 1751, 9, 267, 291, 14, 19700, 275, 1379, 2640, 8, 571, 9, 339, 347, 6766, 8, 277, 304, 267, 2150, 291, 14, 19700, 421, 199, 533, 30417, 3481, 279, 2925, 8, 3481, 279, 2925, 304, 339, 347, 511, 63, 362, 63, 1100, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 1001, 1447, 15, 1100, 15, 1339, 736, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 702, 522, 14, 1205, 508, 283, 1840, 9949, 7, 267, 702, 283, 3578, 15, 1001, 7, 315, 522, 14, 2139, 459, 2714, 13, 804, 418, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 702, 1228, 8, 576, 12, 1211, 9, 267, 702, 283, 1339, 736, 7, 315, 666, 267, 702, 283, 20660, 7, 315, 666, 339, 347, 511, 63, 362, 63, 1100, 63, 1001, 1447, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 1001, 1447, 15, 1100, 15, 1339, 736, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1447, 11, 1001, 21004, 267, 776, 267, 702, 522, 14, 1205, 508, 283, 1840, 9949, 7, 267, 702, 283, 3578, 15, 1447, 11, 1001, 7, 315, 522, 14, 2139, 459, 2714, 13, 804, 418, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 702, 1228, 8, 576, 12, 1211, 9, 267, 702, 283, 1339, 736, 7, 315, 666, 267, 702, 283, 20660, 7, 315, 666, 339, 347, 511, 63, 362, 63, 2302, 63, 1259, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 360, 1840, 9949, 297, 522, 14, 1205, 9, 267, 291, 14, 4080, 360, 3578, 15, 1001, 297, 522, 14, 2139, 459, 2714, 13, 804, 1105, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 291, 14, 6926, 8, 576, 12, 1211, 9, 267, 291, 14, 4080, 360, 2302, 297, 666, 9, 267, 291, 14, 4080, 360, 344, 297, 666, 9, 267, 291, 14, 4080, 360, 466, 297, 666, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 67, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 5, 19, 33, 5, 18, 38, 5, 18, 38, 1548, 14, 957, 5, 18, 38, 14635, 5, 18, 7579, 1047, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 360, 1840, 9949, 297, 522, 14, 1205, 9, 267, 291, 14, 4080, 360, 3578, 15, 1001, 297, 522, 14, 2139, 459, 2714, 13, 804, 1105, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 291, 14, 6926, 8, 576, 12, 1211, 9, 267, 291, 14, 4080, 360, 2302, 297, 666, 9, 267, 291, 14, 4080, 360, 344, 297, 666, 9, 267, 291, 14, 4080, 360, 466, 297, 666, 9, 267, 291, 14, 4080, 360, 21318, 63, 5512, 297, 666, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 6667, 63, 3316, 8, 277, 304, 267, 522, 17, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 522, 18, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 15, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 8, 470, 17, 14, 2030, 12, 522, 18, 14, 2030, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 889, 63, 2302, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 3904, 288, 2004, 29, 5303, 267, 776, 267, 291, 14, 629, 360, 5303, 8857, 4784, 297, 522, 14, 1205, 9, 339, 347, 511, 63, 362, 63, 21318, 26818, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 21318, 26818, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 22220, 267, 291, 14, 629, 360, 1840, 9949, 297, 522, 14, 1205 ]
[ 1882, 2803, 26, 2774, 24, 1882, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 30704, 14, 888, 492, 4094, 17320, 199, 199, 504, 30704, 14, 5819, 492, 334, 272, 13294, 63, 6106, 3131, 272, 1059, 63, 1313, 199, 9, 199, 199, 646, 2022, 199, 199, 504, 3330, 396, 492, 1379, 2640, 199, 199, 646, 2882, 199, 199, 504, 1275, 8769, 14, 576, 492, 334, 272, 14416, 199, 9, 421, 199, 318, 2386, 736, 973, 8, 2966, 63, 888, 12, 1011, 1751, 304, 272, 408, 272, 961, 805, 2529, 282, 1611, 20785, 9279, 4223, 14, 272, 408, 339, 327, 2494, 1536, 30704, 272, 1101, 275, 4094, 17320, 8, 1751, 29, 1751, 9, 339, 1101, 14, 2613, 360, 647, 20785, 63, 1339, 736, 3780, 358, 339, 2386, 736, 1135, 374, 275, 1101, 14, 362, 63, 1339, 736, 63, 5189, 342, 272, 2386, 736, 1135, 374, 14, 2683, 63, 3780, 8, 14635, 9, 339, 372, 1101, 14, 1875, 63, 6508, 63, 571, 342, 421, 199, 533, 6801, 279, 2925, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 2202, 275, 469, 288, 283, 1339, 736, 3780, 14, 1339, 736, 5189, 63, 1985, 356, 283, 5189, 7, 267, 789, 267, 1145, 275, 2386, 736, 973, 16037, 1011, 1751, 9, 267, 291, 14, 19700, 275, 1379, 2640, 8, 571, 9, 339, 347, 6766, 8, 277, 304, 267, 2150, 291, 14, 19700, 421, 199, 533, 30417, 3481, 279, 2925, 8, 3481, 279, 2925, 304, 339, 347, 511, 63, 362, 63, 1100, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 1001, 1447, 15, 1100, 15, 1339, 736, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 702, 522, 14, 1205, 508, 283, 1840, 9949, 7, 267, 702, 283, 3578, 15, 1001, 7, 315, 522, 14, 2139, 459, 2714, 13, 804, 418, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 702, 1228, 8, 576, 12, 1211, 9, 267, 702, 283, 1339, 736, 7, 315, 666, 267, 702, 283, 20660, 7, 315, 666, 339, 347, 511, 63, 362, 63, 1100, 63, 1001, 1447, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 1001, 1447, 15, 1100, 15, 1339, 736, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1447, 11, 1001, 21004, 267, 776, 267, 702, 522, 14, 1205, 508, 283, 1840, 9949, 7, 267, 702, 283, 3578, 15, 1447, 11, 1001, 7, 315, 522, 14, 2139, 459, 2714, 13, 804, 418, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 702, 1228, 8, 576, 12, 1211, 9, 267, 702, 283, 1339, 736, 7, 315, 666, 267, 702, 283, 20660, 7, 315, 666, 339, 347, 511, 63, 362, 63, 2302, 63, 1259, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 360, 1840, 9949, 297, 522, 14, 1205, 9, 267, 291, 14, 4080, 360, 3578, 15, 1001, 297, 522, 14, 2139, 459, 2714, 13, 804, 1105, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 291, 14, 6926, 8, 576, 12, 1211, 9, 267, 291, 14, 4080, 360, 2302, 297, 666, 9, 267, 291, 14, 4080, 360, 344, 297, 666, 9, 267, 291, 14, 4080, 360, 466, 297, 666, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 67, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 5, 19, 33, 5, 18, 38, 5, 18, 38, 1548, 14, 957, 5, 18, 38, 14635, 5, 18, 7579, 1047, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 360, 1840, 9949, 297, 522, 14, 1205, 9, 267, 291, 14, 4080, 360, 3578, 15, 1001, 297, 522, 14, 2139, 459, 2714, 13, 804, 1105, 267, 666, 275, 2022, 14, 3640, 8, 470, 14, 2030, 14, 2708, 360, 1624, 13, 24, 1333, 267, 291, 14, 6926, 8, 576, 12, 1211, 9, 267, 291, 14, 4080, 360, 2302, 297, 666, 9, 267, 291, 14, 4080, 360, 344, 297, 666, 9, 267, 291, 14, 4080, 360, 466, 297, 666, 9, 267, 291, 14, 4080, 360, 21318, 63, 5512, 297, 666, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 6667, 63, 3316, 8, 277, 304, 267, 522, 17, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 31, 2302, 29, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 522, 18, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 15, 1014, 921, 1548, 14, 957, 15, 14635, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 21004, 267, 776, 267, 291, 14, 629, 8, 470, 17, 14, 2030, 12, 522, 18, 14, 2030, 9, 339, 347, 511, 63, 362, 63, 2302, 63, 889, 63, 2302, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 17656, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 3904, 288, 2004, 29, 5303, 267, 776, 267, 291, 14, 629, 360, 5303, 8857, 4784, 297, 522, 14, 1205, 9, 339, 347, 511, 63, 362, 63, 21318, 26818, 63, 1001, 8, 277, 304, 267, 522, 275, 291, 14, 19700, 14, 362, 8, 288, 1994, 21318, 26818, 297, 288, 5479, 288, 469, 4371, 63, 6106, 11252, 8422, 735, 13294, 63, 6106, 11252, 3578, 15, 1001, 22220, 267, 291, 14, 629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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2014c2g12/c2g12
c2wp/exts/wsgi/static/Brython2.1.0-20140419-113919/Lib/_pyio.py
103
72494
""" Python implementation of the io module. """ import os import abc import codecs import errno # Import _thread instead of threading to reduce startup cost try: from _thread import allocate_lock as Lock except ImportError: from _dummy_thread import allocate_lock as Lock import io from io import (__all__, SEEK_SET, SEEK_CUR, SEEK_END) valid_seek_flags = {0, 1, 2} # Hardwired values if hasattr(os, 'SEEK_HOLE') : valid_seek_flags.add(os.SEEK_HOLE) valid_seek_flags.add(os.SEEK_DATA) # open() uses st_blksize whenever we can DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes # NOTE: Base classes defined here are registered with the "official" ABCs # defined in io.py. We don't use real inheritance though, because we don't # want to inherit the C implementations. # Rebind for compatibility BlockingIOError = BlockingIOError def open(file, mode="r", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): r"""Open file and return a stream. Raise IOError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless closefd is set to False.) mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already exists), 'x' for exclusive creation of a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent. (For reading and writing raw bytes use binary mode and leave encoding unspecified.) The available modes are: ========= =============================================================== Character Meaning --------- --------------------------------------------------------------- 'r' open for reading (default) 'w' open for writing, truncating the file first 'x' create a new file and open it for writing 'a' open for writing, appending to the end of the file if it exists 'b' binary mode 't' text mode (default) '+' open a disk file for updating (reading and writing) 'U' universal newline mode (for backwards compatibility; unneeded for new code) ========= =============================================================== The default mode is 'rt' (open for reading text). For binary random access, the mode 'w+b' opens and truncates the file to 0 bytes, while 'r+b' opens the file without truncation. The 'x' mode implies 'w' and raises an `FileExistsError` if the file already exists. Python distinguishes between files opened in binary and text modes, even when the underlying operating system doesn't. Files opened in binary mode (appending 'b' to the mode argument) return contents as bytes objects without any decoding. In text mode (the default, or when 't' is appended to the mode argument), the contents of the file are returned as strings, the bytes having been first decoded using a platform-dependent encoding or using the specified encoding if given. buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size of a fixed-size chunk buffer. When no buffering argument is given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`. On many systems, the buffer will typically be 4096 or 8192 bytes long. * "Interactive" text files (files for which isatty() returns True) use line buffering. Other text files use the policy described above for binary files. encoding is the str name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is platform dependent, but any encoding supported by Python can be passed. See the codecs module for the list of supported encodings. errors is an optional string that specifies how encoding errors are to be handled---this argument should not be used in binary mode. Pass 'strict' to raise a ValueError exception if there is an encoding error (the default of None has the same effect), or pass 'ignore' to ignore errors. (Note that ignoring encoding errors can lead to data loss.) See the documentation for codecs.register for a list of the permitted encoding error strings. newline is a string controlling how universal newlines works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows: * On input, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newline mode is enabled, but line endings are returned to the caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the caller untranslated. * On output, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep. If newline is '', no translation takes place. If newline is any of the other legal values, any '\n' characters written are translated to the given string. closedfd is a bool. If closefd is False, the underlying file descriptor will be kept open when the file is closed. This does not work when a file name is given and must be True in that case. A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing os.open as *opener* results in functionality similar to passing None). open() returns a file object whose type depends on the mode, and through which the standard file operations such as reading and writing are performed. When open() is used to open a file in a text mode ('w', 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open a file in a binary mode, the returned class varies: in read binary mode, it returns a BufferedReader; in write binary and append binary modes, it returns a BufferedWriter, and in read/write mode, it returns a BufferedRandom. It is also possible to use a string or bytearray as a file for both reading and writing. For strings StringIO can be used like a file opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. """ if not isinstance(file, (str, bytes, int)): raise TypeError("invalid file: %r" % file) if not isinstance(mode, str): raise TypeError("invalid mode: %r" % mode) if not isinstance(buffering, int): raise TypeError("invalid buffering: %r" % buffering) if encoding is not None and not isinstance(encoding, str): raise TypeError("invalid encoding: %r" % encoding) if errors is not None and not isinstance(errors, str): raise TypeError("invalid errors: %r" % errors) modes = set(mode) if modes - set("axrwb+tU") or len(mode) > len(modes): raise ValueError("invalid mode: %r" % mode) creating = "x" in modes reading = "r" in modes writing = "w" in modes appending = "a" in modes updating = "+" in modes text = "t" in modes binary = "b" in modes if "U" in modes: if creating or writing or appending: raise ValueError("can't use U and writing mode at once") reading = True if text and binary: raise ValueError("can't have text and binary mode at once") if creating + reading + writing + appending > 1: raise ValueError("can't have read/write/append mode at once") if not (creating or reading or writing or appending): raise ValueError("must have exactly one of read/write/append mode") if binary and encoding is not None: raise ValueError("binary mode doesn't take an encoding argument") if binary and errors is not None: raise ValueError("binary mode doesn't take an errors argument") if binary and newline is not None: raise ValueError("binary mode doesn't take a newline argument") raw = FileIO(file, (creating and "x" or "") + (reading and "r" or "") + (writing and "w" or "") + (appending and "a" or "") + (updating and "+" or ""), closefd, opener=opener) line_buffering = False if buffering == 1 or buffering < 0 and raw.isatty(): buffering = -1 line_buffering = True if buffering < 0: buffering = DEFAULT_BUFFER_SIZE try: bs = os.fstat(raw.fileno()).st_blksize except (os.error, AttributeError): pass else: if bs > 1: buffering = bs if buffering < 0: raise ValueError("invalid buffering size") if buffering == 0: if binary: return raw raise ValueError("can't have unbuffered text I/O") if updating: buffer = BufferedRandom(raw, buffering) elif creating or writing or appending: buffer = BufferedWriter(raw, buffering) elif reading: buffer = BufferedReader(raw, buffering) else: raise ValueError("unknown mode: %r" % mode) if binary: return buffer text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) text.mode = mode return text class DocDescriptor: """Helper for builtins.open.__doc__ """ def __get__(self, obj, typ): return ( "open(file, mode='r', buffering=-1, encoding=None, " "errors=None, newline=None, closefd=True)\n\n" + open.__doc__) class OpenWrapper: """Wrapper for builtins.open Trick so that open won't become a bound method when stored as a class variable (as dbm.dumb does). See initstdio() in Python/pythonrun.c. """ __doc__ = DocDescriptor() def __new__(cls, *args, **kwargs): return open(*args, **kwargs) # In normal operation, both `UnsupportedOperation`s should be bound to the # same object. try: UnsupportedOperation = io.UnsupportedOperation except AttributeError: class UnsupportedOperation(ValueError, IOError): pass class IOBase(metaclass=abc.ABCMeta): """The abstract base class for all I/O classes, acting on streams of bytes. There is no public constructor. This class provides dummy implementations for many methods that derived classes can override selectively; the default implementations represent a file that cannot be read, written or seeked. Even though IOBase does not declare read, readinto, or write because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise UnsupportedOperation when operations they do not support are called. The basic type used for binary data read from or written to a file is bytes. bytearrays are accepted too, and in some cases (such as readinto) needed. Text I/O classes work with str data. Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise IOError in this case. IOBase (and its subclasses) support the iterator protocol, meaning that an IOBase object can be iterated over yielding the lines in a stream. IOBase also supports the :keyword:`with` statement. In this example, fp is closed after the suite of the with statement is complete: with open('spam.txt', 'r') as fp: fp.write('Spam and eggs!') """ ### Internal ### def _unsupported(self, name): """Internal: raise an IOError exception for unsupported operations.""" raise UnsupportedOperation("%s.%s() not supported" % (self.__class__.__name__, name)) ### Positioning ### def seek(self, pos, whence=0): """Change stream position. Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: * 0 -- start of stream (the default); offset should be zero or positive * 1 -- current stream position; offset may be negative * 2 -- end of stream; offset is usually negative Some operating systems / file systems could provide additional values. Return an int indicating the new absolute position. """ self._unsupported("seek") def tell(self): """Return an int indicating the current stream position.""" return self.seek(0, 1) def truncate(self, pos=None): """Truncate file to size bytes. Size defaults to the current IO position as reported by tell(). Return the new size. """ self._unsupported("truncate") ### Flush and close ### def flush(self): """Flush write buffers, if applicable. This is not implemented for read-only and non-blocking streams. """ self._checkClosed() # XXX Should this return the number of bytes written??? __closed = False def close(self): """Flush and close the IO object. This method has no effect if the file is already closed. """ if not self.__closed: try: self.flush() finally: self.__closed = True def __del__(self): """Destructor. Calls close().""" # The try/except block is in case this is called at program # exit time, when it's possible that globals have already been # deleted, and then the close() call might fail. Since # there's nothing we can do about such failures and they annoy # the end users, we suppress the traceback. try: self.close() except: pass ### Inquiries ### def seekable(self): """Return a bool indicating whether object supports random access. If False, seek(), tell() and truncate() will raise UnsupportedOperation. This method may need to do a test seek(). """ return False def _checkSeekable(self, msg=None): """Internal: raise UnsupportedOperation if file is not seekable """ if not self.seekable(): raise UnsupportedOperation("File or stream is not seekable." if msg is None else msg) def readable(self): """Return a bool indicating whether object was opened for reading. If False, read() will raise UnsupportedOperation. """ return False def _checkReadable(self, msg=None): """Internal: raise UnsupportedOperation if file is not readable """ if not self.readable(): raise UnsupportedOperation("File or stream is not readable." if msg is None else msg) def writable(self): """Return a bool indicating whether object was opened for writing. If False, write() and truncate() will raise UnsupportedOperation. """ return False def _checkWritable(self, msg=None): """Internal: raise UnsupportedOperation if file is not writable """ if not self.writable(): raise UnsupportedOperation("File or stream is not writable." if msg is None else msg) @property def closed(self): """closed: bool. True iff the file has been closed. For backwards compatibility, this is a property, not a predicate. """ return self.__closed def _checkClosed(self, msg=None): """Internal: raise an ValueError if file is closed """ if self.closed: raise ValueError("I/O operation on closed file." if msg is None else msg) ### Context manager ### def __enter__(self): # That's a forward reference """Context management protocol. Returns self (an instance of IOBase).""" self._checkClosed() return self def __exit__(self, *args): """Context management protocol. Calls close()""" self.close() ### Lower-level APIs ### # XXX Should these be present even if unimplemented? def fileno(self): """Returns underlying file descriptor (an int) if one exists. An IOError is raised if the IO object does not use a file descriptor. """ self._unsupported("fileno") def isatty(self): """Return a bool indicating whether this is an 'interactive' stream. Return False if it can't be determined. """ self._checkClosed() return False ### Readline[s] and writelines ### def readline(self, limit=-1): r"""Read and return a line of bytes from the stream. If limit is specified, at most limit bytes will be read. Limit should be an int. The line terminator is always b'\n' for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized. """ # For backwards compatibility, a (slowish) readline(). if hasattr(self, "peek"): def nreadahead(): readahead = self.peek(1) if not readahead: return 1 n = (readahead.find(b"\n") + 1) or len(readahead) if limit >= 0: n = min(n, limit) return n else: def nreadahead(): return 1 if limit is None: limit = -1 elif not isinstance(limit, int): raise TypeError("limit must be an integer") res = bytearray() while limit < 0 or len(res) < limit: b = self.read(nreadahead()) if not b: break res += b if res.endswith(b"\n"): break return bytes(res) def __iter__(self): self._checkClosed() return self def __next__(self): line = self.readline() if not line: raise StopIteration return line def readlines(self, hint=None): """Return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint. """ if hint is None or hint <= 0: return list(self) n = 0 lines = [] for line in self: lines.append(line) n += len(line) if n >= hint: break return lines def writelines(self, lines): self._checkClosed() for line in lines: self.write(line) io.IOBase.register(IOBase) class RawIOBase(IOBase): """Base class for raw binary I/O.""" # The read() method is implemented by calling readinto(); derived # classes that want to support read() only need to implement # readinto() as a primitive operation. In general, readinto() can be # more efficient than read(). # (It would be tempting to also provide an implementation of # readinto() in terms of read(), in case the latter is a more suitable # primitive operation, but that would lead to nasty recursion in case # a subclass doesn't implement either.) def read(self, n=-1): """Read and return up to n bytes, where n is an int. Returns an empty bytes object on EOF, or None if the object is set not to block and has no data to read. """ if n is None: n = -1 if n < 0: return self.readall() b = bytearray(n.__index__()) n = self.readinto(b) if n is None: return None del b[n:] return bytes(b) def readall(self): """Read until EOF, using multiple read() call.""" res = bytearray() while True: data = self.read(DEFAULT_BUFFER_SIZE) if not data: break res += data if res: return bytes(res) else: # b'' or None return data def readinto(self, b): """Read up to len(b) bytes into bytearray b. Returns an int representing the number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read. """ self._unsupported("readinto") def write(self, b): """Write the given buffer to the IO stream. Returns the number of bytes written, which may be less than len(b). """ self._unsupported("write") io.RawIOBase.register(RawIOBase) from _io import FileIO RawIOBase.register(FileIO) class BufferedIOBase(IOBase): """Base class for buffered IO objects. The main difference with RawIOBase is that the read() method supports omitting the size argument, and does not have a default implementation that defers to readinto(). In addition, read(), readinto() and write() may raise BlockingIOError if the underlying raw stream is in non-blocking mode and not ready; unlike their raw counterparts, they will never return None. A typical implementation should not inherit from a RawIOBase implementation, but wrap one. """ def read(self, n=None): """Read and return up to n bytes, where n is an int. If the argument is omitted, None, or negative, reads and returns all data until EOF. If the argument is positive, and the underlying raw stream is not 'interactive', multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams (XXX and for pipes?), at most one raw read will be issued, and a short result does not imply that EOF is imminent. Returns an empty bytes array on EOF. Raises BlockingIOError if the underlying raw stream has no data at the moment. """ self._unsupported("read") def read1(self, n=None): """Read up to n bytes with at most one read() system call, where n is an int. """ self._unsupported("read1") def readinto(self, b): """Read up to len(b) bytes into bytearray b. Like read(), this may issue multiple reads to the underlying raw stream, unless the latter is 'interactive'. Returns an int representing the number of bytes read (0 for EOF). Raises BlockingIOError if the underlying raw stream has no data at the moment. """ # XXX This ought to work with anything that supports the buffer API data = self.read(len(b)) n = len(data) try: b[:n] = data except TypeError as err: import array if not isinstance(b, array.array): raise err b[:n] = array.array('b', data) return n def write(self, b): """Write the given bytes buffer to the IO stream. Return the number of bytes written, which is never less than len(b). Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment. """ self._unsupported("write") def detach(self): """ Separate the underlying raw stream from the buffer and return it. After the raw stream has been detached, the buffer is in an unusable state. """ self._unsupported("detach") io.BufferedIOBase.register(BufferedIOBase) class _BufferedIOMixin(BufferedIOBase): """A mixin implementation of BufferedIOBase with an underlying raw stream. This passes most requests on to the underlying raw stream. It does *not* provide implementations of read(), readinto() or write(). """ def __init__(self, raw): self._raw = raw ### Positioning ### def seek(self, pos, whence=0): new_position = self.raw.seek(pos, whence) if new_position < 0: raise IOError("seek() returned an invalid position") return new_position def tell(self): pos = self.raw.tell() if pos < 0: raise IOError("tell() returned an invalid position") return pos def truncate(self, pos=None): # Flush the stream. We're mixing buffered I/O with lower-level I/O, # and a flush may be necessary to synch both views of the current # file state. self.flush() if pos is None: pos = self.tell() # XXX: Should seek() be used, instead of passing the position # XXX directly to truncate? return self.raw.truncate(pos) ### Flush and close ### def flush(self): if self.closed: raise ValueError("flush of closed file") self.raw.flush() def close(self): if self.raw is not None and not self.closed: try: # may raise BlockingIOError or BrokenPipeError etc self.flush() finally: self.raw.close() def detach(self): if self.raw is None: raise ValueError("raw stream already detached") self.flush() raw = self._raw self._raw = None return raw ### Inquiries ### def seekable(self): return self.raw.seekable() def readable(self): return self.raw.readable() def writable(self): return self.raw.writable() @property def raw(self): return self._raw @property def closed(self): return self.raw.closed @property def name(self): return self.raw.name @property def mode(self): return self.raw.mode def __getstate__(self): raise TypeError("can not serialize a '{0}' object" .format(self.__class__.__name__)) def __repr__(self): clsname = self.__class__.__name__ try: name = self.name except AttributeError: return "<_pyio.{0}>".format(clsname) else: return "<_pyio.{0} name={1!r}>".format(clsname, name) ### Lower-level APIs ### def fileno(self): return self.raw.fileno() def isatty(self): return self.raw.isatty() class BytesIO(BufferedIOBase): """Buffered I/O implementation using an in-memory bytes buffer.""" def __init__(self, initial_bytes=None): buf = bytearray() if initial_bytes is not None: buf += initial_bytes self._buffer = buf self._pos = 0 def __getstate__(self): if self.closed: raise ValueError("__getstate__ on closed file") return self.__dict__.copy() def getvalue(self): """Return the bytes value (contents) of the buffer """ if self.closed: raise ValueError("getvalue on closed file") return bytes(self._buffer) def getbuffer(self): """Return a readable and writable view of the buffer. """ return memoryview(self._buffer) def read(self, n=None): if self.closed: raise ValueError("read from closed file") if n is None: n = -1 if n < 0: n = len(self._buffer) if len(self._buffer) <= self._pos: return b"" newpos = min(len(self._buffer), self._pos + n) b = self._buffer[self._pos : newpos] self._pos = newpos return bytes(b) def read1(self, n): """This is the same as read. """ return self.read(n) def write(self, b): if self.closed: raise ValueError("write to closed file") if isinstance(b, str): raise TypeError("can't write str to binary stream") n = len(b) if n == 0: return 0 pos = self._pos if pos > len(self._buffer): # Inserts null bytes between the current end of the file # and the new write position. padding = b'\x00' * (pos - len(self._buffer)) self._buffer += padding self._buffer[pos:pos + n] = b self._pos += n return n def seek(self, pos, whence=0): if self.closed: raise ValueError("seek on closed file") try: pos.__index__ except AttributeError as err: raise TypeError("an integer is required") from err if whence == 0: if pos < 0: raise ValueError("negative seek position %r" % (pos,)) self._pos = pos elif whence == 1: self._pos = max(0, self._pos + pos) elif whence == 2: self._pos = max(0, len(self._buffer) + pos) else: raise ValueError("unsupported whence value") return self._pos def tell(self): if self.closed: raise ValueError("tell on closed file") return self._pos def truncate(self, pos=None): if self.closed: raise ValueError("truncate on closed file") if pos is None: pos = self._pos else: try: pos.__index__ except AttributeError as err: raise TypeError("an integer is required") from err if pos < 0: raise ValueError("negative truncate position %r" % (pos,)) del self._buffer[pos:] return pos def readable(self): if self.closed: raise ValueError("I/O operation on closed file.") return True def writable(self): if self.closed: raise ValueError("I/O operation on closed file.") return True def seekable(self): if self.closed: raise ValueError("I/O operation on closed file.") return True class BufferedReader(_BufferedIOMixin): """BufferedReader(raw[, buffer_size]) A buffer for a readable, sequential BaseRawIO object. The constructor creates a BufferedReader for the given readable raw stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE is used. """ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): """Create a new buffered reader using the given readable raw IO object. """ if not raw.readable(): raise IOError('"raw" argument must be readable.') _BufferedIOMixin.__init__(self, raw) if buffer_size <= 0: raise ValueError("invalid buffer size") self.buffer_size = buffer_size self._reset_read_buf() self._read_lock = Lock() def _reset_read_buf(self): self._read_buf = b"" self._read_pos = 0 def read(self, n=None): """Read n bytes. Returns exactly n bytes of data unless the underlying raw IO stream reaches EOF or if the call would block in non-blocking mode. If n is negative, read until EOF or until read() would block. """ if n is not None and n < -1: raise ValueError("invalid number of bytes to read") with self._read_lock: return self._read_unlocked(n) def _read_unlocked(self, n=None): nodata_val = b"" empty_values = (b"", None) buf = self._read_buf pos = self._read_pos # Special case for when the number of bytes to read is unspecified. if n is None or n == -1: self._reset_read_buf() if hasattr(self.raw, 'readall'): chunk = self.raw.readall() if chunk is None: return buf[pos:] or None else: return buf[pos:] + chunk chunks = [buf[pos:]] # Strip the consumed bytes. current_size = 0 while True: # Read until EOF or until read() would block. try: chunk = self.raw.read() except InterruptedError: continue if chunk in empty_values: nodata_val = chunk break current_size += len(chunk) chunks.append(chunk) return b"".join(chunks) or nodata_val # The number of bytes to read is specified, return at most n bytes. avail = len(buf) - pos # Length of the available buffered data. if n <= avail: # Fast path: the data to read is fully buffered. self._read_pos += n return buf[pos:pos+n] # Slow path: read from the stream until enough bytes are read, # or until an EOF occurs or until read() would block. chunks = [buf[pos:]] wanted = max(self.buffer_size, n) while avail < n: try: chunk = self.raw.read(wanted) except InterruptedError: continue if chunk in empty_values: nodata_val = chunk break avail += len(chunk) chunks.append(chunk) # n is more then avail only when an EOF occurred or when # read() would have blocked. n = min(n, avail) out = b"".join(chunks) self._read_buf = out[n:] # Save the extra data in the buffer. self._read_pos = 0 return out[:n] if out else nodata_val def peek(self, n=0): """Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size. """ with self._read_lock: return self._peek_unlocked(n) def _peek_unlocked(self, n=0): want = min(n, self.buffer_size) have = len(self._read_buf) - self._read_pos if have < want or have <= 0: to_read = self.buffer_size - have while True: try: current = self.raw.read(to_read) except InterruptedError: continue break if current: self._read_buf = self._read_buf[self._read_pos:] + current self._read_pos = 0 return self._read_buf[self._read_pos:] def read1(self, n): """Reads up to n bytes, with at most one read() system call.""" # Returns up to n bytes. If at least one byte is buffered, we # only return buffered bytes. Otherwise, we do one raw read. if n < 0: raise ValueError("number of bytes to read must be positive") if n == 0: return b"" with self._read_lock: self._peek_unlocked(1) return self._read_unlocked( min(n, len(self._read_buf) - self._read_pos)) def tell(self): return _BufferedIOMixin.tell(self) - len(self._read_buf) + self._read_pos def seek(self, pos, whence=0): if whence not in valid_seek_flags: raise ValueError("invalid whence value") with self._read_lock: if whence == 1: pos -= len(self._read_buf) - self._read_pos pos = _BufferedIOMixin.seek(self, pos, whence) self._reset_read_buf() return pos class BufferedWriter(_BufferedIOMixin): """A buffer for a writeable sequential RawIO object. The constructor creates a BufferedWriter for the given writeable raw stream. If the buffer_size is not given, it defaults to DEFAULT_BUFFER_SIZE. """ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): if not raw.writable(): raise IOError('"raw" argument must be writable.') _BufferedIOMixin.__init__(self, raw) if buffer_size <= 0: raise ValueError("invalid buffer size") self.buffer_size = buffer_size self._write_buf = bytearray() self._write_lock = Lock() def write(self, b): if self.closed: raise ValueError("write to closed file") if isinstance(b, str): raise TypeError("can't write str to binary stream") with self._write_lock: # XXX we can implement some more tricks to try and avoid # partial writes if len(self._write_buf) > self.buffer_size: # We're full, so let's pre-flush the buffer. (This may # raise BlockingIOError with characters_written == 0.) self._flush_unlocked() before = len(self._write_buf) self._write_buf.extend(b) written = len(self._write_buf) - before if len(self._write_buf) > self.buffer_size: try: self._flush_unlocked() except BlockingIOError as e: if len(self._write_buf) > self.buffer_size: # We've hit the buffer_size. We have to accept a partial # write and cut back our buffer. overage = len(self._write_buf) - self.buffer_size written -= overage self._write_buf = self._write_buf[:self.buffer_size] raise BlockingIOError(e.errno, e.strerror, written) return written def truncate(self, pos=None): with self._write_lock: self._flush_unlocked() if pos is None: pos = self.raw.tell() return self.raw.truncate(pos) def flush(self): with self._write_lock: self._flush_unlocked() def _flush_unlocked(self): if self.closed: raise ValueError("flush of closed file") while self._write_buf: try: n = self.raw.write(self._write_buf) except InterruptedError: continue except BlockingIOError: raise RuntimeError("self.raw should implement RawIOBase: it " "should not raise BlockingIOError") if n is None: raise BlockingIOError( errno.EAGAIN, "write could not complete without blocking", 0) if n > len(self._write_buf) or n < 0: raise IOError("write() returned incorrect number of bytes") del self._write_buf[:n] def tell(self): return _BufferedIOMixin.tell(self) + len(self._write_buf) def seek(self, pos, whence=0): if whence not in valid_seek_flags: raise ValueError("invalid whence value") with self._write_lock: self._flush_unlocked() return _BufferedIOMixin.seek(self, pos, whence) class BufferedRWPair(BufferedIOBase): """A buffered reader and writer object together. A buffered reader object and buffered writer object put together to form a sequential IO object that can read and write. This is typically used with a socket or two-way pipe. reader and writer are RawIOBase objects that are readable and writeable respectively. If the buffer_size is omitted it defaults to DEFAULT_BUFFER_SIZE. """ # XXX The usefulness of this (compared to having two separate IO # objects) is questionable. def __init__(self, reader, writer, buffer_size=DEFAULT_BUFFER_SIZE): """Constructor. The arguments are two RawIO instances. """ if not reader.readable(): raise IOError('"reader" argument must be readable.') if not writer.writable(): raise IOError('"writer" argument must be writable.') self.reader = BufferedReader(reader, buffer_size) self.writer = BufferedWriter(writer, buffer_size) def read(self, n=None): if n is None: n = -1 return self.reader.read(n) def readinto(self, b): return self.reader.readinto(b) def write(self, b): return self.writer.write(b) def peek(self, n=0): return self.reader.peek(n) def read1(self, n): return self.reader.read1(n) def readable(self): return self.reader.readable() def writable(self): return self.writer.writable() def flush(self): return self.writer.flush() def close(self): self.writer.close() self.reader.close() def isatty(self): return self.reader.isatty() or self.writer.isatty() @property def closed(self): return self.writer.closed class BufferedRandom(BufferedWriter, BufferedReader): """A buffered interface to random access streams. The constructor creates a reader and writer for a seekable stream, raw, given in the first argument. If the buffer_size is omitted it defaults to DEFAULT_BUFFER_SIZE. """ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): raw._checkSeekable() BufferedReader.__init__(self, raw, buffer_size) BufferedWriter.__init__(self, raw, buffer_size) def seek(self, pos, whence=0): if whence not in valid_seek_flags: raise ValueError("invalid whence value") self.flush() if self._read_buf: # Undo read ahead. with self._read_lock: self.raw.seek(self._read_pos - len(self._read_buf), 1) # First do the raw seek, then empty the read buffer, so that # if the raw seek fails, we don't lose buffered data forever. pos = self.raw.seek(pos, whence) with self._read_lock: self._reset_read_buf() if pos < 0: raise IOError("seek() returned invalid position") return pos def tell(self): if self._write_buf: return BufferedWriter.tell(self) else: return BufferedReader.tell(self) def truncate(self, pos=None): if pos is None: pos = self.tell() # Use seek to flush the read buffer. return BufferedWriter.truncate(self, pos) def read(self, n=None): if n is None: n = -1 self.flush() return BufferedReader.read(self, n) def readinto(self, b): self.flush() return BufferedReader.readinto(self, b) def peek(self, n=0): self.flush() return BufferedReader.peek(self, n) def read1(self, n): self.flush() return BufferedReader.read1(self, n) def write(self, b): if self._read_buf: # Undo readahead with self._read_lock: self.raw.seek(self._read_pos - len(self._read_buf), 1) self._reset_read_buf() return BufferedWriter.write(self, b) class TextIOBase(IOBase): """Base class for text I/O. This class provides a character and line based interface to stream I/O. There is no readinto method because Python's character strings are immutable. There is no public constructor. """ def read(self, n=-1): """Read at most n characters from stream, where n is an int. Read from underlying buffer until we have n characters or we hit EOF. If n is negative or omitted, read until EOF. Returns a string. """ self._unsupported("read") def write(self, s): """Write string s to stream and returning an int.""" self._unsupported("write") def truncate(self, pos=None): """Truncate size to pos, where pos is an int.""" self._unsupported("truncate") def readline(self): """Read until newline or EOF. Returns an empty string if EOF is hit immediately. """ self._unsupported("readline") def detach(self): """ Separate the underlying buffer from the TextIOBase and return it. After the underlying buffer has been detached, the TextIO is in an unusable state. """ self._unsupported("detach") @property def encoding(self): """Subclasses should override.""" return None @property def newlines(self): """Line endings translated so far. Only line endings translated during reading are considered. Subclasses should override. """ return None @property def errors(self): """Error setting of the decoder or encoder. Subclasses should override.""" return None io.TextIOBase.register(TextIOBase) class IncrementalNewlineDecoder(codecs.IncrementalDecoder): r"""Codec used when reading a file in universal newlines mode. It wraps another incremental decoder, translating \r\n and \r into \n. It also records the types of newlines encountered. When used with translate=False, it ensures that the newline sequence is returned in one piece. """ def __init__(self, decoder, translate, errors='strict'): codecs.IncrementalDecoder.__init__(self, errors=errors) self.translate = translate self.decoder = decoder self.seennl = 0 self.pendingcr = False def decode(self, input, final=False): # decode input (with the eventual \r from a previous pass) if self.decoder is None: output = input else: output = self.decoder.decode(input, final=final) if self.pendingcr and (output or final): output = "\r" + output self.pendingcr = False # retain last \r even when not translating data: # then readline() is sure to get \r\n in one pass if output.endswith("\r") and not final: output = output[:-1] self.pendingcr = True # Record which newlines are read crlf = output.count('\r\n') cr = output.count('\r') - crlf lf = output.count('\n') - crlf self.seennl |= (lf and self._LF) | (cr and self._CR) \ | (crlf and self._CRLF) if self.translate: if crlf: output = output.replace("\r\n", "\n") if cr: output = output.replace("\r", "\n") return output def getstate(self): if self.decoder is None: buf = b"" flag = 0 else: buf, flag = self.decoder.getstate() flag <<= 1 if self.pendingcr: flag |= 1 return buf, flag def setstate(self, state): buf, flag = state self.pendingcr = bool(flag & 1) if self.decoder is not None: self.decoder.setstate((buf, flag >> 1)) def reset(self): self.seennl = 0 self.pendingcr = False if self.decoder is not None: self.decoder.reset() _LF = 1 _CR = 2 _CRLF = 4 @property def newlines(self): return (None, "\n", "\r", ("\r", "\n"), "\r\n", ("\n", "\r\n"), ("\r", "\r\n"), ("\r", "\n", "\r\n") )[self.seennl] class TextIOWrapper(TextIOBase): r"""Character and line based layer over a BufferedIOBase object, buffer. encoding gives the name of the encoding that the stream will be decoded or encoded with. It defaults to locale.getpreferredencoding(False). errors determines the strictness of encoding and decoding (see the codecs.register) and defaults to "strict". newline can be None, '', '\n', '\r', or '\r\n'. It controls the handling of line endings. If it is None, universal newlines is enabled. With this enabled, on input, the lines endings '\n', '\r', or '\r\n' are translated to '\n' before being returned to the caller. Conversely, on output, '\n' is translated to the system default line separator, os.linesep. If newline is any other of its legal values, that newline becomes the newline when the file is read and it is returned untranslated. On output, '\n' is converted to the newline. If line_buffering is True, a call to flush is implied when a call to write contains a newline character. """ _CHUNK_SIZE = 2048 # The write_through argument has no effect here since this # implementation always writes through. The argument is present only # so that the signature can match the signature of the C version. def __init__(self, buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False): if newline is not None and not isinstance(newline, str): raise TypeError("illegal newline type: %r" % (type(newline),)) if newline not in (None, "", "\n", "\r", "\r\n"): raise ValueError("illegal newline value: %r" % (newline,)) if encoding is None: try: encoding = os.device_encoding(buffer.fileno()) except (AttributeError, UnsupportedOperation): pass if encoding is None: try: import locale except ImportError: # Importing locale may fail if Python is being built encoding = "ascii" else: encoding = locale.getpreferredencoding(False) if not isinstance(encoding, str): raise ValueError("invalid encoding: %r" % encoding) if errors is None: errors = "strict" else: if not isinstance(errors, str): raise ValueError("invalid errors: %r" % errors) self._buffer = buffer self._line_buffering = line_buffering self._encoding = encoding self._errors = errors self._readuniversal = not newline self._readtranslate = newline is None self._readnl = newline self._writetranslate = newline != '' self._writenl = newline or os.linesep self._encoder = None self._decoder = None self._decoded_chars = '' # buffer for text returned from decoder self._decoded_chars_used = 0 # offset into _decoded_chars for read() self._snapshot = None # info for reconstructing decoder state self._seekable = self._telling = self.buffer.seekable() self._has_read1 = hasattr(self.buffer, 'read1') self._b2cratio = 0.0 if self._seekable and self.writable(): position = self.buffer.tell() if position != 0: try: self._get_encoder().setstate(0) except LookupError: # Sometimes the encoder doesn't exist pass # self._snapshot is either None, or a tuple (dec_flags, next_input) # where dec_flags is the second (integer) item of the decoder state # and next_input is the chunk of input bytes that comes next after the # snapshot point. We use this to reconstruct decoder states in tell(). # Naming convention: # - "bytes_..." for integer variables that count input bytes # - "chars_..." for integer variables that count decoded characters def __repr__(self): result = "<_pyio.TextIOWrapper" try: name = self.name except AttributeError: pass else: result += " name={0!r}".format(name) try: mode = self.mode except AttributeError: pass else: result += " mode={0!r}".format(mode) return result + " encoding={0!r}>".format(self.encoding) @property def encoding(self): return self._encoding @property def errors(self): return self._errors @property def line_buffering(self): return self._line_buffering @property def buffer(self): return self._buffer def seekable(self): if self.closed: raise ValueError("I/O operation on closed file.") return self._seekable def readable(self): return self.buffer.readable() def writable(self): return self.buffer.writable() def flush(self): self.buffer.flush() self._telling = self._seekable def close(self): if self.buffer is not None and not self.closed: try: self.flush() finally: self.buffer.close() @property def closed(self): return self.buffer.closed @property def name(self): return self.buffer.name def fileno(self): return self.buffer.fileno() def isatty(self): return self.buffer.isatty() def write(self, s): 'Write data, where s is a str' if self.closed: raise ValueError("write to closed file") if not isinstance(s, str): raise TypeError("can't write %s to text stream" % s.__class__.__name__) length = len(s) haslf = (self._writetranslate or self._line_buffering) and "\n" in s if haslf and self._writetranslate and self._writenl != "\n": s = s.replace("\n", self._writenl) encoder = self._encoder or self._get_encoder() # XXX What if we were just reading? b = encoder.encode(s) self.buffer.write(b) if self._line_buffering and (haslf or "\r" in s): self.flush() self._snapshot = None if self._decoder: self._decoder.reset() return length def _get_encoder(self): make_encoder = codecs.getincrementalencoder(self._encoding) self._encoder = make_encoder(self._errors) return self._encoder def _get_decoder(self): make_decoder = codecs.getincrementaldecoder(self._encoding) decoder = make_decoder(self._errors) if self._readuniversal: decoder = IncrementalNewlineDecoder(decoder, self._readtranslate) self._decoder = decoder return decoder # The following three methods implement an ADT for _decoded_chars. # Text returned from the decoder is buffered here until the client # requests it by calling our read() or readline() method. def _set_decoded_chars(self, chars): """Set the _decoded_chars buffer.""" self._decoded_chars = chars self._decoded_chars_used = 0 def _get_decoded_chars(self, n=None): """Advance into the _decoded_chars buffer.""" offset = self._decoded_chars_used if n is None: chars = self._decoded_chars[offset:] else: chars = self._decoded_chars[offset:offset + n] self._decoded_chars_used += len(chars) return chars def _rewind_decoded_chars(self, n): """Rewind the _decoded_chars buffer.""" if self._decoded_chars_used < n: raise AssertionError("rewind decoded_chars out of bounds") self._decoded_chars_used -= n def _read_chunk(self): """ Read and decode the next chunk of data from the BufferedReader. """ # The return value is True unless EOF was reached. The decoded # string is placed in self._decoded_chars (replacing its previous # value). The entire input chunk is sent to the decoder, though # some of it may remain buffered in the decoder, yet to be # converted. if self._decoder is None: raise ValueError("no decoder") if self._telling: # To prepare for tell(), we need to snapshot a point in the # file where the decoder's input buffer is empty. dec_buffer, dec_flags = self._decoder.getstate() # Given this, we know there was a valid snapshot point # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). # Read a chunk, decode it, and put the result in self._decoded_chars. if self._has_read1: input_chunk = self.buffer.read1(self._CHUNK_SIZE) else: input_chunk = self.buffer.read(self._CHUNK_SIZE) eof = not input_chunk decoded_chars = self._decoder.decode(input_chunk, eof) self._set_decoded_chars(decoded_chars) if decoded_chars: self._b2cratio = len(input_chunk) / len(self._decoded_chars) else: self._b2cratio = 0.0 if self._telling: # At the snapshot point, len(dec_buffer) bytes before the read, # the next input to be decoded is dec_buffer + input_chunk. self._snapshot = (dec_flags, dec_buffer + input_chunk) return not eof def _pack_cookie(self, position, dec_flags=0, bytes_to_feed=0, need_eof=0, chars_to_skip=0): # The meaning of a tell() cookie is: seek to position, set the # decoder flags to dec_flags, read bytes_to_feed bytes, feed them # into the decoder with need_eof as the EOF flag, then skip # chars_to_skip characters of the decoded result. For most simple # decoders, tell() will often just give a byte offset in the file. return (position | (dec_flags<<64) | (bytes_to_feed<<128) | (chars_to_skip<<192) | bool(need_eof)<<256) def _unpack_cookie(self, bigint): rest, position = divmod(bigint, 1<<64) rest, dec_flags = divmod(rest, 1<<64) rest, bytes_to_feed = divmod(rest, 1<<64) need_eof, chars_to_skip = divmod(rest, 1<<64) return position, dec_flags, bytes_to_feed, need_eof, chars_to_skip def tell(self): if not self._seekable: raise UnsupportedOperation("underlying stream is not seekable") if not self._telling: raise IOError("telling position disabled by next() call") self.flush() position = self.buffer.tell() decoder = self._decoder if decoder is None or self._snapshot is None: if self._decoded_chars: # This should never happen. raise AssertionError("pending decoded text") return position # Skip backward to the snapshot point (see _read_chunk). dec_flags, next_input = self._snapshot position -= len(next_input) # How many decoded characters have been used up since the snapshot? chars_to_skip = self._decoded_chars_used if chars_to_skip == 0: # We haven't moved from the snapshot point. return self._pack_cookie(position, dec_flags) # Starting from the snapshot position, we will walk the decoder # forward until it gives us enough decoded characters. saved_state = decoder.getstate() try: # Fast search for an acceptable start point, close to our # current pos. # Rationale: calling decoder.decode() has a large overhead # regardless of chunk size; we want the number of such calls to # be O(1) in most situations (common decoders, non-crazy input). # Actually, it will be exactly 1 for fixed-size codecs (all # 8-bit codecs, also UTF-16 and UTF-32). skip_bytes = int(self._b2cratio * chars_to_skip) skip_back = 1 assert skip_bytes <= len(next_input) while skip_bytes > 0: decoder.setstate((b'', dec_flags)) # Decode up to temptative start point n = len(decoder.decode(next_input[:skip_bytes])) if n <= chars_to_skip: b, d = decoder.getstate() if not b: # Before pos and no bytes buffered in decoder => OK dec_flags = d chars_to_skip -= n break # Skip back by buffered amount and reset heuristic skip_bytes -= len(b) skip_back = 1 else: # We're too far ahead, skip back a bit skip_bytes -= skip_back skip_back = skip_back * 2 else: skip_bytes = 0 decoder.setstate((b'', dec_flags)) # Note our initial start point. start_pos = position + skip_bytes start_flags = dec_flags if chars_to_skip == 0: # We haven't moved from the start point. return self._pack_cookie(start_pos, start_flags) # Feed the decoder one byte at a time. As we go, note the # nearest "safe start point" before the current location # (a point where the decoder has nothing buffered, so seek() # can safely start from there and advance to this location). bytes_fed = 0 need_eof = 0 # Chars decoded since `start_pos` chars_decoded = 0 for i in range(skip_bytes, len(next_input)): bytes_fed += 1 chars_decoded += len(decoder.decode(next_input[i:i+1])) dec_buffer, dec_flags = decoder.getstate() if not dec_buffer and chars_decoded <= chars_to_skip: # Decoder buffer is empty, so this is a safe start point. start_pos += bytes_fed chars_to_skip -= chars_decoded start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 if chars_decoded >= chars_to_skip: break else: # We didn't get enough decoded data; signal EOF to get more. chars_decoded += len(decoder.decode(b'', final=True)) need_eof = 1 if chars_decoded < chars_to_skip: raise IOError("can't reconstruct logical file position") # The returned cookie corresponds to the last safe start point. return self._pack_cookie( start_pos, start_flags, bytes_fed, need_eof, chars_to_skip) finally: decoder.setstate(saved_state) def truncate(self, pos=None): self.flush() if pos is None: pos = self.tell() return self.buffer.truncate(pos) def detach(self): if self.buffer is None: raise ValueError("buffer is already detached") self.flush() buffer = self._buffer self._buffer = None return buffer def seek(self, cookie, whence=0): if self.closed: raise ValueError("tell on closed file") if not self._seekable: raise UnsupportedOperation("underlying stream is not seekable") if whence == 1: # seek relative to current position if cookie != 0: raise UnsupportedOperation("can't do nonzero cur-relative seeks") # Seeking to the current position should attempt to # sync the underlying buffer with the current position. whence = 0 cookie = self.tell() if whence == 2: # seek relative to end of file if cookie != 0: raise UnsupportedOperation("can't do nonzero end-relative seeks") self.flush() position = self.buffer.seek(0, 2) self._set_decoded_chars('') self._snapshot = None if self._decoder: self._decoder.reset() return position if whence != 0: raise ValueError("unsupported whence (%r)" % (whence,)) if cookie < 0: raise ValueError("negative seek position %r" % (cookie,)) self.flush() # The strategy of seek() is to go back to the safe start point # and replay the effect of read(chars_to_skip) from there. start_pos, dec_flags, bytes_to_feed, need_eof, chars_to_skip = \ self._unpack_cookie(cookie) # Seek back to the safe start point. self.buffer.seek(start_pos) self._set_decoded_chars('') self._snapshot = None # Restore the decoder to its state from the safe start point. if cookie == 0 and self._decoder: self._decoder.reset() elif self._decoder or dec_flags or chars_to_skip: self._decoder = self._decoder or self._get_decoder() self._decoder.setstate((b'', dec_flags)) self._snapshot = (dec_flags, b'') if chars_to_skip: # Just like _read_chunk, feed the decoder and save a snapshot. input_chunk = self.buffer.read(bytes_to_feed) self._set_decoded_chars( self._decoder.decode(input_chunk, need_eof)) self._snapshot = (dec_flags, input_chunk) # Skip chars_to_skip of the decoded characters. if len(self._decoded_chars) < chars_to_skip: raise IOError("can't restore logical file position") self._decoded_chars_used = chars_to_skip # Finally, reset the encoder (merely useful for proper BOM handling) try: encoder = self._encoder or self._get_encoder() except LookupError: # Sometimes the encoder doesn't exist pass else: if cookie != 0: encoder.setstate(0) else: encoder.reset() return cookie def read(self, n=None): self._checkReadable() if n is None: n = -1 decoder = self._decoder or self._get_decoder() try: n.__index__ except AttributeError as err: raise TypeError("an integer is required") from err if n < 0: # Read everything. result = (self._get_decoded_chars() + decoder.decode(self.buffer.read(), final=True)) self._set_decoded_chars('') self._snapshot = None return result else: # Keep reading chunks until we have n characters to return. eof = False result = self._get_decoded_chars(n) while len(result) < n and not eof: eof = not self._read_chunk() result += self._get_decoded_chars(n - len(result)) return result def __next__(self): self._telling = False line = self.readline() if not line: self._snapshot = None self._telling = self._seekable raise StopIteration return line def readline(self, limit=None): if self.closed: raise ValueError("read from closed file") if limit is None: limit = -1 elif not isinstance(limit, int): raise TypeError("limit must be an integer") # Grab all the decoded text (we will rewind any extra bits later). line = self._get_decoded_chars() start = 0 # Make the decoder if it doesn't already exist. if not self._decoder: self._get_decoder() pos = endpos = None while True: if self._readtranslate: # Newlines are already translated, only search for \n pos = line.find('\n', start) if pos >= 0: endpos = pos + 1 break else: start = len(line) elif self._readuniversal: # Universal newline search. Find any of \r, \r\n, \n # The decoder ensures that \r\n are not split in two pieces # In C we'd look for these in parallel of course. nlpos = line.find("\n", start) crpos = line.find("\r", start) if crpos == -1: if nlpos == -1: # Nothing found start = len(line) else: # Found \n endpos = nlpos + 1 break elif nlpos == -1: # Found lone \r endpos = crpos + 1 break elif nlpos < crpos: # Found \n endpos = nlpos + 1 break elif nlpos == crpos + 1: # Found \r\n endpos = crpos + 2 break else: # Found \r endpos = crpos + 1 break else: # non-universal pos = line.find(self._readnl) if pos >= 0: endpos = pos + len(self._readnl) break if limit >= 0 and len(line) >= limit: endpos = limit # reached length limit break # No line ending seen yet - get more data' while self._read_chunk(): if self._decoded_chars: break if self._decoded_chars: line += self._get_decoded_chars() else: # end of file self._set_decoded_chars('') self._snapshot = None return line if limit >= 0 and endpos > limit: endpos = limit # don't exceed limit # Rewind _decoded_chars to just after the line ending we found. self._rewind_decoded_chars(len(line) - endpos) return line[:endpos] @property def newlines(self): return self._decoder.newlines if self._decoder else None class StringIO(TextIOWrapper): """Text I/O implementation using an in-memory buffer. The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper's constructor. """ def __init__(self, initial_value="", newline="\n"): super(StringIO, self).__init__(BytesIO(), encoding="utf-8", errors="strict", newline=newline) # Issue #5645: make universal newlines semantics the same as in the # C version, even under Windows. if newline is None: self._writetranslate = False if initial_value is not None: if not isinstance(initial_value, str): raise TypeError("initial_value must be str or None, not {0}" .format(type(initial_value).__name__)) initial_value = str(initial_value) self.write(initial_value) self.seek(0) def getvalue(self): self.flush() return self.buffer.getvalue().decode(self._encoding, self._errors) def __repr__(self): # TextIOWrapper tells the encoding in its repr. In StringIO, # that's a implementation detail. return object.__repr__(self) @property def errors(self): return None @property def encoding(self): return None def detach(self): # This doesn't make sense on StringIO. self._unsupported("detach")
gpl-2.0
[ 624, 199, 4718, 4514, 402, 314, 5890, 859, 14, 199, 624, 199, 199, 646, 747, 199, 646, 13022, 199, 646, 6010, 199, 646, 7554, 199, 3, 3161, 485, 2671, 3140, 402, 5796, 370, 7114, 14210, 7918, 199, 893, 26, 272, 687, 485, 2671, 492, 18310, 63, 831, 465, 15536, 199, 2590, 3545, 26, 272, 687, 485, 5869, 63, 2671, 492, 18310, 63, 831, 465, 15536, 199, 199, 646, 5890, 199, 504, 5890, 492, 25373, 452, 3108, 5795, 11959, 63, 3597, 12, 5795, 11959, 63, 7013, 12, 5795, 11959, 63, 3902, 9, 199, 199, 1078, 63, 5507, 63, 2469, 275, 469, 16, 12, 413, 12, 499, 93, 221, 327, 22825, 14249, 581, 1338, 199, 692, 2688, 8, 736, 12, 283, 18439, 63, 2979, 906, 358, 520, 272, 1686, 63, 5507, 63, 2469, 14, 525, 8, 736, 14, 18439, 63, 2979, 906, 9, 272, 1686, 63, 5507, 63, 2469, 14, 525, 8, 736, 14, 18439, 63, 3998, 9, 199, 199, 3, 1551, 342, 4440, 410, 63, 14023, 890, 18119, 781, 883, 199, 3472, 63, 10960, 63, 4305, 275, 1695, 627, 6619, 221, 327, 2783, 199, 199, 3, 6944, 26, 3523, 3992, 3247, 2348, 787, 7264, 543, 314, 298, 29260, 2, 17281, 83, 199, 3, 3247, 315, 5890, 14, 647, 14, 2136, 2793, 1133, 675, 3363, 15433, 10617, 12, 2952, 781, 2793, 1133, 199, 3, 2934, 370, 8287, 314, 445, 12591, 14, 199, 199, 3, 799, 3409, 367, 7163, 199, 27132, 13760, 275, 8651, 316, 13760, 421, 199, 318, 1551, 8, 493, 12, 818, 628, 82, 401, 21033, 4022, 17, 12, 2644, 29, 403, 12, 2552, 29, 403, 12, 268, 8057, 29, 403, 12, 4002, 2592, 29, 549, 12, 16088, 29, 403, 304, 339, 519, 624, 4299, 570, 436, 372, 282, 2547, 14, 221, 14771, 5925, 12188, 5988, 14, 339, 570, 365, 1902, 282, 1318, 503, 3696, 1059, 15131, 314, 536, 334, 460, 314, 931, 272, 340, 314, 570, 5712, 1133, 315, 314, 1453, 6449, 2082, 9, 402, 314, 570, 370, 272, 506, 12123, 503, 376, 3000, 570, 5872, 402, 314, 570, 370, 506, 272, 8072, 14, 334, 3917, 282, 570, 5872, 365, 1627, 12, 652, 365, 6876, 1380, 314, 272, 2138, 473, 15, 47, 909, 365, 6876, 12, 7444, 4002, 2592, 365, 663, 370, 756, 4959, 339, 818, 365, 376, 2716, 1059, 626, 9314, 314, 818, 315, 1314, 314, 570, 365, 272, 12123, 14, 2779, 4243, 370, 283, 82, 7, 1314, 4910, 1551, 367, 7664, 315, 1318, 818, 14, 5439, 272, 2863, 1338, 787, 283, 87, 7, 367, 3575, 334, 8208, 1958, 314, 570, 340, 652, 2575, 272, 3495, 395, 283, 88, 7, 367, 13914, 7143, 402, 282, 892, 570, 12, 436, 283, 65, 7, 367, 24373, 272, 334, 6777, 641, 2005, 13074, 10460, 12, 4910, 626, 1006, 14511, 5666, 370, 314, 1284, 402, 314, 272, 570, 15270, 402, 314, 1453, 12005, 3421, 680, 1010, 1318, 818, 12, 340, 2644, 365, 272, 440, 2013, 314, 2644, 1202, 365, 4298, 11410, 14, 334, 1858, 7664, 436, 272, 3575, 3066, 2783, 675, 3366, 818, 436, 10137, 2644, 21994, 4959, 710, 272, 2808, 12404, 787, 26, 339, 275, 763, 19691, 17224, 272, 17660, 25136, 316, 272, 3001, 13, 9527, 18964, 272, 283, 82, 7, 755, 1551, 367, 7664, 334, 885, 9, 272, 283, 87, 7, 755, 1551, 367, 3575, 12, 8181, 67, 1958, 314, 570, 1642, 272, 283, 88, 7, 755, 1218, 282, 892, 570, 436, 1551, 652, 367, 3575, 272, 283, 65, 7, 755, 1551, 367, 3575, 12, 24373, 370, 314, 1284, 402, 314, 570, 340, 652, 3495, 272, 283, 66, 7, 755, 3366, 818, 272, 283, 84, 7, 755, 1318, 818, 334, 885, 9, 272, 20246, 755, 1551, 282, 4543, 570, 367, 12928, 334, 19332, 436, 3575, 9, 272, 283, 53, 7, 755, 17508, 8057, 818, 334, 509, 8552, 7163, 27, 625, 11368, 1598, 367, 892, 1233, 9, 272, 275, 763, 19691, 17224, 339, 710, 849, 818, 365, 283, 2591, 7, 334, 1490, 367, 7664, 1318, 680, 2104, 3366, 2196, 272, 2879, 12, 314, 818, 283, 87, 11, 66, 7, 30848, 436, 14547, 83, 314, 570, 370, 378, 2783, 12, 1830, 272, 283, 82, 11, 66, 7, 30848, 314, 570, 1928, 8181, 1063, 14, 710, 283, 88, 7, 818, 22660, 283, 87, 7, 436, 272, 6534, 376, 658, 1173, 23839, 64, 340, 314, 570, 2575, 3495, 14, 339, 2018, 22237, 397, 3382, 1584, 12123, 315, 3366, 436, 1318, 12404, 12, 272, 2755, 1380, 314, 8793, 17406, 2656, 3181, 1133, 14, 16920, 12123, 315, 272, 3366, 818, 334, 740, 316, 283, 66, 7, 370, 314, 818, 1423, 9, 372, 4072, 465, 272, 2783, 2251, 1928, 1263, 15952, 14, 1010, 1318, 818, 334, 1589, 849, 12, 503, 1380, 272, 283, 84, 7, 365, 11544, 370, 314, 818, 1423, 395, 314, 4072, 402, 314, 570, 787, 272, 2138, 465, 3326, 12, 314, 2783, 9445, 2757, 1642, 11203, 1808, 282, 272, 4298, 13, 7106, 2644, 503, 1808, 314, 2013, 2644, 340, 1627, 14, 339, 21033, 365, 376, 2716, 3000, 1202, 370, 663, 314, 21033, 4592, 14, 272, 8325, 378, 370, 6258, 21033, 2331, 334, 2118, 4370, 315, 3366, 818, 395, 413, 370, 3504, 272, 1004, 21033, 334, 2118, 18025, 315, 1318, 818, 395, 436, 376, 3000, 690, 413, 370, 6623, 272, 314, 1568, 402, 282, 6317, 13, 890, 3728, 3335, 14, 221, 3979, 949, 21033, 1423, 365, 272, 1627, 12, 314, 849, 21033, 4592, 5419, 465, 11924, 26, 339, 627, 14161, 1584, 787, 20224, 315, 6317, 13, 890, 8291, 27, 314, 1568, 402, 314, 3335, 489, 365, 12414, 1808, 282, 25332, 9936, 370, 6705, 314, 8793, 2243, 1159, 489, 298, 1457, 1568, 2, 436, 32039, 1771, 641, 658, 2308, 14, 3472, 63, 10960, 63, 4305, 2313, 489, 4068, 5002, 10460, 12, 314, 3335, 911, 13609, 506, 17125, 503, 28828, 2783, 1846, 14, 339, 627, 298, 23879, 2, 1318, 1584, 334, 1725, 367, 1314, 365, 16623, 342, 2529, 715, 9, 489, 675, 1004, 21033, 14, 221, 5439, 1318, 1584, 675, 314, 4592, 11736, 3432, 489, 367, 3366, 1584, 14, 339, 2644, 365, 314, 620, 536, 402, 314, 2644, 1202, 370, 4849, 503, 3752, 314, 272, 570, 14, 961, 1077, 1454, 506, 1202, 315, 1318, 818, 14, 710, 849, 2644, 365, 272, 4298 ]
[ 199, 4718, 4514, 402, 314, 5890, 859, 14, 199, 624, 199, 199, 646, 747, 199, 646, 13022, 199, 646, 6010, 199, 646, 7554, 199, 3, 3161, 485, 2671, 3140, 402, 5796, 370, 7114, 14210, 7918, 199, 893, 26, 272, 687, 485, 2671, 492, 18310, 63, 831, 465, 15536, 199, 2590, 3545, 26, 272, 687, 485, 5869, 63, 2671, 492, 18310, 63, 831, 465, 15536, 199, 199, 646, 5890, 199, 504, 5890, 492, 25373, 452, 3108, 5795, 11959, 63, 3597, 12, 5795, 11959, 63, 7013, 12, 5795, 11959, 63, 3902, 9, 199, 199, 1078, 63, 5507, 63, 2469, 275, 469, 16, 12, 413, 12, 499, 93, 221, 327, 22825, 14249, 581, 1338, 199, 692, 2688, 8, 736, 12, 283, 18439, 63, 2979, 906, 358, 520, 272, 1686, 63, 5507, 63, 2469, 14, 525, 8, 736, 14, 18439, 63, 2979, 906, 9, 272, 1686, 63, 5507, 63, 2469, 14, 525, 8, 736, 14, 18439, 63, 3998, 9, 199, 199, 3, 1551, 342, 4440, 410, 63, 14023, 890, 18119, 781, 883, 199, 3472, 63, 10960, 63, 4305, 275, 1695, 627, 6619, 221, 327, 2783, 199, 199, 3, 6944, 26, 3523, 3992, 3247, 2348, 787, 7264, 543, 314, 298, 29260, 2, 17281, 83, 199, 3, 3247, 315, 5890, 14, 647, 14, 2136, 2793, 1133, 675, 3363, 15433, 10617, 12, 2952, 781, 2793, 1133, 199, 3, 2934, 370, 8287, 314, 445, 12591, 14, 199, 199, 3, 799, 3409, 367, 7163, 199, 27132, 13760, 275, 8651, 316, 13760, 421, 199, 318, 1551, 8, 493, 12, 818, 628, 82, 401, 21033, 4022, 17, 12, 2644, 29, 403, 12, 2552, 29, 403, 12, 268, 8057, 29, 403, 12, 4002, 2592, 29, 549, 12, 16088, 29, 403, 304, 339, 519, 624, 4299, 570, 436, 372, 282, 2547, 14, 221, 14771, 5925, 12188, 5988, 14, 339, 570, 365, 1902, 282, 1318, 503, 3696, 1059, 15131, 314, 536, 334, 460, 314, 931, 272, 340, 314, 570, 5712, 1133, 315, 314, 1453, 6449, 2082, 9, 402, 314, 570, 370, 272, 506, 12123, 503, 376, 3000, 570, 5872, 402, 314, 570, 370, 506, 272, 8072, 14, 334, 3917, 282, 570, 5872, 365, 1627, 12, 652, 365, 6876, 1380, 314, 272, 2138, 473, 15, 47, 909, 365, 6876, 12, 7444, 4002, 2592, 365, 663, 370, 756, 4959, 339, 818, 365, 376, 2716, 1059, 626, 9314, 314, 818, 315, 1314, 314, 570, 365, 272, 12123, 14, 2779, 4243, 370, 283, 82, 7, 1314, 4910, 1551, 367, 7664, 315, 1318, 818, 14, 5439, 272, 2863, 1338, 787, 283, 87, 7, 367, 3575, 334, 8208, 1958, 314, 570, 340, 652, 2575, 272, 3495, 395, 283, 88, 7, 367, 13914, 7143, 402, 282, 892, 570, 12, 436, 283, 65, 7, 367, 24373, 272, 334, 6777, 641, 2005, 13074, 10460, 12, 4910, 626, 1006, 14511, 5666, 370, 314, 1284, 402, 314, 272, 570, 15270, 402, 314, 1453, 12005, 3421, 680, 1010, 1318, 818, 12, 340, 2644, 365, 272, 440, 2013, 314, 2644, 1202, 365, 4298, 11410, 14, 334, 1858, 7664, 436, 272, 3575, 3066, 2783, 675, 3366, 818, 436, 10137, 2644, 21994, 4959, 710, 272, 2808, 12404, 787, 26, 339, 275, 763, 19691, 17224, 272, 17660, 25136, 316, 272, 3001, 13, 9527, 18964, 272, 283, 82, 7, 755, 1551, 367, 7664, 334, 885, 9, 272, 283, 87, 7, 755, 1551, 367, 3575, 12, 8181, 67, 1958, 314, 570, 1642, 272, 283, 88, 7, 755, 1218, 282, 892, 570, 436, 1551, 652, 367, 3575, 272, 283, 65, 7, 755, 1551, 367, 3575, 12, 24373, 370, 314, 1284, 402, 314, 570, 340, 652, 3495, 272, 283, 66, 7, 755, 3366, 818, 272, 283, 84, 7, 755, 1318, 818, 334, 885, 9, 272, 20246, 755, 1551, 282, 4543, 570, 367, 12928, 334, 19332, 436, 3575, 9, 272, 283, 53, 7, 755, 17508, 8057, 818, 334, 509, 8552, 7163, 27, 625, 11368, 1598, 367, 892, 1233, 9, 272, 275, 763, 19691, 17224, 339, 710, 849, 818, 365, 283, 2591, 7, 334, 1490, 367, 7664, 1318, 680, 2104, 3366, 2196, 272, 2879, 12, 314, 818, 283, 87, 11, 66, 7, 30848, 436, 14547, 83, 314, 570, 370, 378, 2783, 12, 1830, 272, 283, 82, 11, 66, 7, 30848, 314, 570, 1928, 8181, 1063, 14, 710, 283, 88, 7, 818, 22660, 283, 87, 7, 436, 272, 6534, 376, 658, 1173, 23839, 64, 340, 314, 570, 2575, 3495, 14, 339, 2018, 22237, 397, 3382, 1584, 12123, 315, 3366, 436, 1318, 12404, 12, 272, 2755, 1380, 314, 8793, 17406, 2656, 3181, 1133, 14, 16920, 12123, 315, 272, 3366, 818, 334, 740, 316, 283, 66, 7, 370, 314, 818, 1423, 9, 372, 4072, 465, 272, 2783, 2251, 1928, 1263, 15952, 14, 1010, 1318, 818, 334, 1589, 849, 12, 503, 1380, 272, 283, 84, 7, 365, 11544, 370, 314, 818, 1423, 395, 314, 4072, 402, 314, 570, 787, 272, 2138, 465, 3326, 12, 314, 2783, 9445, 2757, 1642, 11203, 1808, 282, 272, 4298, 13, 7106, 2644, 503, 1808, 314, 2013, 2644, 340, 1627, 14, 339, 21033, 365, 376, 2716, 3000, 1202, 370, 663, 314, 21033, 4592, 14, 272, 8325, 378, 370, 6258, 21033, 2331, 334, 2118, 4370, 315, 3366, 818, 395, 413, 370, 3504, 272, 1004, 21033, 334, 2118, 18025, 315, 1318, 818, 395, 436, 376, 3000, 690, 413, 370, 6623, 272, 314, 1568, 402, 282, 6317, 13, 890, 3728, 3335, 14, 221, 3979, 949, 21033, 1423, 365, 272, 1627, 12, 314, 849, 21033, 4592, 5419, 465, 11924, 26, 339, 627, 14161, 1584, 787, 20224, 315, 6317, 13, 890, 8291, 27, 314, 1568, 402, 314, 3335, 489, 365, 12414, 1808, 282, 25332, 9936, 370, 6705, 314, 8793, 2243, 1159, 489, 298, 1457, 1568, 2, 436, 32039, 1771, 641, 658, 2308, 14, 3472, 63, 10960, 63, 4305, 2313, 489, 4068, 5002, 10460, 12, 314, 3335, 911, 13609, 506, 17125, 503, 28828, 2783, 1846, 14, 339, 627, 298, 23879, 2, 1318, 1584, 334, 1725, 367, 1314, 365, 16623, 342, 2529, 715, 9, 489, 675, 1004, 21033, 14, 221, 5439, 1318, 1584, 675, 314, 4592, 11736, 3432, 489, 367, 3366, 1584, 14, 339, 2644, 365, 314, 620, 536, 402, 314, 2644, 1202, 370, 4849, 503, 3752, 314, 272, 570, 14, 961, 1077, 1454, 506, 1202, 315, 1318, 818, 14, 710, 849, 2644, 365, 272, 4298, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
ellasafy/shadowsocks
shadowsocks/crypto/table.py
1044
8108
# !/usr/bin/env python # # Copyright 2015 clowwindy # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import absolute_import, division, print_function, \ with_statement import string import struct import hashlib __all__ = ['ciphers'] cached_tables = {} if hasattr(string, 'maketrans'): maketrans = string.maketrans translate = string.translate else: maketrans = bytes.maketrans translate = bytes.translate def get_table(key): m = hashlib.md5() m.update(key) s = m.digest() a, b = struct.unpack('<QQ', s) table = maketrans(b'', b'') table = [table[i: i + 1] for i in range(len(table))] for i in range(1, 1024): table.sort(key=lambda x: int(a % (ord(x) + i))) return table def init_table(key): if key not in cached_tables: encrypt_table = b''.join(get_table(key)) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) cached_tables[key] = [encrypt_table, decrypt_table] return cached_tables[key] class TableCipher(object): def __init__(self, cipher_name, key, iv, op): self._encrypt_table, self._decrypt_table = init_table(key) self._op = op def update(self, data): if self._op: return translate(data, self._encrypt_table) else: return translate(data, self._decrypt_table) ciphers = { 'table': (0, 0, TableCipher) } def test_table_result(): from shadowsocks.common import ord target1 = [ [60, 53, 84, 138, 217, 94, 88, 23, 39, 242, 219, 35, 12, 157, 165, 181, 255, 143, 83, 247, 162, 16, 31, 209, 190, 171, 115, 65, 38, 41, 21, 245, 236, 46, 121, 62, 166, 233, 44, 154, 153, 145, 230, 49, 128, 216, 173, 29, 241, 119, 64, 229, 194, 103, 131, 110, 26, 197, 218, 59, 204, 56, 27, 34, 141, 221, 149, 239, 192, 195, 24, 155, 170, 183, 11, 254, 213, 37, 137, 226, 75, 203, 55, 19, 72, 248, 22, 129, 33, 175, 178, 10, 198, 71, 77, 36, 113, 167, 48, 2, 117, 140, 142, 66, 199, 232, 243, 32, 123, 54, 51, 82, 57, 177, 87, 251, 150, 196, 133, 5, 253, 130, 8, 184, 14, 152, 231, 3, 186, 159, 76, 89, 228, 205, 156, 96, 163, 146, 18, 91, 132, 85, 80, 109, 172, 176, 105, 13, 50, 235, 127, 0, 189, 95, 98, 136, 250, 200, 108, 179, 211, 214, 106, 168, 78, 79, 74, 210, 30, 73, 201, 151, 208, 114, 101, 174, 92, 52, 120, 240, 15, 169, 220, 182, 81, 224, 43, 185, 40, 99, 180, 17, 212, 158, 42, 90, 9, 191, 45, 6, 25, 4, 222, 67, 126, 1, 116, 124, 206, 69, 61, 7, 68, 97, 202, 63, 244, 20, 28, 58, 93, 134, 104, 144, 227, 147, 102, 118, 135, 148, 47, 238, 86, 112, 122, 70, 107, 215, 100, 139, 223, 225, 164, 237, 111, 125, 207, 160, 187, 246, 234, 161, 188, 193, 249, 252], [151, 205, 99, 127, 201, 119, 199, 211, 122, 196, 91, 74, 12, 147, 124, 180, 21, 191, 138, 83, 217, 30, 86, 7, 70, 200, 56, 62, 218, 47, 168, 22, 107, 88, 63, 11, 95, 77, 28, 8, 188, 29, 194, 186, 38, 198, 33, 230, 98, 43, 148, 110, 177, 1, 109, 82, 61, 112, 219, 59, 0, 210, 35, 215, 50, 27, 103, 203, 212, 209, 235, 93, 84, 169, 166, 80, 130, 94, 164, 165, 142, 184, 111, 18, 2, 141, 232, 114, 6, 131, 195, 139, 176, 220, 5, 153, 135, 213, 154, 189, 238, 174, 226, 53, 222, 146, 162, 236, 158, 143, 55, 244, 233, 96, 173, 26, 206, 100, 227, 49, 178, 34, 234, 108, 207, 245, 204, 150, 44, 87, 121, 54, 140, 118, 221, 228, 155, 78, 3, 239, 101, 64, 102, 17, 223, 41, 137, 225, 229, 66, 116, 171, 125, 40, 39, 71, 134, 13, 193, 129, 247, 251, 20, 136, 242, 14, 36, 97, 163, 181, 72, 25, 144, 46, 175, 89, 145, 113, 90, 159, 190, 15, 183, 73, 123, 187, 128, 248, 252, 152, 24, 197, 68, 253, 52, 69, 117, 57, 92, 104, 157, 170, 214, 81, 60, 133, 208, 246, 172, 23, 167, 160, 192, 76, 161, 237, 45, 4, 58, 10, 182, 65, 202, 240, 185, 241, 79, 224, 132, 51, 42, 126, 105, 37, 250, 149, 32, 243, 231, 67, 179, 48, 9, 106, 216, 31, 249, 19, 85, 254, 156, 115, 255, 120, 75, 16]] target2 = [ [124, 30, 170, 247, 27, 127, 224, 59, 13, 22, 196, 76, 72, 154, 32, 209, 4, 2, 131, 62, 101, 51, 230, 9, 166, 11, 99, 80, 208, 112, 36, 248, 81, 102, 130, 88, 218, 38, 168, 15, 241, 228, 167, 117, 158, 41, 10, 180, 194, 50, 204, 243, 246, 251, 29, 198, 219, 210, 195, 21, 54, 91, 203, 221, 70, 57, 183, 17, 147, 49, 133, 65, 77, 55, 202, 122, 162, 169, 188, 200, 190, 125, 63, 244, 96, 31, 107, 106, 74, 143, 116, 148, 78, 46, 1, 137, 150, 110, 181, 56, 95, 139, 58, 3, 231, 66, 165, 142, 242, 43, 192, 157, 89, 175, 109, 220, 128, 0, 178, 42, 255, 20, 214, 185, 83, 160, 253, 7, 23, 92, 111, 153, 26, 226, 33, 176, 144, 18, 216, 212, 28, 151, 71, 206, 222, 182, 8, 174, 205, 201, 152, 240, 155, 108, 223, 104, 239, 98, 164, 211, 184, 34, 193, 14, 114, 187, 40, 254, 12, 67, 93, 217, 6, 94, 16, 19, 82, 86, 245, 24, 197, 134, 132, 138, 229, 121, 5, 235, 238, 85, 47, 103, 113, 179, 69, 250, 45, 135, 156, 25, 61, 75, 44, 146, 189, 84, 207, 172, 119, 53, 123, 186, 120, 171, 68, 227, 145, 136, 100, 90, 48, 79, 159, 149, 39, 213, 236, 126, 52, 60, 225, 199, 105, 73, 233, 252, 118, 215, 35, 115, 64, 37, 97, 129, 161, 177, 87, 237, 141, 173, 191, 163, 140, 234, 232, 249], [117, 94, 17, 103, 16, 186, 172, 127, 146, 23, 46, 25, 168, 8, 163, 39, 174, 67, 137, 175, 121, 59, 9, 128, 179, 199, 132, 4, 140, 54, 1, 85, 14, 134, 161, 238, 30, 241, 37, 224, 166, 45, 119, 109, 202, 196, 93, 190, 220, 69, 49, 21, 228, 209, 60, 73, 99, 65, 102, 7, 229, 200, 19, 82, 240, 71, 105, 169, 214, 194, 64, 142, 12, 233, 88, 201, 11, 72, 92, 221, 27, 32, 176, 124, 205, 189, 177, 246, 35, 112, 219, 61, 129, 170, 173, 100, 84, 242, 157, 26, 218, 20, 33, 191, 155, 232, 87, 86, 153, 114, 97, 130, 29, 192, 164, 239, 90, 43, 236, 208, 212, 185, 75, 210, 0, 81, 227, 5, 116, 243, 34, 18, 182, 70, 181, 197, 217, 95, 183, 101, 252, 248, 107, 89, 136, 216, 203, 68, 91, 223, 96, 141, 150, 131, 13, 152, 198, 111, 44, 222, 125, 244, 76, 251, 158, 106, 24, 42, 38, 77, 2, 213, 207, 249, 147, 113, 135, 245, 118, 193, 47, 98, 145, 66, 160, 123, 211, 165, 78, 204, 80, 250, 110, 162, 48, 58, 10, 180, 55, 231, 79, 149, 74, 62, 50, 148, 143, 206, 28, 15, 57, 159, 139, 225, 122, 237, 138, 171, 36, 56, 115, 63, 144, 154, 6, 230, 133, 215, 41, 184, 22, 104, 254, 234, 253, 187, 226, 247, 188, 156, 151, 40, 108, 51, 83, 178, 52, 3, 31, 255, 195, 53, 235, 126, 167, 120]] encrypt_table = b''.join(get_table(b'foobar!')) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) for i in range(0, 256): assert (target1[0][i] == ord(encrypt_table[i])) assert (target1[1][i] == ord(decrypt_table[i])) encrypt_table = b''.join(get_table(b'barfoo!')) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) for i in range(0, 256): assert (target2[0][i] == ord(encrypt_table[i])) assert (target2[1][i] == ord(decrypt_table[i])) def test_encryption(): from shadowsocks.crypto import util cipher = TableCipher('table', b'test', b'', 1) decipher = TableCipher('table', b'test', b'', 0) util.run_cipher(cipher, decipher) if __name__ == '__main__': test_table_result() test_encryption()
apache-2.0
[ 3, 8546, 15, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 6900, 286, 674, 11530, 89, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 971, 272, 543, 63, 6242, 199, 199, 646, 1059, 199, 646, 2702, 199, 646, 8337, 421, 199, 363, 452, 363, 275, 788, 27426, 418, 199, 199, 5245, 63, 5987, 275, 1052, 199, 199, 692, 2688, 8, 875, 12, 283, 22191, 31552, 735, 272, 5475, 31552, 275, 1059, 14, 22191, 31552, 272, 9028, 275, 1059, 14, 5275, 199, 2836, 26, 272, 5475, 31552, 275, 2783, 14, 22191, 31552, 272, 9028, 275, 2783, 14, 5275, 421, 199, 318, 664, 63, 1224, 8, 498, 304, 272, 333, 275, 8337, 14, 1064, 21, 342, 272, 333, 14, 873, 8, 498, 9, 272, 308, 275, 333, 14, 5671, 342, 272, 282, 12, 330, 275, 2702, 14, 5301, 4827, 12917, 297, 308, 9, 272, 1817, 275, 5475, 31552, 8, 66, 6448, 330, 17483, 272, 1817, 275, 359, 1224, 59, 73, 26, 284, 435, 413, 61, 367, 284, 315, 1425, 8, 552, 8, 1224, 10524, 272, 367, 284, 315, 1425, 8, 17, 12, 6619, 304, 267, 1817, 14, 3191, 8, 498, 29, 2734, 671, 26, 1109, 8, 65, 450, 334, 2181, 8, 88, 9, 435, 284, 1724, 272, 372, 1817, 421, 199, 318, 4205, 63, 1224, 8, 498, 304, 272, 340, 790, 440, 315, 6328, 63, 5987, 26, 267, 14645, 63, 1224, 275, 330, 17067, 904, 8, 362, 63, 1224, 8, 498, 430, 267, 20090, 63, 1224, 275, 5475, 31552, 8, 11929, 63, 1224, 12, 5475, 31552, 8, 66, 6448, 330, 7, 1333, 267, 6328, 63, 5987, 59, 498, 61, 275, 359, 11929, 63, 1224, 12, 20090, 63, 1224, 61, 272, 372, 6328, 63, 5987, 59, 498, 61, 421, 199, 533, 6957, 21967, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 10830, 63, 354, 12, 790, 12, 18831, 12, 1687, 304, 267, 291, 423, 11929, 63, 1224, 12, 291, 423, 15682, 63, 1224, 275, 4205, 63, 1224, 8, 498, 9, 267, 291, 423, 411, 275, 1687, 339, 347, 1678, 8, 277, 12, 666, 304, 267, 340, 291, 423, 411, 26, 288, 372, 9028, 8, 576, 12, 291, 423, 11929, 63, 1224, 9, 267, 587, 26, 288, 372, 9028, 8, 576, 12, 291, 423, 15682, 63, 1224, 9, 421, 199, 27426, 275, 469, 272, 283, 1224, 356, 334, 16, 12, 378, 12, 6957, 21967, 9, 199, 93, 421, 199, 318, 511, 63, 1224, 63, 1099, 837, 272, 687, 15084, 21234, 14, 2330, 492, 6206, 272, 1347, 17, 275, 359, 267, 359, 2259, 12, 13564, 12, 8264, 12, 26309, 12, 499, 1196, 12, 18729, 12, 10523, 12, 6546, 12, 10551, 12, 499, 2260, 12, 499, 1167, 12, 8685, 12, 3144, 12, 32400, 12, 31852, 12, 413, 2835, 12, 268, 5450, 12, 29235, 12, 20582, 12, 499, 2417, 12, 32729, 12, 3193, 12, 7105, 12, 499, 1643, 12, 29682, 12, 413, 3172, 12, 22560, 12, 11738, 12, 10448, 12, 13385, 12, 7829, 12, 268, 32102, 12, 499, 1344, 12, 12426, 12, 26228, 12, 16202, 12, 29923, 12, 499, 1153, 12, 10868, 12, 31693, 12, 25828, 12, 28818, 12, 28700, 12, 12260, 12, 7960, 12, 30630, 12, 268, 413, 2898, 12, 7349, 12, 499, 2953, 12, 26497, 12, 5049, 12, 499, 1398, 12, 413, 2635, 12, 22363, 12, 30542, 12, 16814, 12, 7875, 12, 413, 2576, 12, 32319, 12, 8155, 12, 14785, 12, 268, 12001, 12, 8087, 12, 8177, 12, 413, 2953, 12, 499, 2025, 12, 28528, 12, 499, 1355, 12, 13567, 12, 413, 2720, 12, 5504, 12, 29710, 12, 27209, 12, 413, 2658, 12, 4119, 12, 22540, 12, 268, 499, 969, 12, 6877, 12, 27750, 12, 32584, 12, 13098, 12, 29202, 12, 12766, 12, 5851, 12, 15323, 12, 499, 2006, 12, 6928, 12, 25454, 12, 9404, 12, 27306, 12, 413, 2277, 12, 268, 1616, 12, 413, 2905, 12, 17245, 12, 8375, 12, 8780, 12, 24073, 12, 31650, 12, 9615, 12, 499, 12, 26189, 12, 22796, 12, 31308, 12, 14157, 12, 9013, 12, 499, 708, 12, 268, 499, 2824, 12, 4337, 12, 11869, 12, 13470, 12, 8026, 12, 18051, 12, 12699, 12, 413, 1138, 12, 10513, 12, 499, 2869, 12, 14711, 12, 32132, 12, 28416, 12, 959, 12, 26727, 12, 268, 21334, 12, 1695, 12, 27631, 12, 4329, 12, 413, 2528, 12, 499, 2192, 12, 650, 12, 413, 1184, 12, 413, 1427, 12, 14646, 12, 17838, 12, 499, 1651, 12, 24005, 12, 32609, 12, 15580, 12, 268, 24619, 12, 31263, 12, 6155, 12, 21358, 12, 27207, 12, 16412, 12, 5939, 12, 24058, 12, 24911, 12, 27827, 12, 20462, 12, 4944, 12, 5238, 12, 31071, 12, 12792, 12, 268, 378, 12, 31446, 12, 16102, 12, 16096, 12, 27208, 12, 16074, 12, 1926, 12, 24579, 12, 31420, 12, 30301, 12, 21237, 12, 23746, 12, 413, 2333, 12, 14679, 12, 13734, 12, 268, 9720, 12, 26160, 12, 4233, 12, 18525, 12, 1784, 12, 413, 2869, 12, 29203, 12, 23510, 12, 14313, 12, 30698, 12, 20140, 12, 14589, 12, 13960, 12, 21883, 12, 4114, 12, 268, 20680, 12, 25647, 12, 413, 2564, 12, 19071, 12, 18565, 12, 11851, 12, 413, 2426, 12, 6335, 12, 8806, 12, 13576, 12, 5557, 12, 29532, 12, 413, 2010, 12, 5685, 12, 9137, 12, 1749, 12, 268, 413, 3328, 12, 10416, 12, 1227, 12, 5661, 12, 841, 12, 26485, 12, 13296, 12, 21572, 12, 413 ]
[ 8546, 15, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 6900, 286, 674, 11530, 89, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 971, 272, 543, 63, 6242, 199, 199, 646, 1059, 199, 646, 2702, 199, 646, 8337, 421, 199, 363, 452, 363, 275, 788, 27426, 418, 199, 199, 5245, 63, 5987, 275, 1052, 199, 199, 692, 2688, 8, 875, 12, 283, 22191, 31552, 735, 272, 5475, 31552, 275, 1059, 14, 22191, 31552, 272, 9028, 275, 1059, 14, 5275, 199, 2836, 26, 272, 5475, 31552, 275, 2783, 14, 22191, 31552, 272, 9028, 275, 2783, 14, 5275, 421, 199, 318, 664, 63, 1224, 8, 498, 304, 272, 333, 275, 8337, 14, 1064, 21, 342, 272, 333, 14, 873, 8, 498, 9, 272, 308, 275, 333, 14, 5671, 342, 272, 282, 12, 330, 275, 2702, 14, 5301, 4827, 12917, 297, 308, 9, 272, 1817, 275, 5475, 31552, 8, 66, 6448, 330, 17483, 272, 1817, 275, 359, 1224, 59, 73, 26, 284, 435, 413, 61, 367, 284, 315, 1425, 8, 552, 8, 1224, 10524, 272, 367, 284, 315, 1425, 8, 17, 12, 6619, 304, 267, 1817, 14, 3191, 8, 498, 29, 2734, 671, 26, 1109, 8, 65, 450, 334, 2181, 8, 88, 9, 435, 284, 1724, 272, 372, 1817, 421, 199, 318, 4205, 63, 1224, 8, 498, 304, 272, 340, 790, 440, 315, 6328, 63, 5987, 26, 267, 14645, 63, 1224, 275, 330, 17067, 904, 8, 362, 63, 1224, 8, 498, 430, 267, 20090, 63, 1224, 275, 5475, 31552, 8, 11929, 63, 1224, 12, 5475, 31552, 8, 66, 6448, 330, 7, 1333, 267, 6328, 63, 5987, 59, 498, 61, 275, 359, 11929, 63, 1224, 12, 20090, 63, 1224, 61, 272, 372, 6328, 63, 5987, 59, 498, 61, 421, 199, 533, 6957, 21967, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 10830, 63, 354, 12, 790, 12, 18831, 12, 1687, 304, 267, 291, 423, 11929, 63, 1224, 12, 291, 423, 15682, 63, 1224, 275, 4205, 63, 1224, 8, 498, 9, 267, 291, 423, 411, 275, 1687, 339, 347, 1678, 8, 277, 12, 666, 304, 267, 340, 291, 423, 411, 26, 288, 372, 9028, 8, 576, 12, 291, 423, 11929, 63, 1224, 9, 267, 587, 26, 288, 372, 9028, 8, 576, 12, 291, 423, 15682, 63, 1224, 9, 421, 199, 27426, 275, 469, 272, 283, 1224, 356, 334, 16, 12, 378, 12, 6957, 21967, 9, 199, 93, 421, 199, 318, 511, 63, 1224, 63, 1099, 837, 272, 687, 15084, 21234, 14, 2330, 492, 6206, 272, 1347, 17, 275, 359, 267, 359, 2259, 12, 13564, 12, 8264, 12, 26309, 12, 499, 1196, 12, 18729, 12, 10523, 12, 6546, 12, 10551, 12, 499, 2260, 12, 499, 1167, 12, 8685, 12, 3144, 12, 32400, 12, 31852, 12, 413, 2835, 12, 268, 5450, 12, 29235, 12, 20582, 12, 499, 2417, 12, 32729, 12, 3193, 12, 7105, 12, 499, 1643, 12, 29682, 12, 413, 3172, 12, 22560, 12, 11738, 12, 10448, 12, 13385, 12, 7829, 12, 268, 32102, 12, 499, 1344, 12, 12426, 12, 26228, 12, 16202, 12, 29923, 12, 499, 1153, 12, 10868, 12, 31693, 12, 25828, 12, 28818, 12, 28700, 12, 12260, 12, 7960, 12, 30630, 12, 268, 413, 2898, 12, 7349, 12, 499, 2953, 12, 26497, 12, 5049, 12, 499, 1398, 12, 413, 2635, 12, 22363, 12, 30542, 12, 16814, 12, 7875, 12, 413, 2576, 12, 32319, 12, 8155, 12, 14785, 12, 268, 12001, 12, 8087, 12, 8177, 12, 413, 2953, 12, 499, 2025, 12, 28528, 12, 499, 1355, 12, 13567, 12, 413, 2720, 12, 5504, 12, 29710, 12, 27209, 12, 413, 2658, 12, 4119, 12, 22540, 12, 268, 499, 969, 12, 6877, 12, 27750, 12, 32584, 12, 13098, 12, 29202, 12, 12766, 12, 5851, 12, 15323, 12, 499, 2006, 12, 6928, 12, 25454, 12, 9404, 12, 27306, 12, 413, 2277, 12, 268, 1616, 12, 413, 2905, 12, 17245, 12, 8375, 12, 8780, 12, 24073, 12, 31650, 12, 9615, 12, 499, 12, 26189, 12, 22796, 12, 31308, 12, 14157, 12, 9013, 12, 499, 708, 12, 268, 499, 2824, 12, 4337, 12, 11869, 12, 13470, 12, 8026, 12, 18051, 12, 12699, 12, 413, 1138, 12, 10513, 12, 499, 2869, 12, 14711, 12, 32132, 12, 28416, 12, 959, 12, 26727, 12, 268, 21334, 12, 1695, 12, 27631, 12, 4329, 12, 413, 2528, 12, 499, 2192, 12, 650, 12, 413, 1184, 12, 413, 1427, 12, 14646, 12, 17838, 12, 499, 1651, 12, 24005, 12, 32609, 12, 15580, 12, 268, 24619, 12, 31263, 12, 6155, 12, 21358, 12, 27207, 12, 16412, 12, 5939, 12, 24058, 12, 24911, 12, 27827, 12, 20462, 12, 4944, 12, 5238, 12, 31071, 12, 12792, 12, 268, 378, 12, 31446, 12, 16102, 12, 16096, 12, 27208, 12, 16074, 12, 1926, 12, 24579, 12, 31420, 12, 30301, 12, 21237, 12, 23746, 12, 413, 2333, 12, 14679, 12, 13734, 12, 268, 9720, 12, 26160, 12, 4233, 12, 18525, 12, 1784, 12, 413, 2869, 12, 29203, 12, 23510, 12, 14313, 12, 30698, 12, 20140, 12, 14589, 12, 13960, 12, 21883, 12, 4114, 12, 268, 20680, 12, 25647, 12, 413, 2564, 12, 19071, 12, 18565, 12, 11851, 12, 413, 2426, 12, 6335, 12, 8806, 12, 13576, 12, 5557, 12, 29532, 12, 413, 2010, 12, 5685, 12, 9137, 12, 1749, 12, 268, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
speed-of-light/pyslider
lib/auto/match_do.py
1
1715
import numpy as np from lib.exp.base import ExpCommon from lib.exp.prepare import Prepare from lib.exp.matching import Matcher from lib.exp.evaluator.ground_truth import GroundTruth from lib.exp.evaluator.pair_evaluator import PairEvaluator class MatchDo(ExpCommon): """ Provide a simple way to rundown """ def __init__(self, root, name): self.root = root self.name = name ExpCommon.__init__(self, root, name) self.elog.info("Doer: init") def reduced_frames(self): """ Get preprocessed frames """ pp = Prepare(self.root, self.name) df = pp.load("keys") pk = df[df.key.str.contains('reduce')].key.values[5] fids = pp.load(pk).frame_id.values.astype(np.int32) self.elog.info("Doer: reduced frames") return fids def gnd_mpairs(self): """ load ground truth matched pairs TODO change univ_df() to pairs() """ gt = GroundTruth(self.root, self.name) df = gt.univ_df() self.elog.info("Doer: gnd mpairs") return df def matching(self, fids, thres): mm = Matcher(self.root, self.name) res, sfs, vfs = mm.set_match(fids, ransac=False, thres=0.9) self.elog.info("Doer: matching") return res, sfs, vfs def evaluation(self, res, gnd): pe = PairEvaluator(res, gnd) er = pe.pairing() praf = pe.hitd_praf(er) self.elog.info("Doer: evaluation") return praf def rundown(self): fids = self.reduced_frames() # gnd = self.gnd_mpairs() res, sfs, vfs = self.matching(fids, .9) # praf = self.evaluation(res, gnd) return res, sfs, vfs
agpl-3.0
[ 646, 2680, 465, 980, 199, 504, 1973, 14, 1474, 14, 1095, 492, 7910, 7844, 199, 504, 1973, 14, 1474, 14, 6726, 492, 17008, 199, 504, 1973, 14, 1474, 14, 9467, 492, 9814, 281, 199, 504, 1973, 14, 1474, 14, 27406, 14, 3928, 63, 17167, 492, 598, 2363, 14064, 762, 199, 504, 1973, 14, 1474, 14, 27406, 14, 3852, 63, 27406, 492, 510, 8387, 10006, 16530, 421, 199, 533, 9814, 2585, 8, 4527, 7844, 304, 272, 408, 272, 22896, 282, 3486, 4340, 370, 519, 725, 944, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1738, 12, 536, 304, 267, 291, 14, 1231, 275, 1738, 267, 291, 14, 354, 275, 536, 267, 7910, 7844, 855, 826, 721, 277, 12, 1738, 12, 536, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 4205, 531, 339, 347, 14953, 63, 8444, 8, 277, 304, 267, 408, 2372, 876, 7292, 11223, 408, 267, 11618, 275, 17008, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 4051, 275, 11618, 14, 912, 480, 1612, 531, 267, 3803, 275, 4051, 59, 1587, 14, 498, 14, 495, 14, 6134, 360, 5270, 358, 1055, 498, 14, 1459, 59, 21, 61, 267, 289, 1580, 275, 11618, 14, 912, 8, 2051, 680, 1943, 63, 344, 14, 1459, 14, 6041, 8, 1590, 14, 442, 708, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 14953, 11223, 531, 267, 372, 289, 1580, 339, 347, 486, 977, 63, 311, 8387, 83, 8, 277, 304, 267, 408, 267, 2248, 19252, 16865, 7838, 6342, 267, 3254, 1570, 17225, 63, 1587, 342, 370, 6342, 342, 267, 408, 267, 16484, 275, 598, 2363, 14064, 762, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 4051, 275, 16484, 14, 27516, 63, 1587, 342, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 486, 977, 6118, 8387, 83, 531, 267, 372, 4051, 339, 347, 4877, 8, 277, 12, 289, 1580, 12, 294, 470, 304, 267, 8562, 275, 9814, 281, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 522, 12, 308, 2319, 12, 31628, 275, 8562, 14, 409, 63, 1431, 8, 329, 795, 12, 519, 796, 645, 29, 797, 12, 294, 470, 29, 16, 14, 25, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 4877, 531, 267, 372, 522, 12, 308, 2319, 12, 31628, 339, 347, 11735, 8, 277, 12, 522, 12, 486, 977, 304, 267, 4837, 275, 510, 8387, 10006, 16530, 8, 470, 12, 486, 977, 9, 267, 9266, 275, 4837, 14, 3852, 316, 342, 267, 299, 345, 70, 275, 4837, 14, 12948, 68, 63, 80, 345, 70, 8, 281, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 11735, 531, 267, 372, 299, 345, 70, 339, 347, 519, 725, 944, 8, 277, 304, 267, 289, 1580, 275, 291, 14, 19523, 63, 8444, 342, 267, 327, 486, 977, 275, 291, 14, 784, 68, 63, 311, 8387, 83, 342, 267, 522, 12, 308, 2319, 12, 31628, 275, 291, 14, 9467, 8, 329, 795, 12, 1275, 25, 9, 267, 327, 299, 345, 70, 275, 291, 14, 19154, 8, 470, 12, 486, 977, 9, 267, 372, 522, 12, 308, 2319, 12, 31628, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2680, 465, 980, 199, 504, 1973, 14, 1474, 14, 1095, 492, 7910, 7844, 199, 504, 1973, 14, 1474, 14, 6726, 492, 17008, 199, 504, 1973, 14, 1474, 14, 9467, 492, 9814, 281, 199, 504, 1973, 14, 1474, 14, 27406, 14, 3928, 63, 17167, 492, 598, 2363, 14064, 762, 199, 504, 1973, 14, 1474, 14, 27406, 14, 3852, 63, 27406, 492, 510, 8387, 10006, 16530, 421, 199, 533, 9814, 2585, 8, 4527, 7844, 304, 272, 408, 272, 22896, 282, 3486, 4340, 370, 519, 725, 944, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1738, 12, 536, 304, 267, 291, 14, 1231, 275, 1738, 267, 291, 14, 354, 275, 536, 267, 7910, 7844, 855, 826, 721, 277, 12, 1738, 12, 536, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 4205, 531, 339, 347, 14953, 63, 8444, 8, 277, 304, 267, 408, 2372, 876, 7292, 11223, 408, 267, 11618, 275, 17008, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 4051, 275, 11618, 14, 912, 480, 1612, 531, 267, 3803, 275, 4051, 59, 1587, 14, 498, 14, 495, 14, 6134, 360, 5270, 358, 1055, 498, 14, 1459, 59, 21, 61, 267, 289, 1580, 275, 11618, 14, 912, 8, 2051, 680, 1943, 63, 344, 14, 1459, 14, 6041, 8, 1590, 14, 442, 708, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 14953, 11223, 531, 267, 372, 289, 1580, 339, 347, 486, 977, 63, 311, 8387, 83, 8, 277, 304, 267, 408, 267, 2248, 19252, 16865, 7838, 6342, 267, 3254, 1570, 17225, 63, 1587, 342, 370, 6342, 342, 267, 408, 267, 16484, 275, 598, 2363, 14064, 762, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 4051, 275, 16484, 14, 27516, 63, 1587, 342, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 486, 977, 6118, 8387, 83, 531, 267, 372, 4051, 339, 347, 4877, 8, 277, 12, 289, 1580, 12, 294, 470, 304, 267, 8562, 275, 9814, 281, 8, 277, 14, 1231, 12, 291, 14, 354, 9, 267, 522, 12, 308, 2319, 12, 31628, 275, 8562, 14, 409, 63, 1431, 8, 329, 795, 12, 519, 796, 645, 29, 797, 12, 294, 470, 29, 16, 14, 25, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 4877, 531, 267, 372, 522, 12, 308, 2319, 12, 31628, 339, 347, 11735, 8, 277, 12, 522, 12, 486, 977, 304, 267, 4837, 275, 510, 8387, 10006, 16530, 8, 470, 12, 486, 977, 9, 267, 9266, 275, 4837, 14, 3852, 316, 342, 267, 299, 345, 70, 275, 4837, 14, 12948, 68, 63, 80, 345, 70, 8, 281, 9, 267, 291, 14, 69, 793, 14, 815, 480, 2585, 281, 26, 11735, 531, 267, 372, 299, 345, 70, 339, 347, 519, 725, 944, 8, 277, 304, 267, 289, 1580, 275, 291, 14, 19523, 63, 8444, 342, 267, 327, 486, 977, 275, 291, 14, 784, 68, 63, 311, 8387, 83, 342, 267, 522, 12, 308, 2319, 12, 31628, 275, 291, 14, 9467, 8, 329, 795, 12, 1275, 25, 9, 267, 327, 299, 345, 70, 275, 291, 14, 19154, 8, 470, 12, 486, 977, 9, 267, 372, 522, 12, 308, 2319, 12, 31628, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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-*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import functools import itertools import tempfile import re from contextlib import contextmanager import luigi import luigi.task_register import luigi.cmdline_parser from luigi.cmdline_parser import CmdlineParser from luigi import six import os import unittest def skipOnTravis(reason): return unittest.skipIf(os.getenv('TRAVIS') == 'true', reason) class with_config(object): """ Decorator to override config settings for the length of a function. Usage: .. code-block: python >>> import luigi.configuration >>> @with_config({'foo': {'bar': 'baz'}}) ... def my_test(): ... print(luigi.configuration.get_config().get("foo", "bar")) ... >>> my_test() baz >>> @with_config({'hoo': {'bar': 'buz'}}) ... @with_config({'foo': {'bar': 'baz'}}) ... def my_test(): ... print(luigi.configuration.get_config().get("foo", "bar")) ... print(luigi.configuration.get_config().get("hoo", "bar")) ... >>> my_test() baz buz >>> @with_config({'foo': {'bar': 'buz'}}) ... @with_config({'foo': {'bar': 'baz'}}) ... def my_test(): ... print(luigi.configuration.get_config().get("foo", "bar")) ... >>> my_test() baz >>> @with_config({'foo': {'bur': 'buz'}}) ... @with_config({'foo': {'bar': 'baz'}}) ... def my_test(): ... print(luigi.configuration.get_config().get("foo", "bar")) ... print(luigi.configuration.get_config().get("foo", "bur")) ... >>> my_test() baz buz >>> @with_config({'foo': {'bur': 'buz'}}) ... @with_config({'foo': {'bar': 'baz'}}, replace_sections=True) ... def my_test(): ... print(luigi.configuration.get_config().get("foo", "bar")) ... print(luigi.configuration.get_config().get("foo", "bur", "no_bur")) ... >>> my_test() baz no_bur """ def __init__(self, config, replace_sections=False): self.config = config self.replace_sections = replace_sections def _make_dict(self, old_dict): if self.replace_sections: old_dict.update(self.config) return old_dict def get_section(sec): old_sec = old_dict.get(sec, {}) new_sec = self.config.get(sec, {}) old_sec.update(new_sec) return old_sec all_sections = itertools.chain(old_dict.keys(), self.config.keys()) return {sec: get_section(sec) for sec in all_sections} def __call__(self, fun): @functools.wraps(fun) def wrapper(*args, **kwargs): import luigi.configuration orig_conf = luigi.configuration.LuigiConfigParser.instance() new_conf = luigi.configuration.LuigiConfigParser() luigi.configuration.LuigiConfigParser._instance = new_conf orig_dict = {k: dict(orig_conf.items(k)) for k in orig_conf.sections()} new_dict = self._make_dict(orig_dict) for (section, settings) in six.iteritems(new_dict): new_conf.add_section(section) for (name, value) in six.iteritems(settings): new_conf.set(section, name, value) try: return fun(*args, **kwargs) finally: luigi.configuration.LuigiConfigParser._instance = orig_conf return wrapper class RunOnceTask(luigi.Task): def __init__(self, *args, **kwargs): super(RunOnceTask, self).__init__(*args, **kwargs) self.comp = False def complete(self): return self.comp def run(self): self.comp = True class LuigiTestCase(unittest.TestCase): """ Tasks registred within a test case will get unregistered in a finalizer Instance caches are cleared before and after all runs """ def setUp(self): super(LuigiTestCase, self).setUp() self._stashed_reg = luigi.task_register.Register._get_reg() luigi.task_register.Register.clear_instance_cache() def tearDown(self): luigi.task_register.Register._set_reg(self._stashed_reg) super(LuigiTestCase, self).tearDown() luigi.task_register.Register.clear_instance_cache() def run_locally(self, args): """ Helper for running tests testing more of the stack, the command line parsing and task from name intstantiation parts in particular. """ temp = CmdlineParser._instance try: CmdlineParser._instance = None run_exit_status = luigi.run(['--local-scheduler', '--no-lock'] + args) finally: CmdlineParser._instance = temp return run_exit_status def run_locally_split(self, space_seperated_args): """ Helper for running tests testing more of the stack, the command line parsing and task from name intstantiation parts in particular. """ return self.run_locally(space_seperated_args.split(' ')) class parsing(object): """ Convenient decorator for test cases to set the parsing environment. """ def __init__(self, cmds): self.cmds = cmds def __call__(self, fun): @functools.wraps(fun) def wrapper(*args, **kwargs): with CmdlineParser.global_instance(self.cmds, allow_override=True): return fun(*args, **kwargs) return wrapper def in_parse(cmds, deferred_computation): with CmdlineParser.global_instance(cmds) as cp: deferred_computation(cp.get_task_obj()) @contextmanager def temporary_unloaded_module(python_file_contents): """ Create an importable module Return the name of importable module name given its file contents (source code) """ with tempfile.NamedTemporaryFile( dir='test/', prefix="_test_time_generated_module", suffix='.py') as temp_module_file: temp_module_file.file.write(python_file_contents) temp_module_file.file.flush() temp_module_path = temp_module_file.name temp_module_name = re.search(r'/(_test_time_generated_module.*).py', temp_module_path).group(1) yield temp_module_name
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 6029, 13, 7806, 428, 555, 3338, 14840, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 646, 9143, 199, 646, 7975, 199, 646, 5549, 199, 646, 295, 199, 504, 15502, 492, 27608, 199, 199, 646, 19485, 199, 646, 19485, 14, 1765, 63, 2683, 199, 646, 19485, 14, 15612, 63, 2087, 199, 504, 19485, 14, 15612, 63, 2087, 492, 26005, 604, 2842, 199, 504, 19485, 492, 3816, 199, 646, 747, 199, 199, 646, 2882, 421, 199, 318, 3372, 3314, 2437, 5068, 8, 5764, 304, 272, 372, 2882, 14, 15118, 8, 736, 14, 12959, 360, 1766, 6087, 1311, 358, 508, 283, 2052, 297, 4499, 9, 421, 199, 533, 543, 63, 888, 8, 785, 304, 272, 408, 272, 30684, 370, 4278, 1101, 2202, 367, 314, 2582, 402, 282, 805, 14, 339, 11028, 26, 339, 2508, 1233, 13, 1457, 26, 2366, 398, 1306, 492, 19485, 14, 4758, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1306, 768, 1045, 63, 888, 3252, 19112, 356, 791, 1700, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 19112, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1032, 90, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 30735, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 30735, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1032, 90, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 30735, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 28400, 3350, 63, 7786, 29, 549, 9, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 30735, 401, 298, 889, 63, 30735, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 949, 63, 30735, 339, 408, 339, 347, 636, 826, 721, 277, 12, 1101, 12, 3350, 63, 7786, 29, 797, 304, 267, 291, 14, 888, 275, 1101, 267, 291, 14, 1814, 63, 7786, 275, 3350, 63, 7786, 339, 347, 485, 1875, 63, 807, 8, 277, 12, 2269, 63, 807, 304, 267, 340, 291, 14, 1814, 63, 7786, 26, 288, 2269, 63, 807, 14, 873, 8, 277, 14, 888, 9, 288, 372, 2269, 63, 807, 398, 347, 664, 63, 2792, 8, 3321, 304, 288, 2269, 63, 3321, 275, 2269, 63, 807, 14, 362, 8, 3321, 12, 5009, 288, 892, 63, 3321, 275, 291, 14, 888, 14, 362, 8, 3321, 12, 5009, 288, 2269, 63, 3321, 14, 873, 8, 1222, 63, 3321, 9, 288, 372, 2269, 63, 3321, 398, 1006, 63, 7786, 275, 7975, 14, 4429, 8, 1753, 63, 807, 14, 1612, 1062, 291, 14, 888, 14, 1612, 1012, 267, 372, 469, 3321, 26, 664, 63, 2792, 8, 3321, 9, 367, 6513, 315, 1006, 63, 7786, 93, 339, 347, 636, 1250, 721, 277, 12, 9627, 304, 267, 768, 17869, 14, 13582, 8, 7036, 9, 267, 347, 4975, 2031, 589, 12, 1011, 958, 304, 288, 492, 19485, 14, 4758, 288, 2306, 63, 2190, 275, 19485, 14, 4758, 14, 18176, 13721, 15218, 14, 842, 342, 288, 892, 63, 2190, 275, 19485, 14, 4758, 14, 18176, 13721, 15218, 342, 288, 19485, 14, 4758, 14, 18176, 13721, 15218, 423, 842, 275, 892, 63, 2190, 288, 2306, 63, 807, 275, 469, 75, 26, 1211, 8, 2981, 63, 2190, 14, 1744, 8, 75, 430, 367, 1022, 315, 2306, 63, 2190, 14, 7786, 12737, 288, 892, 63, 807, 275, 291, 423, 1875, 63, 807, 8, 2981, 63, 807, 9, 288, 367, 334, 2792, 12, 2202, 9, 315, 3816, 14, 4611, 8, 1222, 63, 807, 304, 355, 892, 63, 2190, 14, 525, 63, 2792, 8, 2792, 9, 355, 367, 334, 354, 12, 574, 9, 315, 3816, 14, 4611, 8, 1751, 304, 490, 892, 63, 2190, 14, 409, 8, 2792, 12, 536, 12, 574, 9 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 6029, 13, 7806, 428, 555, 3338, 14840, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 646, 9143, 199, 646, 7975, 199, 646, 5549, 199, 646, 295, 199, 504, 15502, 492, 27608, 199, 199, 646, 19485, 199, 646, 19485, 14, 1765, 63, 2683, 199, 646, 19485, 14, 15612, 63, 2087, 199, 504, 19485, 14, 15612, 63, 2087, 492, 26005, 604, 2842, 199, 504, 19485, 492, 3816, 199, 646, 747, 199, 199, 646, 2882, 421, 199, 318, 3372, 3314, 2437, 5068, 8, 5764, 304, 272, 372, 2882, 14, 15118, 8, 736, 14, 12959, 360, 1766, 6087, 1311, 358, 508, 283, 2052, 297, 4499, 9, 421, 199, 533, 543, 63, 888, 8, 785, 304, 272, 408, 272, 30684, 370, 4278, 1101, 2202, 367, 314, 2582, 402, 282, 805, 14, 339, 11028, 26, 339, 2508, 1233, 13, 1457, 26, 2366, 398, 1306, 492, 19485, 14, 4758, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1306, 768, 1045, 63, 888, 3252, 19112, 356, 791, 1700, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 19112, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1032, 90, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 30735, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 936, 1552, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 30735, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 1032, 90, 267, 1306, 768, 1045, 63, 888, 3252, 1421, 356, 791, 30735, 356, 283, 464, 90, 936, 1552, 267, 2263, 768, 1045, 63, 888, 3252, 1421, 356, 791, 1700, 356, 283, 6185, 28400, 3350, 63, 7786, 29, 549, 9, 267, 2263, 347, 3002, 63, 396, 837, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 1700, 2237, 267, 2263, 258, 870, 8, 26795, 14, 4758, 14, 362, 63, 888, 1252, 362, 480, 1421, 401, 298, 30735, 401, 298, 889, 63, 30735, 2237, 267, 2263, 267, 1306, 3002, 63, 396, 342, 267, 15507, 267, 949, 63, 30735, 339, 408, 339, 347, 636, 826, 721, 277, 12, 1101, 12, 3350, 63, 7786, 29, 797, 304, 267, 291, 14, 888, 275, 1101, 267, 291, 14, 1814, 63, 7786, 275, 3350, 63, 7786, 339, 347, 485, 1875, 63, 807, 8, 277, 12, 2269, 63, 807, 304, 267, 340, 291, 14, 1814, 63, 7786, 26, 288, 2269, 63, 807, 14, 873, 8, 277, 14, 888, 9, 288, 372, 2269, 63, 807, 398, 347, 664, 63, 2792, 8, 3321, 304, 288, 2269, 63, 3321, 275, 2269, 63, 807, 14, 362, 8, 3321, 12, 5009, 288, 892, 63, 3321, 275, 291, 14, 888, 14, 362, 8, 3321, 12, 5009, 288, 2269, 63, 3321, 14, 873, 8, 1222, 63, 3321, 9, 288, 372, 2269, 63, 3321, 398, 1006, 63, 7786, 275, 7975, 14, 4429, 8, 1753, 63, 807, 14, 1612, 1062, 291, 14, 888, 14, 1612, 1012, 267, 372, 469, 3321, 26, 664, 63, 2792, 8, 3321, 9, 367, 6513, 315, 1006, 63, 7786, 93, 339, 347, 636, 1250, 721, 277, 12, 9627, 304, 267, 768, 17869, 14, 13582, 8, 7036, 9, 267, 347, 4975, 2031, 589, 12, 1011, 958, 304, 288, 492, 19485, 14, 4758, 288, 2306, 63, 2190, 275, 19485, 14, 4758, 14, 18176, 13721, 15218, 14, 842, 342, 288, 892, 63, 2190, 275, 19485, 14, 4758, 14, 18176, 13721, 15218, 342, 288, 19485, 14, 4758, 14, 18176, 13721, 15218, 423, 842, 275, 892, 63, 2190, 288, 2306, 63, 807, 275, 469, 75, 26, 1211, 8, 2981, 63, 2190, 14, 1744, 8, 75, 430, 367, 1022, 315, 2306, 63, 2190, 14, 7786, 12737, 288, 892, 63, 807, 275, 291, 423, 1875, 63, 807, 8, 2981, 63, 807, 9, 288, 367, 334, 2792, 12, 2202, 9, 315, 3816, 14, 4611, 8, 1222, 63, 807, 304, 355, 892, 63, 2190, 14, 525, 63, 2792, 8, 2792, 9, 355, 367, 334, 354, 12, 574, 9, 315, 3816, 14, 4611, 8, 1751, 304, 490, 892, 63, 2190, 14, 409, 8, 2792, 12, 536, 12, 574, 9, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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leanup Failup Report.""" from insteonplm.messages.message import Message from insteonplm.constants import ( MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_0X56, MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_SIZE, ) from insteonplm.address import Address class AllLinkCleanupFailureReport(Message): """INSTEON All-Link Failure Report Message. Message type 0x56 """ _code = MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_0X56 _sendSize = MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_SIZE _receivedSize = MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_SIZE _description = "INSTEON All-Link Failure Report Message" def __init__(self, group, address): """Init the AllLinkCleanupFailureReport Class.""" self._group = group self._address = Address(address) self._failedFlag = 0x01 @classmethod def from_raw_message(cls, rawmessage): """Create message from a raw byte stream.""" return AllLinkCleanupFailureReport(rawmessage[3], rawmessage[4:7]) @property def group(self): """Return the All-Link Group.""" return self._group @property def address(self): """Return the device address.""" return self._address def _message_properties(self): return [ {"failedFlag": self._failedFlag}, {"group": self._group}, {"address": self._address}, ]
mit
[ 624, 7834, 37, 615, 6430, 2900, 13, 3834, 7891, 12176, 384, 11774, 1041, 199, 504, 315, 1597, 265, 1168, 77, 14, 3431, 14, 1188, 492, 6430, 199, 504, 315, 1597, 265, 1168, 77, 14, 5559, 492, 334, 272, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 16, 56, 1367, 12, 272, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 12, 199, 9, 199, 504, 315, 1597, 265, 1168, 77, 14, 1562, 492, 9906, 421, 199, 533, 2900, 3834, 7891, 6782, 7457, 8, 2209, 304, 272, 408, 7834, 37, 615, 2900, 13, 3834, 20367, 11774, 6430, 14, 339, 6430, 730, 378, 88, 1367, 272, 408, 339, 485, 600, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 16, 56, 1367, 272, 485, 2254, 2320, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 272, 485, 9226, 2320, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 272, 485, 1802, 275, 298, 7834, 37, 615, 2900, 13, 3834, 20367, 11774, 6430, 2, 339, 347, 636, 826, 721, 277, 12, 1572, 12, 2287, 304, 267, 408, 9346, 314, 2900, 3834, 7891, 6782, 7457, 8089, 1041, 267, 291, 423, 923, 275, 1572, 267, 291, 423, 1562, 275, 9906, 8, 1562, 9, 267, 291, 423, 4892, 5318, 275, 378, 88, 614, 339, 768, 3744, 272, 347, 687, 63, 1773, 63, 1188, 8, 1886, 12, 3066, 1188, 304, 267, 408, 2499, 1245, 687, 282, 3066, 3696, 2547, 1041, 267, 372, 2900, 3834, 7891, 6782, 7457, 8, 1773, 1188, 59, 19, 467, 3066, 1188, 59, 20, 26, 23, 566, 339, 768, 1829, 272, 347, 1572, 8, 277, 304, 267, 408, 1767, 314, 2900, 13, 3834, 5611, 1041, 267, 372, 291, 423, 923, 339, 768, 1829, 272, 347, 2287, 8, 277, 304, 267, 408, 1767, 314, 2243, 2287, 1041, 267, 372, 291, 423, 1562, 339, 347, 485, 1188, 63, 3282, 8, 277, 304, 267, 372, 359, 288, 2420, 4892, 5318, 582, 291, 423, 4892, 5318, 1386, 288, 2420, 923, 582, 291, 423, 923, 1386, 288, 2420, 1562, 582, 291, 423, 1562, 1386, 267, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 7834, 37, 615, 6430, 2900, 13, 3834, 7891, 12176, 384, 11774, 1041, 199, 504, 315, 1597, 265, 1168, 77, 14, 3431, 14, 1188, 492, 6430, 199, 504, 315, 1597, 265, 1168, 77, 14, 5559, 492, 334, 272, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 16, 56, 1367, 12, 272, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 12, 199, 9, 199, 504, 315, 1597, 265, 1168, 77, 14, 1562, 492, 9906, 421, 199, 533, 2900, 3834, 7891, 6782, 7457, 8, 2209, 304, 272, 408, 7834, 37, 615, 2900, 13, 3834, 20367, 11774, 6430, 14, 339, 6430, 730, 378, 88, 1367, 272, 408, 339, 485, 600, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 16, 56, 1367, 272, 485, 2254, 2320, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 272, 485, 9226, 2320, 275, 603, 1608, 2962, 63, 1761, 63, 7916, 63, 2089, 879, 2160, 63, 13989, 63, 17356, 63, 4305, 272, 485, 1802, 275, 298, 7834, 37, 615, 2900, 13, 3834, 20367, 11774, 6430, 2, 339, 347, 636, 826, 721, 277, 12, 1572, 12, 2287, 304, 267, 408, 9346, 314, 2900, 3834, 7891, 6782, 7457, 8089, 1041, 267, 291, 423, 923, 275, 1572, 267, 291, 423, 1562, 275, 9906, 8, 1562, 9, 267, 291, 423, 4892, 5318, 275, 378, 88, 614, 339, 768, 3744, 272, 347, 687, 63, 1773, 63, 1188, 8, 1886, 12, 3066, 1188, 304, 267, 408, 2499, 1245, 687, 282, 3066, 3696, 2547, 1041, 267, 372, 2900, 3834, 7891, 6782, 7457, 8, 1773, 1188, 59, 19, 467, 3066, 1188, 59, 20, 26, 23, 566, 339, 768, 1829, 272, 347, 1572, 8, 277, 304, 267, 408, 1767, 314, 2900, 13, 3834, 5611, 1041, 267, 372, 291, 423, 923, 339, 768, 1829, 272, 347, 2287, 8, 277, 304, 267, 408, 1767, 314, 2243, 2287, 1041, 267, 372, 291, 423, 1562, 339, 347, 485, 1188, 63, 3282, 8, 277, 304, 267, 372, 359, 288, 2420, 4892, 5318, 582, 291, 423, 4892, 5318, 1386, 288, 2420, 923, 582, 291, 423, 923, 1386, 288, 2420, 1562, 582, 291, 423, 1562, 1386, 267, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
vispeal/VoteHelper
weibonews/weibonews/utils/db/format.py
1
1175
''' Created on Nov 19, 2013 @author: fli ''' import re from weibonews.utils.format import dict2PropertyTable _CONN_RE = re.compile(r"(?P<hosts>(?P<host>[A-Z0-9_.-]+)(?P<portpart>:(?P<port>\d+))?(?P<repls>(?P<repl>,[A-Z0-9_.-]+(:\d+)?)*))/(?P<db>\w+)", re.IGNORECASE) def parse_conn_string(conn_str): ''' parse a connection string to a db dict ''' match = _CONN_RE.search(conn_str) if match: if match.group('repls'): host = match.group('hosts') port = None else: host = match.group('host') port = int(match.group('port')) if match.group('port') else 27017 db_address = match.group('db') return { 'server' : host, 'port' : port, 'db' : db_address } else: raise ValueError('The connection string "%s" is incorrect.' % conn_str) def parse_conn_dict(conn_dict): result = {} for key, conn_str in conn_dict.items(): result[key] = parse_conn_string(conn_str) return result def cursor_to_array(cursor): ''' transform cursor to array ''' items = map(dict2PropertyTable, cursor) return items
gpl-2.0
[ 2344, 199, 10502, 641, 3091, 86, 5851, 12, 6171, 199, 199, 32, 2502, 26, 289, 317, 199, 2344, 199, 199, 646, 295, 199, 504, 781, 1892, 368, 3569, 14, 1208, 14, 908, 492, 1211, 18, 3697, 3186, 199, 199, 63, 17489, 63, 907, 275, 295, 14, 2014, 8, 82, 24726, 48, 28, 5146, 30, 2229, 48, 28, 1102, 9514, 33, 13, 58, 16, 13, 25, 3754, 13, 11896, 2229, 48, 28, 719, 2064, 20020, 2229, 48, 28, 719, 3072, 68, 11, 22119, 2229, 48, 28, 1155, 478, 30, 2229, 48, 28, 16349, 6244, 59, 33, 13, 58, 16, 13, 25, 3754, 20253, 8, 3427, 68, 19544, 3342, 430, 9448, 48, 28, 697, 3072, 87, 11, 4186, 295, 14, 15434, 9, 199, 199, 318, 2198, 63, 1631, 63, 875, 8, 1631, 63, 495, 304, 272, 1449, 2198, 282, 1950, 1059, 370, 282, 1592, 1211, 272, 1449, 272, 1336, 275, 485, 17489, 63, 907, 14, 1733, 8, 1631, 63, 495, 9, 272, 340, 1336, 26, 267, 340, 1336, 14, 923, 360, 1155, 478, 735, 288, 1591, 275, 1336, 14, 923, 360, 5146, 358, 288, 1844, 275, 488, 267, 587, 26, 288, 1591, 275, 1336, 14, 923, 360, 1102, 358, 288, 1844, 275, 1109, 8, 1431, 14, 923, 360, 719, 1333, 340, 1336, 14, 923, 360, 719, 358, 587, 8087, 9570, 267, 1592, 63, 1562, 275, 1336, 14, 923, 360, 697, 358, 267, 372, 469, 288, 283, 1000, 7, 520, 1591, 12, 288, 283, 719, 7, 520, 1844, 12, 288, 283, 697, 7, 520, 1592, 63, 1562, 267, 789, 272, 587, 26, 267, 746, 1722, 360, 1918, 1950, 1059, 2071, 83, 2, 365, 8927, 3530, 450, 2557, 63, 495, 9, 199, 199, 318, 2198, 63, 1631, 63, 807, 8, 1631, 63, 807, 304, 272, 754, 275, 1052, 272, 367, 790, 12, 2557, 63, 495, 315, 2557, 63, 807, 14, 1744, 837, 267, 754, 59, 498, 61, 275, 2198, 63, 1631, 63, 875, 8, 1631, 63, 495, 9, 272, 372, 754, 199, 199, 318, 3920, 63, 475, 63, 1144, 8, 3937, 304, 272, 1449, 5793, 3920, 370, 1625, 272, 1449, 272, 2974, 275, 2341, 8, 807, 18, 3697, 3186, 12, 3920, 9, 272, 372, 2974, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 10502, 641, 3091, 86, 5851, 12, 6171, 199, 199, 32, 2502, 26, 289, 317, 199, 2344, 199, 199, 646, 295, 199, 504, 781, 1892, 368, 3569, 14, 1208, 14, 908, 492, 1211, 18, 3697, 3186, 199, 199, 63, 17489, 63, 907, 275, 295, 14, 2014, 8, 82, 24726, 48, 28, 5146, 30, 2229, 48, 28, 1102, 9514, 33, 13, 58, 16, 13, 25, 3754, 13, 11896, 2229, 48, 28, 719, 2064, 20020, 2229, 48, 28, 719, 3072, 68, 11, 22119, 2229, 48, 28, 1155, 478, 30, 2229, 48, 28, 16349, 6244, 59, 33, 13, 58, 16, 13, 25, 3754, 20253, 8, 3427, 68, 19544, 3342, 430, 9448, 48, 28, 697, 3072, 87, 11, 4186, 295, 14, 15434, 9, 199, 199, 318, 2198, 63, 1631, 63, 875, 8, 1631, 63, 495, 304, 272, 1449, 2198, 282, 1950, 1059, 370, 282, 1592, 1211, 272, 1449, 272, 1336, 275, 485, 17489, 63, 907, 14, 1733, 8, 1631, 63, 495, 9, 272, 340, 1336, 26, 267, 340, 1336, 14, 923, 360, 1155, 478, 735, 288, 1591, 275, 1336, 14, 923, 360, 5146, 358, 288, 1844, 275, 488, 267, 587, 26, 288, 1591, 275, 1336, 14, 923, 360, 1102, 358, 288, 1844, 275, 1109, 8, 1431, 14, 923, 360, 719, 1333, 340, 1336, 14, 923, 360, 719, 358, 587, 8087, 9570, 267, 1592, 63, 1562, 275, 1336, 14, 923, 360, 697, 358, 267, 372, 469, 288, 283, 1000, 7, 520, 1591, 12, 288, 283, 719, 7, 520, 1844, 12, 288, 283, 697, 7, 520, 1592, 63, 1562, 267, 789, 272, 587, 26, 267, 746, 1722, 360, 1918, 1950, 1059, 2071, 83, 2, 365, 8927, 3530, 450, 2557, 63, 495, 9, 199, 199, 318, 2198, 63, 1631, 63, 807, 8, 1631, 63, 807, 304, 272, 754, 275, 1052, 272, 367, 790, 12, 2557, 63, 495, 315, 2557, 63, 807, 14, 1744, 837, 267, 754, 59, 498, 61, 275, 2198, 63, 1631, 63, 875, 8, 1631, 63, 495, 9, 272, 372, 754, 199, 199, 318, 3920, 63, 475, 63, 1144, 8, 3937, 304, 272, 1449, 5793, 3920, 370, 1625, 272, 1449, 272, 2974, 275, 2341, 8, 807, 18, 3697, 3186, 12, 3920, 9, 272, 372, 2974, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ArcherSys/ArcherSys
Lib/distutils/dist.py
1
149498
<<<<<<< HEAD <<<<<<< HEAD """distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. """ import sys, os, re from email import message_from_file try: import warnings except ImportError: warnings = None from distutils.errors import * from distutils.fancy_getopt import FancyGetopt, translate_longopt from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log from distutils.debug import DEBUG # Regex to define acceptable Distutils command names. This is not *quite* # the same as a Python NAME -- I don't allow leading underscores. The fact # that they're very similar is no coincidence; the default naming scheme is # to look for a Python module named after the command. command_re = re.compile (r'^[a-zA-Z]([a-zA-Z0-9_]*)$') class Distribution: """The core of the Distutils. Most of the work hiding behind 'setup' is really done within a Distribution instance, which farms the work out to the Distutils commands specified on the command line. Setup scripts will almost never instantiate Distribution directly, unless the 'setup()' function is totally inadequate to their needs. However, it is conceivable that a setup script might wish to subclass Distribution for some specialized purpose, and then pass the subclass to 'setup()' as the 'distclass' keyword argument. If so, it is necessary to respect the expectations that 'setup' has of Distribution. See the code for 'setup()', in core.py, for details. """ # 'global_options' describes the command-line options that may be # supplied to the setup script prior to any actual commands. # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of # these global options. This list should be kept to a bare minimum, # since every global option is also valid as a command option -- and we # don't want to pollute the commands with too many options that they # have minimal control over. # The fourth entry for verbose means that it can be repeated. global_options = [('verbose', 'v', "run verbosely (default)", 1), ('quiet', 'q', "run quietly (turns verbosity off)"), ('dry-run', 'n', "don't actually do anything"), ('help', 'h', "show detailed help message"), ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'), ] # 'common_usage' is a short (2-3 line) string describing the common # usage of the setup script. common_usage = """\ Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package """ # options that are not propagated to the commands display_options = [ ('help-commands', None, "list all available commands"), ('name', None, "print package name"), ('version', 'V', "print package version"), ('fullname', None, "print <package name>-<version>"), ('author', None, "print the author's name"), ('author-email', None, "print the author's email address"), ('maintainer', None, "print the maintainer's name"), ('maintainer-email', None, "print the maintainer's email address"), ('contact', None, "print the maintainer's name if known, else the author's"), ('contact-email', None, "print the maintainer's email address if known, else the author's"), ('url', None, "print the URL for this package"), ('license', None, "print the license of the package"), ('licence', None, "alias for --license"), ('description', None, "print the package description"), ('long-description', None, "print the long package description"), ('platforms', None, "print the list of platforms"), ('classifiers', None, "print the list of classifiers"), ('keywords', None, "print the list of keywords"), ('provides', None, "print the list of packages/modules provided"), ('requires', None, "print the list of packages/modules required"), ('obsoletes', None, "print the list of packages/modules made obsolete") ] display_option_names = [translate_longopt(x[0]) for x in display_options] # negative options are options that exclude other options negative_opt = {'quiet': 'verbose'} # -- Creation/initialization methods ------------------------------- def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then use 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some null value: 0, None, an empty list or dictionary, etc.) Most importantly, initialize the 'command_obj' attribute to the empty dictionary; this will be filled in with real command objects by 'parse_command_line()'. """ # Default values for our command-line options self.verbose = 1 self.dry_run = 0 self.help = 0 for attr in self.display_option_names: setattr(self, attr, 0) # Store the distribution meta-data (name, version, author, and so # forth) in a separate object -- we're getting to have enough # information here (and enough command-line options) that it's # worth it. Also delegate 'get_XXX()' methods to the 'metadata' # object in a sneaky and underhanded (but efficient!) way. self.metadata = DistributionMetadata() for basename in self.metadata._METHOD_BASENAMES: method_name = "get_" + basename setattr(self, method_name, getattr(self.metadata, method_name)) # 'cmdclass' maps command names to class objects, so we # can 1) quickly figure out which class to instantiate when # we need to create a new command object, and 2) have a way # for the setup script to override command classes self.cmdclass = {} # 'command_packages' is a list of packages in which commands # are searched for. The factory for command 'foo' is expected # to be named 'foo' in the module 'foo' in one of the packages # named here. This list is searched from the left; an error # is raised if no named package provides the command being # searched for. (Always access using get_command_packages().) self.command_packages = None # 'script_name' and 'script_args' are usually set to sys.argv[0] # and sys.argv[1:], but they can be overridden when the caller is # not necessarily a setup script run from the command-line. self.script_name = None self.script_args = None # 'command_options' is where we store command options between # parsing them (from config files, the command-line, etc.) and when # they are actually needed -- ie. when the command in question is # instantiated. It is a dictionary of dictionaries of 2-tuples: # command_options = { command_name : { option : (source, value) } } self.command_options = {} # 'dist_files' is the list of (command, pyversion, file) that # have been created by any dist commands run so far. This is # filled regardless of whether the run is dry or not. pyversion # gives sysconfig.get_python_version() if the dist file is # specific to a Python version, 'any' if it is good for all # Python versions on the target platform, and '' for a source # file. pyversion should not be used to specify minimum or # maximum required Python versions; use the metainfo for that # instead. self.dist_files = [] # These options are really the business of various commands, rather # than of the Distribution itself. We provide aliases for them in # Distribution as a convenience to the developer. self.packages = None self.package_data = {} self.package_dir = None self.py_modules = None self.libraries = None self.headers = None self.ext_modules = None self.ext_package = None self.include_dirs = None self.extra_path = None self.scripts = None self.data_files = None self.password = '' # And now initialize bookkeeping stuff that can't be supplied by # the caller at all. 'command_obj' maps command names to # Command instances -- that's how we enforce that every command # class is a singleton. self.command_obj = {} # 'have_run' maps command names to boolean values; it keeps track # of whether we have actually run a particular command, to make it # cheap to "run" a command whenever we think we might need to -- if # it's already been done, no need for expensive filesystem # operations, we just check the 'have_run' dictionary and carry on. # It's only safe to query 'have_run' for a command class that has # been instantiated -- a false value will be inserted when the # command object is created, and replaced with a true value when # the command is successfully run. Thus it's probably best to use # '.get()' rather than a straight lookup. self.have_run = {} # Now we'll use the attrs dictionary (ultimately, keyword args from # the setup script) to possibly override any or all of these # distribution options. if attrs: # Pull out the set of command options and work on them # specifically. Note that this order guarantees that aliased # command options will override any supplied redundantly # through the general options dictionary. options = attrs.get('options') if options is not None: del attrs['options'] for (command, cmd_options) in options.items(): opt_dict = self.get_option_dict(command) for (opt, val) in cmd_options.items(): opt_dict[opt] = ("setup script", val) if 'licence' in attrs: attrs['license'] = attrs['licence'] del attrs['licence'] msg = "'licence' distribution option is deprecated; use 'license'" if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): setattr(self.metadata, key, val) elif hasattr(self, key): setattr(self, key, val) else: msg = "Unknown distribution option: %s" % repr(key) if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # no-user-cfg is handled before other command line args # because other args override the config files, and this # one is needed before we can load the config files. # If attrs['script_args'] wasn't passed, assume false. # # This also make sure we just look at the global options self.want_user_cfg = True if self.script_args is not None: for arg in self.script_args: if not arg.startswith('-'): break if arg == '--no-user-cfg': self.want_user_cfg = False break self.finalize_options() def get_option_dict(self, command): """Get the option dictionary for a given command. If that command's option dictionary hasn't been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary. """ dict = self.command_options.get(command) if dict is None: dict = self.command_options[command] = {} return dict def dump_option_dicts(self, header=None, commands=None, indent=""): from pprint import pformat if commands is None: # dump all command option dicts commands = sorted(self.command_options.keys()) if header is not None: self.announce(indent + header) indent = indent + " " if not commands: self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: self.announce(indent + "no option dict for '%s' command" % cmd_name) else: self.announce(indent + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) for line in out.split('\n'): self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- def find_config_files(self): """Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac; and setup.cfg in the current directory. The file in the user's home directory can be disabled with the --no-user-cfg option. """ files = [] check_environ() # Where to look for the system-wide Distutils config file sys_dir = os.path.dirname(sys.modules['distutils'].__file__) # Look for the system config file sys_file = os.path.join(sys_dir, "distutils.cfg") if os.path.isfile(sys_file): files.append(sys_file) # What to call the per-user config file if os.name == 'posix': user_filename = ".pydistutils.cfg" else: user_filename = "pydistutils.cfg" # And look for the user config file if self.want_user_cfg: user_file = os.path.join(os.path.expanduser('~'), user_filename) if os.path.isfile(user_file): files.append(user_file) # All platforms support local setup.cfg local_file = "setup.cfg" if os.path.isfile(local_file): files.append(local_file) if DEBUG: self.announce("using config files: %s" % ', '.join(files)) return files def parse_config_files(self, filenames=None): from configparser import ConfigParser # Ignore install directory options if we have a venv if sys.prefix != sys.base_prefix: ignore_options = [ 'install-base', 'install-platbase', 'install-lib', 'install-platlib', 'install-purelib', 'install-headers', 'install-scripts', 'install-data', 'prefix', 'exec-prefix', 'home', 'user', 'root'] else: ignore_options = [] ignore_options = frozenset(ignore_options) if filenames is None: filenames = self.find_config_files() if DEBUG: self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: if DEBUG: self.announce(" reading %s" % filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) opt_dict = self.get_option_dict(section) for opt in options: if opt != '__name__' and opt not in ignore_options: val = parser.get(section,opt) opt = opt.replace('-', '_') opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain # the original filenames that options come from) parser.__init__() # If there was a "global" section in the config file, use it # to set Distribution options. if 'global' in self.command_options: for (opt, (src, val)) in self.command_options['global'].items(): alias = self.negative_opt.get(opt) try: if alias: setattr(self, alias, not strtobool(val)) elif opt in ('verbose', 'dry_run'): # ugh! setattr(self, opt, strtobool(val)) else: setattr(self, opt, val) except ValueError as msg: raise DistutilsOptionError(msg) # -- Command-line parsing methods ---------------------------------- def parse_command_line(self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line was successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # # We now have enough information to show the Macintosh dialog # that allows the user to interactively specify the "command line". # toplevel_options = self._get_toplevel_options() # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is. self.commands = [] parser = FancyGetopt(toplevel_options + self.display_options) parser.set_negative_aliases(self.negative_opt) parser.set_aliases({'licence': 'license'}) args = parser.getopt(args=self.script_args, object=self) option_order = parser.get_option_order() log.set_verbosity(self.verbose) # for display options we return immediately if self.handle_display_options(option_order): return while args: args = self._parse_command_opts(parser, args) if args is None: # user asked for help (and got it) return # Handle the cases of --help as a "global" option, ie. # "setup.py --help" and "setup.py --help command ...". For the # former, we show global options (--verbose, --dry-run, etc.) # and display-only options (--name, --version, etc.); for the # latter, we omit the display-only options and show help for # each command listed on the command line. if self.help: self._show_help(parser, display_options=len(self.commands) == 0, commands=self.commands) return # Oops, no commands found -- an end-user error if not self.commands: raise DistutilsArgError("no commands supplied") # All is well: return true return True def _get_toplevel_options(self): """Return the non-display options recognized at the top level. This includes options that are recognized *only* at the top level as well as options recognized for commands. """ return self.global_options + [ ("command-packages=", None, "list of packages that provide distutils commands"), ] def _parse_command_opts(self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command # Pull the current command from the head of the command line command = args[0] if not command_re.match(command): raise SystemExit("invalid command name '%s'" % command) self.commands.append(command) # Dig up the command class that implements this command, so we # 1) know that it's a valid command, and 2) know which options # it takes. try: cmd_class = self.get_command_class(command) except DistutilsModuleError as msg: raise DistutilsArgError(msg) # Require that the command class be derived from Command -- want # to be sure that the basic "command" interface is implemented. if not issubclass(cmd_class, Command): raise DistutilsClassError( "command class %s must subclass Command" % cmd_class) # Also make sure that the command object provides a list of its # known options. if not (hasattr(cmd_class, 'user_options') and isinstance(cmd_class.user_options, list)): raise DistutilsClassError(("command class %s must provide " + "'user_options' attribute (a list of tuples)") % \ cmd_class) # If the command class has a list of negative alias options, # merge it in with the global negative aliases. negative_opt = self.negative_opt if hasattr(cmd_class, 'negative_opt'): negative_opt = negative_opt.copy() negative_opt.update(cmd_class.negative_opt) # Check for help_options in command class. They have a different # format (tuple of four) so we need to preprocess them here. if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_options = fix_help_options(cmd_class.help_options) else: help_options = [] # All commands support the global options too, just by adding # in 'global_options'. parser.set_option_table(self.global_options + cmd_class.user_options + help_options) parser.set_negative_aliases(negative_opt) (args, opts) = parser.getopt(args[1:]) if hasattr(opts, 'help') and opts.help: self._show_help(parser, display_options=0, commands=[cmd_class]) return if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_option_found=0 for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 if callable(func): func() else: raise DistutilsClassError( "invalid help function %r for help option '%s': " "must be a callable object (function, etc.)" % (func, help_option)) if help_option_found: return # Put the options from the command-line into their official # holding pen, the 'command_options' dictionary. opt_dict = self.get_option_dict(command) for (name, value) in vars(opts).items(): opt_dict[name] = ("command line", value) return args def finalize_options(self): """Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects. """ for attr in ('keywords', 'platforms'): value = getattr(self.metadata, attr) if value is None: continue if isinstance(value, str): value = [elm.strip() for elm in value.split(',')] setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): """Show help for the setup script command-line in the form of several lists of command-line options. 'parser' should be a FancyGetopt instance; do not expect it to be returned in the same state, as its option table will be reset to make it generate the correct help text. If 'global_options' is true, lists the global options: --verbose, --dry-run, etc. If 'display_options' is true, lists the "display-only" options: --name, --version, etc. Finally, lists per-command help for every command name or command class in 'commands'. """ # late import because of mutual dependence between these modules from distutils.core import gen_usage from distutils.cmd import Command if global_options: if display_options: options = self._get_toplevel_options() else: options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") print('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") print('') for command in self.commands: if isinstance(command, type) and issubclass(command, Command): klass = command else: klass = self.get_command_class(command) if (hasattr(klass, 'help_options') and isinstance(klass.help_options, list)): parser.set_option_table(klass.user_options + fix_help_options(klass.help_options)) else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) print('') print(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. """ from distutils.core import gen_usage # User just wants a list of commands -- we'll print it out and stop # processing now (ie. if they ran "setup --help-commands foo bar", # we ignore "foo bar"). if self.help_commands: self.print_commands() print('') print(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then # display that metadata in the order in which the user supplied the # metadata options. any_display_options = 0 is_display_option = {} for option in self.display_options: is_display_option[option[0]] = 1 for (opt, val) in option_order: if val and is_display_option.get(opt): opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: print(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): print('\n'.join(value)) else: print(value) any_display_options = 1 return any_display_options def print_command_list(self, commands, header, max_length): """Print a subset of the list of all commands -- used by 'print_commands()'. """ print(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" print(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) max_length = 0 for cmd in (std_commands + extra_commands): if len(cmd) > max_length: max_length = len(cmd) self.print_command_list(std_commands, "Standard commands", max_length) if extra_commands: print() self.print_command_list(extra_commands, "Extra commands", max_length) def get_command_list(self): """Get a list of (command, description) tuples. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ # Currently this is only used on Mac OS, for the Mac-only GUI # Distutils interface (by Jack Jansen) import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) rv = [] for cmd in (std_commands + extra_commands): klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" rv.append((cmd, description)) return rv # -- Command class/object methods ---------------------------------- def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages if not isinstance(pkgs, list): if pkgs is None: pkgs = '' pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs return pkgs def get_command_class(self, command): """Return the class that implements the Distutils command named by 'command'. First we check the 'cmdclass' dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module ("distutils.command." + command) and fetch the command class from the module. The loaded class is also stored in 'cmdclass' to speed future calls to 'get_command_class()'. Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class. """ klass = self.cmdclass.get(command) if klass: return klass for pkgname in self.get_command_packages(): module_name = "%s.%s" % (pkgname, command) klass_name = command try: __import__ (module_name) module = sys.modules[module_name] except ImportError: continue try: klass = getattr(module, klass_name) except AttributeError: raise DistutilsModuleError( "invalid command '%s' (no class '%s' in module '%s')" % (command, klass_name, module_name)) self.cmdclass[command] = klass return klass raise DistutilsModuleError("invalid command '%s'" % command) def get_command_obj(self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no command object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: self.announce("Distribution.get_command_obj(): " \ "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) self.have_run[command] = 0 # Set any options that were supplied in config files # or on the command line. (NB. support for error # reporting is lame here: any errors aren't reported # until 'finalize_options()' is called, which means # we won't report the source of the error.) options = self.command_options.get(command) if options: self._set_command_options(cmd_obj, options) return cmd_obj def _set_command_options(self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionary for this command (from 'self.command_options'). """ command_name = command_obj.get_command_name() if option_dict is None: option_dict = self.get_option_dict(command_name) if DEBUG: self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): if DEBUG: self.announce(" %s = %s (from %s)" % (option, value, source)) try: bool_opts = [translate_longopt(o) for o in command_obj.boolean_options] except AttributeError: bool_opts = [] try: neg_opt = command_obj.negative_opt except AttributeError: neg_opt = {} try: is_string = isinstance(value, str) if option in neg_opt and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) else: raise DistutilsOptionError( "error in %s: command '%s' has no such option '%s'" % (source, command_name, option)) except ValueError as msg: raise DistutilsOptionError(msg) def reinitialize_command(self, command, reinit_subcommands=0): """Reinitializes a command to the state it was in when first returned by 'get_command_obj()': ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for real. 'command' should be a command name (string) or command object. If 'reinit_subcommands' is true, also reinitializes the command's sub-commands, as declared by the 'sub_commands' class attribute (if it has one). See the "install" command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true. Returns the reinitialized command object. """ from distutils.cmd import Command if not isinstance(command, Command): command_name = command command = self.get_command_obj(command_name) else: command_name = command.get_command_name() if not command.finalized: return command command.initialize_options() command.finalized = 0 self.have_run[command_name] = 0 self._set_command_options(command) if reinit_subcommands: for sub in command.get_sub_commands(): self.reinitialize_command(sub, reinit_subcommands) return command # -- Methods that operate on the Distribution ---------------------- def announce(self, msg, level=log.INFO): log.log(level, msg) def run_commands(self): """Run each command that was seen on the setup script command line. Uses the list of commands found and cache of command objects created by 'get_command_obj()'. """ for cmd in self.commands: self.run_command(cmd) # -- Methods that operate on its Commands -------------------------- def run_command(self, command): """Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by 'command', return silently without doing anything. If the command named by 'command' doesn't even have a command object yet, create one. Then invoke 'run()' on that command object (or an existing one). """ # Already been here, done that? then return silently. if self.have_run.get(command): return log.info("running %s", command) cmd_obj = self.get_command_obj(command) cmd_obj.ensure_finalized() cmd_obj.run() self.have_run[command] = 1 # -- Distribution query methods ------------------------------------ def has_pure_modules(self): return len(self.packages or self.py_modules or []) > 0 def has_ext_modules(self): return self.ext_modules and len(self.ext_modules) > 0 def has_c_libraries(self): return self.libraries and len(self.libraries) > 0 def has_modules(self): return self.has_pure_modules() or self.has_ext_modules() def has_headers(self): return self.headers and len(self.headers) > 0 def has_scripts(self): return self.scripts and len(self.scripts) > 0 def has_data_files(self): return self.data_files and len(self.data_files) > 0 def is_pure(self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries()) # -- Metadata query methods ---------------------------------------- # If you're looking for 'get_name()', 'get_version()', and so forth, # they are defined in a sneaky way: the constructor binds self.get_XXX # to self.metadata.get_XXX. The actual code is in the # DistributionMetadata class, below. class DistributionMetadata: """Dummy class to hold the distribution meta-data: name, version, author, and so forth. """ _METHOD_BASENAMES = ("name", "version", "author", "author_email", "maintainer", "maintainer_email", "url", "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", "contact_email", "license", "classifiers", "download_url", # PEP 314 "provides", "requires", "obsoletes", ) def __init__(self, path=None): if path is not None: self.read_pkg_file(open(path)) else: self.name = None self.version = None self.author = None self.author_email = None self.maintainer = None self.maintainer_email = None self.url = None self.license = None self.description = None self.long_description = None self.keywords = None self.platforms = None self.classifiers = None self.download_url = None # PEP 314 self.provides = None self.requires = None self.obsoletes = None def read_pkg_file(self, file): """Reads the metadata values from a file object.""" msg = message_from_file(file) def _read_field(name): value = msg[name] if value == 'UNKNOWN': return None return value def _read_list(name): values = msg.get_all(name, None) if values == []: return None return values metadata_version = msg['metadata-version'] self.name = _read_field('name') self.version = _read_field('version') self.description = _read_field('summary') # we are filling author only. self.author = _read_field('author') self.maintainer = None self.author_email = _read_field('author-email') self.maintainer_email = None self.url = _read_field('home-page') self.license = _read_field('license') if 'download-url' in msg: self.download_url = _read_field('download-url') else: self.download_url = None self.long_description = _read_field('description') self.description = _read_field('summary') if 'keywords' in msg: self.keywords = _read_field('keywords').split(',') self.platforms = _read_list('platform') self.classifiers = _read_list('classifier') # PEP 314 - these fields only exist in 1.1 if metadata_version == '1.1': self.requires = _read_list('requires') self.provides = _read_list('provides') self.obsoletes = _read_list('obsoletes') else: self.requires = None self.provides = None self.obsoletes = None def write_pkg_info(self, base_dir): """Write the PKG-INFO file into the release tree. """ with open(os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8') as pkg_info: self.write_pkg_file(pkg_info) def write_pkg_file(self, file): """Write the PKG-INFO format data to a file object. """ version = '1.0' if (self.provides or self.requires or self.obsoletes or self.classifiers or self.download_url): version = '1.1' file.write('Metadata-Version: %s\n' % version) file.write('Name: %s\n' % self.get_name() ) file.write('Version: %s\n' % self.get_version() ) file.write('Summary: %s\n' % self.get_description() ) file.write('Home-page: %s\n' % self.get_url() ) file.write('Author: %s\n' % self.get_contact() ) file.write('Author-email: %s\n' % self.get_contact_email() ) file.write('License: %s\n' % self.get_license() ) if self.download_url: file.write('Download-URL: %s\n' % self.download_url) long_desc = rfc822_escape(self.get_long_description()) file.write('Description: %s\n' % long_desc) keywords = ','.join(self.get_keywords()) if keywords: file.write('Keywords: %s\n' % keywords ) self._write_list(file, 'Platform', self.get_platforms()) self._write_list(file, 'Classifier', self.get_classifiers()) # PEP 314 self._write_list(file, 'Requires', self.get_requires()) self._write_list(file, 'Provides', self.get_provides()) self._write_list(file, 'Obsoletes', self.get_obsoletes()) def _write_list(self, file, name, values): for value in values: file.write('%s: %s\n' % (name, value)) # -- Metadata query methods ---------------------------------------- def get_name(self): return self.name or "UNKNOWN" def get_version(self): return self.version or "0.0.0" def get_fullname(self): return "%s-%s" % (self.get_name(), self.get_version()) def get_author(self): return self.author or "UNKNOWN" def get_author_email(self): return self.author_email or "UNKNOWN" def get_maintainer(self): return self.maintainer or "UNKNOWN" def get_maintainer_email(self): return self.maintainer_email or "UNKNOWN" def get_contact(self): return self.maintainer or self.author or "UNKNOWN" def get_contact_email(self): return self.maintainer_email or self.author_email or "UNKNOWN" def get_url(self): return self.url or "UNKNOWN" def get_license(self): return self.license or "UNKNOWN" get_licence = get_license def get_description(self): return self.description or "UNKNOWN" def get_long_description(self): return self.long_description or "UNKNOWN" def get_keywords(self): return self.keywords or [] def get_platforms(self): return self.platforms or ["UNKNOWN"] def get_classifiers(self): return self.classifiers or [] def get_download_url(self): return self.download_url or "UNKNOWN" # PEP 314 def get_requires(self): return self.requires or [] def set_requires(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.requires = value def get_provides(self): return self.provides or [] def set_provides(self, value): value = [v.strip() for v in value] for v in value: import distutils.versionpredicate distutils.versionpredicate.split_provision(v) self.provides = value def get_obsoletes(self): return self.obsoletes or [] def set_obsoletes(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.obsoletes = value def fix_help_options(options): """Convert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. """ new_options = [] for help_tuple in options: new_options.append(help_tuple[0:3]) return new_options ======= """distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. """ import sys, os, re from email import message_from_file try: import warnings except ImportError: warnings = None from distutils.errors import * from distutils.fancy_getopt import FancyGetopt, translate_longopt from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log from distutils.debug import DEBUG # Regex to define acceptable Distutils command names. This is not *quite* # the same as a Python NAME -- I don't allow leading underscores. The fact # that they're very similar is no coincidence; the default naming scheme is # to look for a Python module named after the command. command_re = re.compile (r'^[a-zA-Z]([a-zA-Z0-9_]*)$') class Distribution: """The core of the Distutils. Most of the work hiding behind 'setup' is really done within a Distribution instance, which farms the work out to the Distutils commands specified on the command line. Setup scripts will almost never instantiate Distribution directly, unless the 'setup()' function is totally inadequate to their needs. However, it is conceivable that a setup script might wish to subclass Distribution for some specialized purpose, and then pass the subclass to 'setup()' as the 'distclass' keyword argument. If so, it is necessary to respect the expectations that 'setup' has of Distribution. See the code for 'setup()', in core.py, for details. """ # 'global_options' describes the command-line options that may be # supplied to the setup script prior to any actual commands. # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of # these global options. This list should be kept to a bare minimum, # since every global option is also valid as a command option -- and we # don't want to pollute the commands with too many options that they # have minimal control over. # The fourth entry for verbose means that it can be repeated. global_options = [('verbose', 'v', "run verbosely (default)", 1), ('quiet', 'q', "run quietly (turns verbosity off)"), ('dry-run', 'n', "don't actually do anything"), ('help', 'h', "show detailed help message"), ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'), ] # 'common_usage' is a short (2-3 line) string describing the common # usage of the setup script. common_usage = """\ Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package """ # options that are not propagated to the commands display_options = [ ('help-commands', None, "list all available commands"), ('name', None, "print package name"), ('version', 'V', "print package version"), ('fullname', None, "print <package name>-<version>"), ('author', None, "print the author's name"), ('author-email', None, "print the author's email address"), ('maintainer', None, "print the maintainer's name"), ('maintainer-email', None, "print the maintainer's email address"), ('contact', None, "print the maintainer's name if known, else the author's"), ('contact-email', None, "print the maintainer's email address if known, else the author's"), ('url', None, "print the URL for this package"), ('license', None, "print the license of the package"), ('licence', None, "alias for --license"), ('description', None, "print the package description"), ('long-description', None, "print the long package description"), ('platforms', None, "print the list of platforms"), ('classifiers', None, "print the list of classifiers"), ('keywords', None, "print the list of keywords"), ('provides', None, "print the list of packages/modules provided"), ('requires', None, "print the list of packages/modules required"), ('obsoletes', None, "print the list of packages/modules made obsolete") ] display_option_names = [translate_longopt(x[0]) for x in display_options] # negative options are options that exclude other options negative_opt = {'quiet': 'verbose'} # -- Creation/initialization methods ------------------------------- def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then use 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some null value: 0, None, an empty list or dictionary, etc.) Most importantly, initialize the 'command_obj' attribute to the empty dictionary; this will be filled in with real command objects by 'parse_command_line()'. """ # Default values for our command-line options self.verbose = 1 self.dry_run = 0 self.help = 0 for attr in self.display_option_names: setattr(self, attr, 0) # Store the distribution meta-data (name, version, author, and so # forth) in a separate object -- we're getting to have enough # information here (and enough command-line options) that it's # worth it. Also delegate 'get_XXX()' methods to the 'metadata' # object in a sneaky and underhanded (but efficient!) way. self.metadata = DistributionMetadata() for basename in self.metadata._METHOD_BASENAMES: method_name = "get_" + basename setattr(self, method_name, getattr(self.metadata, method_name)) # 'cmdclass' maps command names to class objects, so we # can 1) quickly figure out which class to instantiate when # we need to create a new command object, and 2) have a way # for the setup script to override command classes self.cmdclass = {} # 'command_packages' is a list of packages in which commands # are searched for. The factory for command 'foo' is expected # to be named 'foo' in the module 'foo' in one of the packages # named here. This list is searched from the left; an error # is raised if no named package provides the command being # searched for. (Always access using get_command_packages().) self.command_packages = None # 'script_name' and 'script_args' are usually set to sys.argv[0] # and sys.argv[1:], but they can be overridden when the caller is # not necessarily a setup script run from the command-line. self.script_name = None self.script_args = None # 'command_options' is where we store command options between # parsing them (from config files, the command-line, etc.) and when # they are actually needed -- ie. when the command in question is # instantiated. It is a dictionary of dictionaries of 2-tuples: # command_options = { command_name : { option : (source, value) } } self.command_options = {} # 'dist_files' is the list of (command, pyversion, file) that # have been created by any dist commands run so far. This is # filled regardless of whether the run is dry or not. pyversion # gives sysconfig.get_python_version() if the dist file is # specific to a Python version, 'any' if it is good for all # Python versions on the target platform, and '' for a source # file. pyversion should not be used to specify minimum or # maximum required Python versions; use the metainfo for that # instead. self.dist_files = [] # These options are really the business of various commands, rather # than of the Distribution itself. We provide aliases for them in # Distribution as a convenience to the developer. self.packages = None self.package_data = {} self.package_dir = None self.py_modules = None self.libraries = None self.headers = None self.ext_modules = None self.ext_package = None self.include_dirs = None self.extra_path = None self.scripts = None self.data_files = None self.password = '' # And now initialize bookkeeping stuff that can't be supplied by # the caller at all. 'command_obj' maps command names to # Command instances -- that's how we enforce that every command # class is a singleton. self.command_obj = {} # 'have_run' maps command names to boolean values; it keeps track # of whether we have actually run a particular command, to make it # cheap to "run" a command whenever we think we might need to -- if # it's already been done, no need for expensive filesystem # operations, we just check the 'have_run' dictionary and carry on. # It's only safe to query 'have_run' for a command class that has # been instantiated -- a false value will be inserted when the # command object is created, and replaced with a true value when # the command is successfully run. Thus it's probably best to use # '.get()' rather than a straight lookup. self.have_run = {} # Now we'll use the attrs dictionary (ultimately, keyword args from # the setup script) to possibly override any or all of these # distribution options. if attrs: # Pull out the set of command options and work on them # specifically. Note that this order guarantees that aliased # command options will override any supplied redundantly # through the general options dictionary. options = attrs.get('options') if options is not None: del attrs['options'] for (command, cmd_options) in options.items(): opt_dict = self.get_option_dict(command) for (opt, val) in cmd_options.items(): opt_dict[opt] = ("setup script", val) if 'licence' in attrs: attrs['license'] = attrs['licence'] del attrs['licence'] msg = "'licence' distribution option is deprecated; use 'license'" if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): setattr(self.metadata, key, val) elif hasattr(self, key): setattr(self, key, val) else: msg = "Unknown distribution option: %s" % repr(key) if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # no-user-cfg is handled before other command line args # because other args override the config files, and this # one is needed before we can load the config files. # If attrs['script_args'] wasn't passed, assume false. # # This also make sure we just look at the global options self.want_user_cfg = True if self.script_args is not None: for arg in self.script_args: if not arg.startswith('-'): break if arg == '--no-user-cfg': self.want_user_cfg = False break self.finalize_options() def get_option_dict(self, command): """Get the option dictionary for a given command. If that command's option dictionary hasn't been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary. """ dict = self.command_options.get(command) if dict is None: dict = self.command_options[command] = {} return dict def dump_option_dicts(self, header=None, commands=None, indent=""): from pprint import pformat if commands is None: # dump all command option dicts commands = sorted(self.command_options.keys()) if header is not None: self.announce(indent + header) indent = indent + " " if not commands: self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: self.announce(indent + "no option dict for '%s' command" % cmd_name) else: self.announce(indent + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) for line in out.split('\n'): self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- def find_config_files(self): """Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac; and setup.cfg in the current directory. The file in the user's home directory can be disabled with the --no-user-cfg option. """ files = [] check_environ() # Where to look for the system-wide Distutils config file sys_dir = os.path.dirname(sys.modules['distutils'].__file__) # Look for the system config file sys_file = os.path.join(sys_dir, "distutils.cfg") if os.path.isfile(sys_file): files.append(sys_file) # What to call the per-user config file if os.name == 'posix': user_filename = ".pydistutils.cfg" else: user_filename = "pydistutils.cfg" # And look for the user config file if self.want_user_cfg: user_file = os.path.join(os.path.expanduser('~'), user_filename) if os.path.isfile(user_file): files.append(user_file) # All platforms support local setup.cfg local_file = "setup.cfg" if os.path.isfile(local_file): files.append(local_file) if DEBUG: self.announce("using config files: %s" % ', '.join(files)) return files def parse_config_files(self, filenames=None): from configparser import ConfigParser # Ignore install directory options if we have a venv if sys.prefix != sys.base_prefix: ignore_options = [ 'install-base', 'install-platbase', 'install-lib', 'install-platlib', 'install-purelib', 'install-headers', 'install-scripts', 'install-data', 'prefix', 'exec-prefix', 'home', 'user', 'root'] else: ignore_options = [] ignore_options = frozenset(ignore_options) if filenames is None: filenames = self.find_config_files() if DEBUG: self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: if DEBUG: self.announce(" reading %s" % filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) opt_dict = self.get_option_dict(section) for opt in options: if opt != '__name__' and opt not in ignore_options: val = parser.get(section,opt) opt = opt.replace('-', '_') opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain # the original filenames that options come from) parser.__init__() # If there was a "global" section in the config file, use it # to set Distribution options. if 'global' in self.command_options: for (opt, (src, val)) in self.command_options['global'].items(): alias = self.negative_opt.get(opt) try: if alias: setattr(self, alias, not strtobool(val)) elif opt in ('verbose', 'dry_run'): # ugh! setattr(self, opt, strtobool(val)) else: setattr(self, opt, val) except ValueError as msg: raise DistutilsOptionError(msg) # -- Command-line parsing methods ---------------------------------- def parse_command_line(self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line was successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # # We now have enough information to show the Macintosh dialog # that allows the user to interactively specify the "command line". # toplevel_options = self._get_toplevel_options() # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is. self.commands = [] parser = FancyGetopt(toplevel_options + self.display_options) parser.set_negative_aliases(self.negative_opt) parser.set_aliases({'licence': 'license'}) args = parser.getopt(args=self.script_args, object=self) option_order = parser.get_option_order() log.set_verbosity(self.verbose) # for display options we return immediately if self.handle_display_options(option_order): return while args: args = self._parse_command_opts(parser, args) if args is None: # user asked for help (and got it) return # Handle the cases of --help as a "global" option, ie. # "setup.py --help" and "setup.py --help command ...". For the # former, we show global options (--verbose, --dry-run, etc.) # and display-only options (--name, --version, etc.); for the # latter, we omit the display-only options and show help for # each command listed on the command line. if self.help: self._show_help(parser, display_options=len(self.commands) == 0, commands=self.commands) return # Oops, no commands found -- an end-user error if not self.commands: raise DistutilsArgError("no commands supplied") # All is well: return true return True def _get_toplevel_options(self): """Return the non-display options recognized at the top level. This includes options that are recognized *only* at the top level as well as options recognized for commands. """ return self.global_options + [ ("command-packages=", None, "list of packages that provide distutils commands"), ] def _parse_command_opts(self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command # Pull the current command from the head of the command line command = args[0] if not command_re.match(command): raise SystemExit("invalid command name '%s'" % command) self.commands.append(command) # Dig up the command class that implements this command, so we # 1) know that it's a valid command, and 2) know which options # it takes. try: cmd_class = self.get_command_class(command) except DistutilsModuleError as msg: raise DistutilsArgError(msg) # Require that the command class be derived from Command -- want # to be sure that the basic "command" interface is implemented. if not issubclass(cmd_class, Command): raise DistutilsClassError( "command class %s must subclass Command" % cmd_class) # Also make sure that the command object provides a list of its # known options. if not (hasattr(cmd_class, 'user_options') and isinstance(cmd_class.user_options, list)): raise DistutilsClassError(("command class %s must provide " + "'user_options' attribute (a list of tuples)") % \ cmd_class) # If the command class has a list of negative alias options, # merge it in with the global negative aliases. negative_opt = self.negative_opt if hasattr(cmd_class, 'negative_opt'): negative_opt = negative_opt.copy() negative_opt.update(cmd_class.negative_opt) # Check for help_options in command class. They have a different # format (tuple of four) so we need to preprocess them here. if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_options = fix_help_options(cmd_class.help_options) else: help_options = [] # All commands support the global options too, just by adding # in 'global_options'. parser.set_option_table(self.global_options + cmd_class.user_options + help_options) parser.set_negative_aliases(negative_opt) (args, opts) = parser.getopt(args[1:]) if hasattr(opts, 'help') and opts.help: self._show_help(parser, display_options=0, commands=[cmd_class]) return if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_option_found=0 for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 if callable(func): func() else: raise DistutilsClassError( "invalid help function %r for help option '%s': " "must be a callable object (function, etc.)" % (func, help_option)) if help_option_found: return # Put the options from the command-line into their official # holding pen, the 'command_options' dictionary. opt_dict = self.get_option_dict(command) for (name, value) in vars(opts).items(): opt_dict[name] = ("command line", value) return args def finalize_options(self): """Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects. """ for attr in ('keywords', 'platforms'): value = getattr(self.metadata, attr) if value is None: continue if isinstance(value, str): value = [elm.strip() for elm in value.split(',')] setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): """Show help for the setup script command-line in the form of several lists of command-line options. 'parser' should be a FancyGetopt instance; do not expect it to be returned in the same state, as its option table will be reset to make it generate the correct help text. If 'global_options' is true, lists the global options: --verbose, --dry-run, etc. If 'display_options' is true, lists the "display-only" options: --name, --version, etc. Finally, lists per-command help for every command name or command class in 'commands'. """ # late import because of mutual dependence between these modules from distutils.core import gen_usage from distutils.cmd import Command if global_options: if display_options: options = self._get_toplevel_options() else: options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") print('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") print('') for command in self.commands: if isinstance(command, type) and issubclass(command, Command): klass = command else: klass = self.get_command_class(command) if (hasattr(klass, 'help_options') and isinstance(klass.help_options, list)): parser.set_option_table(klass.user_options + fix_help_options(klass.help_options)) else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) print('') print(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. """ from distutils.core import gen_usage # User just wants a list of commands -- we'll print it out and stop # processing now (ie. if they ran "setup --help-commands foo bar", # we ignore "foo bar"). if self.help_commands: self.print_commands() print('') print(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then # display that metadata in the order in which the user supplied the # metadata options. any_display_options = 0 is_display_option = {} for option in self.display_options: is_display_option[option[0]] = 1 for (opt, val) in option_order: if val and is_display_option.get(opt): opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: print(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): print('\n'.join(value)) else: print(value) any_display_options = 1 return any_display_options def print_command_list(self, commands, header, max_length): """Print a subset of the list of all commands -- used by 'print_commands()'. """ print(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" print(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) max_length = 0 for cmd in (std_commands + extra_commands): if len(cmd) > max_length: max_length = len(cmd) self.print_command_list(std_commands, "Standard commands", max_length) if extra_commands: print() self.print_command_list(extra_commands, "Extra commands", max_length) def get_command_list(self): """Get a list of (command, description) tuples. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ # Currently this is only used on Mac OS, for the Mac-only GUI # Distutils interface (by Jack Jansen) import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) rv = [] for cmd in (std_commands + extra_commands): klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" rv.append((cmd, description)) return rv # -- Command class/object methods ---------------------------------- def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages if not isinstance(pkgs, list): if pkgs is None: pkgs = '' pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs return pkgs def get_command_class(self, command): """Return the class that implements the Distutils command named by 'command'. First we check the 'cmdclass' dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module ("distutils.command." + command) and fetch the command class from the module. The loaded class is also stored in 'cmdclass' to speed future calls to 'get_command_class()'. Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class. """ klass = self.cmdclass.get(command) if klass: return klass for pkgname in self.get_command_packages(): module_name = "%s.%s" % (pkgname, command) klass_name = command try: __import__ (module_name) module = sys.modules[module_name] except ImportError: continue try: klass = getattr(module, klass_name) except AttributeError: raise DistutilsModuleError( "invalid command '%s' (no class '%s' in module '%s')" % (command, klass_name, module_name)) self.cmdclass[command] = klass return klass raise DistutilsModuleError("invalid command '%s'" % command) def get_command_obj(self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no command object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: self.announce("Distribution.get_command_obj(): " \ "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) self.have_run[command] = 0 # Set any options that were supplied in config files # or on the command line. (NB. support for error # reporting is lame here: any errors aren't reported # until 'finalize_options()' is called, which means # we won't report the source of the error.) options = self.command_options.get(command) if options: self._set_command_options(cmd_obj, options) return cmd_obj def _set_command_options(self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionary for this command (from 'self.command_options'). """ command_name = command_obj.get_command_name() if option_dict is None: option_dict = self.get_option_dict(command_name) if DEBUG: self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): if DEBUG: self.announce(" %s = %s (from %s)" % (option, value, source)) try: bool_opts = [translate_longopt(o) for o in command_obj.boolean_options] except AttributeError: bool_opts = [] try: neg_opt = command_obj.negative_opt except AttributeError: neg_opt = {} try: is_string = isinstance(value, str) if option in neg_opt and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) else: raise DistutilsOptionError( "error in %s: command '%s' has no such option '%s'" % (source, command_name, option)) except ValueError as msg: raise DistutilsOptionError(msg) def reinitialize_command(self, command, reinit_subcommands=0): """Reinitializes a command to the state it was in when first returned by 'get_command_obj()': ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for real. 'command' should be a command name (string) or command object. If 'reinit_subcommands' is true, also reinitializes the command's sub-commands, as declared by the 'sub_commands' class attribute (if it has one). See the "install" command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true. Returns the reinitialized command object. """ from distutils.cmd import Command if not isinstance(command, Command): command_name = command command = self.get_command_obj(command_name) else: command_name = command.get_command_name() if not command.finalized: return command command.initialize_options() command.finalized = 0 self.have_run[command_name] = 0 self._set_command_options(command) if reinit_subcommands: for sub in command.get_sub_commands(): self.reinitialize_command(sub, reinit_subcommands) return command # -- Methods that operate on the Distribution ---------------------- def announce(self, msg, level=log.INFO): log.log(level, msg) def run_commands(self): """Run each command that was seen on the setup script command line. Uses the list of commands found and cache of command objects created by 'get_command_obj()'. """ for cmd in self.commands: self.run_command(cmd) # -- Methods that operate on its Commands -------------------------- def run_command(self, command): """Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by 'command', return silently without doing anything. If the command named by 'command' doesn't even have a command object yet, create one. Then invoke 'run()' on that command object (or an existing one). """ # Already been here, done that? then return silently. if self.have_run.get(command): return log.info("running %s", command) cmd_obj = self.get_command_obj(command) cmd_obj.ensure_finalized() cmd_obj.run() self.have_run[command] = 1 # -- Distribution query methods ------------------------------------ def has_pure_modules(self): return len(self.packages or self.py_modules or []) > 0 def has_ext_modules(self): return self.ext_modules and len(self.ext_modules) > 0 def has_c_libraries(self): return self.libraries and len(self.libraries) > 0 def has_modules(self): return self.has_pure_modules() or self.has_ext_modules() def has_headers(self): return self.headers and len(self.headers) > 0 def has_scripts(self): return self.scripts and len(self.scripts) > 0 def has_data_files(self): return self.data_files and len(self.data_files) > 0 def is_pure(self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries()) # -- Metadata query methods ---------------------------------------- # If you're looking for 'get_name()', 'get_version()', and so forth, # they are defined in a sneaky way: the constructor binds self.get_XXX # to self.metadata.get_XXX. The actual code is in the # DistributionMetadata class, below. class DistributionMetadata: """Dummy class to hold the distribution meta-data: name, version, author, and so forth. """ _METHOD_BASENAMES = ("name", "version", "author", "author_email", "maintainer", "maintainer_email", "url", "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", "contact_email", "license", "classifiers", "download_url", # PEP 314 "provides", "requires", "obsoletes", ) def __init__(self, path=None): if path is not None: self.read_pkg_file(open(path)) else: self.name = None self.version = None self.author = None self.author_email = None self.maintainer = None self.maintainer_email = None self.url = None self.license = None self.description = None self.long_description = None self.keywords = None self.platforms = None self.classifiers = None self.download_url = None # PEP 314 self.provides = None self.requires = None self.obsoletes = None def read_pkg_file(self, file): """Reads the metadata values from a file object.""" msg = message_from_file(file) def _read_field(name): value = msg[name] if value == 'UNKNOWN': return None return value def _read_list(name): values = msg.get_all(name, None) if values == []: return None return values metadata_version = msg['metadata-version'] self.name = _read_field('name') self.version = _read_field('version') self.description = _read_field('summary') # we are filling author only. self.author = _read_field('author') self.maintainer = None self.author_email = _read_field('author-email') self.maintainer_email = None self.url = _read_field('home-page') self.license = _read_field('license') if 'download-url' in msg: self.download_url = _read_field('download-url') else: self.download_url = None self.long_description = _read_field('description') self.description = _read_field('summary') if 'keywords' in msg: self.keywords = _read_field('keywords').split(',') self.platforms = _read_list('platform') self.classifiers = _read_list('classifier') # PEP 314 - these fields only exist in 1.1 if metadata_version == '1.1': self.requires = _read_list('requires') self.provides = _read_list('provides') self.obsoletes = _read_list('obsoletes') else: self.requires = None self.provides = None self.obsoletes = None def write_pkg_info(self, base_dir): """Write the PKG-INFO file into the release tree. """ with open(os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8') as pkg_info: self.write_pkg_file(pkg_info) def write_pkg_file(self, file): """Write the PKG-INFO format data to a file object. """ version = '1.0' if (self.provides or self.requires or self.obsoletes or self.classifiers or self.download_url): version = '1.1' file.write('Metadata-Version: %s\n' % version) file.write('Name: %s\n' % self.get_name() ) file.write('Version: %s\n' % self.get_version() ) file.write('Summary: %s\n' % self.get_description() ) file.write('Home-page: %s\n' % self.get_url() ) file.write('Author: %s\n' % self.get_contact() ) file.write('Author-email: %s\n' % self.get_contact_email() ) file.write('License: %s\n' % self.get_license() ) if self.download_url: file.write('Download-URL: %s\n' % self.download_url) long_desc = rfc822_escape(self.get_long_description()) file.write('Description: %s\n' % long_desc) keywords = ','.join(self.get_keywords()) if keywords: file.write('Keywords: %s\n' % keywords ) self._write_list(file, 'Platform', self.get_platforms()) self._write_list(file, 'Classifier', self.get_classifiers()) # PEP 314 self._write_list(file, 'Requires', self.get_requires()) self._write_list(file, 'Provides', self.get_provides()) self._write_list(file, 'Obsoletes', self.get_obsoletes()) def _write_list(self, file, name, values): for value in values: file.write('%s: %s\n' % (name, value)) # -- Metadata query methods ---------------------------------------- def get_name(self): return self.name or "UNKNOWN" def get_version(self): return self.version or "0.0.0" def get_fullname(self): return "%s-%s" % (self.get_name(), self.get_version()) def get_author(self): return self.author or "UNKNOWN" def get_author_email(self): return self.author_email or "UNKNOWN" def get_maintainer(self): return self.maintainer or "UNKNOWN" def get_maintainer_email(self): return self.maintainer_email or "UNKNOWN" def get_contact(self): return self.maintainer or self.author or "UNKNOWN" def get_contact_email(self): return self.maintainer_email or self.author_email or "UNKNOWN" def get_url(self): return self.url or "UNKNOWN" def get_license(self): return self.license or "UNKNOWN" get_licence = get_license def get_description(self): return self.description or "UNKNOWN" def get_long_description(self): return self.long_description or "UNKNOWN" def get_keywords(self): return self.keywords or [] def get_platforms(self): return self.platforms or ["UNKNOWN"] def get_classifiers(self): return self.classifiers or [] def get_download_url(self): return self.download_url or "UNKNOWN" # PEP 314 def get_requires(self): return self.requires or [] def set_requires(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.requires = value def get_provides(self): return self.provides or [] def set_provides(self, value): value = [v.strip() for v in value] for v in value: import distutils.versionpredicate distutils.versionpredicate.split_provision(v) self.provides = value def get_obsoletes(self): return self.obsoletes or [] def set_obsoletes(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.obsoletes = value def fix_help_options(options): """Convert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. """ new_options = [] for help_tuple in options: new_options.append(help_tuple[0:3]) return new_options >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453 ======= """distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. """ import sys, os, re from email import message_from_file try: import warnings except ImportError: warnings = None from distutils.errors import * from distutils.fancy_getopt import FancyGetopt, translate_longopt from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log from distutils.debug import DEBUG # Regex to define acceptable Distutils command names. This is not *quite* # the same as a Python NAME -- I don't allow leading underscores. The fact # that they're very similar is no coincidence; the default naming scheme is # to look for a Python module named after the command. command_re = re.compile (r'^[a-zA-Z]([a-zA-Z0-9_]*)$') class Distribution: """The core of the Distutils. Most of the work hiding behind 'setup' is really done within a Distribution instance, which farms the work out to the Distutils commands specified on the command line. Setup scripts will almost never instantiate Distribution directly, unless the 'setup()' function is totally inadequate to their needs. However, it is conceivable that a setup script might wish to subclass Distribution for some specialized purpose, and then pass the subclass to 'setup()' as the 'distclass' keyword argument. If so, it is necessary to respect the expectations that 'setup' has of Distribution. See the code for 'setup()', in core.py, for details. """ # 'global_options' describes the command-line options that may be # supplied to the setup script prior to any actual commands. # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of # these global options. This list should be kept to a bare minimum, # since every global option is also valid as a command option -- and we # don't want to pollute the commands with too many options that they # have minimal control over. # The fourth entry for verbose means that it can be repeated. global_options = [('verbose', 'v', "run verbosely (default)", 1), ('quiet', 'q', "run quietly (turns verbosity off)"), ('dry-run', 'n', "don't actually do anything"), ('help', 'h', "show detailed help message"), ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'), ] # 'common_usage' is a short (2-3 line) string describing the common # usage of the setup script. common_usage = """\ Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package """ # options that are not propagated to the commands display_options = [ ('help-commands', None, "list all available commands"), ('name', None, "print package name"), ('version', 'V', "print package version"), ('fullname', None, "print <package name>-<version>"), ('author', None, "print the author's name"), ('author-email', None, "print the author's email address"), ('maintainer', None, "print the maintainer's name"), ('maintainer-email', None, "print the maintainer's email address"), ('contact', None, "print the maintainer's name if known, else the author's"), ('contact-email', None, "print the maintainer's email address if known, else the author's"), ('url', None, "print the URL for this package"), ('license', None, "print the license of the package"), ('licence', None, "alias for --license"), ('description', None, "print the package description"), ('long-description', None, "print the long package description"), ('platforms', None, "print the list of platforms"), ('classifiers', None, "print the list of classifiers"), ('keywords', None, "print the list of keywords"), ('provides', None, "print the list of packages/modules provided"), ('requires', None, "print the list of packages/modules required"), ('obsoletes', None, "print the list of packages/modules made obsolete") ] display_option_names = [translate_longopt(x[0]) for x in display_options] # negative options are options that exclude other options negative_opt = {'quiet': 'verbose'} # -- Creation/initialization methods ------------------------------- def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then use 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some null value: 0, None, an empty list or dictionary, etc.) Most importantly, initialize the 'command_obj' attribute to the empty dictionary; this will be filled in with real command objects by 'parse_command_line()'. """ # Default values for our command-line options self.verbose = 1 self.dry_run = 0 self.help = 0 for attr in self.display_option_names: setattr(self, attr, 0) # Store the distribution meta-data (name, version, author, and so # forth) in a separate object -- we're getting to have enough # information here (and enough command-line options) that it's # worth it. Also delegate 'get_XXX()' methods to the 'metadata' # object in a sneaky and underhanded (but efficient!) way. self.metadata = DistributionMetadata() for basename in self.metadata._METHOD_BASENAMES: method_name = "get_" + basename setattr(self, method_name, getattr(self.metadata, method_name)) # 'cmdclass' maps command names to class objects, so we # can 1) quickly figure out which class to instantiate when # we need to create a new command object, and 2) have a way # for the setup script to override command classes self.cmdclass = {} # 'command_packages' is a list of packages in which commands # are searched for. The factory for command 'foo' is expected # to be named 'foo' in the module 'foo' in one of the packages # named here. This list is searched from the left; an error # is raised if no named package provides the command being # searched for. (Always access using get_command_packages().) self.command_packages = None # 'script_name' and 'script_args' are usually set to sys.argv[0] # and sys.argv[1:], but they can be overridden when the caller is # not necessarily a setup script run from the command-line. self.script_name = None self.script_args = None # 'command_options' is where we store command options between # parsing them (from config files, the command-line, etc.) and when # they are actually needed -- ie. when the command in question is # instantiated. It is a dictionary of dictionaries of 2-tuples: # command_options = { command_name : { option : (source, value) } } self.command_options = {} # 'dist_files' is the list of (command, pyversion, file) that # have been created by any dist commands run so far. This is # filled regardless of whether the run is dry or not. pyversion # gives sysconfig.get_python_version() if the dist file is # specific to a Python version, 'any' if it is good for all # Python versions on the target platform, and '' for a source # file. pyversion should not be used to specify minimum or # maximum required Python versions; use the metainfo for that # instead. self.dist_files = [] # These options are really the business of various commands, rather # than of the Distribution itself. We provide aliases for them in # Distribution as a convenience to the developer. self.packages = None self.package_data = {} self.package_dir = None self.py_modules = None self.libraries = None self.headers = None self.ext_modules = None self.ext_package = None self.include_dirs = None self.extra_path = None self.scripts = None self.data_files = None self.password = '' # And now initialize bookkeeping stuff that can't be supplied by # the caller at all. 'command_obj' maps command names to # Command instances -- that's how we enforce that every command # class is a singleton. self.command_obj = {} # 'have_run' maps command names to boolean values; it keeps track # of whether we have actually run a particular command, to make it # cheap to "run" a command whenever we think we might need to -- if # it's already been done, no need for expensive filesystem # operations, we just check the 'have_run' dictionary and carry on. # It's only safe to query 'have_run' for a command class that has # been instantiated -- a false value will be inserted when the # command object is created, and replaced with a true value when # the command is successfully run. Thus it's probably best to use # '.get()' rather than a straight lookup. self.have_run = {} # Now we'll use the attrs dictionary (ultimately, keyword args from # the setup script) to possibly override any or all of these # distribution options. if attrs: # Pull out the set of command options and work on them # specifically. Note that this order guarantees that aliased # command options will override any supplied redundantly # through the general options dictionary. options = attrs.get('options') if options is not None: del attrs['options'] for (command, cmd_options) in options.items(): opt_dict = self.get_option_dict(command) for (opt, val) in cmd_options.items(): opt_dict[opt] = ("setup script", val) if 'licence' in attrs: attrs['license'] = attrs['licence'] del attrs['licence'] msg = "'licence' distribution option is deprecated; use 'license'" if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): setattr(self.metadata, key, val) elif hasattr(self, key): setattr(self, key, val) else: msg = "Unknown distribution option: %s" % repr(key) if warnings is not None: warnings.warn(msg) else: sys.stderr.write(msg + "\n") # no-user-cfg is handled before other command line args # because other args override the config files, and this # one is needed before we can load the config files. # If attrs['script_args'] wasn't passed, assume false. # # This also make sure we just look at the global options self.want_user_cfg = True if self.script_args is not None: for arg in self.script_args: if not arg.startswith('-'): break if arg == '--no-user-cfg': self.want_user_cfg = False break self.finalize_options() def get_option_dict(self, command): """Get the option dictionary for a given command. If that command's option dictionary hasn't been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary. """ dict = self.command_options.get(command) if dict is None: dict = self.command_options[command] = {} return dict def dump_option_dicts(self, header=None, commands=None, indent=""): from pprint import pformat if commands is None: # dump all command option dicts commands = sorted(self.command_options.keys()) if header is not None: self.announce(indent + header) indent = indent + " " if not commands: self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: self.announce(indent + "no option dict for '%s' command" % cmd_name) else: self.announce(indent + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) for line in out.split('\n'): self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- def find_config_files(self): """Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac; and setup.cfg in the current directory. The file in the user's home directory can be disabled with the --no-user-cfg option. """ files = [] check_environ() # Where to look for the system-wide Distutils config file sys_dir = os.path.dirname(sys.modules['distutils'].__file__) # Look for the system config file sys_file = os.path.join(sys_dir, "distutils.cfg") if os.path.isfile(sys_file): files.append(sys_file) # What to call the per-user config file if os.name == 'posix': user_filename = ".pydistutils.cfg" else: user_filename = "pydistutils.cfg" # And look for the user config file if self.want_user_cfg: user_file = os.path.join(os.path.expanduser('~'), user_filename) if os.path.isfile(user_file): files.append(user_file) # All platforms support local setup.cfg local_file = "setup.cfg" if os.path.isfile(local_file): files.append(local_file) if DEBUG: self.announce("using config files: %s" % ', '.join(files)) return files def parse_config_files(self, filenames=None): from configparser import ConfigParser # Ignore install directory options if we have a venv if sys.prefix != sys.base_prefix: ignore_options = [ 'install-base', 'install-platbase', 'install-lib', 'install-platlib', 'install-purelib', 'install-headers', 'install-scripts', 'install-data', 'prefix', 'exec-prefix', 'home', 'user', 'root'] else: ignore_options = [] ignore_options = frozenset(ignore_options) if filenames is None: filenames = self.find_config_files() if DEBUG: self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: if DEBUG: self.announce(" reading %s" % filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) opt_dict = self.get_option_dict(section) for opt in options: if opt != '__name__' and opt not in ignore_options: val = parser.get(section,opt) opt = opt.replace('-', '_') opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain # the original filenames that options come from) parser.__init__() # If there was a "global" section in the config file, use it # to set Distribution options. if 'global' in self.command_options: for (opt, (src, val)) in self.command_options['global'].items(): alias = self.negative_opt.get(opt) try: if alias: setattr(self, alias, not strtobool(val)) elif opt in ('verbose', 'dry_run'): # ugh! setattr(self, opt, strtobool(val)) else: setattr(self, opt, val) except ValueError as msg: raise DistutilsOptionError(msg) # -- Command-line parsing methods ---------------------------------- def parse_command_line(self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line was successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # # We now have enough information to show the Macintosh dialog # that allows the user to interactively specify the "command line". # toplevel_options = self._get_toplevel_options() # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is. self.commands = [] parser = FancyGetopt(toplevel_options + self.display_options) parser.set_negative_aliases(self.negative_opt) parser.set_aliases({'licence': 'license'}) args = parser.getopt(args=self.script_args, object=self) option_order = parser.get_option_order() log.set_verbosity(self.verbose) # for display options we return immediately if self.handle_display_options(option_order): return while args: args = self._parse_command_opts(parser, args) if args is None: # user asked for help (and got it) return # Handle the cases of --help as a "global" option, ie. # "setup.py --help" and "setup.py --help command ...". For the # former, we show global options (--verbose, --dry-run, etc.) # and display-only options (--name, --version, etc.); for the # latter, we omit the display-only options and show help for # each command listed on the command line. if self.help: self._show_help(parser, display_options=len(self.commands) == 0, commands=self.commands) return # Oops, no commands found -- an end-user error if not self.commands: raise DistutilsArgError("no commands supplied") # All is well: return true return True def _get_toplevel_options(self): """Return the non-display options recognized at the top level. This includes options that are recognized *only* at the top level as well as options recognized for commands. """ return self.global_options + [ ("command-packages=", None, "list of packages that provide distutils commands"), ] def _parse_command_opts(self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command # Pull the current command from the head of the command line command = args[0] if not command_re.match(command): raise SystemExit("invalid command name '%s'" % command) self.commands.append(command) # Dig up the command class that implements this command, so we # 1) know that it's a valid command, and 2) know which options # it takes. try: cmd_class = self.get_command_class(command) except DistutilsModuleError as msg: raise DistutilsArgError(msg) # Require that the command class be derived from Command -- want # to be sure that the basic "command" interface is implemented. if not issubclass(cmd_class, Command): raise DistutilsClassError( "command class %s must subclass Command" % cmd_class) # Also make sure that the command object provides a list of its # known options. if not (hasattr(cmd_class, 'user_options') and isinstance(cmd_class.user_options, list)): raise DistutilsClassError(("command class %s must provide " + "'user_options' attribute (a list of tuples)") % \ cmd_class) # If the command class has a list of negative alias options, # merge it in with the global negative aliases. negative_opt = self.negative_opt if hasattr(cmd_class, 'negative_opt'): negative_opt = negative_opt.copy() negative_opt.update(cmd_class.negative_opt) # Check for help_options in command class. They have a different # format (tuple of four) so we need to preprocess them here. if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_options = fix_help_options(cmd_class.help_options) else: help_options = [] # All commands support the global options too, just by adding # in 'global_options'. parser.set_option_table(self.global_options + cmd_class.user_options + help_options) parser.set_negative_aliases(negative_opt) (args, opts) = parser.getopt(args[1:]) if hasattr(opts, 'help') and opts.help: self._show_help(parser, display_options=0, commands=[cmd_class]) return if (hasattr(cmd_class, 'help_options') and isinstance(cmd_class.help_options, list)): help_option_found=0 for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 if callable(func): func() else: raise DistutilsClassError( "invalid help function %r for help option '%s': " "must be a callable object (function, etc.)" % (func, help_option)) if help_option_found: return # Put the options from the command-line into their official # holding pen, the 'command_options' dictionary. opt_dict = self.get_option_dict(command) for (name, value) in vars(opts).items(): opt_dict[name] = ("command line", value) return args def finalize_options(self): """Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects. """ for attr in ('keywords', 'platforms'): value = getattr(self.metadata, attr) if value is None: continue if isinstance(value, str): value = [elm.strip() for elm in value.split(',')] setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): """Show help for the setup script command-line in the form of several lists of command-line options. 'parser' should be a FancyGetopt instance; do not expect it to be returned in the same state, as its option table will be reset to make it generate the correct help text. If 'global_options' is true, lists the global options: --verbose, --dry-run, etc. If 'display_options' is true, lists the "display-only" options: --name, --version, etc. Finally, lists per-command help for every command name or command class in 'commands'. """ # late import because of mutual dependence between these modules from distutils.core import gen_usage from distutils.cmd import Command if global_options: if display_options: options = self._get_toplevel_options() else: options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") print('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") print('') for command in self.commands: if isinstance(command, type) and issubclass(command, Command): klass = command else: klass = self.get_command_class(command) if (hasattr(klass, 'help_options') and isinstance(klass.help_options, list)): parser.set_option_table(klass.user_options + fix_help_options(klass.help_options)) else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) print('') print(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. """ from distutils.core import gen_usage # User just wants a list of commands -- we'll print it out and stop # processing now (ie. if they ran "setup --help-commands foo bar", # we ignore "foo bar"). if self.help_commands: self.print_commands() print('') print(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then # display that metadata in the order in which the user supplied the # metadata options. any_display_options = 0 is_display_option = {} for option in self.display_options: is_display_option[option[0]] = 1 for (opt, val) in option_order: if val and is_display_option.get(opt): opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: print(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): print('\n'.join(value)) else: print(value) any_display_options = 1 return any_display_options def print_command_list(self, commands, header, max_length): """Print a subset of the list of all commands -- used by 'print_commands()'. """ print(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" print(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) max_length = 0 for cmd in (std_commands + extra_commands): if len(cmd) > max_length: max_length = len(cmd) self.print_command_list(std_commands, "Standard commands", max_length) if extra_commands: print() self.print_command_list(extra_commands, "Extra commands", max_length) def get_command_list(self): """Get a list of (command, description) tuples. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. """ # Currently this is only used on Mac OS, for the Mac-only GUI # Distutils interface (by Jack Jansen) import distutils.command std_commands = distutils.command.__all__ is_std = {} for cmd in std_commands: is_std[cmd] = 1 extra_commands = [] for cmd in self.cmdclass.keys(): if not is_std.get(cmd): extra_commands.append(cmd) rv = [] for cmd in (std_commands + extra_commands): klass = self.cmdclass.get(cmd) if not klass: klass = self.get_command_class(cmd) try: description = klass.description except AttributeError: description = "(no description available)" rv.append((cmd, description)) return rv # -- Command class/object methods ---------------------------------- def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages if not isinstance(pkgs, list): if pkgs is None: pkgs = '' pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs return pkgs def get_command_class(self, command): """Return the class that implements the Distutils command named by 'command'. First we check the 'cmdclass' dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module ("distutils.command." + command) and fetch the command class from the module. The loaded class is also stored in 'cmdclass' to speed future calls to 'get_command_class()'. Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class. """ klass = self.cmdclass.get(command) if klass: return klass for pkgname in self.get_command_packages(): module_name = "%s.%s" % (pkgname, command) klass_name = command try: __import__ (module_name) module = sys.modules[module_name] except ImportError: continue try: klass = getattr(module, klass_name) except AttributeError: raise DistutilsModuleError( "invalid command '%s' (no class '%s' in module '%s')" % (command, klass_name, module_name)) self.cmdclass[command] = klass return klass raise DistutilsModuleError("invalid command '%s'" % command) def get_command_obj(self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no command object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: self.announce("Distribution.get_command_obj(): " \ "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) self.have_run[command] = 0 # Set any options that were supplied in config files # or on the command line. (NB. support for error # reporting is lame here: any errors aren't reported # until 'finalize_options()' is called, which means # we won't report the source of the error.) options = self.command_options.get(command) if options: self._set_command_options(cmd_obj, options) return cmd_obj def _set_command_options(self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionary for this command (from 'self.command_options'). """ command_name = command_obj.get_command_name() if option_dict is None: option_dict = self.get_option_dict(command_name) if DEBUG: self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): if DEBUG: self.announce(" %s = %s (from %s)" % (option, value, source)) try: bool_opts = [translate_longopt(o) for o in command_obj.boolean_options] except AttributeError: bool_opts = [] try: neg_opt = command_obj.negative_opt except AttributeError: neg_opt = {} try: is_string = isinstance(value, str) if option in neg_opt and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) else: raise DistutilsOptionError( "error in %s: command '%s' has no such option '%s'" % (source, command_name, option)) except ValueError as msg: raise DistutilsOptionError(msg) def reinitialize_command(self, command, reinit_subcommands=0): """Reinitializes a command to the state it was in when first returned by 'get_command_obj()': ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for real. 'command' should be a command name (string) or command object. If 'reinit_subcommands' is true, also reinitializes the command's sub-commands, as declared by the 'sub_commands' class attribute (if it has one). See the "install" command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true. Returns the reinitialized command object. """ from distutils.cmd import Command if not isinstance(command, Command): command_name = command command = self.get_command_obj(command_name) else: command_name = command.get_command_name() if not command.finalized: return command command.initialize_options() command.finalized = 0 self.have_run[command_name] = 0 self._set_command_options(command) if reinit_subcommands: for sub in command.get_sub_commands(): self.reinitialize_command(sub, reinit_subcommands) return command # -- Methods that operate on the Distribution ---------------------- def announce(self, msg, level=log.INFO): log.log(level, msg) def run_commands(self): """Run each command that was seen on the setup script command line. Uses the list of commands found and cache of command objects created by 'get_command_obj()'. """ for cmd in self.commands: self.run_command(cmd) # -- Methods that operate on its Commands -------------------------- def run_command(self, command): """Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by 'command', return silently without doing anything. If the command named by 'command' doesn't even have a command object yet, create one. Then invoke 'run()' on that command object (or an existing one). """ # Already been here, done that? then return silently. if self.have_run.get(command): return log.info("running %s", command) cmd_obj = self.get_command_obj(command) cmd_obj.ensure_finalized() cmd_obj.run() self.have_run[command] = 1 # -- Distribution query methods ------------------------------------ def has_pure_modules(self): return len(self.packages or self.py_modules or []) > 0 def has_ext_modules(self): return self.ext_modules and len(self.ext_modules) > 0 def has_c_libraries(self): return self.libraries and len(self.libraries) > 0 def has_modules(self): return self.has_pure_modules() or self.has_ext_modules() def has_headers(self): return self.headers and len(self.headers) > 0 def has_scripts(self): return self.scripts and len(self.scripts) > 0 def has_data_files(self): return self.data_files and len(self.data_files) > 0 def is_pure(self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries()) # -- Metadata query methods ---------------------------------------- # If you're looking for 'get_name()', 'get_version()', and so forth, # they are defined in a sneaky way: the constructor binds self.get_XXX # to self.metadata.get_XXX. The actual code is in the # DistributionMetadata class, below. class DistributionMetadata: """Dummy class to hold the distribution meta-data: name, version, author, and so forth. """ _METHOD_BASENAMES = ("name", "version", "author", "author_email", "maintainer", "maintainer_email", "url", "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", "contact_email", "license", "classifiers", "download_url", # PEP 314 "provides", "requires", "obsoletes", ) def __init__(self, path=None): if path is not None: self.read_pkg_file(open(path)) else: self.name = None self.version = None self.author = None self.author_email = None self.maintainer = None self.maintainer_email = None self.url = None self.license = None self.description = None self.long_description = None self.keywords = None self.platforms = None self.classifiers = None self.download_url = None # PEP 314 self.provides = None self.requires = None self.obsoletes = None def read_pkg_file(self, file): """Reads the metadata values from a file object.""" msg = message_from_file(file) def _read_field(name): value = msg[name] if value == 'UNKNOWN': return None return value def _read_list(name): values = msg.get_all(name, None) if values == []: return None return values metadata_version = msg['metadata-version'] self.name = _read_field('name') self.version = _read_field('version') self.description = _read_field('summary') # we are filling author only. self.author = _read_field('author') self.maintainer = None self.author_email = _read_field('author-email') self.maintainer_email = None self.url = _read_field('home-page') self.license = _read_field('license') if 'download-url' in msg: self.download_url = _read_field('download-url') else: self.download_url = None self.long_description = _read_field('description') self.description = _read_field('summary') if 'keywords' in msg: self.keywords = _read_field('keywords').split(',') self.platforms = _read_list('platform') self.classifiers = _read_list('classifier') # PEP 314 - these fields only exist in 1.1 if metadata_version == '1.1': self.requires = _read_list('requires') self.provides = _read_list('provides') self.obsoletes = _read_list('obsoletes') else: self.requires = None self.provides = None self.obsoletes = None def write_pkg_info(self, base_dir): """Write the PKG-INFO file into the release tree. """ with open(os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8') as pkg_info: self.write_pkg_file(pkg_info) def write_pkg_file(self, file): """Write the PKG-INFO format data to a file object. """ version = '1.0' if (self.provides or self.requires or self.obsoletes or self.classifiers or self.download_url): version = '1.1' file.write('Metadata-Version: %s\n' % version) file.write('Name: %s\n' % self.get_name() ) file.write('Version: %s\n' % self.get_version() ) file.write('Summary: %s\n' % self.get_description() ) file.write('Home-page: %s\n' % self.get_url() ) file.write('Author: %s\n' % self.get_contact() ) file.write('Author-email: %s\n' % self.get_contact_email() ) file.write('License: %s\n' % self.get_license() ) if self.download_url: file.write('Download-URL: %s\n' % self.download_url) long_desc = rfc822_escape(self.get_long_description()) file.write('Description: %s\n' % long_desc) keywords = ','.join(self.get_keywords()) if keywords: file.write('Keywords: %s\n' % keywords ) self._write_list(file, 'Platform', self.get_platforms()) self._write_list(file, 'Classifier', self.get_classifiers()) # PEP 314 self._write_list(file, 'Requires', self.get_requires()) self._write_list(file, 'Provides', self.get_provides()) self._write_list(file, 'Obsoletes', self.get_obsoletes()) def _write_list(self, file, name, values): for value in values: file.write('%s: %s\n' % (name, value)) # -- Metadata query methods ---------------------------------------- def get_name(self): return self.name or "UNKNOWN" def get_version(self): return self.version or "0.0.0" def get_fullname(self): return "%s-%s" % (self.get_name(), self.get_version()) def get_author(self): return self.author or "UNKNOWN" def get_author_email(self): return self.author_email or "UNKNOWN" def get_maintainer(self): return self.maintainer or "UNKNOWN" def get_maintainer_email(self): return self.maintainer_email or "UNKNOWN" def get_contact(self): return self.maintainer or self.author or "UNKNOWN" def get_contact_email(self): return self.maintainer_email or self.author_email or "UNKNOWN" def get_url(self): return self.url or "UNKNOWN" def get_license(self): return self.license or "UNKNOWN" get_licence = get_license def get_description(self): return self.description or "UNKNOWN" def get_long_description(self): return self.long_description or "UNKNOWN" def get_keywords(self): return self.keywords or [] def get_platforms(self): return self.platforms or ["UNKNOWN"] def get_classifiers(self): return self.classifiers or [] def get_download_url(self): return self.download_url or "UNKNOWN" # PEP 314 def get_requires(self): return self.requires or [] def set_requires(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.requires = value def get_provides(self): return self.provides or [] def set_provides(self, value): value = [v.strip() for v in value] for v in value: import distutils.versionpredicate distutils.versionpredicate.split_provision(v) self.provides = value def get_obsoletes(self): return self.obsoletes or [] def set_obsoletes(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) self.obsoletes = value def fix_help_options(options): """Convert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. """ new_options = [] for help_tuple in options: new_options.append(help_tuple[0:3]) return new_options >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
mit
[ 31275, 8999, 28, 13053, 199, 31275, 8999, 28, 13053, 199, 624, 13350, 14, 2686, 199, 199, 17473, 314, 11839, 1021, 12, 1314, 8469, 314, 859, 4084, 199, 1235, 316, 6137, 15, 7657, 15, 16832, 14, 199, 624, 199, 199, 646, 984, 12, 747, 12, 295, 199, 504, 3031, 492, 1245, 63, 504, 63, 493, 199, 199, 893, 26, 272, 492, 3598, 199, 2590, 3545, 26, 272, 3598, 275, 488, 199, 199, 504, 7065, 14, 2550, 492, 627, 199, 504, 7065, 14, 25352, 63, 18907, 492, 481, 9844, 1002, 2992, 12, 9028, 63, 2809, 2992, 199, 504, 7065, 14, 1974, 492, 1104, 63, 2314, 12, 620, 475, 2245, 12, 18158, 10228, 63, 3765, 199, 504, 7065, 492, 943, 199, 504, 7065, 14, 1757, 492, 10990, 199, 199, 3, 12939, 370, 5627, 14712, 12577, 1414, 1561, 14, 221, 961, 365, 440, 627, 783, 266, 10, 199, 3, 314, 2011, 465, 282, 2018, 13637, 1553, 473, 2793, 1133, 2040, 9186, 23998, 14, 221, 710, 10572, 199, 3, 626, 2985, 3984, 7437, 8545, 365, 949, 21914, 559, 5606, 27, 314, 849, 19720, 5687, 365, 199, 3, 370, 3648, 367, 282, 2018, 859, 4310, 2410, 314, 1414, 14, 199, 1531, 63, 264, 275, 295, 14, 2014, 334, 82, 23811, 65, 13, 6353, 13, 58, 61, 779, 65, 13, 6353, 13, 58, 16, 13, 25, 15555, 9, 9988, 421, 199, 533, 11839, 26, 272, 408, 1918, 6170, 402, 314, 12577, 14, 221, 17536, 402, 314, 1736, 27276, 316, 22172, 283, 2758, 7, 272, 365, 7710, 4224, 4453, 282, 11839, 1256, 12, 1314, 12474, 706, 314, 1736, 734, 272, 370, 314, 12577, 3718, 2013, 641, 314, 1414, 1004, 14, 339, 12439, 10554, 911, 18871, 7078, 17321, 11839, 5370, 12, 272, 7444, 314, 283, 2758, 11716, 805, 365, 12657, 1183, 315, 9587, 392, 323, 370, 3932, 4839, 14, 272, 9738, 12, 652, 365, 406, 2375, 461, 626, 282, 3272, 2884, 5594, 13809, 370, 5516, 272, 11839, 367, 2005, 27877, 12016, 12, 436, 2066, 986, 314, 5516, 272, 370, 283, 2758, 11716, 465, 314, 283, 2686, 533, 7, 4252, 1423, 14, 221, 982, 880, 12, 652, 365, 272, 5784, 370, 14021, 314, 21851, 626, 283, 2758, 7, 965, 402, 11839, 14, 272, 1666, 314, 1233, 367, 283, 2758, 19633, 315, 6170, 14, 647, 12, 367, 2436, 14, 272, 408, 2378, 327, 283, 2966, 63, 1419, 7, 23369, 314, 1414, 13, 604, 1511, 626, 1443, 506, 272, 327, 6841, 370, 314, 3272, 2884, 6791, 370, 1263, 3503, 3718, 14, 272, 327, 662, 71, 14, 26069, 2758, 14, 647, 446, 78, 2, 503, 26069, 2758, 14, 647, 1553, 10243, 2, 3865, 5452, 30268, 402, 272, 327, 3520, 2288, 1511, 14, 221, 961, 769, 1077, 506, 16204, 370, 282, 18753, 7481, 12, 272, 327, 3967, 4036, 2288, 945, 365, 2597, 1686, 465, 282, 1414, 945, 1553, 436, 781, 272, 327, 2793, 1133, 2934, 370, 11271, 938, 314, 3718, 543, 4634, 5002, 1511, 626, 2985, 272, 327, 1172, 13460, 3304, 1806, 14, 272, 327, 710, 11648, 273, 2397, 367, 3376, 4910, 626, 652, 883, 506, 10877, 14, 272, 2288, 63, 1419, 275, 4274, 3832, 297, 283, 86, 297, 298, 1065, 3376, 590, 334, 885, 4186, 413, 395, 1993, 661, 10243, 297, 283, 81, 297, 298, 1065, 11971, 590, 334, 353, 83, 8661, 2331, 13185, 1993, 661, 10481, 13, 1065, 297, 283, 78, 297, 298, 13196, 1133, 5965, 886, 7003, 1288, 1993, 661, 3437, 297, 283, 72, 297, 298, 2384, 16212, 1720, 1245, 1288, 1993, 661, 889, 13, 751, 13, 4128, 297, 488, 12, 2432, 283, 4247, 1134, 13350, 14, 4128, 315, 2195, 5629, 2082, 659, 272, 1622, 339, 327, 283, 2330, 63, 3807, 7, 365, 282, 3974, 334, 18, 13, 19, 1004, 9, 1059, 13660, 314, 2863, 272, 327, 4503, 402, 314, 3272, 2884, 14, 272, 2863, 63, 3807, 275, 9638, 199, 7844, 3718, 26, 334, 3239, 2850, 3437, 13, 4405, 7, 367, 1655, 9, 819, 3272, 14, 647, 1900, 420, 911, 1900, 314, 2559, 1334, 685, 1619, 283, 1506, 4805, 523, 3272, 14, 647, 3907, 259, 911, 3907, 314, 2559, 199, 624, 339, 327, 1511, 626, 787, 440, 25350, 370, 314, 3718, 272, 2929, 63, 1419, 275, 359, 267, 661, 3437, 13, 4405, 297, 488, 12, 268, 298, 513, 1006, 2808, 3718, 1288, 267, 661, 354, 297, 488, 12, 268, 298, 1361, 2559, 536, 1288, 267, 661, 1023, 297, 283, 54, 297, 268, 298, 1361, 2559, 1015, 1288, 267, 661, 9930, 297, 488, 12, 268, 298, 1361, 665, 2491, 536, 24860, 28, 1023, 30, 1288, 267, 661, 2502, 297, 488, 12, 268, 298, 1361, 314, 4132, 1159, 536, 1288, 267, 661, 2502, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 4132, 1159, 3031, 2287, 1288, 267, 661, 26665, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 536, 1288, 267, 661, 26665, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 3031, 2287, 1288, 267, 661, 7811, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 536, 340, 6040, 12, 587, 314, 4132, 1159, 1288, 267, 661, 7811, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 3031, 2287, 340, 6040, 12, 587, 314, 4132, 1159, 1288, 267, 661, 633, 297, 488, 12, 268, 298, 1361, 314, 2851, 367, 642, 2559, 1288, 267, 661, 1682, 297, 488, 12, 268, 298, 1361, 314, 4190, 402, 314, 2559, 1288, 267, 661, 606, 4894, 297, 488, 12, 268, 298, 3620, 367, 1553, 1682, 1288, 267, 661, 1802, 297, 488, 12, 268, 298, 1361, 314, 2559, 1369, 1288, 267, 661, 2809, 13, 1802, 297, 488, 12, 268, 298, 1361, 314, 1846, 2559, 1369, 1288, 267, 661, 19601, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 10677, 1288, 267, 661, 27628, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 19137, 1288, 267, 661, 7511, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 7681, 1288, 267, 661, 20121, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 2741, 1288, 267, 661, 6537, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 1415, 1288, 267, 661, 2873, 31750, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 6326, 24985, 531, 267, 1622 ]
[ 8999, 28, 13053, 199, 31275, 8999, 28, 13053, 199, 624, 13350, 14, 2686, 199, 199, 17473, 314, 11839, 1021, 12, 1314, 8469, 314, 859, 4084, 199, 1235, 316, 6137, 15, 7657, 15, 16832, 14, 199, 624, 199, 199, 646, 984, 12, 747, 12, 295, 199, 504, 3031, 492, 1245, 63, 504, 63, 493, 199, 199, 893, 26, 272, 492, 3598, 199, 2590, 3545, 26, 272, 3598, 275, 488, 199, 199, 504, 7065, 14, 2550, 492, 627, 199, 504, 7065, 14, 25352, 63, 18907, 492, 481, 9844, 1002, 2992, 12, 9028, 63, 2809, 2992, 199, 504, 7065, 14, 1974, 492, 1104, 63, 2314, 12, 620, 475, 2245, 12, 18158, 10228, 63, 3765, 199, 504, 7065, 492, 943, 199, 504, 7065, 14, 1757, 492, 10990, 199, 199, 3, 12939, 370, 5627, 14712, 12577, 1414, 1561, 14, 221, 961, 365, 440, 627, 783, 266, 10, 199, 3, 314, 2011, 465, 282, 2018, 13637, 1553, 473, 2793, 1133, 2040, 9186, 23998, 14, 221, 710, 10572, 199, 3, 626, 2985, 3984, 7437, 8545, 365, 949, 21914, 559, 5606, 27, 314, 849, 19720, 5687, 365, 199, 3, 370, 3648, 367, 282, 2018, 859, 4310, 2410, 314, 1414, 14, 199, 1531, 63, 264, 275, 295, 14, 2014, 334, 82, 23811, 65, 13, 6353, 13, 58, 61, 779, 65, 13, 6353, 13, 58, 16, 13, 25, 15555, 9, 9988, 421, 199, 533, 11839, 26, 272, 408, 1918, 6170, 402, 314, 12577, 14, 221, 17536, 402, 314, 1736, 27276, 316, 22172, 283, 2758, 7, 272, 365, 7710, 4224, 4453, 282, 11839, 1256, 12, 1314, 12474, 706, 314, 1736, 734, 272, 370, 314, 12577, 3718, 2013, 641, 314, 1414, 1004, 14, 339, 12439, 10554, 911, 18871, 7078, 17321, 11839, 5370, 12, 272, 7444, 314, 283, 2758, 11716, 805, 365, 12657, 1183, 315, 9587, 392, 323, 370, 3932, 4839, 14, 272, 9738, 12, 652, 365, 406, 2375, 461, 626, 282, 3272, 2884, 5594, 13809, 370, 5516, 272, 11839, 367, 2005, 27877, 12016, 12, 436, 2066, 986, 314, 5516, 272, 370, 283, 2758, 11716, 465, 314, 283, 2686, 533, 7, 4252, 1423, 14, 221, 982, 880, 12, 652, 365, 272, 5784, 370, 14021, 314, 21851, 626, 283, 2758, 7, 965, 402, 11839, 14, 272, 1666, 314, 1233, 367, 283, 2758, 19633, 315, 6170, 14, 647, 12, 367, 2436, 14, 272, 408, 2378, 327, 283, 2966, 63, 1419, 7, 23369, 314, 1414, 13, 604, 1511, 626, 1443, 506, 272, 327, 6841, 370, 314, 3272, 2884, 6791, 370, 1263, 3503, 3718, 14, 272, 327, 662, 71, 14, 26069, 2758, 14, 647, 446, 78, 2, 503, 26069, 2758, 14, 647, 1553, 10243, 2, 3865, 5452, 30268, 402, 272, 327, 3520, 2288, 1511, 14, 221, 961, 769, 1077, 506, 16204, 370, 282, 18753, 7481, 12, 272, 327, 3967, 4036, 2288, 945, 365, 2597, 1686, 465, 282, 1414, 945, 1553, 436, 781, 272, 327, 2793, 1133, 2934, 370, 11271, 938, 314, 3718, 543, 4634, 5002, 1511, 626, 2985, 272, 327, 1172, 13460, 3304, 1806, 14, 272, 327, 710, 11648, 273, 2397, 367, 3376, 4910, 626, 652, 883, 506, 10877, 14, 272, 2288, 63, 1419, 275, 4274, 3832, 297, 283, 86, 297, 298, 1065, 3376, 590, 334, 885, 4186, 413, 395, 1993, 661, 10243, 297, 283, 81, 297, 298, 1065, 11971, 590, 334, 353, 83, 8661, 2331, 13185, 1993, 661, 10481, 13, 1065, 297, 283, 78, 297, 298, 13196, 1133, 5965, 886, 7003, 1288, 1993, 661, 3437, 297, 283, 72, 297, 298, 2384, 16212, 1720, 1245, 1288, 1993, 661, 889, 13, 751, 13, 4128, 297, 488, 12, 2432, 283, 4247, 1134, 13350, 14, 4128, 315, 2195, 5629, 2082, 659, 272, 1622, 339, 327, 283, 2330, 63, 3807, 7, 365, 282, 3974, 334, 18, 13, 19, 1004, 9, 1059, 13660, 314, 2863, 272, 327, 4503, 402, 314, 3272, 2884, 14, 272, 2863, 63, 3807, 275, 9638, 199, 7844, 3718, 26, 334, 3239, 2850, 3437, 13, 4405, 7, 367, 1655, 9, 819, 3272, 14, 647, 1900, 420, 911, 1900, 314, 2559, 1334, 685, 1619, 283, 1506, 4805, 523, 3272, 14, 647, 3907, 259, 911, 3907, 314, 2559, 199, 624, 339, 327, 1511, 626, 787, 440, 25350, 370, 314, 3718, 272, 2929, 63, 1419, 275, 359, 267, 661, 3437, 13, 4405, 297, 488, 12, 268, 298, 513, 1006, 2808, 3718, 1288, 267, 661, 354, 297, 488, 12, 268, 298, 1361, 2559, 536, 1288, 267, 661, 1023, 297, 283, 54, 297, 268, 298, 1361, 2559, 1015, 1288, 267, 661, 9930, 297, 488, 12, 268, 298, 1361, 665, 2491, 536, 24860, 28, 1023, 30, 1288, 267, 661, 2502, 297, 488, 12, 268, 298, 1361, 314, 4132, 1159, 536, 1288, 267, 661, 2502, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 4132, 1159, 3031, 2287, 1288, 267, 661, 26665, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 536, 1288, 267, 661, 26665, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 3031, 2287, 1288, 267, 661, 7811, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 536, 340, 6040, 12, 587, 314, 4132, 1159, 1288, 267, 661, 7811, 13, 2123, 297, 488, 12, 268, 298, 1361, 314, 11075, 281, 1159, 3031, 2287, 340, 6040, 12, 587, 314, 4132, 1159, 1288, 267, 661, 633, 297, 488, 12, 268, 298, 1361, 314, 2851, 367, 642, 2559, 1288, 267, 661, 1682, 297, 488, 12, 268, 298, 1361, 314, 4190, 402, 314, 2559, 1288, 267, 661, 606, 4894, 297, 488, 12, 268, 298, 3620, 367, 1553, 1682, 1288, 267, 661, 1802, 297, 488, 12, 268, 298, 1361, 314, 2559, 1369, 1288, 267, 661, 2809, 13, 1802, 297, 488, 12, 268, 298, 1361, 314, 1846, 2559, 1369, 1288, 267, 661, 19601, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 10677, 1288, 267, 661, 27628, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 19137, 1288, 267, 661, 7511, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 7681, 1288, 267, 661, 20121, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 2741, 1288, 267, 661, 6537, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 1415, 1288, 267, 661, 2873, 31750, 297, 488, 12, 268, 298, 1361, 314, 769, 402, 6117, 15, 3112, 6326, 24985, 531, 267, 1622, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
google/data-driven-discretization-1d
pde_superresolution/duckarray_test.py
1
2487
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for duck array functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl.testing import absltest # pylint: disable=g-bad-import-order from absl.testing import parameterized import numpy as np import scipy.fftpack import tensorflow as tf from pde_superresolution import duckarray # pylint: disable=g-bad-import-order class DuckArrayTest(parameterized.TestCase): def test_resample_mean(self): inputs = np.arange(6.0) expected = np.array([0.5, 2.5, 4.5]) actual = duckarray.resample_mean(inputs, factor=2) np.testing.assert_allclose(expected, actual) with tf.Graph().as_default(): with tf.Session() as sess: actual = sess.run( duckarray.resample_mean(tf.constant(inputs), factor=2)) np.testing.assert_allclose(expected, actual) def test_subsample(self): inputs = np.arange(6) expected = np.array([0, 2, 4]) actual = duckarray.subsample(inputs, factor=2) np.testing.assert_allclose(expected, actual) with tf.Graph().as_default(): with tf.Session() as sess: actual = sess.run( duckarray.subsample(tf.constant(inputs), factor=2)) np.testing.assert_allclose(expected, actual) @parameterized.parameters( dict(y=np.sin(2*np.pi*np.arange(8)/8), period=1), dict(y=np.sin(2*np.pi*np.arange(8)/8), period=8), dict(y=np.linspace(-1, 1, num=12) ** 2, period=2), ) def test_spectral_derivative(self, y, period): for order in range(3): with self.subTest(order=order): expected = scipy.fftpack.diff(y, order=order, period=period) actual = duckarray.spectral_derivative(y, order, period) np.testing.assert_allclose(expected, actual, atol=1e-12) if __name__ == '__main__': absltest.main()
apache-2.0
[ 3, 1898, 14894, 4475, 20376, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 4178, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 2925, 367, 366, 10112, 1625, 3423, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 2853, 76, 14, 4776, 492, 2853, 76, 396, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 199, 504, 2853, 76, 14, 4776, 492, 29526, 199, 646, 2680, 465, 980, 199, 646, 7026, 14, 9996, 1389, 199, 646, 3228, 465, 2833, 199, 199, 504, 299, 271, 63, 4792, 12588, 492, 366, 10112, 1144, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 421, 199, 533, 577, 10112, 3836, 774, 8, 25000, 14, 1746, 304, 819, 347, 511, 63, 22882, 63, 3670, 8, 277, 304, 272, 4153, 275, 980, 14, 5605, 8, 22, 14, 16, 9, 272, 1420, 275, 980, 14, 1144, 779, 16, 14, 21, 12, 499, 14, 21, 12, 841, 14, 21, 566, 272, 3503, 275, 366, 10112, 1144, 14, 22882, 63, 3670, 8, 3711, 12, 6535, 29, 18, 9, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 339, 543, 2833, 14, 4578, 1252, 305, 63, 885, 837, 489, 543, 2833, 14, 4434, 342, 465, 4043, 26, 267, 3503, 275, 4043, 14, 1065, 8, 288, 366, 10112, 1144, 14, 22882, 63, 3670, 8, 3249, 14, 4083, 8, 3711, 395, 6535, 29, 18, 430, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 819, 347, 511, 63, 954, 3271, 8, 277, 304, 272, 4153, 275, 980, 14, 5605, 8, 22, 9, 272, 1420, 275, 980, 14, 1144, 779, 16, 12, 499, 12, 841, 566, 272, 3503, 275, 366, 10112, 1144, 14, 954, 3271, 8, 3711, 12, 6535, 29, 18, 9, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 339, 543, 2833, 14, 4578, 1252, 305, 63, 885, 837, 489, 543, 2833, 14, 4434, 342, 465, 4043, 26, 267, 3503, 275, 4043, 14, 1065, 8, 288, 366, 10112, 1144, 14, 954, 3271, 8, 3249, 14, 4083, 8, 3711, 395, 6535, 29, 18, 430, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 819, 768, 25000, 14, 3214, 8, 489, 1211, 8, 89, 29, 1590, 14, 5911, 8, 18, 10, 1590, 14, 1038, 10, 1590, 14, 5605, 8, 24, 2447, 24, 395, 6247, 29, 17, 395, 489, 1211, 8, 89, 29, 1590, 14, 5911, 8, 18, 10, 1590, 14, 1038, 10, 1590, 14, 5605, 8, 24, 2447, 24, 395, 6247, 29, 24, 395, 489, 1211, 8, 89, 29, 1590, 14, 11649, 2801, 17, 12, 413, 12, 1967, 29, 713, 9, 1011, 499, 12, 6247, 29, 18, 395, 523, 776, 523, 347, 511, 63, 31738, 63, 26851, 8, 277, 12, 612, 12, 6247, 304, 272, 367, 1865, 315, 1425, 8, 19, 304, 489, 543, 291, 14, 954, 774, 8, 1648, 29, 1648, 304, 267, 1420, 275, 7026, 14, 9996, 1389, 14, 3028, 8, 89, 12, 1865, 29, 1648, 12, 6247, 29, 5191, 9, 267, 3503, 275, 366, 10112, 1144, 14, 31738, 63, 26851, 8, 89, 12, 1865, 12, 6247, 9, 267, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 12, 9543, 29, 17, 69, 13, 713, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 2853, 76, 396, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 14894, 4475, 20376, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 4178, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 2925, 367, 366, 10112, 1625, 3423, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 2853, 76, 14, 4776, 492, 2853, 76, 396, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 199, 504, 2853, 76, 14, 4776, 492, 29526, 199, 646, 2680, 465, 980, 199, 646, 7026, 14, 9996, 1389, 199, 646, 3228, 465, 2833, 199, 199, 504, 299, 271, 63, 4792, 12588, 492, 366, 10112, 1144, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 421, 199, 533, 577, 10112, 3836, 774, 8, 25000, 14, 1746, 304, 819, 347, 511, 63, 22882, 63, 3670, 8, 277, 304, 272, 4153, 275, 980, 14, 5605, 8, 22, 14, 16, 9, 272, 1420, 275, 980, 14, 1144, 779, 16, 14, 21, 12, 499, 14, 21, 12, 841, 14, 21, 566, 272, 3503, 275, 366, 10112, 1144, 14, 22882, 63, 3670, 8, 3711, 12, 6535, 29, 18, 9, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 339, 543, 2833, 14, 4578, 1252, 305, 63, 885, 837, 489, 543, 2833, 14, 4434, 342, 465, 4043, 26, 267, 3503, 275, 4043, 14, 1065, 8, 288, 366, 10112, 1144, 14, 22882, 63, 3670, 8, 3249, 14, 4083, 8, 3711, 395, 6535, 29, 18, 430, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 819, 347, 511, 63, 954, 3271, 8, 277, 304, 272, 4153, 275, 980, 14, 5605, 8, 22, 9, 272, 1420, 275, 980, 14, 1144, 779, 16, 12, 499, 12, 841, 566, 272, 3503, 275, 366, 10112, 1144, 14, 954, 3271, 8, 3711, 12, 6535, 29, 18, 9, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 339, 543, 2833, 14, 4578, 1252, 305, 63, 885, 837, 489, 543, 2833, 14, 4434, 342, 465, 4043, 26, 267, 3503, 275, 4043, 14, 1065, 8, 288, 366, 10112, 1144, 14, 954, 3271, 8, 3249, 14, 4083, 8, 3711, 395, 6535, 29, 18, 430, 272, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 9, 819, 768, 25000, 14, 3214, 8, 489, 1211, 8, 89, 29, 1590, 14, 5911, 8, 18, 10, 1590, 14, 1038, 10, 1590, 14, 5605, 8, 24, 2447, 24, 395, 6247, 29, 17, 395, 489, 1211, 8, 89, 29, 1590, 14, 5911, 8, 18, 10, 1590, 14, 1038, 10, 1590, 14, 5605, 8, 24, 2447, 24, 395, 6247, 29, 24, 395, 489, 1211, 8, 89, 29, 1590, 14, 11649, 2801, 17, 12, 413, 12, 1967, 29, 713, 9, 1011, 499, 12, 6247, 29, 18, 395, 523, 776, 523, 347, 511, 63, 31738, 63, 26851, 8, 277, 12, 612, 12, 6247, 304, 272, 367, 1865, 315, 1425, 8, 19, 304, 489, 543, 291, 14, 954, 774, 8, 1648, 29, 1648, 304, 267, 1420, 275, 7026, 14, 9996, 1389, 14, 3028, 8, 89, 12, 1865, 29, 1648, 12, 6247, 29, 5191, 9, 267, 3503, 275, 366, 10112, 1144, 14, 31738, 63, 26851, 8, 89, 12, 1865, 12, 6247, 9, 267, 980, 14, 4776, 14, 479, 63, 7520, 8, 2062, 12, 3503, 12, 9543, 29, 17, 69, 13, 713, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 2853, 76, 396, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
won0089/oppia
core/tests/test_utils_test.py
30
5373
# coding: utf-8 # # Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an 'AS-IS' BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for test_utils, mainly for the FunctionWrapper. """ __author__ = 'Frederik Creemers' from core.tests import test_utils class FunctionWrapperTests(test_utils.GenericTestBase): """Test for testing test_utils.FunctionWrapper""" def test_wrapper_calls_subclass_methods(self): """Tests the basic functionality of FunctionWrapper.""" # Keeps track of which functions have been called, to test that pre_call_hook, # the actual function, and post_call_hook are called in the right order. order = [] testcase = self class MyWrapper(test_utils.FunctionWrapper): def pre_call_hook(self, args): order.append('before') testcase.assertEqual(args.get('posarg'), 'foo') testcase.assertEqual(args.get('kwarg'), 'bar') def post_call_hook(self, args, result): order.append('after') testcase.assertEqual(result, 'foobar') testcase.assertEqual(args.get('posarg'), 'foo') testcase.assertEqual(args.get('kwarg'), 'bar') def function(posarg, kwarg): order.append("call") return posarg + kwarg wrapped = MyWrapper(function) self.assertEqual(wrapped('foo', kwarg='bar'), 'foobar') self.assertEqual(order, ['before', 'call', 'after']) def test_wrapper_calls_passed_method(self): """Tests that FunctionWrapper also works for methods""" data = {} class A(object): def __init__(self, a): self.a = a def my_method(self, b): data['value'] = self.a + b return (self.a + b) * 2 wrapped = test_utils.FunctionWrapper(A.my_method) with self.swap(A, 'my_method', wrapped): val = A('foo').my_method('bar') self.assertEqual(val, 'foobarfoobar') self.assertEqual(data.get('value'), 'foobar') def test_wrapper_calls_passed_class_method(self): """Tests that FunctionWrapper also works for class methods""" data = {} class A(object): a = "foo" @classmethod def class_method(cls, b): data['value'] = cls.a + b return (cls.a + b) * 2 wrapped = test_utils.FunctionWrapper(A.class_method) with self.swap(A, 'class_method', wrapped): val = A.class_method('bar') self.assertEqual(val, 'foobarfoobar') self.assertEqual(data.get('value'), 'foobar') def test_wrapper_calls_passed_static_method(self): """Tests that FunctionWrapper also works for static methods""" data = {} class A(object): @staticmethod def static_method(ab): data['value'] = ab return ab * 2 wrapped = test_utils.FunctionWrapper(A.static_method) with self.swap(A, 'static_method', wrapped): val = A.static_method('foobar') self.assertEqual(val, 'foobarfoobar') self.assertEqual(data.get('value'), 'foobar') def test_wrapper_calls_passed_lambdas(self): data = {} def side_effect(ab): data['value'] = ab return ab l = lambda x: side_effect(x)*2 wrapped = test_utils.FunctionWrapper(l) self.assertEqual(wrapped('foobar'), 'foobarfoobar') self.assertEqual(data.get('value'), 'foobar') class CallCounterTests(test_utils.GenericTestBase): def test_call_counter_counts_the_number_of_times_a_function_gets_called(self): f = lambda x: x ** 2 wrapped_function = test_utils.CallCounter(f) self.assertEqual(wrapped_function.times_called, 0) for i in xrange(5): self.assertEqual(wrapped_function(i), i ** 2) self.assertEqual(wrapped_function.times_called, i + 1) class FailingFunctionTests(test_utils.GenericTestBase): def test_failing_function_fails_for_first_n_calls(self): class CustomError(Exception): pass function = lambda x: x ** 2 ff = test_utils.FailingFunction(function, CustomError, 5) for i in xrange(5): with self.assertRaises(CustomError): ff(i) raise ValueError(str(i)) self.assertEqual(ff(5), 25) def test_failing_function_never_succeeds_when_n_is_infinity(self): class CustomError(Exception): pass function = lambda x: x ** 2 ff = test_utils.FailingFunction(function, CustomError, test_utils.FailingFunction.INFINITY) for i in xrange(20): with self.assertRaises(CustomError): ff(i)
apache-2.0
[ 3, 2803, 26, 2774, 13, 24, 199, 3, 199, 3, 1898, 6927, 710, 593, 802, 4674, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 420, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 13, 1311, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 624, 2925, 367, 511, 63, 1208, 12, 27580, 367, 314, 6801, 4590, 14, 408, 199, 199, 363, 2502, 363, 275, 283, 38, 264, 9910, 75, 445, 850, 16465, 7, 199, 199, 504, 6170, 14, 2219, 492, 511, 63, 1208, 421, 199, 533, 6801, 4590, 2925, 8, 396, 63, 1208, 14, 9417, 14440, 304, 272, 408, 774, 367, 5343, 511, 63, 1208, 14, 3481, 4590, 624, 339, 347, 511, 63, 5029, 63, 5352, 63, 6083, 63, 2474, 8, 277, 304, 267, 408, 2925, 314, 5678, 9330, 402, 6801, 4590, 1041, 398, 327, 1804, 1024, 1190, 4426, 402, 1314, 3423, 1172, 2757, 2797, 12, 370, 511, 626, 876, 63, 1250, 63, 3664, 12, 267, 327, 314, 3503, 805, 12, 436, 2963, 63, 1250, 63, 3664, 787, 2797, 315, 314, 2451, 1865, 14, 267, 1865, 275, 942, 267, 16228, 275, 291, 398, 1021, 4932, 4590, 8, 396, 63, 1208, 14, 3481, 4590, 304, 953, 347, 876, 63, 1250, 63, 3664, 8, 277, 12, 1249, 304, 355, 1865, 14, 740, 360, 5182, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 1712, 1273, 659, 283, 1421, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 12745, 659, 283, 1700, 358, 953, 347, 2963, 63, 1250, 63, 3664, 8, 277, 12, 1249, 12, 754, 304, 355, 1865, 14, 740, 360, 4399, 358, 355, 16228, 14, 629, 8, 1099, 12, 283, 9664, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 1712, 1273, 659, 283, 1421, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 12745, 659, 283, 1700, 358, 398, 347, 805, 8, 1712, 1273, 12, 17582, 304, 288, 1865, 14, 740, 480, 1250, 531, 288, 372, 2086, 1273, 435, 17582, 398, 8072, 275, 4932, 4590, 8, 1593, 9, 398, 291, 14, 629, 8, 9130, 360, 1421, 297, 17582, 534, 1700, 659, 283, 9664, 358, 267, 291, 14, 629, 8, 1648, 12, 788, 5182, 297, 283, 1250, 297, 283, 4399, 1105, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 347, 636, 826, 721, 277, 12, 282, 304, 355, 291, 14, 65, 275, 282, 953, 347, 3002, 63, 765, 8, 277, 12, 330, 304, 355, 666, 459, 585, 418, 275, 291, 14, 65, 435, 330, 355, 372, 334, 277, 14, 65, 435, 330, 9, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 1662, 63, 765, 9, 398, 543, 291, 14, 9286, 8, 33, 12, 283, 1662, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 360, 1421, 1959, 1662, 63, 765, 360, 1700, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 533, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 1021, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 282, 275, 298, 1421, 2, 953, 768, 3744, 288, 347, 1021, 63, 765, 8, 1886, 12, 330, 304, 355, 666, 459, 585, 418, 275, 843, 14, 65, 435, 330, 355, 372, 334, 1886, 14, 65, 435, 330, 9, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 533, 63, 765, 9, 267, 543, 291, 14, 9286, 8, 33, 12, 283, 533, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 14, 533, 63, 765, 360, 1700, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 1986, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 2955, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 768, 4639, 288, 347, 2955, 63, 765, 8, 371, 304, 355, 666, 459, 585, 418, 275, 2236, 355, 372, 2236, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 1986, 63, 765, 9, 267, 543, 291, 14, 9286, 8, 33, 12, 283, 1986, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 14, 1986, 63, 765, 360, 9664, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 416, 887, 24315, 8, 277, 304, 267, 666, 275, 1052, 398, 347, 5366, 63, 5881, 8, 371, 304, 288, 666, 459, 585, 418, 275, 2236, 288, 372, 2236, 398, 634, 275, 2400, 671, 26, 5366, 63, 5881, 8, 88, 3342, 18, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 76, 9, 267, 291, 14, 629, 8, 9130, 360, 9664, 659, 283, 9664, 9664, 358, 267, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 421, 199, 533, 6523, 11348, 2925, 8, 396, 63, 1208, 14, 9417, 14440, 304, 272, 347, 511, 63, 1250, 63, 5337, 63, 6851, 63, 1589, 63, 1955, 63, 1618, 63, 4508, 63 ]
[ 2803, 26, 2774, 13, 24, 199, 3, 199, 3, 1898, 6927, 710, 593, 802, 4674, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 420, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 13, 1311, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 624, 2925, 367, 511, 63, 1208, 12, 27580, 367, 314, 6801, 4590, 14, 408, 199, 199, 363, 2502, 363, 275, 283, 38, 264, 9910, 75, 445, 850, 16465, 7, 199, 199, 504, 6170, 14, 2219, 492, 511, 63, 1208, 421, 199, 533, 6801, 4590, 2925, 8, 396, 63, 1208, 14, 9417, 14440, 304, 272, 408, 774, 367, 5343, 511, 63, 1208, 14, 3481, 4590, 624, 339, 347, 511, 63, 5029, 63, 5352, 63, 6083, 63, 2474, 8, 277, 304, 267, 408, 2925, 314, 5678, 9330, 402, 6801, 4590, 1041, 398, 327, 1804, 1024, 1190, 4426, 402, 1314, 3423, 1172, 2757, 2797, 12, 370, 511, 626, 876, 63, 1250, 63, 3664, 12, 267, 327, 314, 3503, 805, 12, 436, 2963, 63, 1250, 63, 3664, 787, 2797, 315, 314, 2451, 1865, 14, 267, 1865, 275, 942, 267, 16228, 275, 291, 398, 1021, 4932, 4590, 8, 396, 63, 1208, 14, 3481, 4590, 304, 953, 347, 876, 63, 1250, 63, 3664, 8, 277, 12, 1249, 304, 355, 1865, 14, 740, 360, 5182, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 1712, 1273, 659, 283, 1421, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 12745, 659, 283, 1700, 358, 953, 347, 2963, 63, 1250, 63, 3664, 8, 277, 12, 1249, 12, 754, 304, 355, 1865, 14, 740, 360, 4399, 358, 355, 16228, 14, 629, 8, 1099, 12, 283, 9664, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 1712, 1273, 659, 283, 1421, 358, 355, 16228, 14, 629, 8, 589, 14, 362, 360, 12745, 659, 283, 1700, 358, 398, 347, 805, 8, 1712, 1273, 12, 17582, 304, 288, 1865, 14, 740, 480, 1250, 531, 288, 372, 2086, 1273, 435, 17582, 398, 8072, 275, 4932, 4590, 8, 1593, 9, 398, 291, 14, 629, 8, 9130, 360, 1421, 297, 17582, 534, 1700, 659, 283, 9664, 358, 267, 291, 14, 629, 8, 1648, 12, 788, 5182, 297, 283, 1250, 297, 283, 4399, 1105, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 347, 636, 826, 721, 277, 12, 282, 304, 355, 291, 14, 65, 275, 282, 953, 347, 3002, 63, 765, 8, 277, 12, 330, 304, 355, 666, 459, 585, 418, 275, 291, 14, 65, 435, 330, 355, 372, 334, 277, 14, 65, 435, 330, 9, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 1662, 63, 765, 9, 398, 543, 291, 14, 9286, 8, 33, 12, 283, 1662, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 360, 1421, 1959, 1662, 63, 765, 360, 1700, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 533, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 1021, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 282, 275, 298, 1421, 2, 953, 768, 3744, 288, 347, 1021, 63, 765, 8, 1886, 12, 330, 304, 355, 666, 459, 585, 418, 275, 843, 14, 65, 435, 330, 355, 372, 334, 1886, 14, 65, 435, 330, 9, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 533, 63, 765, 9, 267, 543, 291, 14, 9286, 8, 33, 12, 283, 533, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 14, 533, 63, 765, 360, 1700, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 1986, 63, 765, 8, 277, 304, 267, 408, 2925, 626, 6801, 4590, 2597, 5419, 367, 2955, 3102, 624, 267, 666, 275, 1052, 398, 1021, 437, 8, 785, 304, 288, 768, 4639, 288, 347, 2955, 63, 765, 8, 371, 304, 355, 666, 459, 585, 418, 275, 2236, 355, 372, 2236, 627, 499, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 33, 14, 1986, 63, 765, 9, 267, 543, 291, 14, 9286, 8, 33, 12, 283, 1986, 63, 765, 297, 8072, 304, 288, 1139, 275, 437, 14, 1986, 63, 765, 360, 9664, 358, 288, 291, 14, 629, 8, 637, 12, 283, 9664, 9664, 358, 288, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 339, 347, 511, 63, 5029, 63, 5352, 63, 12070, 63, 416, 887, 24315, 8, 277, 304, 267, 666, 275, 1052, 398, 347, 5366, 63, 5881, 8, 371, 304, 288, 666, 459, 585, 418, 275, 2236, 288, 372, 2236, 398, 634, 275, 2400, 671, 26, 5366, 63, 5881, 8, 88, 3342, 18, 398, 8072, 275, 511, 63, 1208, 14, 3481, 4590, 8, 76, 9, 267, 291, 14, 629, 8, 9130, 360, 9664, 659, 283, 9664, 9664, 358, 267, 291, 14, 629, 8, 576, 14, 362, 360, 585, 659, 283, 9664, 358, 421, 199, 533, 6523, 11348, 2925, 8, 396, 63, 1208, 14, 9417, 14440, 304, 272, 347, 511, 63, 1250, 63, 5337, 63, 6851, 63, 1589, 63, 1955, 63, 1618, 63, 4508, 63, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
runcom/docker-py
docker/utils/ports/ports.py
22
2798
def add_port_mapping(port_bindings, internal_port, external): if internal_port in port_bindings: port_bindings[internal_port].append(external) else: port_bindings[internal_port] = [external] def add_port(port_bindings, internal_port_range, external_range): if external_range is None: for internal_port in internal_port_range: add_port_mapping(port_bindings, internal_port, None) else: ports = zip(internal_port_range, external_range) for internal_port, external_port in ports: add_port_mapping(port_bindings, internal_port, external_port) def build_port_bindings(ports): port_bindings = {} for port in ports: internal_port_range, external_range = split_port(port) add_port(port_bindings, internal_port_range, external_range) return port_bindings def to_port_range(port): if not port: return None protocol = "" if "/" in port: parts = port.split("/") if len(parts) != 2: raise ValueError('Invalid port "%s", should be ' '[[remote_ip:]remote_port[-remote_port]:]' 'port[/protocol]' % port) port, protocol = parts protocol = "/" + protocol parts = str(port).split('-') if len(parts) == 1: return ["%s%s" % (port, protocol)] if len(parts) == 2: full_port_range = range(int(parts[0]), int(parts[1]) + 1) return ["%s%s" % (p, protocol) for p in full_port_range] raise ValueError('Invalid port range "%s", should be ' 'port or startport-endport' % port) def split_port(port): parts = str(port).split(':') if not 1 <= len(parts) <= 3: raise ValueError('Invalid port "%s", should be ' '[[remote_ip:]remote_port:]port[/protocol]' % port) if len(parts) == 1: internal_port, = parts return to_port_range(internal_port), None if len(parts) == 2: external_port, internal_port = parts internal_range = to_port_range(internal_port) external_range = to_port_range(external_port) if len(internal_range) != len(external_range): raise ValueError('Port ranges don\'t match in length') return internal_range, external_range external_ip, external_port, internal_port = parts internal_range = to_port_range(internal_port) external_range = to_port_range(external_port) if not external_range: external_range = [None] * len(internal_range) if len(internal_range) != len(external_range): raise ValueError('Port ranges don\'t match in length') return internal_range, [(external_ip, ex_port or None) for ex_port in external_range]
apache-2.0
[ 199, 199, 318, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 5957, 304, 272, 340, 5007, 63, 719, 315, 1844, 63, 10880, 26, 267, 1844, 63, 10880, 59, 4672, 63, 719, 1055, 740, 8, 5159, 9, 272, 587, 26, 267, 1844, 63, 10880, 59, 4672, 63, 719, 61, 275, 359, 5159, 61, 421, 199, 318, 1050, 63, 719, 8, 719, 63, 10880, 12, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 304, 272, 340, 5957, 63, 1842, 365, 488, 26, 267, 367, 5007, 63, 719, 315, 5007, 63, 719, 63, 1842, 26, 288, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 488, 9, 272, 587, 26, 267, 8873, 275, 3482, 8, 4672, 63, 719, 63, 1842, 12, 5957, 63, 1842, 9, 267, 367, 5007, 63, 719, 12, 5957, 63, 719, 315, 8873, 26, 288, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 5957, 63, 719, 9, 421, 199, 318, 1900, 63, 719, 63, 10880, 8, 5203, 304, 272, 1844, 63, 10880, 275, 1052, 272, 367, 1844, 315, 8873, 26, 267, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 275, 3715, 63, 719, 8, 719, 9, 267, 1050, 63, 719, 8, 719, 63, 10880, 12, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 9, 272, 372, 1844, 63, 10880, 421, 199, 318, 370, 63, 719, 63, 1842, 8, 719, 304, 272, 340, 440, 1844, 26, 267, 372, 488, 339, 4113, 275, 3087, 272, 340, 10609, 315, 1844, 26, 267, 4184, 275, 1844, 14, 1294, 19031, 267, 340, 822, 8, 4181, 9, 1137, 499, 26, 288, 746, 1722, 360, 3364, 1844, 2071, 83, 401, 1077, 506, 283, 2490, 6730, 59, 3846, 63, 711, 2938, 3846, 63, 719, 1988, 3846, 63, 719, 2189, 6616, 2490, 283, 719, 28787, 3922, 6616, 450, 1844, 9, 267, 1844, 12, 4113, 275, 4184, 267, 4113, 275, 10609, 435, 4113, 339, 4184, 275, 620, 8, 719, 680, 1294, 21950, 339, 340, 822, 8, 4181, 9, 508, 413, 26, 267, 372, 28585, 83, 5, 83, 2, 450, 334, 719, 12, 4113, 1874, 339, 340, 822, 8, 4181, 9, 508, 499, 26, 267, 2615, 63, 719, 63, 1842, 275, 1425, 8, 442, 8, 4181, 59, 16, 2522, 1109, 8, 4181, 59, 17, 566, 435, 413, 9, 267, 372, 28585, 83, 5, 83, 2, 450, 334, 80, 12, 4113, 9, 367, 299, 315, 2615, 63, 719, 63, 1842, 61, 339, 746, 1722, 360, 3364, 1844, 1425, 2071, 83, 401, 1077, 506, 283, 2151, 283, 719, 503, 1343, 719, 13, 500, 719, 7, 450, 1844, 9, 421, 199, 318, 3715, 63, 719, 8, 719, 304, 272, 4184, 275, 620, 8, 719, 680, 1294, 11633, 272, 340, 440, 413, 2695, 822, 8, 4181, 9, 2695, 650, 26, 267, 746, 1722, 360, 3364, 1844, 2071, 83, 401, 1077, 506, 283, 586, 6730, 59, 3846, 63, 711, 2938, 3846, 63, 719, 2938, 719, 28787, 3922, 6616, 450, 1844, 9, 339, 340, 822, 8, 4181, 9, 508, 413, 26, 267, 5007, 63, 719, 12, 275, 4184, 267, 372, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 395, 488, 272, 340, 822, 8, 4181, 9, 508, 499, 26, 267, 5957, 63, 719, 12, 5007, 63, 719, 275, 4184, 398, 5007, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 9, 267, 5957, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 5159, 63, 719, 9, 267, 340, 822, 8, 4672, 63, 1842, 9, 1137, 822, 8, 5159, 63, 1842, 304, 288, 746, 1722, 360, 4313, 12271, 2793, 3985, 84, 1336, 315, 2582, 358, 398, 372, 5007, 63, 1842, 12, 5957, 63, 1842, 339, 5957, 63, 711, 12, 5957, 63, 719, 12, 5007, 63, 719, 275, 4184, 272, 5007, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 9, 272, 5957, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 5159, 63, 719, 9, 272, 340, 440, 5957, 63, 1842, 26, 267, 5957, 63, 1842, 275, 359, 403, 61, 627, 822, 8, 4672, 63, 1842, 9, 339, 340, 822, 8, 4672, 63, 1842, 9, 1137, 822, 8, 5159, 63, 1842, 304, 267, 746, 1722, 360, 4313, 12271, 2793, 3985, 84, 1336, 315, 2582, 358, 339, 372, 5007, 63, 1842, 12, 3842, 5159, 63, 711, 12, 444, 63, 719, 503, 488, 9, 1169, 367, 444, 63, 719, 315, 5957, 63, 1842, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 318, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 5957, 304, 272, 340, 5007, 63, 719, 315, 1844, 63, 10880, 26, 267, 1844, 63, 10880, 59, 4672, 63, 719, 1055, 740, 8, 5159, 9, 272, 587, 26, 267, 1844, 63, 10880, 59, 4672, 63, 719, 61, 275, 359, 5159, 61, 421, 199, 318, 1050, 63, 719, 8, 719, 63, 10880, 12, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 304, 272, 340, 5957, 63, 1842, 365, 488, 26, 267, 367, 5007, 63, 719, 315, 5007, 63, 719, 63, 1842, 26, 288, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 488, 9, 272, 587, 26, 267, 8873, 275, 3482, 8, 4672, 63, 719, 63, 1842, 12, 5957, 63, 1842, 9, 267, 367, 5007, 63, 719, 12, 5957, 63, 719, 315, 8873, 26, 288, 1050, 63, 719, 63, 4745, 8, 719, 63, 10880, 12, 5007, 63, 719, 12, 5957, 63, 719, 9, 421, 199, 318, 1900, 63, 719, 63, 10880, 8, 5203, 304, 272, 1844, 63, 10880, 275, 1052, 272, 367, 1844, 315, 8873, 26, 267, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 275, 3715, 63, 719, 8, 719, 9, 267, 1050, 63, 719, 8, 719, 63, 10880, 12, 5007, 63, 719, 63, 1842, 12, 5957, 63, 1842, 9, 272, 372, 1844, 63, 10880, 421, 199, 318, 370, 63, 719, 63, 1842, 8, 719, 304, 272, 340, 440, 1844, 26, 267, 372, 488, 339, 4113, 275, 3087, 272, 340, 10609, 315, 1844, 26, 267, 4184, 275, 1844, 14, 1294, 19031, 267, 340, 822, 8, 4181, 9, 1137, 499, 26, 288, 746, 1722, 360, 3364, 1844, 2071, 83, 401, 1077, 506, 283, 2490, 6730, 59, 3846, 63, 711, 2938, 3846, 63, 719, 1988, 3846, 63, 719, 2189, 6616, 2490, 283, 719, 28787, 3922, 6616, 450, 1844, 9, 267, 1844, 12, 4113, 275, 4184, 267, 4113, 275, 10609, 435, 4113, 339, 4184, 275, 620, 8, 719, 680, 1294, 21950, 339, 340, 822, 8, 4181, 9, 508, 413, 26, 267, 372, 28585, 83, 5, 83, 2, 450, 334, 719, 12, 4113, 1874, 339, 340, 822, 8, 4181, 9, 508, 499, 26, 267, 2615, 63, 719, 63, 1842, 275, 1425, 8, 442, 8, 4181, 59, 16, 2522, 1109, 8, 4181, 59, 17, 566, 435, 413, 9, 267, 372, 28585, 83, 5, 83, 2, 450, 334, 80, 12, 4113, 9, 367, 299, 315, 2615, 63, 719, 63, 1842, 61, 339, 746, 1722, 360, 3364, 1844, 1425, 2071, 83, 401, 1077, 506, 283, 2151, 283, 719, 503, 1343, 719, 13, 500, 719, 7, 450, 1844, 9, 421, 199, 318, 3715, 63, 719, 8, 719, 304, 272, 4184, 275, 620, 8, 719, 680, 1294, 11633, 272, 340, 440, 413, 2695, 822, 8, 4181, 9, 2695, 650, 26, 267, 746, 1722, 360, 3364, 1844, 2071, 83, 401, 1077, 506, 283, 586, 6730, 59, 3846, 63, 711, 2938, 3846, 63, 719, 2938, 719, 28787, 3922, 6616, 450, 1844, 9, 339, 340, 822, 8, 4181, 9, 508, 413, 26, 267, 5007, 63, 719, 12, 275, 4184, 267, 372, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 395, 488, 272, 340, 822, 8, 4181, 9, 508, 499, 26, 267, 5957, 63, 719, 12, 5007, 63, 719, 275, 4184, 398, 5007, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 9, 267, 5957, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 5159, 63, 719, 9, 267, 340, 822, 8, 4672, 63, 1842, 9, 1137, 822, 8, 5159, 63, 1842, 304, 288, 746, 1722, 360, 4313, 12271, 2793, 3985, 84, 1336, 315, 2582, 358, 398, 372, 5007, 63, 1842, 12, 5957, 63, 1842, 339, 5957, 63, 711, 12, 5957, 63, 719, 12, 5007, 63, 719, 275, 4184, 272, 5007, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 4672, 63, 719, 9, 272, 5957, 63, 1842, 275, 370, 63, 719, 63, 1842, 8, 5159, 63, 719, 9, 272, 340, 440, 5957, 63, 1842, 26, 267, 5957, 63, 1842, 275, 359, 403, 61, 627, 822, 8, 4672, 63, 1842, 9, 339, 340, 822, 8, 4672, 63, 1842, 9, 1137, 822, 8, 5159, 63, 1842, 304, 267, 746, 1722, 360, 4313, 12271, 2793, 3985, 84, 1336, 315, 2582, 358, 339, 372, 5007, 63, 1842, 12, 3842, 5159, 63, 711, 12, 444, 63, 719, 503, 488, 9, 1169, 367, 444, 63, 719, 315, 5957, 63, 1842, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
TedaLIEz/sentry
src/sentry/migrations/0166_auto__chg_field_user_id__add_field_apikey_allowed_origins.py
34
36870
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'ApiKey.allowed_origins' db.add_column('sentry_apikey', 'allowed_origins', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) def backwards(self, orm): # Deleting field 'ApiKey.allowed_origins' db.delete_column('sentry_apikey', 'allowed_origins') models = { 'sentry.accessgroup': { 'Meta': {'unique_together': "(('team', 'name'),)", 'object_name': 'AccessGroup'}, 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'managed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'members': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.User']", 'symmetrical': 'False'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Project']", 'symmetrical': 'False'}), 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"}), 'type': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '50'}) }, 'sentry.activity': { 'Meta': {'object_name': 'Activity'}, 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True'}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'event': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Event']", 'null': 'True'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'ident': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'}) }, 'sentry.alert': { 'Meta': {'object_name': 'Alert'}, 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True'}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'related_groups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'related_alerts'", 'symmetrical': 'False', 'through': "orm['sentry.AlertRelatedGroup']", 'to': "orm['sentry.Group']"}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}) }, 'sentry.alertrelatedgroup': { 'Meta': {'unique_together': "(('group', 'alert'),)", 'object_name': 'AlertRelatedGroup'}, 'alert': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Alert']"}), 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}) }, 'sentry.apikey': { 'Meta': {'object_name': 'ApiKey'}, 'allowed_origins': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}), 'label': ('django.db.models.fields.CharField', [], {'default': "'Default'", 'max_length': '64', 'blank': 'True'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'key_set'", 'to': "orm['sentry.Organization']"}), 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}) }, 'sentry.auditlogentry': { 'Meta': {'object_name': 'AuditLogEntry'}, 'actor': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'audit_actors'", 'to': "orm['sentry.User']"}), 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'event': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}), 'target_object': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}), 'target_user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'audit_targets'", 'null': 'True', 'to': "orm['sentry.User']"}) }, 'sentry.authidentity': { 'Meta': {'unique_together': "(('auth_provider', 'ident'), ('auth_provider', 'user'))", 'object_name': 'AuthIdentity'}, 'auth_provider': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.AuthProvider']"}), 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'ident': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'last_synced': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_verified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}) }, 'sentry.authprovider': { 'Meta': {'object_name': 'AuthProvider'}, 'config': ('jsonfield.fields.JSONField', [], {'default': '{}'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'default_global_access': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'default_role': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '50'}), 'default_teams': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Team']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'last_sync': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']", 'unique': 'True'}), 'provider': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'sync_time': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}) }, 'sentry.broadcast': { 'Meta': {'object_name': 'Broadcast'}, 'badge': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), 'link': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.CharField', [], {'max_length': '256'}) }, 'sentry.event': { 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'Event', 'db_table': "'sentry_message'", 'index_together': "(('group', 'datetime'),)"}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'data': ('sentry.db.models.fields.node.NodeField', [], {'null': 'True', 'blank': 'True'}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'db_column': "'message_id'"}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'event_set'", 'null': 'True', 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'num_comments': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}), 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'time_spent': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'null': 'True'}) }, 'sentry.eventmapping': { 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'EventMapping'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}) }, 'sentry.file': { 'Meta': {'object_name': 'File'}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True'}), 'headers': ('jsonfield.fields.JSONField', [], {'default': '{}'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'path': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'size': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}), 'storage': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), 'storage_options': ('jsonfield.fields.JSONField', [], {'default': '{}'}), 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '64'}) }, 'sentry.group': { 'Meta': {'unique_together': "(('project', 'checksum'),)", 'object_name': 'Group', 'db_table': "'sentry_groupedmessage'"}, 'active_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}), 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}), 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'is_public': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'level': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}), 'logger': ('django.db.models.fields.CharField', [], {'default': "'root'", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'num_comments': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}), 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'resolved_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), 'score': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'time_spent_count': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}), 'time_spent_total': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}), 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '1', 'db_index': 'True'}) }, 'sentry.groupassignee': { 'Meta': {'object_name': 'GroupAssignee', 'db_table': "'sentry_groupasignee'"}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'assignee_set'", 'unique': 'True', 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'assignee_set'", 'to': "orm['sentry.Project']"}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_assignee_set'", 'to': "orm['sentry.User']"}) }, 'sentry.groupbookmark': { 'Meta': {'unique_together': "(('project', 'user', 'group'),)", 'object_name': 'GroupBookmark'}, 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Project']"}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_bookmark_set'", 'to': "orm['sentry.User']"}) }, 'sentry.grouphash': { 'Meta': {'unique_together': "(('project', 'hash'),)", 'object_name': 'GroupHash'}, 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}), 'hash': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}) }, 'sentry.groupmeta': { 'Meta': {'unique_together': "(('group', 'key'),)", 'object_name': 'GroupMeta'}, 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'value': ('django.db.models.fields.TextField', [], {}) }, 'sentry.grouprulestatus': { 'Meta': {'unique_together': "(('rule', 'group'),)", 'object_name': 'GroupRuleStatus'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'last_active': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'rule': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Rule']"}), 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}) }, 'sentry.groupseen': { 'Meta': {'unique_together': "(('user', 'group'),)", 'object_name': 'GroupSeen'}, 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'db_index': 'False'}) }, 'sentry.grouptagkey': { 'Meta': {'unique_together': "(('project', 'group', 'key'),)", 'object_name': 'GroupTagKey'}, 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'values_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}) }, 'sentry.grouptagvalue': { 'Meta': {'unique_together': "(('project', 'key', 'value', 'group'),)", 'object_name': 'GroupTagValue', 'db_table': "'sentry_messagefiltervalue'"}, 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'grouptag'", 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'grouptag'", 'null': 'True', 'to': "orm['sentry.Project']"}), 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.helppage': { 'Meta': {'object_name': 'HelpPage'}, 'content': ('django.db.models.fields.TextField', [], {}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'unique': 'True', 'null': 'True'}), 'priority': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '50'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}) }, 'sentry.lostpasswordhash': { 'Meta': {'object_name': 'LostPasswordHash'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'hash': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'unique': 'True'}) }, 'sentry.option': { 'Meta': {'object_name': 'Option'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), 'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'value': ('sentry.db.models.fields.pickle.UnicodePickledObjectField', [], {}) }, 'sentry.organization': { 'Meta': {'object_name': 'Organization'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'members': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'org_memberships'", 'symmetrical': 'False', 'through': "orm['sentry.OrganizationMember']", 'to': "orm['sentry.User']"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}) }, 'sentry.organizationmember': { 'Meta': {'unique_together': "(('organization', 'user'), ('organization', 'email'))", 'object_name': 'OrganizationMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}), 'has_global_access': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'member_set'", 'to': "orm['sentry.Organization']"}), 'teams': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Team']", 'symmetrical': 'False', 'blank': 'True'}), 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '50'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'sentry_orgmember_set'", 'null': 'True', 'to': "orm['sentry.User']"}) }, 'sentry.pendingteammember': { 'Meta': {'unique_together': "(('team', 'email'),)", 'object_name': 'PendingTeamMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'pending_member_set'", 'to': "orm['sentry.Team']"}), 'type': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '50'}) }, 'sentry.project': { 'Meta': {'unique_together': "(('team', 'slug'), ('organization', 'slug'))", 'object_name': 'Project'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}), 'platform': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"}) }, 'sentry.projectkey': { 'Meta': {'object_name': 'ProjectKey'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'key_set'", 'to': "orm['sentry.Project']"}), 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'roles': ('django.db.models.fields.BigIntegerField', [], {'default': '1'}), 'secret_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'}), 'user_added': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'keys_added_set'", 'null': 'True', 'to': "orm['sentry.User']"}) }, 'sentry.projectoption': { 'Meta': {'unique_together': "(('project', 'key'),)", 'object_name': 'ProjectOption', 'db_table': "'sentry_projectoptions'"}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'value': ('sentry.db.models.fields.pickle.UnicodePickledObjectField', [], {}) }, 'sentry.release': { 'Meta': {'unique_together': "(('project', 'version'),)", 'object_name': 'Release'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'version': ('django.db.models.fields.CharField', [], {'max_length': '64'}) }, 'sentry.releasefile': { 'Meta': {'unique_together': "(('release', 'ident'),)", 'object_name': 'ReleaseFile'}, 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'ident': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'name': ('django.db.models.fields.TextField', [], {}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"}) }, 'sentry.rule': { 'Meta': {'object_name': 'Rule'}, 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'label': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}) }, 'sentry.tagkey': { 'Meta': {'unique_together': "(('project', 'key'),)", 'object_name': 'TagKey', 'db_table': "'sentry_filterkey'"}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}), 'values_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}) }, 'sentry.tagvalue': { 'Meta': {'unique_together': "(('project', 'key', 'value'),)", 'object_name': 'TagValue', 'db_table': "'sentry_filtervalue'"}, 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}), 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.team': { 'Meta': {'unique_together': "(('organization', 'slug'),)", 'object_name': 'Team'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}), 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}) }, 'sentry.teammember': { 'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'TeamMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"}), 'type': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '50'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}) }, 'sentry.user': { 'Meta': {'object_name': 'User', 'db_table': "'auth_user'"}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedAutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_managed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}) }, 'sentry.useroption': { 'Meta': {'unique_together': "(('user', 'project', 'key'),)", 'object_name': 'UserOption'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}), 'value': ('sentry.db.models.fields.pickle.UnicodePickledObjectField', [], {}) } } complete_apps = ['sentry']
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 12919, 14, 1208, 492, 2197, 63, 1208, 465, 2197, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 199, 504, 1639, 14, 697, 492, 1709, 421, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 267, 327, 12934, 901, 283, 7394, 1197, 14, 6541, 63, 2981, 3617, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 28181, 297, 283, 6541, 63, 2981, 3617, 297, 1993, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 7533, 2307, 29, 549, 12, 4596, 29, 549, 395, 1993, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 267, 327, 15920, 901, 283, 7394, 1197, 14, 6541, 63, 2981, 3617, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 28181, 297, 283, 6541, 63, 2981, 3617, 358, 2378, 1709, 275, 469, 267, 283, 3870, 14, 2732, 923, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 5969, 297, 283, 354, 9878, 283, 785, 63, 354, 356, 283, 3946, 2448, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 602, 63, 3270, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 11122, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 6334, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 1899, 6256, 283, 10247, 356, 283, 797, 1604, 288, 283, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 772, 1604, 288, 283, 6776, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6256, 283, 10247, 356, 283, 797, 1604, 288, 283, 5969, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 13126, 6097, 288, 283, 466, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 8781, 3901, 297, 990, 791, 885, 356, 283, 1400, 3071, 267, 1660, 267, 283, 3870, 14, 8240, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 14350, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 1604, 288, 283, 2083, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 1430, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2390, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 923, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 5425, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 772, 297, 283, 2307, 356, 283, 549, 1604, 288, 283, 1715, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6097, 288, 283, 466, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 18992, 297, 990, 8613, 288, 283, 751, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 1899, 6256, 283, 2307, 356, 283, 549, 3071, 267, 1660, 267, 283, 3870, 14, 9241, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 18758, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 1604, 288, 283, 2083, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 923, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 1188, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 297, 990, 8613, 288, 283, 1715, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6097, 288, 283, 2407, 63, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 2407, 63, 354, 356, 3546, 2407, 63, 24501, 4662, 283, 10247, 356, 283, 797, 297, 283, 8304, 356, 298, 1025, 459, 3870, 14, 18758, 13885, 2448, 6256, 283, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6097, 288, 283, 1205, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 18992, 297, 990, 791, 885, 356, 283, 16, 297, 283, 697, 63, 1080, 356, 283, 549, 3071, 267, 1660, 267, 283, 3870, 14, 9241, 2407, 923, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 923, 297, 283, 9241, 9878 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 12919, 14, 1208, 492, 2197, 63, 1208, 465, 2197, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 199, 504, 1639, 14, 697, 492, 1709, 421, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 267, 327, 12934, 901, 283, 7394, 1197, 14, 6541, 63, 2981, 3617, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 28181, 297, 283, 6541, 63, 2981, 3617, 297, 1993, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 7533, 2307, 29, 549, 12, 4596, 29, 549, 395, 1993, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 267, 327, 15920, 901, 283, 7394, 1197, 14, 6541, 63, 2981, 3617, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 28181, 297, 283, 6541, 63, 2981, 3617, 358, 2378, 1709, 275, 469, 267, 283, 3870, 14, 2732, 923, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 5969, 297, 283, 354, 9878, 283, 785, 63, 354, 356, 283, 3946, 2448, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 602, 63, 3270, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 11122, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 6334, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 1899, 6256, 283, 10247, 356, 283, 797, 1604, 288, 283, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 772, 1604, 288, 283, 6776, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6256, 283, 10247, 356, 283, 797, 1604, 288, 283, 5969, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 13126, 6097, 288, 283, 466, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 8781, 3901, 297, 990, 791, 885, 356, 283, 1400, 3071, 267, 1660, 267, 283, 3870, 14, 8240, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 14350, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 1604, 288, 283, 2083, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 1430, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2390, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 923, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 5425, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 772, 297, 283, 2307, 356, 283, 549, 1604, 288, 283, 1715, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6097, 288, 283, 466, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 18992, 297, 990, 8613, 288, 283, 751, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 1899, 6256, 283, 2307, 356, 283, 549, 3071, 267, 1660, 267, 283, 3870, 14, 9241, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 18758, 2267, 288, 283, 576, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 12256, 1915, 807, 14, 21975, 1915, 2141, 792, 297, 990, 791, 2307, 356, 283, 549, 1604, 288, 283, 2083, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 923, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6256, 283, 2307, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 1188, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 297, 990, 8613, 288, 283, 1715, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 11766, 14, 9550, 297, 990, 791, 475, 356, 298, 1025, 459, 3870, 14, 4761, 6097, 288, 283, 2407, 63, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 2407, 63, 354, 356, 3546, 2407, 63, 24501, 4662, 283, 10247, 356, 283, 797, 297, 283, 8304, 356, 298, 1025, 459, 3870, 14, 18758, 13885, 2448, 6256, 283, 475, 356, 298, 1025, 459, 3870, 14, 2448, 6097, 288, 283, 1205, 356, 661, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 18992, 297, 990, 791, 885, 356, 283, 16, 297, 283, 697, 63, 1080, 356, 283, 549, 3071, 267, 1660, 267, 283, 3870, 14, 9241, 2407, 923, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 923, 297, 283, 9241, 9878, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
indhub/mxnet
python/mxnet/gluon/rnn/rnn_layer.py
4
23858
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # coding: utf-8 # pylint: disable=no-member, invalid-name, protected-access, no-self-use # pylint: disable=too-many-branches, too-many-arguments, no-self-use # pylint: disable=too-many-lines, arguments-differ """Definition of various recurrent neural network layers.""" from __future__ import print_function __all__ = ['RNN', 'LSTM', 'GRU'] from ... import ndarray from .. import Block from . import rnn_cell class _RNNLayer(Block): """Implementation of recurrent layers.""" def __init__(self, hidden_size, num_layers, layout, dropout, bidirectional, input_size, i2h_weight_initializer, h2h_weight_initializer, i2h_bias_initializer, h2h_bias_initializer, mode, **kwargs): super(_RNNLayer, self).__init__(**kwargs) assert layout == 'TNC' or layout == 'NTC', \ "Invalid layout %s; must be one of ['TNC' or 'NTC']"%layout self._hidden_size = hidden_size self._num_layers = num_layers self._mode = mode self._layout = layout self._dropout = dropout self._dir = 2 if bidirectional else 1 self._input_size = input_size self._i2h_weight_initializer = i2h_weight_initializer self._h2h_weight_initializer = h2h_weight_initializer self._i2h_bias_initializer = i2h_bias_initializer self._h2h_bias_initializer = h2h_bias_initializer self._gates = {'rnn_relu': 1, 'rnn_tanh': 1, 'lstm': 4, 'gru': 3}[mode] self.i2h_weight = [] self.h2h_weight = [] self.i2h_bias = [] self.h2h_bias = [] ng, ni, nh = self._gates, input_size, hidden_size for i in range(num_layers): for j in (['l', 'r'] if self._dir == 2 else ['l']): self.i2h_weight.append( self.params.get('%s%d_i2h_weight'%(j, i), shape=(ng*nh, ni), init=i2h_weight_initializer, allow_deferred_init=True)) self.h2h_weight.append( self.params.get('%s%d_h2h_weight'%(j, i), shape=(ng*nh, nh), init=h2h_weight_initializer, allow_deferred_init=True)) self.i2h_bias.append( self.params.get('%s%d_i2h_bias'%(j, i), shape=(ng*nh,), init=i2h_bias_initializer, allow_deferred_init=True)) self.h2h_bias.append( self.params.get('%s%d_h2h_bias'%(j, i), shape=(ng*nh,), init=h2h_bias_initializer, allow_deferred_init=True)) ni = nh * self._dir for param_list in [self.i2h_weight, self.h2h_weight, self.i2h_bias, self.h2h_bias]: for p in param_list: self._reg_params[p.name] = p self._unfused = self._unfuse() def __repr__(self): s = '{name}({mapping}, {_layout}' if self._num_layers != 1: s += ', num_layers={_num_layers}' if self._dropout != 0: s += ', dropout={_dropout}' if self._dir == 2: s += ', bidirectional' s += ')' shape = self.i2h_weight[0].shape mapping = '{0} -> {1}'.format(shape[1] if shape[1] else None, shape[0] // self._gates) return s.format(name=self.__class__.__name__, mapping=mapping, **self.__dict__) def state_info(self, batch_size=0): raise NotImplementedError def _unfuse(self): """Unfuses the fused RNN in to a stack of rnn cells.""" get_cell = {'rnn_relu': lambda **kwargs: rnn_cell.RNNCell(self._hidden_size, activation='relu', **kwargs), 'rnn_tanh': lambda **kwargs: rnn_cell.RNNCell(self._hidden_size, activation='tanh', **kwargs), 'lstm': lambda **kwargs: rnn_cell.LSTMCell(self._hidden_size, **kwargs), 'gru': lambda **kwargs: rnn_cell.GRUCell(self._hidden_size, **kwargs)}[self._mode] stack = rnn_cell.SequentialRNNCell(prefix=self.prefix, params=self.params) with stack.name_scope(): ni = self._input_size for i in range(self._num_layers): kwargs = {'input_size': ni, 'i2h_weight_initializer': self._i2h_weight_initializer, 'h2h_weight_initializer': self._h2h_weight_initializer, 'i2h_bias_initializer': self._i2h_bias_initializer, 'h2h_bias_initializer': self._h2h_bias_initializer} if self._dir == 2: stack.add(rnn_cell.BidirectionalCell( get_cell(prefix='l%d_'%i, **kwargs), get_cell(prefix='r%d_'%i, **kwargs))) else: stack.add(get_cell(prefix='l%d_'%i, **kwargs)) if self._dropout > 0 and i != self._num_layers - 1: stack.add(rnn_cell.DropoutCell(self._dropout)) ni = self._hidden_size * self._dir return stack def begin_state(self, batch_size=0, func=ndarray.zeros, **kwargs): """Initial state for this cell. Parameters ---------- batch_size: int Only required for `NDArray` API. Size of the batch ('N' in layout). Dimension of the input. func : callable, default `ndarray.zeros` Function for creating initial state. For Symbol API, func can be `symbol.zeros`, `symbol.uniform`, `symbol.var` etc. Use `symbol.var` if you want to directly feed input as states. For NDArray API, func can be `ndarray.zeros`, `ndarray.ones`, etc. **kwargs : Additional keyword arguments passed to func. For example `mean`, `std`, `dtype`, etc. Returns ------- states : nested list of Symbol Starting states for the first RNN step. """ states = [] for i, info in enumerate(self.state_info(batch_size)): if info is not None: info.update(kwargs) else: info = kwargs states.append(func(name='%sh0_%d'%(self.prefix, i), **info)) return states def forward(self, inputs, states=None): batch_size = inputs.shape[self._layout.find('N')] skip_states = states is None if skip_states: states = self.begin_state(batch_size, ctx=inputs.context) if isinstance(states, ndarray.NDArray): states = [states] for state, info in zip(states, self.state_info(batch_size)): if state.shape != info['shape']: raise ValueError( "Invalid recurrent state shape. Expecting %s, got %s."%( str(info['shape']), str(state.shape))) if self._input_size == 0: for i in range(self._dir): self.i2h_weight[i].shape = (self._gates*self._hidden_size, inputs.shape[2]) self.i2h_weight[i]._finish_deferred_init() if inputs.context.device_type == 'gpu' or \ self._mode in ['lstm', 'gru'] and not self._dropout: out = self._forward_kernel(inputs, states) else: out = self._forward(inputs, states) # out is (output, state) return out[0] if skip_states else out def _forward(self, inputs, states): """forward using gluon cell""" ns = len(states) axis = self._layout.find('T') states = sum(zip(*((j for j in i) for i in states)), ()) outputs, states = self._unfused.unroll( inputs.shape[axis], inputs, states, layout=self._layout, merge_outputs=True) new_states = [] for i in range(ns): state = ndarray.concat(*(j.reshape((1,)+j.shape) for j in states[i::ns]), dim=0) new_states.append(state) return outputs, new_states def _forward_kernel(self, inputs, states): """ forward using CUDNN or CPU kenrel""" if self._layout == 'NTC': inputs = ndarray.swapaxes(inputs, dim1=0, dim2=1) ctx = inputs.context params = sum(zip(self.i2h_weight, self.h2h_weight), ()) params += sum(zip(self.i2h_bias, self.h2h_bias), ()) params = (i.data(ctx).reshape((-1,)) for i in params) params = ndarray.concat(*params, dim=0) rnn = ndarray.RNN(inputs, params, *states, state_size=self._hidden_size, num_layers=self._num_layers, bidirectional=self._dir == 2, p=self._dropout, state_outputs=True, mode=self._mode) if self._mode == 'lstm': outputs, states = rnn[0], [rnn[1], rnn[2]] else: outputs, states = rnn[0], [rnn[1]] if self._layout == 'NTC': outputs = ndarray.swapaxes(outputs, dim1=0, dim2=1) return outputs, states class RNN(_RNNLayer): r"""Applies a multi-layer Elman RNN with `tanh` or `ReLU` non-linearity to an input sequence. For each element in the input sequence, each layer computes the following function: .. math:: h_t = \tanh(w_{ih} * x_t + b_{ih} + w_{hh} * h_{(t-1)} + b_{hh}) where :math:`h_t` is the hidden state at time `t`, and :math:`x_t` is the output of the previous layer at time `t` or :math:`input_t` for the first layer. If nonlinearity='relu', then `ReLU` is used instead of `tanh`. Parameters ---------- hidden_size: int The number of features in the hidden state h. num_layers: int, default 1 Number of recurrent layers. activation: {'relu' or 'tanh'}, default 'relu' The activation function to use. layout : str, default 'TNC' The format of input and output tensors. T, N and C stand for sequence length, batch size, and feature dimensions respectively. dropout: float, default 0 If non-zero, introduces a dropout layer on the outputs of each RNN layer except the last layer. bidirectional: bool, default False If `True`, becomes a bidirectional RNN. i2h_weight_initializer : str or Initializer Initializer for the input weights matrix, used for the linear transformation of the inputs. h2h_weight_initializer : str or Initializer Initializer for the recurrent weights matrix, used for the linear transformation of the recurrent state. i2h_bias_initializer : str or Initializer Initializer for the bias vector. h2h_bias_initializer : str or Initializer Initializer for the bias vector. input_size: int, default 0 The number of expected features in the input x. If not specified, it will be inferred from input. prefix : str or None Prefix of this `Block`. params : ParameterDict or None Shared Parameters for this `Block`. Inputs: - **data**: input tensor with shape `(sequence_length, batch_size, input_size)` when `layout` is "TNC". For other layouts, dimensions are permuted accordingly using transpose() operator which adds performance overhead. Consider creating batches in TNC layout during data batching step. - **states**: initial recurrent state tensor with shape `(num_layers, batch_size, num_hidden)`. If `bidirectional` is True, shape will instead be `(2*num_layers, batch_size, num_hidden)`. If `states` is None, zeros will be used as default begin states. Outputs: - **out**: output tensor with shape `(sequence_length, batch_size, num_hidden)` when `layout` is "TNC". If `bidirectional` is True, output shape will instead be `(sequence_length, batch_size, 2*num_hidden)` - **out_states**: output recurrent state tensor with the same shape as `states`. If `states` is None `out_states` will not be returned. Examples -------- >>> layer = mx.gluon.rnn.RNN(100, 3) >>> layer.initialize() >>> input = mx.nd.random.uniform(shape=(5, 3, 10)) >>> # by default zeros are used as begin state >>> output = layer(input) >>> # manually specify begin state. >>> h0 = mx.nd.random.uniform(shape=(3, 3, 100)) >>> output, hn = layer(input, h0) """ def __init__(self, hidden_size, num_layers=1, activation='relu', layout='TNC', dropout=0, bidirectional=False, i2h_weight_initializer=None, h2h_weight_initializer=None, i2h_bias_initializer='zeros', h2h_bias_initializer='zeros', input_size=0, **kwargs): super(RNN, self).__init__(hidden_size, num_layers, layout, dropout, bidirectional, input_size, i2h_weight_initializer, h2h_weight_initializer, i2h_bias_initializer, h2h_bias_initializer, 'rnn_'+activation, **kwargs) def state_info(self, batch_size=0): return [{'shape': (self._num_layers * self._dir, batch_size, self._hidden_size), '__layout__': 'LNC'}] class LSTM(_RNNLayer): r"""Applies a multi-layer long short-term memory (LSTM) RNN to an input sequence. For each element in the input sequence, each layer computes the following function: .. math:: \begin{array}{ll} i_t = sigmoid(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ f_t = sigmoid(W_{if} x_t + b_{if} + W_{hf} h_{(t-1)} + b_{hf}) \\ g_t = \tanh(W_{ig} x_t + b_{ig} + W_{hc} h_{(t-1)} + b_{hg}) \\ o_t = sigmoid(W_{io} x_t + b_{io} + W_{ho} h_{(t-1)} + b_{ho}) \\ c_t = f_t * c_{(t-1)} + i_t * g_t \\ h_t = o_t * \tanh(c_t) \end{array} where :math:`h_t` is the hidden state at time `t`, :math:`c_t` is the cell state at time `t`, :math:`x_t` is the hidden state of the previous layer at time `t` or :math:`input_t` for the first layer, and :math:`i_t`, :math:`f_t`, :math:`g_t`, :math:`o_t` are the input, forget, cell, and out gates, respectively. Parameters ---------- hidden_size: int The number of features in the hidden state h. num_layers: int, default 1 Number of recurrent layers. layout : str, default 'TNC' The format of input and output tensors. T, N and C stand for sequence length, batch size, and feature dimensions respectively. dropout: float, default 0 If non-zero, introduces a dropout layer on the outputs of each RNN layer except the last layer. bidirectional: bool, default False If `True`, becomes a bidirectional RNN. i2h_weight_initializer : str or Initializer Initializer for the input weights matrix, used for the linear transformation of the inputs. h2h_weight_initializer : str or Initializer Initializer for the recurrent weights matrix, used for the linear transformation of the recurrent state. i2h_bias_initializer : str or Initializer, default 'lstmbias' Initializer for the bias vector. By default, bias for the forget gate is initialized to 1 while all other biases are initialized to zero. h2h_bias_initializer : str or Initializer Initializer for the bias vector. input_size: int, default 0 The number of expected features in the input x. If not specified, it will be inferred from input. prefix : str or None Prefix of this `Block`. params : `ParameterDict` or `None` Shared Parameters for this `Block`. Inputs: - **data**: input tensor with shape `(sequence_length, batch_size, input_size)` when `layout` is "TNC". For other layouts, dimensions are permuted accordingly using transpose() operator which adds performance overhead. Consider creating batches in TNC layout during data batching step. - **states**: a list of two initial recurrent state tensors. Each has shape `(num_layers, batch_size, num_hidden)`. If `bidirectional` is True, shape will instead be `(2*num_layers, batch_size, num_hidden)`. If `states` is None, zeros will be used as default begin states. Outputs: - **out**: output tensor with shape `(sequence_length, batch_size, num_hidden)` when `layout` is "TNC". If `bidirectional` is True, output shape will instead be `(sequence_length, batch_size, 2*num_hidden)` - **out_states**: a list of two output recurrent state tensors with the same shape as in `states`. If `states` is None `out_states` will not be returned. Examples -------- >>> layer = mx.gluon.rnn.LSTM(100, 3) >>> layer.initialize() >>> input = mx.nd.random.uniform(shape=(5, 3, 10)) >>> # by default zeros are used as begin state >>> output = layer(input) >>> # manually specify begin state. >>> h0 = mx.nd.random.uniform(shape=(3, 3, 100)) >>> c0 = mx.nd.random.uniform(shape=(3, 3, 100)) >>> output, hn = layer(input, [h0, c0]) """ def __init__(self, hidden_size, num_layers=1, layout='TNC', dropout=0, bidirectional=False, input_size=0, i2h_weight_initializer=None, h2h_weight_initializer=None, i2h_bias_initializer='zeros', h2h_bias_initializer='zeros', **kwargs): super(LSTM, self).__init__(hidden_size, num_layers, layout, dropout, bidirectional, input_size, i2h_weight_initializer, h2h_weight_initializer, i2h_bias_initializer, h2h_bias_initializer, 'lstm', **kwargs) def state_info(self, batch_size=0): return [{'shape': (self._num_layers * self._dir, batch_size, self._hidden_size), '__layout__': 'LNC'}, {'shape': (self._num_layers * self._dir, batch_size, self._hidden_size), '__layout__': 'LNC'}] class GRU(_RNNLayer): r"""Applies a multi-layer gated recurrent unit (GRU) RNN to an input sequence. For each element in the input sequence, each layer computes the following function: .. math:: \begin{array}{ll} r_t = sigmoid(W_{ir} x_t + b_{ir} + W_{hr} h_{(t-1)} + b_{hr}) \\ i_t = sigmoid(W_{ii} x_t + b_{ii} + W_hi h_{(t-1)} + b_{hi}) \\ n_t = \tanh(W_{in} x_t + b_{in} + r_t * (W_{hn} h_{(t-1)}+ b_{hn})) \\ h_t = (1 - i_t) * n_t + i_t * h_{(t-1)} \\ \end{array} where :math:`h_t` is the hidden state at time `t`, :math:`x_t` is the hidden state of the previous layer at time `t` or :math:`input_t` for the first layer, and :math:`r_t`, :math:`i_t`, :math:`n_t` are the reset, input, and new gates, respectively. Parameters ---------- hidden_size: int The number of features in the hidden state h num_layers: int, default 1 Number of recurrent layers. layout : str, default 'TNC' The format of input and output tensors. T, N and C stand for sequence length, batch size, and feature dimensions respectively. dropout: float, default 0 If non-zero, introduces a dropout layer on the outputs of each RNN layer except the last layer bidirectional: bool, default False If True, becomes a bidirectional RNN. i2h_weight_initializer : str or Initializer Initializer for the input weights matrix, used for the linear transformation of the inputs. h2h_weight_initializer : str or Initializer Initializer for the recurrent weights matrix, used for the linear transformation of the recurrent state. i2h_bias_initializer : str or Initializer Initializer for the bias vector. h2h_bias_initializer : str or Initializer Initializer for the bias vector. input_size: int, default 0 The number of expected features in the input x. If not specified, it will be inferred from input. prefix : str or None Prefix of this `Block`. params : ParameterDict or None Shared Parameters for this `Block`. Inputs: - **data**: input tensor with shape `(sequence_length, batch_size, input_size)` when `layout` is "TNC". For other layouts, dimensions are permuted accordingly using transpose() operator which adds performance overhead. Consider creating batches in TNC layout during data batching step. - **states**: initial recurrent state tensor with shape `(num_layers, batch_size, num_hidden)`. If `bidirectional` is True, shape will instead be `(2*num_layers, batch_size, num_hidden)`. If `states` is None, zeros will be used as default begin states. Outputs: - **out**: output tensor with shape `(sequence_length, batch_size, num_hidden)` when `layout` is "TNC". If `bidirectional` is True, output shape will instead be `(sequence_length, batch_size, 2*num_hidden)` - **out_states**: output recurrent state tensor with the same shape as `states`. If `states` is None `out_states` will not be returned. Examples -------- >>> layer = mx.gluon.rnn.GRU(100, 3) >>> layer.initialize() >>> input = mx.nd.random.uniform(shape=(5, 3, 10)) >>> # by default zeros are used as begin state >>> output = layer(input) >>> # manually specify begin state. >>> h0 = mx.nd.random.uniform(shape=(3, 3, 100)) >>> output, hn = layer(input, h0) """ def __init__(self, hidden_size, num_layers=1, layout='TNC', dropout=0, bidirectional=False, input_size=0, i2h_weight_initializer=None, h2h_weight_initializer=None, i2h_bias_initializer='zeros', h2h_bias_initializer='zeros', **kwargs): super(GRU, self).__init__(hidden_size, num_layers, layout, dropout, bidirectional, input_size, i2h_weight_initializer, h2h_weight_initializer, i2h_bias_initializer, h2h_bias_initializer, 'gru', **kwargs) def state_info(self, batch_size=0): return [{'shape': (self._num_layers * self._dir, batch_size, self._hidden_size), '__layout__': 'LNC'}]
apache-2.0
[ 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 199, 3, 2032, 1854, 1334, 314, 844, 365, 1854, 641, 376, 199, 3, 298, 1179, 2281, 2, 4207, 12, 2428, 2990, 1549, 4217, 1634, 1821, 199, 3, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 1666, 314, 844, 367, 314, 199, 3, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 3, 2803, 26, 2774, 13, 24, 199, 3, 4287, 26, 3507, 29, 889, 13, 1114, 12, 3866, 13, 354, 12, 17819, 13, 2732, 12, 949, 13, 277, 13, 1180, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 16896, 12, 4634, 13, 3479, 13, 4958, 12, 949, 13, 277, 13, 1180, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1278, 12, 2368, 13, 328, 1260, 199, 624, 10701, 402, 7750, 295, 1818, 1279, 4889, 2784, 9393, 1041, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 363, 452, 363, 275, 788, 24124, 297, 283, 28576, 297, 283, 3975, 53, 418, 199, 199, 504, 2263, 492, 6800, 199, 504, 2508, 492, 8651, 199, 504, 1275, 492, 19433, 63, 3890, 421, 199, 533, 485, 24124, 5003, 8, 3142, 304, 272, 408, 7921, 402, 295, 1818, 9393, 1041, 272, 347, 636, 826, 721, 277, 12, 8752, 63, 890, 12, 1967, 63, 4359, 12, 7054, 12, 326, 19795, 12, 12111, 21360, 12, 1324, 63, 890, 12, 326, 284, 18, 72, 63, 3463, 63, 6498, 12, 394, 18, 72, 63, 3463, 63, 6498, 12, 326, 284, 18, 72, 63, 8160, 63, 6498, 12, 394, 18, 72, 63, 8160, 63, 6498, 12, 326, 818, 12, 1011, 958, 304, 267, 1613, 1547, 24124, 5003, 12, 291, 2843, 826, 14155, 958, 9, 267, 702, 7054, 508, 283, 52, 6389, 7, 503, 7054, 508, 283, 46, 5708, 297, 971, 288, 298, 3364, 7054, 450, 83, 27, 1471, 506, 1373, 402, 788, 52, 6389, 7, 503, 283, 46, 5708, 418, 6808, 4209, 267, 291, 423, 5642, 63, 890, 275, 8752, 63, 890, 267, 291, 423, 1507, 63, 4359, 275, 1967, 63, 4359, 267, 291, 423, 632, 275, 818, 267, 291, 423, 4209, 275, 7054, 267, 291, 423, 17953, 275, 19795, 267, 291, 423, 694, 275, 499, 340, 12111, 21360, 587, 413, 267, 291, 423, 1210, 63, 890, 275, 1324, 63, 890, 267, 291, 423, 73, 18, 72, 63, 3463, 63, 6498, 275, 284, 18, 72, 63, 3463, 63, 6498, 267, 291, 423, 72, 18, 72, 63, 3463, 63, 6498, 275, 394, 18, 72, 63, 3463, 63, 6498, 267, 291, 423, 73, 18, 72, 63, 8160, 63, 6498, 275, 284, 18, 72, 63, 8160, 63, 6498, 267, 291, 423, 72, 18, 72, 63, 8160, 63, 6498, 275, 394, 18, 72, 63, 8160, 63, 6498, 398, 291, 423, 71, 2335, 275, 791, 12845, 63, 12833, 356, 413, 12, 283, 12845, 63, 21468, 356, 413, 12, 283, 26652, 356, 841, 12, 283, 2587, 85, 356, 650, 22857, 632, 61, 398, 291, 14, 73, 18, 72, 63, 3463, 275, 942, 267, 291, 14, 72, 18, 72, 63, 3463, 275, 942, 267, 291, 14, 73, 18, 72, 63, 8160, 275, 942, 267, 291, 14, 72, 18, 72, 63, 8160, 275, 942, 398, 28810, 12, 302, 73, 12, 302, 72, 275, 291, 423, 71, 2335, 12, 1324, 63, 890, 12, 8752, 63, 890, 267, 367, 284, 315, 1425, 8, 1507, 63, 4359, 304, 288, 367, 1335, 315, 21022, 76, 297, 283, 82, 418, 340, 291, 423, 694, 508, 499, 587, 788, 76, 9090, 355, 291, 14, 73, 18, 72, 63, 3463, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 73, 18, 72, 63, 3463, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 12, 302, 73, 395, 2511, 4205, 29, 73, 18, 72, 63, 3463, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 72, 18, 72, 63, 3463, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 72, 18, 72, 63, 3463, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 12, 302, 72, 395, 2511, 4205, 29, 72, 18, 72, 63, 3463, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 73, 18, 72, 63, 8160, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 73, 18, 72, 63, 8160, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 4706, 2511, 4205, 29, 73, 18, 72, 63, 8160, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 72, 18, 72, 63, 8160, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 72, 18, 72, 63, 8160, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 4706, 2511, 4205, 29, 72, 18, 72, 63, 8160, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 288, 302, 73, 275, 302, 72, 627, 291, 423, 694, 398, 367, 1215, 63, 513, 315, 359, 277, 14, 73, 18, 72, 63, 3463, 12, 291, 14, 72, 18, 72, 63, 3463, 12, 291, 14, 73, 18, 72, 63, 8160, 12, 291, 14, 72, 18, 72, 63, 8160, 2189, 288, 367, 299, 315, 1215, 63, 513, 26, 355, 291, 423, 1135, 63, 1162, 59, 80, 14, 354, 61, 275, 299, 398, 291, 423, 324, 30032, 275, 291, 423, 324, 70, 1180, 342, 339, 347, 636, 2722, 721, 277, 304, 267, 308, 275, 5041 ]
[ 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 199, 3, 2032, 1854, 1334, 314, 844, 365, 1854, 641, 376, 199, 3, 298, 1179, 2281, 2, 4207, 12, 2428, 2990, 1549, 4217, 1634, 1821, 199, 3, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 1666, 314, 844, 367, 314, 199, 3, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 3, 2803, 26, 2774, 13, 24, 199, 3, 4287, 26, 3507, 29, 889, 13, 1114, 12, 3866, 13, 354, 12, 17819, 13, 2732, 12, 949, 13, 277, 13, 1180, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 16896, 12, 4634, 13, 3479, 13, 4958, 12, 949, 13, 277, 13, 1180, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1278, 12, 2368, 13, 328, 1260, 199, 624, 10701, 402, 7750, 295, 1818, 1279, 4889, 2784, 9393, 1041, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 363, 452, 363, 275, 788, 24124, 297, 283, 28576, 297, 283, 3975, 53, 418, 199, 199, 504, 2263, 492, 6800, 199, 504, 2508, 492, 8651, 199, 504, 1275, 492, 19433, 63, 3890, 421, 199, 533, 485, 24124, 5003, 8, 3142, 304, 272, 408, 7921, 402, 295, 1818, 9393, 1041, 272, 347, 636, 826, 721, 277, 12, 8752, 63, 890, 12, 1967, 63, 4359, 12, 7054, 12, 326, 19795, 12, 12111, 21360, 12, 1324, 63, 890, 12, 326, 284, 18, 72, 63, 3463, 63, 6498, 12, 394, 18, 72, 63, 3463, 63, 6498, 12, 326, 284, 18, 72, 63, 8160, 63, 6498, 12, 394, 18, 72, 63, 8160, 63, 6498, 12, 326, 818, 12, 1011, 958, 304, 267, 1613, 1547, 24124, 5003, 12, 291, 2843, 826, 14155, 958, 9, 267, 702, 7054, 508, 283, 52, 6389, 7, 503, 7054, 508, 283, 46, 5708, 297, 971, 288, 298, 3364, 7054, 450, 83, 27, 1471, 506, 1373, 402, 788, 52, 6389, 7, 503, 283, 46, 5708, 418, 6808, 4209, 267, 291, 423, 5642, 63, 890, 275, 8752, 63, 890, 267, 291, 423, 1507, 63, 4359, 275, 1967, 63, 4359, 267, 291, 423, 632, 275, 818, 267, 291, 423, 4209, 275, 7054, 267, 291, 423, 17953, 275, 19795, 267, 291, 423, 694, 275, 499, 340, 12111, 21360, 587, 413, 267, 291, 423, 1210, 63, 890, 275, 1324, 63, 890, 267, 291, 423, 73, 18, 72, 63, 3463, 63, 6498, 275, 284, 18, 72, 63, 3463, 63, 6498, 267, 291, 423, 72, 18, 72, 63, 3463, 63, 6498, 275, 394, 18, 72, 63, 3463, 63, 6498, 267, 291, 423, 73, 18, 72, 63, 8160, 63, 6498, 275, 284, 18, 72, 63, 8160, 63, 6498, 267, 291, 423, 72, 18, 72, 63, 8160, 63, 6498, 275, 394, 18, 72, 63, 8160, 63, 6498, 398, 291, 423, 71, 2335, 275, 791, 12845, 63, 12833, 356, 413, 12, 283, 12845, 63, 21468, 356, 413, 12, 283, 26652, 356, 841, 12, 283, 2587, 85, 356, 650, 22857, 632, 61, 398, 291, 14, 73, 18, 72, 63, 3463, 275, 942, 267, 291, 14, 72, 18, 72, 63, 3463, 275, 942, 267, 291, 14, 73, 18, 72, 63, 8160, 275, 942, 267, 291, 14, 72, 18, 72, 63, 8160, 275, 942, 398, 28810, 12, 302, 73, 12, 302, 72, 275, 291, 423, 71, 2335, 12, 1324, 63, 890, 12, 8752, 63, 890, 267, 367, 284, 315, 1425, 8, 1507, 63, 4359, 304, 288, 367, 1335, 315, 21022, 76, 297, 283, 82, 418, 340, 291, 423, 694, 508, 499, 587, 788, 76, 9090, 355, 291, 14, 73, 18, 72, 63, 3463, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 73, 18, 72, 63, 3463, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 12, 302, 73, 395, 2511, 4205, 29, 73, 18, 72, 63, 3463, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 72, 18, 72, 63, 3463, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 72, 18, 72, 63, 3463, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 12, 302, 72, 395, 2511, 4205, 29, 72, 18, 72, 63, 3463, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 73, 18, 72, 63, 8160, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 73, 18, 72, 63, 8160, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 4706, 2511, 4205, 29, 73, 18, 72, 63, 8160, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 355, 291, 14, 72, 18, 72, 63, 8160, 14, 740, 8, 490, 291, 14, 1162, 14, 362, 3508, 83, 5, 68, 63, 72, 18, 72, 63, 8160, 13328, 74, 12, 284, 395, 2215, 2687, 2753, 10, 29199, 4706, 2511, 4205, 29, 72, 18, 72, 63, 8160, 63, 6498, 12, 2511, 2040, 63, 12116, 63, 826, 29, 549, 430, 288, 302, 73, 275, 302, 72, 627, 291, 423, 694, 398, 367, 1215, 63, 513, 315, 359, 277, 14, 73, 18, 72, 63, 3463, 12, 291, 14, 72, 18, 72, 63, 3463, 12, 291, 14, 73, 18, 72, 63, 8160, 12, 291, 14, 72, 18, 72, 63,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
megaumi/django
tests/auth_tests/test_remote_user.py
275
10242
from datetime import datetime from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.models import User from django.test import TestCase, modify_settings, override_settings from django.utils import timezone @override_settings(ROOT_URLCONF='auth_tests.urls') class RemoteUserTest(TestCase): middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware' backend = 'django.contrib.auth.backends.RemoteUserBackend' header = 'REMOTE_USER' # Usernames to be passed in REMOTE_USER for the test_known_user test case. known_user = 'knownuser' known_user2 = 'knownuser2' def setUp(self): self.patched_settings = modify_settings( AUTHENTICATION_BACKENDS={'append': self.backend}, MIDDLEWARE_CLASSES={'append': self.middleware}, ) self.patched_settings.enable() def tearDown(self): self.patched_settings.disable() def test_no_remote_user(self): """ Tests requests where no remote user is specified and insures that no users get created. """ num_users = User.objects.count() response = self.client.get('/remote_user/') self.assertTrue(response.context['user'].is_anonymous()) self.assertEqual(User.objects.count(), num_users) response = self.client.get('/remote_user/', **{self.header: None}) self.assertTrue(response.context['user'].is_anonymous()) self.assertEqual(User.objects.count(), num_users) response = self.client.get('/remote_user/', **{self.header: ''}) self.assertTrue(response.context['user'].is_anonymous()) self.assertEqual(User.objects.count(), num_users) def test_unknown_user(self): """ Tests the case where the username passed in the header does not exist as a User. """ num_users = User.objects.count() response = self.client.get('/remote_user/', **{self.header: 'newuser'}) self.assertEqual(response.context['user'].username, 'newuser') self.assertEqual(User.objects.count(), num_users + 1) User.objects.get(username='newuser') # Another request with same user should not create any new users. response = self.client.get('/remote_user/', **{self.header: 'newuser'}) self.assertEqual(User.objects.count(), num_users + 1) def test_known_user(self): """ Tests the case where the username passed in the header is a valid User. """ User.objects.create(username='knownuser') User.objects.create(username='knownuser2') num_users = User.objects.count() response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertEqual(response.context['user'].username, 'knownuser') self.assertEqual(User.objects.count(), num_users) # Test that a different user passed in the headers causes the new user # to be logged in. response = self.client.get('/remote_user/', **{self.header: self.known_user2}) self.assertEqual(response.context['user'].username, 'knownuser2') self.assertEqual(User.objects.count(), num_users) def test_last_login(self): """ Tests that a user's last_login is set the first time they make a request but not updated in subsequent requests with the same session. """ user = User.objects.create(username='knownuser') # Set last_login to something so we can determine if it changes. default_login = datetime(2000, 1, 1) if settings.USE_TZ: default_login = default_login.replace(tzinfo=timezone.utc) user.last_login = default_login user.save() response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertNotEqual(default_login, response.context['user'].last_login) user = User.objects.get(username='knownuser') user.last_login = default_login user.save() response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertEqual(default_login, response.context['user'].last_login) def test_header_disappears(self): """ Tests that a logged in user is logged out automatically when the REMOTE_USER header disappears during the same browser session. """ User.objects.create(username='knownuser') # Known user authenticates response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertEqual(response.context['user'].username, 'knownuser') # During the session, the REMOTE_USER header disappears. Should trigger logout. response = self.client.get('/remote_user/') self.assertEqual(response.context['user'].is_anonymous(), True) # verify the remoteuser middleware will not remove a user # authenticated via another backend User.objects.create_user(username='modeluser', password='foo') self.client.login(username='modeluser', password='foo') authenticate(username='modeluser', password='foo') response = self.client.get('/remote_user/') self.assertEqual(response.context['user'].username, 'modeluser') def test_user_switch_forces_new_login(self): """ Tests that if the username in the header changes between requests that the original user is logged out """ User.objects.create(username='knownuser') # Known user authenticates response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertEqual(response.context['user'].username, 'knownuser') # During the session, the REMOTE_USER changes to a different user. response = self.client.get('/remote_user/', **{self.header: "newnewuser"}) # Ensure that the current user is not the prior remote_user # In backends that create a new user, username is "newnewuser" # In backends that do not create new users, it is '' (anonymous user) self.assertNotEqual(response.context['user'].username, 'knownuser') class RemoteUserNoCreateBackend(RemoteUserBackend): """Backend that doesn't create unknown users.""" create_unknown_user = False class RemoteUserNoCreateTest(RemoteUserTest): """ Contains the same tests as RemoteUserTest, but using a custom auth backend class that doesn't create unknown users. """ backend = 'auth_tests.test_remote_user.RemoteUserNoCreateBackend' def test_unknown_user(self): num_users = User.objects.count() response = self.client.get('/remote_user/', **{self.header: 'newuser'}) self.assertTrue(response.context['user'].is_anonymous()) self.assertEqual(User.objects.count(), num_users) class CustomRemoteUserBackend(RemoteUserBackend): """ Backend that overrides RemoteUserBackend methods. """ def clean_username(self, username): """ Grabs username before the @ character. """ return username.split('@')[0] def configure_user(self, user): """ Sets user's email address. """ user.email = 'user@example.com' user.save() return user class RemoteUserCustomTest(RemoteUserTest): """ Tests a custom RemoteUserBackend subclass that overrides the clean_username and configure_user methods. """ backend = 'auth_tests.test_remote_user.CustomRemoteUserBackend' # REMOTE_USER strings with email addresses for the custom backend to # clean. known_user = 'knownuser@example.com' known_user2 = 'knownuser2@example.com' def test_known_user(self): """ The strings passed in REMOTE_USER should be cleaned and the known users should not have been configured with an email address. """ super(RemoteUserCustomTest, self).test_known_user() self.assertEqual(User.objects.get(username='knownuser').email, '') self.assertEqual(User.objects.get(username='knownuser2').email, '') def test_unknown_user(self): """ The unknown user created should be configured with an email address. """ super(RemoteUserCustomTest, self).test_unknown_user() newuser = User.objects.get(username='newuser') self.assertEqual(newuser.email, 'user@example.com') class CustomHeaderMiddleware(RemoteUserMiddleware): """ Middleware that overrides custom HTTP auth user header. """ header = 'HTTP_AUTHUSER' class CustomHeaderRemoteUserTest(RemoteUserTest): """ Tests a custom RemoteUserMiddleware subclass with custom HTTP auth user header. """ middleware = ( 'auth_tests.test_remote_user.CustomHeaderMiddleware' ) header = 'HTTP_AUTHUSER' class PersistentRemoteUserTest(RemoteUserTest): """ PersistentRemoteUserMiddleware keeps the user logged in even if the subsequent calls do not contain the header value. """ middleware = 'django.contrib.auth.middleware.PersistentRemoteUserMiddleware' require_header = False def test_header_disappears(self): """ A logged in user is kept logged in even if the REMOTE_USER header disappears during the same browser session. """ User.objects.create(username='knownuser') # Known user authenticates response = self.client.get('/remote_user/', **{self.header: self.known_user}) self.assertEqual(response.context['user'].username, 'knownuser') # Should stay logged in if the REMOTE_USER header disappears. response = self.client.get('/remote_user/') self.assertEqual(response.context['user'].is_anonymous(), False) self.assertEqual(response.context['user'].username, 'knownuser')
bsd-3-clause
[ 504, 2197, 492, 2197, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 492, 12895, 199, 504, 1639, 14, 2828, 14, 1178, 14, 7765, 492, 17283, 1899, 8447, 199, 504, 1639, 14, 2828, 14, 1178, 14, 5754, 492, 17283, 1899, 6608, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 396, 492, 7640, 12, 2811, 63, 1751, 12, 4278, 63, 1751, 199, 504, 1639, 14, 1208, 492, 7137, 421, 199, 32, 4415, 63, 1751, 8, 5441, 63, 18125, 534, 1178, 63, 2219, 14, 3603, 358, 199, 533, 17283, 1899, 774, 8, 1746, 304, 339, 10816, 275, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 6713, 1899, 6608, 7, 272, 4865, 275, 283, 1176, 14, 2828, 14, 1178, 14, 7765, 14, 6713, 1899, 8447, 7, 272, 1406, 275, 283, 16058, 63, 3791, 7, 339, 327, 2876, 1247, 370, 506, 3032, 315, 820, 2769, 9407, 63, 3791, 367, 314, 511, 63, 3159, 63, 751, 511, 1930, 14, 272, 6040, 63, 751, 275, 283, 3159, 751, 7, 272, 6040, 63, 751, 18, 275, 283, 3159, 751, 18, 7, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 22631, 63, 1751, 275, 2811, 63, 1751, 8, 288, 7560, 20987, 2594, 63, 28988, 3713, 740, 356, 291, 14, 4620, 1386, 288, 30718, 63, 13748, 3713, 740, 356, 291, 14, 5754, 1386, 267, 776, 267, 291, 14, 22631, 63, 1751, 14, 4296, 342, 339, 347, 6766, 8, 277, 304, 267, 291, 14, 22631, 63, 1751, 14, 5993, 342, 339, 347, 511, 63, 889, 63, 3846, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 4145, 2382, 949, 3982, 922, 365, 2013, 436, 5261, 1482, 626, 949, 267, 4390, 664, 2737, 14, 267, 408, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 6217, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 488, 1552, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 3071, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 339, 347, 511, 63, 5187, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 314, 1930, 2382, 314, 3434, 3032, 315, 314, 1406, 1630, 440, 2187, 267, 465, 282, 2876, 14, 267, 408, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 1222, 751, 3071, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 1222, 751, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 435, 413, 9, 267, 2876, 14, 1462, 14, 362, 8, 2473, 534, 1222, 751, 358, 398, 327, 22604, 1056, 543, 2011, 922, 1077, 440, 1218, 1263, 892, 4390, 14, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 1222, 751, 3071, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 435, 413, 9, 339, 347, 511, 63, 3159, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 314, 1930, 2382, 314, 3434, 3032, 315, 314, 1406, 365, 282, 1686, 2876, 14, 267, 408, 267, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 358, 267, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 18, 358, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 1552, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 3159, 751, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 267, 327, 1379, 626, 282, 3365, 922, 3032, 315, 314, 2323, 14486, 314, 892, 922, 267, 327, 370, 506, 10367, 315, 14, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 18, 1552, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 3159, 751, 18, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 339, 347, 511, 63, 2019, 63, 2886, 8, 277, 304, 267, 408, 267, 6496, 626, 282, 922, 1159, 2061, 63, 2886, 365, 663, 314, 1642, 900, 2985, 1852, 282, 267, 1056, 1325, 440, 4588, 315, 13372, 4145, 543, 314, 2011, 2351, 14, 267, 408, 267, 922, 275, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 358, 267, 327, 2494, 2061, 63, 2886, 370, 6020, 880, 781, 883, 6705, 340, 652, 4493, 14, 267, 849, 63, 2886, 275, 2197, 8, 8269, 12, 413, 12, 413, 9, 267, 340, 2202, 14, 4701, 63, 14226, 26, 288, 849, 63, 2886, 275, 849, 63, 2886, 14, 1814, 8, 9374, 29, 7145, 14, 5834, 9, 267, 922, 14, 2019, 63, 2886, 275, 849, 63, 2886, 267, 922, 14, 2117, 342, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 1552, 267, 291, 14, 7418, 8, 885, 63, 2886, 12, 1177, 14, 1100, 459, 751, 2278, 2019, 63, 2886, 9, 398, 922, 275, 2876, 14, 1462, 14, 362, 8, 2473, 534, 3159, 751, 358, 267, 922, 14, 2019, 63, 2886, 275, 849, 63, 2886, 267, 922, 14, 2117, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63 ]
[ 2197, 492, 2197, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 492, 12895, 199, 504, 1639, 14, 2828, 14, 1178, 14, 7765, 492, 17283, 1899, 8447, 199, 504, 1639, 14, 2828, 14, 1178, 14, 5754, 492, 17283, 1899, 6608, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 396, 492, 7640, 12, 2811, 63, 1751, 12, 4278, 63, 1751, 199, 504, 1639, 14, 1208, 492, 7137, 421, 199, 32, 4415, 63, 1751, 8, 5441, 63, 18125, 534, 1178, 63, 2219, 14, 3603, 358, 199, 533, 17283, 1899, 774, 8, 1746, 304, 339, 10816, 275, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 6713, 1899, 6608, 7, 272, 4865, 275, 283, 1176, 14, 2828, 14, 1178, 14, 7765, 14, 6713, 1899, 8447, 7, 272, 1406, 275, 283, 16058, 63, 3791, 7, 339, 327, 2876, 1247, 370, 506, 3032, 315, 820, 2769, 9407, 63, 3791, 367, 314, 511, 63, 3159, 63, 751, 511, 1930, 14, 272, 6040, 63, 751, 275, 283, 3159, 751, 7, 272, 6040, 63, 751, 18, 275, 283, 3159, 751, 18, 7, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 22631, 63, 1751, 275, 2811, 63, 1751, 8, 288, 7560, 20987, 2594, 63, 28988, 3713, 740, 356, 291, 14, 4620, 1386, 288, 30718, 63, 13748, 3713, 740, 356, 291, 14, 5754, 1386, 267, 776, 267, 291, 14, 22631, 63, 1751, 14, 4296, 342, 339, 347, 6766, 8, 277, 304, 267, 291, 14, 22631, 63, 1751, 14, 5993, 342, 339, 347, 511, 63, 889, 63, 3846, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 4145, 2382, 949, 3982, 922, 365, 2013, 436, 5261, 1482, 626, 949, 267, 4390, 664, 2737, 14, 267, 408, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 6217, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 488, 1552, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 3071, 267, 291, 14, 1815, 8, 1310, 14, 1100, 459, 751, 2278, 374, 63, 12628, 1012, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 339, 347, 511, 63, 5187, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 314, 1930, 2382, 314, 3434, 3032, 315, 314, 1406, 1630, 440, 2187, 267, 465, 282, 2876, 14, 267, 408, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 1222, 751, 3071, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 1222, 751, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 435, 413, 9, 267, 2876, 14, 1462, 14, 362, 8, 2473, 534, 1222, 751, 358, 398, 327, 22604, 1056, 543, 2011, 922, 1077, 440, 1218, 1263, 892, 4390, 14, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 31159, 277, 14, 1291, 26, 283, 1222, 751, 3071, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 435, 413, 9, 339, 347, 511, 63, 3159, 63, 751, 8, 277, 304, 267, 408, 267, 6496, 314, 1930, 2382, 314, 3434, 3032, 315, 314, 1406, 365, 282, 1686, 2876, 14, 267, 408, 267, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 358, 267, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 18, 358, 267, 1967, 63, 3707, 275, 2876, 14, 1462, 14, 835, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 1552, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 3159, 751, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 267, 327, 1379, 626, 282, 3365, 922, 3032, 315, 314, 2323, 14486, 314, 892, 922, 267, 327, 370, 506, 10367, 315, 14, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 18, 1552, 267, 291, 14, 629, 8, 1310, 14, 1100, 459, 751, 2278, 2473, 12, 283, 3159, 751, 18, 358, 267, 291, 14, 629, 8, 1899, 14, 1462, 14, 835, 1062, 1967, 63, 3707, 9, 339, 347, 511, 63, 2019, 63, 2886, 8, 277, 304, 267, 408, 267, 6496, 626, 282, 922, 1159, 2061, 63, 2886, 365, 663, 314, 1642, 900, 2985, 1852, 282, 267, 1056, 1325, 440, 4588, 315, 13372, 4145, 543, 314, 2011, 2351, 14, 267, 408, 267, 922, 275, 2876, 14, 1462, 14, 981, 8, 2473, 534, 3159, 751, 358, 267, 327, 2494, 2061, 63, 2886, 370, 6020, 880, 781, 883, 6705, 340, 652, 4493, 14, 267, 849, 63, 2886, 275, 2197, 8, 8269, 12, 413, 12, 413, 9, 267, 340, 2202, 14, 4701, 63, 14226, 26, 288, 849, 63, 2886, 275, 849, 63, 2886, 14, 1814, 8, 9374, 29, 7145, 14, 5834, 9, 267, 922, 14, 2019, 63, 2886, 275, 849, 63, 2886, 267, 922, 14, 2117, 342, 398, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 751, 3678, 3521, 31159, 277, 14, 1291, 26, 291, 14, 3159, 63, 751, 1552, 267, 291, 14, 7418, 8, 885, 63, 2886, 12, 1177, 14, 1100, 459, 751, 2278, 2019, 63, 2886, 9, 398, 922, 275, 2876, 14, 1462, 14, 362, 8, 2473, 534, 3159, 751, 358, 267, 922, 14, 2019, 63, 2886, 275, 849, 63, 2886, 267, 922, 14, 2117, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3846, 63, 0 ]
[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]
boh1996/LectioAPI
scrapers/subject_list.py
1
1386
#!/usr/bin/python # -*- coding: utf8 -*- from bs4 import BeautifulSoup as Soup import urls import re import proxy import functions def subject_list ( start, end, school_id ): increase = 1 subjects = [] cards = [] for code in range(0, end-start+1): cards.append(start + (code*increase)) for code in cards: url = "http://www.lectio.dk/lectio/%s/FindSkema.aspx?type=hold&fag=%s" % ( str(school_id), str(code) ) cookies = {} # Insert User-agent headers and the cookie information headers = { "User-Agent" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1665.2 Safari/537.36", "Content-Type" : "application/x-www-form-urlencoded", "Host" : "www.lectio.dk", "Origin" : "https://www.lectio.dk", "Cookie" : functions.implode(cookies, "{{index}}={{value}}", "; ") } error = False try: response = proxy.session.get(url, headers=headers) except Exception, e: print code error = True if error == False: html = response.text soup = Soup(html) if not soup.find("table", attrs={"id" : "m_Content_contenttbl"}) is None: elements = soup.find("table", attrs={"id" : "m_Content_contenttbl"}).find("span").text.split(" - ") subjects.append({ "abbrevation" : elements[0].encode("utf8"), "name" : elements[1].encode("utf8"), "subject_id" : str(code) }) return subjects
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 24, 1882, 199, 199, 504, 9922, 20, 492, 17132, 465, 28028, 199, 646, 8187, 199, 646, 295, 199, 646, 4566, 199, 646, 3423, 199, 199, 318, 5420, 63, 513, 334, 1343, 12, 1284, 12, 308, 15089, 63, 344, 3461, 199, 198, 31687, 275, 413, 199, 198, 25660, 275, 942, 421, 198, 13761, 275, 942, 421, 198, 509, 1233, 315, 1425, 8, 16, 12, 1284, 13, 928, 11, 17, 304, 507, 198, 13761, 14, 740, 8, 928, 435, 334, 600, 10, 31687, 430, 421, 198, 509, 1233, 315, 27181, 26, 507, 198, 633, 275, 298, 1014, 921, 1544, 14, 10251, 4538, 14, 6341, 15, 10251, 4538, 3149, 83, 15, 6591, 51, 415, 391, 14, 26146, 31, 466, 29, 12239, 6, 70, 643, 2458, 83, 2, 450, 334, 620, 8, 23194, 63, 344, 395, 620, 8, 600, 9, 776, 2742, 198, 7792, 275, 1052, 2742, 198, 3, 15496, 2876, 13, 4054, 2323, 436, 314, 5494, 2556, 507, 198, 2139, 275, 469, 686, 198, 2, 1899, 13, 7788, 2, 520, 298, 22285, 15, 21, 14, 16, 334, 8647, 23350, 1227, 14, 17, 27, 644, 19716, 772, 9, 21257, 21666, 15, 24416, 14, 1344, 334, 43, 4943, 12, 2839, 30506, 9, 16776, 15, 708, 14, 16, 14, 975, 2182, 14, 18, 428, 2756, 759, 15, 24416, 14, 1344, 401, 686, 198, 2, 2714, 13, 804, 2, 520, 298, 3578, 15, 88, 13, 1544, 13, 964, 13, 21886, 401, 686, 198, 2, 4965, 2, 520, 298, 1544, 14, 10251, 4538, 14, 6341, 401, 686, 198, 2, 12834, 2, 520, 298, 2859, 921, 1544, 14, 10251, 4538, 14, 6341, 401, 686, 198, 2, 7810, 2, 520, 3423, 14, 3236, 320, 271, 8, 7792, 12, 7370, 1080, 4863, 3126, 91, 585, 4863, 401, 28036, 6099, 507, 198, 93, 507, 198, 705, 275, 756, 507, 198, 893, 26, 686, 198, 1310, 275, 4566, 14, 1730, 14, 362, 8, 633, 12, 2323, 29, 2139, 9, 507, 198, 2590, 2186, 12, 325, 26, 686, 198, 1361, 1233, 686, 198, 705, 275, 715, 2742, 198, 692, 1125, 508, 756, 26, 686, 198, 1360, 275, 1177, 14, 505, 6319, 198, 9317, 275, 28028, 8, 1360, 9, 6319, 198, 692, 440, 9108, 14, 1623, 480, 1224, 401, 3290, 8871, 344, 2, 520, 298, 77, 63, 2714, 63, 1317, 14806, 5984, 365, 488, 26, 1585, 198, 5527, 275, 9108, 14, 1623, 480, 1224, 401, 3290, 8871, 344, 2, 520, 298, 77, 63, 2714, 63, 1317, 14806, 3570, 680, 1623, 480, 3751, 3471, 505, 14, 1294, 480, 446, 6099, 16737, 198, 25660, 14, 740, 2561, 1871, 198, 2, 371, 10205, 4255, 2, 520, 4008, 59, 16, 1055, 2143, 480, 1624, 24, 1288, 1871, 198, 2, 354, 2, 520, 4008, 59, 17, 1055, 2143, 480, 1624, 24, 1288, 1871, 198, 2, 5875, 63, 344, 2, 520, 620, 8, 600, 9, 1585, 198, 1552, 421, 198, 1107, 32446, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 24, 1882, 199, 199, 504, 9922, 20, 492, 17132, 465, 28028, 199, 646, 8187, 199, 646, 295, 199, 646, 4566, 199, 646, 3423, 199, 199, 318, 5420, 63, 513, 334, 1343, 12, 1284, 12, 308, 15089, 63, 344, 3461, 199, 198, 31687, 275, 413, 199, 198, 25660, 275, 942, 421, 198, 13761, 275, 942, 421, 198, 509, 1233, 315, 1425, 8, 16, 12, 1284, 13, 928, 11, 17, 304, 507, 198, 13761, 14, 740, 8, 928, 435, 334, 600, 10, 31687, 430, 421, 198, 509, 1233, 315, 27181, 26, 507, 198, 633, 275, 298, 1014, 921, 1544, 14, 10251, 4538, 14, 6341, 15, 10251, 4538, 3149, 83, 15, 6591, 51, 415, 391, 14, 26146, 31, 466, 29, 12239, 6, 70, 643, 2458, 83, 2, 450, 334, 620, 8, 23194, 63, 344, 395, 620, 8, 600, 9, 776, 2742, 198, 7792, 275, 1052, 2742, 198, 3, 15496, 2876, 13, 4054, 2323, 436, 314, 5494, 2556, 507, 198, 2139, 275, 469, 686, 198, 2, 1899, 13, 7788, 2, 520, 298, 22285, 15, 21, 14, 16, 334, 8647, 23350, 1227, 14, 17, 27, 644, 19716, 772, 9, 21257, 21666, 15, 24416, 14, 1344, 334, 43, 4943, 12, 2839, 30506, 9, 16776, 15, 708, 14, 16, 14, 975, 2182, 14, 18, 428, 2756, 759, 15, 24416, 14, 1344, 401, 686, 198, 2, 2714, 13, 804, 2, 520, 298, 3578, 15, 88, 13, 1544, 13, 964, 13, 21886, 401, 686, 198, 2, 4965, 2, 520, 298, 1544, 14, 10251, 4538, 14, 6341, 401, 686, 198, 2, 12834, 2, 520, 298, 2859, 921, 1544, 14, 10251, 4538, 14, 6341, 401, 686, 198, 2, 7810, 2, 520, 3423, 14, 3236, 320, 271, 8, 7792, 12, 7370, 1080, 4863, 3126, 91, 585, 4863, 401, 28036, 6099, 507, 198, 93, 507, 198, 705, 275, 756, 507, 198, 893, 26, 686, 198, 1310, 275, 4566, 14, 1730, 14, 362, 8, 633, 12, 2323, 29, 2139, 9, 507, 198, 2590, 2186, 12, 325, 26, 686, 198, 1361, 1233, 686, 198, 705, 275, 715, 2742, 198, 692, 1125, 508, 756, 26, 686, 198, 1360, 275, 1177, 14, 505, 6319, 198, 9317, 275, 28028, 8, 1360, 9, 6319, 198, 692, 440, 9108, 14, 1623, 480, 1224, 401, 3290, 8871, 344, 2, 520, 298, 77, 63, 2714, 63, 1317, 14806, 5984, 365, 488, 26, 1585, 198, 5527, 275, 9108, 14, 1623, 480, 1224, 401, 3290, 8871, 344, 2, 520, 298, 77, 63, 2714, 63, 1317, 14806, 3570, 680, 1623, 480, 3751, 3471, 505, 14, 1294, 480, 446, 6099, 16737, 198, 25660, 14, 740, 2561, 1871, 198, 2, 371, 10205, 4255, 2, 520, 4008, 59, 16, 1055, 2143, 480, 1624, 24, 1288, 1871, 198, 2, 354, 2, 520, 4008, 59, 17, 1055, 2143, 480, 1624, 24, 1288, 1871, 198, 2, 5875, 63, 344, 2, 520, 620, 8, 600, 9, 1585, 198, 1552, 421, 198, 1107, 32446, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1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on_main/tests/test_models.py
1
1200
from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase from envirocon.envirocon_main.models import GroundWorkClass class TestGroundWorkClassModels(TestCase): def setUp(self): self.gwc = GroundWorkClass() def test_gwc_init(self): self.assertIsNotNone(self.gwc) self.assertEquals(unicode(self.gwc.faculty_group.name), 'Another Test Class Faculty') self.assertEquals(unicode(self.gwc.course_group.name), 'Another Test Class Students') self.assertIsNotNone(self.gwc.course) self.assertIsNotNone(self.gwc.game) self.assertIsNotNone(self.gwc.faculty_team) def test_gwc_init_creator(self): cr = User.objects.create() ngwc = GroundWorkClass(creator=cr, title='New Name') self.assertIsNotNone(ngwc.creator) def test_next_month(self): nm = self.gwc.next_month() d = datetime.today() nxtmn = datetime(d.year + (d.month + 1) / 12, ((d.month + 1) % 12) + 1, d.day) self.assertEquals(nm, nxtmn) def test_copy_survey_srvy_none(self): pass
gpl-2.0
[ 504, 2197, 492, 2197, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 655, 433, 293, 388, 14, 287, 433, 293, 388, 63, 973, 14, 992, 492, 598, 2363, 6517, 2543, 421, 199, 533, 1379, 39, 2363, 6517, 2543, 20474, 8, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 8392, 67, 275, 598, 2363, 6517, 2543, 342, 339, 347, 511, 63, 8392, 67, 63, 826, 8, 277, 304, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 9, 267, 291, 14, 2947, 8, 2975, 8, 277, 14, 8392, 67, 14, 12668, 17323, 63, 923, 14, 354, 395, 2079, 283, 23296, 1379, 8089, 481, 645, 17323, 358, 267, 291, 14, 2947, 8, 2975, 8, 277, 14, 8392, 67, 14, 1972, 63, 923, 14, 354, 395, 2079, 283, 23296, 1379, 8089, 17246, 83, 358, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 1972, 9, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 5097, 9, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 12668, 17323, 63, 5969, 9, 339, 347, 511, 63, 8392, 67, 63, 826, 63, 9986, 8, 277, 304, 267, 2467, 275, 2876, 14, 1462, 14, 981, 342, 267, 302, 8392, 67, 275, 598, 2363, 6517, 2543, 8, 9986, 29, 1556, 12, 2538, 534, 4665, 2812, 358, 267, 291, 14, 10389, 8, 2753, 13683, 14, 9986, 9, 339, 347, 511, 63, 2184, 63, 4482, 8, 277, 304, 267, 16751, 275, 291, 14, 8392, 67, 14, 2184, 63, 4482, 342, 267, 366, 275, 2197, 14, 8136, 342, 267, 302, 400, 10344, 275, 2197, 8, 68, 14, 3403, 435, 334, 68, 14, 4482, 435, 413, 9, 1182, 3144, 12, 586, 3666, 68, 14, 4482, 435, 413, 9, 450, 3144, 9, 435, 413, 12, 366, 14, 2977, 9, 267, 291, 14, 2947, 8, 10756, 12, 302, 400, 10344, 9, 339, 347, 511, 63, 1574, 63, 10625, 63, 15165, 89, 63, 3592, 8, 277, 304, 267, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2197, 492, 2197, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 655, 433, 293, 388, 14, 287, 433, 293, 388, 63, 973, 14, 992, 492, 598, 2363, 6517, 2543, 421, 199, 533, 1379, 39, 2363, 6517, 2543, 20474, 8, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 8392, 67, 275, 598, 2363, 6517, 2543, 342, 339, 347, 511, 63, 8392, 67, 63, 826, 8, 277, 304, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 9, 267, 291, 14, 2947, 8, 2975, 8, 277, 14, 8392, 67, 14, 12668, 17323, 63, 923, 14, 354, 395, 2079, 283, 23296, 1379, 8089, 481, 645, 17323, 358, 267, 291, 14, 2947, 8, 2975, 8, 277, 14, 8392, 67, 14, 1972, 63, 923, 14, 354, 395, 2079, 283, 23296, 1379, 8089, 17246, 83, 358, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 1972, 9, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 5097, 9, 267, 291, 14, 10389, 8, 277, 14, 8392, 67, 14, 12668, 17323, 63, 5969, 9, 339, 347, 511, 63, 8392, 67, 63, 826, 63, 9986, 8, 277, 304, 267, 2467, 275, 2876, 14, 1462, 14, 981, 342, 267, 302, 8392, 67, 275, 598, 2363, 6517, 2543, 8, 9986, 29, 1556, 12, 2538, 534, 4665, 2812, 358, 267, 291, 14, 10389, 8, 2753, 13683, 14, 9986, 9, 339, 347, 511, 63, 2184, 63, 4482, 8, 277, 304, 267, 16751, 275, 291, 14, 8392, 67, 14, 2184, 63, 4482, 342, 267, 366, 275, 2197, 14, 8136, 342, 267, 302, 400, 10344, 275, 2197, 8, 68, 14, 3403, 435, 334, 68, 14, 4482, 435, 413, 9, 1182, 3144, 12, 586, 3666, 68, 14, 4482, 435, 413, 9, 450, 3144, 9, 435, 413, 12, 366, 14, 2977, 9, 267, 291, 14, 2947, 8, 10756, 12, 302, 400, 10344, 9, 339, 347, 511, 63, 1574, 63, 10625, 63, 15165, 89, 63, 3592, 8, 277, 304, 267, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,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0, 0, 0 ]
labase/activlets
src/test/test_model.py
1
6983
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Activlets # Copyright 2013-2015 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__. # # Activlets é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos da Licença Pública Geral GNU como # publicada pela Fundação do Software Livre (FSF); na versão 2 da # Licença. # # Este programa é distribuído na esperança de que possa ser útil, # mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO # a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a # Licença Pública Geral GNU para maiores detalhes. # # Você deve ter recebido uma cópia da Licença Pública Geral GNU # junto com este programa, se não, veja em <http://www.gnu.org/licenses/> """ O testa o modelo de aktask. """ import unittest from aktask.model import Issue, Facade, Project from aktask.control import MainControl from unittest.mock import MagicMock, call, patch, ANY class IssueTest(unittest.TestCase): class Evento: x = y = 42 EV = Evento() def setUp(self): self.caretaker = MagicMock(name="caretaker") keys = "number, title, body, user, labels, milestone, state, size, assignee".split(", ") self.façade = Facade() Facade().use_with_caution_empty_facade_model() self.issue0 = {key: key+"0" for key in keys} self.issue1 = {key: key+"1" for key in keys} self.app = Issue(**self.issue0) def test_create(self): """cria um issue""" self.assertIsInstance(self.app, Issue, "Issue of __instance not created") def test_update(self): """atualiza um issue""" attr_in_issue0 = all(True for attr in self.issue0 if getattr(self.app, attr) in self.issue0.values()) self.assertTrue(attr_in_issue0, "Issue mismatch contents with issue 0 %s" % self.issue0.values()) self.app.update(**self.issue1) attr_in_issue1 = all(True for attr in self.issue0 if getattr(self.app, attr) in self.issue1.values()) self.assertTrue(attr_in_issue1, "Issue mismatch contents with issue 1 %s" % self.issue1.values()) def test_retrieve(self): """recupera valores de um issue""" self.app.retrieve(self.caretaker) self.caretaker.update.assert_called_with(**self.issue0) def test_facade_singleton(self): """verifica se facade é singleton""" self.assertIs(Facade(), Facade()) def test_facade_manage_project(self): """insere e recupera projeto""" project = Facade().insert_project("test") self.assertIsInstance(project, Project, "%s not instance of Project" % project) project = Facade().retrieve_project("test") self.assertIsInstance(project, Project, "%s not instance of Project" % project) def _test_facade_manage_issue(self, project="test", **kwargs): """insere e recupera issue""" proj = self.façade.insert_project(project) return proj, self.façade.insert_issue(project, **kwargs) def test_facade_manage_issue(self): """insere e recupera issue""" _, issue = self._test_facade_manage_issue("test", title="issue") self.assertIsInstance(issue, Issue, "%s not instance of Issue" % issue) issue = Facade().retrieve_issue("test", "0") self.assertIsInstance(issue, Issue, "%s not instance of Issue" % issue) self.assertEqual(issue.title, "issue", "Issue title is not issue, else is %s" % issue.title) def test_facade_visit_issue(self): """visita issue""" project, issue = self._test_facade_manage_issue("test", title="issue") visitor = MagicMock("visitor") visitor.visit = MagicMock("visit") self.assertIsInstance(issue, Issue, "%s not instance of Issue" % issue) Facade().accept(visitor) self.assertEqual(visitor.visit.call_count, 2) mc = visitor.mock_calls calls = [call(project), call(issue)] visitor.visit.assert_has_calls(calls) def _mock_github(self): with patch("github.Github") as MockGh: instance = MockGh.return_value instance.get_user.return_value = instance.get_repo.return_value = instance mockissue = MagicMock("mockissue") mockmile = MagicMock("mockmile") mockmile.title = "issue.milestone" mockmile.return_value = True instance.get_issues.return_value = [mockissue] mockissue.labels = [{"la": "red"}, {"lb": "green"}] mockissue.title = "ta" mockissue.number = "2016" mockissue.body = "issue.body" mockissue.milestone = mockmile mockissue.state = "issue.state" return instance, mockmile def test_control_fill_with_data(self): """le do github e escreve no modelo""" mc = MainControl() self.assertIsNotNone(self.façade.retrieve_project("eica"), "MainControl failed to create eica") mg, mm = self._mock_github() mc.fill_with_data(reader=mg) print(mm.call_count) mg.get_user.assert_called_once_with("labase") mg.get_repo.assert_called_once_with("eica") issue = self.façade.retrieve_issue("eica", "2016") self.assertIsNotNone(issue, "Facade failed to index issue") self.assertEqual(issue.milestone, "issue.milestone") def _mock_gtk_writer(self): MockGh = MagicMock("MockGh") visitor = MagicMock("visitor") visitor.update = visitor instance = MockGh.return_value instance.visit.side_effect = lambda vis: vis.retrieve(visitor) return instance, visitor def test_control_render_data_to_gui(self): """le do modelo e escreve no gtk""" def Any(cls): class Any(cls): def __eq__(self, other): return True return Any() mc = MainControl() project = self.façade.retrieve_project("eica") self.assertIsNotNone(project, "MainControl failed to create eica") mgtk, visitor = self._mock_gtk_writer() mc.fill_with_data(reader=self._mock_github()[0]) mc.render_data_to_gui(writer=mgtk) issue = self.façade.retrieve_issue("eica", "2016") mgtk.visit.assert_any_call(issue) mgtk.visit.assert_any_call(project) self.assertEqual(2, mgtk.visit.call_count) visitor.update.assert_any_call(name="eica") issuedict = dict(assignee=None, body='issue.body', labels=[{'la': 'red'}, {'lb': 'green'}], milestone='issue.milestone', number='2016', size=0, state='issue.state', title='ta', user='') # cl = visitor.call_args_list # assert cl[1] == issuedict, cl[1] visitor.update.assert_any_call(**issuedict) self.assertEqual(2, visitor.update.call_count) if __name__ == '__main__': unittest.main()
gpl-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 9094, 24, 1882, 199, 3, 662, 1597, 601, 783, 2392, 26785, 623, 266, 886, 557, 926, 391, 21904, 86, 16537, 199, 3, 1898, 6171, 13, 7806, 14243, 320, 593, 6442, 20936, 665, 7007, 320, 32, 21225, 14, 1286, 82, 74, 14, 3289, 6244, 199, 3, 658, 22511, 482, 665, 1014, 921, 5561, 482, 14, 277, 711, 14, 1308, 3133, 64, 363, 27, 658, 12006, 665, 1014, 921, 374, 14, 7136, 15, 19, 53, 3583, 8637, 4343, 199, 3, 199, 3, 21904, 86, 16537, 26785, 28236, 2032, 1212, 86, 264, 27, 373, 679, 28413, 299, 380, 295, 2130, 13676, 13, 320, 325, 15, 810, 199, 3, 1953, 1792, 11302, 13, 320, 477, 343, 293, 31069, 2044, 16908, 12927, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 512, 573, 199, 3, 4575, 10641, 299, 352, 65, 481, 725, 65, 22723, 886, 2290, 491, 1003, 264, 334, 7079, 38, 2736, 11802, 809, 83, 16299, 499, 12927, 199, 3, 491, 530, 287, 15368, 65, 14, 199, 3, 199, 3, 662, 1597, 557, 926, 391, 26785, 1473, 13676, 1117, 11802, 9455, 529, 290, 15368, 65, 477, 17414, 1115, 28023, 8926, 13333, 119, 2270, 12, 199, 3, 28065, 22032, 653, 742, 28327, 2054, 598, 689, 1441, 13033, 27, 26298, 399, 391, 486, 285, 4466, 65, 11512, 13676, 14422, 65, 477, 437, 1093, 2328, 33, 128, 230, 128, 226, 47, 199, 3, 282, 6420, 16891, 603, 540, 17238, 47, 29934, 10319, 2507, 33, 128, 230, 128, 226, 47, 26512, 3115, 14, 25777, 3387, 282, 199, 3, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 12665, 610, 2308, 470, 20894, 279, 72, 397, 14, 199, 3, 199, 3, 812, 679, 28413, 477, 432, 2044, 295, 301, 17949, 79, 399, 391, 286, 11980, 1038, 65, 12927, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 199, 3, 1335, 24087, 2414, 325, 1597, 557, 926, 391, 12, 542, 302, 16299, 12, 11199, 3387, 18564, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 3133, 199, 199, 624, 199, 47, 511, 65, 312, 818, 320, 477, 282, 75, 1765, 14, 199, 199, 624, 199, 646, 2882, 199, 504, 282, 75, 1765, 14, 1238, 492, 13383, 12, 481, 645, 9587, 12, 7290, 199, 504, 282, 75, 1765, 14, 2785, 492, 11298, 3717, 199, 504, 2882, 14, 1805, 492, 10079, 12, 1240, 12, 3371, 12, 1821, 421, 199, 533, 13383, 774, 8, 2796, 14, 1746, 304, 272, 1021, 22207, 475, 26, 267, 671, 275, 612, 275, 5685, 272, 30069, 275, 22207, 475, 342, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 28654, 502, 2570, 275, 10079, 8, 354, 628, 28654, 502, 2570, 531, 267, 2883, 275, 298, 1955, 12, 2538, 12, 2396, 12, 922, 12, 3628, 12, 333, 18072, 12, 1174, 12, 1568, 12, 465, 4093, 18682, 1674, 1294, 11854, 6099, 267, 291, 14, 667, 15368, 9587, 275, 481, 645, 9587, 342, 267, 481, 645, 9587, 1252, 1180, 63, 1045, 63, 696, 2206, 63, 1667, 63, 12668, 9587, 63, 1238, 342, 398, 291, 14, 5237, 16, 275, 469, 498, 26, 790, 5207, 16, 2, 367, 790, 315, 2883, 93, 267, 291, 14, 5237, 17, 275, 469, 498, 26, 790, 5207, 17, 2, 367, 790, 315, 2883, 93, 398, 291, 14, 571, 275, 13383, 3682, 277, 14, 5237, 16, 9, 339, 347, 511, 63, 981, 8, 277, 304, 267, 408, 1408, 65, 28236, 4976, 624, 267, 291, 14, 6926, 8, 277, 14, 571, 12, 13383, 12, 298, 17106, 402, 636, 842, 440, 2737, 531, 339, 347, 511, 63, 873, 8, 277, 304, 267, 408, 292, 1061, 565, 65, 28236, 4976, 624, 267, 1921, 63, 262, 63, 5237, 16, 275, 1006, 8, 549, 367, 1921, 315, 291, 14, 5237, 16, 340, 2519, 8, 277, 14, 571, 12, 1921, 9, 315, 291, 14, 5237, 16, 14, 1459, 1012, 267, 291, 14, 1815, 8, 962, 63, 262, 63, 5237, 16, 12, 298, 17106, 15015, 4072, 543, 4976, 378, 450, 83, 2, 450, 291, 14, 5237, 16, 14, 1459, 1012, 267, 291, 14, 571, 14, 873, 3682, 277, 14, 5237, 17, 9, 267, 1921, 63, 262, 63, 5237, 17, 275, 1006, 8, 549, 367, 1921, 315, 291, 14, 5237, 16, 340, 2519, 8, 277, 14, 571, 12, 1921, 9, 315, 291, 14, 5237, 17, 14, 1459, 1012, 267, 291, 14, 1815, 8, 962, 63, 262, 63, 5237, 17, 12, 298, 17106, 15015, 4072, 543, 4976, 413, 450, 83, 2, 450, 291, 14, 5237, 17, 14, 1459, 1012, 339, 347, 511, 63, 14270, 8, 277, 304, 267, 408, 2761, 27951, 65, 1139, 7944, 477, 28236, 4976, 624, 267, 291, 14, 571, 14, 14270, 8, 277, 14, 28654, 502, 2570, 9, 267, 291, 14, 28654, 502, 2570, 14, 873, 14, 479, 63, 3527, 63, 1045, 3682, 277, 14, 5237, 16, 9, 339, 347, 511, 63, 12668, 9587, 63, 24675, 8, 277, 304, 267, 408, 422, 1903, 696, 542, 21625, 9587, 26785, 19768, 624, 267, 291, 14, 3436, 8, 38, 645, 9587, 1062, 481, 645, 9587, 1012, 339, 347, 511, 63, 12668, 9587, 63, 9053, 63, 1715, 8, 277, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 13523, 16876, 624, 267, 2199, 275, 481, 645, 9587, 1252, 3176, 63, 1715, 480, 396, 531, 267, 291, 14, 6926, 8, 1715, 12, 7290, 12, 2071, 83, 440, 1256, 402, 7290, 2, 450, 2199, 9, 267, 2199, 275, 481, 645, 9587, 1252, 14270, 63, 1715, 480, 396, 531, 267, 291, 14, 6926, 8, 1715, 12, 7290, 12, 2071, 83, 440, 1256, 402, 7290, 2, 450, 2199, 9, 339, 347, 485, 396, 63, 12668, 9587, 63, 9053, 63, 5237, 8, 277, 12, 2199, 628, 396, 401, 1011, 958, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 4976, 624, 267, 13523, 275, 291, 14, 667, 15368, 9587, 14, 3176, 63, 1715, 8, 1715, 9, 267, 372, 13523, 12, 291, 14, 667, 15368, 9587, 14, 3176, 63, 5237, 8, 1715, 12, 1011, 958, 9, 339, 347, 511, 63, 12668, 9587, 63, 9053, 63, 5237, 8, 277, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 4976, 624, 267, 5501, 4976 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 9094, 24, 1882, 199, 3, 662, 1597, 601, 783, 2392, 26785, 623, 266, 886, 557, 926, 391, 21904, 86, 16537, 199, 3, 1898, 6171, 13, 7806, 14243, 320, 593, 6442, 20936, 665, 7007, 320, 32, 21225, 14, 1286, 82, 74, 14, 3289, 6244, 199, 3, 658, 22511, 482, 665, 1014, 921, 5561, 482, 14, 277, 711, 14, 1308, 3133, 64, 363, 27, 658, 12006, 665, 1014, 921, 374, 14, 7136, 15, 19, 53, 3583, 8637, 4343, 199, 3, 199, 3, 21904, 86, 16537, 26785, 28236, 2032, 1212, 86, 264, 27, 373, 679, 28413, 299, 380, 295, 2130, 13676, 13, 320, 325, 15, 810, 199, 3, 1953, 1792, 11302, 13, 320, 477, 343, 293, 31069, 2044, 16908, 12927, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 512, 573, 199, 3, 4575, 10641, 299, 352, 65, 481, 725, 65, 22723, 886, 2290, 491, 1003, 264, 334, 7079, 38, 2736, 11802, 809, 83, 16299, 499, 12927, 199, 3, 491, 530, 287, 15368, 65, 14, 199, 3, 199, 3, 662, 1597, 557, 926, 391, 26785, 1473, 13676, 1117, 11802, 9455, 529, 290, 15368, 65, 477, 17414, 1115, 28023, 8926, 13333, 119, 2270, 12, 199, 3, 28065, 22032, 653, 742, 28327, 2054, 598, 689, 1441, 13033, 27, 26298, 399, 391, 486, 285, 4466, 65, 11512, 13676, 14422, 65, 477, 437, 1093, 2328, 33, 128, 230, 128, 226, 47, 199, 3, 282, 6420, 16891, 603, 540, 17238, 47, 29934, 10319, 2507, 33, 128, 230, 128, 226, 47, 26512, 3115, 14, 25777, 3387, 282, 199, 3, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 12665, 610, 2308, 470, 20894, 279, 72, 397, 14, 199, 3, 199, 3, 812, 679, 28413, 477, 432, 2044, 295, 301, 17949, 79, 399, 391, 286, 11980, 1038, 65, 12927, 491, 530, 287, 15368, 65, 510, 24602, 66, 7518, 22261, 279, 1664, 199, 3, 1335, 24087, 2414, 325, 1597, 557, 926, 391, 12, 542, 302, 16299, 12, 11199, 3387, 18564, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 3133, 199, 199, 624, 199, 47, 511, 65, 312, 818, 320, 477, 282, 75, 1765, 14, 199, 199, 624, 199, 646, 2882, 199, 504, 282, 75, 1765, 14, 1238, 492, 13383, 12, 481, 645, 9587, 12, 7290, 199, 504, 282, 75, 1765, 14, 2785, 492, 11298, 3717, 199, 504, 2882, 14, 1805, 492, 10079, 12, 1240, 12, 3371, 12, 1821, 421, 199, 533, 13383, 774, 8, 2796, 14, 1746, 304, 272, 1021, 22207, 475, 26, 267, 671, 275, 612, 275, 5685, 272, 30069, 275, 22207, 475, 342, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 28654, 502, 2570, 275, 10079, 8, 354, 628, 28654, 502, 2570, 531, 267, 2883, 275, 298, 1955, 12, 2538, 12, 2396, 12, 922, 12, 3628, 12, 333, 18072, 12, 1174, 12, 1568, 12, 465, 4093, 18682, 1674, 1294, 11854, 6099, 267, 291, 14, 667, 15368, 9587, 275, 481, 645, 9587, 342, 267, 481, 645, 9587, 1252, 1180, 63, 1045, 63, 696, 2206, 63, 1667, 63, 12668, 9587, 63, 1238, 342, 398, 291, 14, 5237, 16, 275, 469, 498, 26, 790, 5207, 16, 2, 367, 790, 315, 2883, 93, 267, 291, 14, 5237, 17, 275, 469, 498, 26, 790, 5207, 17, 2, 367, 790, 315, 2883, 93, 398, 291, 14, 571, 275, 13383, 3682, 277, 14, 5237, 16, 9, 339, 347, 511, 63, 981, 8, 277, 304, 267, 408, 1408, 65, 28236, 4976, 624, 267, 291, 14, 6926, 8, 277, 14, 571, 12, 13383, 12, 298, 17106, 402, 636, 842, 440, 2737, 531, 339, 347, 511, 63, 873, 8, 277, 304, 267, 408, 292, 1061, 565, 65, 28236, 4976, 624, 267, 1921, 63, 262, 63, 5237, 16, 275, 1006, 8, 549, 367, 1921, 315, 291, 14, 5237, 16, 340, 2519, 8, 277, 14, 571, 12, 1921, 9, 315, 291, 14, 5237, 16, 14, 1459, 1012, 267, 291, 14, 1815, 8, 962, 63, 262, 63, 5237, 16, 12, 298, 17106, 15015, 4072, 543, 4976, 378, 450, 83, 2, 450, 291, 14, 5237, 16, 14, 1459, 1012, 267, 291, 14, 571, 14, 873, 3682, 277, 14, 5237, 17, 9, 267, 1921, 63, 262, 63, 5237, 17, 275, 1006, 8, 549, 367, 1921, 315, 291, 14, 5237, 16, 340, 2519, 8, 277, 14, 571, 12, 1921, 9, 315, 291, 14, 5237, 17, 14, 1459, 1012, 267, 291, 14, 1815, 8, 962, 63, 262, 63, 5237, 17, 12, 298, 17106, 15015, 4072, 543, 4976, 413, 450, 83, 2, 450, 291, 14, 5237, 17, 14, 1459, 1012, 339, 347, 511, 63, 14270, 8, 277, 304, 267, 408, 2761, 27951, 65, 1139, 7944, 477, 28236, 4976, 624, 267, 291, 14, 571, 14, 14270, 8, 277, 14, 28654, 502, 2570, 9, 267, 291, 14, 28654, 502, 2570, 14, 873, 14, 479, 63, 3527, 63, 1045, 3682, 277, 14, 5237, 16, 9, 339, 347, 511, 63, 12668, 9587, 63, 24675, 8, 277, 304, 267, 408, 422, 1903, 696, 542, 21625, 9587, 26785, 19768, 624, 267, 291, 14, 3436, 8, 38, 645, 9587, 1062, 481, 645, 9587, 1012, 339, 347, 511, 63, 12668, 9587, 63, 9053, 63, 1715, 8, 277, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 13523, 16876, 624, 267, 2199, 275, 481, 645, 9587, 1252, 3176, 63, 1715, 480, 396, 531, 267, 291, 14, 6926, 8, 1715, 12, 7290, 12, 2071, 83, 440, 1256, 402, 7290, 2, 450, 2199, 9, 267, 2199, 275, 481, 645, 9587, 1252, 14270, 63, 1715, 480, 396, 531, 267, 291, 14, 6926, 8, 1715, 12, 7290, 12, 2071, 83, 440, 1256, 402, 7290, 2, 450, 2199, 9, 339, 347, 485, 396, 63, 12668, 9587, 63, 9053, 63, 5237, 8, 277, 12, 2199, 628, 396, 401, 1011, 958, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 4976, 624, 267, 13523, 275, 291, 14, 667, 15368, 9587, 14, 3176, 63, 1715, 8, 1715, 9, 267, 372, 13523, 12, 291, 14, 667, 15368, 9587, 14, 3176, 63, 5237, 8, 1715, 12, 1011, 958, 9, 339, 347, 511, 63, 12668, 9587, 63, 9053, 63, 5237, 8, 277, 304, 267, 408, 262, 261, 264, 325, 6488, 27951, 65, 4976, 624, 267, 5501, 4976, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
snamstorm/rockstor-core
src/rockstor/smart_manager/models/task.py
3
1077
""" Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. RockStor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from django.db import models from smart_manager.models import TaskDefinition class Task(models.Model): task_def = models.ForeignKey(TaskDefinition) state = models.CharField(max_length=64) start = models.DateTimeField(auto_now=True, db_index=True) end = models.DateTimeField(null=True, db_index=True) class Meta: app_label = 'smart_manager'
gpl-3.0
[ 624, 199, 7384, 334, 67, 9, 6029, 13, 6965, 820, 766, 933, 269, 12, 3277, 14, 665, 1014, 921, 24892, 8041, 14, 957, 30, 199, 2765, 570, 365, 1777, 402, 820, 766, 933, 269, 14, 199, 199, 50, 766, 933, 269, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 199, 991, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 199, 269, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 199, 50, 766, 933, 269, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 29946, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 14109, 1684, 844, 367, 1655, 2436, 14, 199, 199, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 21632, 543, 642, 2240, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 624, 199, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 11179, 63, 2609, 14, 992, 492, 8495, 10701, 421, 199, 533, 8495, 8, 992, 14, 1685, 304, 339, 2120, 63, 318, 275, 1709, 14, 3190, 8, 4476, 10701, 9, 272, 1174, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 772, 9, 272, 1343, 275, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 12, 1592, 63, 1080, 29, 549, 9, 272, 1284, 275, 1709, 14, 4626, 8, 2307, 29, 549, 12, 1592, 63, 1080, 29, 549, 9, 339, 1021, 6288, 26, 267, 1145, 63, 1302, 275, 283, 7853, 63, 2609, 7, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 7384, 334, 67, 9, 6029, 13, 6965, 820, 766, 933, 269, 12, 3277, 14, 665, 1014, 921, 24892, 8041, 14, 957, 30, 199, 2765, 570, 365, 1777, 402, 820, 766, 933, 269, 14, 199, 199, 50, 766, 933, 269, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 199, 991, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 199, 269, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 199, 50, 766, 933, 269, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 29946, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 14109, 1684, 844, 367, 1655, 2436, 14, 199, 199, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 21632, 543, 642, 2240, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 624, 199, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 11179, 63, 2609, 14, 992, 492, 8495, 10701, 421, 199, 533, 8495, 8, 992, 14, 1685, 304, 339, 2120, 63, 318, 275, 1709, 14, 3190, 8, 4476, 10701, 9, 272, 1174, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 772, 9, 272, 1343, 275, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 12, 1592, 63, 1080, 29, 549, 9, 272, 1284, 275, 1709, 14, 4626, 8, 2307, 29, 549, 12, 1592, 63, 1080, 29, 549, 9, 339, 1021, 6288, 26, 267, 1145, 63, 1302, 275, 283, 7853, 63, 2609, 7, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
arpitparmar5739/youtube-dl
youtube_dl/extractor/tvplay.py
86
8688
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( parse_iso8601, qualities, ) class TVPlayIE(InfoExtractor): IE_DESC = 'TV3Play and related services' _VALID_URL = r'''(?x)http://(?:www\.)? (?:tvplay\.lv/parraides| tv3play\.lt/programos| play\.tv3\.lt/programos| tv3play\.ee/sisu| tv3play\.se/program| tv6play\.se/program| tv8play\.se/program| tv10play\.se/program| tv3play\.no/programmer| viasat4play\.no/programmer| tv6play\.no/programmer| tv3play\.dk/programmer| play\.novatv\.bg/programi )/[^/]+/(?P<id>\d+) ''' _TESTS = [ { 'url': 'http://www.tvplay.lv/parraides/vinas-melo-labak/418113?autostart=true', 'info_dict': { 'id': '418113', 'ext': 'flv', 'title': 'Kādi ir īri? - Viņas melo labāk', 'description': 'Baiba apsmej īrus, kādi tie ir un ko viņi dara.', 'duration': 25, 'timestamp': 1406097056, 'upload_date': '20140723', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://play.tv3.lt/programos/moterys-meluoja-geriau/409229?autostart=true', 'info_dict': { 'id': '409229', 'ext': 'flv', 'title': 'Moterys meluoja geriau', 'description': 'md5:9aec0fc68e2cbc992d2a140bd41fa89e', 'duration': 1330, 'timestamp': 1403769181, 'upload_date': '20140626', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv3play.ee/sisu/kodu-keset-linna/238551?autostart=true', 'info_dict': { 'id': '238551', 'ext': 'flv', 'title': 'Kodu keset linna 398537', 'description': 'md5:7df175e3c94db9e47c0d81ffa5d68701', 'duration': 1257, 'timestamp': 1292449761, 'upload_date': '20101215', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv3play.se/program/husraddarna/395385?autostart=true', 'info_dict': { 'id': '395385', 'ext': 'flv', 'title': 'Husräddarna S02E07', 'description': 'md5:f210c6c89f42d4fc39faa551be813777', 'duration': 2574, 'timestamp': 1400596321, 'upload_date': '20140520', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv6play.se/program/den-sista-dokusapan/266636?autostart=true', 'info_dict': { 'id': '266636', 'ext': 'flv', 'title': 'Den sista dokusåpan S01E08', 'description': 'md5:295be39c872520221b933830f660b110', 'duration': 1492, 'timestamp': 1330522854, 'upload_date': '20120229', 'age_limit': 18, }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv8play.se/program/antikjakten/282756?autostart=true', 'info_dict': { 'id': '282756', 'ext': 'flv', 'title': 'Antikjakten S01E10', 'description': 'md5:1b201169beabd97e20c5ad0ad67b13b8', 'duration': 2646, 'timestamp': 1348575868, 'upload_date': '20120925', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv3play.no/programmer/anna-anka-soker-assistent/230898?autostart=true', 'info_dict': { 'id': '230898', 'ext': 'flv', 'title': 'Anna Anka søker assistent - Ep. 8', 'description': 'md5:f80916bf5bbe1c5f760d127f8dd71474', 'duration': 2656, 'timestamp': 1277720005, 'upload_date': '20100628', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.viasat4play.no/programmer/budbringerne/21873?autostart=true', 'info_dict': { 'id': '21873', 'ext': 'flv', 'title': 'Budbringerne program 10', 'description': 'md5:4db78dc4ec8a85bb04fd322a3ee5092d', 'duration': 1297, 'timestamp': 1254205102, 'upload_date': '20090929', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.tv6play.no/programmer/hotelinspektor-alex-polizzi/361883?autostart=true', 'info_dict': { 'id': '361883', 'ext': 'flv', 'title': 'Hotelinspektør Alex Polizzi - Ep. 10', 'description': 'md5:3ecf808db9ec96c862c8ecb3a7fdaf81', 'duration': 2594, 'timestamp': 1393236292, 'upload_date': '20140224', }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://play.novatv.bg/programi/zdravei-bulgariya/624952?autostart=true', 'info_dict': { 'id': '624952', 'ext': 'flv', 'title': 'Здравей, България (12.06.2015 г.) ', 'description': 'md5:99f3700451ac5bb71a260268b8daefd7', 'duration': 8838, 'timestamp': 1434100372, 'upload_date': '20150612', }, 'params': { # rtmp download 'skip_download': True, }, }, ] def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( 'http://playapi.mtgx.tv/v1/videos/%s' % video_id, video_id, 'Downloading video JSON') if video['is_geo_blocked']: self.report_warning( 'This content might not be available in your country due to copyright reasons') streams = self._download_json( 'http://playapi.mtgx.tv/v1/videos/stream/%s' % video_id, video_id, 'Downloading streams JSON') quality = qualities(['hls', 'medium', 'high']) formats = [] for format_id, video_url in streams['streams'].items(): if not video_url or not isinstance(video_url, compat_str): continue fmt = { 'format_id': format_id, 'preference': quality(format_id), } if video_url.startswith('rtmp'): m = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', video_url) if not m: continue fmt.update({ 'ext': 'flv', 'url': m.group('url'), 'app': m.group('app'), 'play_path': m.group('playpath'), }) elif video_url.endswith('.f4m'): formats.extend(self._extract_f4m_formats( video_url + '?hdcore=3.5.0&plugin=aasp-3.5.0.151.81', video_id)) continue else: fmt.update({ 'url': video_url, }) formats.append(fmt) self._sort_formats(formats) return { 'id': video_id, 'title': video['title'], 'description': video['description'], 'duration': video['duration'], 'timestamp': parse_iso8601(video['created_at']), 'view_count': video['views']['total'], 'age_limit': video.get('age_limit', 0), 'formats': formats, }
unlicense
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 5819, 492, 8434, 63, 495, 199, 504, 2508, 1208, 492, 334, 272, 2198, 63, 4595, 15363, 12, 272, 6420, 12107, 12, 199, 9, 421, 199, 533, 26990, 9651, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 12764, 19, 9651, 436, 4048, 8500, 7, 272, 485, 5600, 63, 2632, 275, 519, 2344, 2229, 88, 9, 1014, 921, 5169, 1544, 20316, 267, 16697, 6993, 2802, 4537, 6371, 15, 462, 345, 2655, 83, 92, 1779, 13466, 19, 2802, 4537, 4116, 15, 496, 926, 16908, 92, 1779, 5232, 4537, 6993, 19, 4537, 4116, 15, 496, 926, 16908, 92, 1779, 13466, 19, 2802, 4537, 1024, 15, 2316, 85, 92, 1779, 13466, 19, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 22, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 24, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 709, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 19, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 1321, 305, 292, 20, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 13466, 22, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 13466, 19, 2802, 4537, 6341, 15, 6815, 2626, 92, 1779, 5232, 4537, 889, 16305, 86, 4537, 6856, 15, 6815, 73, 267, 16023, 26285, 9448, 48, 28, 344, 3072, 68, 8771, 267, 1449, 272, 485, 7569, 275, 359, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 2802, 14, 6371, 15, 462, 345, 2655, 83, 15, 11908, 305, 13, 278, 320, 13, 5561, 1151, 15, 24456, 9225, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 24456, 9225, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 43, 129, 224, 328, 8190, 221, 129, 105, 322, 31, 446, 6561, 130, 229, 305, 562, 320, 19888, 129, 224, 75, 297, 355, 283, 1802, 356, 283, 13864, 1892, 65, 282, 1190, 278, 74, 221, 129, 105, 20791, 12, 1022, 129, 224, 328, 3367, 69, 8190, 625, 20817, 1321, 130, 229, 73, 366, 17956, 3130, 355, 283, 5553, 356, 5661, 12, 355, 283, 3954, 356, 4329, 1690, 1643, 2760, 1367, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1780, 1789, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 2802, 14, 6993, 19, 14, 4116, 15, 496, 926, 16908, 15, 573, 351, 588, 13, 278, 10836, 79, 3387, 13, 836, 73, 3844, 15, 12443, 11182, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 12443, 11182, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 3716, 351, 588, 562, 10836, 79, 3387, 486, 281, 73, 3844, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 25, 65, 825, 16, 3003, 2333, 69, 18, 19279, 16544, 68, 18, 65, 10037, 3691, 2953, 667, 1407, 69, 297, 355, 283, 5553, 356, 413, 14137, 12, 355, 283, 3954, 356, 22796, 1401, 1876, 12851, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1690, 1479, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 19, 2802, 14, 1024, 15, 2316, 85, 15, 75, 364, 85, 13, 415, 409, 13, 472, 3540, 15, 12332, 23327, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 12332, 23327, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 43, 364, 85, 10074, 409, 7403, 3540, 10551, 2426, 1401, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 23, 1587, 10848, 69, 19, 67, 2635, 697, 25, 69, 2417, 67, 16, 68, 2835, 556, 65, 21, 68, 31828, 614, 297, 355, 283, 5553, 356, 413, 11551, 12, 355, 283, 3954, 356, 25454, 1194, 1887, 26648, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 614, 7842, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 19, 2802, 14, 261, 15, 6815, 15, 72, 527, 22958, 24252, 15, 14099, 13846, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 14099, 13846, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 40, 2647, 13733, 617, 24252, 428, 996, 37, 1780, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 70, 12725, 67, 22, 67, 1407, 70, 2260, 68, 20, 3003, 1355, 667, 65, 23327, 1235, 24, 969, 11956, 297, 355, 283, 5553, 356, 5661, 1342, 12, 355, 283, 3954, 356, 4329, 383, 15112, 12638, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1717, 1165, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 22, 2802, 14, 261, 15, 6815, 15, 848, 13, 338, 1207, 13, 68, 745, 527, 439, 290, 15, 9969, 26654, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 9969, 26654, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 10655, 308, 631, 65, 366, 745, 527, 30234, 10384, 428, 614, 37, 2036, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 11405, 1235, 1355, 67, 1555, 821, 4999, 2025, 66, 25, 13744, 1216, 70, 15268, 66, 6019, 297, 355, 283, 5553, 356, 413, 25722, 12, 355, 283, 3954, 356, 28416, 1717, 12048, 1477, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 4999, 1398, 297, 355, 283, 474, 63, 3097, 356, 6155, 12, 288, 1660, 288, 283, 1162, 356, 469, 355, 327 ]
[ 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 5819, 492, 8434, 63, 495, 199, 504, 2508, 1208, 492, 334, 272, 2198, 63, 4595, 15363, 12, 272, 6420, 12107, 12, 199, 9, 421, 199, 533, 26990, 9651, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 12764, 19, 9651, 436, 4048, 8500, 7, 272, 485, 5600, 63, 2632, 275, 519, 2344, 2229, 88, 9, 1014, 921, 5169, 1544, 20316, 267, 16697, 6993, 2802, 4537, 6371, 15, 462, 345, 2655, 83, 92, 1779, 13466, 19, 2802, 4537, 4116, 15, 496, 926, 16908, 92, 1779, 5232, 4537, 6993, 19, 4537, 4116, 15, 496, 926, 16908, 92, 1779, 13466, 19, 2802, 4537, 1024, 15, 2316, 85, 92, 1779, 13466, 19, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 22, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 24, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 709, 2802, 4537, 261, 15, 6815, 92, 1779, 13466, 19, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 1321, 305, 292, 20, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 13466, 22, 2802, 4537, 889, 15, 6815, 2626, 92, 1779, 13466, 19, 2802, 4537, 6341, 15, 6815, 2626, 92, 1779, 5232, 4537, 889, 16305, 86, 4537, 6856, 15, 6815, 73, 267, 16023, 26285, 9448, 48, 28, 344, 3072, 68, 8771, 267, 1449, 272, 485, 7569, 275, 359, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 2802, 14, 6371, 15, 462, 345, 2655, 83, 15, 11908, 305, 13, 278, 320, 13, 5561, 1151, 15, 24456, 9225, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 24456, 9225, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 43, 129, 224, 328, 8190, 221, 129, 105, 322, 31, 446, 6561, 130, 229, 305, 562, 320, 19888, 129, 224, 75, 297, 355, 283, 1802, 356, 283, 13864, 1892, 65, 282, 1190, 278, 74, 221, 129, 105, 20791, 12, 1022, 129, 224, 328, 3367, 69, 8190, 625, 20817, 1321, 130, 229, 73, 366, 17956, 3130, 355, 283, 5553, 356, 5661, 12, 355, 283, 3954, 356, 4329, 1690, 1643, 2760, 1367, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1780, 1789, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 2802, 14, 6993, 19, 14, 4116, 15, 496, 926, 16908, 15, 573, 351, 588, 13, 278, 10836, 79, 3387, 13, 836, 73, 3844, 15, 12443, 11182, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 12443, 11182, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 3716, 351, 588, 562, 10836, 79, 3387, 486, 281, 73, 3844, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 25, 65, 825, 16, 3003, 2333, 69, 18, 19279, 16544, 68, 18, 65, 10037, 3691, 2953, 667, 1407, 69, 297, 355, 283, 5553, 356, 413, 14137, 12, 355, 283, 3954, 356, 22796, 1401, 1876, 12851, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1690, 1479, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 19, 2802, 14, 1024, 15, 2316, 85, 15, 75, 364, 85, 13, 415, 409, 13, 472, 3540, 15, 12332, 23327, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 12332, 23327, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 43, 364, 85, 10074, 409, 7403, 3540, 10551, 2426, 1401, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 23, 1587, 10848, 69, 19, 67, 2635, 697, 25, 69, 2417, 67, 16, 68, 2835, 556, 65, 21, 68, 31828, 614, 297, 355, 283, 5553, 356, 413, 11551, 12, 355, 283, 3954, 356, 25454, 1194, 1887, 26648, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 614, 7842, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 19, 2802, 14, 261, 15, 6815, 15, 72, 527, 22958, 24252, 15, 14099, 13846, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 14099, 13846, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 40, 2647, 13733, 617, 24252, 428, 996, 37, 1780, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 70, 12725, 67, 22, 67, 1407, 70, 2260, 68, 20, 3003, 1355, 667, 65, 23327, 1235, 24, 969, 11956, 297, 355, 283, 5553, 356, 5661, 1342, 12, 355, 283, 3954, 356, 4329, 383, 15112, 12638, 12, 355, 283, 5064, 63, 602, 356, 283, 7280, 1717, 1165, 297, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 519, 2791, 5235, 355, 283, 2759, 63, 4249, 356, 715, 12, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 22, 2802, 14, 261, 15, 6815, 15, 848, 13, 338, 1207, 13, 68, 745, 527, 439, 290, 15, 9969, 26654, 31, 2495, 928, 29, 2052, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 9969, 26654, 297, 355, 283, 832, 356, 283, 22753, 297, 355, 283, 1213, 356, 283, 10655, 308, 631, 65, 366, 745, 527, 30234, 10384, 428, 614, 37, 2036, 297, 355, 283, 1802, 356, 283, 1064, 21, 26, 11405, 1235, 1355, 67, 1555, 821, 4999, 2025, 66, 25, 13744, 1216, 70, 15268, 66, 6019, 297, 355, 283, 5553, 356, 413, 25722, 12, 355, 283, 3954, 356, 28416, 1717, 12048, 1477, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 4999, 1398, 297, 355, 283, 474, 63, 3097, 356, 6155, 12, 288, 1660, 288, 283, 1162, 356, 469, 355, 327, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
carnell69/kuma
kuma/search/signals.py
13
1554
import logging from django.conf import settings from kuma.wiki.search import WikiDocumentType log = logging.getLogger('kuma.search.signals') def render_done_handler(**kwargs): if not settings.ES_LIVE_INDEX or 'instance' not in kwargs: return from kuma.wiki.tasks import index_documents from .models import Index doc = kwargs['instance'] if WikiDocumentType.should_update(doc): current_index = Index.objects.get_current() outdated = current_index.record_outdated(doc) if outdated: log.info('Found a newer index and scheduled ' 'indexing it after promotion.') doc_pks = set(doc.other_translations.values_list('pk', flat=True)) doc_pks.add(doc.id) try: index_documents.delay(list(doc_pks), current_index.pk) except Exception: log.error('Search indexing task failed', exc_info=True) else: log.info('Ignoring wiki document %r while updating search index', doc.id, exc_info=True) def pre_delete_handler(**kwargs): if not settings.ES_LIVE_INDEX or 'instance' not in kwargs: return from kuma.wiki.tasks import unindex_documents from .models import Index doc = kwargs['instance'] current_index = Index.objects.get_current() if WikiDocumentType.should_update(doc): unindex_documents.delay([doc.pk], current_index.pk) else: log.info('Ignoring wiki document %r while updating search index', doc.pk, exc_info=True)
mpl-2.0
[ 646, 2050, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 199, 504, 1022, 85, 391, 14, 6797, 14, 1733, 492, 644, 11545, 5564, 804, 421, 199, 793, 275, 2050, 14, 5572, 360, 20661, 391, 14, 1733, 14, 10458, 358, 421, 199, 318, 3795, 63, 4456, 63, 2232, 3682, 958, 304, 272, 340, 440, 2202, 14, 654, 63, 31541, 63, 10215, 503, 283, 842, 7, 440, 315, 2074, 26, 267, 372, 339, 687, 1022, 85, 391, 14, 6797, 14, 5054, 492, 1478, 63, 12233, 272, 687, 1275, 992, 492, 5499, 339, 1382, 275, 2074, 459, 842, 418, 272, 340, 644, 11545, 5564, 804, 14, 5626, 63, 873, 8, 1301, 304, 267, 1453, 63, 1080, 275, 5499, 14, 1462, 14, 362, 63, 1818, 342, 267, 734, 19074, 275, 1453, 63, 1080, 14, 3059, 63, 548, 19074, 8, 1301, 9, 267, 340, 734, 19074, 26, 288, 943, 14, 815, 360, 3601, 282, 15666, 1478, 436, 18416, 283, 2151, 283, 28703, 652, 2410, 8023, 23193, 2659, 267, 1382, 63, 27323, 275, 663, 8, 1301, 14, 1848, 63, 13982, 14, 1459, 63, 513, 360, 2051, 297, 6829, 29, 549, 430, 267, 1382, 63, 27323, 14, 525, 8, 1301, 14, 344, 9, 267, 862, 26, 288, 1478, 63, 12233, 14, 5814, 8, 513, 8, 1301, 63, 27323, 395, 1453, 63, 1080, 14, 2051, 9, 267, 871, 2186, 26, 288, 943, 14, 705, 360, 5278, 16356, 2120, 3405, 297, 3178, 63, 815, 29, 549, 9, 272, 587, 26, 267, 943, 14, 815, 360, 32390, 17195, 2213, 450, 82, 1830, 12928, 2754, 1478, 297, 326, 1382, 14, 344, 12, 3178, 63, 815, 29, 549, 9, 421, 199, 318, 876, 63, 1807, 63, 2232, 3682, 958, 304, 272, 340, 440, 2202, 14, 654, 63, 31541, 63, 10215, 503, 283, 842, 7, 440, 315, 2074, 26, 267, 372, 339, 687, 1022, 85, 391, 14, 6797, 14, 5054, 492, 625, 1080, 63, 12233, 272, 687, 1275, 992, 492, 5499, 339, 1382, 275, 2074, 459, 842, 418, 272, 1453, 63, 1080, 275, 5499, 14, 1462, 14, 362, 63, 1818, 342, 339, 340, 644, 11545, 5564, 804, 14, 5626, 63, 873, 8, 1301, 304, 267, 625, 1080, 63, 12233, 14, 5814, 779, 1301, 14, 2051, 467, 1453, 63, 1080, 14, 2051, 9, 272, 587, 26, 267, 943, 14, 815, 360, 32390, 17195, 2213, 450, 82, 1830, 12928, 2754, 1478, 297, 326, 1382, 14, 2051, 12, 3178, 63, 815, 29, 549, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2050, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 199, 504, 1022, 85, 391, 14, 6797, 14, 1733, 492, 644, 11545, 5564, 804, 421, 199, 793, 275, 2050, 14, 5572, 360, 20661, 391, 14, 1733, 14, 10458, 358, 421, 199, 318, 3795, 63, 4456, 63, 2232, 3682, 958, 304, 272, 340, 440, 2202, 14, 654, 63, 31541, 63, 10215, 503, 283, 842, 7, 440, 315, 2074, 26, 267, 372, 339, 687, 1022, 85, 391, 14, 6797, 14, 5054, 492, 1478, 63, 12233, 272, 687, 1275, 992, 492, 5499, 339, 1382, 275, 2074, 459, 842, 418, 272, 340, 644, 11545, 5564, 804, 14, 5626, 63, 873, 8, 1301, 304, 267, 1453, 63, 1080, 275, 5499, 14, 1462, 14, 362, 63, 1818, 342, 267, 734, 19074, 275, 1453, 63, 1080, 14, 3059, 63, 548, 19074, 8, 1301, 9, 267, 340, 734, 19074, 26, 288, 943, 14, 815, 360, 3601, 282, 15666, 1478, 436, 18416, 283, 2151, 283, 28703, 652, 2410, 8023, 23193, 2659, 267, 1382, 63, 27323, 275, 663, 8, 1301, 14, 1848, 63, 13982, 14, 1459, 63, 513, 360, 2051, 297, 6829, 29, 549, 430, 267, 1382, 63, 27323, 14, 525, 8, 1301, 14, 344, 9, 267, 862, 26, 288, 1478, 63, 12233, 14, 5814, 8, 513, 8, 1301, 63, 27323, 395, 1453, 63, 1080, 14, 2051, 9, 267, 871, 2186, 26, 288, 943, 14, 705, 360, 5278, 16356, 2120, 3405, 297, 3178, 63, 815, 29, 549, 9, 272, 587, 26, 267, 943, 14, 815, 360, 32390, 17195, 2213, 450, 82, 1830, 12928, 2754, 1478, 297, 326, 1382, 14, 344, 12, 3178, 63, 815, 29, 549, 9, 421, 199, 318, 876, 63, 1807, 63, 2232, 3682, 958, 304, 272, 340, 440, 2202, 14, 654, 63, 31541, 63, 10215, 503, 283, 842, 7, 440, 315, 2074, 26, 267, 372, 339, 687, 1022, 85, 391, 14, 6797, 14, 5054, 492, 625, 1080, 63, 12233, 272, 687, 1275, 992, 492, 5499, 339, 1382, 275, 2074, 459, 842, 418, 272, 1453, 63, 1080, 275, 5499, 14, 1462, 14, 362, 63, 1818, 342, 339, 340, 644, 11545, 5564, 804, 14, 5626, 63, 873, 8, 1301, 304, 267, 625, 1080, 63, 12233, 14, 5814, 779, 1301, 14, 2051, 467, 1453, 63, 1080, 14, 2051, 9, 272, 587, 26, 267, 943, 14, 815, 360, 32390, 17195, 2213, 450, 82, 1830, 12928, 2754, 1478, 297, 326, 1382, 14, 2051, 12, 3178, 63, 815, 29, 549, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Jay-Jay-D/LeanSTP
Algorithm.Framework/Portfolio/MinimumVariancePortfolioOptimizer.py
3
4622
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import numpy as np import pandas as pd from scipy.optimize import minimize ### <summary> ### Provides an implementation of a portfolio optimizer that calculate the optimal weights ### with the weight range from -1 to 1 and minimize the portfolio variance with a target return of 2% ### </summary> class MinimumVariancePortfolioOptimizer: '''Provides an implementation of a portfolio optimizer that calculate the optimal weights with the weight range from -1 to 1 and minimize the portfolio variance with a target return of 2%''' def __init__(self, minimum_weight = -1, maximum_weight = 1, target_return = 0.02): '''Initialize the MinimumVariancePortfolioOptimizer Args: minimum_weight(float): The lower bounds on portfolio weights maximum_weight(float): The upper bounds on portfolio weights target_return(float): The target portfolio return''' self.minimum_weight = minimum_weight self.maximum_weight = maximum_weight self.target_return = target_return def Optimize(self, historicalReturns, expectedReturns = None, covariance = None): ''' Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns args: historicalReturns: Matrix of annualized historical returns where each column represents a security and each row returns for the given date/time (size: K x N). expectedReturns: Array of double with the portfolio annualized expected returns (size: K x 1). covariance: Multi-dimensional array of double with the portfolio covariance of annualized returns (size: K x K). Returns: Array of double with the portfolio weights (size: K x 1) ''' if covariance is None: covariance = historicalReturns.cov() if expectedReturns is None: expectedReturns = historicalReturns.mean() size = historicalReturns.columns.size # K x 1 x0 = np.array(size * [1. / size]) constraints = [ {'type': 'eq', 'fun': lambda weights: self.get_budget_constraint(weights)}, {'type': 'eq', 'fun': lambda weights: self.get_target_constraint(weights, expectedReturns)}] opt = minimize(lambda weights: self.portfolio_variance(weights, covariance), # Objective function x0, # Initial guess bounds = self.get_boundary_conditions(size), # Bounds for variables constraints = constraints, # Constraints definition method='SLSQP') # Optimization method: Sequential Least SQuares Programming return opt['x'] def portfolio_variance(self, weights, covariance): '''Computes the portfolio variance Args: weighs: Portfolio weights covariance: Covariance matrix of historical returns''' variance = np.dot(weights.T, np.dot(covariance, weights)) if variance == 0: raise ValueError(f'MinimumVariancePortfolioOptimizer.portfolio_variance: Volatility cannot be zero. Weights: {weights}') return variance def get_boundary_conditions(self, size): '''Creates the boundary condition for the portfolio weights''' return tuple((self.minimum_weight, self.maximum_weight) for x in range(size)) def get_budget_constraint(self, weights): '''Defines a budget constraint: the sum of the weights equals unity''' return np.sum(weights) - 1 def get_target_constraint(self, weights, expectedReturns): '''Ensure that the portfolio return target a given return''' return np.dot(np.matrix(expectedReturns), np.matrix(weights).T).item() - self.target_return
apache-2.0
[ 172, 120, 124, 3, 7813, 1441, 14657, 14, 11265, 446, 28939, 67, 345, 280, 20135, 11711, 554, 12, 662, 311, 3891, 316, 1010, 15067, 83, 14, 199, 3, 7005, 290, 23823, 530, 12643, 1098, 12580, 373, 18, 14, 16, 14, 1898, 6927, 5843, 867, 8631, 11098, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 199, 504, 7026, 14, 13416, 492, 24720, 199, 199, 5680, 665, 4705, 30, 199, 5680, 21552, 376, 4514, 402, 282, 1844, 27165, 10736, 626, 8671, 314, 22081, 4931, 221, 199, 5680, 543, 314, 5401, 1425, 687, 446, 17, 370, 413, 436, 24720, 314, 1844, 27165, 11773, 543, 282, 1347, 372, 402, 499, 5, 199, 5680, 3068, 4705, 30, 199, 533, 22466, 31805, 4313, 27165, 13946, 26, 272, 1449, 17473, 376, 4514, 402, 282, 1844, 27165, 10736, 626, 8671, 314, 22081, 4931, 5591, 543, 314, 5401, 1425, 687, 446, 17, 370, 413, 436, 24720, 314, 1844, 27165, 11773, 543, 282, 1347, 372, 402, 499, 5, 2344, 272, 347, 636, 826, 721, 277, 12, 20169, 7481, 63, 3463, 275, 446, 17, 12, 20169, 5696, 63, 3463, 275, 413, 12, 326, 1347, 63, 1107, 275, 378, 14, 996, 304, 267, 1449, 9345, 314, 22466, 31805, 4313, 27165, 13946, 267, 3033, 26, 288, 7481, 63, 3463, 8, 1609, 304, 710, 5117, 10461, 641, 1844, 27165, 4931, 288, 5696, 63, 3463, 8, 1609, 304, 710, 7008, 10461, 641, 1844, 27165, 4931, 288, 1347, 63, 1107, 8, 1609, 304, 710, 1347, 1844, 27165, 372, 2344, 267, 291, 14, 10700, 63, 3463, 275, 7481, 63, 3463, 267, 291, 14, 11555, 63, 3463, 275, 5696, 63, 3463, 267, 291, 14, 1375, 63, 1107, 275, 1347, 63, 1107, 339, 347, 19246, 794, 8, 277, 12, 32530, 3407, 12, 1420, 3407, 275, 488, 12, 13263, 275, 488, 304, 267, 1449, 267, 14795, 1844, 27165, 13712, 367, 282, 2741, 3634, 402, 32530, 2529, 436, 376, 1625, 402, 1420, 2529, 267, 1249, 26, 288, 32530, 3407, 26, 8449, 402, 21172, 1061, 1759, 32530, 2529, 2382, 1924, 2763, 8469, 282, 6391, 436, 1924, 1962, 2529, 367, 314, 1627, 1434, 15, 521, 334, 890, 26, 1804, 671, 653, 680, 288, 1420, 3407, 26, 8725, 402, 4270, 543, 314, 1844, 27165, 21172, 1061, 1759, 1420, 2529, 334, 890, 26, 1804, 671, 413, 680, 288, 13263, 26, 6879, 13, 13014, 1625, 402, 4270, 543, 314, 1844, 27165, 13263, 402, 21172, 1061, 1759, 2529, 334, 890, 26, 1804, 671, 1804, 680, 267, 1803, 26, 288, 8725, 402, 4270, 543, 314, 1844, 27165, 4931, 334, 890, 26, 1804, 671, 413, 9, 267, 1449, 267, 340, 13263, 365, 488, 26, 288, 13263, 275, 32530, 3407, 14, 8695, 342, 267, 340, 1420, 3407, 365, 488, 26, 288, 1420, 3407, 275, 32530, 3407, 14, 3670, 342, 398, 1568, 275, 32530, 3407, 14, 3406, 14, 890, 257, 327, 1804, 671, 413, 267, 671, 16, 275, 980, 14, 1144, 8, 890, 627, 359, 17, 14, 1182, 1568, 566, 398, 9565, 275, 359, 288, 791, 466, 356, 283, 4077, 297, 283, 7036, 356, 2400, 4931, 26, 291, 14, 362, 63, 16501, 63, 5631, 8, 4916, 16658, 288, 791, 466, 356, 283, 4077, 297, 283, 7036, 356, 2400, 4931, 26, 291, 14, 362, 63, 1375, 63, 5631, 8, 4916, 12, 1420, 3407, 6769, 61, 398, 2450, 275, 24720, 8, 2734, 4931, 26, 291, 14, 719, 27165, 63, 6221, 8, 4916, 12, 13263, 395, 258, 327, 24921, 6850, 805, 2432, 671, 16, 12, 2476, 12788, 327, 6026, 9519, 2432, 10461, 275, 291, 14, 362, 63, 9891, 63, 9855, 8, 890, 395, 5185, 327, 21972, 83, 367, 2860, 2432, 9565, 275, 9565, 12, 2476, 327, 25889, 83, 5492, 2432, 1083, 534, 4929, 18445, 48, 358, 263, 327, 19246, 2072, 1083, 26, 221, 3240, 9092, 7005, 1810, 428, 49, 1458, 470, 2165, 9258, 267, 372, 2450, 459, 88, 418, 339, 347, 1844, 27165, 63, 6221, 8, 277, 12, 4931, 12, 13263, 304, 267, 1449, 22594, 314, 1844, 27165, 11773, 267, 3033, 26, 288, 781, 2056, 83, 26, 10977, 27165, 4931, 288, 13263, 26, 1849, 6221, 3634, 402, 32530, 2529, 2344, 267, 11773, 275, 980, 14, 3287, 8, 4916, 14, 52, 12, 980, 14, 3287, 8, 15024, 12, 4931, 430, 267, 340, 11773, 508, 378, 26, 288, 746, 1722, 8, 70, 7, 12092, 31805, 4313, 27165, 13946, 14, 719, 27165, 63, 6221, 26, 28367, 3913, 506, 4697, 14, 2136, 2492, 26, 469, 4916, 12216, 267, 372, 11773, 339, 347, 664, 63, 9891, 63, 9855, 8, 277, 12, 1568, 304, 267, 1449, 10607, 314, 8424, 5558, 367, 314, 1844, 27165, 4931, 2344, 267, 372, 2008, 1332, 277, 14, 10700, 63, 3463, 12, 291, 14, 11555, 63, 3463, 9, 367, 671, 315, 1425, 8, 890, 430, 339, 347, 664, 63, 16501, 63, 5631, 8, 277, 12, 4931, 304, 267, 1449, 23891, 282, 1032, 14080, 5828, 26, 314, 3089, 402, 314, 4931, 18527, 625, 1209, 2344, 267, 372, 980, 14, 1838, 8, 4916, 9, 446, 413, 339, 347, 664, 63, 1375, 63, 5631, 8, 277, 12, 4931, 12, 1420, 3407, 304, 267, 1449, 13913, 626, 314, 1844, 27165, 372, 1347, 282, 1627, 372, 2344, 267, 372, 980, 14, 3287, 8, 1590, 14, 3642, 8, 2062, 3407, 395, 980, 14, 3642, 8, 4916, 680, 52, 680, 1053, 342, 446, 291, 14, 1375, 63, 1107, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 120, 124, 3, 7813, 1441, 14657, 14, 11265, 446, 28939, 67, 345, 280, 20135, 11711, 554, 12, 662, 311, 3891, 316, 1010, 15067, 83, 14, 199, 3, 7005, 290, 23823, 530, 12643, 1098, 12580, 373, 18, 14, 16, 14, 1898, 6927, 5843, 867, 8631, 11098, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 199, 504, 7026, 14, 13416, 492, 24720, 199, 199, 5680, 665, 4705, 30, 199, 5680, 21552, 376, 4514, 402, 282, 1844, 27165, 10736, 626, 8671, 314, 22081, 4931, 221, 199, 5680, 543, 314, 5401, 1425, 687, 446, 17, 370, 413, 436, 24720, 314, 1844, 27165, 11773, 543, 282, 1347, 372, 402, 499, 5, 199, 5680, 3068, 4705, 30, 199, 533, 22466, 31805, 4313, 27165, 13946, 26, 272, 1449, 17473, 376, 4514, 402, 282, 1844, 27165, 10736, 626, 8671, 314, 22081, 4931, 5591, 543, 314, 5401, 1425, 687, 446, 17, 370, 413, 436, 24720, 314, 1844, 27165, 11773, 543, 282, 1347, 372, 402, 499, 5, 2344, 272, 347, 636, 826, 721, 277, 12, 20169, 7481, 63, 3463, 275, 446, 17, 12, 20169, 5696, 63, 3463, 275, 413, 12, 326, 1347, 63, 1107, 275, 378, 14, 996, 304, 267, 1449, 9345, 314, 22466, 31805, 4313, 27165, 13946, 267, 3033, 26, 288, 7481, 63, 3463, 8, 1609, 304, 710, 5117, 10461, 641, 1844, 27165, 4931, 288, 5696, 63, 3463, 8, 1609, 304, 710, 7008, 10461, 641, 1844, 27165, 4931, 288, 1347, 63, 1107, 8, 1609, 304, 710, 1347, 1844, 27165, 372, 2344, 267, 291, 14, 10700, 63, 3463, 275, 7481, 63, 3463, 267, 291, 14, 11555, 63, 3463, 275, 5696, 63, 3463, 267, 291, 14, 1375, 63, 1107, 275, 1347, 63, 1107, 339, 347, 19246, 794, 8, 277, 12, 32530, 3407, 12, 1420, 3407, 275, 488, 12, 13263, 275, 488, 304, 267, 1449, 267, 14795, 1844, 27165, 13712, 367, 282, 2741, 3634, 402, 32530, 2529, 436, 376, 1625, 402, 1420, 2529, 267, 1249, 26, 288, 32530, 3407, 26, 8449, 402, 21172, 1061, 1759, 32530, 2529, 2382, 1924, 2763, 8469, 282, 6391, 436, 1924, 1962, 2529, 367, 314, 1627, 1434, 15, 521, 334, 890, 26, 1804, 671, 653, 680, 288, 1420, 3407, 26, 8725, 402, 4270, 543, 314, 1844, 27165, 21172, 1061, 1759, 1420, 2529, 334, 890, 26, 1804, 671, 413, 680, 288, 13263, 26, 6879, 13, 13014, 1625, 402, 4270, 543, 314, 1844, 27165, 13263, 402, 21172, 1061, 1759, 2529, 334, 890, 26, 1804, 671, 1804, 680, 267, 1803, 26, 288, 8725, 402, 4270, 543, 314, 1844, 27165, 4931, 334, 890, 26, 1804, 671, 413, 9, 267, 1449, 267, 340, 13263, 365, 488, 26, 288, 13263, 275, 32530, 3407, 14, 8695, 342, 267, 340, 1420, 3407, 365, 488, 26, 288, 1420, 3407, 275, 32530, 3407, 14, 3670, 342, 398, 1568, 275, 32530, 3407, 14, 3406, 14, 890, 257, 327, 1804, 671, 413, 267, 671, 16, 275, 980, 14, 1144, 8, 890, 627, 359, 17, 14, 1182, 1568, 566, 398, 9565, 275, 359, 288, 791, 466, 356, 283, 4077, 297, 283, 7036, 356, 2400, 4931, 26, 291, 14, 362, 63, 16501, 63, 5631, 8, 4916, 16658, 288, 791, 466, 356, 283, 4077, 297, 283, 7036, 356, 2400, 4931, 26, 291, 14, 362, 63, 1375, 63, 5631, 8, 4916, 12, 1420, 3407, 6769, 61, 398, 2450, 275, 24720, 8, 2734, 4931, 26, 291, 14, 719, 27165, 63, 6221, 8, 4916, 12, 13263, 395, 258, 327, 24921, 6850, 805, 2432, 671, 16, 12, 2476, 12788, 327, 6026, 9519, 2432, 10461, 275, 291, 14, 362, 63, 9891, 63, 9855, 8, 890, 395, 5185, 327, 21972, 83, 367, 2860, 2432, 9565, 275, 9565, 12, 2476, 327, 25889, 83, 5492, 2432, 1083, 534, 4929, 18445, 48, 358, 263, 327, 19246, 2072, 1083, 26, 221, 3240, 9092, 7005, 1810, 428, 49, 1458, 470, 2165, 9258, 267, 372, 2450, 459, 88, 418, 339, 347, 1844, 27165, 63, 6221, 8, 277, 12, 4931, 12, 13263, 304, 267, 1449, 22594, 314, 1844, 27165, 11773, 267, 3033, 26, 288, 781, 2056, 83, 26, 10977, 27165, 4931, 288, 13263, 26, 1849, 6221, 3634, 402, 32530, 2529, 2344, 267, 11773, 275, 980, 14, 3287, 8, 4916, 14, 52, 12, 980, 14, 3287, 8, 15024, 12, 4931, 430, 267, 340, 11773, 508, 378, 26, 288, 746, 1722, 8, 70, 7, 12092, 31805, 4313, 27165, 13946, 14, 719, 27165, 63, 6221, 26, 28367, 3913, 506, 4697, 14, 2136, 2492, 26, 469, 4916, 12216, 267, 372, 11773, 339, 347, 664, 63, 9891, 63, 9855, 8, 277, 12, 1568, 304, 267, 1449, 10607, 314, 8424, 5558, 367, 314, 1844, 27165, 4931, 2344, 267, 372, 2008, 1332, 277, 14, 10700, 63, 3463, 12, 291, 14, 11555, 63, 3463, 9, 367, 671, 315, 1425, 8, 890, 430, 339, 347, 664, 63, 16501, 63, 5631, 8, 277, 12, 4931, 304, 267, 1449, 23891, 282, 1032, 14080, 5828, 26, 314, 3089, 402, 314, 4931, 18527, 625, 1209, 2344, 267, 372, 980, 14, 1838, 8, 4916, 9, 446, 413, 339, 347, 664, 63, 1375, 63, 5631, 8, 277, 12, 4931, 12, 1420, 3407, 304, 267, 1449, 13913, 626, 314, 1844, 27165, 372, 1347, 282, 1627, 372, 2344, 267, 372, 980, 14, 3287, 8, 1590, 14, 3642, 8, 2062, 3407, 395, 980, 14, 3642, 8, 4916, 680, 52, 680, 1053, 342, 446, 291,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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
pannal/Subliminal.bundle
Contents/Code/support/lib.py
2
1469
# coding=utf-8 import plex from subzero.intent import TempIntent from subzero.lib.dict import DictProxy from subzero.lib.httpfake import PlexPyNativeResponseProxy from subzero.constants import DEFAULT_TIMEOUT class PlexPyNativeRequestProxy(object): """ A really dumb object that tries to mimic requests.Request in an incomplete way, so that plex.Plex uses native plex HTTPRequests instead of the better requests.Request class. This allows us to operate freely on 127.0.0.1's PMS. To be used in conjunction with subzero.lib.httpfake.PlexPyNativeResponseProxy """ url = None data = None headers = None method = None def prepare(self): return self def send(self): # fixme: add self.data to HTTP.Request data = None status_code = 200 try: data = HTTP.Request(self.url, headers=self.headers, immediate=True, method=self.method, timeout=DEFAULT_TIMEOUT) except Ex.HTTPError as e: status_code = e.code return PlexPyNativeResponseProxy(data, status_code, self) plex.request.Request = PlexPyNativeRequestProxy Plex = plex.Plex class IntentDictStorage(DictProxy): store = "intent" def setup_defaults(self): return {"force": {}} def get_intent(): """ use this to get an intent from inside a separate thread :return: """ return TempIntent(store=IntentDictStorage(Dict))
mit
[ 3, 2803, 29, 1624, 13, 24, 199, 199, 646, 299, 3113, 199, 504, 1007, 4262, 14, 17456, 492, 12540, 607, 767, 199, 504, 1007, 4262, 14, 773, 14, 807, 492, 7448, 4936, 199, 504, 1007, 4262, 14, 773, 14, 1014, 3183, 492, 510, 3113, 2713, 19675, 2364, 4936, 199, 504, 1007, 4262, 14, 5559, 492, 6186, 63, 8899, 421, 199, 533, 510, 3113, 2713, 19675, 2017, 4936, 8, 785, 304, 272, 408, 272, 437, 7710, 32490, 909, 626, 11275, 370, 24102, 530, 4145, 14, 2017, 315, 376, 17110, 4340, 12, 880, 626, 299, 3113, 14, 48, 3113, 272, 4440, 5438, 299, 3113, 3101, 16272, 3140, 402, 314, 8034, 4145, 14, 2017, 1021, 14, 339, 961, 6127, 2739, 370, 19218, 20673, 7742, 641, 12792, 14, 16, 14, 16, 14, 17, 1159, 510, 3053, 14, 339, 4005, 506, 1202, 315, 22888, 543, 1007, 4262, 14, 773, 14, 1014, 3183, 14, 48, 3113, 2713, 19675, 2364, 4936, 272, 408, 272, 1166, 275, 488, 272, 666, 275, 488, 272, 2323, 275, 488, 272, 1083, 275, 488, 339, 347, 9275, 8, 277, 304, 267, 372, 291, 339, 347, 3222, 8, 277, 304, 267, 327, 5325, 278, 26, 1050, 291, 14, 576, 370, 3101, 14, 2017, 267, 666, 275, 488, 267, 2004, 63, 600, 275, 1926, 267, 862, 26, 288, 666, 275, 3101, 14, 2017, 8, 277, 14, 633, 12, 2323, 29, 277, 14, 2139, 12, 8569, 29, 549, 12, 1083, 29, 277, 14, 765, 12, 1816, 2653, 29, 3472, 63, 8899, 9, 267, 871, 1316, 14, 12815, 465, 325, 26, 288, 2004, 63, 600, 275, 325, 14, 600, 267, 372, 510, 3113, 2713, 19675, 2364, 4936, 8, 576, 12, 2004, 63, 600, 12, 291, 9, 421, 199, 22198, 14, 1069, 14, 2017, 275, 510, 3113, 2713, 19675, 2017, 4936, 199, 199, 48, 3113, 275, 299, 3113, 14, 48, 3113, 421, 199, 533, 1010, 767, 2141, 6408, 8, 2141, 4936, 304, 272, 3877, 275, 298, 17456, 2, 339, 347, 3272, 63, 4322, 8, 277, 304, 267, 372, 2420, 3990, 582, 24312, 421, 199, 318, 664, 63, 17456, 837, 272, 408, 272, 675, 642, 370, 664, 376, 21020, 687, 6272, 282, 7396, 2462, 272, 520, 1107, 26, 272, 408, 272, 372, 12540, 607, 767, 8, 1617, 29, 607, 767, 2141, 6408, 8, 2141, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2803, 29, 1624, 13, 24, 199, 199, 646, 299, 3113, 199, 504, 1007, 4262, 14, 17456, 492, 12540, 607, 767, 199, 504, 1007, 4262, 14, 773, 14, 807, 492, 7448, 4936, 199, 504, 1007, 4262, 14, 773, 14, 1014, 3183, 492, 510, 3113, 2713, 19675, 2364, 4936, 199, 504, 1007, 4262, 14, 5559, 492, 6186, 63, 8899, 421, 199, 533, 510, 3113, 2713, 19675, 2017, 4936, 8, 785, 304, 272, 408, 272, 437, 7710, 32490, 909, 626, 11275, 370, 24102, 530, 4145, 14, 2017, 315, 376, 17110, 4340, 12, 880, 626, 299, 3113, 14, 48, 3113, 272, 4440, 5438, 299, 3113, 3101, 16272, 3140, 402, 314, 8034, 4145, 14, 2017, 1021, 14, 339, 961, 6127, 2739, 370, 19218, 20673, 7742, 641, 12792, 14, 16, 14, 16, 14, 17, 1159, 510, 3053, 14, 339, 4005, 506, 1202, 315, 22888, 543, 1007, 4262, 14, 773, 14, 1014, 3183, 14, 48, 3113, 2713, 19675, 2364, 4936, 272, 408, 272, 1166, 275, 488, 272, 666, 275, 488, 272, 2323, 275, 488, 272, 1083, 275, 488, 339, 347, 9275, 8, 277, 304, 267, 372, 291, 339, 347, 3222, 8, 277, 304, 267, 327, 5325, 278, 26, 1050, 291, 14, 576, 370, 3101, 14, 2017, 267, 666, 275, 488, 267, 2004, 63, 600, 275, 1926, 267, 862, 26, 288, 666, 275, 3101, 14, 2017, 8, 277, 14, 633, 12, 2323, 29, 277, 14, 2139, 12, 8569, 29, 549, 12, 1083, 29, 277, 14, 765, 12, 1816, 2653, 29, 3472, 63, 8899, 9, 267, 871, 1316, 14, 12815, 465, 325, 26, 288, 2004, 63, 600, 275, 325, 14, 600, 267, 372, 510, 3113, 2713, 19675, 2364, 4936, 8, 576, 12, 2004, 63, 600, 12, 291, 9, 421, 199, 22198, 14, 1069, 14, 2017, 275, 510, 3113, 2713, 19675, 2017, 4936, 199, 199, 48, 3113, 275, 299, 3113, 14, 48, 3113, 421, 199, 533, 1010, 767, 2141, 6408, 8, 2141, 4936, 304, 272, 3877, 275, 298, 17456, 2, 339, 347, 3272, 63, 4322, 8, 277, 304, 267, 372, 2420, 3990, 582, 24312, 421, 199, 318, 664, 63, 17456, 837, 272, 408, 272, 675, 642, 370, 664, 376, 21020, 687, 6272, 282, 7396, 2462, 272, 520, 1107, 26, 272, 408, 272, 372, 12540, 607, 767, 8, 1617, 29, 607, 767, 2141, 6408, 8, 2141, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ging/horizon
openstack_dashboard/dashboards/identity/users/views.py
4
5893
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import operator from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.decorators import method_decorator # noqa from django.utils.translation import ugettext_lazy as _ from django.views.decorators.debug import sensitive_post_parameters # noqa from horizon import exceptions from horizon import forms from horizon import messages from horizon import tables from horizon.utils import memoized from openstack_dashboard import api from openstack_dashboard import policy from openstack_dashboard.dashboards.identity.users \ import forms as project_forms from openstack_dashboard.dashboards.identity.users \ import tables as project_tables class IndexView(tables.DataTableView): table_class = project_tables.UsersTable template_name = 'identity/users/index.html' def get_data(self): users = [] domain_context = self.request.session.get('domain_context', None) if policy.check((("identity", "identity:list_users"),), self.request): try: users = api.keystone.user_list(self.request, domain=domain_context) except Exception: exceptions.handle(self.request, _('Unable to retrieve user list.')) elif policy.check((("identity", "identity:get_user"),), self.request): try: user = api.keystone.user_get(self.request, self.request.user.id) users.append(user) except Exception: exceptions.handle(self.request, _('Unable to retrieve user information.')) else: msg = _("Insufficient privilege level to view user information.") messages.info(self.request, msg) return users class UpdateView(forms.ModalFormView): form_class = project_forms.UpdateUserForm template_name = 'identity/users/update.html' success_url = reverse_lazy('horizon:identity:users:index') @method_decorator(sensitive_post_parameters('password', 'confirm_password')) def dispatch(self, *args, **kwargs): return super(UpdateView, self).dispatch(*args, **kwargs) @memoized.memoized_method def get_object(self): try: return api.keystone.user_get(self.request, self.kwargs['user_id'], admin=True) except Exception: redirect = reverse("horizon:identity:users:index") exceptions.handle(self.request, _('Unable to update user.'), redirect=redirect) def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['user'] = self.get_object() return context def get_initial(self): user = self.get_object() domain_id = getattr(user, "domain_id", None) domain_name = '' # Retrieve the domain name where the project belong if api.keystone.VERSIONS.active >= 3: try: domain = api.keystone.domain_get(self.request, domain_id) domain_name = domain.name except Exception: exceptions.handle(self.request, _('Unable to retrieve project domain.')) return {'domain_id': domain_id, 'domain_name': domain_name, 'id': user.id, 'name': user.name, 'project': user.project_id, 'email': getattr(user, 'email', None)} class CreateView(forms.ModalFormView): form_class = project_forms.CreateUserForm template_name = 'identity/users/create.html' success_url = reverse_lazy('horizon:identity:users:index') @method_decorator(sensitive_post_parameters('password', 'confirm_password')) def dispatch(self, *args, **kwargs): return super(CreateView, self).dispatch(*args, **kwargs) def get_form_kwargs(self): kwargs = super(CreateView, self).get_form_kwargs() try: roles = api.keystone.role_list(self.request) except Exception: redirect = reverse("horizon:identity:users:index") exceptions.handle(self.request, _("Unable to retrieve user roles."), redirect=redirect) roles.sort(key=operator.attrgetter("id")) kwargs['roles'] = roles return kwargs def get_initial(self): # Set the domain of the user domain = api.keystone.get_default_domain(self.request) default_role = api.keystone.get_default_role(self.request) return {'domain_id': domain.id, 'domain_name': domain.name, 'role_id': getattr(default_role, "id", None)}
apache-2.0
[ 3, 1898, 6029, 1910, 5703, 24230, 598, 27639, 465, 11159, 701, 314, 199, 3, 30660, 402, 314, 20548, 437, 281, 265, 3844, 7769, 436, 19326, 9516, 4633, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 1898, 6029, 653, 2871, 7586, 12, 3277, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 4182, 199, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 63, 6395, 199, 504, 1639, 14, 1208, 14, 11582, 492, 1083, 63, 11547, 221, 327, 8151, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1757, 492, 18423, 63, 1932, 63, 3214, 221, 327, 8151, 199, 199, 504, 21726, 492, 4967, 199, 504, 21726, 492, 4513, 199, 504, 21726, 492, 3788, 199, 504, 21726, 492, 6716, 199, 504, 21726, 14, 1208, 492, 11955, 1759, 199, 199, 504, 13869, 63, 9743, 492, 2986, 199, 504, 13869, 63, 9743, 492, 4592, 199, 199, 504, 13869, 63, 9743, 14, 30424, 14, 5582, 14, 3707, 971, 272, 492, 4513, 465, 2199, 63, 3351, 199, 504, 13869, 63, 9743, 14, 30424, 14, 5582, 14, 3707, 971, 272, 492, 6716, 465, 2199, 63, 5987, 421, 199, 533, 5499, 2768, 8, 5987, 14, 1451, 3186, 2768, 304, 272, 1817, 63, 533, 275, 2199, 63, 5987, 14, 12117, 3186, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 1080, 14, 1360, 7, 339, 347, 664, 63, 576, 8, 277, 304, 267, 4390, 275, 942, 267, 2881, 63, 1100, 275, 291, 14, 1069, 14, 1730, 14, 362, 360, 2261, 63, 1100, 297, 488, 9, 267, 340, 4592, 14, 1074, 1332, 480, 5582, 401, 298, 5582, 26, 513, 63, 3707, 1288, 395, 717, 291, 14, 1069, 304, 288, 862, 26, 355, 4390, 275, 2986, 14, 19143, 14, 751, 63, 513, 8, 277, 14, 1069, 12, 6901, 2881, 29, 2261, 63, 1100, 9, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 922, 769, 12459, 267, 916, 4592, 14, 1074, 1332, 480, 5582, 401, 298, 5582, 26, 362, 63, 751, 1288, 395, 2079, 291, 14, 1069, 304, 288, 862, 26, 355, 922, 275, 2986, 14, 19143, 14, 751, 63, 362, 8, 277, 14, 1069, 12, 6163, 291, 14, 1069, 14, 751, 14, 344, 9, 355, 4390, 14, 740, 8, 751, 9, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 922, 2556, 12459, 267, 587, 26, 288, 1499, 275, 3824, 13962, 12983, 1979, 17228, 2166, 370, 2455, 922, 2556, 2685, 288, 3788, 14, 815, 8, 277, 14, 1069, 12, 1499, 9, 267, 372, 4390, 421, 199, 533, 6162, 2768, 8, 3351, 14, 23689, 2821, 2768, 304, 272, 1824, 63, 533, 275, 2199, 63, 3351, 14, 4152, 1899, 2821, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 873, 14, 1360, 7, 272, 3182, 63, 633, 275, 3837, 63, 6395, 360, 16561, 26, 5582, 26, 3707, 26, 1080, 358, 339, 768, 765, 63, 11547, 8, 7361, 63, 1932, 63, 3214, 360, 2060, 297, 6059, 283, 9548, 63, 2060, 1333, 272, 347, 7634, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 1613, 8, 4152, 2768, 12, 291, 680, 6052, 2031, 589, 12, 1011, 958, 9, 339, 768, 20457, 14, 20457, 63, 765, 272, 347, 664, 63, 785, 8, 277, 304, 267, 862, 26, 288, 372, 2986, 14, 19143, 14, 751, 63, 362, 8, 277, 14, 1069, 12, 291, 14, 958, 459, 751, 63, 344, 995, 1460, 4628, 29, 549, 9, 267, 871, 2186, 26, 288, 4660, 275, 3837, 480, 16561, 26, 5582, 26, 3707, 26, 1080, 531, 288, 4967, 14, 2479, 8, 277, 14, 1069, 12, 2892, 4018, 6005, 370, 1678, 922, 8038, 2892, 4660, 29, 4876, 9, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 1067, 275, 1613, 8, 4152, 2768, 12, 291, 680, 362, 63, 1100, 63, 576, 3682, 958, 9, 267, 1067, 459, 751, 418, 275, 291, 14, 362, 63, 785, 342, 267, 372, 1067, 339, 347, 664, 63, 2747, 8, 277, 304, 267, 922, 275, 291, 14, 362, 63, 785, 342, 267, 2881, 63, 344, 275, 2519, 8, 751, 12, 298, 2261, 63, 344, 401, 488, 9, 267, 2881, 63, 354, 275, 2125, 267, 327, 13939, 314, 2881, 536, 2382, 314, 2199, 13511, 267, 340, 2986, 14, 19143, 14, 26358, 14, 2682, 2356, 650, 26, 288, 862, 26, 355, 2881, 275, 2986, 14, 19143, 14, 2261, 63, 362, 8, 277, 14, 1069, 12, 1740, 2881, 63, 344, 9, 355, 2881, 63, 354, 275, 2881, 14, 354, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 2199, 2881, 12459, 267, 372, 791, 2261, 63, 344, 356, 2881, 63, 344, 12, 355, 283, 2261, 63, 354, 356, 2881, 63, 354, 12, 355, 283, 344, 356, 922, 14, 344, 12, 355, 283, 354, 356, 922, 14, 354, 12, 355, 283, 1715, 356, 922, 14, 1715, 63, 344, 12, 355, 283, 2123, 356, 2519, 8, 751, 12, 283, 2123, 297, 488, 6769, 421, 199, 533, 2790, 2768, 8, 3351, 14, 23689, 2821, 2768, 304, 272, 1824, 63, 533, 275, 2199, 63, 3351, 14, 2499, 1899, 2821, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 981, 14, 1360 ]
[ 1898, 6029, 1910, 5703, 24230, 598, 27639, 465, 11159, 701, 314, 199, 3, 30660, 402, 314, 20548, 437, 281, 265, 3844, 7769, 436, 19326, 9516, 4633, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 1898, 6029, 653, 2871, 7586, 12, 3277, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 4182, 199, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 63, 6395, 199, 504, 1639, 14, 1208, 14, 11582, 492, 1083, 63, 11547, 221, 327, 8151, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1757, 492, 18423, 63, 1932, 63, 3214, 221, 327, 8151, 199, 199, 504, 21726, 492, 4967, 199, 504, 21726, 492, 4513, 199, 504, 21726, 492, 3788, 199, 504, 21726, 492, 6716, 199, 504, 21726, 14, 1208, 492, 11955, 1759, 199, 199, 504, 13869, 63, 9743, 492, 2986, 199, 504, 13869, 63, 9743, 492, 4592, 199, 199, 504, 13869, 63, 9743, 14, 30424, 14, 5582, 14, 3707, 971, 272, 492, 4513, 465, 2199, 63, 3351, 199, 504, 13869, 63, 9743, 14, 30424, 14, 5582, 14, 3707, 971, 272, 492, 6716, 465, 2199, 63, 5987, 421, 199, 533, 5499, 2768, 8, 5987, 14, 1451, 3186, 2768, 304, 272, 1817, 63, 533, 275, 2199, 63, 5987, 14, 12117, 3186, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 1080, 14, 1360, 7, 339, 347, 664, 63, 576, 8, 277, 304, 267, 4390, 275, 942, 267, 2881, 63, 1100, 275, 291, 14, 1069, 14, 1730, 14, 362, 360, 2261, 63, 1100, 297, 488, 9, 267, 340, 4592, 14, 1074, 1332, 480, 5582, 401, 298, 5582, 26, 513, 63, 3707, 1288, 395, 717, 291, 14, 1069, 304, 288, 862, 26, 355, 4390, 275, 2986, 14, 19143, 14, 751, 63, 513, 8, 277, 14, 1069, 12, 6901, 2881, 29, 2261, 63, 1100, 9, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 922, 769, 12459, 267, 916, 4592, 14, 1074, 1332, 480, 5582, 401, 298, 5582, 26, 362, 63, 751, 1288, 395, 2079, 291, 14, 1069, 304, 288, 862, 26, 355, 922, 275, 2986, 14, 19143, 14, 751, 63, 362, 8, 277, 14, 1069, 12, 6163, 291, 14, 1069, 14, 751, 14, 344, 9, 355, 4390, 14, 740, 8, 751, 9, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 922, 2556, 12459, 267, 587, 26, 288, 1499, 275, 3824, 13962, 12983, 1979, 17228, 2166, 370, 2455, 922, 2556, 2685, 288, 3788, 14, 815, 8, 277, 14, 1069, 12, 1499, 9, 267, 372, 4390, 421, 199, 533, 6162, 2768, 8, 3351, 14, 23689, 2821, 2768, 304, 272, 1824, 63, 533, 275, 2199, 63, 3351, 14, 4152, 1899, 2821, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 873, 14, 1360, 7, 272, 3182, 63, 633, 275, 3837, 63, 6395, 360, 16561, 26, 5582, 26, 3707, 26, 1080, 358, 339, 768, 765, 63, 11547, 8, 7361, 63, 1932, 63, 3214, 360, 2060, 297, 6059, 283, 9548, 63, 2060, 1333, 272, 347, 7634, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 1613, 8, 4152, 2768, 12, 291, 680, 6052, 2031, 589, 12, 1011, 958, 9, 339, 768, 20457, 14, 20457, 63, 765, 272, 347, 664, 63, 785, 8, 277, 304, 267, 862, 26, 288, 372, 2986, 14, 19143, 14, 751, 63, 362, 8, 277, 14, 1069, 12, 291, 14, 958, 459, 751, 63, 344, 995, 1460, 4628, 29, 549, 9, 267, 871, 2186, 26, 288, 4660, 275, 3837, 480, 16561, 26, 5582, 26, 3707, 26, 1080, 531, 288, 4967, 14, 2479, 8, 277, 14, 1069, 12, 2892, 4018, 6005, 370, 1678, 922, 8038, 2892, 4660, 29, 4876, 9, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 1067, 275, 1613, 8, 4152, 2768, 12, 291, 680, 362, 63, 1100, 63, 576, 3682, 958, 9, 267, 1067, 459, 751, 418, 275, 291, 14, 362, 63, 785, 342, 267, 372, 1067, 339, 347, 664, 63, 2747, 8, 277, 304, 267, 922, 275, 291, 14, 362, 63, 785, 342, 267, 2881, 63, 344, 275, 2519, 8, 751, 12, 298, 2261, 63, 344, 401, 488, 9, 267, 2881, 63, 354, 275, 2125, 267, 327, 13939, 314, 2881, 536, 2382, 314, 2199, 13511, 267, 340, 2986, 14, 19143, 14, 26358, 14, 2682, 2356, 650, 26, 288, 862, 26, 355, 2881, 275, 2986, 14, 19143, 14, 2261, 63, 362, 8, 277, 14, 1069, 12, 1740, 2881, 63, 344, 9, 355, 2881, 63, 354, 275, 2881, 14, 354, 288, 871, 2186, 26, 355, 4967, 14, 2479, 8, 277, 14, 1069, 12, 3303, 4018, 6005, 370, 8044, 2199, 2881, 12459, 267, 372, 791, 2261, 63, 344, 356, 2881, 63, 344, 12, 355, 283, 2261, 63, 354, 356, 2881, 63, 354, 12, 355, 283, 344, 356, 922, 14, 344, 12, 355, 283, 354, 356, 922, 14, 354, 12, 355, 283, 1715, 356, 922, 14, 1715, 63, 344, 12, 355, 283, 2123, 356, 2519, 8, 751, 12, 283, 2123, 297, 488, 6769, 421, 199, 533, 2790, 2768, 8, 3351, 14, 23689, 2821, 2768, 304, 272, 1824, 63, 533, 275, 2199, 63, 3351, 14, 2499, 1899, 2821, 272, 1978, 63, 354, 275, 283, 5582, 15, 3707, 15, 981, 14, 1360, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
shravya-ks/ECN-ns3
src/fd-net-device/bindings/modulegen__gcc_LP64.py
1
326067
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) return True pybindgen.settings.error_handler = ErrorHandler() import sys def module_init(): root_module = Module('ns.fd_net_device', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## address.h (module 'network'): ns3::Address [class] module.add_class('Address', import_from_module='ns.network') ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network') ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper [class] module.add_class('AsciiTraceHelper', import_from_module='ns.network') ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice [class] module.add_class('AsciiTraceHelperForDevice', allow_subclassing=True, import_from_module='ns.network') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class] module.add_class('AttributeConstructionList', import_from_module='ns.core') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct] module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList']) ## buffer.h (module 'network'): ns3::Buffer [class] module.add_class('Buffer', import_from_module='ns.network') ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer']) ## packet.h (module 'network'): ns3::ByteTagIterator [class] module.add_class('ByteTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] module.add_class('ByteTagList', import_from_module='ns.network') ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator']) ## callback.h (module 'core'): ns3::CallbackBase [class] module.add_class('CallbackBase', import_from_module='ns.core') ## system-mutex.h (module 'core'): ns3::CriticalSection [class] module.add_class('CriticalSection', import_from_module='ns.core') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate', import_from_module='ns.network') ## event-id.h (module 'core'): ns3::EventId [class] module.add_class('EventId', import_from_module='ns.core') ## hash.h (module 'core'): ns3::Hasher [class] module.add_class('Hasher', import_from_module='ns.core') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] module.add_class('Ipv4Address', import_from_module='ns.network') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class] module.add_class('Ipv4Mask', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] module.add_class('Ipv6Address', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class] module.add_class('Ipv6Prefix', import_from_module='ns.network') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] module.add_class('Mac48Address', import_from_module='ns.network') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address']) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class] module.add_class('NetDeviceContainer', import_from_module='ns.network') ## node-container.h (module 'network'): ns3::NodeContainer [class] module.add_class('NodeContainer', import_from_module='ns.network') ## object-base.h (module 'core'): ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') ## object.h (module 'core'): ns3::ObjectDeleter [struct] module.add_class('ObjectDeleter', import_from_module='ns.core') ## object-factory.h (module 'core'): ns3::ObjectFactory [class] module.add_class('ObjectFactory', import_from_module='ns.core') ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] module.add_class('PacketMetadata', import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class] module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet.h (module 'network'): ns3::PacketTagIterator [class] module.add_class('PacketTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class] module.add_class('PacketTagList', import_from_module='ns.network') ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct] module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration] module.add_enum('TagData_e', ['MAX_SIZE'], outer_class=root_module['ns3::PacketTagList::TagData'], import_from_module='ns.network') ## pcap-file.h (module 'network'): ns3::PcapFile [class] module.add_class('PcapFile', import_from_module='ns.network') ## trace-helper.h (module 'network'): ns3::PcapHelper [class] module.add_class('PcapHelper', import_from_module='ns.network') ## trace-helper.h (module 'network'): ns3::PcapHelper::DataLinkType [enumeration] module.add_enum('DataLinkType', ['DLT_NULL', 'DLT_EN10MB', 'DLT_PPP', 'DLT_RAW', 'DLT_IEEE802_11', 'DLT_LINUX_SLL', 'DLT_PRISM_HEADER', 'DLT_IEEE802_11_RADIO', 'DLT_IEEE802_15_4', 'DLT_NETLINK'], outer_class=root_module['ns3::PcapHelper'], import_from_module='ns.network') ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice [class] module.add_class('PcapHelperForDevice', allow_subclassing=True, import_from_module='ns.network') ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simulator.h (module 'core'): ns3::Simulator [class] module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core') ## simulator.h (module 'core'): ns3::Simulator [enumeration] module.add_enum('', ['NO_CONTEXT'], outer_class=root_module['ns3::Simulator'], import_from_module='ns.core') ## system-condition.h (module 'core'): ns3::SystemCondition [class] module.add_class('SystemCondition', import_from_module='ns.core') ## system-mutex.h (module 'core'): ns3::SystemMutex [class] module.add_class('SystemMutex', import_from_module='ns.core') ## tag.h (module 'network'): ns3::Tag [class] module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## tag-buffer.h (module 'network'): ns3::TagBuffer [class] module.add_class('TagBuffer', import_from_module='ns.network') ## nstime.h (module 'core'): ns3::TimeWithUnit [class] module.add_class('TimeWithUnit', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId [class] module.add_class('TypeId', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## empty.h (module 'core'): ns3::empty [class] module.add_class('empty', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] module.add_class('int64x64_t', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration] module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core') ## chunk.h (module 'network'): ns3::Chunk [class] module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper [class] module.add_class('FdNetDeviceHelper', parent=[root_module['ns3::PcapHelperForDevice'], root_module['ns3::AsciiTraceHelperForDevice']]) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## object.h (module 'core'): ns3::Object [class] module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) ## object.h (module 'core'): ns3::Object::AggregateIterator [class] module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class] module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NetDeviceQueue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NetDeviceQueue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::QueueItem', 'ns3::empty', 'ns3::DefaultDeleter<ns3::QueueItem>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## system-thread.h (module 'core'): ns3::SystemThread [class] module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) ## nstime.h (module 'core'): ns3::Time [class] module.add_class('Time', import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time::Unit [enumeration] module.add_enum('Unit', ['Y', 'D', 'H', 'MIN', 'S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time [class] root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t']) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class] module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) ## trailer.h (module 'network'): ns3::Trailer [class] module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## attribute.h (module 'core'): ns3::AttributeAccessor [class] module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) ## attribute.h (module 'core'): ns3::AttributeChecker [class] module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) ## attribute.h (module 'core'): ns3::AttributeValue [class] module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) ## callback.h (module 'core'): ns3::CallbackChecker [class] module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## callback.h (module 'core'): ns3::CallbackImplBase [class] module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) ## callback.h (module 'core'): ns3::CallbackValue [class] module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## data-rate.h (module 'network'): ns3::DataRateChecker [class] module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## data-rate.h (module 'network'): ns3::DataRateValue [class] module.add_class('DataRateValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper [class] module.add_class('EmuFdNetDeviceHelper', parent=root_module['ns3::FdNetDeviceHelper']) ## event-impl.h (module 'core'): ns3::EventImpl [class] module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) ## unix-fd-reader.h (module 'core'): ns3::FdReader [class] module.add_class('FdReader', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class] module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class] module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class] module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class] module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class] module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class] module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class] module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class] module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class] module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class] module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## net-device.h (module 'network'): ns3::NetDevice [class] module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object']) ## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration] module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network') ## net-device.h (module 'network'): ns3::NetDeviceQueue [class] module.add_class('NetDeviceQueue', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >']) ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface [class] module.add_class('NetDeviceQueueInterface', import_from_module='ns.network', parent=root_module['ns3::Object']) ## nix-vector.h (module 'network'): ns3::NixVector [class] module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) ## node.h (module 'network'): ns3::Node [class] module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object']) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class] module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class] module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class] module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >']) ## packet.h (module 'network'): ns3::Packet [class] module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) ## net-device.h (module 'network'): ns3::QueueItem [class] module.add_class('QueueItem', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >']) ## net-device.h (module 'network'): ns3::QueueItem::Uint8Values [enumeration] module.add_enum('Uint8Values', ['IP_DSFIELD'], outer_class=root_module['ns3::QueueItem'], import_from_module='ns.network') ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper [class] module.add_class('TapFdNetDeviceHelper', parent=root_module['ns3::EmuFdNetDeviceHelper']) ## nstime.h (module 'core'): ns3::TimeValue [class] module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## type-id.h (module 'core'): ns3::TypeIdChecker [class] module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## type-id.h (module 'core'): ns3::TypeIdValue [class] module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## address.h (module 'network'): ns3::AddressChecker [class] module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## address.h (module 'network'): ns3::AddressValue [class] module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice [class] module.add_class('FdNetDevice', parent=root_module['ns3::NetDevice']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::EncapsulationMode [enumeration] module.add_enum('EncapsulationMode', ['DIX', 'LLC', 'DIXPI'], outer_class=root_module['ns3::FdNetDevice']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader [class] module.add_class('FdNetDeviceFdReader', parent=root_module['ns3::FdReader']) ## Register a nested module for the namespace FatalImpl nested_module = module.add_cpp_namespace('FatalImpl') register_types_ns3_FatalImpl(nested_module) ## Register a nested module for the namespace Hash nested_module = module.add_cpp_namespace('Hash') register_types_ns3_Hash(nested_module) ## Register a nested module for the namespace TracedValueCallback nested_module = module.add_cpp_namespace('TracedValueCallback') register_types_ns3_TracedValueCallback(nested_module) def register_types_ns3_FatalImpl(module): root_module = module.get_root() def register_types_ns3_Hash(module): root_module = module.get_root() ## hash-function.h (module 'core'): ns3::Hash::Implementation [class] module.add_class('Implementation', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >']) typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash32Function_ptr') typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash32Function_ptr*') typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash32Function_ptr&') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash64Function_ptr') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash64Function_ptr*') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash64Function_ptr&') ## Register a nested module for the namespace Function nested_module = module.add_cpp_namespace('Function') register_types_ns3_Hash_Function(nested_module) def register_types_ns3_Hash_Function(module): root_module = module.get_root() ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a [class] module.add_class('Fnv1a', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash32 [class] module.add_class('Hash32', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash64 [class] module.add_class('Hash64', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3 [class] module.add_class('Murmur3', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) def register_types_ns3_TracedValueCallback(module): root_module = module.get_root() typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *', u'ns3::TracedValueCallback::Time') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) **', u'ns3::TracedValueCallback::Time*') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *&', u'ns3::TracedValueCallback::Time&') def register_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) register_Ns3AsciiTraceHelper_methods(root_module, root_module['ns3::AsciiTraceHelper']) register_Ns3AsciiTraceHelperForDevice_methods(root_module, root_module['ns3::AsciiTraceHelperForDevice']) register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList']) register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item']) register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator']) register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item']) register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList']) register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator']) register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item']) register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase']) register_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection']) register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher']) register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address']) register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask']) register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address']) register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix']) register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer']) register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter']) register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata']) register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item']) register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator']) register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator']) register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item']) register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList']) register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData']) register_Ns3PcapFile_methods(root_module, root_module['ns3::PcapFile']) register_Ns3PcapHelper_methods(root_module, root_module['ns3::PcapHelper']) register_Ns3PcapHelperForDevice_methods(root_module, root_module['ns3::PcapHelperForDevice']) register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator']) register_Ns3SystemCondition_methods(root_module, root_module['ns3::SystemCondition']) register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex']) register_Ns3Tag_methods(root_module, root_module['ns3::Tag']) register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer']) register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit']) register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId']) register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation']) register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation']) register_Ns3Empty_methods(root_module, root_module['ns3::empty']) register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t']) register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk']) register_Ns3FdNetDeviceHelper_methods(root_module, root_module['ns3::FdNetDeviceHelper']) register_Ns3Header_methods(root_module, root_module['ns3::Header']) register_Ns3Object_methods(root_module, root_module['ns3::Object']) register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper']) register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >']) register_Ns3SimpleRefCount__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >']) register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) register_Ns3SimpleRefCount__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >']) register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread']) register_Ns3Time_methods(root_module, root_module['ns3::Time']) register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor']) register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer']) register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor']) register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker']) register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue']) register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker']) register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase']) register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue']) register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker']) register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EmuFdNetDeviceHelper_methods(root_module, root_module['ns3::EmuFdNetDeviceHelper']) register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader']) register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker']) register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue']) register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker']) register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue']) register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker']) register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue']) register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker']) register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue']) register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice']) register_Ns3NetDeviceQueue_methods(root_module, root_module['ns3::NetDeviceQueue']) register_Ns3NetDeviceQueueInterface_methods(root_module, root_module['ns3::NetDeviceQueueInterface']) register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector']) register_Ns3Node_methods(root_module, root_module['ns3::Node']) register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper']) register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) register_Ns3QueueItem_methods(root_module, root_module['ns3::QueueItem']) register_Ns3TapFdNetDeviceHelper_methods(root_module, root_module['ns3::TapFdNetDeviceHelper']) register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue']) register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker']) register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue']) register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) register_Ns3FdNetDevice_methods(root_module, root_module['ns3::FdNetDevice']) register_Ns3FdNetDeviceFdReader_methods(root_module, root_module['ns3::FdNetDeviceFdReader']) register_Ns3HashImplementation_methods(root_module, root_module['ns3::Hash::Implementation']) register_Ns3HashFunctionFnv1a_methods(root_module, root_module['ns3::Hash::Function::Fnv1a']) register_Ns3HashFunctionHash32_methods(root_module, root_module['ns3::Hash::Function::Hash32']) register_Ns3HashFunctionHash64_methods(root_module, root_module['ns3::Hash::Function::Hash64']) register_Ns3HashFunctionMurmur3_methods(root_module, root_module['ns3::Hash::Function::Murmur3']) return def register_Ns3Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## address.h (module 'network'): ns3::Address::Address() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor] cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor] cls.add_constructor([param('ns3::Address const &', 'address')]) ## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function] cls.add_method('CheckCompatible', 'bool', [param('uint8_t', 'type'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyAllFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function] cls.add_method('CopyAllTo', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'uint32_t', [param('uint8_t *', 'buffer')], is_const=True) ## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'buffer')]) ## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function] cls.add_method('GetLength', 'uint8_t', [], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function] cls.add_method('IsInvalid', 'bool', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function] cls.add_method('IsMatchingType', 'bool', [param('uint8_t', 'type')], is_const=True) ## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function] cls.add_method('Register', 'uint8_t', [], is_static=True) ## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'buffer')], is_const=True) return def register_Ns3AsciiTraceHelper_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper(ns3::AsciiTraceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::AsciiTraceHelper const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): ns3::Ptr<ns3::OutputStreamWrapper> ns3::AsciiTraceHelper::CreateFileStream(std::string filename, std::_Ios_Openmode filemode=std::ios_base::out) [member function] cls.add_method('CreateFileStream', 'ns3::Ptr< ns3::OutputStreamWrapper >', [param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode', default_value='std::ios_base::out')]) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDequeueSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDequeueSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDropSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDropSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultEnqueueSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultEnqueueSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultReceiveSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultReceiveSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromDevice', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')]) ## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromInterfacePair', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')]) return def register_Ns3AsciiTraceHelperForDevice_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice(ns3::AsciiTraceHelperForDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::AsciiTraceHelperForDevice const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename=false) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::Ptr<ns3::NetDevice> nd) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, std::string ndName, bool explicitFilename=false) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string ndName) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'ndName')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NetDeviceContainer d) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NetDeviceContainer d) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NetDeviceContainer', 'd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NodeContainer n) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::NodeContainer', 'n')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NodeContainer n) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NodeContainer', 'n')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'explicitFilename')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, uint32_t nodeid, uint32_t deviceid) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(std::string prefix) [member function] cls.add_method('EnableAsciiAll', 'void', [param('std::string', 'prefix')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(ns3::Ptr<ns3::OutputStreamWrapper> stream) [member function] cls.add_method('EnableAsciiAll', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function] cls.add_method('EnableAsciiInternal', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')], is_pure_virtual=True, is_virtual=True) return def register_Ns3AttributeConstructionList_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function] cls.add_method('Add', 'void', [param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')]) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('Find', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True) return def register_Ns3AttributeConstructionListItem_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable] cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False) return def register_Ns3Buffer_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'void', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtStart(uint32_t start) [member function] cls.add_method('AddAtStart', 'void', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function] cls.add_method('Begin', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Buffer', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function] cls.add_method('End', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3BufferIterator_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function] cls.add_method('GetDistanceFrom', 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function] cls.add_method('IsEnd', 'bool', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function] cls.add_method('IsStart', 'bool', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function] cls.add_method('Next', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function] cls.add_method('Next', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function] cls.add_method('PeekU8', 'uint8_t', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function] cls.add_method('Prev', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function] cls.add_method('Prev', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function] cls.add_method('Read', 'void', [param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function] cls.add_method('ReadLsbtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function] cls.add_method('ReadLsbtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function] cls.add_method('ReadLsbtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function] cls.add_method('ReadNtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function] cls.add_method('ReadNtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function] cls.add_method('ReadNtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function] cls.add_method('Write', 'void', [param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function] cls.add_method('WriteHtolsbU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function] cls.add_method('WriteHtolsbU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function] cls.add_method('WriteHtolsbU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function] cls.add_method('WriteHtonU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function] cls.add_method('WriteHtonU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function] cls.add_method('WriteHtonU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data'), param('uint32_t', 'len')]) return def register_Ns3ByteTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagIterator::Item', []) return def register_Ns3ByteTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function] cls.add_method('GetEnd', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function] cls.add_method('GetStart', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3ByteTagList_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor] cls.add_constructor([]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor] cls.add_constructor([param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function] cls.add_method('Add', 'ns3::TagBuffer', [param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function] cls.add_method('Add', 'void', [param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t appendOffset) [member function] cls.add_method('AddAtEnd', 'void', [param('int32_t', 'appendOffset')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t prependOffset) [member function] cls.add_method('AddAtStart', 'void', [param('int32_t', 'prependOffset')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Adjust(int32_t adjustment) [member function] cls.add_method('Adjust', 'void', [param('int32_t', 'adjustment')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function] cls.add_method('Begin', 'ns3::ByteTagList::Iterator', [param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')], is_const=True) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3ByteTagListIterator_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')]) ## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function] cls.add_method('GetOffsetStart', 'uint32_t', [], is_const=True) ## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagList::Iterator::Item', []) return def register_Ns3ByteTagListIteratorItem_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor] cls.add_constructor([param('ns3::TagBuffer', 'buf')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable] cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable] cls.add_instance_attribute('end', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable] cls.add_instance_attribute('size', 'uint32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable] cls.add_instance_attribute('start', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3CallbackBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function] cls.add_method('GetImpl', 'ns3::Ptr< ns3::CallbackImplBase >', [], is_const=True) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')], visibility='protected') return def register_Ns3CriticalSection_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor] cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor] cls.add_constructor([param('ns3::SystemMutex &', 'mutex')]) return def register_Ns3DataRate_methods(root_module, cls): cls.add_output_stream_operator() cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRate const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor] cls.add_constructor([param('uint64_t', 'bps')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor] cls.add_constructor([param('std::string', 'rate')]) ## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBitsTxTime(uint32_t bits) const [member function] cls.add_method('CalculateBitsTxTime', 'ns3::Time', [param('uint32_t', 'bits')], is_const=True) ## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBytesTxTime(uint32_t bytes) const [member function] cls.add_method('CalculateBytesTxTime', 'ns3::Time', [param('uint32_t', 'bytes')], is_const=True) ## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function] cls.add_method('CalculateTxTime', 'double', [param('uint32_t', 'bytes')], deprecated=True, is_const=True) ## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function] cls.add_method('GetBitRate', 'uint64_t', [], is_const=True) return def register_Ns3EventId_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('==') ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventId const &', 'arg0')]) ## event-id.h (module 'core'): ns3::EventId::EventId() [constructor] cls.add_constructor([]) ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')]) ## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function] cls.add_method('GetTs', 'uint64_t', [], is_const=True) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function] cls.add_method('GetUid', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function] cls.add_method('IsExpired', 'bool', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function] cls.add_method('IsRunning', 'bool', [], is_const=True) ## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function] cls.add_method('PeekEventImpl', 'ns3::EventImpl *', [], is_const=True) return def register_Ns3Hasher_methods(root_module, cls): ## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Hasher const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hasher const &', 'arg0')]) ## hash.h (module 'core'): ns3::Hasher::Hasher() [constructor] cls.add_constructor([]) ## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Ptr<ns3::Hash::Implementation> hp) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Hash::Implementation >', 'hp')]) ## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')]) ## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(std::string const s) [member function] cls.add_method('GetHash32', 'uint32_t', [param('std::string const', 's')]) ## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(char const * buffer, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('size_t const', 'size')]) ## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(std::string const s) [member function] cls.add_method('GetHash64', 'uint64_t', [param('std::string const', 's')]) ## hash.h (module 'core'): ns3::Hasher & ns3::Hasher::clear() [member function] cls.add_method('clear', 'ns3::Hasher &', []) return def register_Ns3Ipv4Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] cls.add_constructor([param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('CombineMask', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv4Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv4Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('GetSubnetDirectedBroadcast', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Address const &', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] cls.add_method('IsLocalMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('IsSubnetDirectedBroadcast', 'bool', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) return def register_Ns3Ipv4Mask_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] cls.add_constructor([param('uint32_t', 'mask')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] cls.add_constructor([param('char const *', 'mask')]) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] cls.add_method('GetInverse', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint16_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Mask', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'mask')]) return def register_Ns3Ipv6Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor] cls.add_constructor([param('uint8_t *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] cls.add_method('CombinePrefix', 'ns3::Ipv6Address', [param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv6Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv6Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] cls.add_method('GetAllHostsMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] cls.add_method('GetAllNodesMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] cls.add_method('GetAllRoutersMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function] cls.add_method('GetIpv4MappedAddress', 'ns3::Ipv4Address', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] cls.add_method('IsAllHostsMulticast', 'bool', [], deprecated=True, is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] cls.add_method('IsAllNodesMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] cls.add_method('IsAllRoutersMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsDocumentation() const [member function] cls.add_method('IsDocumentation', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Address const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() const [member function] cls.add_method('IsIpv4MappedAddress', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] cls.add_method('IsLinkLocal', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function] cls.add_method('IsLinkLocalMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] cls.add_method('IsSolicitedMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac16Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac16Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac64Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac64Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac16Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac16Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac64Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac64Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress(ns3::Ipv4Address addr) [member function] cls.add_method('MakeIpv4MappedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv4Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function] cls.add_method('MakeSolicitedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv6Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function] cls.add_method('Set', 'void', [param('uint8_t *', 'address')]) return def register_Ns3Ipv6Prefix_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] cls.add_constructor([param('uint8_t *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] cls.add_constructor([param('char const *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] cls.add_constructor([param('uint8_t', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint8_t', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Prefix const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) return def register_Ns3Mac48Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor] cls.add_constructor([param('char const *', 'str')]) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function] cls.add_method('Allocate', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Mac48Address', [param('ns3::Address const &', 'address')], is_static=True) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function] cls.add_method('CopyFrom', 'void', [param('uint8_t const *', 'buffer')]) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'void', [param('uint8_t *', 'buffer')], is_const=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv4Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv6Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function] cls.add_method('GetMulticast6Prefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function] cls.add_method('GetMulticastPrefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function] cls.add_method('IsGroup', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) return def register_Ns3NetDeviceContainer_methods(root_module, cls): ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor] cls.add_constructor([]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] cls.add_constructor([param('std::string', 'devName')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NetDeviceContainer', 'other')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] cls.add_method('Add', 'void', [param('std::string', 'deviceName')]) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True) ## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3NodeContainer_methods(root_module, cls): ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer() [constructor] cls.add_constructor([]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::Ptr<ns3::Node> node) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor] cls.add_constructor([param('std::string', 'nodeName')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d, ns3::NodeContainer const & e) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd'), param('ns3::NodeContainer const &', 'e')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NodeContainer', 'other')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(std::string nodeName) [member function] cls.add_method('Add', 'void', [param('std::string', 'nodeName')]) ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_const=True) ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n) [member function] cls.add_method('Create', 'void', [param('uint32_t', 'n')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n, uint32_t systemId) [member function] cls.add_method('Create', 'void', [param('uint32_t', 'n'), param('uint32_t', 'systemId')]) ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_const=True) ## node-container.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NodeContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::Node >', [param('uint32_t', 'i')], is_const=True) ## node-container.h (module 'network'): static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function] cls.add_method('GetGlobal', 'ns3::NodeContainer', [], is_static=True) ## node-container.h (module 'network'): uint32_t ns3::NodeContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3ObjectBase_methods(root_module, cls): ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor] cls.add_constructor([]) ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] cls.add_method('ConstructSelf', 'void', [param('ns3::AttributeConstructionList const &', 'attributes')], visibility='protected') ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] cls.add_method('NotifyConstructionCompleted', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectDeleter_methods(root_module, cls): ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] cls.add_constructor([]) ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')]) ## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function] cls.add_method('Delete', 'void', [param('ns3::Object *', 'object')], is_static=True) return def register_Ns3ObjectFactory_methods(root_module, cls): cls.add_output_stream_operator() ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] cls.add_constructor([param('std::string', 'typeId')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::Object >', [], is_const=True) ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('Set', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] cls.add_method('SetTypeId', 'void', [param('ns3::TypeId', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] cls.add_method('SetTypeId', 'void', [param('char const *', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] cls.add_method('SetTypeId', 'void', [param('std::string', 'tid')]) return def register_Ns3PacketMetadata_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [param('ns3::Buffer', 'buffer')], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function] cls.add_method('CreateFragment', 'ns3::PacketMetadata', [param('uint32_t', 'start'), param('uint32_t', 'end')], is_const=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function] cls.add_method('Enable', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('RemoveHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('RemoveTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3PacketMetadataItem_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor] cls.add_constructor([]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable] cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable] cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable] cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable] cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable] cls.add_instance_attribute('isFragment', 'bool', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor] cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')]) ## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketMetadata::Item', []) return def register_Ns3PacketTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketTagIterator::Item', []) return def register_Ns3PacketTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3PacketTagList_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor] cls.add_constructor([param('ns3::PacketTagList const &', 'o')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function] cls.add_method('Add', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function] cls.add_method('Head', 'ns3::PacketTagList::TagData const *', [], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function] cls.add_method('Peek', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function] cls.add_method('Remove', 'bool', [param('ns3::Tag &', 'tag')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Replace(ns3::Tag & tag) [member function] cls.add_method('Replace', 'bool', [param('ns3::Tag &', 'tag')]) return def register_Ns3PacketTagListTagData_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable] cls.add_instance_attribute('count', 'uint32_t', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable] cls.add_instance_attribute('data', 'uint8_t [ 21 ]', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable] cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PcapFile_methods(root_module, cls): ## pcap-file.h (module 'network'): ns3::PcapFile::PcapFile() [constructor] cls.add_constructor([]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Clear() [member function] cls.add_method('Clear', 'void', []) ## pcap-file.h (module 'network'): void ns3::PcapFile::Close() [member function] cls.add_method('Close', 'void', []) ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t & packets, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] cls.add_method('Diff', 'bool', [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t &', 'packets'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], is_static=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function] cls.add_method('Eof', 'bool', [], is_const=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Fail() const [member function] cls.add_method('Fail', 'bool', [], is_const=True) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetDataLinkType() [member function] cls.add_method('GetDataLinkType', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetMagic() [member function] cls.add_method('GetMagic', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSigFigs() [member function] cls.add_method('GetSigFigs', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSnapLen() [member function] cls.add_method('GetSnapLen', 'uint32_t', []) ## pcap-file.h (module 'network'): bool ns3::PcapFile::GetSwapMode() [member function] cls.add_method('GetSwapMode', 'bool', []) ## pcap-file.h (module 'network'): int32_t ns3::PcapFile::GetTimeZoneOffset() [member function] cls.add_method('GetTimeZoneOffset', 'int32_t', []) ## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMajor() [member function] cls.add_method('GetVersionMajor', 'uint16_t', []) ## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMinor() [member function] cls.add_method('GetVersionMinor', 'uint16_t', []) ## pcap-file.h (module 'network'): void ns3::PcapFile::Init(uint32_t dataLinkType, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ns3::PcapFile::ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false) [member function] cls.add_method('Init', 'void', [param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT'), param('int32_t', 'timeZoneCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT'), param('bool', 'swapMode', default_value='false'), param('bool', 'nanosecMode', default_value='false')]) ## pcap-file.h (module 'network'): bool ns3::PcapFile::IsNanoSecMode() [member function] cls.add_method('IsNanoSecMode', 'bool', []) ## pcap-file.h (module 'network'): void ns3::PcapFile::Open(std::string const & filename, std::_Ios_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Read(uint8_t * const data, uint32_t maxBytes, uint32_t & tsSec, uint32_t & tsUsec, uint32_t & inclLen, uint32_t & origLen, uint32_t & readLen) [member function] cls.add_method('Read', 'void', [param('uint8_t * const', 'data'), param('uint32_t', 'maxBytes'), param('uint32_t &', 'tsSec'), param('uint32_t &', 'tsUsec'), param('uint32_t &', 'inclLen'), param('uint32_t &', 'origLen'), param('uint32_t &', 'readLen')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('uint8_t const * const', 'data'), param('uint32_t', 'totalLen')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file.h (module 'network'): ns3::PcapFile::SNAPLEN_DEFAULT [variable] cls.add_static_attribute('SNAPLEN_DEFAULT', 'uint32_t const', is_const=True) ## pcap-file.h (module 'network'): ns3::PcapFile::ZONE_DEFAULT [variable] cls.add_static_attribute('ZONE_DEFAULT', 'int32_t const', is_const=True) return def register_Ns3PcapHelper_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper(ns3::PcapHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::_Ios_Openmode filemode, ns3::PcapHelper::DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=0) [member function] cls.add_method('CreateFile', 'ns3::Ptr< ns3::PcapFileWrapper >', [param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode'), param('ns3::PcapHelper::DataLinkType', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='0')]) ## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromDevice', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')]) ## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromInterfacePair', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')]) return def register_Ns3PcapHelperForDevice_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice(ns3::PcapHelperForDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::PcapHelperForDevice const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous=false, bool explicitFilename=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NetDeviceContainer d, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NodeContainer n, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::NodeContainer', 'n'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapAll(std::string prefix, bool promiscuous=false) [member function] cls.add_method('EnablePcapAll', 'void', [param('std::string', 'prefix'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function] cls.add_method('EnablePcapInternal', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')], is_pure_virtual=True, is_virtual=True) return def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3Simulator_methods(root_module, cls): ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Simulator const &', 'arg0')]) ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function] cls.add_method('GetContext', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function] cls.add_method('GetImplementation', 'ns3::Ptr< ns3::SimulatorImpl >', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function] cls.add_method('IsFinished', 'bool', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function] cls.add_method('Now', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function] cls.add_method('SetImplementation', 'void', [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function] cls.add_method('Stop', 'void', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & delay) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'delay')], is_static=True) return def register_Ns3SystemCondition_methods(root_module, cls): ## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition(ns3::SystemCondition const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemCondition const &', 'arg0')]) ## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition() [constructor] cls.add_constructor([]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Broadcast() [member function] cls.add_method('Broadcast', 'void', []) ## system-condition.h (module 'core'): bool ns3::SystemCondition::GetCondition() [member function] cls.add_method('GetCondition', 'bool', []) ## system-condition.h (module 'core'): void ns3::SystemCondition::SetCondition(bool condition) [member function] cls.add_method('SetCondition', 'void', [param('bool', 'condition')]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Signal() [member function] cls.add_method('Signal', 'void', []) ## system-condition.h (module 'core'): bool ns3::SystemCondition::TimedWait(uint64_t ns) [member function] cls.add_method('TimedWait', 'bool', [param('uint64_t', 'ns')]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Wait() [member function] cls.add_method('Wait', 'void', []) return def register_Ns3SystemMutex_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor] cls.add_constructor([]) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function] cls.add_method('Lock', 'void', []) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function] cls.add_method('Unlock', 'void', []) return def register_Ns3Tag_methods(root_module, cls): ## tag.h (module 'network'): ns3::Tag::Tag() [constructor] cls.add_constructor([]) ## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor] cls.add_constructor([param('ns3::Tag const &', 'arg0')]) ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_virtual=True) ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TagBuffer_methods(root_module, cls): ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor] cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')]) ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor] cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function] cls.add_method('CopyFrom', 'void', [param('ns3::TagBuffer', 'o')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function] cls.add_method('ReadDouble', 'double', []) ## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function] cls.add_method('TrimAtEnd', 'void', [param('uint32_t', 'trim')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function] cls.add_method('WriteDouble', 'void', [param('double', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'v')]) return def register_Ns3TimeWithUnit_methods(root_module, cls): cls.add_output_stream_operator() ## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')]) ## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor] cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')]) return def register_Ns3TypeId_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')], deprecated=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor, std::string callback) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] cls.add_method('GetAttributeFullName', 'std::string', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] cls.add_method('GetAttributeN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function] cls.add_method('GetConstructor', 'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function] cls.add_method('GetGroupName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetHash() const [member function] cls.add_method('GetHash', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function] cls.add_method('GetName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function] cls.add_method('GetParent', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function] cls.add_method('GetRegistered', 'ns3::TypeId', [param('uint32_t', 'i')], is_static=True) ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] cls.add_method('GetRegisteredN', 'uint32_t', [], is_static=True) ## type-id.h (module 'core'): std::size_t ns3::TypeId::GetSize() const [member function] cls.add_method('GetSize', 'std::size_t', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function] cls.add_method('GetTraceSource', 'ns3::TypeId::TraceSourceInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] cls.add_method('GetTraceSourceN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function] cls.add_method('GetUid', 'uint16_t', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function] cls.add_method('HasConstructor', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function] cls.add_method('HasParent', 'bool', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function] cls.add_method('HideFromDocumentation', 'ns3::TypeId', []) ## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function] cls.add_method('IsChildOf', 'bool', [param('ns3::TypeId', 'other')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function] cls.add_method('LookupAttributeByName', 'bool', [param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info', transfer_ownership=False)], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByHash(uint32_t hash) [member function] cls.add_method('LookupByHash', 'ns3::TypeId', [param('uint32_t', 'hash')], is_static=True) ## type-id.h (module 'core'): static bool ns3::TypeId::LookupByHashFailSafe(uint32_t hash, ns3::TypeId * tid) [member function] cls.add_method('LookupByHashFailSafe', 'bool', [param('uint32_t', 'hash'), param('ns3::TypeId *', 'tid')], is_static=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function] cls.add_method('LookupByName', 'ns3::TypeId', [param('std::string', 'name')], is_static=True) ## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function] cls.add_method('LookupTraceSourceByName', 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function] cls.add_method('SetAttributeInitialValue', 'bool', [param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function] cls.add_method('SetGroupName', 'ns3::TypeId', [param('std::string', 'groupName')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function] cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function] cls.add_method('SetSize', 'ns3::TypeId', [param('std::size_t', 'size')]) ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] cls.add_method('SetUid', 'void', [param('uint16_t', 'tid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] cls.add_instance_attribute('flags', 'uint32_t', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable] cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::callback [variable] cls.add_instance_attribute('callback', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) return def register_Ns3Empty_methods(root_module, cls): ## empty.h (module 'core'): ns3::empty::empty() [constructor] cls.add_constructor([]) ## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor] cls.add_constructor([param('ns3::empty const &', 'arg0')]) return def register_Ns3Int64x64_t_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_unary_numeric_operator('-') cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] cls.add_constructor([]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long double v) [constructor] cls.add_constructor([param('long double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] cls.add_method('GetHigh', 'int64_t', [], is_const=True) ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] cls.add_method('GetLow', 'uint64_t', [], is_const=True) ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] cls.add_method('Invert', 'ns3::int64x64_t', [param('uint64_t', 'v')], is_static=True) ## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function] cls.add_method('MulByInvert', 'void', [param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::implementation [variable] cls.add_static_attribute('implementation', 'ns3::int64x64_t::impl_type const', is_const=True) return def register_Ns3Chunk_methods(root_module, cls): ## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor] cls.add_constructor([]) ## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor] cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3FdNetDeviceHelper_methods(root_module, cls): ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper::FdNetDeviceHelper(ns3::FdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdNetDeviceHelper const &', 'arg0')]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper::FdNetDeviceHelper() [constructor] cls.add_constructor([]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(std::string name) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('std::string', 'name')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(ns3::NodeContainer const & c) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::NodeContainer const &', 'c')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::SetAttribute(std::string n1, ns3::AttributeValue const & v1) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::FdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function] cls.add_method('EnableAsciiInternal', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')], visibility='private', is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function] cls.add_method('EnablePcapInternal', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')], visibility='private', is_virtual=True) return def register_Ns3Header_methods(root_module, cls): cls.add_output_stream_operator() ## header.h (module 'network'): ns3::Header::Header() [constructor] cls.add_constructor([]) ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] cls.add_constructor([param('ns3::Header const &', 'arg0')]) ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Object_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::Object() [constructor] cls.add_constructor([]) ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function] cls.add_method('AggregateObject', 'void', [param('ns3::Ptr< ns3::Object >', 'other')]) ## object.h (module 'core'): void ns3::Object::Dispose() [member function] cls.add_method('Dispose', 'void', []) ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] cls.add_method('GetAggregateIterator', 'ns3::Object::AggregateIterator', [], is_const=True) ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object.h (module 'core'): void ns3::Object::Initialize() [member function] cls.add_method('Initialize', 'void', []) ## object.h (module 'core'): bool ns3::Object::IsInitialized() const [member function] cls.add_method('IsInitialized', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] cls.add_constructor([param('ns3::Object const &', 'o')], visibility='protected') ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::DoInitialize() [member function] cls.add_method('DoInitialize', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectAggregateIterator_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')]) ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor] cls.add_constructor([]) ## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function] cls.add_method('Next', 'ns3::Ptr< ns3::Object const >', []) return def register_Ns3PcapFileWrapper_methods(root_module, cls): ## pcap-file-wrapper.h (module 'network'): static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper::PcapFileWrapper() [constructor] cls.add_constructor([]) ## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Fail() const [member function] cls.add_method('Fail', 'bool', [], is_const=True) ## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Eof() const [member function] cls.add_method('Eof', 'bool', [], is_const=True) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Clear() [member function] cls.add_method('Clear', 'void', []) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Open(std::string const & filename, std::_Ios_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Close() [member function] cls.add_method('Close', 'void', []) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function] cls.add_method('Init', 'void', [param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')]) ## pcap-file-wrapper.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PcapFileWrapper::Read(ns3::Time & t) [member function] cls.add_method('Read', 'ns3::Ptr< ns3::Packet >', [param('ns3::Time &', 't')]) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetMagic() [member function] cls.add_method('GetMagic', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function] cls.add_method('GetVersionMajor', 'uint16_t', []) ## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function] cls.add_method('GetVersionMinor', 'uint16_t', []) ## pcap-file-wrapper.h (module 'network'): int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function] cls.add_method('GetTimeZoneOffset', 'int32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function] cls.add_method('GetSigFigs', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function] cls.add_method('GetSnapLen', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function] cls.add_method('GetDataLinkType', 'uint32_t', []) return def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter< ns3::NetDeviceQueue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount(ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter< ns3::QueueItem > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SystemThread_methods(root_module, cls): ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemThread const &', 'arg0')]) ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor] cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) ## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function] cls.add_method('Equals', 'bool', [param('pthread_t', 'id')], is_static=True) ## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function] cls.add_method('Join', 'void', []) ## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function] cls.add_method('Self', 'pthread_t', [], is_static=True) ## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function] cls.add_method('Start', 'void', []) return def register_Ns3Time_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right')) cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## nstime.h (module 'core'): ns3::Time::Time() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor] cls.add_constructor([param('ns3::Time const &', 'o')]) ## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & v) [constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor] cls.add_constructor([param('std::string const &', 's')]) ## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function] cls.add_method('As', 'ns3::TimeWithUnit', [param('ns3::Time::Unit const', 'unit')], is_const=True) ## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function] cls.add_method('Compare', 'int', [param('ns3::Time const &', 'o')], is_const=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'value')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value, ns3::Time::Unit unit) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'value'), param('ns3::Time::Unit', 'unit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit unit) [member function] cls.add_method('FromDouble', 'ns3::Time', [param('double', 'value'), param('ns3::Time::Unit', 'unit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit unit) [member function] cls.add_method('FromInteger', 'ns3::Time', [param('uint64_t', 'value'), param('ns3::Time::Unit', 'unit')], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetDays() const [member function] cls.add_method('GetDays', 'double', [], is_const=True) ## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function] cls.add_method('GetFemtoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): double ns3::Time::GetHours() const [member function] cls.add_method('GetHours', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function] cls.add_method('GetInteger', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function] cls.add_method('GetMicroSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function] cls.add_method('GetMilliSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): double ns3::Time::GetMinutes() const [member function] cls.add_method('GetMinutes', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function] cls.add_method('GetNanoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function] cls.add_method('GetPicoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function] cls.add_method('GetResolution', 'ns3::Time::Unit', [], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function] cls.add_method('GetSeconds', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function] cls.add_method('GetTimeStep', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): double ns3::Time::GetYears() const [member function] cls.add_method('GetYears', 'double', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function] cls.add_method('IsNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function] cls.add_method('IsPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function] cls.add_method('IsStrictlyNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function] cls.add_method('IsStrictlyPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function] cls.add_method('IsZero', 'bool', [], is_const=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::Max() [member function] cls.add_method('Max', 'ns3::Time', [], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::Min() [member function] cls.add_method('Min', 'ns3::Time', [], is_static=True) ## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function] cls.add_method('SetResolution', 'void', [param('ns3::Time::Unit', 'resolution')], is_static=True) ## nstime.h (module 'core'): static bool ns3::Time::StaticInit() [member function] cls.add_method('StaticInit', 'bool', [], is_static=True) ## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit unit) const [member function] cls.add_method('To', 'ns3::int64x64_t', [param('ns3::Time::Unit', 'unit')], is_const=True) ## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit unit) const [member function] cls.add_method('ToDouble', 'double', [param('ns3::Time::Unit', 'unit')], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit unit) const [member function] cls.add_method('ToInteger', 'int64_t', [param('ns3::Time::Unit', 'unit')], is_const=True) return def register_Ns3TraceSourceAccessor_methods(root_module, cls): ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] cls.add_constructor([]) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Connect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('ConnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Disconnect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('DisconnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Trailer_methods(root_module, cls): cls.add_output_stream_operator() ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] cls.add_constructor([]) ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_pure_virtual=True, is_virtual=True) ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] cls.add_method('Get', 'bool', [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function] cls.add_method('HasGetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function] cls.add_method('HasSetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] cls.add_method('Set', 'bool', [param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeChecker_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function] cls.add_method('Check', 'bool', [param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] cls.add_method('Copy', 'bool', [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function] cls.add_method('CreateValidValue', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::AttributeValue const &', 'value')], is_const=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function] cls.add_method('GetUnderlyingTypeInformation', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function] cls.add_method('GetValueTypeName', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function] cls.add_method('HasUnderlyingTypeInformation', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackChecker_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')]) return def register_Ns3CallbackImplBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')]) ## callback.h (module 'core'): std::string ns3::CallbackImplBase::GetTypeid() const [member function] cls.add_method('GetTypeid', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')], is_pure_virtual=True, is_const=True, is_virtual=True) ## callback.h (module 'core'): static std::string ns3::CallbackImplBase::Demangle(std::string const & mangled) [member function] cls.add_method('Demangle', 'std::string', [param('std::string const &', 'mangled')], is_static=True, visibility='protected') return def register_Ns3CallbackValue_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'base')]) ## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function] cls.add_method('Set', 'void', [param('ns3::CallbackBase', 'base')]) return def register_Ns3DataRateChecker_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')]) return def register_Ns3DataRateValue_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor] cls.add_constructor([param('ns3::DataRate const &', 'value')]) ## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function] cls.add_method('Get', 'ns3::DataRate', [], is_const=True) ## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function] cls.add_method('Set', 'void', [param('ns3::DataRate const &', 'value')]) return def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, visibility='private', is_virtual=True) ## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], visibility='private', is_virtual=True) ## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, visibility='private', is_virtual=True) return def register_Ns3EmuFdNetDeviceHelper_methods(root_module, cls): ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper::EmuFdNetDeviceHelper(ns3::EmuFdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmuFdNetDeviceHelper const &', 'arg0')]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper::EmuFdNetDeviceHelper() [constructor] cls.add_constructor([]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): std::string ns3::EmuFdNetDeviceHelper::GetDeviceName() [member function] cls.add_method('GetDeviceName', 'std::string', []) ## emu-fd-net-device-helper.h (module 'fd-net-device'): void ns3::EmuFdNetDeviceHelper::SetDeviceName(std::string deviceName) [member function] cls.add_method('SetDeviceName', 'void', [param('std::string', 'deviceName')]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): int ns3::EmuFdNetDeviceHelper::CreateFileDescriptor() const [member function] cls.add_method('CreateFileDescriptor', 'int', [], is_const=True, visibility='protected', is_virtual=True) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::EmuFdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## emu-fd-net-device-helper.h (module 'fd-net-device'): void ns3::EmuFdNetDeviceHelper::SetFileDescriptor(ns3::Ptr<ns3::FdNetDevice> device) const [member function] cls.add_method('SetFileDescriptor', 'void', [param('ns3::Ptr< ns3::FdNetDevice >', 'device')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3EventImpl_methods(root_module, cls): ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventImpl const &', 'arg0')]) ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor] cls.add_constructor([]) ## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function] cls.add_method('Invoke', 'void', []) ## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function] cls.add_method('IsCancelled', 'bool', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function] cls.add_method('Notify', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3FdReader_methods(root_module, cls): ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdReader const &', 'arg0')]) ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor] cls.add_constructor([]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function] cls.add_method('Start', 'void', [param('int', 'fd'), param('ns3::Callback< void, unsigned char *, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function] cls.add_method('Stop', 'void', []) ## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3Ipv4AddressChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')]) return def register_Ns3Ipv4AddressValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Address', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Address const &', 'value')]) return def register_Ns3Ipv4MaskChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')]) return def register_Ns3Ipv4MaskValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Mask', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Mask const &', 'value')]) return def register_Ns3Ipv6AddressChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')]) return def register_Ns3Ipv6AddressValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Address', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Address const &', 'value')]) return def register_Ns3Ipv6PrefixChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')]) return def register_Ns3Ipv6PrefixValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Prefix', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Prefix const &', 'value')]) return def register_Ns3Mac48AddressChecker_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')]) return def register_Ns3Mac48AddressValue_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'value')]) ## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Mac48Address', [], is_const=True) ## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Mac48Address const &', 'value')]) return def register_Ns3NetDevice_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDevice const &', 'arg0')]) ## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('Send', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3NetDeviceQueue_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue(ns3::NetDeviceQueue const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceQueue const &', 'arg0')]) ## net-device.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): bool ns3::NetDeviceQueue::IsStopped() const [member function] cls.add_method('IsStopped', 'bool', [], is_const=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::SetWakeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetWakeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Start() [member function] cls.add_method('Start', 'void', [], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Stop() [member function] cls.add_method('Stop', 'void', [], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Wake() [member function] cls.add_method('Wake', 'void', [], is_virtual=True) return def register_Ns3NetDeviceQueueInterface_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface(ns3::NetDeviceQueueInterface const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceQueueInterface const &', 'arg0')]) ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::CreateTxQueues() [member function] cls.add_method('CreateTxQueues', 'void', []) ## net-device.h (module 'network'): uint8_t ns3::NetDeviceQueueInterface::GetNTxQueues() const [member function] cls.add_method('GetNTxQueues', 'uint8_t', [], is_const=True) ## net-device.h (module 'network'): ns3::Callback<unsigned char, ns3::Ptr<ns3::QueueItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ns3::NetDeviceQueueInterface::GetSelectQueueCallback() const [member function] cls.add_method('GetSelectQueueCallback', 'ns3::Callback< unsigned char, ns3::Ptr< ns3::QueueItem >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::NetDeviceQueue> ns3::NetDeviceQueueInterface::GetTxQueue(uint8_t i) const [member function] cls.add_method('GetTxQueue', 'ns3::Ptr< ns3::NetDeviceQueue >', [param('uint8_t', 'i')], is_const=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDeviceQueueInterface::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::SetSelectQueueCallback(ns3::Callback<unsigned char, ns3::Ptr<ns3::QueueItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetSelectQueueCallback', 'void', [param('ns3::Callback< unsigned char, ns3::Ptr< ns3::QueueItem >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::SetTxQueuesN(uint8_t numTxQueues) [member function] cls.add_method('SetTxQueuesN', 'void', [param('uint8_t', 'numTxQueues')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3NixVector_methods(root_module, cls): cls.add_output_stream_operator() ## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor] cls.add_constructor([]) ## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor] cls.add_constructor([param('ns3::NixVector const &', 'o')]) ## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function] cls.add_method('AddNeighborIndex', 'void', [param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function] cls.add_method('BitCount', 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) ## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', [param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function] cls.add_method('GetRemainingBits', 'uint32_t', []) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3Node_methods(root_module, cls): ## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [copy constructor] cls.add_constructor([param('ns3::Node const &', 'arg0')]) ## node.h (module 'network'): ns3::Node::Node() [constructor] cls.add_constructor([]) ## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor] cls.add_constructor([param('uint32_t', 'systemId')]) ## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function] cls.add_method('AddApplication', 'uint32_t', [param('ns3::Ptr< ns3::Application >', 'application')]) ## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('AddDevice', 'uint32_t', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function] cls.add_method('ChecksumEnabled', 'bool', [], is_static=True) ## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function] cls.add_method('GetApplication', 'ns3::Ptr< ns3::Application >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function] cls.add_method('GetId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): ns3::Time ns3::Node::GetLocalTime() const [member function] cls.add_method('GetLocalTime', 'ns3::Time', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function] cls.add_method('GetNApplications', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('RegisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function] cls.add_method('RegisterProtocolHandler', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) ## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('UnregisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler) [member function] cls.add_method('UnregisterProtocolHandler', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')]) ## node.h (module 'network'): void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## node.h (module 'network'): void ns3::Node::DoInitialize() [member function] cls.add_method('DoInitialize', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectFactoryChecker_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')]) return def register_Ns3ObjectFactoryValue_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'value')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function] cls.add_method('Get', 'ns3::ObjectFactory', [], is_const=True) ## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function] cls.add_method('Set', 'void', [param('ns3::ObjectFactory const &', 'value')]) return def register_Ns3OutputStreamWrapper_methods(root_module, cls): ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [copy constructor] cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')]) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor] cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')]) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor] cls.add_constructor([param('std::ostream *', 'os')]) ## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function] cls.add_method('GetStream', 'std::ostream *', []) return def register_Ns3Packet_methods(root_module, cls): cls.add_output_stream_operator() ## packet.h (module 'network'): ns3::Packet::Packet() [constructor] cls.add_constructor([]) ## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor] cls.add_constructor([param('ns3::Packet const &', 'o')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor] cls.add_constructor([param('uint32_t', 'size')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) ## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function] cls.add_method('AddByteTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header')]) ## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function] cls.add_method('AddPacketTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer')]) ## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function] cls.add_method('EnablePrinting', 'void', [], is_static=True) ## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function] cls.add_method('FindFirstMatchingByteTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function] cls.add_method('GetByteTagIterator', 'ns3::ByteTagIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function] cls.add_method('GetNixVector', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function] cls.add_method('GetPacketTagIterator', 'ns3::PacketTagIterator', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function] cls.add_method('PeekHeader', 'uint32_t', [param('ns3::Header &', 'header')], is_const=True) ## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function] cls.add_method('PeekPacketTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function] cls.add_method('PeekTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function] cls.add_method('PrintByteTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function] cls.add_method('PrintPacketTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function] cls.add_method('RemoveAllByteTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function] cls.add_method('RemoveAllPacketTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function] cls.add_method('RemoveHeader', 'uint32_t', [param('ns3::Header &', 'header')]) ## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function] cls.add_method('RemovePacketTag', 'bool', [param('ns3::Tag &', 'tag')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function] cls.add_method('RemoveTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): bool ns3::Packet::ReplacePacketTag(ns3::Tag & tag) [member function] cls.add_method('ReplacePacketTag', 'bool', [param('ns3::Tag &', 'tag')]) ## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function] cls.add_method('SetNixVector', 'void', [param('ns3::Ptr< ns3::NixVector >', 'nixVector')]) ## packet.h (module 'network'): std::string ns3::Packet::ToString() const [member function] cls.add_method('ToString', 'std::string', [], is_const=True) return def register_Ns3QueueItem_methods(root_module, cls): cls.add_output_stream_operator() ## net-device.h (module 'network'): ns3::QueueItem::QueueItem(ns3::Ptr<ns3::Packet> p) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p')]) ## net-device.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::QueueItem::GetPacket() const [member function] cls.add_method('GetPacket', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## net-device.h (module 'network'): uint32_t ns3::QueueItem::GetPacketSize() const [member function] cls.add_method('GetPacketSize', 'uint32_t', [], is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::QueueItem::GetUint8Value(ns3::QueueItem::Uint8Values field, uint8_t & value) const [member function] cls.add_method('GetUint8Value', 'bool', [param('ns3::QueueItem::Uint8Values', 'field'), param('uint8_t &', 'value')], is_const=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::QueueItem::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) return def register_Ns3TapFdNetDeviceHelper_methods(root_module, cls): ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper(ns3::TapFdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapFdNetDeviceHelper const &', 'arg0')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper() [constructor] cls.add_constructor([]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetModePi(bool pi) [member function] cls.add_method('SetModePi', 'void', [param('bool', 'pi')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv4Address(ns3::Ipv4Address address) [member function] cls.add_method('SetTapIpv4Address', 'void', [param('ns3::Ipv4Address', 'address')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv4Mask(ns3::Ipv4Mask mask) [member function] cls.add_method('SetTapIpv4Mask', 'void', [param('ns3::Ipv4Mask', 'mask')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv6Address(ns3::Ipv6Address address) [member function] cls.add_method('SetTapIpv6Address', 'void', [param('ns3::Ipv6Address', 'address')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv6Prefix(int prefix) [member function] cls.add_method('SetTapIpv6Prefix', 'void', [param('int', 'prefix')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapMacAddress(ns3::Mac48Address mac) [member function] cls.add_method('SetTapMacAddress', 'void', [param('ns3::Mac48Address', 'mac')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): int ns3::TapFdNetDeviceHelper::CreateFileDescriptor() const [member function] cls.add_method('CreateFileDescriptor', 'int', [], is_const=True, visibility='protected', is_virtual=True) ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::TapFdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetFileDescriptor(ns3::Ptr<ns3::FdNetDevice> device) const [member function] cls.add_method('SetFileDescriptor', 'void', [param('ns3::Ptr< ns3::FdNetDevice >', 'device')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3TimeValue_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeValue const &', 'arg0')]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor] cls.add_constructor([param('ns3::Time const &', 'value')]) ## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function] cls.add_method('Get', 'ns3::Time', [], is_const=True) ## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Time const &', 'value')]) return def register_Ns3TypeIdChecker_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')]) return def register_Ns3TypeIdValue_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor] cls.add_constructor([param('ns3::TypeId const &', 'value')]) ## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function] cls.add_method('Get', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function] cls.add_method('Set', 'void', [param('ns3::TypeId const &', 'value')]) return def register_Ns3AddressChecker_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')]) return def register_Ns3AddressValue_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressValue const &', 'arg0')]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor] cls.add_constructor([param('ns3::Address const &', 'value')]) ## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Address', [], is_const=True) ## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Address const &', 'value')]) return def register_Ns3FdNetDevice_methods(root_module, cls): ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::FdNetDevice() [constructor] cls.add_constructor([]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Ptr<ns3::Channel> ns3::FdNetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::EncapsulationMode ns3::FdNetDevice::GetEncapsulationMode() const [member function] cls.add_method('GetEncapsulationMode', 'ns3::FdNetDevice::EncapsulationMode', [], is_const=True) ## fd-net-device.h (module 'fd-net-device'): uint32_t ns3::FdNetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): uint16_t ns3::FdNetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Ptr<ns3::Node> ns3::FdNetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): static ns3::TypeId ns3::FdNetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('Send', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetEncapsulationMode(ns3::FdNetDevice::EncapsulationMode mode) [member function] cls.add_method('SetEncapsulationMode', 'void', [param('ns3::FdNetDevice::EncapsulationMode', 'mode')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetFileDescriptor(int fd) [member function] cls.add_method('SetFileDescriptor', 'void', [param('int', 'fd')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIsBroadcast(bool broadcast) [member function] cls.add_method('SetIsBroadcast', 'void', [param('bool', 'broadcast')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIsMulticast(bool multicast) [member function] cls.add_method('SetIsMulticast', 'void', [param('bool', 'multicast')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::Start(ns3::Time tStart) [member function] cls.add_method('Start', 'void', [param('ns3::Time', 'tStart')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::Stop(ns3::Time tStop) [member function] cls.add_method('Stop', 'void', [param('ns3::Time', 'tStop')]) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3FdNetDeviceFdReader_methods(root_module, cls): ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader::FdNetDeviceFdReader(ns3::FdNetDeviceFdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdNetDeviceFdReader const &', 'arg0')]) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader::FdNetDeviceFdReader() [constructor] cls.add_constructor([]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDeviceFdReader::SetBufferSize(uint32_t bufferSize) [member function] cls.add_method('SetBufferSize', 'void', [param('uint32_t', 'bufferSize')]) ## fd-net-device.h (module 'fd-net-device'): ns3::FdReader::Data ns3::FdNetDeviceFdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], visibility='private', is_virtual=True) return def register_Ns3HashImplementation_methods(root_module, cls): ## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation(ns3::Hash::Implementation const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hash::Implementation const &', 'arg0')]) ## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation() [constructor] cls.add_constructor([]) ## hash-function.h (module 'core'): uint32_t ns3::Hash::Implementation::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_pure_virtual=True, is_virtual=True) ## hash-function.h (module 'core'): uint64_t ns3::Hash::Implementation::GetHash64(char const * buffer, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-function.h (module 'core'): void ns3::Hash::Implementation::clear() [member function] cls.add_method('clear', 'void', [], is_pure_virtual=True, is_virtual=True) return def register_Ns3HashFunctionFnv1a_methods(root_module, cls): ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a(ns3::Hash::Function::Fnv1a const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hash::Function::Fnv1a const &', 'arg0')]) ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a() [constructor] cls.add_constructor([]) ## hash-fnv.h (module 'core'): uint32_t ns3::Hash::Function::Fnv1a::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-fnv.h (module 'core'): uint64_t ns3::Hash::Function::Fnv1a::GetHash64(char const * buffer, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-fnv.h (module 'core'): void ns3::Hash::Function::Fnv1a::clear() [member function] cls.add_method('clear', 'void', [], is_virtual=True) return def register_Ns3HashFunctionHash32_methods(root_module, cls): ## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Function::Hash32 const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hash::Function::Hash32 const &', 'arg0')]) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Hash32Function_ptr hp) [constructor] cls.add_constructor([param('ns3::Hash::Hash32Function_ptr', 'hp')]) ## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash32::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-function.h (module 'core'): void ns3::Hash::Function::Hash32::clear() [member function] cls.add_method('clear', 'void', [], is_virtual=True) return def register_Ns3HashFunctionHash64_methods(root_module, cls): ## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Function::Hash64 const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hash::Function::Hash64 const &', 'arg0')]) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Hash64Function_ptr hp) [constructor] cls.add_constructor([param('ns3::Hash::Hash64Function_ptr', 'hp')]) ## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash64::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-function.h (module 'core'): uint64_t ns3::Hash::Function::Hash64::GetHash64(char const * buffer, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-function.h (module 'core'): void ns3::Hash::Function::Hash64::clear() [member function] cls.add_method('clear', 'void', [], is_virtual=True) return def register_Ns3HashFunctionMurmur3_methods(root_module, cls): ## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3(ns3::Hash::Function::Murmur3 const & arg0) [copy constructor] cls.add_constructor([param('ns3::Hash::Function::Murmur3 const &', 'arg0')]) ## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3() [constructor] cls.add_constructor([]) ## hash-murmur3.h (module 'core'): uint32_t ns3::Hash::Function::Murmur3::GetHash32(char const * buffer, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-murmur3.h (module 'core'): uint64_t ns3::Hash::Function::Murmur3::GetHash64(char const * buffer, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_virtual=True) ## hash-murmur3.h (module 'core'): void ns3::Hash::Function::Murmur3::clear() [member function] cls.add_method('clear', 'void', [], is_virtual=True) return def register_functions(root_module): module = root_module register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module) register_functions_ns3_Hash(module.get_submodule('Hash'), root_module) register_functions_ns3_TracedValueCallback(module.get_submodule('TracedValueCallback'), root_module) return def register_functions_ns3_FatalImpl(module, root_module): return def register_functions_ns3_Hash(module, root_module): register_functions_ns3_Hash_Function(module.get_submodule('Function'), root_module) return def register_functions_ns3_Hash_Function(module, root_module): return def register_functions_ns3_TracedValueCallback(module, root_module): return def main(): out = FileCodeSink(sys.stdout) root_module = module_init() register_types(root_module) register_methods(root_module) register_functions(root_module) root_module.generate(out) if __name__ == '__main__': main()
gpl-2.0
[ 504, 1134, 31297, 492, 5673, 12, 3814, 3034, 17111, 12, 1215, 12, 9151, 12, 7246, 533, 12, 14330, 421, 199, 646, 1134, 31297, 14, 1751, 199, 646, 3598, 199, 199, 533, 4520, 2461, 8, 647, 31297, 14, 1751, 14, 25933, 304, 272, 347, 2429, 63, 705, 8, 277, 12, 4975, 12, 1919, 12, 5190, 7822, 267, 3598, 14, 4050, 480, 1971, 450, 82, 315, 4975, 450, 83, 2, 450, 334, 1971, 12, 4975, 430, 267, 372, 715, 199, 647, 31297, 14, 1751, 14, 705, 63, 2232, 275, 4520, 2461, 342, 421, 199, 646, 984, 199, 199, 318, 859, 63, 826, 837, 272, 1738, 63, 578, 275, 5673, 360, 561, 14, 2592, 63, 846, 63, 1782, 297, 7246, 63, 3251, 18749, 26, 561, 19, 358, 272, 372, 1738, 63, 578, 199, 199, 318, 2274, 63, 1313, 8, 578, 304, 272, 1738, 63, 578, 275, 859, 14, 362, 63, 1231, 342, 2286, 925, 2287, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 2287, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1476, 447, 4261, 2320, 63, 69, 359, 14130, 61, 272, 859, 14, 525, 63, 4869, 360, 4261, 2320, 63, 69, 297, 788, 4283, 63, 4305, 995, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 1476, 995, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3307, 13, 3676, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 17333, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 17333, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3307, 13, 3676, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 27492, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27492, 297, 2040, 63, 27904, 29, 549, 12, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 2225, 13, 12708, 13, 513, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 11120, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 11120, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2225, 13, 12708, 13, 513, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 11120, 447, 2081, 359, 1820, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 11120, 1105, 272, 925, 3335, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 3299, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3299, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3335, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 3299, 447, 3585, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3585, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 3299, 1105, 272, 925, 3644, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 14420, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 14420, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3644, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 14420, 447, 2081, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 14420, 1105, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 10499, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 447, 3585, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3585, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 10499, 1105, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 447, 3585, 447, 2081, 359, 1820, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 10499, 447, 3585, 1105, 272, 925, 3233, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 9822, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 9822, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2656, 13, 19078, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 27677, 8660, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27677, 8660, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 666, 13, 1866, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 20390, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 20390, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 1566, 13, 344, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 12534, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 12534, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2631, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 13415, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 13415, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1762, 20, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 1738, 63, 578, 459, 561, 19, 447, 1762, 20, 1476, 2278, 31120, 63, 28392, 63, 475, 8, 1231 ]
[ 1134, 31297, 492, 5673, 12, 3814, 3034, 17111, 12, 1215, 12, 9151, 12, 7246, 533, 12, 14330, 421, 199, 646, 1134, 31297, 14, 1751, 199, 646, 3598, 199, 199, 533, 4520, 2461, 8, 647, 31297, 14, 1751, 14, 25933, 304, 272, 347, 2429, 63, 705, 8, 277, 12, 4975, 12, 1919, 12, 5190, 7822, 267, 3598, 14, 4050, 480, 1971, 450, 82, 315, 4975, 450, 83, 2, 450, 334, 1971, 12, 4975, 430, 267, 372, 715, 199, 647, 31297, 14, 1751, 14, 705, 63, 2232, 275, 4520, 2461, 342, 421, 199, 646, 984, 199, 199, 318, 859, 63, 826, 837, 272, 1738, 63, 578, 275, 5673, 360, 561, 14, 2592, 63, 846, 63, 1782, 297, 7246, 63, 3251, 18749, 26, 561, 19, 358, 272, 372, 1738, 63, 578, 199, 199, 318, 2274, 63, 1313, 8, 578, 304, 272, 1738, 63, 578, 275, 859, 14, 362, 63, 1231, 342, 2286, 925, 2287, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 2287, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1476, 447, 4261, 2320, 63, 69, 359, 14130, 61, 272, 859, 14, 525, 63, 4869, 360, 4261, 2320, 63, 69, 297, 788, 4283, 63, 4305, 995, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 1476, 995, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3307, 13, 3676, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 17333, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 17333, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3307, 13, 3676, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 27492, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27492, 297, 2040, 63, 27904, 29, 549, 12, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 2225, 13, 12708, 13, 513, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 11120, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 11120, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2225, 13, 12708, 13, 513, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 11120, 447, 2081, 359, 1820, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 11120, 1105, 272, 925, 3335, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 3299, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3299, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3335, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 3299, 447, 3585, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3585, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 3299, 1105, 272, 925, 3644, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 14420, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 14420, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3644, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 14420, 447, 2081, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 14420, 1105, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 10499, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 447, 3585, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 3585, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 10499, 1105, 272, 925, 3696, 13, 1450, 13, 513, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 10499, 447, 3585, 447, 2081, 359, 1820, 61, 272, 859, 14, 525, 63, 533, 360, 2081, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 297, 6890, 63, 533, 29, 1231, 63, 578, 459, 561, 19, 447, 10499, 447, 3585, 1105, 272, 925, 3233, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 9822, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 9822, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2656, 13, 19078, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 27677, 8660, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27677, 8660, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 666, 13, 1866, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 20390, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 20390, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 1566, 13, 344, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 12534, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 12534, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2631, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 13415, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 13415, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1762, 20, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 1738, 63, 578, 459, 561, 19, 447, 1762, 20, 1476, 2278, 31120, 63, 28392, 63, 475, 8, 1231, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
nthuoj/NTHUOJ_web
status/status_info.py
6
2628
from datetime import datetime from django.db.models import Q from contest.contest_info import get_running_contests, \ get_freeze_time_datetime, get_contestant from contest.models import Contest from problem.models import Problem, Submission, SubmissionDetail from users.models import User from utils.user_info import validate_user, has_contest_ownership def regroup_submission(submissions): submission_groups = [] for submission in submissions: submission_groups.append({ 'grouper': submission, 'list': SubmissionDetail.objects.filter( sid=submission.id ).order_by('tid') }) return submission_groups def get_visible_submission(user): """Get all submissions that can be viewed by the given user.""" user = validate_user(user) submissions = Submission.objects.all() # Admin can view all submissions if user.has_admin_auth(): return submissions # No one can view admins' submissions submissions = submissions.exclude( user__in=User.objects.filter(user_level=User.ADMIN) ) # Invisible problem is invisible_problem = Problem.objects.filter( visible=False ).exclude( owner=user ) # Not ended contest has something to judge contests = Contest.objects.filter( is_homework=False, end_time__gte=datetime.now() ) for contest in contests: # Those who don't have contest ownership has some limitations if not has_contest_ownership(user, contest): # 1. Can't view contest owner/coowners' submission before the end submissions = submissions.exclude( Q(user__in=contest.coowner.all()) | Q(user=contest.owner), problem__in=contest.problem.all(), submit_time__gte=contest.creation_time ) # 2. Can't view other contestants' submission after contest freeze submissions = submissions.exclude( user=get_contestant(contest).exclude(username=user.username), problem__in=contest.problem.all(), submit_time__gte=get_freeze_time_datetime(contest) ) else: # Exclude contest problem from invlsible problem for owner/coowners invisible_problem = invisible_problem.exclude( id__in=contest.problem.filter(visible=False).values_list('id', flat=True) ) # Invisible problems' submission can't be seen submissions = submissions.exclude( problem__in=invisible_problem ) return submissions
mit
[ 504, 2197, 492, 2197, 199, 504, 1639, 14, 697, 14, 992, 492, 1413, 199, 199, 504, 406, 396, 14, 388, 396, 63, 815, 492, 664, 63, 5720, 63, 388, 2219, 12, 971, 272, 664, 63, 18459, 63, 521, 63, 2083, 12, 664, 63, 388, 396, 867, 199, 504, 406, 396, 14, 992, 492, 1448, 396, 199, 504, 5160, 14, 992, 492, 20980, 12, 4804, 2250, 12, 4804, 2250, 8064, 199, 504, 4390, 14, 992, 492, 2876, 199, 504, 3778, 14, 751, 63, 815, 492, 4107, 63, 751, 12, 965, 63, 388, 396, 63, 22495, 421, 199, 318, 295, 923, 63, 12542, 8, 29752, 304, 272, 13071, 63, 2634, 275, 942, 272, 367, 13071, 315, 30399, 26, 267, 13071, 63, 2634, 14, 740, 2561, 288, 283, 923, 281, 356, 13071, 12, 288, 283, 513, 356, 4804, 2250, 8064, 14, 1462, 14, 1541, 8, 355, 15764, 29, 12542, 14, 344, 288, 7092, 1648, 63, 991, 360, 5700, 358, 267, 3828, 339, 372, 13071, 63, 2634, 421, 199, 318, 664, 63, 6604, 63, 12542, 8, 751, 304, 272, 408, 1002, 1006, 30399, 626, 883, 506, 2455, 379, 701, 314, 1627, 922, 1041, 272, 922, 275, 4107, 63, 751, 8, 751, 9, 272, 30399, 275, 4804, 2250, 14, 1462, 14, 452, 342, 339, 327, 9516, 883, 2455, 1006, 30399, 272, 340, 922, 14, 1989, 63, 2113, 63, 1178, 837, 267, 372, 30399, 339, 327, 3091, 1373, 883, 2455, 4628, 83, 7, 30399, 272, 30399, 275, 30399, 14, 5473, 8, 267, 922, 363, 262, 29, 1899, 14, 1462, 14, 1541, 8, 751, 63, 1896, 29, 1899, 14, 14288, 9, 272, 776, 339, 327, 1010, 6604, 5160, 365, 272, 315, 6604, 63, 6462, 275, 20980, 14, 1462, 14, 1541, 8, 267, 8917, 29, 797, 272, 7092, 5473, 8, 267, 5771, 29, 751, 272, 776, 339, 327, 2832, 22480, 406, 396, 965, 6020, 370, 1335, 16603, 272, 406, 2219, 275, 1448, 396, 14, 1462, 14, 1541, 8, 267, 365, 63, 4219, 800, 29, 797, 12, 267, 1284, 63, 521, 363, 19586, 29, 2083, 14, 2131, 342, 272, 776, 272, 367, 406, 396, 315, 406, 2219, 26, 267, 327, 18049, 261, 3963, 2793, 1133, 1172, 406, 396, 12715, 965, 2005, 4204, 267, 340, 440, 965, 63, 388, 396, 63, 22495, 8, 751, 12, 406, 396, 304, 288, 327, 413, 14, 6855, 1133, 2455, 406, 396, 5771, 15, 331, 27169, 7, 13071, 2544, 314, 1284, 288, 30399, 275, 30399, 14, 5473, 8, 355, 1413, 8, 751, 363, 262, 29, 388, 396, 14, 331, 4597, 14, 452, 1012, 1204, 1413, 8, 751, 29, 388, 396, 14, 4597, 395, 355, 5160, 363, 262, 29, 388, 396, 14, 6462, 14, 452, 1062, 355, 11482, 63, 521, 363, 19586, 29, 388, 396, 14, 8782, 63, 521, 288, 776, 288, 327, 499, 14, 6855, 1133, 2455, 1163, 406, 396, 2285, 7, 13071, 2410, 406, 396, 22778, 288, 30399, 275, 30399, 14, 5473, 8, 355, 922, 29, 362, 63, 388, 396, 867, 8, 388, 396, 680, 5473, 8, 2473, 29, 751, 14, 2473, 395, 355, 5160, 363, 262, 29, 388, 396, 14, 6462, 14, 452, 1062, 355, 11482, 63, 521, 363, 19586, 29, 362, 63, 18459, 63, 521, 63, 2083, 8, 388, 396, 9, 288, 776, 267, 587, 26, 288, 327, 28554, 406, 396, 5160, 687, 4572, 76, 1164, 5160, 367, 5771, 15, 331, 27169, 288, 315, 6604, 63, 6462, 275, 315, 6604, 63, 6462, 14, 5473, 8, 355, 1305, 363, 262, 29, 388, 396, 14, 6462, 14, 1541, 8, 6604, 29, 797, 680, 1459, 63, 513, 360, 344, 297, 6829, 29, 549, 9, 288, 776, 339, 327, 1010, 6604, 8826, 7, 13071, 883, 1133, 506, 6775, 272, 30399, 275, 30399, 14, 5473, 8, 267, 5160, 363, 262, 29, 262, 6604, 63, 6462, 272, 776, 339, 372, 30399, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2197, 492, 2197, 199, 504, 1639, 14, 697, 14, 992, 492, 1413, 199, 199, 504, 406, 396, 14, 388, 396, 63, 815, 492, 664, 63, 5720, 63, 388, 2219, 12, 971, 272, 664, 63, 18459, 63, 521, 63, 2083, 12, 664, 63, 388, 396, 867, 199, 504, 406, 396, 14, 992, 492, 1448, 396, 199, 504, 5160, 14, 992, 492, 20980, 12, 4804, 2250, 12, 4804, 2250, 8064, 199, 504, 4390, 14, 992, 492, 2876, 199, 504, 3778, 14, 751, 63, 815, 492, 4107, 63, 751, 12, 965, 63, 388, 396, 63, 22495, 421, 199, 318, 295, 923, 63, 12542, 8, 29752, 304, 272, 13071, 63, 2634, 275, 942, 272, 367, 13071, 315, 30399, 26, 267, 13071, 63, 2634, 14, 740, 2561, 288, 283, 923, 281, 356, 13071, 12, 288, 283, 513, 356, 4804, 2250, 8064, 14, 1462, 14, 1541, 8, 355, 15764, 29, 12542, 14, 344, 288, 7092, 1648, 63, 991, 360, 5700, 358, 267, 3828, 339, 372, 13071, 63, 2634, 421, 199, 318, 664, 63, 6604, 63, 12542, 8, 751, 304, 272, 408, 1002, 1006, 30399, 626, 883, 506, 2455, 379, 701, 314, 1627, 922, 1041, 272, 922, 275, 4107, 63, 751, 8, 751, 9, 272, 30399, 275, 4804, 2250, 14, 1462, 14, 452, 342, 339, 327, 9516, 883, 2455, 1006, 30399, 272, 340, 922, 14, 1989, 63, 2113, 63, 1178, 837, 267, 372, 30399, 339, 327, 3091, 1373, 883, 2455, 4628, 83, 7, 30399, 272, 30399, 275, 30399, 14, 5473, 8, 267, 922, 363, 262, 29, 1899, 14, 1462, 14, 1541, 8, 751, 63, 1896, 29, 1899, 14, 14288, 9, 272, 776, 339, 327, 1010, 6604, 5160, 365, 272, 315, 6604, 63, 6462, 275, 20980, 14, 1462, 14, 1541, 8, 267, 8917, 29, 797, 272, 7092, 5473, 8, 267, 5771, 29, 751, 272, 776, 339, 327, 2832, 22480, 406, 396, 965, 6020, 370, 1335, 16603, 272, 406, 2219, 275, 1448, 396, 14, 1462, 14, 1541, 8, 267, 365, 63, 4219, 800, 29, 797, 12, 267, 1284, 63, 521, 363, 19586, 29, 2083, 14, 2131, 342, 272, 776, 272, 367, 406, 396, 315, 406, 2219, 26, 267, 327, 18049, 261, 3963, 2793, 1133, 1172, 406, 396, 12715, 965, 2005, 4204, 267, 340, 440, 965, 63, 388, 396, 63, 22495, 8, 751, 12, 406, 396, 304, 288, 327, 413, 14, 6855, 1133, 2455, 406, 396, 5771, 15, 331, 27169, 7, 13071, 2544, 314, 1284, 288, 30399, 275, 30399, 14, 5473, 8, 355, 1413, 8, 751, 363, 262, 29, 388, 396, 14, 331, 4597, 14, 452, 1012, 1204, 1413, 8, 751, 29, 388, 396, 14, 4597, 395, 355, 5160, 363, 262, 29, 388, 396, 14, 6462, 14, 452, 1062, 355, 11482, 63, 521, 363, 19586, 29, 388, 396, 14, 8782, 63, 521, 288, 776, 288, 327, 499, 14, 6855, 1133, 2455, 1163, 406, 396, 2285, 7, 13071, 2410, 406, 396, 22778, 288, 30399, 275, 30399, 14, 5473, 8, 355, 922, 29, 362, 63, 388, 396, 867, 8, 388, 396, 680, 5473, 8, 2473, 29, 751, 14, 2473, 395, 355, 5160, 363, 262, 29, 388, 396, 14, 6462, 14, 452, 1062, 355, 11482, 63, 521, 363, 19586, 29, 362, 63, 18459, 63, 521, 63, 2083, 8, 388, 396, 9, 288, 776, 267, 587, 26, 288, 327, 28554, 406, 396, 5160, 687, 4572, 76, 1164, 5160, 367, 5771, 15, 331, 27169, 288, 315, 6604, 63, 6462, 275, 315, 6604, 63, 6462, 14, 5473, 8, 355, 1305, 363, 262, 29, 388, 396, 14, 6462, 14, 1541, 8, 6604, 29, 797, 680, 1459, 63, 513, 360, 344, 297, 6829, 29, 549, 9, 288, 776, 339, 327, 1010, 6604, 8826, 7, 13071, 883, 1133, 506, 6775, 272, 30399, 275, 30399, 14, 5473, 8, 267, 5160, 363, 262, 29, 262, 6604, 63, 6462, 272, 776, 339, 372, 30399, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
rwillmer/django
tests/unmanaged_models/tests.py
296
2174
from __future__ import unicode_literals from django.db import connection from django.test import TestCase from .models import A01, A02, B01, B02, C01, C02, Managed1, Unmanaged2 class SimpleTests(TestCase): def test_simple(self): """ The main test here is that the all the models can be created without any database errors. We can also do some more simple insertion and lookup tests whilst we're here to show that the second of models do refer to the tables from the first set. """ # Insert some data into one set of models. a = A01.objects.create(f_a="foo", f_b=42) B01.objects.create(fk_a=a, f_a="fred", f_b=1729) c = C01.objects.create(f_a="barney", f_b=1) c.mm_a = [a] # ... and pull it out via the other set. a2 = A02.objects.all()[0] self.assertIsInstance(a2, A02) self.assertEqual(a2.f_a, "foo") b2 = B02.objects.all()[0] self.assertIsInstance(b2, B02) self.assertEqual(b2.f_a, "fred") self.assertIsInstance(b2.fk_a, A02) self.assertEqual(b2.fk_a.f_a, "foo") self.assertEqual(list(C02.objects.filter(f_a=None)), []) resp = list(C02.objects.filter(mm_a=a.id)) self.assertEqual(len(resp), 1) self.assertIsInstance(resp[0], C02) self.assertEqual(resp[0].f_a, 'barney') class ManyToManyUnmanagedTests(TestCase): def test_many_to_many_between_unmanaged(self): """ The intermediary table between two unmanaged models should not be created. """ table = Unmanaged2._meta.get_field('mm').m2m_db_table() tables = connection.introspection.table_names() self.assertNotIn(table, tables, "Table '%s' should not exist, but it does." % table) def test_many_to_many_between_unmanaged_and_managed(self): """ An intermediary table between a managed and an unmanaged model should be created. """ table = Managed1._meta.get_field('mm').m2m_db_table() tables = connection.introspection.table_names() self.assertIn(table, tables, "Table '%s' does not exist." % table)
bsd-3-clause
[ 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1950, 199, 504, 1639, 14, 396, 492, 7640, 199, 199, 504, 1275, 992, 492, 437, 614, 12, 437, 996, 12, 699, 614, 12, 699, 996, 12, 445, 614, 12, 445, 996, 12, 4688, 6028, 17, 12, 1910, 11122, 18, 421, 199, 533, 5870, 2925, 8, 1746, 304, 339, 347, 511, 63, 4129, 8, 277, 304, 267, 408, 267, 710, 2446, 511, 2348, 365, 626, 314, 1006, 314, 1709, 883, 506, 2737, 1928, 267, 1263, 3050, 2552, 14, 2136, 883, 2597, 886, 2005, 1655, 3486, 22470, 436, 267, 4237, 2295, 704, 382, 270, 781, 3984, 2348, 370, 2498, 626, 314, 3499, 402, 1709, 886, 267, 10618, 370, 314, 6716, 687, 314, 1642, 663, 14, 267, 408, 267, 327, 15496, 2005, 666, 1901, 1373, 663, 402, 1709, 14, 267, 282, 275, 437, 614, 14, 1462, 14, 981, 8, 70, 63, 65, 628, 1421, 401, 289, 63, 66, 29, 2260, 9, 267, 699, 614, 14, 1462, 14, 981, 8, 9010, 63, 65, 29, 65, 12, 289, 63, 65, 628, 22980, 401, 289, 63, 66, 29, 1196, 1398, 9, 267, 286, 275, 445, 614, 14, 1462, 14, 981, 8, 70, 63, 65, 628, 1700, 23263, 401, 289, 63, 66, 29, 17, 9, 267, 286, 14, 596, 63, 65, 275, 359, 65, 61, 398, 327, 2263, 436, 10299, 652, 734, 4799, 314, 1163, 663, 14, 267, 282, 18, 275, 437, 996, 14, 1462, 14, 452, 3430, 16, 61, 267, 291, 14, 6926, 8, 65, 18, 12, 437, 996, 9, 267, 291, 14, 629, 8, 65, 18, 14, 70, 63, 65, 12, 298, 1421, 531, 398, 330, 18, 275, 699, 996, 14, 1462, 14, 452, 3430, 16, 61, 267, 291, 14, 6926, 8, 66, 18, 12, 699, 996, 9, 267, 291, 14, 629, 8, 66, 18, 14, 70, 63, 65, 12, 298, 22980, 531, 398, 291, 14, 6926, 8, 66, 18, 14, 9010, 63, 65, 12, 437, 996, 9, 267, 291, 14, 629, 8, 66, 18, 14, 9010, 63, 65, 14, 70, 63, 65, 12, 298, 1421, 531, 398, 291, 14, 629, 8, 513, 8, 35, 996, 14, 1462, 14, 1541, 8, 70, 63, 65, 29, 403, 1826, 3073, 398, 3085, 275, 769, 8, 35, 996, 14, 1462, 14, 1541, 8, 596, 63, 65, 29, 65, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 4518, 395, 413, 9, 398, 291, 14, 6926, 8, 4518, 59, 16, 467, 445, 996, 9, 267, 291, 14, 629, 8, 4518, 59, 16, 1055, 70, 63, 65, 12, 283, 1700, 23263, 358, 421, 199, 533, 15517, 6749, 1358, 11122, 2925, 8, 1746, 304, 339, 347, 511, 63, 3479, 63, 475, 63, 3479, 63, 13007, 63, 324, 11122, 8, 277, 304, 267, 408, 267, 710, 1640, 30747, 1817, 3382, 2877, 625, 11122, 1709, 1077, 440, 506, 2737, 14, 267, 408, 267, 1817, 275, 1910, 11122, 18, 423, 2024, 14, 362, 63, 698, 360, 596, 1959, 77, 18, 77, 63, 697, 63, 1224, 342, 267, 6716, 275, 1950, 14, 21627, 14, 1224, 63, 1247, 342, 267, 291, 14, 8795, 8, 1224, 12, 6716, 12, 298, 3186, 1543, 83, 7, 1077, 440, 2187, 12, 1325, 652, 1630, 2122, 450, 1817, 9, 339, 347, 511, 63, 3479, 63, 475, 63, 3479, 63, 13007, 63, 324, 11122, 63, 460, 63, 11122, 8, 277, 304, 267, 408, 267, 1626, 1640, 30747, 1817, 3382, 282, 12883, 436, 376, 625, 11122, 1402, 1077, 506, 2737, 14, 267, 408, 267, 1817, 275, 4688, 6028, 17, 423, 2024, 14, 362, 63, 698, 360, 596, 1959, 77, 18, 77, 63, 697, 63, 1224, 342, 267, 6716, 275, 1950, 14, 21627, 14, 1224, 63, 1247, 342, 267, 291, 14, 4080, 8, 1224, 12, 6716, 12, 298, 3186, 1543, 83, 7, 1630, 440, 2187, 2122, 450, 1817, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1950, 199, 504, 1639, 14, 396, 492, 7640, 199, 199, 504, 1275, 992, 492, 437, 614, 12, 437, 996, 12, 699, 614, 12, 699, 996, 12, 445, 614, 12, 445, 996, 12, 4688, 6028, 17, 12, 1910, 11122, 18, 421, 199, 533, 5870, 2925, 8, 1746, 304, 339, 347, 511, 63, 4129, 8, 277, 304, 267, 408, 267, 710, 2446, 511, 2348, 365, 626, 314, 1006, 314, 1709, 883, 506, 2737, 1928, 267, 1263, 3050, 2552, 14, 2136, 883, 2597, 886, 2005, 1655, 3486, 22470, 436, 267, 4237, 2295, 704, 382, 270, 781, 3984, 2348, 370, 2498, 626, 314, 3499, 402, 1709, 886, 267, 10618, 370, 314, 6716, 687, 314, 1642, 663, 14, 267, 408, 267, 327, 15496, 2005, 666, 1901, 1373, 663, 402, 1709, 14, 267, 282, 275, 437, 614, 14, 1462, 14, 981, 8, 70, 63, 65, 628, 1421, 401, 289, 63, 66, 29, 2260, 9, 267, 699, 614, 14, 1462, 14, 981, 8, 9010, 63, 65, 29, 65, 12, 289, 63, 65, 628, 22980, 401, 289, 63, 66, 29, 1196, 1398, 9, 267, 286, 275, 445, 614, 14, 1462, 14, 981, 8, 70, 63, 65, 628, 1700, 23263, 401, 289, 63, 66, 29, 17, 9, 267, 286, 14, 596, 63, 65, 275, 359, 65, 61, 398, 327, 2263, 436, 10299, 652, 734, 4799, 314, 1163, 663, 14, 267, 282, 18, 275, 437, 996, 14, 1462, 14, 452, 3430, 16, 61, 267, 291, 14, 6926, 8, 65, 18, 12, 437, 996, 9, 267, 291, 14, 629, 8, 65, 18, 14, 70, 63, 65, 12, 298, 1421, 531, 398, 330, 18, 275, 699, 996, 14, 1462, 14, 452, 3430, 16, 61, 267, 291, 14, 6926, 8, 66, 18, 12, 699, 996, 9, 267, 291, 14, 629, 8, 66, 18, 14, 70, 63, 65, 12, 298, 22980, 531, 398, 291, 14, 6926, 8, 66, 18, 14, 9010, 63, 65, 12, 437, 996, 9, 267, 291, 14, 629, 8, 66, 18, 14, 9010, 63, 65, 14, 70, 63, 65, 12, 298, 1421, 531, 398, 291, 14, 629, 8, 513, 8, 35, 996, 14, 1462, 14, 1541, 8, 70, 63, 65, 29, 403, 1826, 3073, 398, 3085, 275, 769, 8, 35, 996, 14, 1462, 14, 1541, 8, 596, 63, 65, 29, 65, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 4518, 395, 413, 9, 398, 291, 14, 6926, 8, 4518, 59, 16, 467, 445, 996, 9, 267, 291, 14, 629, 8, 4518, 59, 16, 1055, 70, 63, 65, 12, 283, 1700, 23263, 358, 421, 199, 533, 15517, 6749, 1358, 11122, 2925, 8, 1746, 304, 339, 347, 511, 63, 3479, 63, 475, 63, 3479, 63, 13007, 63, 324, 11122, 8, 277, 304, 267, 408, 267, 710, 1640, 30747, 1817, 3382, 2877, 625, 11122, 1709, 1077, 440, 506, 2737, 14, 267, 408, 267, 1817, 275, 1910, 11122, 18, 423, 2024, 14, 362, 63, 698, 360, 596, 1959, 77, 18, 77, 63, 697, 63, 1224, 342, 267, 6716, 275, 1950, 14, 21627, 14, 1224, 63, 1247, 342, 267, 291, 14, 8795, 8, 1224, 12, 6716, 12, 298, 3186, 1543, 83, 7, 1077, 440, 2187, 12, 1325, 652, 1630, 2122, 450, 1817, 9, 339, 347, 511, 63, 3479, 63, 475, 63, 3479, 63, 13007, 63, 324, 11122, 63, 460, 63, 11122, 8, 277, 304, 267, 408, 267, 1626, 1640, 30747, 1817, 3382, 282, 12883, 436, 376, 625, 11122, 1402, 1077, 506, 2737, 14, 267, 408, 267, 1817, 275, 4688, 6028, 17, 423, 2024, 14, 362, 63, 698, 360, 596, 1959, 77, 18, 77, 63, 697, 63, 1224, 342, 267, 6716, 275, 1950, 14, 21627, 14, 1224, 63, 1247, 342, 267, 291, 14, 4080, 8, 1224, 12, 6716, 12, 298, 3186, 1543, 83, 7, 1630, 440, 2187, 2122, 450, 1817, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Cactuslegs/audacity-of-nope
lib-src/lv2/lv2/plugins/eg04-sampler.lv2/waflib/Tools/ifort.py
330
1460
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import re from waflib import Utils from waflib.Tools import fc,fc_config,fc_scan,ar from waflib.Configure import conf @conf def find_ifort(conf): fc=conf.find_program('ifort',var='FC') fc=conf.cmd_to_list(fc) conf.get_ifort_version(fc) conf.env.FC_NAME='IFORT' @conf def ifort_modifier_cygwin(conf): raise NotImplementedError("Ifort on cygwin not yet implemented") @conf def ifort_modifier_win32(conf): fc_config.fortran_modifier_win32(conf) @conf def ifort_modifier_darwin(conf): fc_config.fortran_modifier_darwin(conf) @conf def ifort_modifier_platform(conf): dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform() ifort_modifier_func=getattr(conf,'ifort_modifier_'+dest_os,None) if ifort_modifier_func: ifort_modifier_func() @conf def get_ifort_version(conf,fc): version_re=re.compile(r"ifort\s*\(IFORT\)\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search cmd=fc+['--version'] out,err=fc_config.getoutput(conf,cmd,stdin=False) if out: match=version_re(out) else: match=version_re(err) if not match: conf.fatal('cannot determine ifort version.') k=match.groupdict() conf.env['FC_VERSION']=(k['major'],k['minor']) def configure(conf): conf.find_ifort() conf.find_program('xiar',var='AR') conf.env.ARFLAGS='rcs' conf.fc_flags() conf.fc_add_flags() conf.ifort_modifier_platform()
gpl-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 2644, 26, 2774, 13, 24, 199, 3, 14750, 1, 4226, 440, 5283, 1, 1455, 921, 21500, 14, 31864, 14, 957, 15, 3187, 15, 4757, 15, 21500, 2706, 15, 4780, 14, 1360, 20930, 2873, 24522, 63, 1589, 63, 21500, 63, 493, 199, 199, 646, 295, 199, 504, 31380, 492, 17397, 199, 504, 31380, 14, 11654, 492, 10821, 12, 3003, 63, 888, 12, 3003, 63, 6282, 12, 285, 199, 504, 31380, 14, 17324, 492, 3743, 199, 32, 2190, 199, 318, 2342, 63, 692, 361, 8, 2190, 304, 199, 198, 3003, 29, 2190, 14, 1623, 63, 6815, 360, 692, 361, 297, 1391, 534, 4161, 358, 199, 198, 3003, 29, 2190, 14, 1760, 63, 475, 63, 513, 8, 3003, 9, 199, 198, 2190, 14, 362, 63, 692, 361, 63, 1023, 8, 3003, 9, 199, 198, 2190, 14, 1813, 14, 4161, 63, 2339, 534, 4656, 2596, 7, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 16680, 8, 2190, 304, 199, 198, 3730, 4279, 480, 3917, 361, 641, 23941, 440, 5966, 6366, 531, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 2676, 708, 8, 2190, 304, 199, 198, 3003, 63, 888, 14, 18496, 63, 18156, 63, 2676, 708, 8, 2190, 9, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 13245, 8, 2190, 304, 199, 198, 3003, 63, 888, 14, 18496, 63, 18156, 63, 13245, 8, 2190, 9, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 3246, 8, 2190, 304, 199, 198, 2614, 63, 736, 29, 2190, 14, 1813, 459, 19374, 63, 3100, 418, 269, 17397, 14, 324, 24155, 63, 1274, 63, 3246, 342, 199, 198, 692, 361, 63, 18156, 63, 1532, 29, 5675, 8, 2190, 2584, 692, 361, 63, 18156, 20013, 2614, 63, 736, 12, 403, 9, 199, 198, 692, 340, 361, 63, 18156, 63, 1532, 26, 507, 198, 692, 361, 63, 18156, 63, 1532, 342, 199, 32, 2190, 199, 318, 664, 63, 692, 361, 63, 1023, 8, 2190, 12, 3003, 304, 199, 198, 1023, 63, 264, 29, 264, 14, 2014, 8, 82, 2, 692, 361, 60, 83, 7590, 8, 4656, 2596, 13670, 83, 30957, 48, 28, 8452, 3072, 68, 10, 31477, 2229, 48, 28, 11067, 3072, 68, 10, 4186, 264, 14, 41, 680, 1733, 199, 198, 1760, 29, 3003, 11, 459, 306, 1023, 418, 199, 198, 548, 12, 1508, 29, 3003, 63, 888, 14, 362, 1199, 8, 2190, 12, 1760, 12, 6626, 29, 797, 9, 199, 198, 692, 734, 26, 507, 198, 1431, 29, 1023, 63, 264, 8, 548, 9, 199, 198, 2836, 26, 507, 198, 1431, 29, 1023, 63, 264, 8, 1508, 9, 199, 198, 692, 440, 1336, 26, 507, 198, 2190, 14, 16208, 360, 11250, 6705, 340, 361, 1015, 2659, 199, 198, 75, 29, 1431, 14, 20567, 342, 199, 198, 2190, 14, 1813, 459, 4161, 63, 4612, 418, 2687, 75, 459, 8452, 995, 75, 459, 11067, 1105, 199, 318, 7908, 8, 2190, 304, 199, 198, 2190, 14, 1623, 63, 692, 361, 342, 199, 198, 2190, 14, 1623, 63, 6815, 360, 6865, 285, 297, 1391, 534, 689, 358, 199, 198, 2190, 14, 1813, 14, 689, 4831, 534, 1195, 83, 7, 199, 198, 2190, 14, 3003, 63, 2469, 342, 199, 198, 2190, 14, 3003, 63, 525, 63, 2469, 342, 199, 198, 2190, 14, 692, 361, 63, 18156, 63, 3246, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 2644, 26, 2774, 13, 24, 199, 3, 14750, 1, 4226, 440, 5283, 1, 1455, 921, 21500, 14, 31864, 14, 957, 15, 3187, 15, 4757, 15, 21500, 2706, 15, 4780, 14, 1360, 20930, 2873, 24522, 63, 1589, 63, 21500, 63, 493, 199, 199, 646, 295, 199, 504, 31380, 492, 17397, 199, 504, 31380, 14, 11654, 492, 10821, 12, 3003, 63, 888, 12, 3003, 63, 6282, 12, 285, 199, 504, 31380, 14, 17324, 492, 3743, 199, 32, 2190, 199, 318, 2342, 63, 692, 361, 8, 2190, 304, 199, 198, 3003, 29, 2190, 14, 1623, 63, 6815, 360, 692, 361, 297, 1391, 534, 4161, 358, 199, 198, 3003, 29, 2190, 14, 1760, 63, 475, 63, 513, 8, 3003, 9, 199, 198, 2190, 14, 362, 63, 692, 361, 63, 1023, 8, 3003, 9, 199, 198, 2190, 14, 1813, 14, 4161, 63, 2339, 534, 4656, 2596, 7, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 16680, 8, 2190, 304, 199, 198, 3730, 4279, 480, 3917, 361, 641, 23941, 440, 5966, 6366, 531, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 2676, 708, 8, 2190, 304, 199, 198, 3003, 63, 888, 14, 18496, 63, 18156, 63, 2676, 708, 8, 2190, 9, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 13245, 8, 2190, 304, 199, 198, 3003, 63, 888, 14, 18496, 63, 18156, 63, 13245, 8, 2190, 9, 199, 32, 2190, 199, 318, 340, 361, 63, 18156, 63, 3246, 8, 2190, 304, 199, 198, 2614, 63, 736, 29, 2190, 14, 1813, 459, 19374, 63, 3100, 418, 269, 17397, 14, 324, 24155, 63, 1274, 63, 3246, 342, 199, 198, 692, 361, 63, 18156, 63, 1532, 29, 5675, 8, 2190, 2584, 692, 361, 63, 18156, 20013, 2614, 63, 736, 12, 403, 9, 199, 198, 692, 340, 361, 63, 18156, 63, 1532, 26, 507, 198, 692, 361, 63, 18156, 63, 1532, 342, 199, 32, 2190, 199, 318, 664, 63, 692, 361, 63, 1023, 8, 2190, 12, 3003, 304, 199, 198, 1023, 63, 264, 29, 264, 14, 2014, 8, 82, 2, 692, 361, 60, 83, 7590, 8, 4656, 2596, 13670, 83, 30957, 48, 28, 8452, 3072, 68, 10, 31477, 2229, 48, 28, 11067, 3072, 68, 10, 4186, 264, 14, 41, 680, 1733, 199, 198, 1760, 29, 3003, 11, 459, 306, 1023, 418, 199, 198, 548, 12, 1508, 29, 3003, 63, 888, 14, 362, 1199, 8, 2190, 12, 1760, 12, 6626, 29, 797, 9, 199, 198, 692, 734, 26, 507, 198, 1431, 29, 1023, 63, 264, 8, 548, 9, 199, 198, 2836, 26, 507, 198, 1431, 29, 1023, 63, 264, 8, 1508, 9, 199, 198, 692, 440, 1336, 26, 507, 198, 2190, 14, 16208, 360, 11250, 6705, 340, 361, 1015, 2659, 199, 198, 75, 29, 1431, 14, 20567, 342, 199, 198, 2190, 14, 1813, 459, 4161, 63, 4612, 418, 2687, 75, 459, 8452, 995, 75, 459, 11067, 1105, 199, 318, 7908, 8, 2190, 304, 199, 198, 2190, 14, 1623, 63, 692, 361, 342, 199, 198, 2190, 14, 1623, 63, 6815, 360, 6865, 285, 297, 1391, 534, 689, 358, 199, 198, 2190, 14, 1813, 14, 689, 4831, 534, 1195, 83, 7, 199, 198, 2190, 14, 3003, 63, 2469, 342, 199, 198, 2190, 14, 3003, 63, 525, 63, 2469, 342, 199, 198, 2190, 14, 692, 361, 63, 18156, 63, 3246, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
mfraezz/osf.io
admin/subjects/views.py
11
1344
from django.contrib.auth.mixins import PermissionRequiredMixin from django.core.urlresolvers import reverse_lazy from django.views.generic import ListView, UpdateView from admin.subjects.forms import SubjectForm from osf.models.subject import Subject from osf.models.provider import PreprintProvider class SubjectListView(PermissionRequiredMixin, ListView): model = Subject permission_required = 'osf.view_subject' paginate_by = 100 raise_exception = True def get_queryset(self): req_obj = self.request.GET qs = super(SubjectListView, self).get_queryset().order_by('text') if PreprintProvider.objects.filter(_id=req_obj.get('provider_id')).exists(): qs = qs.filter(provider___id=req_obj.get('provider_id')) return qs def get_context_data(self, **kwargs): context = super(SubjectListView, self).get_context_data(**kwargs) context['filterable_provider_ids'] = dict({'': '---'}, **dict(PreprintProvider.objects.values_list('_id', 'name'))) return context class SubjectUpdateView(PermissionRequiredMixin, UpdateView): form_class = SubjectForm model = SubjectForm.Meta.model permission_required = 'osf.change_subject' raise_exception = True def get_success_url(self, *args, **kwargs): return reverse_lazy('subjects:list')
apache-2.0
[ 504, 1639, 14, 2828, 14, 1178, 14, 30192, 492, 8779, 8030, 4256, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 63, 6395, 199, 504, 1639, 14, 4196, 14, 6767, 492, 3820, 2768, 12, 6162, 2768, 199, 199, 504, 4628, 14, 25660, 14, 3351, 492, 26793, 2821, 199, 504, 747, 70, 14, 992, 14, 5875, 492, 26793, 199, 504, 747, 70, 14, 992, 14, 3780, 492, 510, 1155, 672, 6663, 421, 199, 533, 26793, 23239, 8, 7980, 8030, 4256, 12, 3820, 2768, 304, 272, 1402, 275, 26793, 272, 4983, 63, 2427, 275, 283, 20923, 14, 1345, 63, 5875, 7, 272, 9881, 23043, 63, 991, 275, 2948, 272, 746, 63, 1971, 275, 715, 339, 347, 664, 63, 7924, 8, 277, 304, 267, 2648, 63, 1113, 275, 291, 14, 1069, 14, 2970, 267, 6377, 275, 1613, 8, 13528, 23239, 12, 291, 680, 362, 63, 7924, 1252, 1648, 63, 991, 360, 505, 358, 267, 340, 510, 1155, 672, 6663, 14, 1462, 14, 1541, 1547, 344, 29, 2103, 63, 1113, 14, 362, 360, 3780, 63, 344, 11103, 2444, 837, 288, 6377, 275, 6377, 14, 1541, 8, 3780, 8989, 344, 29, 2103, 63, 1113, 14, 362, 360, 3780, 63, 344, 1333, 267, 372, 6377, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 1067, 275, 1613, 8, 13528, 23239, 12, 291, 680, 362, 63, 1100, 63, 576, 3682, 958, 9, 267, 1067, 459, 1289, 13048, 63, 3780, 63, 1580, 418, 275, 1211, 3252, 356, 283, 2595, 2267, 1011, 807, 8, 24001, 672, 6663, 14, 1462, 14, 1459, 63, 513, 6412, 344, 297, 283, 354, 7058, 267, 372, 1067, 199, 199, 533, 26793, 4152, 2768, 8, 7980, 8030, 4256, 12, 6162, 2768, 304, 272, 1824, 63, 533, 275, 26793, 2821, 272, 1402, 275, 26793, 2821, 14, 3396, 14, 1238, 272, 4983, 63, 2427, 275, 283, 20923, 14, 1461, 63, 5875, 7, 272, 746, 63, 1971, 275, 715, 339, 347, 664, 63, 3742, 63, 633, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 3837, 63, 6395, 360, 25660, 26, 513, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1639, 14, 2828, 14, 1178, 14, 30192, 492, 8779, 8030, 4256, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 63, 6395, 199, 504, 1639, 14, 4196, 14, 6767, 492, 3820, 2768, 12, 6162, 2768, 199, 199, 504, 4628, 14, 25660, 14, 3351, 492, 26793, 2821, 199, 504, 747, 70, 14, 992, 14, 5875, 492, 26793, 199, 504, 747, 70, 14, 992, 14, 3780, 492, 510, 1155, 672, 6663, 421, 199, 533, 26793, 23239, 8, 7980, 8030, 4256, 12, 3820, 2768, 304, 272, 1402, 275, 26793, 272, 4983, 63, 2427, 275, 283, 20923, 14, 1345, 63, 5875, 7, 272, 9881, 23043, 63, 991, 275, 2948, 272, 746, 63, 1971, 275, 715, 339, 347, 664, 63, 7924, 8, 277, 304, 267, 2648, 63, 1113, 275, 291, 14, 1069, 14, 2970, 267, 6377, 275, 1613, 8, 13528, 23239, 12, 291, 680, 362, 63, 7924, 1252, 1648, 63, 991, 360, 505, 358, 267, 340, 510, 1155, 672, 6663, 14, 1462, 14, 1541, 1547, 344, 29, 2103, 63, 1113, 14, 362, 360, 3780, 63, 344, 11103, 2444, 837, 288, 6377, 275, 6377, 14, 1541, 8, 3780, 8989, 344, 29, 2103, 63, 1113, 14, 362, 360, 3780, 63, 344, 1333, 267, 372, 6377, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 1067, 275, 1613, 8, 13528, 23239, 12, 291, 680, 362, 63, 1100, 63, 576, 3682, 958, 9, 267, 1067, 459, 1289, 13048, 63, 3780, 63, 1580, 418, 275, 1211, 3252, 356, 283, 2595, 2267, 1011, 807, 8, 24001, 672, 6663, 14, 1462, 14, 1459, 63, 513, 6412, 344, 297, 283, 354, 7058, 267, 372, 1067, 199, 199, 533, 26793, 4152, 2768, 8, 7980, 8030, 4256, 12, 6162, 2768, 304, 272, 1824, 63, 533, 275, 26793, 2821, 272, 1402, 275, 26793, 2821, 14, 3396, 14, 1238, 272, 4983, 63, 2427, 275, 283, 20923, 14, 1461, 63, 5875, 7, 272, 746, 63, 1971, 275, 715, 339, 347, 664, 63, 3742, 63, 633, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 3837, 63, 6395, 360, 25660, 26, 513, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
servo/servo
tests/wpt/web-platform-tests/webdriver/tests/get_element_css_value/user_prompts.py
16
4163
# META: timeout=long import pytest from tests.support.asserts import assert_error, assert_success, assert_dialog_handled def get_element_css_value(session, element_id, prop): return session.transport.send( "GET", "session/{session_id}/element/{element_id}/css/{prop}".format( session_id=session.session_id, element_id=element_id, prop=prop ) ) @pytest.fixture def check_user_prompt_closed_without_exception(session, create_dialog, inline): def check_user_prompt_closed_without_exception(dialog_type, retval): session.url = inline("""<input style="display: block">""") element = session.find.css("input", all=False) create_dialog(dialog_type, text=dialog_type) response = get_element_css_value(session, element.id, "display") assert_success(response, "block") assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval) return check_user_prompt_closed_without_exception @pytest.fixture def check_user_prompt_closed_with_exception(session, create_dialog, inline): def check_user_prompt_closed_with_exception(dialog_type, retval): session.url = inline("""<input style="display: block">""") element = session.find.css("input", all=False) create_dialog(dialog_type, text=dialog_type) response = get_element_css_value(session, element.id, "display") assert_error(response, "unexpected alert open") assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval) return check_user_prompt_closed_with_exception @pytest.fixture def check_user_prompt_not_closed_but_exception(session, create_dialog, inline): def check_user_prompt_not_closed_but_exception(dialog_type): session.url = inline("""<input style="display: block">""") element = session.find.css("input", all=False) create_dialog(dialog_type, text=dialog_type) response = get_element_css_value(session, element.id, "display") assert_error(response, "unexpected alert open") assert session.alert.text == dialog_type session.alert.dismiss() return check_user_prompt_not_closed_but_exception @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", True), ("prompt", ""), ]) def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval): check_user_prompt_closed_without_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", True), ("prompt", ""), ]) def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval): check_user_prompt_closed_without_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"}) @pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type): check_user_prompt_not_closed_but_exception(dialog_type) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_default(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval)
mpl-2.0
[ 3, 603, 15808, 26, 2653, 29, 2809, 199, 199, 646, 4613, 199, 199, 504, 2295, 14, 4058, 14, 479, 83, 492, 702, 63, 705, 12, 702, 63, 3742, 12, 702, 63, 7196, 63, 11217, 421, 199, 318, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 63, 344, 12, 5931, 304, 272, 372, 2351, 14, 5545, 14, 2254, 8, 267, 298, 2970, 401, 267, 298, 1730, 5321, 1730, 63, 344, 5995, 2108, 5321, 2108, 63, 344, 5995, 3919, 5321, 4469, 5469, 908, 8, 288, 2351, 63, 344, 29, 1730, 14, 1730, 63, 344, 12, 288, 1819, 63, 344, 29, 2108, 63, 344, 12, 288, 5931, 29, 4469, 267, 776, 272, 776, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 3742, 8, 1310, 12, 298, 1457, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 2351, 14, 9241, 14, 505, 508, 9592, 63, 466, 267, 2351, 14, 9241, 14, 32439, 342, 339, 372, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 4247, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 401, 2097, 9241, 401, 298, 9548, 401, 298, 7650, 3135, 199, 318, 511, 63, 4247 ]
[ 603, 15808, 26, 2653, 29, 2809, 199, 199, 646, 4613, 199, 199, 504, 2295, 14, 4058, 14, 479, 83, 492, 702, 63, 705, 12, 702, 63, 3742, 12, 702, 63, 7196, 63, 11217, 421, 199, 318, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 63, 344, 12, 5931, 304, 272, 372, 2351, 14, 5545, 14, 2254, 8, 267, 298, 2970, 401, 267, 298, 1730, 5321, 1730, 63, 344, 5995, 2108, 5321, 2108, 63, 344, 5995, 3919, 5321, 4469, 5469, 908, 8, 288, 2351, 63, 344, 29, 1730, 14, 1730, 63, 344, 12, 288, 1819, 63, 344, 29, 2108, 63, 344, 12, 288, 5931, 29, 4469, 267, 776, 272, 776, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 3742, 8, 1310, 12, 298, 1457, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 12, 8308, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 304, 267, 2351, 14, 633, 275, 8308, 4852, 28, 1210, 3449, 628, 2918, 26, 1853, 1743, 6141, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 1210, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 664, 63, 2108, 63, 3919, 63, 585, 8, 1730, 12, 1819, 14, 344, 12, 298, 2918, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 2351, 14, 9241, 14, 505, 508, 9592, 63, 466, 267, 2351, 14, 9241, 14, 32439, 342, 339, 372, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 4247, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 401, 2097, 9241, 401, 298, 9548, 401, 298, 7650, 3135, 199, 318, 511, 63, 4247, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
erikge/watch_gyp
pylib/gyp/generator/gypsh.py
2779
1665
# Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """gypsh output module gypsh is a GYP shell. It's not really a generator per se. All it does is fire up an interactive Python session with a few local variables set to the variables passed to the generator. Like gypd, it's intended as a debugging aid, to facilitate the exploration of .gyp structures after being processed by the input module. The expected usage is "gyp -f gypsh -D OS=desired_os". """ import code import sys # All of this stuff about generator variables was lovingly ripped from gypd.py. # That module has a much better description of what's going on and why. _generator_identity_variables = [ 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', 'INTERMEDIATE_DIR', 'PRODUCT_DIR', 'RULE_INPUT_ROOT', 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', 'RULE_INPUT_NAME', 'RULE_INPUT_PATH', 'SHARED_INTERMEDIATE_DIR', ] generator_default_variables = { } for v in _generator_identity_variables: generator_default_variables[v] = '<(%s)' % v def GenerateOutput(target_list, target_dicts, data, params): locals = { 'target_list': target_list, 'target_dicts': target_dicts, 'data': data, } # Use a banner that looks like the stock Python one and like what # code.interact uses by default, but tack on something to indicate what # locals are available, and identify gypsh. banner='Python %s on %s\nlocals.keys() = %s\ngypsh' % \ (sys.version, sys.platform, repr(sorted(locals.keys()))) code.interact(banner, local=locals)
bsd-3-clause
[ 3, 1898, 334, 67, 9, 7760, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 6179, 609, 1072, 859, 199, 199, 6179, 609, 365, 282, 25686, 5218, 14, 221, 2779, 1159, 440, 7710, 282, 4306, 1126, 542, 14, 221, 2900, 652, 1630, 365, 199, 8935, 1536, 376, 12777, 2018, 2351, 543, 282, 9284, 2257, 2860, 663, 370, 314, 199, 3669, 3032, 370, 314, 4306, 14, 221, 16485, 4902, 68, 12, 652, 1159, 11619, 465, 282, 10201, 199, 21745, 12, 370, 30242, 1051, 323, 314, 31337, 402, 1275, 6179, 13955, 2410, 3769, 7686, 199, 991, 314, 1324, 859, 14, 199, 199, 1918, 1420, 4503, 365, 298, 6179, 446, 70, 4902, 609, 446, 36, 4403, 29, 16035, 63, 736, 1674, 199, 624, 421, 199, 646, 1233, 199, 646, 984, 421, 199, 3, 2900, 402, 642, 8292, 3595, 4306, 2860, 1990, 560, 4007, 590, 8012, 80, 1915, 687, 4902, 68, 14, 647, 14, 199, 3, 10314, 859, 965, 282, 8298, 8034, 1369, 402, 4052, 1159, 9995, 641, 436, 10842, 14, 199, 63, 4679, 63, 5582, 63, 3669, 275, 359, 523, 283, 21623, 63, 6351, 297, 523, 283, 21623, 63, 12273, 297, 523, 283, 23227, 63, 3022, 297, 523, 283, 14853, 63, 3022, 297, 523, 283, 13578, 63, 7321, 63, 5441, 297, 523, 283, 13578, 63, 7321, 63, 3022, 2339, 297, 523, 283, 13578, 63, 7321, 63, 2472, 297, 523, 283, 13578, 63, 7321, 63, 2339, 297, 523, 283, 13578, 63, 7321, 63, 3243, 297, 523, 283, 13772, 63, 23227, 63, 3022, 297, 199, 61, 199, 199, 4679, 63, 885, 63, 3669, 275, 469, 199, 93, 199, 199, 509, 373, 315, 485, 4679, 63, 5582, 63, 3669, 26, 523, 4306, 63, 885, 63, 3669, 59, 86, 61, 275, 2650, 4042, 83, 3171, 450, 373, 421, 199, 318, 7958, 2959, 8, 1375, 63, 513, 12, 1347, 63, 7892, 12, 666, 12, 1862, 304, 523, 9480, 275, 469, 267, 283, 1375, 63, 513, 356, 221, 1347, 63, 513, 12, 267, 283, 1375, 63, 7892, 356, 1347, 63, 7892, 12, 267, 283, 576, 356, 260, 666, 12, 489, 789, 819, 327, 3645, 282, 20997, 626, 10734, 2839, 314, 10952, 2018, 1373, 436, 2839, 4052, 523, 327, 1233, 14, 25850, 4440, 701, 849, 12, 1325, 307, 564, 641, 6020, 370, 6623, 4052, 523, 327, 9480, 787, 2808, 12, 436, 10405, 4902, 609, 14, 523, 20997, 534, 4718, 450, 83, 641, 450, 83, 60, 78, 9350, 14, 1612, 342, 275, 450, 83, 60, 2753, 2279, 609, 7, 450, 971, 268, 334, 1274, 14, 1023, 12, 984, 14, 3246, 12, 4700, 8, 5917, 8, 9350, 14, 1612, 16890, 819, 1233, 14, 25850, 8, 13066, 12, 2257, 29, 9350, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 334, 67, 9, 7760, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 6179, 609, 1072, 859, 199, 199, 6179, 609, 365, 282, 25686, 5218, 14, 221, 2779, 1159, 440, 7710, 282, 4306, 1126, 542, 14, 221, 2900, 652, 1630, 365, 199, 8935, 1536, 376, 12777, 2018, 2351, 543, 282, 9284, 2257, 2860, 663, 370, 314, 199, 3669, 3032, 370, 314, 4306, 14, 221, 16485, 4902, 68, 12, 652, 1159, 11619, 465, 282, 10201, 199, 21745, 12, 370, 30242, 1051, 323, 314, 31337, 402, 1275, 6179, 13955, 2410, 3769, 7686, 199, 991, 314, 1324, 859, 14, 199, 199, 1918, 1420, 4503, 365, 298, 6179, 446, 70, 4902, 609, 446, 36, 4403, 29, 16035, 63, 736, 1674, 199, 624, 421, 199, 646, 1233, 199, 646, 984, 421, 199, 3, 2900, 402, 642, 8292, 3595, 4306, 2860, 1990, 560, 4007, 590, 8012, 80, 1915, 687, 4902, 68, 14, 647, 14, 199, 3, 10314, 859, 965, 282, 8298, 8034, 1369, 402, 4052, 1159, 9995, 641, 436, 10842, 14, 199, 63, 4679, 63, 5582, 63, 3669, 275, 359, 523, 283, 21623, 63, 6351, 297, 523, 283, 21623, 63, 12273, 297, 523, 283, 23227, 63, 3022, 297, 523, 283, 14853, 63, 3022, 297, 523, 283, 13578, 63, 7321, 63, 5441, 297, 523, 283, 13578, 63, 7321, 63, 3022, 2339, 297, 523, 283, 13578, 63, 7321, 63, 2472, 297, 523, 283, 13578, 63, 7321, 63, 2339, 297, 523, 283, 13578, 63, 7321, 63, 3243, 297, 523, 283, 13772, 63, 23227, 63, 3022, 297, 199, 61, 199, 199, 4679, 63, 885, 63, 3669, 275, 469, 199, 93, 199, 199, 509, 373, 315, 485, 4679, 63, 5582, 63, 3669, 26, 523, 4306, 63, 885, 63, 3669, 59, 86, 61, 275, 2650, 4042, 83, 3171, 450, 373, 421, 199, 318, 7958, 2959, 8, 1375, 63, 513, 12, 1347, 63, 7892, 12, 666, 12, 1862, 304, 523, 9480, 275, 469, 267, 283, 1375, 63, 513, 356, 221, 1347, 63, 513, 12, 267, 283, 1375, 63, 7892, 356, 1347, 63, 7892, 12, 267, 283, 576, 356, 260, 666, 12, 489, 789, 819, 327, 3645, 282, 20997, 626, 10734, 2839, 314, 10952, 2018, 1373, 436, 2839, 4052, 523, 327, 1233, 14, 25850, 4440, 701, 849, 12, 1325, 307, 564, 641, 6020, 370, 6623, 4052, 523, 327, 9480, 787, 2808, 12, 436, 10405, 4902, 609, 14, 523, 20997, 534, 4718, 450, 83, 641, 450, 83, 60, 78, 9350, 14, 1612, 342, 275, 450, 83, 60, 2753, 2279, 609, 7, 450, 971, 268, 334, 1274, 14, 1023, 12, 984, 14, 3246, 12, 4700, 8, 5917, 8, 9350, 14, 1612, 16890, 819, 1233, 14, 25850, 8, 13066, 12, 2257, 29, 9350, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
msincenselee/vnpy
vnpy/gateway/deribit/deribit_gateway.py
1
17944
from typing import Callable from vnpy.trader.object import ( TickData, OrderData, TradeData, PositionData, AccountData, ContractData, OrderRequest, CancelRequest, SubscribeRequest, HistoryRequest, ) from vnpy.trader.constant import ( Direction, Offset, Exchange, OrderType, Product, Status, OptionType ) from vnpy.trader.gateway import BaseGateway from vnpy.api.websocket import WebsocketClient from datetime import datetime from copy import copy WEBSOCKET_HOST = "wss://www.deribit.com/ws/api/v2" PRODUCT_DERIBIT2VT = { "future": Product.FUTURES, "option": Product.OPTION } OPTIONTYPE_DERIBIT2VT = { "call": OptionType.CALL, "put": OptionType.PUT } DIRECTION_VT2DERIBIT = {Direction.LONG: "buy", Direction.SHORT: "sell"} ORDERTYPE_VT2DERIBIT = { OrderType.LIMIT: "limit", OrderType.MARKET: "market", } ORDERTYPE_DERIBIT2VT = {v: k for k, v in ORDERTYPE_VT2DERIBIT.items()} DIRECTION_DERIBIT2VT = {v: k for k, v in DIRECTION_VT2DERIBIT.items()} STATUS_DERIBIT2VT = { "open": Status.NOTTRADED, "filled": Status.ALLTRADED, "rejected": Status.REJECTED, "cancelled": Status.CANCELLED, } class DeribitGateway(BaseGateway): """""" default_setting = { "key": "", "secret": "", "proxy_host": "", "proxy_port": "" } exchanges = [Exchange.DERIBIT] def __init__(self, event_engine): """""" super().__init__(event_engine, "DERIBIT") self.ws_api = DeribitWebsocketApi(self) def connect(self, setting: dict): """""" key = setting["key"] secret = setting["secret"] proxy_host = setting["proxy_host"] proxy_port = setting["proxy_port"] if proxy_port.isdigit(): proxy_port = int(proxy_port) else: proxy_port = 0 self.ws_api.connect( key, secret, proxy_host, proxy_port, ) def subscribe(self, req: SubscribeRequest): """""" self.ws_api.subscribe(req) def send_order(self, req: OrderRequest): """""" return self.ws_api.send_order(req) def cancel_order(self, req: CancelRequest): """""" return self.ws_api.cancel_order(req) def query_account(self): """""" self.ws_api.query_account() def query_position(self): """ Query holding positions. """ pass def query_history(self, req: HistoryRequest): """ Query bar history data. """ pass def close(self): """""" self.ws_api.stop() class DeribitWebsocketApi(WebsocketClient): """""" def __init__(self, gateway: BaseGateway): """""" super().__init__() self.gateway = gateway self.gateway_name = gateway.gateway_name self.key = "" self.secret = "" self.access_token = "" self.reqid = 1 self.reqid_callback_map = {} self.reqid_currency_map = {} self.reqid_order_map = {} self.connect_time = 0 self.order_count = 1000000 self.local_sys_map = {} self.sys_local_map = {} self.cancel_requests = {} self.callbacks = { "ticker": self.on_ticker, "book": self.on_orderbook, "user": self.on_user_update, } self.ticks = {} def connect( self, key: str, secret: str, proxy_host: str, proxy_port: int ): """""" self.key = key self.secret = secret self.connect_time = ( int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count ) self.init(WEBSOCKET_HOST, proxy_host, proxy_port) self.start() def subscribe(self, req: SubscribeRequest): """""" symbol = req.symbol self.ticks[symbol] = TickData( gateway_name=self.gateway_name, symbol=symbol, exchange=Exchange.DERIBIT, datetime=datetime.now(), ) params = { "channels": [ f"ticker.{symbol}.100ms", f"book.{symbol}.none.10.100ms", f"user.changes.{symbol}.raw" ], "access_token": self.access_token } self.send_request("private/subscribe", params) def send_order(self, req: OrderRequest): """""" self.order_count += 1 orderid = str(self.connect_time + self.order_count) order = req.create_order_data(orderid, self.gateway_name) self.gateway.on_order(order) side = DIRECTION_VT2DERIBIT[req.direction] method = "private/" + side params = { "instrument_name": req.symbol, "amount": int(req.volume), "type": ORDERTYPE_VT2DERIBIT[req.type], "label": orderid, "price": req.price } if req.offset == Offset.CLOSE: params["reduce_only"] = True reqid = self.send_request( method, params, self.on_send_order ) self.reqid_order_map[reqid] = order return order.vt_orderid def cancel_order(self, req: CancelRequest): """""" if req.orderid not in self.local_sys_map: self.cancel_requests[req.orderid] = req return sys_id = self.local_sys_map[req.orderid] params = { "order_id": sys_id, "access_token": self.access_token, } self.send_request( "private/cancel", params, self.on_cancel_order ) def get_access_token(self): """ use the access key and secret to get access token """ params = { "grant_type": "client_credentials", "client_id": self.key, "client_secret": self.secret } self.send_request( "public/auth", params, self.on_access_token ) def query_instrument(self): """""" for currency in ["BTC", "ETH"]: params = { "currency": currency, "expired": False, } self.send_request( "public/get_instruments", params, self.on_query_instrument ) def query_account(self): """""" for currency in ["BTC", "ETH"]: params = { "currency": currency, "access_token": self.access_token } self.send_request( "private/get_account_summary", params, self.on_query_account ) def query_position(self): """""" for currency in ["BTC", "ETH"]: params = { "currency": currency, "access_token": self.access_token } self.send_request( "private/get_positions", params, self.on_query_position ) def query_order(self): """""" for currency in ["BTC", "ETH"]: params = { "currency": currency, "access_token": self.access_token } self.send_request( "private/get_open_orders_by_currency", params, self.on_query_order ) def on_connected(self): """ Callback when websocket is connected successfully. """ self.gateway.write_log("服务器连接成功") self.get_access_token() self.query_instrument() def on_disconnected(self): """ Callback when websocket connection is lost. """ self.gateway.write_log("服务器连接断开") def on_packet(self, packet: dict): """ callback when data is received and unpacked """ if "id" in packet: packet_id = packet["id"] if packet_id in self.reqid_callback_map.keys(): callback = self.reqid_callback_map[packet_id] callback(packet) elif "params" in packet: channel = packet["params"]["channel"] kind = channel.split(".")[0] callback = self.callbacks[kind] callback(packet) def on_access_token(self, packet: dict): """""" data = packet["result"] self.access_token = data["access_token"] self.gateway.write_log("服务器登录成功") self.query_position() self.query_account() self.query_order() # Subscribe to account update params = { "channels": [ "user.portfolio.btc", "user.portfolio.eth" ], "access_token": self.access_token } self.send_request("private/subscribe", params) def on_query_instrument(self, packet: dict): """""" currency = self.reqid_currency_map[packet["id"]] for d in packet["result"]: contract = ContractData( symbol=d["instrument_name"], exchange=Exchange.DERIBIT, name=d["instrument_name"], product=PRODUCT_DERIBIT2VT[d["kind"]], pricetick=d["tick_size"], size=d["contract_size"], min_volume=d["min_trade_amount"], net_position=True, history_data=False, gateway_name=self.gateway_name, ) if contract.product == Product.OPTION: contract.option_portfolio = d["base_currency"] contract.option_strike = d["strike"] contract.option_index = str(d["strike"]) contract.option_underlying = d["base_currency"] contract.option_type = OPTIONTYPE_DERIBIT2VT[d["option_type"]] contract.option_expiry = datetime.fromtimestamp( d["expiration_timestamp"] / 1000 ) self.gateway.on_contract(contract) self.gateway.write_log(f"{currency}合约信息查询成功") def on_query_position(self, packet: dict): """""" data = packet["result"] currency = self.reqid_currency_map[packet["id"]] for pos in data: position = PositionData( symbol=pos["instrument_name"], exchange=Exchange.DERIBIT, direction=Direction.NET, volume=pos["size"], pnl=float(pos["floating_profit_loss"]), gateway_name=self.gateway_name, ) self.gateway.on_position(position) self.gateway.write_log(f"{currency}持仓查询成功") def on_query_account(self, packet: dict): """""" data = packet["result"] currency = data["currency"] account = AccountData( accountid=currency, balance=data["balance"], frozen=data["balance"] - data["available_funds"], gateway_name=self.gateway_name, ) self.gateway.on_account(account) self.gateway.write_log(f"{currency}资金查询成功") def on_query_order(self, packet: dict): """""" data = packet["result"] currency = self.reqid_currency_map[packet["id"]] for d in data: self.on_order(d) self.gateway.write_log(f"{currency}委托查询成功") def on_send_order(self, packet: dict): """""" error = packet.get("error", None) if not error: return msg = error["message"] reason = error["data"]["reason"] code = error["code"] self.gateway.write_log( f"委托失败,代码:{code},类型:{msg},原因:{reason}" ) order = self.reqid_order_map[packet["id"]] order.status = Status.REJECTED self.gateway.on_order(order) def on_cancel_order(self, packet: dict): """""" data = packet["result"] orderid = data["label"] order = OrderData( symbol=data["instrument_name"], exchange=Exchange.DERIBIT, type=ORDERTYPE_DERIBIT2VT[data["order_type"]], orderid=orderid, direction=DIRECTION_DERIBIT2VT[data["direction"]], price=float(data["price"]), volume=float(data["amount"]), traded=float(data["filled_amount"]), time=str(datetime.fromtimestamp(data["last_update_timestamp"] / 1000)), status=STATUS_DERIBIT2VT[data["order_state"]], gateway_name=self.gateway_name, ) self.gateway.on_order(copy(order)) def on_user_update(self, packet: dict): """""" if "portfolio" in packet["params"]["channel"]: self.on_account(packet) return data = packet["params"]["data"] trades = data["trades"] positions = data["positions"] orders = data["orders"] if orders: for order in orders: self.on_order(order) if trades: for trade in trades: self.on_trade(trade, orders[0]["order_id"]) if positions: for position in positions: self.on_position(position) def on_order(self, data: dict): """""" if data["label"]: local_id = data["label"] else: local_id = data["order_id"] sys_id = data["order_id"] self.local_sys_map[local_id] = sys_id self.sys_local_map[sys_id] = local_id order = OrderData( symbol=data["instrument_name"], exchange=Exchange.DERIBIT, type=ORDERTYPE_DERIBIT2VT[data["order_type"]], orderid=local_id, direction=DIRECTION_DERIBIT2VT[data["direction"]], price=float(data["price"]), volume=float(data["amount"]), traded=float(data["filled_amount"]), time=str(datetime.fromtimestamp(data["last_update_timestamp"] / 1000)), status=STATUS_DERIBIT2VT[data["order_state"]], gateway_name=self.gateway_name, ) if data["reduce_only"]: order.offset = Offset.CLOSE self.gateway.on_order(order) # Send cancel requests if necessary if order.orderid in self.cancel_requests: req = self.cancel_requests.pop(order.orderid) if order.is_active(): self.cancel_order(req) def on_trade(self, data: list, orderid): """""" sys_id = data["order_id"] local_id = self.sys_local_map[sys_id] trade = TradeData( symbol=data["instrument_name"], exchange=Exchange.DERIBIT, orderid=local_id, tradeid=data["trade_id"], direction=DIRECTION_DERIBIT2VT[data["direction"]], price=float(data["price"]), volume=float(data["amount"]), time=str(datetime.fromtimestamp(data["timestamp"] / 1000)), gateway_name=self.gateway_name, ) self.gateway.on_trade(trade) def on_position(self, data: dict): """""" pos = PositionData( symbol=data["instrument_name"], exchange=Exchange.DERIBIT, direction=Direction.NET, volume=data["size"], price=data["average_price"], pnl=float(data["floating_profit_loss"]), gateway_name=self.gateway_name, ) self.gateway.on_position(pos) def on_account(self, packet: dict): """""" data = packet["params"]["data"] account = AccountData( accountid=data["currency"], balance=data["balance"], frozen=data["balance"] - data["available_funds"], gateway_name=self.gateway_name, ) self.gateway.on_account(account) def on_ticker(self, packet: dict): """""" data = packet["params"]["data"] symbol = data["instrument_name"] tick = self.ticks.get(symbol, None) if not tick: return tick.last_price = data["last_price"] tick.high_price = data["stats"]["high"] tick.low_price = data["stats"]["low"] tick.volume = data["stats"]["volume"] tick.datetime = datetime.fromtimestamp(data["timestamp"] / 1000) self.gateway.on_tick(copy(tick)) def on_orderbook(self, packet: dict): """""" data = packet["params"]["data"] symbol = data["instrument_name"] bids = data["bids"] asks = data["asks"] tick = self.ticks[symbol] for i in range(min(len(bids), 5)): ix = i + 1 bp, bv = bids[i] setattr(tick, f"bid_price_{ix}", bp) setattr(tick, f"bid_volume_{ix}", bv) for i in range(min(len(asks), 5)): ix = i + 1 ap, av = asks[i] setattr(tick, f"ask_price_{ix}", ap) setattr(tick, f"ask_volume_{ix}", av) self.gateway.on_tick(copy(tick)) def send_request( self, method: str, params: dict, callback: Callable = None ): """""" self.reqid += 1 msg = { "jsonrpc": "2.0", "id": self.reqid, "method": method, "params": params } self.send_packet(msg) if callback: self.reqid_callback_map[self.reqid] = callback if "currency" in params: self.reqid_currency_map[self.reqid] = params["currency"] return self.reqid
mit
[ 504, 14090, 492, 16975, 199, 199, 504, 373, 20245, 14, 1239, 424, 14, 785, 492, 334, 272, 18742, 1451, 12, 272, 9240, 1451, 12, 272, 12643, 271, 1451, 12, 272, 15483, 1451, 12, 272, 9973, 1451, 12, 272, 1448, 6908, 1451, 12, 272, 9240, 2017, 12, 272, 28374, 2017, 12, 272, 4804, 5355, 2017, 12, 272, 27829, 2017, 12, 199, 9, 199, 504, 373, 20245, 14, 1239, 424, 14, 4083, 492, 334, 272, 25596, 414, 12, 272, 29432, 12, 272, 25655, 12, 272, 9240, 804, 12, 272, 12705, 12, 272, 9795, 12, 272, 3207, 804, 199, 9, 199, 504, 373, 20245, 14, 1239, 424, 14, 7019, 492, 3523, 12455, 199, 504, 373, 20245, 14, 1246, 14, 13508, 492, 2136, 10833, 3041, 199, 199, 504, 2197, 492, 2197, 199, 504, 1331, 492, 1331, 421, 199, 13166, 17462, 63, 5449, 275, 298, 87, 385, 921, 1544, 14, 9910, 2075, 14, 957, 15, 3569, 15, 1246, 15, 86, 18, 2, 199, 199, 14853, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 2443, 582, 12705, 14, 20254, 10799, 12, 272, 298, 1422, 582, 12705, 14, 13352, 199, 93, 199, 13352, 2711, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 1250, 582, 3207, 804, 14, 11978, 12, 272, 298, 524, 582, 3207, 804, 14, 4013, 199, 93, 199, 6098, 1075, 63, 8156, 18, 11733, 2100, 649, 275, 469, 17015, 14, 12375, 26, 298, 31240, 401, 25596, 414, 14, 13003, 26, 298, 23235, 3570, 199, 12125, 2711, 63, 8156, 18, 11733, 2100, 649, 275, 469, 272, 9240, 804, 14, 13387, 26, 298, 3097, 401, 272, 9240, 804, 14, 10520, 775, 26, 298, 22270, 401, 199, 93, 199, 12125, 2711, 63, 11733, 2100, 649, 18, 8156, 275, 469, 86, 26, 1022, 367, 1022, 12, 373, 315, 16044, 2711, 63, 8156, 18, 11733, 2100, 649, 14, 1744, 12737, 199, 6098, 1075, 63, 11733, 2100, 649, 18, 8156, 275, 469, 86, 26, 1022, 367, 1022, 12, 373, 315, 8703, 1075, 63, 8156, 18, 11733, 2100, 649, 14, 1744, 12737, 199, 6305, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 1490, 582, 9795, 14, 4609, 13954, 8280, 12, 272, 298, 17647, 582, 9795, 14, 1761, 13954, 8280, 12, 272, 298, 24054, 582, 9795, 14, 907, 5550, 1149, 12, 272, 298, 21924, 582, 9795, 14, 20707, 5290, 12, 199, 93, 421, 199, 533, 18674, 1892, 390, 12455, 8, 1563, 12455, 304, 272, 408, 624, 339, 849, 63, 6031, 275, 469, 267, 298, 498, 582, 4873, 267, 298, 4731, 582, 4873, 267, 298, 3280, 63, 1102, 582, 4873, 267, 298, 3280, 63, 719, 582, 3087, 272, 789, 339, 444, 6627, 275, 359, 13188, 14, 11733, 2100, 649, 61, 339, 347, 636, 826, 721, 277, 12, 1566, 63, 3908, 304, 267, 408, 624, 267, 1613, 11027, 826, 721, 1430, 63, 3908, 12, 298, 11733, 2100, 649, 531, 398, 291, 14, 3569, 63, 1246, 275, 18674, 1892, 390, 6004, 10833, 7394, 8, 277, 9, 339, 347, 4907, 8, 277, 12, 4260, 26, 1211, 304, 267, 408, 624, 267, 790, 275, 4260, 905, 498, 937, 267, 7565, 275, 4260, 905, 4731, 937, 267, 4566, 63, 1102, 275, 4260, 905, 3280, 63, 1102, 937, 267, 4566, 63, 719, 275, 4260, 905, 3280, 63, 719, 937, 398, 340, 4566, 63, 719, 14, 13896, 837, 288, 4566, 63, 719, 275, 1109, 8, 3280, 63, 719, 9, 267, 587, 26, 288, 4566, 63, 719, 275, 378, 398, 291, 14, 3569, 63, 1246, 14, 2242, 8, 288, 790, 12, 288, 7565, 12, 288, 4566, 63, 1102, 12, 288, 4566, 63, 719, 12, 267, 776, 339, 347, 23421, 8, 277, 12, 2648, 26, 4804, 5355, 2017, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 10108, 8, 2103, 9, 339, 347, 3222, 63, 1648, 8, 277, 12, 2648, 26, 9240, 2017, 304, 267, 408, 624, 267, 372, 291, 14, 3569, 63, 1246, 14, 2254, 63, 1648, 8, 2103, 9, 339, 347, 9311, 63, 1648, 8, 277, 12, 2648, 26, 28374, 2017, 304, 267, 408, 624, 267, 372, 291, 14, 3569, 63, 1246, 14, 6406, 63, 1648, 8, 2103, 9, 339, 347, 1827, 63, 2048, 8, 277, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 1131, 63, 2048, 342, 339, 347, 1827, 63, 3124, 8, 277, 304, 267, 408, 267, 8133, 17573, 12266, 14, 267, 408, 267, 986, 339, 347, 1827, 63, 5570, 8, 277, 12, 2648, 26, 27829, 2017, 304, 267, 408, 267, 8133, 4681, 7994, 666, 14, 267, 408, 267, 986, 339, 347, 4002, 8, 277, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 2379, 342, 421, 199, 533, 18674, 1892, 390, 6004, 10833, 7394, 8, 6004, 10833, 3041, 304, 272, 408, 624, 339, 347, 636, 826, 721, 277, 12, 10391, 26, 3523, 12455, 304, 267, 408, 624, 267, 1613, 11027, 826, 4533, 398, 291, 14, 7019, 275, 10391, 267, 291, 14, 7019, 63, 354, 275, 10391, 14, 7019, 63, 354, 398, 291, 14, 498, 275, 3087, 267, 291, 14, 4731, 275, 3087, 267, 291, 14, 2732, 63, 1418, 275, 3087, 398, 291, 14, 2103, 344, 275, 413, 267, 291, 14, 2103, 344, 63, 3058, 63, 1130, 275, 1052, 267, 291, 14, 2103, 344, 63, 4968, 63, 1130, 275, 1052, 267, 291, 14, 2103, 344, 63, 1648, 63, 1130, 275, 1052, 398, 291, 14, 2242, 63, 521, 275, 378, 267, 291, 14, 1648, 63, 835, 275, 19492, 267, 291, 14, 1832, 63, 1274, 63, 1130, 275, 1052, 267, 291, 14, 1274, 63, 1832, 63, 1130, 275, 1052, 267, 291, 14, 6406, 63, 6615, 275, 1052, 398, 291, 14, 11948, 275, 469, 288, 298, 28572, 582, 291, 14, 265, 63, 28572, 12, 288, 298, 2706, 582, 291, 14, 265, 63, 1648, 2706, 12, 288, 298, 751, 582, 291, 14, 265, 63, 751, 63, 873, 12, 267, 789, 398, 291, 14, 10406, 275, 1052, 339, 347, 4907, 8, 267, 291, 12, 267, 790, 26, 620, 12, 267, 7565, 26, 620, 12, 267, 4566, 63, 1102, 26, 620, 12, 267, 4566, 63, 719, 26, 1109, 272, 3461, 267, 408, 624, 267, 291, 14, 498, 275, 790, 267, 291, 14, 4731, 275, 7565, 398, 291, 14, 2242, 63, 521, 275, 334, 288, 1109, 8 ]
[ 14090, 492, 16975, 199, 199, 504, 373, 20245, 14, 1239, 424, 14, 785, 492, 334, 272, 18742, 1451, 12, 272, 9240, 1451, 12, 272, 12643, 271, 1451, 12, 272, 15483, 1451, 12, 272, 9973, 1451, 12, 272, 1448, 6908, 1451, 12, 272, 9240, 2017, 12, 272, 28374, 2017, 12, 272, 4804, 5355, 2017, 12, 272, 27829, 2017, 12, 199, 9, 199, 504, 373, 20245, 14, 1239, 424, 14, 4083, 492, 334, 272, 25596, 414, 12, 272, 29432, 12, 272, 25655, 12, 272, 9240, 804, 12, 272, 12705, 12, 272, 9795, 12, 272, 3207, 804, 199, 9, 199, 504, 373, 20245, 14, 1239, 424, 14, 7019, 492, 3523, 12455, 199, 504, 373, 20245, 14, 1246, 14, 13508, 492, 2136, 10833, 3041, 199, 199, 504, 2197, 492, 2197, 199, 504, 1331, 492, 1331, 421, 199, 13166, 17462, 63, 5449, 275, 298, 87, 385, 921, 1544, 14, 9910, 2075, 14, 957, 15, 3569, 15, 1246, 15, 86, 18, 2, 199, 199, 14853, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 2443, 582, 12705, 14, 20254, 10799, 12, 272, 298, 1422, 582, 12705, 14, 13352, 199, 93, 199, 13352, 2711, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 1250, 582, 3207, 804, 14, 11978, 12, 272, 298, 524, 582, 3207, 804, 14, 4013, 199, 93, 199, 6098, 1075, 63, 8156, 18, 11733, 2100, 649, 275, 469, 17015, 14, 12375, 26, 298, 31240, 401, 25596, 414, 14, 13003, 26, 298, 23235, 3570, 199, 12125, 2711, 63, 8156, 18, 11733, 2100, 649, 275, 469, 272, 9240, 804, 14, 13387, 26, 298, 3097, 401, 272, 9240, 804, 14, 10520, 775, 26, 298, 22270, 401, 199, 93, 199, 12125, 2711, 63, 11733, 2100, 649, 18, 8156, 275, 469, 86, 26, 1022, 367, 1022, 12, 373, 315, 16044, 2711, 63, 8156, 18, 11733, 2100, 649, 14, 1744, 12737, 199, 6098, 1075, 63, 11733, 2100, 649, 18, 8156, 275, 469, 86, 26, 1022, 367, 1022, 12, 373, 315, 8703, 1075, 63, 8156, 18, 11733, 2100, 649, 14, 1744, 12737, 199, 6305, 63, 11733, 2100, 649, 18, 8156, 275, 469, 272, 298, 1490, 582, 9795, 14, 4609, 13954, 8280, 12, 272, 298, 17647, 582, 9795, 14, 1761, 13954, 8280, 12, 272, 298, 24054, 582, 9795, 14, 907, 5550, 1149, 12, 272, 298, 21924, 582, 9795, 14, 20707, 5290, 12, 199, 93, 421, 199, 533, 18674, 1892, 390, 12455, 8, 1563, 12455, 304, 272, 408, 624, 339, 849, 63, 6031, 275, 469, 267, 298, 498, 582, 4873, 267, 298, 4731, 582, 4873, 267, 298, 3280, 63, 1102, 582, 4873, 267, 298, 3280, 63, 719, 582, 3087, 272, 789, 339, 444, 6627, 275, 359, 13188, 14, 11733, 2100, 649, 61, 339, 347, 636, 826, 721, 277, 12, 1566, 63, 3908, 304, 267, 408, 624, 267, 1613, 11027, 826, 721, 1430, 63, 3908, 12, 298, 11733, 2100, 649, 531, 398, 291, 14, 3569, 63, 1246, 275, 18674, 1892, 390, 6004, 10833, 7394, 8, 277, 9, 339, 347, 4907, 8, 277, 12, 4260, 26, 1211, 304, 267, 408, 624, 267, 790, 275, 4260, 905, 498, 937, 267, 7565, 275, 4260, 905, 4731, 937, 267, 4566, 63, 1102, 275, 4260, 905, 3280, 63, 1102, 937, 267, 4566, 63, 719, 275, 4260, 905, 3280, 63, 719, 937, 398, 340, 4566, 63, 719, 14, 13896, 837, 288, 4566, 63, 719, 275, 1109, 8, 3280, 63, 719, 9, 267, 587, 26, 288, 4566, 63, 719, 275, 378, 398, 291, 14, 3569, 63, 1246, 14, 2242, 8, 288, 790, 12, 288, 7565, 12, 288, 4566, 63, 1102, 12, 288, 4566, 63, 719, 12, 267, 776, 339, 347, 23421, 8, 277, 12, 2648, 26, 4804, 5355, 2017, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 10108, 8, 2103, 9, 339, 347, 3222, 63, 1648, 8, 277, 12, 2648, 26, 9240, 2017, 304, 267, 408, 624, 267, 372, 291, 14, 3569, 63, 1246, 14, 2254, 63, 1648, 8, 2103, 9, 339, 347, 9311, 63, 1648, 8, 277, 12, 2648, 26, 28374, 2017, 304, 267, 408, 624, 267, 372, 291, 14, 3569, 63, 1246, 14, 6406, 63, 1648, 8, 2103, 9, 339, 347, 1827, 63, 2048, 8, 277, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 1131, 63, 2048, 342, 339, 347, 1827, 63, 3124, 8, 277, 304, 267, 408, 267, 8133, 17573, 12266, 14, 267, 408, 267, 986, 339, 347, 1827, 63, 5570, 8, 277, 12, 2648, 26, 27829, 2017, 304, 267, 408, 267, 8133, 4681, 7994, 666, 14, 267, 408, 267, 986, 339, 347, 4002, 8, 277, 304, 267, 408, 624, 267, 291, 14, 3569, 63, 1246, 14, 2379, 342, 421, 199, 533, 18674, 1892, 390, 6004, 10833, 7394, 8, 6004, 10833, 3041, 304, 272, 408, 624, 339, 347, 636, 826, 721, 277, 12, 10391, 26, 3523, 12455, 304, 267, 408, 624, 267, 1613, 11027, 826, 4533, 398, 291, 14, 7019, 275, 10391, 267, 291, 14, 7019, 63, 354, 275, 10391, 14, 7019, 63, 354, 398, 291, 14, 498, 275, 3087, 267, 291, 14, 4731, 275, 3087, 267, 291, 14, 2732, 63, 1418, 275, 3087, 398, 291, 14, 2103, 344, 275, 413, 267, 291, 14, 2103, 344, 63, 3058, 63, 1130, 275, 1052, 267, 291, 14, 2103, 344, 63, 4968, 63, 1130, 275, 1052, 267, 291, 14, 2103, 344, 63, 1648, 63, 1130, 275, 1052, 398, 291, 14, 2242, 63, 521, 275, 378, 267, 291, 14, 1648, 63, 835, 275, 19492, 267, 291, 14, 1832, 63, 1274, 63, 1130, 275, 1052, 267, 291, 14, 1274, 63, 1832, 63, 1130, 275, 1052, 267, 291, 14, 6406, 63, 6615, 275, 1052, 398, 291, 14, 11948, 275, 469, 288, 298, 28572, 582, 291, 14, 265, 63, 28572, 12, 288, 298, 2706, 582, 291, 14, 265, 63, 1648, 2706, 12, 288, 298, 751, 582, 291, 14, 265, 63, 751, 63, 873, 12, 267, 789, 398, 291, 14, 10406, 275, 1052, 339, 347, 4907, 8, 267, 291, 12, 267, 790, 26, 620, 12, 267, 7565, 26, 620, 12, 267, 4566, 63, 1102, 26, 620, 12, 267, 4566, 63, 719, 26, 1109, 272, 3461, 267, 408, 624, 267, 291, 14, 498, 275, 790, 267, 291, 14, 4731, 275, 7565, 398, 291, 14, 2242, 63, 521, 275, 334, 288, 1109, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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ientConnectorError from async_timeout import timeout from gios import ApiError, Gios, InvalidSensorsData, NoStationError from homeassistant.core import Config, HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import CONF_STATION_ID, DOMAIN, SCAN_INTERVAL _LOGGER = logging.getLogger(__name__) async def async_setup(hass: HomeAssistant, config: Config) -> bool: """Set up configured GIOS.""" return True async def async_setup_entry(hass, config_entry): """Set up GIOS as config entry.""" station_id = config_entry.data[CONF_STATION_ID] _LOGGER.debug("Using station_id: %s", station_id) websession = async_get_clientsession(hass) coordinator = GiosDataUpdateCoordinator(hass, websession, station_id) await coordinator.async_refresh() if not coordinator.last_update_success: raise ConfigEntryNotReady hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][config_entry.entry_id] = coordinator hass.async_create_task( hass.config_entries.async_forward_entry_setup(config_entry, "air_quality") ) return True async def async_unload_entry(hass, config_entry): """Unload a config entry.""" hass.data[DOMAIN].pop(config_entry.entry_id) await hass.config_entries.async_forward_entry_unload(config_entry, "air_quality") return True class GiosDataUpdateCoordinator(DataUpdateCoordinator): """Define an object to hold GIOS data.""" def __init__(self, hass, session, station_id): """Class to manage fetching GIOS data API.""" self.gios = Gios(station_id, session) super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL) async def _async_update_data(self): """Update data via library.""" try: with timeout(30): await self.gios.update() except ( ApiError, NoStationError, ClientConnectorError, InvalidSensorsData, ) as error: raise UpdateFailed(error) from error return self.gios.data
mit
[ 624, 1918, 598, 13532, 3931, 1041, 199, 646, 2050, 199, 199, 504, 30274, 14, 1258, 63, 3924, 492, 6810, 20476, 547, 199, 504, 5316, 63, 2593, 492, 2653, 199, 504, 486, 9207, 492, 13986, 547, 12, 598, 9207, 12, 6378, 51, 17564, 1451, 12, 3091, 933, 5263, 199, 199, 504, 8846, 14, 1018, 492, 4094, 12, 29913, 199, 504, 8846, 14, 3924, 492, 4094, 3900, 1763, 17960, 199, 504, 8846, 14, 7546, 14, 65, 24134, 63, 1258, 492, 5316, 63, 362, 63, 1258, 1730, 199, 504, 8846, 14, 7546, 14, 873, 63, 27380, 492, 3918, 4152, 13940, 707, 12, 6162, 4276, 199, 199, 504, 1275, 1297, 492, 6392, 63, 840, 2594, 63, 998, 12, 15265, 12, 12075, 879, 63, 17359, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 4146, 347, 5316, 63, 2758, 8, 5387, 26, 29913, 12, 1101, 26, 4094, 9, 1035, 2155, 26, 272, 408, 1084, 1536, 7526, 598, 13532, 1041, 272, 372, 715, 421, 199, 4146, 347, 5316, 63, 2758, 63, 2373, 8, 5387, 12, 1101, 63, 2373, 304, 272, 408, 1084, 1536, 598, 13532, 465, 1101, 2397, 1041, 272, 16518, 63, 344, 275, 1101, 63, 2373, 14, 576, 59, 3103, 63, 840, 2594, 63, 998, 61, 272, 485, 10186, 14, 1757, 480, 10369, 16518, 63, 344, 26, 450, 83, 401, 16518, 63, 344, 9, 339, 3330, 1730, 275, 5316, 63, 362, 63, 1258, 1730, 8, 5387, 9, 339, 29186, 275, 598, 9207, 1451, 4152, 13940, 707, 8, 5387, 12, 3330, 1730, 12, 16518, 63, 344, 9, 272, 5517, 29186, 14, 4146, 63, 6635, 342, 339, 340, 440, 29186, 14, 2019, 63, 873, 63, 3742, 26, 267, 746, 4094, 3900, 1763, 17960, 339, 6298, 14, 576, 14, 5486, 8, 7378, 12, 5009, 272, 6298, 14, 576, 59, 7378, 1527, 888, 63, 2373, 14, 2373, 63, 344, 61, 275, 29186, 339, 6298, 14, 4146, 63, 981, 63, 1765, 8, 267, 6298, 14, 888, 63, 3189, 14, 4146, 63, 6688, 63, 2373, 63, 2758, 8, 888, 63, 2373, 12, 298, 8387, 63, 9161, 531, 272, 776, 272, 372, 715, 421, 199, 4146, 347, 5316, 63, 25477, 63, 2373, 8, 5387, 12, 1101, 63, 2373, 304, 272, 408, 31470, 282, 1101, 2397, 1041, 272, 6298, 14, 576, 59, 7378, 1055, 1935, 8, 888, 63, 2373, 14, 2373, 63, 344, 9, 272, 5517, 6298, 14, 888, 63, 3189, 14, 4146, 63, 6688, 63, 2373, 63, 25477, 8, 888, 63, 2373, 12, 298, 8387, 63, 9161, 531, 272, 372, 715, 421, 199, 533, 598, 9207, 1451, 4152, 13940, 707, 8, 1451, 4152, 13940, 707, 304, 272, 408, 16213, 376, 909, 370, 10266, 598, 13532, 666, 1041, 339, 347, 636, 826, 721, 277, 12, 6298, 12, 2351, 12, 16518, 63, 344, 304, 267, 408, 2543, 370, 9635, 21239, 598, 13532, 666, 3261, 1041, 267, 291, 14, 6153, 736, 275, 598, 9207, 8, 10600, 63, 344, 12, 2351, 9, 398, 1613, 11027, 826, 721, 5387, 12, 485, 10186, 12, 536, 29, 7378, 12, 1678, 63, 4284, 29, 24078, 63, 17359, 9, 339, 5316, 347, 485, 4146, 63, 873, 63, 576, 8, 277, 304, 267, 408, 4152, 666, 4799, 3555, 1041, 267, 862, 26, 288, 543, 2653, 8, 1216, 304, 355, 5517, 291, 14, 6153, 736, 14, 873, 342, 267, 871, 334, 288, 13986, 547, 12, 288, 3091, 933, 5263, 12, 288, 6810, 20476, 547, 12, 288, 6378, 51, 17564, 1451, 12, 267, 776, 465, 1125, 26, 288, 746, 6162, 4276, 8, 705, 9, 687, 1125, 267, 372, 291, 14, 6153, 736, 14, 576, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1918, 598, 13532, 3931, 1041, 199, 646, 2050, 199, 199, 504, 30274, 14, 1258, 63, 3924, 492, 6810, 20476, 547, 199, 504, 5316, 63, 2593, 492, 2653, 199, 504, 486, 9207, 492, 13986, 547, 12, 598, 9207, 12, 6378, 51, 17564, 1451, 12, 3091, 933, 5263, 199, 199, 504, 8846, 14, 1018, 492, 4094, 12, 29913, 199, 504, 8846, 14, 3924, 492, 4094, 3900, 1763, 17960, 199, 504, 8846, 14, 7546, 14, 65, 24134, 63, 1258, 492, 5316, 63, 362, 63, 1258, 1730, 199, 504, 8846, 14, 7546, 14, 873, 63, 27380, 492, 3918, 4152, 13940, 707, 12, 6162, 4276, 199, 199, 504, 1275, 1297, 492, 6392, 63, 840, 2594, 63, 998, 12, 15265, 12, 12075, 879, 63, 17359, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 4146, 347, 5316, 63, 2758, 8, 5387, 26, 29913, 12, 1101, 26, 4094, 9, 1035, 2155, 26, 272, 408, 1084, 1536, 7526, 598, 13532, 1041, 272, 372, 715, 421, 199, 4146, 347, 5316, 63, 2758, 63, 2373, 8, 5387, 12, 1101, 63, 2373, 304, 272, 408, 1084, 1536, 598, 13532, 465, 1101, 2397, 1041, 272, 16518, 63, 344, 275, 1101, 63, 2373, 14, 576, 59, 3103, 63, 840, 2594, 63, 998, 61, 272, 485, 10186, 14, 1757, 480, 10369, 16518, 63, 344, 26, 450, 83, 401, 16518, 63, 344, 9, 339, 3330, 1730, 275, 5316, 63, 362, 63, 1258, 1730, 8, 5387, 9, 339, 29186, 275, 598, 9207, 1451, 4152, 13940, 707, 8, 5387, 12, 3330, 1730, 12, 16518, 63, 344, 9, 272, 5517, 29186, 14, 4146, 63, 6635, 342, 339, 340, 440, 29186, 14, 2019, 63, 873, 63, 3742, 26, 267, 746, 4094, 3900, 1763, 17960, 339, 6298, 14, 576, 14, 5486, 8, 7378, 12, 5009, 272, 6298, 14, 576, 59, 7378, 1527, 888, 63, 2373, 14, 2373, 63, 344, 61, 275, 29186, 339, 6298, 14, 4146, 63, 981, 63, 1765, 8, 267, 6298, 14, 888, 63, 3189, 14, 4146, 63, 6688, 63, 2373, 63, 2758, 8, 888, 63, 2373, 12, 298, 8387, 63, 9161, 531, 272, 776, 272, 372, 715, 421, 199, 4146, 347, 5316, 63, 25477, 63, 2373, 8, 5387, 12, 1101, 63, 2373, 304, 272, 408, 31470, 282, 1101, 2397, 1041, 272, 6298, 14, 576, 59, 7378, 1055, 1935, 8, 888, 63, 2373, 14, 2373, 63, 344, 9, 272, 5517, 6298, 14, 888, 63, 3189, 14, 4146, 63, 6688, 63, 2373, 63, 25477, 8, 888, 63, 2373, 12, 298, 8387, 63, 9161, 531, 272, 372, 715, 421, 199, 533, 598, 9207, 1451, 4152, 13940, 707, 8, 1451, 4152, 13940, 707, 304, 272, 408, 16213, 376, 909, 370, 10266, 598, 13532, 666, 1041, 339, 347, 636, 826, 721, 277, 12, 6298, 12, 2351, 12, 16518, 63, 344, 304, 267, 408, 2543, 370, 9635, 21239, 598, 13532, 666, 3261, 1041, 267, 291, 14, 6153, 736, 275, 598, 9207, 8, 10600, 63, 344, 12, 2351, 9, 398, 1613, 11027, 826, 721, 5387, 12, 485, 10186, 12, 536, 29, 7378, 12, 1678, 63, 4284, 29, 24078, 63, 17359, 9, 339, 5316, 347, 485, 4146, 63, 873, 63, 576, 8, 277, 304, 267, 408, 4152, 666, 4799, 3555, 1041, 267, 862, 26, 288, 543, 2653, 8, 1216, 304, 355, 5517, 291, 14, 6153, 736, 14, 873, 342, 267, 871, 334, 288, 13986, 547, 12, 288, 3091, 933, 5263, 12, 288, 6810, 20476, 547, 12, 288, 6378, 51, 17564, 1451, 12, 267, 776, 465, 1125, 26, 288, 746, 6162, 4276, 8, 705, 9, 687, 1125, 267, 372, 291, 14, 6153, 736, 14, 576, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
geertj/python-ad
lib/ad/test/base.py
2
8407
# # This file is part of Python-AD. Python-AD is free software that is made # available under the MIT license. Consult the file "LICENSE" that is # distributed together with this file for the exact licensing terms. # # Python-AD is copyright (c) 2007 by the Python-AD authors. See the file # "AUTHORS" for a complete overview. import os import os.path import sys import tempfile import pexpect from nose import SkipTest from ConfigParser import ConfigParser from ad.util.log import enable_logging class Error(Exception): """Test error.""" class BaseTest(object): """Base class for Python-AD tests.""" @classmethod def setup_class(cls): config = ConfigParser() fname = os.environ.get('FREEADI_TEST_CONFIG') if fname is None: raise Error, 'Python-AD test configuration file not specified.' if not os.access(fname, os.R_OK): raise Error, 'Python-AD test configuration file does not exist.' config.read(fname) cls.c_config = config cls.c_basedir = os.path.dirname(fname) cls.c_iptables = None cls.c_tempfiles = [] enable_logging() @classmethod def teardown_class(cls): for fname in cls.c_tempfiles: try: os.unlink(fname) except OSError: pass cls.c_tempfiles = [] def config(self): return self.c_config def _dedent(self, s): lines = s.splitlines() for i in range(len(lines)): lines[i] = lines[i].lstrip() if lines and not lines[0]: lines = lines[1:] if lines and not lines[-1]: lines = lines[:-1] return '\n'.join(lines) + '\n' def tempfile(self, contents=None, remove=False): fd, name = tempfile.mkstemp() if contents: os.write(fd, self._dedent(contents)) elif remove: os.remove(name) os.close(fd) self.c_tempfiles.append(name) return name def basedir(self): return self.c_basedir def require(self, ad_user=False, local_admin=False, ad_admin=False, firewall=False, expensive=False): if firewall: local_admin = True config = self.config() if ad_user and not config.getboolean('test', 'readonly_ad_tests'): raise SkipTest, 'test disabled by configuration' if not config.get('test', 'domain'): raise SkipTest, 'ad tests enabled but no domain given' if not config.get('test', 'ad_user_account') or \ not config.get('test', 'ad_user_password'): raise SkipTest, 'readonly ad tests enabled but no user/pw given' if local_admin: if not config.getboolean('test', 'intrusive_local_tests'): raise SkipTest, 'test disabled by configuration' if not config.get('test', 'local_admin_account') or \ not config.get('test', 'local_admin_password'): raise SkipTest, 'intrusive local tests enabled but no user/pw given' if ad_admin: if not config.getboolean('test', 'intrusive_ad_tests'): raise SkipTest, 'test disabled by configuration' if not config.get('test', 'ad_admin_account') or \ not config.get('test', 'ad_admin_password'): raise SkipTest, 'intrusive ad tests enabled but no user/pw given' if firewall and not self._iptables_supported(): raise SkipTest, 'iptables/conntrack not available' if expensive and not config.getboolean('test', 'expensive_tests'): raise SkipTest, 'test disabled by configuration' def domain(self): config = self.config() domain = config.get('test', 'domain') return domain def ad_user_account(self): self.require(ad_user=True) account = self.config().get('test', 'ad_user_account') return account def ad_user_password(self): self.require(ad_user=True) password = self.config().get('test', 'ad_user_password') return password def local_admin_account(self): self.require(local_admin=True) account = self.config().get('test', 'local_admin_account') return account def local_admin_password(self): self.require(local_admin=True) password = self.config().get('test', 'local_admin_password') return password def ad_admin_account(self): self.require(ad_admin=True) account = self.config().get('test', 'ad_admin_account') return account def ad_admin_password(self): self.require(ad_admin=True) password = self.config().get('test', 'ad_admin_password') return password def execute_as_root(self, command): self.require(local_admin=True) child = pexpect.spawn('su -c "%s" %s' % \ (command, self.local_admin_account())) child.expect('.*:') child.sendline(self.local_admin_password()) child.expect(pexpect.EOF) assert not child.isalive() if child.exitstatus != 0: m = 'Root command exited with status %s' % child.exitstatus raise Error, m return child.before def acquire_credentials(self, principal, password, ccache=None): if ccache is None: ccache = '' else: ccache = '-c %s' % ccache child = pexpect.spawn('kinit %s %s' % (principal, ccache)) child.expect(':') child.sendline(password) child.expect(pexpect.EOF) assert not child.isalive() if child.exitstatus != 0: m = 'Command kinit exited with status %s' % child.exitstatus raise Error, m def list_credentials(self, ccache=None): if ccache is None: ccache = '' child = pexpect.spawn('klist %s' % ccache) try: child.expect('Ticket cache: ([a-zA-Z0-9_/.:-]+)\r\n') except pexpect.EOF: m = 'Command klist exited with status %s' % child.exitstatus raise Error, m ccache = child.match.group(1) child.expect('Default principal: ([a-zA-Z0-9_/.:@-]+)\r\n') principal = child.match.group(1) creds = [] while True: i = child.expect(['\r\n', pexpect.EOF, '\d\d/\d\d/\d\d \d\d:\d\d:\d\d\s+' \ '\d\d/\d\d/\d\d \d\d:\d\d:\d\d\s+' \ '([a-zA-Z0-9_/.:@-]+)\r\n']) if i == 0: continue elif i == 1: break creds.append(child.match.group(1)) return ccache, principal, creds def _iptables_supported(self): if self.c_iptables is None: try: self.execute_as_root('iptables -L -n') self.execute_as_root('conntrack -L') except Error: self.c_iptables = False else: self.c_iptables = True return self.c_iptables def remove_network_blocks(self): self.require(local_admin=True, firewall=True) self.execute_as_root('iptables -t nat -F') self.execute_as_root('conntrack -F') def block_outgoing_traffic(self, protocol, port): """Block outgoing traffic of type `protocol' with destination `port'.""" self.require(local_admin=True, firewall=True) # Unfortunately we cannot simply insert a rule like this: -A OUTPUT -m # udp -p udp--dport 389 -j DROP. If we do this the kernel code will # be smart and return an error when sending trying to connect or send # a datagram. In order realistically emulate a network failure we # instead redirect packets the discard port on localhost. This # complicates stopping the emulated failure though: merely flushling # the nat table is not enough. We also need to flush the conntrack # table that keeps state for NAT'ed connections even after the rule # that caused the NAT in the first place has been removed. self.execute_as_root('iptables -t nat -A OUTPUT -m %s -p %s --dport %d' ' -j DNAT --to-destination 127.0.0.1:9' % (protocol, protocol, port))
mit
[ 3, 199, 3, 961, 570, 365, 1777, 402, 2018, 13, 1554, 14, 2018, 13, 1554, 365, 2867, 2032, 626, 365, 6326, 199, 3, 2808, 1334, 314, 10697, 4190, 14, 1448, 83, 427, 314, 570, 298, 3961, 2, 626, 365, 199, 3, 1854, 10451, 543, 642, 570, 367, 314, 5835, 32572, 2895, 14, 199, 3, 199, 3, 2018, 13, 1554, 365, 4248, 334, 67, 9, 10219, 701, 314, 2018, 13, 1554, 11462, 14, 1666, 314, 570, 199, 3, 298, 5580, 4149, 2, 367, 282, 4890, 23503, 14, 199, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 984, 199, 646, 5549, 199, 646, 28855, 199, 199, 504, 11354, 492, 18795, 199, 504, 14196, 492, 14196, 199, 504, 1503, 14, 1974, 14, 793, 492, 4756, 63, 4806, 421, 199, 533, 4520, 8, 1726, 304, 272, 408, 774, 1125, 1041, 421, 199, 533, 3523, 774, 8, 785, 304, 272, 408, 1563, 1021, 367, 2018, 13, 1554, 2295, 1041, 339, 768, 3744, 272, 347, 3272, 63, 533, 8, 1886, 304, 267, 1101, 275, 14196, 342, 267, 6748, 275, 747, 14, 2314, 14, 362, 360, 28170, 1554, 41, 63, 2864, 63, 5569, 358, 267, 340, 6748, 365, 488, 26, 288, 746, 4520, 12, 283, 4718, 13, 1554, 511, 2897, 570, 440, 2013, 3530, 267, 340, 440, 747, 14, 2732, 8, 5252, 12, 747, 14, 50, 63, 3593, 304, 288, 746, 4520, 12, 283, 4718, 13, 1554, 511, 2897, 570, 1630, 440, 2187, 3530, 267, 1101, 14, 739, 8, 5252, 9, 267, 843, 14, 67, 63, 888, 275, 1101, 267, 843, 14, 67, 63, 12484, 275, 747, 14, 515, 14, 3475, 8, 5252, 9, 267, 843, 14, 67, 63, 23232, 275, 488, 267, 843, 14, 67, 63, 808, 1725, 275, 942, 267, 4756, 63, 4806, 342, 339, 768, 3744, 272, 347, 17558, 63, 533, 8, 1886, 304, 267, 367, 6748, 315, 843, 14, 67, 63, 808, 1725, 26, 288, 862, 26, 355, 747, 14, 7162, 8, 5252, 9, 288, 871, 6440, 26, 355, 986, 267, 843, 14, 67, 63, 808, 1725, 275, 942, 339, 347, 1101, 8, 277, 304, 267, 372, 291, 14, 67, 63, 888, 339, 347, 485, 14674, 8, 277, 12, 308, 304, 267, 2385, 275, 308, 14, 7644, 342, 267, 367, 284, 315, 1425, 8, 552, 8, 1278, 2298, 288, 2385, 59, 73, 61, 275, 2385, 59, 73, 1055, 10124, 342, 267, 340, 2385, 436, 440, 2385, 59, 16, 2189, 288, 2385, 275, 2385, 59, 17, 2938, 267, 340, 2385, 436, 440, 2385, 1988, 17, 2189, 288, 2385, 275, 2385, 4439, 17, 61, 267, 372, 1557, 78, 1370, 904, 8, 1278, 9, 435, 1557, 78, 7, 339, 347, 5549, 8, 277, 12, 4072, 29, 403, 12, 2813, 29, 797, 304, 267, 6111, 12, 536, 275, 5549, 14, 17721, 342, 267, 340, 4072, 26, 288, 747, 14, 952, 8, 2592, 12, 291, 423, 14674, 8, 4407, 430, 267, 916, 2813, 26, 288, 747, 14, 2168, 8, 354, 9, 267, 747, 14, 1600, 8, 2592, 9, 267, 291, 14, 67, 63, 808, 1725, 14, 740, 8, 354, 9, 267, 372, 536, 339, 347, 19380, 8, 277, 304, 267, 372, 291, 14, 67, 63, 12484, 339, 347, 4409, 8, 277, 12, 1503, 63, 751, 29, 797, 12, 2257, 63, 2113, 29, 797, 12, 1503, 63, 2113, 29, 797, 12, 355, 12042, 29, 797, 12, 23133, 29, 797, 304, 267, 340, 12042, 26, 288, 2257, 63, 2113, 275, 715, 267, 1101, 275, 291, 14, 888, 342, 267, 340, 1503, 63, 751, 436, 440, 1101, 14, 30356, 360, 396, 297, 283, 6753, 63, 350, 63, 2219, 735, 288, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 2261, 735, 355, 746, 18795, 12, 283, 350, 2295, 5223, 1325, 949, 2881, 1627, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2060, 735, 355, 746, 18795, 12, 283, 6753, 1503, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 2257, 63, 2113, 26, 288, 340, 440, 1101, 14, 30356, 360, 396, 297, 283, 442, 6558, 3398, 63, 1832, 63, 2219, 735, 355, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 1832, 63, 2113, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 1832, 63, 2113, 63, 2060, 735, 355, 746, 18795, 12, 283, 442, 6558, 3398, 2257, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 1503, 63, 2113, 26, 288, 340, 440, 1101, 14, 30356, 360, 396, 297, 283, 442, 6558, 3398, 63, 350, 63, 2219, 735, 355, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 2113, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 2113, 63, 2060, 735, 355, 746, 18795, 12, 283, 442, 6558, 3398, 1503, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 12042, 436, 440, 291, 423, 23232, 63, 4946, 837, 288, 746, 18795, 12, 283, 23232, 15, 388, 343, 8085, 440, 2808, 7, 267, 340, 23133, 436, 440, 1101, 14, 30356, 360, 396, 297, 283, 476, 19947, 63, 2219, 735, 288, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 339, 347, 2881, 8, 277, 304, 267, 1101, 275, 291, 14, 888, 342, 267, 2881, 275, 1101, 14, 362, 360, 396, 297, 283, 2261, 358, 267, 372, 2881, 339, 347, 1503, 63, 751, 63, 2048, 8, 277, 304, 267, 291, 14, 4365, 8, 350, 63, 751, 29, 549, 9, 267, 2933, 275, 291, 14, 888, 1252, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2048, 358, 267, 372, 2933, 339, 347, 1503, 63, 751, 63, 2060, 8, 277, 304, 267, 291, 14, 4365, 8, 350, 63, 751, 29, 549, 9, 267, 2505, 275, 291, 14, 888, 1252, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2060, 358, 267, 372, 2505, 339, 347, 2257, 63, 2113, 63, 2048, 8, 277, 304, 267, 291, 14, 4365, 8, 1832, 63 ]
[ 199, 3, 961, 570, 365, 1777, 402, 2018, 13, 1554, 14, 2018, 13, 1554, 365, 2867, 2032, 626, 365, 6326, 199, 3, 2808, 1334, 314, 10697, 4190, 14, 1448, 83, 427, 314, 570, 298, 3961, 2, 626, 365, 199, 3, 1854, 10451, 543, 642, 570, 367, 314, 5835, 32572, 2895, 14, 199, 3, 199, 3, 2018, 13, 1554, 365, 4248, 334, 67, 9, 10219, 701, 314, 2018, 13, 1554, 11462, 14, 1666, 314, 570, 199, 3, 298, 5580, 4149, 2, 367, 282, 4890, 23503, 14, 199, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 984, 199, 646, 5549, 199, 646, 28855, 199, 199, 504, 11354, 492, 18795, 199, 504, 14196, 492, 14196, 199, 504, 1503, 14, 1974, 14, 793, 492, 4756, 63, 4806, 421, 199, 533, 4520, 8, 1726, 304, 272, 408, 774, 1125, 1041, 421, 199, 533, 3523, 774, 8, 785, 304, 272, 408, 1563, 1021, 367, 2018, 13, 1554, 2295, 1041, 339, 768, 3744, 272, 347, 3272, 63, 533, 8, 1886, 304, 267, 1101, 275, 14196, 342, 267, 6748, 275, 747, 14, 2314, 14, 362, 360, 28170, 1554, 41, 63, 2864, 63, 5569, 358, 267, 340, 6748, 365, 488, 26, 288, 746, 4520, 12, 283, 4718, 13, 1554, 511, 2897, 570, 440, 2013, 3530, 267, 340, 440, 747, 14, 2732, 8, 5252, 12, 747, 14, 50, 63, 3593, 304, 288, 746, 4520, 12, 283, 4718, 13, 1554, 511, 2897, 570, 1630, 440, 2187, 3530, 267, 1101, 14, 739, 8, 5252, 9, 267, 843, 14, 67, 63, 888, 275, 1101, 267, 843, 14, 67, 63, 12484, 275, 747, 14, 515, 14, 3475, 8, 5252, 9, 267, 843, 14, 67, 63, 23232, 275, 488, 267, 843, 14, 67, 63, 808, 1725, 275, 942, 267, 4756, 63, 4806, 342, 339, 768, 3744, 272, 347, 17558, 63, 533, 8, 1886, 304, 267, 367, 6748, 315, 843, 14, 67, 63, 808, 1725, 26, 288, 862, 26, 355, 747, 14, 7162, 8, 5252, 9, 288, 871, 6440, 26, 355, 986, 267, 843, 14, 67, 63, 808, 1725, 275, 942, 339, 347, 1101, 8, 277, 304, 267, 372, 291, 14, 67, 63, 888, 339, 347, 485, 14674, 8, 277, 12, 308, 304, 267, 2385, 275, 308, 14, 7644, 342, 267, 367, 284, 315, 1425, 8, 552, 8, 1278, 2298, 288, 2385, 59, 73, 61, 275, 2385, 59, 73, 1055, 10124, 342, 267, 340, 2385, 436, 440, 2385, 59, 16, 2189, 288, 2385, 275, 2385, 59, 17, 2938, 267, 340, 2385, 436, 440, 2385, 1988, 17, 2189, 288, 2385, 275, 2385, 4439, 17, 61, 267, 372, 1557, 78, 1370, 904, 8, 1278, 9, 435, 1557, 78, 7, 339, 347, 5549, 8, 277, 12, 4072, 29, 403, 12, 2813, 29, 797, 304, 267, 6111, 12, 536, 275, 5549, 14, 17721, 342, 267, 340, 4072, 26, 288, 747, 14, 952, 8, 2592, 12, 291, 423, 14674, 8, 4407, 430, 267, 916, 2813, 26, 288, 747, 14, 2168, 8, 354, 9, 267, 747, 14, 1600, 8, 2592, 9, 267, 291, 14, 67, 63, 808, 1725, 14, 740, 8, 354, 9, 267, 372, 536, 339, 347, 19380, 8, 277, 304, 267, 372, 291, 14, 67, 63, 12484, 339, 347, 4409, 8, 277, 12, 1503, 63, 751, 29, 797, 12, 2257, 63, 2113, 29, 797, 12, 1503, 63, 2113, 29, 797, 12, 355, 12042, 29, 797, 12, 23133, 29, 797, 304, 267, 340, 12042, 26, 288, 2257, 63, 2113, 275, 715, 267, 1101, 275, 291, 14, 888, 342, 267, 340, 1503, 63, 751, 436, 440, 1101, 14, 30356, 360, 396, 297, 283, 6753, 63, 350, 63, 2219, 735, 288, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 2261, 735, 355, 746, 18795, 12, 283, 350, 2295, 5223, 1325, 949, 2881, 1627, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2060, 735, 355, 746, 18795, 12, 283, 6753, 1503, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 2257, 63, 2113, 26, 288, 340, 440, 1101, 14, 30356, 360, 396, 297, 283, 442, 6558, 3398, 63, 1832, 63, 2219, 735, 355, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 1832, 63, 2113, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 1832, 63, 2113, 63, 2060, 735, 355, 746, 18795, 12, 283, 442, 6558, 3398, 2257, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 1503, 63, 2113, 26, 288, 340, 440, 1101, 14, 30356, 360, 396, 297, 283, 442, 6558, 3398, 63, 350, 63, 2219, 735, 355, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 288, 340, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 2113, 63, 2048, 358, 503, 971, 490, 440, 1101, 14, 362, 360, 396, 297, 283, 350, 63, 2113, 63, 2060, 735, 355, 746, 18795, 12, 283, 442, 6558, 3398, 1503, 2295, 5223, 1325, 949, 922, 15, 8796, 1627, 7, 267, 340, 12042, 436, 440, 291, 423, 23232, 63, 4946, 837, 288, 746, 18795, 12, 283, 23232, 15, 388, 343, 8085, 440, 2808, 7, 267, 340, 23133, 436, 440, 1101, 14, 30356, 360, 396, 297, 283, 476, 19947, 63, 2219, 735, 288, 746, 18795, 12, 283, 396, 6980, 701, 2897, 7, 339, 347, 2881, 8, 277, 304, 267, 1101, 275, 291, 14, 888, 342, 267, 2881, 275, 1101, 14, 362, 360, 396, 297, 283, 2261, 358, 267, 372, 2881, 339, 347, 1503, 63, 751, 63, 2048, 8, 277, 304, 267, 291, 14, 4365, 8, 350, 63, 751, 29, 549, 9, 267, 2933, 275, 291, 14, 888, 1252, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2048, 358, 267, 372, 2933, 339, 347, 1503, 63, 751, 63, 2060, 8, 277, 304, 267, 291, 14, 4365, 8, 350, 63, 751, 29, 549, 9, 267, 2505, 275, 291, 14, 888, 1252, 362, 360, 396, 297, 283, 350, 63, 751, 63, 2060, 358, 267, 372, 2505, 339, 347, 2257, 63, 2113, 63, 2048, 8, 277, 304, 267, 291, 14, 4365, 8, 1832, 63, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
fanhero/thumbor
tests/engines/test_pil.py
4
5566
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com thumbor@googlegroups.com from __future__ import unicode_literals, absolute_import from os.path import abspath, join, dirname from unittest import TestCase, skipUnless from preggy import expect from PIL import Image from thumbor.context import Context from thumbor.config import Config from thumbor.engines.pil import Engine try: from pyexiv2 import ImageMetadata # noqa METADATA_AVAILABLE = True except ImportError: METADATA_AVAILABLE = False import datetime import mock STORAGE_PATH = abspath(join(dirname(__file__), '../fixtures/images/')) class PilEngineTestCase(TestCase): def get_context(self): cfg = Config( SECURITY_KEY='ACME-SEC', ENGINE='thumbor.engines.pil', IMAGE_METADATA_READ_FORMATS='exif,xmp' ) cfg.LOADER = "thumbor.loaders.file_loader" cfg.FILE_LOADER_ROOT_PATH = STORAGE_PATH cfg.STORAGE = 'thumbor.storages.no_storage' return Context(config=cfg) def setUp(self): self.context = self.get_context() def test_create_engine(self): engine = Engine(self.context) expect(engine).to_be_instance_of(Engine) def test_load_image(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'image.jpg'), 'r') as im: buffer = im.read() image = engine.create_image(buffer) expect(image.format).to_equal('JPEG') def test_convert_tif_16bit_per_channel_lsb_to_png(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'gradient_lsb_16bperchannel.tif'), 'r') as im: buffer = im.read() expect(buffer).not_to_equal(None) engine.convert_tif_to_png(buffer) expect(engine.extension).to_equal('.png') def test_convert_tif_16bit_per_channel_msb_to_png(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'gradient_msb_16bperchannel.tif'), 'r') as im: buffer = im.read() engine.convert_tif_to_png(buffer) expect(engine.extension).to_equal('.png') def test_convert_tif_8bit_per_channel_to_png(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'gradient_8bit.tif'), 'r') as im: buffer = im.read() engine.convert_tif_to_png(buffer) expect(engine.extension).to_equal('.png') def test_can_set_resampling_filter(self): to_test = { 'LANCZOS': Image.LANCZOS, 'NEAREST': Image.NEAREST, 'BiLinear': Image.BILINEAR, 'bicubic': Image.BICUBIC, 'garbage': Image.LANCZOS, } if hasattr(Image, 'HAMMING'): to_test['HAMMING'] = Image.HAMMING for setting, expected in to_test.items(): cfg = Config(PILLOW_RESAMPLING_FILTER=setting) engine = Engine(Context(config=cfg)) expect(engine.get_resize_filter()).to_equal(expected) cfg = Config() engine = Engine(Context(config=cfg)) expect(engine.get_resize_filter()).to_equal(Image.LANCZOS) @mock.patch('thumbor.engines.pil.cv', new=None) @mock.patch('thumbor.engines.logger.error') def test_not_imported_cv2_failed_to_convert_tif_to_png(self, mockLogError): engine = Engine(self.context) with open(join(STORAGE_PATH, 'gradient_8bit.tif'), 'r') as im: buffer = im.read() returned_buffer = engine.convert_tif_to_png(buffer) expect(mockLogError.called).to_be_true() expect(buffer).to_equal(returned_buffer) def test_resize_truncated_image(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'BlueSquare_truncated.jpg'), 'r') as im: buffer = im.read() engine.load(buffer, '.jpg') engine.resize(10, 10) mode, _ = engine.image_data_as_rgb() expect(mode).to_equal('RGB') @skipUnless(METADATA_AVAILABLE, 'Pyexiv2 library not found. Skipping metadata tests.') def test_load_image_with_metadata(self): engine = Engine(self.context) with open(join(STORAGE_PATH, 'Christophe_Henner_-_June_2016.jpg'), 'r') as im: buffer = im.read() engine.load(buffer, None) image = engine.image expect(image.format).to_equal('JPEG') expect(engine.metadata).Not.to_be_null() expect(engine.metadata.__class__.__name__).to_equal('ImageMetadata') # read the xmp tags xmp_keys = engine.metadata.xmp_keys expect(len(xmp_keys)).to_equal(44) expect('Xmp.aux.LensSerialNumber' in xmp_keys).to_be_true() width = engine.metadata[b'Xmp.aux.LensSerialNumber'].value expect(width).to_equal('0000c139be') # read EXIF tags exif_keys = engine.metadata.exif_keys expect(len(exif_keys)).to_equal(37) expect('Exif.Image.Software' in exif_keys).to_be_true() expect(engine.metadata[b'Exif.Image.Software'].value).to_equal('Adobe Photoshop Lightroom 4.4 (Macintosh)') # read IPTC tags iptc_keys = engine.metadata.iptc_keys expect(len(iptc_keys)).to_equal(6) expect('Iptc.Application2.DateCreated' in iptc_keys).to_be_true() expect(engine.metadata[b'Iptc.Application2.DateCreated'].value).to_equal( [datetime.date(2016, 6, 23)] )
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 21541, 269, 18884, 1540, 2435, 199, 3, 4178, 921, 5031, 14, 957, 15, 16534, 269, 15, 16534, 269, 15, 6797, 199, 199, 3, 3909, 1334, 314, 10697, 4190, 26, 199, 3, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 199, 3, 1898, 334, 67, 9, 7760, 486, 320, 656, 14, 957, 21541, 269, 32, 3098, 2634, 14, 957, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 12, 3679, 63, 646, 199, 504, 747, 14, 515, 492, 19529, 12, 4263, 12, 9017, 199, 199, 504, 2882, 492, 7640, 12, 3372, 5524, 199, 504, 876, 26435, 492, 4282, 199, 199, 504, 14937, 492, 6047, 199, 199, 504, 21541, 269, 14, 1100, 492, 9470, 199, 504, 21541, 269, 14, 888, 492, 4094, 199, 504, 21541, 269, 14, 30378, 14, 80, 382, 492, 12580, 199, 199, 893, 26, 272, 687, 1134, 476, 1003, 18, 492, 6047, 5142, 221, 327, 8151, 272, 19357, 8071, 63, 17377, 275, 715, 199, 2590, 3545, 26, 272, 19357, 8071, 63, 17377, 275, 756, 199, 199, 646, 2197, 199, 646, 1683, 199, 199, 17467, 63, 3243, 275, 19529, 8, 904, 8, 3475, 3460, 493, 10139, 20644, 8769, 15, 4782, 15, 1333, 421, 199, 533, 18130, 8524, 1746, 8, 1746, 304, 339, 347, 664, 63, 1100, 8, 277, 304, 267, 4810, 275, 4094, 8, 288, 24143, 32712, 63, 3078, 534, 1348, 3635, 13, 15048, 297, 288, 5070, 14331, 534, 16534, 269, 14, 30378, 14, 80, 382, 297, 288, 25228, 63, 8314, 63, 5670, 63, 14019, 534, 476, 692, 12, 88, 311, 7, 267, 776, 267, 4810, 14, 7405, 540, 275, 298, 16534, 269, 14, 16370, 14, 493, 63, 3422, 2, 267, 4810, 14, 3817, 63, 7405, 540, 63, 5441, 63, 3243, 275, 4384, 726, 2962, 63, 3243, 267, 4810, 14, 17467, 275, 283, 16534, 269, 14, 3494, 83, 14, 889, 63, 3494, 7, 398, 372, 9470, 8, 888, 29, 4128, 9, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 1100, 275, 291, 14, 362, 63, 1100, 342, 339, 347, 511, 63, 981, 63, 3908, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 4282, 8, 3908, 680, 475, 63, 1235, 63, 842, 63, 1618, 8, 8524, 9, 339, 347, 511, 63, 912, 63, 1569, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 1569, 14, 8476, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 1834, 275, 6869, 14, 981, 63, 1569, 8, 2738, 9, 267, 4282, 8, 1569, 14, 908, 680, 475, 63, 1452, 360, 28412, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 975, 2075, 63, 529, 63, 2775, 63, 30740, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 30740, 63, 975, 66, 529, 2775, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 4282, 8, 2738, 680, 1397, 63, 475, 63, 1452, 8, 403, 9, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 975, 2075, 63, 529, 63, 2775, 63, 706, 66, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 706, 66, 63, 975, 66, 529, 2775, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 24, 2075, 63, 529, 63, 2775, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 24, 2075, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 2425, 63, 409, 63, 470, 23144, 63, 1541, 8, 277, 304, 267, 370, 63, 396, 275, 469, 288, 283, 10825, 27808, 3100, 356, 6047, 14, 10825, 27808, 3100, 12, 288, 283, 6388, 689, 1719, 356, 6047, 14, 6388, 689, 1719, 12, 288, 283, 17975, 10608, 356, 6047, 14, 34, 1193, 3565, 689, 12, 288, 283, 30435, 456, 530, 356, 6047, 14, 34, 948, 2533, 948, 12, 288, 283, 28737, 356, 6047, 14, 10825, 27808, 3100, 12, 267, 789, 398, 340, 2688, 8, 3491, 12, 283, 40, 1156, 45, 1206, 735, 288, 370, 63, 396, 459, 40, 1156, 45, 1206, 418, 275, 6047, 14, 40, 1156, 45, 1206, 398, 367, 4260, 12, 1420, 315, 370, 63, 396, 14, 1744, 837, 288, 4810, 275, 4094, 8, 48, 1193, 5896, 63, 3830, 7855, 1206, 63, 9905, 29, 6031, 9, 288, 6869, 275, 12580, 8, 2998, 8, 888, 29, 4128, 430, 288, 4282, 8, 3908, 14, 362, 63, 8709, 63, 1541, 8801, 475, 63, 1452, 8, 2062, 9, 398, 4810, 275, 4094, 342, 267, 6869, 275, 12580, 8, 2998, 8, 888, 29, 4128, 430, 267, 4282, 8, 3908, 14, 362, 63, 8709, 63, 1541, 8801, 475, 63, 1452, 8, 3491, 14, 10825, 27808, 3100, 9, 339, 768, 1805, 14, 2068, 360, 16534, 269, 14, 30378, 14, 80, 382, 14, 5107, 297, 892, 29, 403, 9, 272, 768, 1805, 14, 2068, 360, 16534, 269, 14, 30378, 14, 2921, 14, 705, 358, 272, 347, 511, 63, 1397, 63, 17932, 63, 5107, 18, 63, 4892, 63, 475, 63, 3916, 63, 9142, 63, 475, 63, 4524, 8, 277, 12, 1683, 2445, 547, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 21541, 269, 18884, 1540, 2435, 199, 3, 4178, 921, 5031, 14, 957, 15, 16534, 269, 15, 16534, 269, 15, 6797, 199, 199, 3, 3909, 1334, 314, 10697, 4190, 26, 199, 3, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 199, 3, 1898, 334, 67, 9, 7760, 486, 320, 656, 14, 957, 21541, 269, 32, 3098, 2634, 14, 957, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 12, 3679, 63, 646, 199, 504, 747, 14, 515, 492, 19529, 12, 4263, 12, 9017, 199, 199, 504, 2882, 492, 7640, 12, 3372, 5524, 199, 504, 876, 26435, 492, 4282, 199, 199, 504, 14937, 492, 6047, 199, 199, 504, 21541, 269, 14, 1100, 492, 9470, 199, 504, 21541, 269, 14, 888, 492, 4094, 199, 504, 21541, 269, 14, 30378, 14, 80, 382, 492, 12580, 199, 199, 893, 26, 272, 687, 1134, 476, 1003, 18, 492, 6047, 5142, 221, 327, 8151, 272, 19357, 8071, 63, 17377, 275, 715, 199, 2590, 3545, 26, 272, 19357, 8071, 63, 17377, 275, 756, 199, 199, 646, 2197, 199, 646, 1683, 199, 199, 17467, 63, 3243, 275, 19529, 8, 904, 8, 3475, 3460, 493, 10139, 20644, 8769, 15, 4782, 15, 1333, 421, 199, 533, 18130, 8524, 1746, 8, 1746, 304, 339, 347, 664, 63, 1100, 8, 277, 304, 267, 4810, 275, 4094, 8, 288, 24143, 32712, 63, 3078, 534, 1348, 3635, 13, 15048, 297, 288, 5070, 14331, 534, 16534, 269, 14, 30378, 14, 80, 382, 297, 288, 25228, 63, 8314, 63, 5670, 63, 14019, 534, 476, 692, 12, 88, 311, 7, 267, 776, 267, 4810, 14, 7405, 540, 275, 298, 16534, 269, 14, 16370, 14, 493, 63, 3422, 2, 267, 4810, 14, 3817, 63, 7405, 540, 63, 5441, 63, 3243, 275, 4384, 726, 2962, 63, 3243, 267, 4810, 14, 17467, 275, 283, 16534, 269, 14, 3494, 83, 14, 889, 63, 3494, 7, 398, 372, 9470, 8, 888, 29, 4128, 9, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 1100, 275, 291, 14, 362, 63, 1100, 342, 339, 347, 511, 63, 981, 63, 3908, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 4282, 8, 3908, 680, 475, 63, 1235, 63, 842, 63, 1618, 8, 8524, 9, 339, 347, 511, 63, 912, 63, 1569, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 1569, 14, 8476, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 1834, 275, 6869, 14, 981, 63, 1569, 8, 2738, 9, 267, 4282, 8, 1569, 14, 908, 680, 475, 63, 1452, 360, 28412, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 975, 2075, 63, 529, 63, 2775, 63, 30740, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 30740, 63, 975, 66, 529, 2775, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 4282, 8, 2738, 680, 1397, 63, 475, 63, 1452, 8, 403, 9, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 975, 2075, 63, 529, 63, 2775, 63, 706, 66, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 706, 66, 63, 975, 66, 529, 2775, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 3916, 63, 9142, 63, 24, 2075, 63, 529, 63, 2775, 63, 475, 63, 4524, 8, 277, 304, 267, 6869, 275, 12580, 8, 277, 14, 1100, 9, 267, 543, 1551, 8, 904, 8, 17467, 63, 3243, 12, 283, 7490, 63, 24, 2075, 14, 9142, 659, 283, 82, 358, 465, 3416, 26, 288, 3335, 275, 3416, 14, 739, 342, 267, 6869, 14, 3916, 63, 9142, 63, 475, 63, 4524, 8, 2738, 9, 267, 4282, 8, 3908, 14, 3435, 680, 475, 63, 1452, 5175, 4524, 358, 339, 347, 511, 63, 2425, 63, 409, 63, 470, 23144, 63, 1541, 8, 277, 304, 267, 370, 63, 396, 275, 469, 288, 283, 10825, 27808, 3100, 356, 6047, 14, 10825, 27808, 3100, 12, 288, 283, 6388, 689, 1719, 356, 6047, 14, 6388, 689, 1719, 12, 288, 283, 17975, 10608, 356, 6047, 14, 34, 1193, 3565, 689, 12, 288, 283, 30435, 456, 530, 356, 6047, 14, 34, 948, 2533, 948, 12, 288, 283, 28737, 356, 6047, 14, 10825, 27808, 3100, 12, 267, 789, 398, 340, 2688, 8, 3491, 12, 283, 40, 1156, 45, 1206, 735, 288, 370, 63, 396, 459, 40, 1156, 45, 1206, 418, 275, 6047, 14, 40, 1156, 45, 1206, 398, 367, 4260, 12, 1420, 315, 370, 63, 396, 14, 1744, 837, 288, 4810, 275, 4094, 8, 48, 1193, 5896, 63, 3830, 7855, 1206, 63, 9905, 29, 6031, 9, 288, 6869, 275, 12580, 8, 2998, 8, 888, 29, 4128, 430, 288, 4282, 8, 3908, 14, 362, 63, 8709, 63, 1541, 8801, 475, 63, 1452, 8, 2062, 9, 398, 4810, 275, 4094, 342, 267, 6869, 275, 12580, 8, 2998, 8, 888, 29, 4128, 430, 267, 4282, 8, 3908, 14, 362, 63, 8709, 63, 1541, 8801, 475, 63, 1452, 8, 3491, 14, 10825, 27808, 3100, 9, 339, 768, 1805, 14, 2068, 360, 16534, 269, 14, 30378, 14, 80, 382, 14, 5107, 297, 892, 29, 403, 9, 272, 768, 1805, 14, 2068, 360, 16534, 269, 14, 30378, 14, 2921, 14, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
AtScaleInc/Impala
tests/common/query.py
10
4808
#!/usr/bin/env python # Copyright (c) 2012 Cloudera, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from tests.util.test_file_parser import QueryTestSectionReader # TODO: This interface needs to be more robust; At the moment, it has two users with # completely different uses (the benchmark suite and the impala test suite) class Query(object): """Represents a query and all the information neede to execute it Attributes: query_str (str): The SQL query string. name (str): query name? scale_factor (str): for example 300gb, used to determine the database. test_vector (?): Specifies some parameters results (list of ?): ? workload_name (str): for example tpch, tpcds, visa (used to determine directory) db (str): ? represents the database table_format_str (str): ? """ def __init__(self, **kwargs): self.query_str = kwargs.get('query_str') self.name = kwargs.get('name') self.scale_factor = kwargs.get('scale_factor') self.test_vector = kwargs.get('test_vector') self.results = kwargs.get('results') self.workload_name = kwargs.get('workload') self.table_format_str = kwargs.get('table_format_str', str()) self.db = None # Only attempt to build the query if a query_str has been passed to the c'tor. # If it's None, assume the user wants to set a qualified query_str if self.query_str: self.__build_query() def __eq__(self, other): return (self.query_str == other.query_str and self.name == other.name and self.scale_factor == other.scale_factor and self.test_vector == other.test_vector and self.workload_name == other.workload_name and self.db == other.db) def __build_query(self): """Populates db, query_str, table_format_str""" self.db = QueryTestSectionReader.get_db_name(self.test_vector, self.scale_factor) self.query_str = QueryTestSectionReader.build_query(self.query_str.strip()) self.table_format_str = '%s/%s/%s' % (self.test_vector.file_format, self.test_vector.compression_codec, self.test_vector.compression_type) def __str__(self): msg = "Name: %s, Workload: %s, Scale Factor: %s, Table Format: %s" % (self.name, self.workload_name, self.scale_factor, self.table_format_str) return msg class QueryResult(object): """Contains the results of a query execution. Parameters: Required: query (Query): The query object associated with this result. start_time (datetime): Timestamp at the start of execution. query_config (BeeswaxQueryExecConfig) client_name (int): The thread id Optional: time_taken (float): Time taken to execute the query. summary (str): query exection summary (ex. returned 10 rows) data (list of str): Query results returned by Impala. runtime_profile (str): Saved runtime profile of the query's execution. exec_summary (TExecSummary) success (bool): True if the execution was successful. Attributes - these are modified by another class: query_error (str): Empty string if the query succeeded. Error returned by the client if it failed. executor_name (str) """ def __init__(self, query, **kwargs): self.query = query self.time_taken = kwargs.get('time_taken', 0.0) self.__summary = kwargs.get('summary', str()) self.data = kwargs.get('data', str()) self.start_time = kwargs.get('start_time') self.query_config = kwargs.get('query_config') self.client_name = kwargs.get('client_name') self.runtime_profile = kwargs.get('runtime_profile', str()) self.exec_summary = kwargs.get('exec_summary', str()) self.success = kwargs.get('success', False) self.query_error = str() self.executor_name = str() @property def summary(self): return self.__summary @summary.setter def summary(self, value): self.__summary = value def __str__(self): """Print human readable query execution details""" msg = "Query: %s, Start Time: %s, Time Taken: %s, Client Name: %s" % (self.query, self.start_time, self.time_taken, self.client_name) if not self.success: msg += " Error: %s" % self.query_error return msg
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 67, 9, 6029, 5980, 3786, 345, 12, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 504, 2295, 14, 1974, 14, 396, 63, 493, 63, 2087, 492, 8133, 774, 8660, 5929, 199, 199, 3, 3254, 26, 961, 3217, 4839, 370, 506, 1655, 23399, 27, 2854, 314, 12427, 12, 652, 965, 2877, 4390, 543, 199, 3, 14793, 3365, 4440, 334, 1589, 12338, 5241, 436, 314, 1742, 14774, 511, 5241, 9, 199, 533, 8133, 8, 785, 304, 523, 408, 18089, 282, 1827, 436, 1006, 314, 2556, 302, 1024, 271, 370, 5341, 652, 819, 9382, 26, 272, 1827, 63, 495, 334, 495, 304, 710, 5385, 1827, 1059, 14, 272, 536, 334, 495, 304, 1827, 536, 31, 272, 4666, 63, 4778, 334, 495, 304, 367, 2893, 9601, 4908, 12, 1202, 370, 6705, 314, 3050, 14, 272, 511, 63, 4106, 7558, 304, 11015, 2005, 2633, 272, 2058, 334, 513, 402, 5805, 304, 5805, 272, 1736, 912, 63, 354, 334, 495, 304, 367, 2893, 9253, 335, 12, 307, 2352, 795, 12, 373, 13655, 334, 2972, 370, 6705, 2082, 9, 272, 1592, 334, 495, 304, 5805, 8469, 314, 3050, 272, 1817, 63, 908, 63, 495, 334, 495, 304, 5805, 523, 408, 523, 347, 636, 826, 721, 277, 12, 1011, 958, 304, 272, 291, 14, 1131, 63, 495, 275, 2074, 14, 362, 360, 1131, 63, 495, 358, 272, 291, 14, 354, 275, 2074, 14, 362, 360, 354, 358, 272, 291, 14, 3467, 63, 4778, 275, 2074, 14, 362, 360, 3467, 63, 4778, 358, 272, 291, 14, 396, 63, 4106, 275, 2074, 14, 362, 360, 396, 63, 4106, 358, 272, 291, 14, 2604, 275, 2074, 14, 362, 360, 2604, 358, 272, 291, 14, 800, 912, 63, 354, 275, 2074, 14, 362, 360, 800, 912, 358, 272, 291, 14, 1224, 63, 908, 63, 495, 275, 2074, 14, 362, 360, 1224, 63, 908, 63, 495, 297, 620, 1012, 272, 291, 14, 697, 275, 488, 272, 327, 5972, 7427, 370, 1900, 314, 1827, 340, 282, 1827, 63, 495, 965, 2757, 3032, 370, 314, 286, 1133, 269, 14, 272, 327, 982, 652, 1159, 488, 12, 5534, 314, 922, 15061, 370, 663, 282, 12313, 1827, 63, 495, 272, 340, 291, 14, 1131, 63, 495, 26, 291, 855, 1506, 63, 1131, 342, 819, 347, 636, 4077, 721, 277, 12, 1163, 304, 272, 372, 334, 277, 14, 1131, 63, 495, 508, 1163, 14, 1131, 63, 495, 436, 288, 291, 14, 354, 508, 1163, 14, 354, 436, 288, 291, 14, 3467, 63, 4778, 508, 1163, 14, 3467, 63, 4778, 436, 288, 291, 14, 396, 63, 4106, 508, 1163, 14, 396, 63, 4106, 436, 288, 291, 14, 800, 912, 63, 354, 508, 1163, 14, 800, 912, 63, 354, 436, 288, 291, 14, 697, 508, 1163, 14, 697, 9, 819, 347, 636, 1506, 63, 1131, 8, 277, 304, 272, 408, 9606, 15409, 1592, 12, 1827, 63, 495, 12, 1817, 63, 908, 63, 495, 624, 272, 291, 14, 697, 275, 8133, 774, 8660, 5929, 14, 362, 63, 697, 63, 354, 8, 277, 14, 396, 63, 4106, 12, 291, 14, 3467, 63, 4778, 9, 272, 291, 14, 1131, 63, 495, 275, 8133, 774, 8660, 5929, 14, 1506, 63, 1131, 8, 277, 14, 1131, 63, 495, 14, 1913, 1012, 272, 291, 14, 1224, 63, 908, 63, 495, 275, 1543, 83, 3149, 83, 3149, 83, 7, 450, 334, 277, 14, 396, 63, 4106, 14, 493, 63, 908, 12, 5101, 291, 14, 396, 63, 4106, 14, 12849, 63, 9276, 12, 5101, 291, 14, 396, 63, 4106, 14, 12849, 63, 466, 9, 819, 347, 636, 495, 721, 277, 304, 272, 1499, 275, 298, 985, 26, 450, 83, 12, 9361, 912, 26, 450, 83, 12, 22869, 27348, 26, 450, 83, 12, 6957, 9701, 26, 450, 83, 2, 450, 334, 277, 14, 354, 12, 267, 291, 14, 800, 912, 63, 354, 12, 291, 14, 3467, 63, 4778, 12, 291, 14, 1224, 63, 908, 63, 495, 9, 272, 372, 1499, 421, 199, 533, 8133, 2889, 8, 785, 304, 523, 408, 6906, 314, 2058, 402, 282, 1827, 6451, 14, 819, 3897, 26, 272, 11105, 26, 489, 1827, 334, 3227, 304, 710, 1827, 909, 4568, 543, 642, 754, 14, 489, 1343, 63, 521, 334, 2083, 304, 18267, 737, 314, 1343, 402, 6451, 14, 489, 1827, 63, 888, 334, 3655, 397, 758, 88, 3227, 4858, 2028, 9, 489, 1890, 63, 354, 334, 442, 304, 710, 2462, 1305, 339, 4879, 26, 489, 900, 63, 28549, 334, 1609, 304, 4703, 9394, 370, 5341, 314, 1827, 14, 489, 6212, 334, 495, 304, 1827, 14778, 414, 6212, 334, 476, 14, 2138, 1616, 4730, 9, 489, 666, 334, 513, 402, 620, 304, 8133, 2058, 2138, 701, 8362, 14774, 14, 489, 8836, 63, 2913, 334, 495, 304, 29026, 8836, 4690, 402, 314, 1827, 1159, 6451, 14, 489, 2146, 63, 4705, 334, 52, 4858, 10407, 9, 489, 3182, 334, 2245, 304, 715, 340, 314, 6451, 1990, 9512, 14, 819, 9382, 446, 3520, 787, 6042, 701, 4573, 1021, 26, 272, 1827, 63, 705, 334, 495, 304, 9630, 1059, 340, 314, 1827, 19268, 14, 4520, 2138, 701, 314, 1890, 267, 340, 652, 3405, 14, 272, 13270, 63, 354, 334, 495, 9, 523, 408, 819, 347, 636, 826, 721, 277, 12, 1827, 12, 1011, 958, 304, 272, 291, 14, 1131, 275, 1827, 272, 291, 14, 521, 63, 28549, 275, 2074, 14, 362, 360, 521, 63, 28549, 297, 378, 14, 16, 9, 272, 291, 855, 4705 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 67, 9, 6029, 5980, 3786, 345, 12, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 504, 2295, 14, 1974, 14, 396, 63, 493, 63, 2087, 492, 8133, 774, 8660, 5929, 199, 199, 3, 3254, 26, 961, 3217, 4839, 370, 506, 1655, 23399, 27, 2854, 314, 12427, 12, 652, 965, 2877, 4390, 543, 199, 3, 14793, 3365, 4440, 334, 1589, 12338, 5241, 436, 314, 1742, 14774, 511, 5241, 9, 199, 533, 8133, 8, 785, 304, 523, 408, 18089, 282, 1827, 436, 1006, 314, 2556, 302, 1024, 271, 370, 5341, 652, 819, 9382, 26, 272, 1827, 63, 495, 334, 495, 304, 710, 5385, 1827, 1059, 14, 272, 536, 334, 495, 304, 1827, 536, 31, 272, 4666, 63, 4778, 334, 495, 304, 367, 2893, 9601, 4908, 12, 1202, 370, 6705, 314, 3050, 14, 272, 511, 63, 4106, 7558, 304, 11015, 2005, 2633, 272, 2058, 334, 513, 402, 5805, 304, 5805, 272, 1736, 912, 63, 354, 334, 495, 304, 367, 2893, 9253, 335, 12, 307, 2352, 795, 12, 373, 13655, 334, 2972, 370, 6705, 2082, 9, 272, 1592, 334, 495, 304, 5805, 8469, 314, 3050, 272, 1817, 63, 908, 63, 495, 334, 495, 304, 5805, 523, 408, 523, 347, 636, 826, 721, 277, 12, 1011, 958, 304, 272, 291, 14, 1131, 63, 495, 275, 2074, 14, 362, 360, 1131, 63, 495, 358, 272, 291, 14, 354, 275, 2074, 14, 362, 360, 354, 358, 272, 291, 14, 3467, 63, 4778, 275, 2074, 14, 362, 360, 3467, 63, 4778, 358, 272, 291, 14, 396, 63, 4106, 275, 2074, 14, 362, 360, 396, 63, 4106, 358, 272, 291, 14, 2604, 275, 2074, 14, 362, 360, 2604, 358, 272, 291, 14, 800, 912, 63, 354, 275, 2074, 14, 362, 360, 800, 912, 358, 272, 291, 14, 1224, 63, 908, 63, 495, 275, 2074, 14, 362, 360, 1224, 63, 908, 63, 495, 297, 620, 1012, 272, 291, 14, 697, 275, 488, 272, 327, 5972, 7427, 370, 1900, 314, 1827, 340, 282, 1827, 63, 495, 965, 2757, 3032, 370, 314, 286, 1133, 269, 14, 272, 327, 982, 652, 1159, 488, 12, 5534, 314, 922, 15061, 370, 663, 282, 12313, 1827, 63, 495, 272, 340, 291, 14, 1131, 63, 495, 26, 291, 855, 1506, 63, 1131, 342, 819, 347, 636, 4077, 721, 277, 12, 1163, 304, 272, 372, 334, 277, 14, 1131, 63, 495, 508, 1163, 14, 1131, 63, 495, 436, 288, 291, 14, 354, 508, 1163, 14, 354, 436, 288, 291, 14, 3467, 63, 4778, 508, 1163, 14, 3467, 63, 4778, 436, 288, 291, 14, 396, 63, 4106, 508, 1163, 14, 396, 63, 4106, 436, 288, 291, 14, 800, 912, 63, 354, 508, 1163, 14, 800, 912, 63, 354, 436, 288, 291, 14, 697, 508, 1163, 14, 697, 9, 819, 347, 636, 1506, 63, 1131, 8, 277, 304, 272, 408, 9606, 15409, 1592, 12, 1827, 63, 495, 12, 1817, 63, 908, 63, 495, 624, 272, 291, 14, 697, 275, 8133, 774, 8660, 5929, 14, 362, 63, 697, 63, 354, 8, 277, 14, 396, 63, 4106, 12, 291, 14, 3467, 63, 4778, 9, 272, 291, 14, 1131, 63, 495, 275, 8133, 774, 8660, 5929, 14, 1506, 63, 1131, 8, 277, 14, 1131, 63, 495, 14, 1913, 1012, 272, 291, 14, 1224, 63, 908, 63, 495, 275, 1543, 83, 3149, 83, 3149, 83, 7, 450, 334, 277, 14, 396, 63, 4106, 14, 493, 63, 908, 12, 5101, 291, 14, 396, 63, 4106, 14, 12849, 63, 9276, 12, 5101, 291, 14, 396, 63, 4106, 14, 12849, 63, 466, 9, 819, 347, 636, 495, 721, 277, 304, 272, 1499, 275, 298, 985, 26, 450, 83, 12, 9361, 912, 26, 450, 83, 12, 22869, 27348, 26, 450, 83, 12, 6957, 9701, 26, 450, 83, 2, 450, 334, 277, 14, 354, 12, 267, 291, 14, 800, 912, 63, 354, 12, 291, 14, 3467, 63, 4778, 12, 291, 14, 1224, 63, 908, 63, 495, 9, 272, 372, 1499, 421, 199, 533, 8133, 2889, 8, 785, 304, 523, 408, 6906, 314, 2058, 402, 282, 1827, 6451, 14, 819, 3897, 26, 272, 11105, 26, 489, 1827, 334, 3227, 304, 710, 1827, 909, 4568, 543, 642, 754, 14, 489, 1343, 63, 521, 334, 2083, 304, 18267, 737, 314, 1343, 402, 6451, 14, 489, 1827, 63, 888, 334, 3655, 397, 758, 88, 3227, 4858, 2028, 9, 489, 1890, 63, 354, 334, 442, 304, 710, 2462, 1305, 339, 4879, 26, 489, 900, 63, 28549, 334, 1609, 304, 4703, 9394, 370, 5341, 314, 1827, 14, 489, 6212, 334, 495, 304, 1827, 14778, 414, 6212, 334, 476, 14, 2138, 1616, 4730, 9, 489, 666, 334, 513, 402, 620, 304, 8133, 2058, 2138, 701, 8362, 14774, 14, 489, 8836, 63, 2913, 334, 495, 304, 29026, 8836, 4690, 402, 314, 1827, 1159, 6451, 14, 489, 2146, 63, 4705, 334, 52, 4858, 10407, 9, 489, 3182, 334, 2245, 304, 715, 340, 314, 6451, 1990, 9512, 14, 819, 9382, 446, 3520, 787, 6042, 701, 4573, 1021, 26, 272, 1827, 63, 705, 334, 495, 304, 9630, 1059, 340, 314, 1827, 19268, 14, 4520, 2138, 701, 314, 1890, 267, 340, 652, 3405, 14, 272, 13270, 63, 354, 334, 495, 9, 523, 408, 819, 347, 636, 826, 721, 277, 12, 1827, 12, 1011, 958, 304, 272, 291, 14, 1131, 275, 1827, 272, 291, 14, 521, 63, 28549, 275, 2074, 14, 362, 360, 521, 63, 28549, 297, 378, 14, 16, 9, 272, 291, 855, 4705, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
simplegeo/hadoop
contrib/hod/testing/testThreads.py
182
3075
#Licensed to the Apache Software Foundation (ASF) under one #or more contributor license agreements. See the NOTICE file #distributed with this work for additional information #regarding copyright ownership. The ASF licenses this file #to you under the Apache License, Version 2.0 (the #"License"); you may not use this file except in compliance #with the License. You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 #Unless required by applicable law or agreed to in writing, software #distributed under the License is distributed on an "AS IS" BASIS, #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #See the License for the specific language governing permissions and #limitations under the License. import unittest, os, sys, re, threading, time myDirectory = os.path.realpath(sys.argv[0]) rootDirectory = re.sub("/testing/.*", "", myDirectory) sys.path.append(rootDirectory) from testing.lib import BaseTestSuite # module specific imports import os, tempfile, random excludes = [] import getpass from hodlib.Common.threads import simpleCommand from testing.helper import sampleText # All test-case classes should have the naming convention test_.* class test_SimpleCommand(unittest.TestCase): def setUp(self): self.rootDir = '/tmp/hod-%s' % getpass.getuser() if not os.path.exists(self.rootDir): os.mkdir(self.rootDir) self.prefix= 'ThreadsTestSuite.test_SimpleCommand' self.testFile = None pass def testRedirectedStdout(self): self.testFile= tempfile.NamedTemporaryFile(dir=self.rootDir, \ prefix=self.prefix) cmd=simpleCommand('helper','%s %s 1 1>%s' % \ (sys.executable, \ os.path.join(rootDirectory, "testing", "helper.py"), \ self.testFile.name)) cmd.start() cmd.join() self.testFile.seek(0) stdout = self.testFile.read() # print stdout, sampleText assert(stdout == sampleText) pass def testRedirectedStderr(self): self.testFile= tempfile.NamedTemporaryFile(dir=self.rootDir, \ prefix=self.prefix) cmd=simpleCommand('helper','%s %s 2 2>%s' % \ (sys.executable, \ os.path.join(rootDirectory, "testing", "helper.py"), \ self.testFile.name)) cmd.start() cmd.join() self.testFile.seek(0) stderror = self.testFile.read() # print stderror, sampleText assert(stderror == sampleText) pass def tearDown(self): if self.testFile: self.testFile.close() pass class ThreadsTestSuite(BaseTestSuite): def __init__(self): # suite setup BaseTestSuite.__init__(self, __name__, excludes) pass def cleanUp(self): # suite tearDown pass def RunThreadsTests(): # modulename_suite suite = ThreadsTestSuite() testResult = suite.runTests() suite.cleanUp() return testResult if __name__ == "__main__": RunThreadsTests()
apache-2.0
[ 3, 31661, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 269, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 16832, 543, 642, 1736, 367, 4722, 2556, 199, 3, 1135, 1005, 316, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 475, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 23662, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 1045, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 3, 5524, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 16832, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 29946, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 9295, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 3097, 1298, 1334, 314, 844, 14, 199, 646, 2882, 12, 747, 12, 984, 12, 295, 12, 5796, 12, 900, 199, 199, 1662, 6231, 275, 747, 14, 515, 14, 11091, 8, 1274, 14, 3020, 59, 16, 566, 199, 1231, 6231, 257, 275, 295, 14, 954, 4769, 4776, 15, 2795, 401, 4873, 3002, 6231, 9, 199, 199, 1274, 14, 515, 14, 740, 8, 1231, 6231, 9, 199, 199, 504, 5343, 14, 773, 492, 3523, 10591, 199, 199, 3, 859, 2488, 8925, 199, 646, 747, 12, 5549, 12, 2196, 199, 199, 26984, 275, 942, 199, 199, 646, 18354, 199, 504, 394, 364, 773, 14, 7844, 14, 6962, 492, 3486, 3110, 199, 504, 5343, 14, 3676, 492, 2690, 1872, 199, 199, 3, 2900, 511, 13, 2546, 3992, 1077, 1172, 314, 19720, 16129, 511, 63, 2795, 199, 533, 511, 63, 3184, 3110, 8, 2796, 14, 1746, 304, 523, 347, 3613, 8, 277, 304, 272, 291, 14, 1231, 3567, 275, 1994, 2791, 15, 72, 364, 3295, 83, 7, 450, 18354, 14, 362, 751, 342, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 14, 1231, 3567, 304, 489, 747, 14, 8215, 8, 277, 14, 1231, 3567, 9, 272, 291, 14, 1861, 29, 283, 22785, 10591, 14, 396, 63, 3184, 3110, 7, 272, 291, 14, 396, 1173, 275, 488, 272, 986, 819, 347, 511, 497, 12080, 26080, 8, 277, 304, 272, 291, 14, 396, 1173, 29, 5549, 14, 19320, 8, 694, 29, 277, 14, 1231, 3567, 12, 971, 6901, 2403, 29, 277, 14, 1861, 9, 272, 2088, 29, 4129, 3110, 360, 3676, 1673, 5, 83, 450, 83, 413, 413, 6598, 83, 7, 450, 971, 1993, 334, 1274, 14, 5904, 12, 971, 1993, 747, 14, 515, 14, 904, 8, 1231, 6231, 12, 298, 4776, 401, 298, 3676, 14, 647, 1288, 971, 1993, 291, 14, 396, 1173, 14, 354, 430, 339, 2088, 14, 928, 342, 272, 2088, 14, 904, 342, 2286, 291, 14, 396, 1173, 14, 5507, 8, 16, 9, 272, 3839, 275, 291, 14, 396, 1173, 14, 739, 342, 272, 327, 870, 3839, 12, 2690, 1872, 272, 702, 8, 2703, 508, 2690, 1872, 9, 272, 986, 819, 347, 511, 497, 12080, 933, 2303, 8, 277, 304, 272, 291, 14, 396, 1173, 29, 5549, 14, 19320, 8, 694, 29, 277, 14, 1231, 3567, 12, 971, 6059, 2403, 29, 277, 14, 1861, 9, 272, 2088, 29, 4129, 3110, 360, 3676, 1673, 5, 83, 450, 83, 499, 499, 6598, 83, 7, 450, 971, 1993, 334, 1274, 14, 5904, 12, 971, 1993, 747, 14, 515, 14, 904, 8, 1231, 6231, 12, 298, 4776, 401, 298, 3676, 14, 647, 1288, 971, 1993, 291, 14, 396, 1173, 14, 354, 430, 272, 2088, 14, 928, 342, 272, 2088, 14, 904, 342, 489, 272, 291, 14, 396, 1173, 14, 5507, 8, 16, 9, 272, 410, 424, 451, 275, 291, 14, 396, 1173, 14, 739, 342, 272, 327, 870, 410, 424, 451, 12, 2690, 1872, 272, 702, 8, 270, 424, 451, 508, 2690, 1872, 9, 272, 986, 819, 347, 6766, 8, 277, 304, 272, 340, 291, 14, 396, 1173, 26, 291, 14, 396, 1173, 14, 1600, 342, 272, 986, 199, 199, 533, 11086, 83, 10591, 8, 1563, 10591, 304, 523, 347, 636, 826, 721, 277, 304, 272, 327, 5241, 3272, 272, 3523, 10591, 855, 826, 721, 277, 12, 636, 354, 3108, 23388, 9, 272, 986, 12244, 347, 3633, 1721, 8, 277, 304, 272, 327, 5241, 6766, 272, 986, 199, 199, 318, 3378, 22785, 2925, 837, 523, 327, 30045, 63, 5768, 523, 5241, 275, 11086, 83, 10591, 342, 523, 511, 2889, 275, 5241, 14, 1065, 2925, 342, 523, 5241, 14, 3118, 1721, 342, 523, 372, 511, 2889, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 3378, 22785, 2925, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 31661, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 269, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 16832, 543, 642, 1736, 367, 4722, 2556, 199, 3, 1135, 1005, 316, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 475, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 23662, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 1045, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 3, 5524, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 16832, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 29946, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 9295, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 3097, 1298, 1334, 314, 844, 14, 199, 646, 2882, 12, 747, 12, 984, 12, 295, 12, 5796, 12, 900, 199, 199, 1662, 6231, 275, 747, 14, 515, 14, 11091, 8, 1274, 14, 3020, 59, 16, 566, 199, 1231, 6231, 257, 275, 295, 14, 954, 4769, 4776, 15, 2795, 401, 4873, 3002, 6231, 9, 199, 199, 1274, 14, 515, 14, 740, 8, 1231, 6231, 9, 199, 199, 504, 5343, 14, 773, 492, 3523, 10591, 199, 199, 3, 859, 2488, 8925, 199, 646, 747, 12, 5549, 12, 2196, 199, 199, 26984, 275, 942, 199, 199, 646, 18354, 199, 504, 394, 364, 773, 14, 7844, 14, 6962, 492, 3486, 3110, 199, 504, 5343, 14, 3676, 492, 2690, 1872, 199, 199, 3, 2900, 511, 13, 2546, 3992, 1077, 1172, 314, 19720, 16129, 511, 63, 2795, 199, 533, 511, 63, 3184, 3110, 8, 2796, 14, 1746, 304, 523, 347, 3613, 8, 277, 304, 272, 291, 14, 1231, 3567, 275, 1994, 2791, 15, 72, 364, 3295, 83, 7, 450, 18354, 14, 362, 751, 342, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 14, 1231, 3567, 304, 489, 747, 14, 8215, 8, 277, 14, 1231, 3567, 9, 272, 291, 14, 1861, 29, 283, 22785, 10591, 14, 396, 63, 3184, 3110, 7, 272, 291, 14, 396, 1173, 275, 488, 272, 986, 819, 347, 511, 497, 12080, 26080, 8, 277, 304, 272, 291, 14, 396, 1173, 29, 5549, 14, 19320, 8, 694, 29, 277, 14, 1231, 3567, 12, 971, 6901, 2403, 29, 277, 14, 1861, 9, 272, 2088, 29, 4129, 3110, 360, 3676, 1673, 5, 83, 450, 83, 413, 413, 6598, 83, 7, 450, 971, 1993, 334, 1274, 14, 5904, 12, 971, 1993, 747, 14, 515, 14, 904, 8, 1231, 6231, 12, 298, 4776, 401, 298, 3676, 14, 647, 1288, 971, 1993, 291, 14, 396, 1173, 14, 354, 430, 339, 2088, 14, 928, 342, 272, 2088, 14, 904, 342, 2286, 291, 14, 396, 1173, 14, 5507, 8, 16, 9, 272, 3839, 275, 291, 14, 396, 1173, 14, 739, 342, 272, 327, 870, 3839, 12, 2690, 1872, 272, 702, 8, 2703, 508, 2690, 1872, 9, 272, 986, 819, 347, 511, 497, 12080, 933, 2303, 8, 277, 304, 272, 291, 14, 396, 1173, 29, 5549, 14, 19320, 8, 694, 29, 277, 14, 1231, 3567, 12, 971, 6059, 2403, 29, 277, 14, 1861, 9, 272, 2088, 29, 4129, 3110, 360, 3676, 1673, 5, 83, 450, 83, 499, 499, 6598, 83, 7, 450, 971, 1993, 334, 1274, 14, 5904, 12, 971, 1993, 747, 14, 515, 14, 904, 8, 1231, 6231, 12, 298, 4776, 401, 298, 3676, 14, 647, 1288, 971, 1993, 291, 14, 396, 1173, 14, 354, 430, 272, 2088, 14, 928, 342, 272, 2088, 14, 904, 342, 489, 272, 291, 14, 396, 1173, 14, 5507, 8, 16, 9, 272, 410, 424, 451, 275, 291, 14, 396, 1173, 14, 739, 342, 272, 327, 870, 410, 424, 451, 12, 2690, 1872, 272, 702, 8, 270, 424, 451, 508, 2690, 1872, 9, 272, 986, 819, 347, 6766, 8, 277, 304, 272, 340, 291, 14, 396, 1173, 26, 291, 14, 396, 1173, 14, 1600, 342, 272, 986, 199, 199, 533, 11086, 83, 10591, 8, 1563, 10591, 304, 523, 347, 636, 826, 721, 277, 304, 272, 327, 5241, 3272, 272, 3523, 10591, 855, 826, 721, 277, 12, 636, 354, 3108, 23388, 9, 272, 986, 12244, 347, 3633, 1721, 8, 277, 304, 272, 327, 5241, 6766, 272, 986, 199, 199, 318, 3378, 22785, 2925, 837, 523, 327, 30045, 63, 5768, 523, 5241, 275, 11086, 83, 10591, 342, 523, 511, 2889, 275, 5241, 14, 1065, 2925, 342, 523, 5241, 14, 3118, 1721, 342, 523, 372, 511, 2889, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 3378, 22785, 2925, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
alash3al/rethinkdb
external/v8_3.30.33.16/build/gyp/test/generator-output/gyptest-top-all.py
216
1437
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies building a project hierarchy created when the --generator-output= option is used to put the build configuration files in a separate directory tree. """ import TestGyp # Android doesn't support --generator-output. test = TestGyp.TestGyp(formats=['!android']) test.writable(test.workpath('src'), False) test.run_gyp('prog1.gyp', '-Dset_symroot=1', '--generator-output=' + test.workpath('gypfiles'), chdir='src') test.writable(test.workpath('src/build'), True) test.writable(test.workpath('src/subdir2/build'), True) test.writable(test.workpath('src/subdir3/build'), True) test.build('prog1.gyp', test.ALL, chdir='gypfiles') chdir = 'gypfiles' expect = """\ Hello from %s Hello from inc.h Hello from inc1/include1.h Hello from inc2/include2.h Hello from inc3/include3.h Hello from subdir2/deeper/deeper.h """ if test.format == 'xcode': chdir = 'src' test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') if test.format == 'xcode': chdir = 'src/subdir2' test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') if test.format == 'xcode': chdir = 'src/subdir3' test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') test.pass_test()
agpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 10015, 282, 2199, 14446, 2737, 1380, 314, 1553, 4679, 13, 1199, 29, 199, 1422, 365, 1202, 370, 5324, 314, 1900, 2897, 1584, 315, 282, 7396, 199, 3619, 3123, 14, 199, 624, 199, 199, 646, 25688, 199, 199, 3, 14694, 3181, 1133, 2291, 1553, 4679, 13, 1199, 14, 199, 396, 275, 25688, 14, 774, 13899, 8, 6321, 2968, 1, 6238, 1105, 199, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 659, 756, 9, 199, 199, 396, 14, 1065, 63, 6179, 360, 6595, 17, 14, 6179, 297, 1467, 2475, 36, 409, 63, 3840, 1231, 29, 17, 297, 1467, 2850, 4679, 13, 1199, 534, 435, 511, 14, 800, 515, 360, 6179, 1725, 659, 1467, 13097, 534, 2164, 358, 199, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 1506, 659, 715, 9, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 10622, 18, 15, 1506, 659, 715, 9, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 10622, 19, 15, 1506, 659, 715, 9, 199, 199, 396, 14, 1506, 360, 6595, 17, 14, 6179, 297, 511, 14, 1761, 12, 13097, 534, 6179, 1725, 358, 199, 199, 8563, 275, 283, 6179, 1725, 7, 199, 199, 4921, 275, 9638, 199, 6257, 687, 450, 83, 199, 6257, 687, 12864, 14, 72, 199, 6257, 687, 12864, 17, 15, 2613, 17, 14, 72, 199, 6257, 687, 12864, 18, 15, 2613, 18, 14, 72, 199, 6257, 687, 12864, 19, 15, 2613, 19, 14, 72, 199, 6257, 687, 15488, 18, 15, 11192, 529, 15, 11192, 529, 14, 72, 199, 624, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 17, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 17, 14, 67, 358, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 15, 10622, 18, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 18, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 18, 14, 67, 358, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 15, 10622, 19, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 19, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 19, 14, 67, 358, 199, 199, 396, 14, 1529, 63, 396, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 10015, 282, 2199, 14446, 2737, 1380, 314, 1553, 4679, 13, 1199, 29, 199, 1422, 365, 1202, 370, 5324, 314, 1900, 2897, 1584, 315, 282, 7396, 199, 3619, 3123, 14, 199, 624, 199, 199, 646, 25688, 199, 199, 3, 14694, 3181, 1133, 2291, 1553, 4679, 13, 1199, 14, 199, 396, 275, 25688, 14, 774, 13899, 8, 6321, 2968, 1, 6238, 1105, 199, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 659, 756, 9, 199, 199, 396, 14, 1065, 63, 6179, 360, 6595, 17, 14, 6179, 297, 1467, 2475, 36, 409, 63, 3840, 1231, 29, 17, 297, 1467, 2850, 4679, 13, 1199, 534, 435, 511, 14, 800, 515, 360, 6179, 1725, 659, 1467, 13097, 534, 2164, 358, 199, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 1506, 659, 715, 9, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 10622, 18, 15, 1506, 659, 715, 9, 199, 396, 14, 15053, 8, 396, 14, 800, 515, 360, 2164, 15, 10622, 19, 15, 1506, 659, 715, 9, 199, 199, 396, 14, 1506, 360, 6595, 17, 14, 6179, 297, 511, 14, 1761, 12, 13097, 534, 6179, 1725, 358, 199, 199, 8563, 275, 283, 6179, 1725, 7, 199, 199, 4921, 275, 9638, 199, 6257, 687, 450, 83, 199, 6257, 687, 12864, 14, 72, 199, 6257, 687, 12864, 17, 15, 2613, 17, 14, 72, 199, 6257, 687, 12864, 18, 15, 2613, 18, 14, 72, 199, 6257, 687, 12864, 19, 15, 2613, 19, 14, 72, 199, 6257, 687, 15488, 18, 15, 11192, 529, 15, 11192, 529, 14, 72, 199, 624, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 17, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 17, 14, 67, 358, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 15, 10622, 18, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 18, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 18, 14, 67, 358, 199, 199, 692, 511, 14, 908, 508, 283, 8701, 356, 523, 13097, 275, 283, 2164, 15, 10622, 19, 7, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 19, 297, 13097, 29, 8563, 12, 3839, 29, 4921, 450, 283, 6595, 19, 14, 67, 358, 199, 199, 396, 14, 1529, 63, 396, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
PeteTheAutomator/ACServerManager
session/migrations/0008_auto_20160902_1030.py
1
1888
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('session', '0007_auto_20160829_1728'), ] operations = [ migrations.AddField( model_name='preset', name='qualify_max_wait_perc', field=models.IntegerField(default=120, help_text=b'This is the factor to calculate the remaining time in a qualify session after the session is ended: 120 means that 120% of the session fastest lap remains to end the current lap'), ), migrations.AddField( model_name='preset', name='start_rule', field=models.IntegerField(default=2, help_text=b'Rules governing race starts / penalties for false-starts. (note: in "Drivethru" mode - if the race has 3 or less laps then the Teleport penalty is enabled)', choices=[(0, b'Car locked until start'), (1, b'Teleport'), (2, b'Drivethru')]), ), migrations.AlterField( model_name='preset', name='abs_allowed', field=models.IntegerField(default=1, help_text=b'Anti-lock brakes', choices=[(0, b'denied'), (1, b'factory'), (2, b'forced')]), ), migrations.AlterField( model_name='preset', name='race_over_time', field=models.IntegerField(default=90), ), migrations.AlterField( model_name='preset', name='race_wait_time', field=models.IntegerField(default=20, help_text=b'Seconds to wait before the start of the session'), ), migrations.AlterField( model_name='preset', name='tc_allowed', field=models.IntegerField(default=1, help_text=b'Traction-control', choices=[(0, b'denied'), (1, b'factory'), (2, b'forced')]), ), ]
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1730, 297, 283, 22530, 63, 2495, 63, 9261, 2036, 1398, 63, 1196, 1651, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 537, 2021, 63, 988, 63, 2573, 63, 27293, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 6708, 12, 1720, 63, 505, 29, 66, 7, 2765, 365, 314, 6535, 370, 8671, 314, 7971, 900, 315, 282, 6420, 2021, 2351, 2410, 314, 2351, 365, 22480, 26, 13960, 4910, 626, 13960, 5, 402, 314, 2351, 289, 32645, 28938, 25803, 370, 1284, 314, 1453, 28938, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 928, 63, 2200, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 18, 12, 1720, 63, 505, 29, 66, 7, 12920, 4210, 21209, 9174, 1182, 12374, 279, 1417, 367, 3055, 13, 17116, 14, 334, 4610, 26, 315, 298, 24276, 273, 6558, 2, 818, 446, 340, 314, 21209, 965, 650, 503, 6656, 1127, 1190, 2066, 314, 23884, 719, 21251, 365, 5223, 3196, 3415, 17497, 16, 12, 330, 7, 16034, 14233, 5133, 1343, 659, 334, 17, 12, 330, 7, 24944, 719, 659, 334, 18, 12, 330, 7, 24276, 273, 6558, 22864, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 2101, 63, 6541, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 17, 12, 1720, 63, 505, 29, 66, 7, 32522, 13, 831, 11137, 9246, 297, 3415, 17497, 16, 12, 330, 5121, 287, 5299, 659, 334, 17, 12, 330, 7, 3702, 659, 334, 18, 12, 330, 7, 28074, 22864, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 5986, 63, 1883, 63, 521, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 2710, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 5986, 63, 2573, 63, 521, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 1165, 12, 1720, 63, 505, 29, 66, 7, 13165, 370, 3618, 2544, 314, 1343, 402, 314, 2351, 659, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 3641, 63, 6541, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 17, 12, 1720, 63, 505, 29, 66, 7, 2437, 414, 13, 2785, 297, 3415, 17497, 16, 12, 330, 5121, 287, 5299, 659, 334, 17, 12, 330, 7, 3702, 659, 334, 18, 12, 330, 7, 28074, 22864, 267, 2318, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1730, 297, 283, 22530, 63, 2495, 63, 9261, 2036, 1398, 63, 1196, 1651, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 537, 2021, 63, 988, 63, 2573, 63, 27293, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 6708, 12, 1720, 63, 505, 29, 66, 7, 2765, 365, 314, 6535, 370, 8671, 314, 7971, 900, 315, 282, 6420, 2021, 2351, 2410, 314, 2351, 365, 22480, 26, 13960, 4910, 626, 13960, 5, 402, 314, 2351, 289, 32645, 28938, 25803, 370, 1284, 314, 1453, 28938, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 928, 63, 2200, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 18, 12, 1720, 63, 505, 29, 66, 7, 12920, 4210, 21209, 9174, 1182, 12374, 279, 1417, 367, 3055, 13, 17116, 14, 334, 4610, 26, 315, 298, 24276, 273, 6558, 2, 818, 446, 340, 314, 21209, 965, 650, 503, 6656, 1127, 1190, 2066, 314, 23884, 719, 21251, 365, 5223, 3196, 3415, 17497, 16, 12, 330, 7, 16034, 14233, 5133, 1343, 659, 334, 17, 12, 330, 7, 24944, 719, 659, 334, 18, 12, 330, 7, 24276, 273, 6558, 22864, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 2101, 63, 6541, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 17, 12, 1720, 63, 505, 29, 66, 7, 32522, 13, 831, 11137, 9246, 297, 3415, 17497, 16, 12, 330, 5121, 287, 5299, 659, 334, 17, 12, 330, 7, 3702, 659, 334, 18, 12, 330, 7, 28074, 22864, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 5986, 63, 1883, 63, 521, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 2710, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 5986, 63, 2573, 63, 521, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 1165, 12, 1720, 63, 505, 29, 66, 7, 13165, 370, 3618, 2544, 314, 1343, 402, 314, 2351, 659, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 25701, 297, 288, 536, 534, 3641, 63, 6541, 297, 288, 901, 29, 992, 14, 3901, 8, 885, 29, 17, 12, 1720, 63, 505, 29, 66, 7, 2437, 414, 13, 2785, 297, 3415, 17497, 16, 12, 330, 5121, 287, 5299, 659, 334, 17, 12, 330, 7, 3702, 659, 334, 18, 12, 330, 7, 28074, 22864, 267, 2318, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
djangorussia/django-1.3-branch
django/views/static.py
151
4888
""" Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ import mimetypes import os import posixpath import re import urllib from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified from django.template import loader, Template, Context, TemplateDoesNotExist from django.utils.http import http_date, parse_http_date def serve(request, path, document_root=None, show_indexes=False): """ Serve static files below a given point in the directory structure. To use, put a URL pattern such as:: (r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root' : '/path/to/my/files/'}) in your URLconf. You must provide the ``document_root`` param. You may also set ``show_indexes`` to ``True`` if you'd like to serve a basic index of the directory. This index view will use the template hardcoded below, but if you'd like to override it, you can create a template called ``static/directory_index.html``. """ path = posixpath.normpath(urllib.unquote(path)) path = path.lstrip('/') newpath = '' for part in path.split('/'): if not part: # Strip empty path components. continue drive, part = os.path.splitdrive(part) head, part = os.path.split(part) if part in (os.curdir, os.pardir): # Strip '.' and '..' in path. continue newpath = os.path.join(newpath, part).replace('\\', '/') if newpath and path != newpath: return HttpResponseRedirect(newpath) fullpath = os.path.join(document_root, newpath) if os.path.isdir(fullpath): if show_indexes: return directory_index(newpath, fullpath) raise Http404("Directory indexes are not allowed here.") if not os.path.exists(fullpath): raise Http404('"%s" does not exist' % fullpath) # Respect the If-Modified-Since header. statobj = os.stat(fullpath) mimetype, encoding = mimetypes.guess_type(fullpath) mimetype = mimetype or 'application/octet-stream' if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'), statobj.st_mtime, statobj.st_size): return HttpResponseNotModified(mimetype=mimetype) response = HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype) response["Last-Modified"] = http_date(statobj.st_mtime) response["Content-Length"] = statobj.st_size if encoding: response["Content-Encoding"] = encoding return response DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="robots" content="NONE,NOARCHIVE" /> <title>Index of {{ directory }}</title> </head> <body> <h1>Index of {{ directory }}</h1> <ul> {% ifnotequal directory "/" %} <li><a href="../">../</a></li> {% endifnotequal %} {% for f in file_list %} <li><a href="{{ f|urlencode }}">{{ f }}</a></li> {% endfor %} </ul> </body> </html> """ def directory_index(path, fullpath): try: t = loader.select_template(['static/directory_index.html', 'static/directory_index']) except TemplateDoesNotExist: t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE, name='Default directory index template') files = [] for f in os.listdir(fullpath): if not f.startswith('.'): if os.path.isdir(os.path.join(fullpath, f)): f += '/' files.append(f) c = Context({ 'directory' : path + '/', 'file_list' : files, }) return HttpResponse(t.render(c)) def was_modified_since(header=None, mtime=0, size=0): """ Was something modified since the user last downloaded it? header This is the value of the If-Modified-Since header. If this is None, I'll just return True. mtime This is the modification time of the item we're talking about. size This is the size of the item we're talking about. """ try: if header is None: raise ValueError matches = re.match(r"^([^;]+)(; length=([0-9]+))?$", header, re.IGNORECASE) header_mtime = parse_http_date(matches.group(1)) header_len = matches.group(3) if header_len and int(header_len) != size: raise ValueError if mtime > header_mtime: raise ValueError except (AttributeError, ValueError, OverflowError): return True return False
bsd-3-clause
[ 624, 199, 21180, 436, 3423, 367, 22701, 2955, 1584, 14, 5723, 787, 1454, 370, 506, 1202, 199, 27868, 16367, 12, 436, 428, 31909, 2845, 506, 1202, 315, 282, 9920, 4260, 14, 199, 624, 199, 199, 646, 13290, 199, 646, 747, 199, 646, 15454, 199, 646, 295, 199, 646, 4011, 199, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 12, 6183, 12, 14935, 12, 6183, 1763, 11911, 199, 504, 1639, 14, 1160, 492, 5077, 12, 5458, 12, 9470, 12, 27193, 199, 504, 1639, 14, 1208, 14, 1014, 492, 1455, 63, 602, 12, 2198, 63, 1014, 63, 602, 199, 199, 318, 14062, 8, 1069, 12, 931, 12, 2213, 63, 1231, 29, 403, 12, 2498, 63, 10116, 29, 797, 304, 272, 408, 272, 3739, 432, 2955, 1584, 5084, 282, 1627, 2376, 315, 314, 2082, 5523, 14, 339, 4005, 675, 12, 5324, 282, 2851, 3851, 4066, 465, 447, 398, 334, 82, 24550, 48, 28, 515, 26343, 4268, 283, 1176, 14, 4196, 14, 1986, 14, 4909, 297, 791, 3554, 63, 1231, 7, 520, 1994, 515, 15, 475, 15, 1662, 15, 1725, 15, 3071, 339, 315, 2195, 2851, 2190, 14, 2047, 1471, 5647, 314, 1124, 3554, 63, 1231, 1040, 1215, 14, 2047, 1443, 272, 2597, 663, 1124, 2384, 63, 10116, 1040, 370, 1124, 549, 1040, 340, 1265, 5121, 2839, 370, 14062, 282, 5678, 1478, 272, 402, 314, 2082, 14, 221, 961, 1478, 2455, 911, 675, 314, 1978, 7508, 15282, 5084, 12, 272, 1325, 340, 1265, 5121, 2839, 370, 4278, 652, 12, 1265, 883, 1218, 282, 1978, 2797, 272, 1124, 1986, 15, 3619, 63, 1080, 14, 1360, 4345, 272, 408, 272, 931, 275, 15454, 14, 9267, 8, 4078, 14, 12240, 8, 515, 430, 272, 931, 275, 931, 14, 10124, 7825, 272, 30965, 275, 2125, 272, 367, 1777, 315, 931, 14, 1294, 18265, 267, 340, 440, 1777, 26, 288, 327, 19828, 2701, 931, 7323, 14, 288, 1980, 267, 12912, 12, 1777, 275, 747, 14, 515, 14, 1294, 9541, 8, 2064, 9, 267, 4854, 12, 1777, 275, 747, 14, 515, 14, 1294, 8, 2064, 9, 267, 340, 1777, 315, 334, 736, 14, 15594, 12, 747, 14, 21386, 304, 288, 327, 19828, 7815, 436, 11541, 7, 315, 931, 14, 288, 1980, 267, 30965, 275, 747, 14, 515, 14, 904, 8, 1222, 515, 12, 1777, 680, 1814, 20786, 15107, 272, 340, 30965, 436, 931, 1137, 30965, 26, 267, 372, 14935, 8, 1222, 515, 9, 272, 26404, 275, 747, 14, 515, 14, 904, 8, 3554, 63, 1231, 12, 30965, 9, 272, 340, 747, 14, 515, 14, 6027, 8, 17943, 304, 267, 340, 2498, 63, 10116, 26, 288, 372, 2082, 63, 1080, 8, 1222, 515, 12, 26404, 9, 267, 746, 4760, 5188, 480, 6231, 10507, 787, 440, 4370, 2348, 2685, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 17943, 304, 267, 746, 4760, 5188, 32681, 83, 2, 1630, 440, 2187, 7, 450, 26404, 9, 272, 327, 3591, 1764, 314, 982, 13, 11911, 13, 24430, 1406, 14, 272, 5672, 1113, 275, 747, 14, 3736, 8, 17943, 9, 272, 12200, 12, 2644, 275, 13290, 14, 11636, 63, 466, 8, 17943, 9, 272, 12200, 275, 12200, 503, 283, 3578, 15, 18162, 13, 1745, 7, 272, 340, 440, 1990, 63, 5540, 63, 8585, 8, 1069, 14, 10614, 14, 362, 360, 2856, 63, 4656, 63, 30389, 63, 51, 568, 2089, 659, 2892, 5672, 1113, 14, 270, 63, 8180, 12, 5672, 1113, 14, 270, 63, 890, 304, 267, 372, 6183, 1763, 11911, 8, 17450, 29, 17450, 9, 272, 1177, 275, 6183, 8, 1490, 8, 17943, 12, 283, 4848, 1959, 739, 1062, 12200, 29, 17450, 9, 272, 1177, 905, 6090, 13, 11911, 937, 275, 1455, 63, 602, 8, 3736, 1113, 14, 270, 63, 8180, 9, 272, 1177, 905, 2714, 13, 4625, 937, 275, 5672, 1113, 14, 270, 63, 890, 272, 340, 2644, 26, 267, 1177, 905, 2714, 13, 7630, 937, 275, 2644, 272, 372, 1177, 421, 199, 3472, 63, 16436, 63, 10215, 63, 7433, 275, 408, 199, 11230, 16556, 3517, 21755, 21486, 55, 19, 35, 501, 21156, 26223, 413, 14, 16, 19894, 1588, 279, 501, 742, 2, 298, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 1766, 15, 12909, 17, 15, 21156, 15, 12909, 17, 13, 14143, 279, 14, 15662, 1743, 199, 28, 1360, 9604, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 16278, 15, 12909, 2, 2748, 26, 4159, 628, 287, 2, 6339, 628, 287, 1743, 523, 665, 2993, 30, 272, 665, 2024, 1455, 13, 20146, 628, 2714, 13, 466, 2, 1564, 628, 505, 15, 1360, 27, 5960, 29, 1624, 13, 24, 2, 7082, 272, 665, 2024, 1455, 13, 20146, 628, 2714, 13, 8493, 2, 1564, 628, 287, 13, 527, 2, 7082, 272, 665, 2024, 536, 628, 28889, 2, 1564, 628, 9185, 12, 2826, 28800, 2, 7082, 272, 665, 1213, 30, 2681, 402, 8448, 2082, 18519, 1213, 30, 523, 3068, 2993, 30, 523, 665, 2030, 30, 272, 665, 72, 17, 30, 2681, 402, 8448, 2082, 18519, 72, 17, 30, 272, 665, 348, 30, 489, 7749, 340, 4610, 537, 2082, 10609, 3674, 489, 665, 317, 2535, 65, 4369, 628, 5093, 1743, 5093, 1108, 65, 2957, 317, 30, 489, 7749, 14454, 4610, 537, 3674, 489, 7749, 367, 289, 315, 570, 63, 513, 3674, 489, 665, 317, 2535, 65, 4369, 628, 3638, 289, 92, 10738, 3586, 1743, 3638, 289, 18519, 65, 2957, 317, 30, 489, 7749, 17273, 3674, 272, 3068, 348, 30, 523, 3068, 2030, 30, 199, 1108, 1360, 30, 199, 624, 199, 199, 318, 2082, 63, 1080, 8, 515, 12, 26404, 304, 272, 862, 26, 267, 307, 275, 5077, 14, 2416, 63, 1160, 2941, 1986, 15, 3619, 63, 1080, 14, 1360, 297, 355, 283, 1986, 15, 3619, 63, 1080, 1105, 272, 871, 27193, 26, 267, 307, 275, 5458, 8, 3472, 63, 16436, 63, 10215, 63, 7433, 12, 536, 534, 2698, 2082, 1478, 1978, 358, 272, 1584, 275, 942, 272, 367, 289, 315, 747, 14, 7374, 8, 17943, 304, 267, 340, 440, 289, 14, 2460, 26461, 288, 340, 747, 14, 515, 14, 6027, 8, 736, 14, 515, 14, 904, 8, 17943, 12, 289, 2298, 355, 289, 847, 7324, 288, 1584, 14, 740, 8, 70, 9, 272, 286, 275, 9470, 2561, 267, 283, 3619, 7, 520, 931, 435, 17220, 267, 283, 493, 63 ]
[ 199, 21180, 436, 3423, 367, 22701, 2955, 1584, 14, 5723, 787, 1454, 370, 506, 1202, 199, 27868, 16367, 12, 436, 428, 31909, 2845, 506, 1202, 315, 282, 9920, 4260, 14, 199, 624, 199, 199, 646, 13290, 199, 646, 747, 199, 646, 15454, 199, 646, 295, 199, 646, 4011, 199, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 12, 6183, 12, 14935, 12, 6183, 1763, 11911, 199, 504, 1639, 14, 1160, 492, 5077, 12, 5458, 12, 9470, 12, 27193, 199, 504, 1639, 14, 1208, 14, 1014, 492, 1455, 63, 602, 12, 2198, 63, 1014, 63, 602, 199, 199, 318, 14062, 8, 1069, 12, 931, 12, 2213, 63, 1231, 29, 403, 12, 2498, 63, 10116, 29, 797, 304, 272, 408, 272, 3739, 432, 2955, 1584, 5084, 282, 1627, 2376, 315, 314, 2082, 5523, 14, 339, 4005, 675, 12, 5324, 282, 2851, 3851, 4066, 465, 447, 398, 334, 82, 24550, 48, 28, 515, 26343, 4268, 283, 1176, 14, 4196, 14, 1986, 14, 4909, 297, 791, 3554, 63, 1231, 7, 520, 1994, 515, 15, 475, 15, 1662, 15, 1725, 15, 3071, 339, 315, 2195, 2851, 2190, 14, 2047, 1471, 5647, 314, 1124, 3554, 63, 1231, 1040, 1215, 14, 2047, 1443, 272, 2597, 663, 1124, 2384, 63, 10116, 1040, 370, 1124, 549, 1040, 340, 1265, 5121, 2839, 370, 14062, 282, 5678, 1478, 272, 402, 314, 2082, 14, 221, 961, 1478, 2455, 911, 675, 314, 1978, 7508, 15282, 5084, 12, 272, 1325, 340, 1265, 5121, 2839, 370, 4278, 652, 12, 1265, 883, 1218, 282, 1978, 2797, 272, 1124, 1986, 15, 3619, 63, 1080, 14, 1360, 4345, 272, 408, 272, 931, 275, 15454, 14, 9267, 8, 4078, 14, 12240, 8, 515, 430, 272, 931, 275, 931, 14, 10124, 7825, 272, 30965, 275, 2125, 272, 367, 1777, 315, 931, 14, 1294, 18265, 267, 340, 440, 1777, 26, 288, 327, 19828, 2701, 931, 7323, 14, 288, 1980, 267, 12912, 12, 1777, 275, 747, 14, 515, 14, 1294, 9541, 8, 2064, 9, 267, 4854, 12, 1777, 275, 747, 14, 515, 14, 1294, 8, 2064, 9, 267, 340, 1777, 315, 334, 736, 14, 15594, 12, 747, 14, 21386, 304, 288, 327, 19828, 7815, 436, 11541, 7, 315, 931, 14, 288, 1980, 267, 30965, 275, 747, 14, 515, 14, 904, 8, 1222, 515, 12, 1777, 680, 1814, 20786, 15107, 272, 340, 30965, 436, 931, 1137, 30965, 26, 267, 372, 14935, 8, 1222, 515, 9, 272, 26404, 275, 747, 14, 515, 14, 904, 8, 3554, 63, 1231, 12, 30965, 9, 272, 340, 747, 14, 515, 14, 6027, 8, 17943, 304, 267, 340, 2498, 63, 10116, 26, 288, 372, 2082, 63, 1080, 8, 1222, 515, 12, 26404, 9, 267, 746, 4760, 5188, 480, 6231, 10507, 787, 440, 4370, 2348, 2685, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 17943, 304, 267, 746, 4760, 5188, 32681, 83, 2, 1630, 440, 2187, 7, 450, 26404, 9, 272, 327, 3591, 1764, 314, 982, 13, 11911, 13, 24430, 1406, 14, 272, 5672, 1113, 275, 747, 14, 3736, 8, 17943, 9, 272, 12200, 12, 2644, 275, 13290, 14, 11636, 63, 466, 8, 17943, 9, 272, 12200, 275, 12200, 503, 283, 3578, 15, 18162, 13, 1745, 7, 272, 340, 440, 1990, 63, 5540, 63, 8585, 8, 1069, 14, 10614, 14, 362, 360, 2856, 63, 4656, 63, 30389, 63, 51, 568, 2089, 659, 2892, 5672, 1113, 14, 270, 63, 8180, 12, 5672, 1113, 14, 270, 63, 890, 304, 267, 372, 6183, 1763, 11911, 8, 17450, 29, 17450, 9, 272, 1177, 275, 6183, 8, 1490, 8, 17943, 12, 283, 4848, 1959, 739, 1062, 12200, 29, 17450, 9, 272, 1177, 905, 6090, 13, 11911, 937, 275, 1455, 63, 602, 8, 3736, 1113, 14, 270, 63, 8180, 9, 272, 1177, 905, 2714, 13, 4625, 937, 275, 5672, 1113, 14, 270, 63, 890, 272, 340, 2644, 26, 267, 1177, 905, 2714, 13, 7630, 937, 275, 2644, 272, 372, 1177, 421, 199, 3472, 63, 16436, 63, 10215, 63, 7433, 275, 408, 199, 11230, 16556, 3517, 21755, 21486, 55, 19, 35, 501, 21156, 26223, 413, 14, 16, 19894, 1588, 279, 501, 742, 2, 298, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 1766, 15, 12909, 17, 15, 21156, 15, 12909, 17, 13, 14143, 279, 14, 15662, 1743, 199, 28, 1360, 9604, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 16278, 15, 12909, 2, 2748, 26, 4159, 628, 287, 2, 6339, 628, 287, 1743, 523, 665, 2993, 30, 272, 665, 2024, 1455, 13, 20146, 628, 2714, 13, 466, 2, 1564, 628, 505, 15, 1360, 27, 5960, 29, 1624, 13, 24, 2, 7082, 272, 665, 2024, 1455, 13, 20146, 628, 2714, 13, 8493, 2, 1564, 628, 287, 13, 527, 2, 7082, 272, 665, 2024, 536, 628, 28889, 2, 1564, 628, 9185, 12, 2826, 28800, 2, 7082, 272, 665, 1213, 30, 2681, 402, 8448, 2082, 18519, 1213, 30, 523, 3068, 2993, 30, 523, 665, 2030, 30, 272, 665, 72, 17, 30, 2681, 402, 8448, 2082, 18519, 72, 17, 30, 272, 665, 348, 30, 489, 7749, 340, 4610, 537, 2082, 10609, 3674, 489, 665, 317, 2535, 65, 4369, 628, 5093, 1743, 5093, 1108, 65, 2957, 317, 30, 489, 7749, 14454, 4610, 537, 3674, 489, 7749, 367, 289, 315, 570, 63, 513, 3674, 489, 665, 317, 2535, 65, 4369, 628, 3638, 289, 92, 10738, 3586, 1743, 3638, 289, 18519, 65, 2957, 317, 30, 489, 7749, 17273, 3674, 272, 3068, 348, 30, 523, 3068, 2030, 30, 199, 1108, 1360, 30, 199, 624, 199, 199, 318, 2082, 63, 1080, 8, 515, 12, 26404, 304, 272, 862, 26, 267, 307, 275, 5077, 14, 2416, 63, 1160, 2941, 1986, 15, 3619, 63, 1080, 14, 1360, 297, 355, 283, 1986, 15, 3619, 63, 1080, 1105, 272, 871, 27193, 26, 267, 307, 275, 5458, 8, 3472, 63, 16436, 63, 10215, 63, 7433, 12, 536, 534, 2698, 2082, 1478, 1978, 358, 272, 1584, 275, 942, 272, 367, 289, 315, 747, 14, 7374, 8, 17943, 304, 267, 340, 440, 289, 14, 2460, 26461, 288, 340, 747, 14, 515, 14, 6027, 8, 736, 14, 515, 14, 904, 8, 17943, 12, 289, 2298, 355, 289, 847, 7324, 288, 1584, 14, 740, 8, 70, 9, 272, 286, 275, 9470, 2561, 267, 283, 3619, 7, 520, 931, 435, 17220, 267, 283, 493, 63, 0 ]
[ 1, 1, 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Time-Line
libs_arm/wx/lib/pubsub/core/kwargs/listenerimpl.py
5
3561
""" :copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved. :license: BSD, see LICENSE_BSD_Simple.txt for details. """ from .listenerbase import ListenerBase, ValidatorBase from .callables import ListenerMismatchError class Listener(ListenerBase): """ Wraps a callable so it can be stored by weak reference and introspected to verify that it adheres to a topic's MDS. A Listener instance has the same hash value as the callable that it wraps. Callables that have 'argName=pub.AUTO_TOPIC' as a kwarg will be given the Topic object for the message sent by sendMessage(). Such a Listener will have wantsTopicObjOnCall() True. Callables that have a '\**kargs' argument will receive all message data, not just that for the topic they are subscribed to. Such a listener will have wantsAllMessageData() True. """ def __call__(self, kwargs, actualTopic, allKwargs=None): """Call the listener with **kwargs. Note that it raises RuntimeError if listener is dead. Should always return True (False would require the callable_ be dead but self hasn't yet been notified of it...).""" if self.acceptsAllKwargs: kwargs = allKwargs or kwargs # if allKwargs is None then use kwargs if self._autoTopicArgName is not None: kwargs = kwargs.copy() kwargs[self._autoTopicArgName] = actualTopic cb = self._callable() if cb is None: self._calledWhenDead() cb(**kwargs) return True class ListenerValidator(ValidatorBase): """ Do not accept any required args or *args; accept any **kwarg, and require that the Listener have at least all the kwargs (can have extra) of Topic. """ def _validateArgs(self, listener, paramsInfo): # accept **kwargs # accept *args # check if listener missing params (only possible if # paramsInfo.acceptsAllKwargs is False) allTopicMsgArgs = self._topicArgs | self._topicKwargs allParams = set(paramsInfo.allParams) if not paramsInfo.acceptsAllKwargs: missingParams = allTopicMsgArgs - allParams if missingParams: msg = 'needs to accept %s more args (%s)' \ % (len(missingParams), ''.join(missingParams)) raise ListenerMismatchError(msg, listener, missingParams) else: # then can accept that some parameters missing from listener # signature pass # check if there are unknown parameters in listener signature: extraArgs = allParams - allTopicMsgArgs if extraArgs: if allTopicMsgArgs: msg = 'args (%s) not allowed, should be (%s)' \ % (','.join(extraArgs), ','.join(allTopicMsgArgs)) else: msg = 'no args allowed, has (%s)' % ','.join(extraArgs) raise ListenerMismatchError(msg, listener, extraArgs) # we accept listener that has fewer required paams than TMS # since all args passed by name (previous showed that spec met # for all parameters). # now make sure listener doesn't require params that are optional in TMS: extraArgs = set( paramsInfo.getRequiredArgs() ) - self._topicArgs if extraArgs: msg = 'params (%s) missing default values' % (','.join(extraArgs),) raise ListenerMismatchError(msg, listener, extraArgs)
gpl-3.0
[ 624, 199, 199, 26, 7307, 26, 1898, 3967, 8315, 701, 593, 317, 422, 428, 2239, 287, 66, 6161, 12, 1006, 4481, 4644, 14, 199, 26, 1682, 26, 6289, 12, 1937, 5113, 63, 15400, 63, 3184, 14, 2424, 367, 2436, 14, 199, 199, 624, 199, 199, 504, 1275, 9799, 1095, 492, 491, 7938, 281, 1563, 12, 4821, 707, 1563, 199, 504, 1275, 1250, 5921, 492, 491, 7938, 281, 23055, 547, 421, 199, 533, 491, 7938, 281, 8, 10464, 1563, 304, 272, 408, 272, 644, 8146, 282, 4550, 880, 652, 883, 506, 5489, 701, 9282, 3659, 436, 1109, 4796, 1043, 272, 370, 4911, 626, 652, 1503, 426, 470, 370, 282, 7482, 1159, 603, 3177, 14, 221, 2286, 437, 491, 7938, 281, 1256, 5591, 965, 314, 2011, 2631, 574, 465, 314, 4550, 626, 652, 14018, 14, 18407, 6523, 5921, 626, 1172, 283, 1273, 985, 29, 5645, 14, 13883, 63, 23740, 7, 465, 282, 17582, 911, 272, 506, 1627, 314, 32166, 909, 367, 314, 1245, 4847, 701, 3222, 2209, 1252, 272, 32753, 282, 491, 7938, 281, 911, 1172, 15061, 12157, 5665, 3314, 2176, 342, 715, 14, 2286, 6523, 5921, 626, 1172, 282, 1557, 538, 24459, 7, 1423, 911, 9128, 1006, 1245, 272, 666, 12, 440, 2951, 626, 367, 314, 7482, 2985, 787, 30400, 370, 14, 32753, 282, 11647, 272, 911, 1172, 15061, 2422, 2209, 1451, 342, 715, 14, 5591, 408, 2286, 347, 636, 1250, 721, 277, 12, 2074, 12, 3503, 12157, 12, 1006, 26643, 589, 29, 403, 304, 267, 408, 2176, 314, 11647, 543, 1011, 958, 14, 3390, 626, 652, 6534, 6064, 267, 340, 11647, 365, 12314, 14, 7719, 3544, 372, 715, 334, 797, 3955, 4409, 267, 314, 4550, 63, 506, 12314, 1325, 291, 18699, 1133, 5966, 2757, 29535, 402, 652, 1396, 10477, 267, 340, 291, 14, 27692, 2422, 26643, 589, 26, 288, 2074, 275, 1006, 26643, 589, 503, 2074, 327, 340, 1006, 26643, 589, 365, 488, 2066, 675, 2074, 398, 340, 291, 423, 2495, 12157, 6373, 985, 365, 440, 488, 26, 288, 2074, 275, 2074, 14, 1574, 342, 288, 2074, 59, 277, 423, 2495, 12157, 6373, 985, 61, 275, 3503, 12157, 398, 7434, 275, 291, 423, 8296, 342, 267, 340, 7434, 365, 488, 26, 288, 291, 423, 3527, 11423, 22147, 342, 267, 7434, 3682, 958, 9, 398, 372, 715, 421, 199, 533, 491, 7938, 281, 8640, 8, 8640, 1563, 304, 272, 408, 272, 4226, 440, 4729, 1263, 1415, 1249, 503, 627, 589, 27, 4729, 1263, 1011, 12745, 12, 5591, 436, 4409, 626, 314, 491, 7938, 281, 1172, 737, 5210, 1006, 314, 2074, 334, 2425, 5591, 1172, 2402, 9, 402, 32166, 14, 272, 408, 2286, 347, 485, 3502, 6213, 8, 277, 12, 11647, 12, 1862, 2354, 304, 267, 327, 4729, 1011, 958, 267, 327, 4729, 627, 589, 2728, 327, 1104, 340, 11647, 4124, 1862, 334, 2118, 3962, 340, 267, 327, 1862, 2354, 14, 27692, 2422, 26643, 589, 365, 756, 9, 267, 1006, 12157, 6173, 6213, 275, 291, 423, 5746, 6213, 1204, 291, 423, 5746, 26643, 589, 267, 1006, 6007, 275, 663, 8, 1162, 2354, 14, 452, 6007, 9, 267, 340, 440, 1862, 2354, 14, 27692, 2422, 26643, 589, 26, 288, 4124, 6007, 275, 1006, 12157, 6173, 6213, 446, 1006, 6007, 288, 340, 4124, 6007, 26, 355, 1499, 275, 283, 10065, 370, 4729, 450, 83, 1655, 1249, 4366, 83, 3171, 971, 490, 450, 334, 552, 8, 4752, 6007, 395, 6522, 904, 8, 4752, 6007, 430, 355, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 4124, 6007, 9, 267, 587, 26, 288, 327, 2066, 883, 4729, 626, 2005, 2633, 4124, 687, 11647, 7205, 327, 4955, 288, 986, 10631, 327, 1104, 340, 2337, 787, 5809, 2633, 315, 11647, 4955, 26, 267, 2402, 6213, 275, 1006, 6007, 446, 1006, 12157, 6173, 6213, 267, 340, 2402, 6213, 26, 288, 340, 1006, 12157, 6173, 6213, 26, 355, 1499, 275, 283, 589, 4366, 83, 9, 440, 4370, 12, 1077, 506, 4366, 83, 3171, 971, 490, 450, 334, 26409, 904, 8, 2911, 6213, 395, 12814, 904, 8, 452, 12157, 6173, 6213, 430, 288, 587, 26, 355, 1499, 275, 283, 889, 1249, 4370, 12, 965, 4366, 83, 3171, 450, 12814, 904, 8, 2911, 6213, 9, 288, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 2402, 6213, 9, 398, 327, 781, 4729, 11647, 626, 965, 27392, 1415, 691, 19470, 2419, 377, 3053, 267, 327, 3967, 1006, 1249, 3032, 701, 536, 334, 6352, 2498, 379, 626, 3158, 7647, 267, 327, 367, 1006, 2633, 680, 398, 327, 3063, 1852, 3238, 11647, 3181, 1133, 4409, 1862, 626, 787, 2716, 315, 377, 3053, 26, 267, 2402, 6213, 275, 663, 8, 1862, 2354, 14, 362, 8030, 6213, 342, 776, 446, 291, 423, 5746, 6213, 267, 340, 2402, 6213, 26, 288, 1499, 275, 283, 1162, 4366, 83, 9, 4124, 849, 1338, 7, 450, 334, 26409, 904, 8, 2911, 6213, 16945, 288, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 2402, 6213, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 199, 26, 7307, 26, 1898, 3967, 8315, 701, 593, 317, 422, 428, 2239, 287, 66, 6161, 12, 1006, 4481, 4644, 14, 199, 26, 1682, 26, 6289, 12, 1937, 5113, 63, 15400, 63, 3184, 14, 2424, 367, 2436, 14, 199, 199, 624, 199, 199, 504, 1275, 9799, 1095, 492, 491, 7938, 281, 1563, 12, 4821, 707, 1563, 199, 504, 1275, 1250, 5921, 492, 491, 7938, 281, 23055, 547, 421, 199, 533, 491, 7938, 281, 8, 10464, 1563, 304, 272, 408, 272, 644, 8146, 282, 4550, 880, 652, 883, 506, 5489, 701, 9282, 3659, 436, 1109, 4796, 1043, 272, 370, 4911, 626, 652, 1503, 426, 470, 370, 282, 7482, 1159, 603, 3177, 14, 221, 2286, 437, 491, 7938, 281, 1256, 5591, 965, 314, 2011, 2631, 574, 465, 314, 4550, 626, 652, 14018, 14, 18407, 6523, 5921, 626, 1172, 283, 1273, 985, 29, 5645, 14, 13883, 63, 23740, 7, 465, 282, 17582, 911, 272, 506, 1627, 314, 32166, 909, 367, 314, 1245, 4847, 701, 3222, 2209, 1252, 272, 32753, 282, 491, 7938, 281, 911, 1172, 15061, 12157, 5665, 3314, 2176, 342, 715, 14, 2286, 6523, 5921, 626, 1172, 282, 1557, 538, 24459, 7, 1423, 911, 9128, 1006, 1245, 272, 666, 12, 440, 2951, 626, 367, 314, 7482, 2985, 787, 30400, 370, 14, 32753, 282, 11647, 272, 911, 1172, 15061, 2422, 2209, 1451, 342, 715, 14, 5591, 408, 2286, 347, 636, 1250, 721, 277, 12, 2074, 12, 3503, 12157, 12, 1006, 26643, 589, 29, 403, 304, 267, 408, 2176, 314, 11647, 543, 1011, 958, 14, 3390, 626, 652, 6534, 6064, 267, 340, 11647, 365, 12314, 14, 7719, 3544, 372, 715, 334, 797, 3955, 4409, 267, 314, 4550, 63, 506, 12314, 1325, 291, 18699, 1133, 5966, 2757, 29535, 402, 652, 1396, 10477, 267, 340, 291, 14, 27692, 2422, 26643, 589, 26, 288, 2074, 275, 1006, 26643, 589, 503, 2074, 327, 340, 1006, 26643, 589, 365, 488, 2066, 675, 2074, 398, 340, 291, 423, 2495, 12157, 6373, 985, 365, 440, 488, 26, 288, 2074, 275, 2074, 14, 1574, 342, 288, 2074, 59, 277, 423, 2495, 12157, 6373, 985, 61, 275, 3503, 12157, 398, 7434, 275, 291, 423, 8296, 342, 267, 340, 7434, 365, 488, 26, 288, 291, 423, 3527, 11423, 22147, 342, 267, 7434, 3682, 958, 9, 398, 372, 715, 421, 199, 533, 491, 7938, 281, 8640, 8, 8640, 1563, 304, 272, 408, 272, 4226, 440, 4729, 1263, 1415, 1249, 503, 627, 589, 27, 4729, 1263, 1011, 12745, 12, 5591, 436, 4409, 626, 314, 491, 7938, 281, 1172, 737, 5210, 1006, 314, 2074, 334, 2425, 5591, 1172, 2402, 9, 402, 32166, 14, 272, 408, 2286, 347, 485, 3502, 6213, 8, 277, 12, 11647, 12, 1862, 2354, 304, 267, 327, 4729, 1011, 958, 267, 327, 4729, 627, 589, 2728, 327, 1104, 340, 11647, 4124, 1862, 334, 2118, 3962, 340, 267, 327, 1862, 2354, 14, 27692, 2422, 26643, 589, 365, 756, 9, 267, 1006, 12157, 6173, 6213, 275, 291, 423, 5746, 6213, 1204, 291, 423, 5746, 26643, 589, 267, 1006, 6007, 275, 663, 8, 1162, 2354, 14, 452, 6007, 9, 267, 340, 440, 1862, 2354, 14, 27692, 2422, 26643, 589, 26, 288, 4124, 6007, 275, 1006, 12157, 6173, 6213, 446, 1006, 6007, 288, 340, 4124, 6007, 26, 355, 1499, 275, 283, 10065, 370, 4729, 450, 83, 1655, 1249, 4366, 83, 3171, 971, 490, 450, 334, 552, 8, 4752, 6007, 395, 6522, 904, 8, 4752, 6007, 430, 355, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 4124, 6007, 9, 267, 587, 26, 288, 327, 2066, 883, 4729, 626, 2005, 2633, 4124, 687, 11647, 7205, 327, 4955, 288, 986, 10631, 327, 1104, 340, 2337, 787, 5809, 2633, 315, 11647, 4955, 26, 267, 2402, 6213, 275, 1006, 6007, 446, 1006, 12157, 6173, 6213, 267, 340, 2402, 6213, 26, 288, 340, 1006, 12157, 6173, 6213, 26, 355, 1499, 275, 283, 589, 4366, 83, 9, 440, 4370, 12, 1077, 506, 4366, 83, 3171, 971, 490, 450, 334, 26409, 904, 8, 2911, 6213, 395, 12814, 904, 8, 452, 12157, 6173, 6213, 430, 288, 587, 26, 355, 1499, 275, 283, 889, 1249, 4370, 12, 965, 4366, 83, 3171, 450, 12814, 904, 8, 2911, 6213, 9, 288, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 2402, 6213, 9, 398, 327, 781, 4729, 11647, 626, 965, 27392, 1415, 691, 19470, 2419, 377, 3053, 267, 327, 3967, 1006, 1249, 3032, 701, 536, 334, 6352, 2498, 379, 626, 3158, 7647, 267, 327, 367, 1006, 2633, 680, 398, 327, 3063, 1852, 3238, 11647, 3181, 1133, 4409, 1862, 626, 787, 2716, 315, 377, 3053, 26, 267, 2402, 6213, 275, 663, 8, 1862, 2354, 14, 362, 8030, 6213, 342, 776, 446, 291, 423, 5746, 6213, 267, 340, 2402, 6213, 26, 288, 1499, 275, 283, 1162, 4366, 83, 9, 4124, 849, 1338, 7, 450, 334, 26409, 904, 8, 2911, 6213, 16945, 288, 746, 491, 7938, 281, 23055, 547, 8, 1328, 12, 11647, 12, 2402, 6213, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
thardie/Diamond
src/collectors/ceph/test/testceph.py
60
7717
#!/usr/bin/python # coding=utf-8 try: import json except ImportError: import simplejson as json import subprocess from test import CollectorTestCase from test import get_collector_config from test import unittest from test import run_only from mock import patch, call from diamond.collector import Collector import ceph def run_only_if_assertSequenceEqual_is_available(func): pred = lambda: 'assertSequenceEqual' in dir(unittest.TestCase) return run_only(func, pred) def run_only_if_subprocess_check_output_is_available(func): pred = lambda: 'check_output' in dir(subprocess) return run_only(func, pred) class TestCounterIterator(unittest.TestCase): @run_only_if_assertSequenceEqual_is_available def test_empty(self): data = {} expected = [] actual = list(ceph.flatten_dictionary(data)) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_simple(self): data = {'a': 1, 'b': 2} expected = [('a', 1), ('b', 2)] actual = list(ceph.flatten_dictionary(data)) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_prefix(self): data = {'a': 1, 'b': 2} expected = [('Z.a', 1), ('Z.b', 2)] actual = list(ceph.flatten_dictionary(data, prefix='Z')) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_sep(self): data = {'a': 1, 'b': 2} expected = [('Z:a', 1), ('Z:b', 2)] actual = list(ceph.flatten_dictionary(data, prefix='Z', sep=':')) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_nested(self): data = {'a': 1, 'b': 2, 'c': {'d': 3}} expected = [('a', 1), ('b', 2), ('c.d', 3)] actual = list(ceph.flatten_dictionary(data)) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_doubly_nested(self): data = {'a': 1, 'b': 2, 'c': {'d': 3}, 'e': {'f': {'g': 1}}} expected = [('a', 1), ('b', 2), ('c.d', 3), ('e.f.g', 1)] actual = list(ceph.flatten_dictionary(data)) self.assertSequenceEqual(actual, expected) @run_only_if_assertSequenceEqual_is_available def test_complex(self): data = {"val": 0, "max": 524288000, "get": 60910, "wait": {"avgcount": 0, "sum": 0}, } expected = [ ('get', 60910), ('max', 524288000), ('val', 0), ('wait.avgcount', 0), ('wait.sum', 0), ] actual = list(ceph.flatten_dictionary(data)) self.assertSequenceEqual(actual, expected) class TestCephCollectorSocketNameHandling(CollectorTestCase): def setUp(self): config = get_collector_config('CephCollector', { 'interval': 10, }) self.collector = ceph.CephCollector(config, None) def test_counter_default_prefix(self): expected = 'ceph.osd.325' sock = '/var/run/ceph/ceph-osd.325.asok' actual = self.collector._get_counter_prefix_from_socket_name(sock) self.assertEquals(actual, expected) def test_counter_alternate_prefix(self): expected = 'ceph.keep-osd.325' sock = '/var/run/ceph/keep-osd.325.asok' actual = self.collector._get_counter_prefix_from_socket_name(sock) self.assertEquals(actual, expected) @patch('glob.glob') def test_get_socket_paths(self, glob_mock): config = get_collector_config('CephCollector', { 'socket_path': '/path/', 'socket_prefix': 'prefix-', 'socket_ext': 'ext', }) collector = ceph.CephCollector(config, None) collector._get_socket_paths() glob_mock.assert_called_with('/path/prefix-*.ext') class TestCephCollectorGettingStats(CollectorTestCase): def setUp(self): config = get_collector_config('CephCollector', { 'interval': 10, }) self.collector = ceph.CephCollector(config, None) def test_import(self): self.assertTrue(ceph.CephCollector) @run_only_if_subprocess_check_output_is_available @patch('subprocess.check_output') def test_load_works(self, check_output): expected = {'a': 1, 'b': 2, } check_output.return_value = json.dumps(expected) actual = self.collector._get_stats_from_socket('a_socket_name') check_output.assert_called_with(['/usr/bin/ceph', '--admin-daemon', 'a_socket_name', 'perf', 'dump', ]) self.assertEqual(actual, expected) @run_only_if_subprocess_check_output_is_available @patch('subprocess.check_output') def test_ceph_command_fails(self, check_output): check_output.side_effect = subprocess.CalledProcessError( 255, ['/usr/bin/ceph'], 'error!', ) actual = self.collector._get_stats_from_socket('a_socket_name') check_output.assert_called_with(['/usr/bin/ceph', '--admin-daemon', 'a_socket_name', 'perf', 'dump', ]) self.assertEqual(actual, {}) @run_only_if_subprocess_check_output_is_available @patch('json.loads') @patch('subprocess.check_output') def test_json_decode_fails(self, check_output, loads): input = {'a': 1, 'b': 2, } check_output.return_value = json.dumps(input) loads.side_effect = ValueError('bad data') actual = self.collector._get_stats_from_socket('a_socket_name') check_output.assert_called_with(['/usr/bin/ceph', '--admin-daemon', 'a_socket_name', 'perf', 'dump', ]) loads.assert_called_with(json.dumps(input)) self.assertEqual(actual, {}) class TestCephCollectorPublish(CollectorTestCase): def setUp(self): config = get_collector_config('CephCollector', { 'interval': 10, }) self.collector = ceph.CephCollector(config, None) @patch.object(Collector, 'publish') def test_simple(self, publish_mock): self.collector._publish_stats('prefix', {'a': 1}) publish_mock.assert_called_with('prefix.a', 1, metric_type='GAUGE', instance=None, precision=0) @patch.object(Collector, 'publish') def test_multiple(self, publish_mock): self.collector._publish_stats('prefix', {'a': 1, 'b': 2}) publish_mock.assert_has_calls([call('prefix.a', 1, metric_type='GAUGE', instance=None, precision=0), call('prefix.b', 2, metric_type='GAUGE', instance=None, precision=0), ]) if __name__ == "__main__": unittest.main()
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 2803, 29, 1624, 13, 24, 199, 199, 893, 26, 272, 492, 2022, 199, 2590, 3545, 26, 272, 492, 13804, 465, 2022, 199, 199, 646, 3873, 199, 199, 504, 511, 492, 3626, 3283, 1746, 199, 504, 511, 492, 664, 63, 10946, 63, 888, 199, 504, 511, 492, 2882, 199, 504, 511, 492, 1255, 63, 2118, 199, 504, 1683, 492, 3371, 12, 1240, 199, 199, 504, 487, 24940, 14, 10946, 492, 3626, 3283, 199, 646, 27316, 421, 199, 318, 1255, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 8, 1532, 304, 272, 8869, 275, 2400, 26, 283, 19376, 7, 315, 2935, 8, 2796, 14, 1746, 9, 272, 372, 1255, 63, 2118, 8, 1532, 12, 8869, 9, 421, 199, 318, 1255, 63, 2118, 63, 692, 63, 5781, 63, 1074, 63, 1199, 63, 374, 63, 4561, 8, 1532, 304, 272, 8869, 275, 2400, 26, 283, 1074, 63, 1199, 7, 315, 2935, 8, 5781, 9, 272, 372, 1255, 63, 2118, 8, 1532, 12, 8869, 9, 421, 199, 533, 1379, 11348, 3585, 8, 2796, 14, 1746, 304, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1667, 8, 277, 304, 267, 666, 275, 1052, 267, 1420, 275, 942, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 4129, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1861, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 58, 14, 65, 297, 413, 395, 661, 58, 14, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 12, 2403, 534, 58, 1333, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 4127, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 58, 26, 65, 297, 413, 395, 661, 58, 26, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 12, 2403, 534, 58, 297, 7375, 18749, 1333, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 6376, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 12, 283, 67, 356, 791, 68, 356, 650, 4863, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 395, 661, 67, 14, 68, 297, 650, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1117, 456, 590, 63, 6376, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 12, 283, 67, 356, 791, 68, 356, 650, 1386, 283, 69, 356, 791, 70, 356, 791, 71, 356, 413, 4863, 93, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 395, 661, 67, 14, 68, 297, 650, 395, 661, 69, 14, 70, 14, 71, 297, 413, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 5254, 8, 277, 304, 267, 666, 275, 2420, 637, 582, 378, 12, 355, 298, 988, 582, 959, 1194, 10740, 1493, 12, 355, 298, 362, 582, 1227, 1643, 709, 12, 355, 298, 2573, 582, 2420, 8595, 835, 582, 378, 12, 586, 298, 1838, 582, 378, 1386, 355, 789, 267, 1420, 275, 359, 288, 661, 362, 297, 1227, 1643, 709, 395, 288, 661, 988, 297, 959, 1194, 10740, 1493, 395, 288, 661, 637, 297, 378, 395, 288, 661, 2573, 14, 8595, 835, 297, 378, 395, 288, 661, 2573, 14, 1838, 297, 378, 395, 267, 1622, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 421, 199, 533, 1379, 24417, 838, 12852, 3869, 985, 26443, 8, 12852, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 1101, 275, 664, 63, 10946, 63, 888, 360, 24417, 838, 12852, 297, 469, 288, 283, 4284, 356, 1616, 12, 267, 3828, 267, 291, 14, 10946, 275, 27316, 14, 24417, 838, 12852, 8, 888, 12, 488, 9, 339, 347, 511, 63, 5337, 63, 885, 63, 1861, 8, 277, 304, 267, 1420, 275, 283, 20266, 14, 736, 68, 14, 13288, 7, 267, 6771, 275, 1994, 1391, 15, 1065, 15, 20266, 15, 20266, 13, 736, 68, 14, 13288, 14, 305, 745, 7, 267, 3503, 275, 291, 14, 10946, 423, 362, 63, 5337, 63, 1861, 63, 504, 63, 3450, 63, 354, 8, 5096, 9, 267, 291, 14, 2947, 8, 6514, 12, 1420, 9, 339, 347, 511, 63, 5337, 63, 17170, 63, 1861, 8, 277, 304, 267, 1420, 275, 283, 20266, 14, 3250, 13, 736, 68, 14, 13288, 7, 267, 6771, 275, 1994, 1391, 15, 1065, 15, 20266, 15, 3250, 13, 736, 68, 14, 13288, 14, 305, 745, 7, 267, 3503, 275, 291, 14, 10946, 423, 362, 63, 5337, 63, 1861, 63, 504, 63, 3450, 63, 354, 8, 5096, 9, 267, 291, 14, 2947, 8, 6514, 12, 1420, 9, 339, 768, 2068, 360, 6463, 14, 6463, 358, 272, 347, 511, 63, 362, 63, 3450, 63, 3771, 8, 277, 12, 5739, 63, 1805, 304, 267, 1101, 275, 664, 63, 10946, 63, 888, 360, 24417, 838, 12852 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 2803, 29, 1624, 13, 24, 199, 199, 893, 26, 272, 492, 2022, 199, 2590, 3545, 26, 272, 492, 13804, 465, 2022, 199, 199, 646, 3873, 199, 199, 504, 511, 492, 3626, 3283, 1746, 199, 504, 511, 492, 664, 63, 10946, 63, 888, 199, 504, 511, 492, 2882, 199, 504, 511, 492, 1255, 63, 2118, 199, 504, 1683, 492, 3371, 12, 1240, 199, 199, 504, 487, 24940, 14, 10946, 492, 3626, 3283, 199, 646, 27316, 421, 199, 318, 1255, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 8, 1532, 304, 272, 8869, 275, 2400, 26, 283, 19376, 7, 315, 2935, 8, 2796, 14, 1746, 9, 272, 372, 1255, 63, 2118, 8, 1532, 12, 8869, 9, 421, 199, 318, 1255, 63, 2118, 63, 692, 63, 5781, 63, 1074, 63, 1199, 63, 374, 63, 4561, 8, 1532, 304, 272, 8869, 275, 2400, 26, 283, 1074, 63, 1199, 7, 315, 2935, 8, 5781, 9, 272, 372, 1255, 63, 2118, 8, 1532, 12, 8869, 9, 421, 199, 533, 1379, 11348, 3585, 8, 2796, 14, 1746, 304, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1667, 8, 277, 304, 267, 666, 275, 1052, 267, 1420, 275, 942, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 4129, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1861, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 58, 14, 65, 297, 413, 395, 661, 58, 14, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 12, 2403, 534, 58, 1333, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 4127, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 93, 267, 1420, 275, 4274, 58, 26, 65, 297, 413, 395, 661, 58, 26, 66, 297, 499, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 12, 2403, 534, 58, 297, 7375, 18749, 1333, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 6376, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 12, 283, 67, 356, 791, 68, 356, 650, 4863, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 395, 661, 67, 14, 68, 297, 650, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 1117, 456, 590, 63, 6376, 8, 277, 304, 267, 666, 275, 791, 65, 356, 413, 12, 283, 66, 356, 499, 12, 283, 67, 356, 791, 68, 356, 650, 1386, 283, 69, 356, 791, 70, 356, 791, 71, 356, 413, 4863, 93, 267, 1420, 275, 4274, 65, 297, 413, 395, 661, 66, 297, 499, 395, 661, 67, 14, 68, 297, 650, 395, 661, 69, 14, 70, 14, 71, 297, 413, 1874, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 339, 768, 1065, 63, 2118, 63, 692, 63, 19376, 63, 374, 63, 4561, 272, 347, 511, 63, 5254, 8, 277, 304, 267, 666, 275, 2420, 637, 582, 378, 12, 355, 298, 988, 582, 959, 1194, 10740, 1493, 12, 355, 298, 362, 582, 1227, 1643, 709, 12, 355, 298, 2573, 582, 2420, 8595, 835, 582, 378, 12, 586, 298, 1838, 582, 378, 1386, 355, 789, 267, 1420, 275, 359, 288, 661, 362, 297, 1227, 1643, 709, 395, 288, 661, 988, 297, 959, 1194, 10740, 1493, 395, 288, 661, 637, 297, 378, 395, 288, 661, 2573, 14, 8595, 835, 297, 378, 395, 288, 661, 2573, 14, 1838, 297, 378, 395, 267, 1622, 267, 3503, 275, 769, 8, 20266, 14, 8487, 63, 9086, 8, 576, 430, 267, 291, 14, 19376, 8, 6514, 12, 1420, 9, 421, 199, 533, 1379, 24417, 838, 12852, 3869, 985, 26443, 8, 12852, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 1101, 275, 664, 63, 10946, 63, 888, 360, 24417, 838, 12852, 297, 469, 288, 283, 4284, 356, 1616, 12, 267, 3828, 267, 291, 14, 10946, 275, 27316, 14, 24417, 838, 12852, 8, 888, 12, 488, 9, 339, 347, 511, 63, 5337, 63, 885, 63, 1861, 8, 277, 304, 267, 1420, 275, 283, 20266, 14, 736, 68, 14, 13288, 7, 267, 6771, 275, 1994, 1391, 15, 1065, 15, 20266, 15, 20266, 13, 736, 68, 14, 13288, 14, 305, 745, 7, 267, 3503, 275, 291, 14, 10946, 423, 362, 63, 5337, 63, 1861, 63, 504, 63, 3450, 63, 354, 8, 5096, 9, 267, 291, 14, 2947, 8, 6514, 12, 1420, 9, 339, 347, 511, 63, 5337, 63, 17170, 63, 1861, 8, 277, 304, 267, 1420, 275, 283, 20266, 14, 3250, 13, 736, 68, 14, 13288, 7, 267, 6771, 275, 1994, 1391, 15, 1065, 15, 20266, 15, 3250, 13, 736, 68, 14, 13288, 14, 305, 745, 7, 267, 3503, 275, 291, 14, 10946, 423, 362, 63, 5337, 63, 1861, 63, 504, 63, 3450, 63, 354, 8, 5096, 9, 267, 291, 14, 2947, 8, 6514, 12, 1420, 9, 339, 768, 2068, 360, 6463, 14, 6463, 358, 272, 347, 511, 63, 362, 63, 3450, 63, 3771, 8, 277, 12, 5739, 63, 1805, 304, 267, 1101, 275, 664, 63, 10946, 63, 888, 360, 24417, 838, 12852, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
florian-dacosta/OpenUpgrade
addons/hr/res_users.py
44
3136
from openerp.osv import fields, osv from openerp.tools.translate import _ class res_users(osv.Model): """ Update of res.users class - if adding groups to an user, check if base.group_user is in it (member of 'Employee'), create an employee form linked to it. """ _name = 'res.users' _inherit = ['res.users'] _columns = { 'display_employees_suggestions': fields.boolean("Display Employees Suggestions"), } _defaults = { 'display_employees_suggestions': True, } def __init__(self, pool, cr): """ Override of __init__ to add access rights on display_employees_suggestions fields. Access rights are disabled by default, but allowed on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS. """ init_res = super(res_users, self).__init__(pool, cr) # duplicate list to avoid modifying the original reference self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) self.SELF_WRITEABLE_FIELDS.append('display_employees_suggestions') # duplicate list to avoid modifying the original reference self.SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) self.SELF_READABLE_FIELDS.append('display_employees_suggestions') return init_res def stop_showing_employees_suggestions(self, cr, uid, user_id, context=None): """Update display_employees_suggestions value to False""" if context is None: context = {} self.write(cr, uid, user_id, {"display_employees_suggestions": False}, context) def _create_welcome_message(self, cr, uid, user, context=None): """Do not welcome new users anymore, welcome new employees instead""" return True def _message_post_get_eid(self, cr, uid, thread_id, context=None): assert thread_id, "res.users does not support posting global messages" if context and 'thread_model' in context: context['thread_model'] = 'hr.employee' if isinstance(thread_id, (list, tuple)): thread_id = thread_id[0] return self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', thread_id)], context=context) def message_post(self, cr, uid, thread_id, context=None, **kwargs): """ Redirect the posting of message on res.users to the related employee. This is done because when giving the context of Chatter on the various mailboxes, we do not have access to the current partner_id. """ if kwargs.get('type') == 'email': return super(res_users, self).message_post(cr, uid, thread_id, context=context, **kwargs) res = None employee_ids = self._message_post_get_eid(cr, uid, thread_id, context=context) if not employee_ids: # no employee: fall back on previous behavior return super(res_users, self).message_post(cr, uid, thread_id, context=context, **kwargs) for employee_id in employee_ids: res = self.pool.get('hr.employee').message_post(cr, uid, employee_id, context=context, **kwargs) return res
agpl-3.0
[ 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 421, 199, 533, 522, 63, 3707, 8, 4795, 14, 1685, 304, 272, 408, 6162, 402, 522, 14, 3707, 1021, 267, 446, 340, 7791, 4652, 370, 376, 922, 12, 1104, 340, 1300, 14, 923, 63, 751, 365, 315, 652, 267, 334, 1114, 402, 283, 22635, 659, 1218, 376, 15778, 1824, 10632, 370, 652, 14, 272, 408, 272, 485, 354, 275, 283, 470, 14, 3707, 7, 272, 485, 6486, 275, 788, 470, 14, 3707, 418, 339, 485, 3406, 275, 469, 267, 283, 2918, 63, 24561, 63, 19957, 15293, 356, 1504, 14, 4871, 480, 7687, 662, 311, 18149, 428, 11914, 15293, 1288, 272, 789, 339, 485, 4322, 275, 469, 267, 283, 2918, 63, 24561, 63, 19957, 15293, 356, 715, 12, 272, 789, 339, 347, 636, 826, 721, 277, 12, 4203, 12, 2467, 304, 267, 408, 11041, 402, 636, 826, 363, 370, 1050, 2879, 4481, 641, 267, 2929, 63, 24561, 63, 19957, 15293, 1504, 14, 11003, 4481, 787, 6980, 701, 267, 849, 12, 1325, 4370, 641, 2005, 2488, 1504, 3247, 315, 267, 291, 14, 899, 15965, 7348, 5670, 15, 10387, 93, 2617, 63, 12767, 14, 267, 408, 267, 4205, 63, 470, 275, 1613, 8, 470, 63, 3707, 12, 291, 2843, 826, 721, 2293, 12, 2467, 9, 267, 327, 9250, 769, 370, 5126, 24662, 314, 3379, 3659, 267, 291, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 275, 769, 8, 277, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 9, 267, 291, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 14, 740, 360, 2918, 63, 24561, 63, 19957, 15293, 358, 267, 327, 9250, 769, 370, 5126, 24662, 314, 3379, 3659, 267, 291, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 275, 769, 8, 277, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 9, 267, 291, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 14, 740, 360, 2918, 63, 24561, 63, 19957, 15293, 358, 267, 372, 4205, 63, 470, 339, 347, 3631, 63, 2384, 316, 63, 24561, 63, 19957, 15293, 8, 277, 12, 2467, 12, 1747, 12, 922, 63, 344, 12, 1067, 29, 403, 304, 267, 408, 4152, 2929, 63, 24561, 63, 19957, 15293, 574, 370, 756, 624, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 291, 14, 952, 8, 1556, 12, 1747, 12, 922, 63, 344, 12, 2420, 2918, 63, 24561, 63, 19957, 15293, 582, 756, 1386, 1067, 9, 339, 347, 485, 981, 63, 28508, 63, 1188, 8, 277, 12, 2467, 12, 1747, 12, 922, 12, 1067, 29, 403, 304, 267, 408, 2585, 440, 336, 14628, 892, 4390, 20827, 12, 336, 14628, 892, 9052, 18149, 3140, 624, 267, 372, 715, 339, 347, 485, 1188, 63, 1932, 63, 362, 63, 30065, 8, 277, 12, 2467, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 403, 304, 267, 702, 2462, 63, 344, 12, 298, 470, 14, 3707, 1630, 440, 2291, 25386, 2288, 3788, 2, 267, 340, 1067, 436, 283, 2671, 63, 1238, 7, 315, 1067, 26, 288, 1067, 459, 2671, 63, 1238, 418, 275, 283, 6271, 14, 10103, 7, 267, 340, 1228, 8, 2671, 63, 344, 12, 334, 513, 12, 2008, 2298, 288, 2462, 63, 344, 275, 2462, 63, 344, 59, 16, 61, 267, 372, 291, 14, 2293, 14, 362, 360, 6271, 14, 10103, 1959, 1733, 8, 1556, 12, 1747, 12, 4274, 751, 63, 344, 297, 6291, 2462, 63, 344, 4360, 1067, 29, 1100, 9, 339, 347, 1245, 63, 1932, 8, 277, 12, 2467, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 403, 12, 1011, 958, 304, 267, 408, 18532, 314, 25386, 402, 1245, 641, 522, 14, 3707, 370, 314, 4048, 15778, 14, 288, 961, 365, 4224, 2952, 1380, 15131, 314, 1067, 402, 2799, 3760, 641, 314, 288, 7750, 6016, 12922, 12, 781, 886, 440, 1172, 2879, 370, 314, 1453, 5854, 63, 344, 14, 408, 267, 340, 2074, 14, 362, 360, 466, 358, 508, 283, 2123, 356, 288, 372, 1613, 8, 470, 63, 3707, 12, 291, 680, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 522, 275, 488, 267, 15778, 63, 1580, 275, 291, 423, 1188, 63, 1932, 63, 362, 63, 30065, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 9, 267, 340, 440, 15778, 63, 1580, 26, 221, 327, 949, 15778, 26, 11264, 1771, 641, 4136, 5953, 288, 372, 1613, 8, 470, 63, 3707, 12, 291, 680, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 367, 15778, 63, 344, 315, 15778, 63, 1580, 26, 288, 522, 275, 291, 14, 2293, 14, 362, 360, 6271, 14, 10103, 1959, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 15778, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 372, 522, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 421, 199, 533, 522, 63, 3707, 8, 4795, 14, 1685, 304, 272, 408, 6162, 402, 522, 14, 3707, 1021, 267, 446, 340, 7791, 4652, 370, 376, 922, 12, 1104, 340, 1300, 14, 923, 63, 751, 365, 315, 652, 267, 334, 1114, 402, 283, 22635, 659, 1218, 376, 15778, 1824, 10632, 370, 652, 14, 272, 408, 272, 485, 354, 275, 283, 470, 14, 3707, 7, 272, 485, 6486, 275, 788, 470, 14, 3707, 418, 339, 485, 3406, 275, 469, 267, 283, 2918, 63, 24561, 63, 19957, 15293, 356, 1504, 14, 4871, 480, 7687, 662, 311, 18149, 428, 11914, 15293, 1288, 272, 789, 339, 485, 4322, 275, 469, 267, 283, 2918, 63, 24561, 63, 19957, 15293, 356, 715, 12, 272, 789, 339, 347, 636, 826, 721, 277, 12, 4203, 12, 2467, 304, 267, 408, 11041, 402, 636, 826, 363, 370, 1050, 2879, 4481, 641, 267, 2929, 63, 24561, 63, 19957, 15293, 1504, 14, 11003, 4481, 787, 6980, 701, 267, 849, 12, 1325, 4370, 641, 2005, 2488, 1504, 3247, 315, 267, 291, 14, 899, 15965, 7348, 5670, 15, 10387, 93, 2617, 63, 12767, 14, 267, 408, 267, 4205, 63, 470, 275, 1613, 8, 470, 63, 3707, 12, 291, 2843, 826, 721, 2293, 12, 2467, 9, 267, 327, 9250, 769, 370, 5126, 24662, 314, 3379, 3659, 267, 291, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 275, 769, 8, 277, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 9, 267, 291, 14, 899, 15965, 63, 10387, 2617, 63, 12767, 14, 740, 360, 2918, 63, 24561, 63, 19957, 15293, 358, 267, 327, 9250, 769, 370, 5126, 24662, 314, 3379, 3659, 267, 291, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 275, 769, 8, 277, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 9, 267, 291, 14, 899, 15965, 63, 5670, 2617, 63, 12767, 14, 740, 360, 2918, 63, 24561, 63, 19957, 15293, 358, 267, 372, 4205, 63, 470, 339, 347, 3631, 63, 2384, 316, 63, 24561, 63, 19957, 15293, 8, 277, 12, 2467, 12, 1747, 12, 922, 63, 344, 12, 1067, 29, 403, 304, 267, 408, 4152, 2929, 63, 24561, 63, 19957, 15293, 574, 370, 756, 624, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 291, 14, 952, 8, 1556, 12, 1747, 12, 922, 63, 344, 12, 2420, 2918, 63, 24561, 63, 19957, 15293, 582, 756, 1386, 1067, 9, 339, 347, 485, 981, 63, 28508, 63, 1188, 8, 277, 12, 2467, 12, 1747, 12, 922, 12, 1067, 29, 403, 304, 267, 408, 2585, 440, 336, 14628, 892, 4390, 20827, 12, 336, 14628, 892, 9052, 18149, 3140, 624, 267, 372, 715, 339, 347, 485, 1188, 63, 1932, 63, 362, 63, 30065, 8, 277, 12, 2467, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 403, 304, 267, 702, 2462, 63, 344, 12, 298, 470, 14, 3707, 1630, 440, 2291, 25386, 2288, 3788, 2, 267, 340, 1067, 436, 283, 2671, 63, 1238, 7, 315, 1067, 26, 288, 1067, 459, 2671, 63, 1238, 418, 275, 283, 6271, 14, 10103, 7, 267, 340, 1228, 8, 2671, 63, 344, 12, 334, 513, 12, 2008, 2298, 288, 2462, 63, 344, 275, 2462, 63, 344, 59, 16, 61, 267, 372, 291, 14, 2293, 14, 362, 360, 6271, 14, 10103, 1959, 1733, 8, 1556, 12, 1747, 12, 4274, 751, 63, 344, 297, 6291, 2462, 63, 344, 4360, 1067, 29, 1100, 9, 339, 347, 1245, 63, 1932, 8, 277, 12, 2467, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 403, 12, 1011, 958, 304, 267, 408, 18532, 314, 25386, 402, 1245, 641, 522, 14, 3707, 370, 314, 4048, 15778, 14, 288, 961, 365, 4224, 2952, 1380, 15131, 314, 1067, 402, 2799, 3760, 641, 314, 288, 7750, 6016, 12922, 12, 781, 886, 440, 1172, 2879, 370, 314, 1453, 5854, 63, 344, 14, 408, 267, 340, 2074, 14, 362, 360, 466, 358, 508, 283, 2123, 356, 288, 372, 1613, 8, 470, 63, 3707, 12, 291, 680, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 522, 275, 488, 267, 15778, 63, 1580, 275, 291, 423, 1188, 63, 1932, 63, 362, 63, 30065, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 9, 267, 340, 440, 15778, 63, 1580, 26, 221, 327, 949, 15778, 26, 11264, 1771, 641, 4136, 5953, 288, 372, 1613, 8, 470, 63, 3707, 12, 291, 680, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 2462, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 367, 15778, 63, 344, 315, 15778, 63, 1580, 26, 288, 522, 275, 291, 14, 2293, 14, 362, 360, 6271, 14, 10103, 1959, 1188, 63, 1932, 8, 1556, 12, 1747, 12, 15778, 63, 344, 12, 1067, 29, 1100, 12, 1011, 958, 9, 267, 372, 522, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
myusuf3/courtside
courtside/register/factories.py
8
1871
import factory import datetime from game import models from register.models import Player, Sport from django.contrib.auth.models import User class SportFactory(factory.django.DjangoModelFactory): FACTORY_FOR = Sport sport = factory.Iterator(['soccer', 'basketball', 'volleyball', 'hockey', 'baseball'], cycle=False) class UserFactory(factory.django.DjangoModelFactory): FACTORY_FOR = User username = factory.Sequence(lambda n: 'username{0}'.format(n)) first_name = factory.Sequence(lambda n: 'Mahdi{0}'.format(n)) last_name = factory.Sequence(lambda n: 'Yusuf{0}'.format(n)) email = factory.Sequence(lambda n: 'mahdi{0}@gmail.com'.format(n)) class PlayerFactory(factory.django.DjangoModelFactory): FACTORY_FOR = Player user = factory.SubFactory(UserFactory) @factory.sequence def gender(n): if n % 2 == 0: return 'F' else: return 'M' @factory.post_generation def sports(self, create, extracted, **kwargs): if not create: return if extracted: for sport in extracted: self.sports.add(sport) class GameFactory(factory.django.DjangoModelFactory): FACTORY_FOR = models.Game FACTORY_HIDDEN_ARGS = ('now',) now = factory.LazyAttribute(lambda o: datetime.datetime.utcnow()) start_date_and_time = factory.LazyAttribute(lambda o: o.now + datetime.timedelta(days=4)) latitude = factory.Sequence(lambda n: '45.{0}'.format(n)) longitude = factory.Sequence(lambda n: '75.{0}'.format(n)) minimum_players = 3 @factory.sequence def active(n): return True @factory.post_generation def players(self, create, extracted, **kwargs): if not create: return if extracted: for player in extracted: self.players.add(player)
mit
[ 646, 6434, 199, 646, 2197, 199, 199, 504, 9219, 492, 1709, 199, 199, 504, 2274, 14, 992, 492, 25610, 12, 428, 719, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 199, 533, 428, 719, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 428, 719, 339, 308, 719, 275, 6434, 14, 3585, 2941, 83, 679, 2247, 297, 283, 18136, 8571, 297, 283, 5650, 15515, 8571, 297, 283, 526, 346, 14655, 297, 283, 1095, 8571, 995, 8643, 29, 797, 9, 421, 199, 533, 16047, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 2876, 339, 3434, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2473, 91, 16, 5285, 908, 8, 78, 430, 272, 1642, 63, 354, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 45, 11326, 328, 91, 16, 5285, 908, 8, 78, 430, 272, 2061, 63, 354, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 57, 527, 1286, 91, 16, 5285, 908, 8, 78, 430, 272, 3031, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 391, 72, 328, 91, 16, 93, 32, 6799, 14, 957, 1370, 908, 8, 78, 430, 421, 199, 533, 25610, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 25610, 339, 922, 275, 6434, 14, 2610, 2927, 8, 24594, 9, 339, 768, 3702, 14, 4041, 272, 347, 24395, 8, 78, 304, 267, 340, 302, 450, 499, 508, 378, 26, 288, 372, 283, 38, 7, 267, 587, 26, 288, 372, 283, 45, 7, 339, 768, 3702, 14, 1932, 63, 15043, 272, 347, 308, 5203, 8, 277, 12, 1218, 12, 12509, 12, 1011, 958, 304, 267, 340, 440, 1218, 26, 288, 372, 267, 340, 12509, 26, 288, 367, 308, 719, 315, 12509, 26, 355, 291, 14, 3275, 83, 14, 525, 8, 3275, 9, 421, 199, 533, 25132, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 1709, 14, 11454, 272, 481, 3036, 5347, 63, 40, 22436, 63, 13990, 275, 661, 2131, 9538, 339, 3063, 275, 6434, 14, 14269, 1646, 8, 2734, 312, 26, 2197, 14, 2083, 14, 10779, 1012, 272, 1343, 63, 602, 63, 460, 63, 521, 275, 6434, 14, 14269, 1646, 8, 2734, 312, 26, 312, 14, 2131, 435, 2197, 14, 7473, 8, 4899, 29, 20, 430, 272, 18896, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2322, 23379, 16, 5285, 908, 8, 78, 430, 272, 18154, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2194, 23379, 16, 5285, 908, 8, 78, 430, 272, 7481, 63, 20716, 275, 650, 2378, 768, 3702, 14, 4041, 272, 347, 4702, 8, 78, 304, 267, 372, 715, 339, 768, 3702, 14, 1932, 63, 15043, 272, 347, 30130, 8, 277, 12, 1218, 12, 12509, 12, 1011, 958, 304, 267, 340, 440, 1218, 26, 288, 372, 267, 340, 12509, 26, 288, 367, 7748, 315, 12509, 26, 355, 291, 14, 20716, 14, 525, 8, 6147, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 6434, 199, 646, 2197, 199, 199, 504, 9219, 492, 1709, 199, 199, 504, 2274, 14, 992, 492, 25610, 12, 428, 719, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 199, 533, 428, 719, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 428, 719, 339, 308, 719, 275, 6434, 14, 3585, 2941, 83, 679, 2247, 297, 283, 18136, 8571, 297, 283, 5650, 15515, 8571, 297, 283, 526, 346, 14655, 297, 283, 1095, 8571, 995, 8643, 29, 797, 9, 421, 199, 533, 16047, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 2876, 339, 3434, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2473, 91, 16, 5285, 908, 8, 78, 430, 272, 1642, 63, 354, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 45, 11326, 328, 91, 16, 5285, 908, 8, 78, 430, 272, 2061, 63, 354, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 57, 527, 1286, 91, 16, 5285, 908, 8, 78, 430, 272, 3031, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 391, 72, 328, 91, 16, 93, 32, 6799, 14, 957, 1370, 908, 8, 78, 430, 421, 199, 533, 25610, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 25610, 339, 922, 275, 6434, 14, 2610, 2927, 8, 24594, 9, 339, 768, 3702, 14, 4041, 272, 347, 24395, 8, 78, 304, 267, 340, 302, 450, 499, 508, 378, 26, 288, 372, 283, 38, 7, 267, 587, 26, 288, 372, 283, 45, 7, 339, 768, 3702, 14, 1932, 63, 15043, 272, 347, 308, 5203, 8, 277, 12, 1218, 12, 12509, 12, 1011, 958, 304, 267, 340, 440, 1218, 26, 288, 372, 267, 340, 12509, 26, 288, 367, 308, 719, 315, 12509, 26, 355, 291, 14, 3275, 83, 14, 525, 8, 3275, 9, 421, 199, 533, 25132, 2927, 8, 3702, 14, 1176, 14, 9323, 1685, 2927, 304, 272, 481, 3036, 5347, 63, 2707, 275, 1709, 14, 11454, 272, 481, 3036, 5347, 63, 40, 22436, 63, 13990, 275, 661, 2131, 9538, 339, 3063, 275, 6434, 14, 14269, 1646, 8, 2734, 312, 26, 2197, 14, 2083, 14, 10779, 1012, 272, 1343, 63, 602, 63, 460, 63, 521, 275, 6434, 14, 14269, 1646, 8, 2734, 312, 26, 312, 14, 2131, 435, 2197, 14, 7473, 8, 4899, 29, 20, 430, 272, 18896, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2322, 23379, 16, 5285, 908, 8, 78, 430, 272, 18154, 275, 6434, 14, 5826, 8, 2734, 302, 26, 283, 2194, 23379, 16, 5285, 908, 8, 78, 430, 272, 7481, 63, 20716, 275, 650, 2378, 768, 3702, 14, 4041, 272, 347, 4702, 8, 78, 304, 267, 372, 715, 339, 768, 3702, 14, 1932, 63, 15043, 272, 347, 30130, 8, 277, 12, 1218, 12, 12509, 12, 1011, 958, 304, 267, 340, 440, 1218, 26, 288, 372, 267, 340, 12509, 26, 288, 367, 7748, 315, 12509, 26, 355, 291, 14, 20716, 14, 525, 8, 6147, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
EdLogan18/logan-repository
plugin.video.adryanlist/_ytplist.py
173
4161
import urllib import urllib2,json import xbmcvfs import requests,time import os,xbmc,xbmcaddon,xbmcgui,re addon = xbmcaddon.Addon('plugin.video.live.streamspro') profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8')) cacheDir = os.path.join(profile, 'cachedir') clean_cache=os.path.join(cacheDir,'cleancacheafter1month') headers=dict({'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; rv:32.0) Gecko/20100101 Firefox/32.0'}) if not cacheDir.startswith(('smb://', 'nfs://', 'upnp://', 'ftp://')) and not os.path.isdir(cacheDir): os.mkdir(cacheDir) if xbmcvfs.exists(clean_cache) and (time.time()-os.path.getmtime(clean_cache) > 60*60*24*30): print 'time of creation of ff',str(time.time()-os.path.getmtime(clean_cache)) import shutil shutil.rmtree(cacheDir) else: with open(clean_cache,'w') as f: f.write('') utubeid = 'www.youtube.*?v(?:=|%3D)([0-9A-Za-z_-]{11})' def YoUTube(page_data,youtube=None,duration=None,max_page=20,nosave=None): pDialog = xbmcgui.DialogProgress() pDialog.create('Updating list', 'Downloading ...') base_yt_url ='http://gdata.youtube.com/feeds/api' if 'search' in page_data: youtube = youtube.replace(' ','+')#Lana Del Rey build_url= base_yt_url + '/videos?q=%s&max-results=50&v=2&alt=json&orderby=published&start-index=%s' if addon.getSetting('searchlongvideos') == 'true': #duration: #medium or long build_url = base_yt_url + '/videos?q=%s&max-results=20&v=2&alt=json&duration=long&start-index=%s' else: build_url = 'http://www.youtube.com/watch?v=%s' %page_data count = 1 allurls ={} for i in range(1,max_page): url = build_url %(youtube,str(count)) #print url try: content = cache(url,int(addon.getSetting("Youtube"))) print len(content) jcontent = json.loads(content) entry = jcontent['feed']['entry'] except Exception: break for myUrl in entry: count += 1 allitem = 'item' + str(count) item = {} item['title']= removeNonAscii(myUrl['title']['$t']).encode('utf-8') item['date']= myUrl['published']['$t'].encode('utf-8') try: item['desc']= removeNonAscii(myUrl['media$group']['media$description']['$t']).encode('utf-8') except Exception: desc = 'UNAVAIABLE' link = myUrl['link'][0]['href'].encode('utf-8','ignore') item['url']= re_me(link,utubeid) allurls[allitem] = item print len(allurls) if nosave: return allurls pDialog.close() def re_me(data, re_patten): match = '' m = re.search(re_patten, data,re.I) if m != None: match = m.group(1) else: match = '' return match def notification(header="", message="", sleep=3000): """ Will display a notification dialog with the specified header and message, in addition you can set the length of time it displays in milliseconds and a icon image. """ xbmc.executebuiltin("XBMC.Notification(%s,%s,%i)" % ( header, message, sleep )) def removeNonAscii(s): return "".join(filter(lambda x: ord(x)<128, s)) def makeRequest(url,referer=None,post=None,body={}): if referer: headers.update=({'Referer':referer}) else: req = urllib2.Request(url,None,headers) response = urllib2.urlopen(req) data = response.read() response.close() return data # from AddonScriptorde X:\plugin.video.my_music_tv\default.py def cache(url, duration=0): cacheFile = os.path.join(cacheDir, (''.join(c for c in unicode(url, 'utf-8') if c not in '/\\:?"*|<>')).strip()) if os.path.exists(cacheFile) and duration!=0 and (time.time()-os.path.getmtime(cacheFile) < 60*60*24*duration): fh = xbmcvfs.File(cacheFile, 'r') content = fh.read() fh.close() return content else: content = makeRequest(url) fh = xbmcvfs.File(cacheFile, 'w') fh.write(content) fh.close() return content
gpl-2.0
[ 646, 4011, 199, 646, 4011, 18, 12, 1001, 199, 646, 10346, 77, 5107, 2319, 199, 646, 4145, 12, 521, 199, 646, 747, 12, 21382, 12, 21382, 9291, 12, 21382, 5885, 12, 264, 199, 9291, 275, 11709, 9291, 14, 19654, 360, 2718, 14, 3722, 14, 6442, 14, 11231, 496, 358, 199, 2913, 275, 11709, 14, 5275, 2042, 8, 9291, 14, 362, 19654, 2354, 360, 2913, 1959, 2708, 360, 1624, 13, 24, 1333, 199, 1637, 3567, 275, 747, 14, 515, 14, 904, 8, 2913, 12, 283, 1637, 694, 358, 199, 3118, 63, 1637, 29, 736, 14, 515, 14, 904, 8, 1637, 3567, 2584, 3118, 1637, 4399, 17, 4482, 358, 199, 2139, 29, 807, 3252, 1899, 13, 7788, 356, 283, 22285, 15, 21, 14, 16, 334, 8647, 23350, 1227, 14, 19, 27, 4336, 26, 708, 14, 16, 9, 30506, 15, 1797, 4587, 614, 24584, 15, 708, 14, 16, 3071, 199, 199, 692, 440, 2581, 3567, 14, 2460, 4725, 23323, 921, 297, 283, 19591, 921, 297, 283, 384, 1590, 921, 297, 283, 8915, 921, 1333, 436, 440, 747, 14, 515, 14, 6027, 8, 1637, 3567, 304, 272, 747, 14, 8215, 8, 1637, 3567, 9, 199, 692, 10346, 77, 5107, 2319, 14, 2444, 8, 3118, 63, 1637, 9, 436, 334, 521, 14, 521, 22251, 736, 14, 515, 14, 26628, 8, 3118, 63, 1637, 9, 690, 5212, 10, 2259, 10, 1194, 10, 1216, 304, 272, 870, 283, 521, 402, 7143, 402, 16328, 297, 495, 8, 521, 14, 521, 22251, 736, 14, 515, 14, 26628, 8, 3118, 63, 1637, 430, 272, 492, 5145, 272, 5145, 14, 9242, 8, 1637, 3567, 9, 258, 199, 2836, 26, 272, 543, 1551, 8, 3118, 63, 1637, 2584, 87, 358, 465, 289, 26, 267, 289, 14, 952, 8355, 221, 199, 337, 3375, 344, 221, 275, 283, 1544, 14, 9788, 6697, 86, 5169, 29, 15287, 19, 36, 31440, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 29668, 199, 318, 1488, 79, 934, 3375, 8, 1606, 63, 576, 12, 9788, 29, 403, 12, 5553, 29, 403, 12, 988, 63, 1606, 29, 1165, 12, 12712, 811, 29, 403, 304, 272, 299, 5619, 275, 26418, 14, 5619, 11504, 342, 272, 299, 5619, 14, 981, 360, 24993, 769, 297, 283, 18085, 2263, 358, 5591, 1300, 63, 24264, 63, 633, 221, 275, 7, 1014, 921, 15275, 14, 9788, 14, 957, 15, 11522, 15, 1246, 7, 272, 340, 283, 1733, 7, 315, 2034, 63, 576, 26, 267, 22378, 275, 22378, 14, 1814, 360, 1656, 6828, 358, 3, 44, 6738, 18464, 799, 89, 267, 1900, 63, 633, 29, 1300, 63, 24264, 63, 633, 435, 1994, 11418, 31, 81, 2458, 83, 6, 988, 13, 2604, 29, 1400, 6, 86, 29, 18, 6, 4478, 29, 1001, 6, 1648, 991, 29, 8987, 6, 928, 13, 1080, 2458, 83, 7, 267, 340, 221, 13553, 14, 30008, 360, 1733, 2809, 11418, 358, 508, 283, 2052, 356, 3322, 327, 5553, 26, 327, 14345, 503, 1846, 288, 1900, 63, 633, 275, 1300, 63, 24264, 63, 633, 435, 1994, 11418, 31, 81, 2458, 83, 6, 988, 13, 2604, 29, 1165, 6, 86, 29, 18, 6, 4478, 29, 1001, 6, 5553, 29, 2809, 6, 928, 13, 1080, 2458, 83, 7, 28872, 272, 587, 26, 267, 1900, 63, 633, 275, 283, 1014, 921, 1544, 14, 9788, 14, 957, 15, 6821, 31, 86, 2458, 83, 7, 450, 1606, 63, 576, 272, 2338, 275, 413, 272, 1006, 3603, 275, 2440, 272, 367, 284, 315, 1425, 8, 17, 12, 988, 63, 1606, 304, 267, 1166, 275, 1900, 63, 633, 2818, 9788, 12, 495, 8, 835, 430, 267, 327, 1361, 1166, 267, 862, 26, 288, 1564, 275, 2581, 8, 633, 12, 442, 8, 9291, 14, 30008, 480, 57, 7715, 13324, 288, 870, 822, 8, 1317, 9, 7846, 1335, 1317, 275, 2022, 14, 3640, 8, 1317, 9, 288, 2397, 275, 1335, 1317, 459, 3871, 2545, 2373, 418, 267, 871, 2186, 26, 288, 2059, 267, 367, 3002, 6417, 315, 2397, 26, 288, 2338, 847, 413, 288, 741, 317, 563, 275, 283, 1053, 7, 435, 620, 8, 835, 9, 288, 1242, 275, 1052, 288, 1242, 459, 1213, 13784, 2813, 6932, 11129, 8, 1662, 6417, 459, 1213, 2545, 4, 84, 13227, 2143, 360, 1624, 13, 24, 358, 288, 1242, 459, 602, 13784, 3002, 6417, 459, 8987, 2545, 4, 84, 2278, 2143, 360, 1624, 13, 24, 358, 288, 862, 26, 355, 1242, 459, 3257, 13784, 2813, 6932, 11129, 8, 1662, 6417, 459, 4603, 4, 923, 2545, 4603, 4, 1802, 2545, 4, 84, 13227, 2143, 360, 1624, 13, 24, 358, 288, 871, 2186, 26, 355, 4328, 275, 283, 1734, 6087, 7730, 2617, 7, 288, 2142, 275, 3002, 6417, 459, 1073, 3488, 16, 2733, 6399, 2278, 2143, 360, 1624, 13, 24, 1673, 4247, 358, 288, 1242, 459, 633, 13784, 295, 63, 278, 8, 1073, 12, 337, 3375, 344, 9, 288, 1006, 3603, 59, 279, 317, 563, 61, 275, 1242, 267, 870, 822, 8, 452, 3603, 9, 272, 340, 302, 736, 811, 26, 267, 372, 1006, 3603, 272, 299, 5619, 14, 1600, 342, 199, 318, 295, 63, 278, 8, 576, 12, 295, 63, 80, 4867, 304, 272, 1336, 275, 2125, 272, 333, 275, 295, 14, 1733, 8, 264, 63, 80, 4867, 12, 666, 12, 264, 14, 41, 9, 272, 340, 333, 1137, 488, 26, 267, 1336, 275, 333, 14, 923, 8, 17, 9, 272, 587, 26, 267, 1336, 275, 2125, 272, 372, 1336, 258, 199, 318, 6955, 8, 1291, 8772, 1245, 8772, 9435, 29, 19962, 304, 272, 408, 12823, 2929, 282, 6955, 9592, 543, 314, 2013, 1406, 436, 1245, 12, 272, 315, 10234, 1265, 883, 663, 314, 2582, 402, 900, 652, 17561, 315, 21131, 436, 282, 7016, 1834, 14, 272, 408, 272, 11709, 14, 2526, 5351, 480, 20806, 7608, 14, 11598, 4042, 83, 8719, 83, 8719, 73, 2924, 450, 334, 1406, 12, 1245, 12, 9435, 5082, 420, 199, 318, 2813, 6932, 11129, 8, 83, 304, 372, 10587, 904, 8, 1541, 8, 2734, 671, 26, 6206, 8, 88, 21528, 3933, 12, 308, 430, 199, 318, 1852, 2017, 8, 633, 12, 20996, 29, 403, 12, 1932, 29, 403, 12, 2030, 16420, 339, 340, 25104, 26, 267, 2323, 14, 873, 2687, 1445, 28900, 356, 20996, 1552, 272, 587, 26, 267, 2648, 275, 4011, 18, 14, 2017 ]
[ 4011, 199, 646, 4011, 18, 12, 1001, 199, 646, 10346, 77, 5107, 2319, 199, 646, 4145, 12, 521, 199, 646, 747, 12, 21382, 12, 21382, 9291, 12, 21382, 5885, 12, 264, 199, 9291, 275, 11709, 9291, 14, 19654, 360, 2718, 14, 3722, 14, 6442, 14, 11231, 496, 358, 199, 2913, 275, 11709, 14, 5275, 2042, 8, 9291, 14, 362, 19654, 2354, 360, 2913, 1959, 2708, 360, 1624, 13, 24, 1333, 199, 1637, 3567, 275, 747, 14, 515, 14, 904, 8, 2913, 12, 283, 1637, 694, 358, 199, 3118, 63, 1637, 29, 736, 14, 515, 14, 904, 8, 1637, 3567, 2584, 3118, 1637, 4399, 17, 4482, 358, 199, 2139, 29, 807, 3252, 1899, 13, 7788, 356, 283, 22285, 15, 21, 14, 16, 334, 8647, 23350, 1227, 14, 19, 27, 4336, 26, 708, 14, 16, 9, 30506, 15, 1797, 4587, 614, 24584, 15, 708, 14, 16, 3071, 199, 199, 692, 440, 2581, 3567, 14, 2460, 4725, 23323, 921, 297, 283, 19591, 921, 297, 283, 384, 1590, 921, 297, 283, 8915, 921, 1333, 436, 440, 747, 14, 515, 14, 6027, 8, 1637, 3567, 304, 272, 747, 14, 8215, 8, 1637, 3567, 9, 199, 692, 10346, 77, 5107, 2319, 14, 2444, 8, 3118, 63, 1637, 9, 436, 334, 521, 14, 521, 22251, 736, 14, 515, 14, 26628, 8, 3118, 63, 1637, 9, 690, 5212, 10, 2259, 10, 1194, 10, 1216, 304, 272, 870, 283, 521, 402, 7143, 402, 16328, 297, 495, 8, 521, 14, 521, 22251, 736, 14, 515, 14, 26628, 8, 3118, 63, 1637, 430, 272, 492, 5145, 272, 5145, 14, 9242, 8, 1637, 3567, 9, 258, 199, 2836, 26, 272, 543, 1551, 8, 3118, 63, 1637, 2584, 87, 358, 465, 289, 26, 267, 289, 14, 952, 8355, 221, 199, 337, 3375, 344, 221, 275, 283, 1544, 14, 9788, 6697, 86, 5169, 29, 15287, 19, 36, 31440, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 29668, 199, 318, 1488, 79, 934, 3375, 8, 1606, 63, 576, 12, 9788, 29, 403, 12, 5553, 29, 403, 12, 988, 63, 1606, 29, 1165, 12, 12712, 811, 29, 403, 304, 272, 299, 5619, 275, 26418, 14, 5619, 11504, 342, 272, 299, 5619, 14, 981, 360, 24993, 769, 297, 283, 18085, 2263, 358, 5591, 1300, 63, 24264, 63, 633, 221, 275, 7, 1014, 921, 15275, 14, 9788, 14, 957, 15, 11522, 15, 1246, 7, 272, 340, 283, 1733, 7, 315, 2034, 63, 576, 26, 267, 22378, 275, 22378, 14, 1814, 360, 1656, 6828, 358, 3, 44, 6738, 18464, 799, 89, 267, 1900, 63, 633, 29, 1300, 63, 24264, 63, 633, 435, 1994, 11418, 31, 81, 2458, 83, 6, 988, 13, 2604, 29, 1400, 6, 86, 29, 18, 6, 4478, 29, 1001, 6, 1648, 991, 29, 8987, 6, 928, 13, 1080, 2458, 83, 7, 267, 340, 221, 13553, 14, 30008, 360, 1733, 2809, 11418, 358, 508, 283, 2052, 356, 3322, 327, 5553, 26, 327, 14345, 503, 1846, 288, 1900, 63, 633, 275, 1300, 63, 24264, 63, 633, 435, 1994, 11418, 31, 81, 2458, 83, 6, 988, 13, 2604, 29, 1165, 6, 86, 29, 18, 6, 4478, 29, 1001, 6, 5553, 29, 2809, 6, 928, 13, 1080, 2458, 83, 7, 28872, 272, 587, 26, 267, 1900, 63, 633, 275, 283, 1014, 921, 1544, 14, 9788, 14, 957, 15, 6821, 31, 86, 2458, 83, 7, 450, 1606, 63, 576, 272, 2338, 275, 413, 272, 1006, 3603, 275, 2440, 272, 367, 284, 315, 1425, 8, 17, 12, 988, 63, 1606, 304, 267, 1166, 275, 1900, 63, 633, 2818, 9788, 12, 495, 8, 835, 430, 267, 327, 1361, 1166, 267, 862, 26, 288, 1564, 275, 2581, 8, 633, 12, 442, 8, 9291, 14, 30008, 480, 57, 7715, 13324, 288, 870, 822, 8, 1317, 9, 7846, 1335, 1317, 275, 2022, 14, 3640, 8, 1317, 9, 288, 2397, 275, 1335, 1317, 459, 3871, 2545, 2373, 418, 267, 871, 2186, 26, 288, 2059, 267, 367, 3002, 6417, 315, 2397, 26, 288, 2338, 847, 413, 288, 741, 317, 563, 275, 283, 1053, 7, 435, 620, 8, 835, 9, 288, 1242, 275, 1052, 288, 1242, 459, 1213, 13784, 2813, 6932, 11129, 8, 1662, 6417, 459, 1213, 2545, 4, 84, 13227, 2143, 360, 1624, 13, 24, 358, 288, 1242, 459, 602, 13784, 3002, 6417, 459, 8987, 2545, 4, 84, 2278, 2143, 360, 1624, 13, 24, 358, 288, 862, 26, 355, 1242, 459, 3257, 13784, 2813, 6932, 11129, 8, 1662, 6417, 459, 4603, 4, 923, 2545, 4603, 4, 1802, 2545, 4, 84, 13227, 2143, 360, 1624, 13, 24, 358, 288, 871, 2186, 26, 355, 4328, 275, 283, 1734, 6087, 7730, 2617, 7, 288, 2142, 275, 3002, 6417, 459, 1073, 3488, 16, 2733, 6399, 2278, 2143, 360, 1624, 13, 24, 1673, 4247, 358, 288, 1242, 459, 633, 13784, 295, 63, 278, 8, 1073, 12, 337, 3375, 344, 9, 288, 1006, 3603, 59, 279, 317, 563, 61, 275, 1242, 267, 870, 822, 8, 452, 3603, 9, 272, 340, 302, 736, 811, 26, 267, 372, 1006, 3603, 272, 299, 5619, 14, 1600, 342, 199, 318, 295, 63, 278, 8, 576, 12, 295, 63, 80, 4867, 304, 272, 1336, 275, 2125, 272, 333, 275, 295, 14, 1733, 8, 264, 63, 80, 4867, 12, 666, 12, 264, 14, 41, 9, 272, 340, 333, 1137, 488, 26, 267, 1336, 275, 333, 14, 923, 8, 17, 9, 272, 587, 26, 267, 1336, 275, 2125, 272, 372, 1336, 258, 199, 318, 6955, 8, 1291, 8772, 1245, 8772, 9435, 29, 19962, 304, 272, 408, 12823, 2929, 282, 6955, 9592, 543, 314, 2013, 1406, 436, 1245, 12, 272, 315, 10234, 1265, 883, 663, 314, 2582, 402, 900, 652, 17561, 315, 21131, 436, 282, 7016, 1834, 14, 272, 408, 272, 11709, 14, 2526, 5351, 480, 20806, 7608, 14, 11598, 4042, 83, 8719, 83, 8719, 73, 2924, 450, 334, 1406, 12, 1245, 12, 9435, 5082, 420, 199, 318, 2813, 6932, 11129, 8, 83, 304, 372, 10587, 904, 8, 1541, 8, 2734, 671, 26, 6206, 8, 88, 21528, 3933, 12, 308, 430, 199, 318, 1852, 2017, 8, 633, 12, 20996, 29, 403, 12, 1932, 29, 403, 12, 2030, 16420, 339, 340, 25104, 26, 267, 2323, 14, 873, 2687, 1445, 28900, 356, 20996, 1552, 272, 587, 26, 267, 2648, 275, 4011, 18, 14, 2017, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
log2timeline/plaso
plaso/parsers/sqlite_plugins/twitter_ios.py
3
12761
# -*- coding:utf-8 -*- """SQLite parser plugin for Twitter on iOS 8+ database files.""" from dfdatetime import posix_time as dfdatetime_posix_time from plaso.containers import events from plaso.containers import time_events from plaso.lib import definitions from plaso.parsers import sqlite from plaso.parsers.sqlite_plugins import interface class TwitterIOSContactEventData(events.EventData): """Twitter on iOS 8+ contact event data. Attributes: description (str): description of the profile. followers_count (int): number of accounts following the contact. following_count (int): number of accounts the contact is following. following (int): 1 if the contact is following the user's account, 0 if not. location (str): location of the profile. name (str): name of the profile. profile_url (str): URL of the profile picture. query (str): SQL query that was used to obtain the event data. screen_name (str): screen name. url (str): URL of the profile. """ DATA_TYPE = 'twitter:ios:contact' def __init__(self): """Initializes event data.""" super(TwitterIOSContactEventData, self).__init__(data_type=self.DATA_TYPE) self.description = None self.followers_count = None self.following = None self.following_count = None self.location = None self.name = None self.profile_url = None self.query = None self.screen_name = None self.url = None class TwitterIOSStatusEventData(events.EventData): """Parent class for Twitter on iOS 8+ status events. Attributes: favorite_count (int): number of times the status message has been favorited. favorited (int): value to mark status as favorite by the account. name (str): user's profile name. query (str): SQL query that was used to obtain the event data. retweet_count (str): number of times the status message has been retweeted. text (str): content of the status message. user_id (int): user unique identifier. """ DATA_TYPE = 'twitter:ios:status' def __init__(self): """Initializes event data.""" super(TwitterIOSStatusEventData, self).__init__(data_type=self.DATA_TYPE) self.favorite_count = None self.favorited = None self.name = None self.query = None self.retweet_count = None self.text = None self.user_id = None class TwitterIOSPlugin(interface.SQLitePlugin): """SQLite parser plugin for Twitter on iOS 8+ database files. The Twitter on iOS 8+ database file is typically stored in: /private/var/mobile/Containers/Data/Application/Library/Caches/databases/ twitter.db """ NAME = 'twitter_ios' DATA_FORMAT = 'Twitter on iOS 8 and later SQLite database (twitter.db) file' REQUIRED_STRUCTURE = { 'Users': frozenset([ 'createdDate', 'updatedAt', 'screenName', 'name', 'profileImageUrl', 'location', 'description', 'url', 'following', 'followersCount', 'followingCount', 'id']), 'Statuses': frozenset([ 'date', 'text', 'userId', 'retweetCount', 'favoriteCount', 'favorited', 'updatedAt'])} QUERIES = [ (('SELECT createdDate, updatedAt, screenName, name, profileImageUrl,' 'location, description, url, following, followersCount, followingCount' ' FROM Users ORDER BY createdDate'), 'ParseContactRow'), (('SELECT Statuses.date AS date, Statuses.text AS text, Statuses.userId ' 'AS user_id, Users.name AS name, Statuses.retweetCount AS ' 'retweetCount, Statuses.favoriteCount AS favoriteCount, ' 'Statuses.favorited AS favorited, Statuses.updatedAt AS updatedAt ' 'FROM Statuses LEFT join Users ON Statuses.userId = Users.id ORDER ' 'BY date'), 'ParseStatusRow')] SCHEMAS = [{ 'Lists': ( 'CREATE TABLE Lists ( \'id\' INTEGER PRIMARY KEY, \'name\' TEXT, ' '\'slug\' TEXT, \'desc\' TEXT, \'private\' INTEGER, ' '\'subscriberCount\' INTEGER, \'memberCount\' INTEGER, \'userId\' ' 'INTEGER, \'updatedAt\' REAL )'), 'ListsShadow': ( 'CREATE TABLE ListsShadow ( \'id\' INTEGER PRIMARY KEY, \'name\' ' 'TEXT, \'slug\' TEXT, \'desc\' TEXT, \'private\' INTEGER, ' '\'subscriberCount\' INTEGER, \'memberCount\' INTEGER, \'userId\' ' 'INTEGER, \'updatedAt\' REAL )'), 'MyRetweets': ( 'CREATE TABLE MyRetweets ( \'statusId\' INTEGER PRIMARY KEY, ' '\'myRetweetId\' INTEGER )'), 'Statuses': ( 'CREATE TABLE Statuses ( \'id\' INTEGER PRIMARY KEY, \'text\' TEXT, ' '\'date\' REAL, \'userId\' INTEGER, \'inReplyToStatusId\' INTEGER, ' '\'retweetedStatusId\' INTEGER, \'geotag\' BLOB, \'entities\' BLOB, ' '\'card\' BLOB, \'cardUsers\' BLOB, \'primaryCardType\' INTEGER, ' '\'cardVersion\' INTEGER, \'retweetCount\' INTEGER, ' '\'favoriteCount\' INTEGER, \'favorited\' INTEGER, \'updatedAt\' ' 'REAL, \'extraScribeItem\' BLOB, \'withheldScope\' TEXT, ' '\'withheldInCountries\' TEXT, \'inReplyToUsername\' TEXT, ' '\'possiblySensitive\' INTEGER, \'isPossiblySensitiveAppealable\' ' 'INTEGER, \'isLifelineAlert\' INTEGER, \'isTruncated\' INTEGER, ' '\'previewLength\' INTEGER, \'fullTextLength\' INTEGER, \'lang\' ' 'TEXT, \'supplmentalLanguage\' TEXT, \'includeInProfileTimeline\' ' 'INTEGER, \'quotedStatusId\' INTEGER, \'source\' TEXT )'), 'StatusesShadow': ( 'CREATE TABLE StatusesShadow ( \'id\' INTEGER PRIMARY KEY, \'text\' ' 'TEXT, \'date\' REAL, \'userId\' INTEGER, \'inReplyToStatusId\' ' 'INTEGER, \'retweetedStatusId\' INTEGER, \'geotag\' BLOB, ' '\'entities\' BLOB, \'card\' BLOB, \'cardUsers\' BLOB, ' '\'primaryCardType\' INTEGER, \'cardVersion\' INTEGER, ' '\'retweetCount\' INTEGER, \'favoriteCount\' INTEGER, \'favorited\' ' 'INTEGER, \'updatedAt\' REAL, \'extraScribeItem\' BLOB, ' '\'withheldScope\' TEXT, \'withheldInCountries\' TEXT, ' '\'inReplyToUsername\' TEXT, \'possiblySensitive\' INTEGER, ' '\'isPossiblySensitiveAppealable\' INTEGER, \'isLifelineAlert\' ' 'INTEGER, \'isTruncated\' INTEGER, \'previewLength\' INTEGER, ' '\'fullTextLength\' INTEGER, \'lang\' TEXT, ' '\'supplementalLanguage\' TEXT, \'includeInProfileTimeline\' ' 'INTEGER, \'quotedStatusId\' INTEGER, \'source\' TEXT )'), 'Users': ( 'CREATE TABLE Users ( \'id\' INTEGER PRIMARY KEY, \'screenName\' ' 'TEXT COLLATE NOCASE, \'profileImageUrl\' TEXT, ' '\'profileBannerUrl\' TEXT, \'profileLinkColorHexTriplet\' INTEGER, ' '\'name\' TEXT, \'location\' TEXT, \'structuredLocation\' BLOB, ' '\'description\' TEXT, \'url\' TEXT, \'urlEntities\' BLOB, ' '\'bioEntities\' BLOB, \'protected\' INTEGER, \'verified\' INTEGER, ' '\'following\' INTEGER, \'deviceFollowing\' INTEGER, ' '\'advertiserAccountType\' INTEGER, \'statusesCount\' INTEGER, ' '\'mediaCount\' INTEGER, \'favoritesCount\' INTEGER, ' '\'followingCount\' INTEGER, \'followersCount\' INTEGER, ' '\'followersCountFast\' INTEGER, \'followersCountNormal\' INTEGER, ' '\'couldBeStale\' INTEGER, \'isLifelineInstitution\' INTEGER, ' '\'hasCollections\' INTEGER, \'updatedAt\' REAL, \'createdDate\' ' 'REAL, \'isTranslator\' INTEGER, \'hasExtendedProfileFields\' ' 'INTEGER, \'extendedProfileFields\' BLOB, \'pinnedTweetId\' ' 'INTEGER, \'businessProfileState\' INTEGER, \'analyticsType\' ' 'INTEGER )'), 'UsersShadow': ( 'CREATE TABLE UsersShadow ( \'id\' INTEGER PRIMARY KEY, ' '\'screenName\' TEXT COLLATE NOCASE, \'profileImageUrl\' TEXT, ' '\'profileBannerUrl\' TEXT, \'profileLinkColorHexTriplet\' INTEGER, ' '\'name\' TEXT, \'location\' TEXT, \'structuredLocation\' BLOB, ' '\'description\' TEXT, \'url\' TEXT, \'urlEntities\' BLOB, ' '\'bioEntities\' BLOB, \'protected\' INTEGER, \'verified\' INTEGER, ' '\'following\' INTEGER, \'deviceFollowing\' INTEGER, ' '\'advertiserAccountType\' INTEGER, \'statusesCount\' INTEGER, ' '\'mediaCount\' INTEGER, \'favoritesCount\' INTEGER, ' '\'followingCount\' INTEGER, \'followersCount\' INTEGER, ' '\'followersCountFast\' INTEGER, \'followersCountNormal\' INTEGER, ' '\'couldBeStale\' INTEGER, \'isLifelineInstitution\' INTEGER, ' '\'hasCollections\' INTEGER, \'updatedAt\' REAL, \'createdDate\' ' 'REAL, \'isTranslator\' INTEGER, \'hasExtendedProfileFields\' ' 'INTEGER, \'extendedProfileFields\' BLOB, \'pinnedTweetId\' ' 'INTEGER, \'businessProfileState\' INTEGER, \'analyticsType\' ' 'INTEGER )')}] def ParseContactRow(self, parser_mediator, query, row, **unused_kwargs): """Parses a contact row from the database. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. query (str): query that created the row. row (sqlite3.Row): row resulting from query. """ query_hash = hash(query) event_data = TwitterIOSContactEventData() event_data.description = self._GetRowValue(query_hash, row, 'description') event_data.followers_count = self._GetRowValue( query_hash, row, 'followersCount') event_data.following = self._GetRowValue(query_hash, row, 'following') event_data.following_count = self._GetRowValue( query_hash, row, 'followingCount') event_data.location = self._GetRowValue(query_hash, row, 'location') event_data.name = self._GetRowValue(query_hash, row, 'name') event_data.profile_url = self._GetRowValue( query_hash, row, 'profileImageUrl') event_data.query = query event_data.screen_name = self._GetRowValue(query_hash, row, 'screenName') event_data.url = self._GetRowValue(query_hash, row, 'url') timestamp = self._GetRowValue(query_hash, row, 'createdDate') if timestamp: # Convert the floating point value to an integer. timestamp = int(timestamp) date_time = dfdatetime_posix_time.PosixTime(timestamp=timestamp) event = time_events.DateTimeValuesEvent( date_time, definitions.TIME_DESCRIPTION_CREATION) parser_mediator.ProduceEventWithEventData(event, event_data) timestamp = self._GetRowValue(query_hash, row, 'updatedAt') if timestamp: # Convert the floating point value to an integer. timestamp = int(timestamp) date_time = dfdatetime_posix_time.PosixTime(timestamp=timestamp) event = time_events.DateTimeValuesEvent( date_time, definitions.TIME_DESCRIPTION_UPDATE) parser_mediator.ProduceEventWithEventData(event, event_data) def ParseStatusRow(self, parser_mediator, query, row, **unused_kwargs): """Parses a contact row from the database. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. query (str): query that created the row. row (sqlite3.Row): row resulting from query. """ query_hash = hash(query) event_data = TwitterIOSStatusEventData() event_data.favorite_count = self._GetRowValue( query_hash, row, 'favoriteCount') event_data.favorited = self._GetRowValue(query_hash, row, 'favorited') event_data.name = self._GetRowValue(query_hash, row, 'name') event_data.query = query event_data.retweet_count = self._GetRowValue( query_hash, row, 'retweetCount') event_data.text = self._GetRowValue(query_hash, row, 'text') event_data.user_id = self._GetRowValue(query_hash, row, 'user_id') timestamp = self._GetRowValue(query_hash, row, 'date') if timestamp: # Convert the floating point value to an integer. timestamp = int(timestamp) date_time = dfdatetime_posix_time.PosixTime(timestamp=timestamp) event = time_events.DateTimeValuesEvent( date_time, definitions.TIME_DESCRIPTION_CREATION) parser_mediator.ProduceEventWithEventData(event, event_data) timestamp = self._GetRowValue(query_hash, row, 'updatedAt') if timestamp: # Convert the floating point value to an integer. timestamp = int(timestamp) date_time = dfdatetime_posix_time.PosixTime(timestamp=timestamp) event = time_events.DateTimeValuesEvent( date_time, definitions.TIME_DESCRIPTION_UPDATE) parser_mediator.ProduceEventWithEventData(event, event_data) sqlite.SQLiteParser.RegisterPlugin(TwitterIOSPlugin)
apache-2.0
[ 3, 1882, 2803, 26, 1624, 13, 24, 1882, 199, 624, 4657, 1175, 1798, 3589, 367, 19259, 641, 284, 3100, 1695, 11, 3050, 1584, 1041, 199, 199, 504, 4051, 2083, 492, 10694, 63, 521, 465, 4051, 2083, 63, 9228, 63, 521, 199, 199, 504, 1620, 305, 79, 14, 13577, 492, 4474, 199, 504, 1620, 305, 79, 14, 13577, 492, 900, 63, 4368, 199, 504, 1620, 305, 79, 14, 773, 492, 10269, 199, 504, 1620, 305, 79, 14, 11531, 492, 11723, 199, 504, 1620, 305, 79, 14, 11531, 14, 10659, 63, 5265, 492, 3217, 421, 199, 533, 19259, 13532, 14499, 2390, 1451, 8, 4368, 14, 2390, 1451, 304, 523, 408, 24540, 641, 284, 3100, 1695, 11, 8966, 1566, 666, 14, 819, 9382, 26, 272, 1369, 334, 495, 304, 1369, 402, 314, 4690, 14, 272, 31474, 63, 835, 334, 442, 304, 1329, 402, 12639, 2569, 314, 8966, 14, 272, 2569, 63, 835, 334, 442, 304, 1329, 402, 12639, 314, 8966, 365, 2569, 14, 272, 2569, 334, 442, 304, 413, 340, 314, 8966, 365, 2569, 314, 922, 1159, 2933, 12, 378, 340, 440, 14, 272, 2909, 334, 495, 304, 2909, 402, 314, 4690, 14, 272, 536, 334, 495, 304, 536, 402, 314, 4690, 14, 272, 4690, 63, 633, 334, 495, 304, 2851, 402, 314, 4690, 24945, 14, 272, 1827, 334, 495, 304, 5385, 1827, 626, 1990, 1202, 370, 3332, 314, 1566, 666, 14, 272, 6426, 63, 354, 334, 495, 304, 6426, 536, 14, 272, 1166, 334, 495, 304, 2851, 402, 314, 4690, 14, 523, 408, 819, 7126, 63, 2711, 275, 283, 13746, 26, 9207, 26, 7811, 7, 819, 347, 636, 826, 721, 277, 304, 272, 408, 23489, 1566, 666, 1041, 272, 1613, 8, 24540, 13532, 14499, 2390, 1451, 12, 291, 2843, 826, 721, 576, 63, 466, 29, 277, 14, 3998, 63, 2711, 9, 272, 291, 14, 1802, 275, 488, 272, 291, 14, 22648, 63, 835, 275, 488, 272, 291, 14, 21589, 275, 488, 272, 291, 14, 21589, 63, 835, 275, 488, 272, 291, 14, 1985, 275, 488, 272, 291, 14, 354, 275, 488, 272, 291, 14, 2913, 63, 633, 275, 488, 272, 291, 14, 1131, 275, 488, 272, 291, 14, 5410, 63, 354, 275, 488, 272, 291, 14, 633, 275, 488, 421, 199, 533, 19259, 13532, 3694, 2390, 1451, 8, 4368, 14, 2390, 1451, 304, 523, 408, 6652, 1021, 367, 19259, 641, 284, 3100, 1695, 11, 2004, 4474, 14, 819, 9382, 26, 272, 17914, 1175, 63, 835, 334, 442, 304, 1329, 402, 5431, 314, 2004, 1245, 965, 2757, 17914, 5703, 14, 272, 17914, 5703, 334, 442, 304, 574, 370, 2216, 2004, 465, 17914, 1175, 701, 314, 2933, 14, 272, 536, 334, 495, 304, 922, 1159, 4690, 536, 14, 272, 1827, 334, 495, 304, 5385, 1827, 626, 1990, 1202, 370, 3332, 314, 1566, 666, 14, 272, 2203, 11554, 63, 835, 334, 495, 304, 1329, 402, 5431, 314, 2004, 1245, 965, 2757, 2203, 25515, 471, 14, 272, 1318, 334, 495, 304, 1564, 402, 314, 2004, 1245, 14, 272, 922, 63, 344, 334, 442, 304, 922, 3747, 5148, 14, 523, 408, 819, 7126, 63, 2711, 275, 283, 13746, 26, 9207, 26, 1205, 7, 819, 347, 636, 826, 721, 277, 304, 272, 408, 23489, 1566, 666, 1041, 272, 1613, 8, 24540, 13532, 3694, 2390, 1451, 12, 291, 2843, 826, 721, 576, 63, 466, 29, 277, 14, 3998, 63, 2711, 9, 272, 291, 14, 23874, 63, 835, 275, 488, 272, 291, 14, 17520, 5703, 275, 488, 272, 291, 14, 354, 275, 488, 272, 291, 14, 1131, 275, 488, 272, 291, 14, 3292, 11554, 63, 835, 275, 488, 272, 291, 14, 505, 275, 488, 272, 291, 14, 751, 63, 344, 275, 488, 421, 199, 533, 19259, 13532, 5061, 8, 3266, 14, 4657, 1175, 5061, 304, 523, 408, 4657, 1175, 1798, 3589, 367, 19259, 641, 284, 3100, 1695, 11, 3050, 1584, 14, 819, 710, 19259, 641, 284, 3100, 1695, 11, 3050, 570, 365, 13609, 5489, 315, 26, 523, 1182, 4239, 15, 1391, 15, 11375, 15, 31266, 1192, 15, 1451, 15, 5039, 15, 7424, 15, 35, 1225, 397, 15, 17439, 15, 523, 15811, 14, 697, 523, 408, 819, 13637, 275, 283, 13746, 63, 9207, 7, 523, 7126, 63, 4807, 275, 283, 24540, 641, 284, 3100, 1695, 436, 2945, 19245, 3050, 334, 13746, 14, 697, 9, 570, 7, 819, 25090, 63, 8893, 3942, 275, 469, 489, 283, 12117, 356, 9522, 779, 881, 283, 3966, 2506, 297, 283, 5334, 1271, 297, 283, 5410, 985, 297, 283, 354, 297, 283, 2913, 3491, 6417, 297, 881, 283, 1985, 297, 283, 1802, 297, 283, 633, 297, 283, 21589, 297, 283, 22648, 2353, 297, 881, 283, 21589, 2353, 297, 283, 344, 3815, 489, 283, 11232, 5589, 356, 9522, 779, 881, 283, 602, 297, 283, 505, 297, 283, 751, 1304, 297, 283, 3292, 11554, 2353, 297, 283, 23874, 2353, 297, 881, 283, 17520, 5703, 297, 283, 5334, 1271, 1105, 93, 819, 7813, 540, 2563, 275, 359, 489, 13636, 4859, 2737, 2506, 12, 4588, 1271, 12, 6426, 985, 12, 536, 12, 4690, 3491, 6417, 2584, 267, 283, 1985, 12, 1369, 12, 1166, 12, 2569, 12, 31474, 2353, 12, 2569, 2353, 7, 267, 283, 4442, 20123, 16044, 6515, 2737, 2506, 659, 283, 4003, 14499, 5810, 659, 489, 13636, 4859, 27673, 5589, 14, 602, 4319, 1434, 12, 27673, 5589, 14, 505, 4319, 1318, 12, 27673, 5589, 14, 751, 1304, 283, 267, 283, 1179, 922, 63, 344, 12, 20123, 14, 354, 4319, 536, 12, 27673, 5589, 14, 3292, 11554, 2353, 4319, 283, 267, 283, 3292, 11554, 2353, 12, 27673, 5589, 14, 23874, 2353, 4319, 17914, 1175, 2353, 12, 283, 267, 283, 11232, 5589, 14, 17520, 5703, 4319, 17914, 5703, 12, 27673, 5589, 14, 5334, 1271, 4319, 4588, 1271, 283, 267, 283, 12491, 27673, 5589, 6578, 4263, 20123, 5258, 27673, 5589, 14, 751, 1304, 275, 20123, 14, 344, 16044, 283, 267, 283, 8285, 1434, 659, 283, 4003, 3694, 5810, 5440, 819, 428, 1244, 2769, 1179, 275, 8910, 489, 283, 15116, 356, 334, 881, 283, 8366, 9934, 31289, 334, 8891, 344, 3985, 17086, 19770, 9301, 12, 8891, 354, 3985, 11951, 12, 283, 881, 32496, 5464, 3985, 11951, 12, 8891, 3257, 3985, 11951, 12, 8891, 4239, 3985, 17086, 12, 283, 881, 32496, 17256, 2353, 3985, 17086, 12, 8891, 1114, 2353 ]
[ 1882, 2803, 26, 1624, 13, 24, 1882, 199, 624, 4657, 1175, 1798, 3589, 367, 19259, 641, 284, 3100, 1695, 11, 3050, 1584, 1041, 199, 199, 504, 4051, 2083, 492, 10694, 63, 521, 465, 4051, 2083, 63, 9228, 63, 521, 199, 199, 504, 1620, 305, 79, 14, 13577, 492, 4474, 199, 504, 1620, 305, 79, 14, 13577, 492, 900, 63, 4368, 199, 504, 1620, 305, 79, 14, 773, 492, 10269, 199, 504, 1620, 305, 79, 14, 11531, 492, 11723, 199, 504, 1620, 305, 79, 14, 11531, 14, 10659, 63, 5265, 492, 3217, 421, 199, 533, 19259, 13532, 14499, 2390, 1451, 8, 4368, 14, 2390, 1451, 304, 523, 408, 24540, 641, 284, 3100, 1695, 11, 8966, 1566, 666, 14, 819, 9382, 26, 272, 1369, 334, 495, 304, 1369, 402, 314, 4690, 14, 272, 31474, 63, 835, 334, 442, 304, 1329, 402, 12639, 2569, 314, 8966, 14, 272, 2569, 63, 835, 334, 442, 304, 1329, 402, 12639, 314, 8966, 365, 2569, 14, 272, 2569, 334, 442, 304, 413, 340, 314, 8966, 365, 2569, 314, 922, 1159, 2933, 12, 378, 340, 440, 14, 272, 2909, 334, 495, 304, 2909, 402, 314, 4690, 14, 272, 536, 334, 495, 304, 536, 402, 314, 4690, 14, 272, 4690, 63, 633, 334, 495, 304, 2851, 402, 314, 4690, 24945, 14, 272, 1827, 334, 495, 304, 5385, 1827, 626, 1990, 1202, 370, 3332, 314, 1566, 666, 14, 272, 6426, 63, 354, 334, 495, 304, 6426, 536, 14, 272, 1166, 334, 495, 304, 2851, 402, 314, 4690, 14, 523, 408, 819, 7126, 63, 2711, 275, 283, 13746, 26, 9207, 26, 7811, 7, 819, 347, 636, 826, 721, 277, 304, 272, 408, 23489, 1566, 666, 1041, 272, 1613, 8, 24540, 13532, 14499, 2390, 1451, 12, 291, 2843, 826, 721, 576, 63, 466, 29, 277, 14, 3998, 63, 2711, 9, 272, 291, 14, 1802, 275, 488, 272, 291, 14, 22648, 63, 835, 275, 488, 272, 291, 14, 21589, 275, 488, 272, 291, 14, 21589, 63, 835, 275, 488, 272, 291, 14, 1985, 275, 488, 272, 291, 14, 354, 275, 488, 272, 291, 14, 2913, 63, 633, 275, 488, 272, 291, 14, 1131, 275, 488, 272, 291, 14, 5410, 63, 354, 275, 488, 272, 291, 14, 633, 275, 488, 421, 199, 533, 19259, 13532, 3694, 2390, 1451, 8, 4368, 14, 2390, 1451, 304, 523, 408, 6652, 1021, 367, 19259, 641, 284, 3100, 1695, 11, 2004, 4474, 14, 819, 9382, 26, 272, 17914, 1175, 63, 835, 334, 442, 304, 1329, 402, 5431, 314, 2004, 1245, 965, 2757, 17914, 5703, 14, 272, 17914, 5703, 334, 442, 304, 574, 370, 2216, 2004, 465, 17914, 1175, 701, 314, 2933, 14, 272, 536, 334, 495, 304, 922, 1159, 4690, 536, 14, 272, 1827, 334, 495, 304, 5385, 1827, 626, 1990, 1202, 370, 3332, 314, 1566, 666, 14, 272, 2203, 11554, 63, 835, 334, 495, 304, 1329, 402, 5431, 314, 2004, 1245, 965, 2757, 2203, 25515, 471, 14, 272, 1318, 334, 495, 304, 1564, 402, 314, 2004, 1245, 14, 272, 922, 63, 344, 334, 442, 304, 922, 3747, 5148, 14, 523, 408, 819, 7126, 63, 2711, 275, 283, 13746, 26, 9207, 26, 1205, 7, 819, 347, 636, 826, 721, 277, 304, 272, 408, 23489, 1566, 666, 1041, 272, 1613, 8, 24540, 13532, 3694, 2390, 1451, 12, 291, 2843, 826, 721, 576, 63, 466, 29, 277, 14, 3998, 63, 2711, 9, 272, 291, 14, 23874, 63, 835, 275, 488, 272, 291, 14, 17520, 5703, 275, 488, 272, 291, 14, 354, 275, 488, 272, 291, 14, 1131, 275, 488, 272, 291, 14, 3292, 11554, 63, 835, 275, 488, 272, 291, 14, 505, 275, 488, 272, 291, 14, 751, 63, 344, 275, 488, 421, 199, 533, 19259, 13532, 5061, 8, 3266, 14, 4657, 1175, 5061, 304, 523, 408, 4657, 1175, 1798, 3589, 367, 19259, 641, 284, 3100, 1695, 11, 3050, 1584, 14, 819, 710, 19259, 641, 284, 3100, 1695, 11, 3050, 570, 365, 13609, 5489, 315, 26, 523, 1182, 4239, 15, 1391, 15, 11375, 15, 31266, 1192, 15, 1451, 15, 5039, 15, 7424, 15, 35, 1225, 397, 15, 17439, 15, 523, 15811, 14, 697, 523, 408, 819, 13637, 275, 283, 13746, 63, 9207, 7, 523, 7126, 63, 4807, 275, 283, 24540, 641, 284, 3100, 1695, 436, 2945, 19245, 3050, 334, 13746, 14, 697, 9, 570, 7, 819, 25090, 63, 8893, 3942, 275, 469, 489, 283, 12117, 356, 9522, 779, 881, 283, 3966, 2506, 297, 283, 5334, 1271, 297, 283, 5410, 985, 297, 283, 354, 297, 283, 2913, 3491, 6417, 297, 881, 283, 1985, 297, 283, 1802, 297, 283, 633, 297, 283, 21589, 297, 283, 22648, 2353, 297, 881, 283, 21589, 2353, 297, 283, 344, 3815, 489, 283, 11232, 5589, 356, 9522, 779, 881, 283, 602, 297, 283, 505, 297, 283, 751, 1304, 297, 283, 3292, 11554, 2353, 297, 283, 23874, 2353, 297, 881, 283, 17520, 5703, 297, 283, 5334, 1271, 1105, 93, 819, 7813, 540, 2563, 275, 359, 489, 13636, 4859, 2737, 2506, 12, 4588, 1271, 12, 6426, 985, 12, 536, 12, 4690, 3491, 6417, 2584, 267, 283, 1985, 12, 1369, 12, 1166, 12, 2569, 12, 31474, 2353, 12, 2569, 2353, 7, 267, 283, 4442, 20123, 16044, 6515, 2737, 2506, 659, 283, 4003, 14499, 5810, 659, 489, 13636, 4859, 27673, 5589, 14, 602, 4319, 1434, 12, 27673, 5589, 14, 505, 4319, 1318, 12, 27673, 5589, 14, 751, 1304, 283, 267, 283, 1179, 922, 63, 344, 12, 20123, 14, 354, 4319, 536, 12, 27673, 5589, 14, 3292, 11554, 2353, 4319, 283, 267, 283, 3292, 11554, 2353, 12, 27673, 5589, 14, 23874, 2353, 4319, 17914, 1175, 2353, 12, 283, 267, 283, 11232, 5589, 14, 17520, 5703, 4319, 17914, 5703, 12, 27673, 5589, 14, 5334, 1271, 4319, 4588, 1271, 283, 267, 283, 12491, 27673, 5589, 6578, 4263, 20123, 5258, 27673, 5589, 14, 751, 1304, 275, 20123, 14, 344, 16044, 283, 267, 283, 8285, 1434, 659, 283, 4003, 3694, 5810, 5440, 819, 428, 1244, 2769, 1179, 275, 8910, 489, 283, 15116, 356, 334, 881, 283, 8366, 9934, 31289, 334, 8891, 344, 3985, 17086, 19770, 9301, 12, 8891, 354, 3985, 11951, 12, 283, 881, 32496, 5464, 3985, 11951, 12, 8891, 3257, 3985, 11951, 12, 8891, 4239, 3985, 17086, 12, 283, 881, 32496, 17256, 2353, 3985, 17086, 12, 8891, 1114, 2353, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1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lib/oai_harvest_config.py
21
3553
## This file is part of Invenio. ## Copyright (C) 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """OAI Harvest Configuration.""" __revision__ = "$Id$" # Exceptions: warnings class InvenioOAIHarvestWarning(Exception): """A generic warning for OAIHarvest.""" def __init__(self, message): """Initialisation.""" self.message = message def __str__(self): """String representation.""" return repr(self.message) ## CFG_OAI_POSSIBLE_POSTMODES -- list of possible modes available for ## OAI harvest post-processing along with possible arguments in a list of ## key => value mappings of argument-name, required, validation checks, etc. CFG_OAI_POSSIBLE_POSTMODES = [ ["c", "convert (c)", [{'name': 'stylesheet', 'required': True, 'validation': ["file"], 'value': "", 'input': "text"}] ], ["p", "extract plots (p)", [{'name': 'extraction-source', 'required': True, 'validation': None, 'value': ["latex"], 'input': "checkbox", 'labels': ["LaTeX"], 'states': [True]}] ], ["r", "extract references (r)", [{'name': 'format', 'required': False, 'validation': None, 'value': "", 'input': "text"}, {'name': 'kb-journal-file', 'required': False, 'validation': ["file"], 'value': "", 'input': "text"}, {'name': 'kb-rep-no-file', 'required': False, 'validation': ["file"], 'value': "", 'input': "text"}] ], ["a", "extract authors (a)", [{'name': 'rt-queue', 'required': False, 'validation': None, 'value': "", 'input': "text"}, {'name': 'stylesheet', 'required': True, 'validation': ["file"], 'value': "", 'input': "text"}] ], ["t", "attach full-text (t)", [{'name': 'doctype', 'required': False, 'validation': None, 'value': "Fulltext", 'input': "text"}] ], ["f", "filter (f)", [{'name': 'filter-file', 'required': True, 'validation': ["file"], 'value': "", 'input': "text"}] ], ["u", "upload (u)", [{'name': 'priority', 'required': False, 'validation': ["int"], 'value': "3", 'input': "text"}, {'name': 'name', 'required': False, 'validation': None, 'value': "oai", 'input': "text"}] ]]
gpl-2.0
[ 309, 961, 570, 365, 1777, 402, 12235, 14, 199, 309, 1898, 334, 35, 9, 7129, 12, 7760, 24354, 14, 199, 309, 199, 309, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 309, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 309, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 309, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 309, 199, 309, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 309, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 309, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 309, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 309, 199, 309, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 309, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 309, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 47, 7730, 25378, 13981, 11595, 1041, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 421, 199, 3, 24873, 26, 3598, 199, 533, 12235, 47, 7730, 18248, 13981, 3849, 8, 1726, 304, 272, 408, 33, 7809, 5721, 367, 593, 7730, 18248, 13981, 1041, 272, 347, 636, 826, 721, 277, 12, 1245, 304, 267, 408, 5733, 19914, 1041, 267, 291, 14, 1188, 275, 1245, 339, 347, 636, 495, 721, 277, 304, 267, 408, 1558, 6025, 1041, 267, 372, 4700, 8, 277, 14, 1188, 9, 421, 199, 309, 10974, 63, 47, 7730, 63, 1512, 2300, 7187, 63, 4030, 31095, 1553, 769, 402, 3962, 12404, 2808, 367, 199, 309, 593, 7730, 12159, 13981, 2963, 13, 6338, 3180, 543, 3962, 2368, 315, 282, 769, 402, 199, 309, 790, 9265, 574, 13546, 402, 1423, 13, 354, 12, 1415, 12, 6411, 5920, 12, 5423, 14, 199, 10118, 63, 47, 7730, 63, 1512, 2300, 7187, 63, 4030, 31095, 275, 359, 268, 2097, 67, 401, 881, 298, 3916, 334, 67, 4186, 881, 9016, 354, 356, 283, 15479, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 80, 401, 881, 298, 5005, 19695, 334, 80, 4186, 881, 9016, 354, 356, 283, 24020, 13, 1365, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 2097, 7572, 2255, 288, 283, 1210, 356, 298, 13456, 401, 288, 283, 3512, 356, 2097, 7833, 12589, 2255, 288, 283, 4981, 356, 359, 549, 9420, 61, 268, 2156, 268, 2097, 82, 401, 881, 298, 5005, 6941, 334, 82, 4186, 881, 9016, 354, 356, 283, 908, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 7862, 13, 7067, 13, 493, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 7862, 13, 1155, 13, 889, 13, 493, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 65, 401, 881, 298, 5005, 11462, 334, 65, 4186, 881, 9016, 354, 356, 283, 2591, 13, 1825, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 15479, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 84, 401, 881, 298, 5040, 2615, 13, 505, 334, 84, 4186, 881, 9016, 354, 356, 283, 6356, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 298, 9042, 505, 401, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 70, 401, 881, 298, 1541, 334, 70, 4186, 881, 9016, 354, 356, 283, 1541, 13, 493, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 85, 401, 881, 298, 5064, 334, 85, 4186, 881, 9016, 354, 356, 283, 6693, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 442, 2255, 288, 283, 585, 356, 298, 19, 401, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 354, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 298, 28475, 401, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 1622, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 961, 570, 365, 1777, 402, 12235, 14, 199, 309, 1898, 334, 35, 9, 7129, 12, 7760, 24354, 14, 199, 309, 199, 309, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 309, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 309, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 309, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 309, 199, 309, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 309, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 309, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 309, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 309, 199, 309, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 309, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 309, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 47, 7730, 25378, 13981, 11595, 1041, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 421, 199, 3, 24873, 26, 3598, 199, 533, 12235, 47, 7730, 18248, 13981, 3849, 8, 1726, 304, 272, 408, 33, 7809, 5721, 367, 593, 7730, 18248, 13981, 1041, 272, 347, 636, 826, 721, 277, 12, 1245, 304, 267, 408, 5733, 19914, 1041, 267, 291, 14, 1188, 275, 1245, 339, 347, 636, 495, 721, 277, 304, 267, 408, 1558, 6025, 1041, 267, 372, 4700, 8, 277, 14, 1188, 9, 421, 199, 309, 10974, 63, 47, 7730, 63, 1512, 2300, 7187, 63, 4030, 31095, 1553, 769, 402, 3962, 12404, 2808, 367, 199, 309, 593, 7730, 12159, 13981, 2963, 13, 6338, 3180, 543, 3962, 2368, 315, 282, 769, 402, 199, 309, 790, 9265, 574, 13546, 402, 1423, 13, 354, 12, 1415, 12, 6411, 5920, 12, 5423, 14, 199, 10118, 63, 47, 7730, 63, 1512, 2300, 7187, 63, 4030, 31095, 275, 359, 268, 2097, 67, 401, 881, 298, 3916, 334, 67, 4186, 881, 9016, 354, 356, 283, 15479, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 80, 401, 881, 298, 5005, 19695, 334, 80, 4186, 881, 9016, 354, 356, 283, 24020, 13, 1365, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 2097, 7572, 2255, 288, 283, 1210, 356, 298, 13456, 401, 288, 283, 3512, 356, 2097, 7833, 12589, 2255, 288, 283, 4981, 356, 359, 549, 9420, 61, 268, 2156, 268, 2097, 82, 401, 881, 298, 5005, 6941, 334, 82, 4186, 881, 9016, 354, 356, 283, 908, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 7862, 13, 7067, 13, 493, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 7862, 13, 1155, 13, 889, 13, 493, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 65, 401, 881, 298, 5005, 11462, 334, 65, 4186, 881, 9016, 354, 356, 283, 2591, 13, 1825, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 15479, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 84, 401, 881, 298, 5040, 2615, 13, 505, 334, 84, 4186, 881, 9016, 354, 356, 283, 6356, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 298, 9042, 505, 401, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 70, 401, 881, 298, 1541, 334, 70, 4186, 881, 9016, 354, 356, 283, 1541, 13, 493, 297, 288, 283, 2427, 356, 715, 12, 288, 283, 6136, 356, 2097, 493, 2255, 288, 283, 585, 356, 4873, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 2156, 268, 2097, 85, 401, 881, 298, 5064, 334, 85, 4186, 881, 9016, 354, 356, 283, 6693, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 2097, 442, 2255, 288, 283, 585, 356, 298, 19, 401, 288, 283, 1210, 356, 298, 505, 6018, 1779, 791, 354, 356, 283, 354, 297, 288, 283, 2427, 356, 756, 12, 288, 283, 6136, 356, 488, 12, 288, 283, 585, 356, 298, 28475, 401, 288, 283, 1210, 356, 298, 505, 3570, 61, 268, 1622, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Vifon/ranger
ranger/core/actions.py
1
53993
# This file is part of ranger, the console file manager. # License: GNU GPL version 3, see the file "AUTHORS" for details. # pylint: disable=too-many-lines,attribute-defined-outside-init from __future__ import (absolute_import, division, print_function) import codecs import os from os import link, symlink, listdir, stat from os.path import join, isdir, realpath, exists import re import shlex import shutil import string import tempfile from inspect import cleandoc from stat import S_IEXEC from hashlib import sha1 from sys import version_info from logging import getLogger import ranger from ranger.ext.direction import Direction from ranger.ext.relative_symlink import relative_symlink from ranger.ext.keybinding_parser import key_to_string, construct_keybinding from ranger.ext.shell_escape import shell_quote from ranger.ext.next_available_filename import next_available_filename from ranger.ext.rifle import squash_flags, ASK_COMMAND from ranger.core.shared import FileManagerAware, SettingsAware from ranger.core.tab import Tab from ranger.container.directory import Directory from ranger.container.file import File from ranger.core.loader import CommandLoader, CopyLoader from ranger.container.settings import ALLOWED_SETTINGS, ALLOWED_VALUES MACRO_FAIL = "<\x01\x01MACRO_HAS_NO_VALUE\x01\01>" LOG = getLogger(__name__) class _MacroTemplate(string.Template): """A template for substituting macros in commands""" delimiter = ranger.MACRO_DELIMITER idpattern = r"[_a-z0-9]*" class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-methods FileManagerAware, SettingsAware): # -------------------------- # -- Basic Commands # -------------------------- @staticmethod def exit(): """:exit Exit the program. """ raise SystemExit def reset(self): """:reset Reset the filemanager, clearing the directory buffer, reload rifle config """ old_path = self.thisdir.path self.previews = {} self.garbage_collect(-1) self.enter_dir(old_path) self.change_mode('normal') if self.metadata: self.metadata.reset() self.rifle.reload_config() self.fm.tags.sync() def change_mode(self, mode=None): """:change_mode <mode> Change mode to "visual" (selection) or "normal" mode. """ if mode is None: self.fm.notify('Syntax: change_mode <mode>', bad=True) return if mode == self.mode: # pylint: disable=access-member-before-definition return if mode == 'visual': self._visual_pos_start = self.thisdir.pointer self._visual_move_cycles = 0 self._previous_selection = set(self.thisdir.marked_items) self.mark_files(val=not self._visual_reverse, movedown=False) elif mode == 'normal': if self.mode == 'visual': # pylint: disable=access-member-before-definition self._visual_pos_start = None self._visual_move_cycles = None self._previous_selection = None else: return self.mode = mode self.ui.status.request_redraw() def set_option_from_string(self, option_name, value, localpath=None, tags=None): if option_name not in ALLOWED_SETTINGS: raise ValueError("The option named `%s' does not exist" % option_name) if not isinstance(value, str): raise ValueError("The value for an option needs to be a string.") self.settings.set(option_name, self._parse_option_value(option_name, value), localpath, tags) def _parse_option_value( # pylint: disable=too-many-return-statements self, name, value): types = self.fm.settings.types_of(name) if bool in types: if value.lower() in ('false', 'off', '0'): return False elif value.lower() in ('true', 'on', '1'): return True if isinstance(None, types) and value.lower() == 'none': return None if int in types: try: return int(value) except ValueError: pass if float in types: try: return float(value) except ValueError: pass if str in types: return value if list in types: return value.split(',') raise ValueError("Invalid value `%s' for option `%s'!" % (name, value)) def toggle_visual_mode(self, reverse=False, narg=None): """:toggle_visual_mode Toggle the visual mode (see :change_mode). """ if self.mode == 'normal': self._visual_reverse = reverse if narg is not None: self.mark_files(val=not reverse, narg=narg) self.change_mode('visual') else: self.change_mode('normal') def reload_cwd(self): """:reload_cwd Reload the current working directory. """ try: cwd = self.thisdir except AttributeError: pass else: cwd.unload() cwd.load_content() def notify(self, obj, duration=4, bad=False, exception=None): """:notify <text> Display the text in the statusbar. """ if isinstance(obj, Exception): if ranger.args.debug: raise obj exception = obj bad = True elif bad and ranger.args.debug: raise Exception(str(obj)) text = str(obj) text_log = 'Notification: {0}'.format(text) if bad: LOG.error(text_log) else: LOG.info(text_log) if exception: LOG.exception(exception) if self.ui and self.ui.is_on: self.ui.status.notify(" ".join(text.split("\n")), duration=duration, bad=bad) else: print(text) def abort(self): """:abort Empty the first queued action. """ try: item = self.loader.queue[0] except IndexError: self.notify("Type Q or :quit<Enter> to exit ranger") else: self.notify("Aborting: " + item.get_description()) self.loader.remove(index=0) def get_cumulative_size(self): for fobj in self.thistab.get_selection() or (): fobj.look_up_cumulative_size() self.ui.status.request_redraw() self.ui.redraw_main_column() def redraw_window(self): """:redraw Redraw the window. """ self.ui.redraw_window() def open_console(self, string='', # pylint: disable=redefined-outer-name prompt=None, position=None): """:open_console [string] Open the console. """ self.change_mode('normal') self.ui.open_console(string, prompt=prompt, position=position) def execute_console(self, string='', # pylint: disable=redefined-outer-name wildcards=None, quantifier=None): """:execute_console [string] Execute a command for the console """ command_name = string.lstrip().split()[0] cmd_class = self.commands.get_command(command_name) if cmd_class is None: self.notify("Command not found: `%s'" % command_name, bad=True) return None cmd = cmd_class(string, quantifier=quantifier) if cmd.resolve_macros and _MacroTemplate.delimiter in cmd.line: macros = dict(('any%d' % i, key_to_string(char)) for i, char in enumerate(wildcards if wildcards is not None else [])) if 'any0' in macros: macros['any'] = macros['any0'] try: line = self.substitute_macros(cmd.line, additional=macros, escape=cmd.escape_macros_for_shell) except ValueError as ex: if ranger.args.debug: raise return self.notify(ex) cmd.init_line(line) try: cmd.execute() except Exception as ex: # pylint: disable=broad-except if ranger.args.debug: raise self.notify(ex) return None def substitute_macros(self, string, # pylint: disable=redefined-outer-name additional=None, escape=False): macros = self.get_macros() if additional: macros.update(additional) if escape: for key, value in macros.items(): if isinstance(value, list): macros[key] = " ".join(shell_quote(s) for s in value) elif value != MACRO_FAIL: macros[key] = shell_quote(value) else: for key, value in macros.items(): if isinstance(value, list): macros[key] = " ".join(value) result = _MacroTemplate(string).safe_substitute(macros) if MACRO_FAIL in result: raise ValueError("Could not apply macros to `%s'" % string) return result def get_macros(self): # pylint: disable=too-many-branches,too-many-statements macros = {} macros['rangerdir'] = ranger.RANGERDIR if not ranger.args.clean: macros['confdir'] = self.fm.confpath() macros['datadir'] = self.fm.datapath() macros['space'] = ' ' if self.fm.thisfile: macros['f'] = self.fm.thisfile.relative_path else: macros['f'] = MACRO_FAIL if self.fm.thistab.get_selection: macros['p'] = [os.path.join(self.fm.thisdir.path, fl.relative_path) for fl in self.fm.thistab.get_selection()] macros['s'] = [fl.relative_path for fl in self.fm.thistab.get_selection()] else: macros['p'] = MACRO_FAIL macros['s'] = MACRO_FAIL if self.fm.copy_buffer: macros['c'] = [fl.path for fl in self.fm.copy_buffer] else: macros['c'] = MACRO_FAIL if self.fm.thisdir.files: macros['t'] = [fl.relative_path for fl in self.fm.thisdir.files if fl.realpath in self.fm.tags or []] else: macros['t'] = MACRO_FAIL if self.fm.thisdir: macros['d'] = self.fm.thisdir.path else: macros['d'] = '.' # define d/f/p/s macros for each tab for i in range(1, 10): try: tab = self.fm.tabs[i] except KeyError: continue tabdir = tab.thisdir if not tabdir: continue i = str(i) macros[i + 'd'] = tabdir.path if tabdir.get_selection(): macros[i + 'p'] = [os.path.join(tabdir.path, fl.relative_path) for fl in tabdir.get_selection()] macros[i + 's'] = [fl.path for fl in tabdir.get_selection()] else: macros[i + 'p'] = MACRO_FAIL macros[i + 's'] = MACRO_FAIL if tabdir.pointed_obj: macros[i + 'f'] = tabdir.pointed_obj.path else: macros[i + 'f'] = MACRO_FAIL # define D/F/P/S for the next tab found_current_tab = False next_tab = None first_tab = None for tabname in self.fm.tabs: if not first_tab: first_tab = tabname if found_current_tab: next_tab = self.fm.tabs[tabname] break if self.fm.current_tab == tabname: found_current_tab = True if found_current_tab and next_tab is None: next_tab = self.fm.tabs[first_tab] next_tab_dir = next_tab.thisdir if next_tab_dir: macros['D'] = str(next_tab_dir.path) if next_tab.thisfile: macros['F'] = next_tab.thisfile.path else: macros['F'] = MACRO_FAIL if next_tab_dir.get_selection(): macros['P'] = [os.path.join(next_tab.path, fl.path) for fl in next_tab.get_selection()] macros['S'] = [fl.path for fl in next_tab.get_selection()] else: macros['P'] = MACRO_FAIL macros['S'] = MACRO_FAIL else: macros['D'] = MACRO_FAIL macros['F'] = MACRO_FAIL macros['S'] = MACRO_FAIL return macros def source(self, filename): """:source <filename> Load a config file. """ filename = os.path.expanduser(filename) LOG.debug("Sourcing config file '%s'", filename) with open(filename, 'r') as fobj: for line in fobj: line = line.strip(" \r\n") if line.startswith("#") or not line.strip(): continue try: self.execute_console(line) except Exception as ex: # pylint: disable=broad-except if ranger.args.debug: raise self.notify('Error in line `%s\':\n %s' % (line, str(ex)), bad=True) def execute_file(self, files, **kw): """Uses the "rifle" module to open/execute a file Arguments are the same as for ranger.ext.rifle.Rifle.execute: files: a list of file objects (not strings!) number: a number to select which way to open the file, in case there are multiple choices label: a string to select an opening method by its label flags: a string specifying additional options, see `man rifle` mimetyle: pass the mimetype to rifle, overriding its own guess """ mode = kw['mode'] if 'mode' in kw else 0 # ranger can act as a file chooser when running with --choosefile=... if mode == 0 and 'label' not in kw: if ranger.args.choosefile: with open(ranger.args.choosefile, 'w') as fobj: fobj.write(self.fm.thisfile.path) if ranger.args.choosefiles: paths = [] for hist in self.fm.thistab.history: for fobj in hist.files: if fobj.marked and fobj.path not in paths: paths += [fobj.path] paths += [f.path for f in self.fm.thistab.get_selection() if f.path not in paths] with open(ranger.args.choosefiles, 'w') as fobj: fobj.write('\n'.join(paths) + '\n') if ranger.args.choosefile or ranger.args.choosefiles: raise SystemExit if isinstance(files, set): files = list(files) elif not isinstance(files, (list, tuple)): files = [files] flags = kw.get('flags', '') if 'c' in squash_flags(flags): files = [self.fm.thisfile] self.signal_emit('execute.before', keywords=kw) filenames = [f.path for f in files] label = kw.get('label', kw.get('app', None)) try: return self.rifle.execute(filenames, mode, label, flags, None) finally: self.signal_emit('execute.after') # -------------------------- # -- Moving Around # -------------------------- def move(self, # pylint: disable=too-many-locals,too-many-branches,too-many-statements narg=None, **kw): """A universal movement method. Accepts these parameters: (int) down, (int) up, (int) left, (int) right, (int) to, (bool) absolute, (bool) relative, (bool) pages, (bool) percentage to=X is translated to down=X, absolute=True Example: self.move(down=4, pages=True) # moves down by 4 pages. self.move(to=2, pages=True) # moves to page 2. self.move(to=80, percentage=True) # moves to 80% """ cwd = self.thisdir kw.setdefault('cycle', self.fm.settings['wrap_scroll']) kw.setdefault('one_indexed', self.fm.settings['one_indexed']) direction = Direction(kw) if 'left' in direction or direction.left() > 0: steps = direction.left() if narg is not None: steps *= narg directory = os.path.join(*(['..'] * steps)) self.thistab.enter_dir(directory) self.change_mode('normal') if not cwd or not cwd.accessible or not cwd.content_loaded: return if 'right' in direction: mode = 0 if narg is not None: mode = narg tfile = self.thisfile selection = self.thistab.get_selection() if not self.thistab.enter_dir(tfile) and selection: result = self.execute_file(selection, mode=mode) if result in (False, ASK_COMMAND): self.open_console('open_with ') elif direction.vertical() and cwd.files: pos_new = direction.move( direction=direction.down(), override=narg, maximum=len(cwd), current=cwd.pointer, pagesize=self.ui.browser.hei) cwd.move(to=pos_new) if self.mode == 'visual': pos_start = min(self._visual_pos_start, (len(cwd.files) - 1)) self._visual_move_cycles += direction.move_cycles() # Haven't cycled if self._visual_move_cycles == 0: targets = set(cwd.files[min(pos_start, pos_new):(max(pos_start, pos_new) + 1)]) # Cycled down once elif self._visual_move_cycles == 1: if pos_new < pos_start: targets = set(cwd.files[:(pos_new + 1)] + cwd.files[pos_start:]) else: targets = set(cwd.files) # Cycled up once elif self._visual_move_cycles == -1: if pos_new > pos_start: targets = set(cwd.files[:(pos_start + 1)] + cwd.files[pos_new:]) else: targets = set(cwd.files) # Cycled more than once else: targets = set(cwd.files) # The current selection current = set(cwd.marked_items) # Set theory anyone? if self._visual_reverse: for fobj in targets & current: cwd.mark_item(fobj, False) for fobj in self._previous_selection - current - targets: cwd.mark_item(fobj, True) else: for fobj in targets - current: cwd.mark_item(fobj, True) for fobj in current - self._previous_selection - targets: cwd.mark_item(fobj, False) if self.ui.pager.visible: self.display_file() def move_parent(self, n, narg=None): self.change_mode('normal') if narg is not None: n *= narg parent = self.thistab.at_level(-1) if parent is not None: if parent.pointer + n < 0: n = 0 - parent.pointer try: self.thistab.enter_dir(parent.files[parent.pointer + n]) except IndexError: pass def select_file(self, path): path = path.strip() if self.enter_dir(os.path.dirname(path)): self.thisdir.move_to_obj(path) def history_go(self, relative): """Move back and forth in the history""" self.thistab.history_go(int(relative)) # TODO: remove this method since it is not used? def scroll(self, relative): """Scroll down by <relative> lines""" if self.ui.browser and self.ui.browser.main_column: self.ui.browser.main_column.scroll(relative) self.thisfile = self.thisdir.pointed_obj def enter_dir(self, path, remember=False, history=True): """Enter the directory at the given path""" cwd = self.thisdir # csh variable is lowercase cdpath = os.environ.get('CDPATH', None) or os.environ.get('cdpath', None) result = self.thistab.enter_dir(path, history=history) if result is False and cdpath: for comp in cdpath.split(':'): curpath = os.path.join(comp, path) if os.path.isdir(curpath): result = self.thistab.enter_dir(curpath, history=history) break if cwd != self.thisdir: if remember: self.bookmarks.remember(cwd) self.change_mode('normal') return result def cd(self, path, remember=True): # pylint: disable=invalid-name """enter the directory at the given path, remember=True""" self.enter_dir(path, remember=remember) def traverse(self): self.change_mode('normal') tfile = self.thisfile cwd = self.thisdir if tfile is not None and tfile.is_directory: self.enter_dir(tfile.path) elif cwd.pointer >= len(cwd) - 1: while True: self.move(left=1) cwd = self.thisdir if cwd.pointer < len(cwd) - 1: break if cwd.path == '/': break self.move(down=1) self.traverse() else: self.move(down=1) self.traverse() def traverse_backwards(self): self.change_mode('normal') if self.thisdir.pointer == 0: self.move(left=1) if self.thisdir.pointer != 0: self.traverse_backwards() else: self.move(up=1) while True: if self.thisfile is not None and self.thisfile.is_directory: self.enter_dir(self.thisfile.path) self.move(to=100, percentage=True) elif self.thisdir.pointer == 0: break else: self.move(up=1) # -------------------------- # -- Shortcuts / Wrappers # -------------------------- def pager_move(self, narg=None, **kw): self.ui.get_pager().move(narg=narg, **kw) def taskview_move(self, narg=None, **kw): self.ui.taskview.move(narg=narg, **kw) def pause_tasks(self): self.loader.pause(-1) def pager_close(self): if self.ui.pager.visible: self.ui.close_pager() if self.ui.browser.pager and self.ui.browser.pager.visible: self.ui.close_embedded_pager() def taskview_open(self): self.ui.open_taskview() def taskview_close(self): self.ui.close_taskview() def execute_command(self, cmd, **kw): return self.run(cmd, **kw) def edit_file(self, file=None): # pylint: disable=redefined-builtin """Calls execute_file with the current file and label='editor'""" if file is None: file = self.thisfile elif isinstance(file, str): file = File(os.path.expanduser(file)) if file is None: return self.execute_file(file, label='editor') def toggle_option(self, string): # pylint: disable=redefined-outer-name """:toggle_option <string> Toggle a boolean option named <string>. """ if isinstance(self.settings[string], bool): self.settings[string] ^= True elif string in ALLOWED_VALUES: current = self.settings[string] allowed = ALLOWED_VALUES[string] if allowed: if current not in allowed and current == "": current = allowed[0] if current in allowed: self.settings[string] = \ allowed[(allowed.index(current) + 1) % len(allowed)] else: self.settings[string] = allowed[0] def set_option(self, optname, value): """:set_option <optname> Set the value of an option named <optname>. """ self.settings[optname] = value def sort(self, func=None, reverse=None): if reverse is not None: self.settings['sort_reverse'] = bool(reverse) if func is not None: self.settings['sort'] = str(func) def mark_files(self, all=False, # pylint: disable=redefined-builtin,too-many-arguments toggle=False, val=None, movedown=None, narg=None): """A wrapper for the directory.mark_xyz functions. Arguments: all - change all files of the current directory at once? toggle - toggle the marked-status? val - mark or unmark? """ if self.thisdir is None: return cwd = self.thisdir if not cwd.accessible: return if movedown is None: movedown = not all if val is None and toggle is False: return if narg is None: narg = 1 else: all = False if all: if toggle: cwd.toggle_all_marks() else: cwd.mark_all(val) if self.mode == 'visual': self.change_mode('normal') else: for i in range(cwd.pointer, min(cwd.pointer + narg, len(cwd))): item = cwd.files[i] if item is not None: if toggle: cwd.toggle_mark(item) else: cwd.mark_item(item, val) if movedown: self.move(down=narg) self.ui.redraw_main_column() self.ui.status.need_redraw = True def mark_in_direction(self, val=True, dirarg=None): cwd = self.thisdir direction = Direction(dirarg) pos, selected = direction.select(lst=cwd.files, current=cwd.pointer, pagesize=self.ui.termsize[0]) cwd.pointer = pos cwd.correct_pointer() for item in selected: cwd.mark_item(item, val) # -------------------------- # -- Searching # -------------------------- # TODO: Do we still use this method? Should we remove it? def search_file(self, text, offset=1, regexp=True): if isinstance(text, str) and regexp: try: text = re.compile(text, re.UNICODE | re.IGNORECASE) # pylint: disable=no-member except re.error: return False self.thistab.last_search = text self.search_next(order='search', offset=offset) return None def search_next(self, order=None, offset=1, forward=True): original_order = order if order is None: order = self.search_method else: self.set_search_method(order=order) if order in ('search', 'tag'): if order == 'search': arg = self.thistab.last_search if arg is None: return False if hasattr(arg, 'search'): def fnc(obj): return arg.search(obj.basename) else: def fnc(obj): return arg in obj.basename elif order == 'tag': def fnc(obj): return obj.realpath in self.tags return self.thisdir.search_fnc(fnc=fnc, offset=offset, forward=forward) elif order in ('size', 'mimetype', 'ctime', 'mtime', 'atime'): cwd = self.thisdir if original_order is not None or not cwd.cycle_list: lst = list(cwd.files) if order == 'size': def fnc(item): return -item.size elif order == 'mimetype': def fnc(item): return item.mimetype or '' elif order == 'ctime': def fnc(item): return -int(item.stat and item.stat.st_ctime) elif order == 'atime': def fnc(item): return -int(item.stat and item.stat.st_atime) elif order == 'mtime': def fnc(item): return -int(item.stat and item.stat.st_mtime) lst.sort(key=fnc) cwd.set_cycle_list(lst) return cwd.cycle(forward=None) return cwd.cycle(forward=forward) return None def set_search_method(self, order, forward=True): # pylint: disable=unused-argument if order in ('search', 'tag', 'size', 'mimetype', 'ctime', 'mtime', 'atime'): self.search_method = order # -------------------------- # -- Tags # -------------------------- # Tags are saved in ~/.config/ranger/tagged and simply mark if a # file is important to you in any context. def tag_toggle(self, paths=None, value=None, movedown=None, tag=None): """:tag_toggle <character> Toggle a tag <character>. """ if not self.tags: return if paths is None: tags = tuple(x.realpath for x in self.thistab.get_selection()) else: tags = [realpath(path) for path in paths] if value is True: self.tags.add(*tags, tag=tag or self.tags.default_tag) elif value is False: self.tags.remove(*tags) else: self.tags.toggle(*tags, tag=tag or self.tags.default_tag) if movedown is None: movedown = len(tags) == 1 and paths is None if movedown: self.move(down=1) self.ui.redraw_main_column() def tag_remove(self, paths=None, movedown=None, tag=None): self.tag_toggle(paths=paths, value=False, movedown=movedown, tag=tag) def tag_add(self, paths=None, movedown=None, tag=None): self.tag_toggle(paths=paths, value=True, movedown=movedown, tag=tag) # -------------------------- # -- Bookmarks # -------------------------- # Using ranger.container.bookmarks. def enter_bookmark(self, key): """Enter the bookmark with the name <key>""" try: self.bookmarks.update_if_outdated() destination = self.bookmarks[str(key)] cwd = self.thisdir if destination.path != cwd.path: self.bookmarks.enter(str(key)) self.bookmarks.remember(cwd) except KeyError: pass def set_bookmark(self, key, val=None): """Set the bookmark with the name <key> to the current directory""" if val is None: val = self.thisdir else: val = Directory(val) self.bookmarks.update_if_outdated() self.bookmarks[str(key)] = val def unset_bookmark(self, key): """Delete the bookmark with the name <key>""" self.bookmarks.update_if_outdated() del self.bookmarks[str(key)] def draw_bookmarks(self): self.ui.browser.draw_bookmarks = True def hide_bookmarks(self): self.ui.browser.draw_bookmarks = False def draw_possible_programs(self): try: target = self.thistab.get_selection()[0] except IndexError: self.ui.browser.draw_info = [] return programs = [program for program in self.rifle.list_commands([target.path], None)] if programs: num_digits = max((len(str(program[0])) for program in programs)) program_info = ['%s | %s' % (str(program[0]).rjust(num_digits), program[1]) for program in programs] self.ui.browser.draw_info = program_info def hide_console_info(self): self.ui.browser.draw_info = False # -------------------------- # -- Pager # -------------------------- # These commands open the built-in pager and set specific sources. def display_command_help(self, console_widget): try: command = console_widget.get_cmd_class() except KeyError: self.notify("Feature not available!", bad=True) return if not command: self.notify("Command not found!", bad=True) return if not command.__doc__: self.notify("Command has no docstring. Try using python without -OO", bad=True) return pager = self.ui.open_pager() lines = cleandoc(command.__doc__).split('\n') pager.set_source(lines) def display_help(self): manualpath = self.relpath('../doc/ranger.1') if os.path.exists(manualpath): process = self.run(['man', manualpath]) if process.poll() != 16: return process = self.run(['man', 'ranger']) if process.poll() == 16: self.notify("Could not find manpage.", bad=True) def display_log(self): logs = list(self.get_log()) pager = self.ui.open_pager() if logs: pager.set_source(["Message Log:"] + logs) else: pager.set_source(["Message Log:", "No messages!"]) pager.move(to=100, percentage=True) def display_file(self): if not self.thisfile or not self.thisfile.is_file: return pager = self.ui.open_pager() fobj = self.thisfile.get_preview_source(pager.wid, pager.hei) if self.thisfile.is_image_preview(): pager.set_image(fobj) else: pager.set_source(fobj) # -------------------------- # -- Previews # -------------------------- def update_preview(self, path): try: del self.previews[path] except KeyError: return False self.ui.need_redraw = True return True @staticmethod def sha1_encode(path): if version_info[0] < 3: return os.path.join(ranger.args.cachedir, sha1(path).hexdigest()) + '.jpg' return os.path.join(ranger.args.cachedir, sha1(path.encode('utf-8', 'backslashreplace')).hexdigest()) + '.jpg' def get_preview(self, fobj, width, height): # pylint: disable=too-many-return-statements pager = self.ui.get_pager() path = fobj.realpath if not path or not os.path.exists(path): return None if not self.settings.preview_script or not self.settings.use_preview_script: try: # XXX: properly determine file's encoding return codecs.open(path, 'r', errors='ignore') # IOError for Python2, OSError for Python3 except (IOError, OSError): return None # self.previews is a 2 dimensional dict: # self.previews['/tmp/foo.jpg'][(80, 24)] = "the content..." # self.previews['/tmp/foo.jpg']['loading'] = False # A -1 in tuples means "any"; (80, -1) = wid. of 80 and any hei. # The key 'foundpreview' is added later. Values in (True, False) # XXX: Previews can break when collapse_preview is on and the # preview column is popping out as you move the cursor on e.g. a # PDF file. try: data = self.previews[path] except KeyError: data = self.previews[path] = {'loading': False} else: if data['loading']: return None found = data.get( (-1, -1), data.get( (width, -1), data.get( (-1, height), data.get( (width, height), False ) ) ) ) if found is not False: return found try: stat_ = os.stat(self.settings.preview_script) except OSError: self.fm.notify("Preview script `{0}` doesn't exist!".format( self.settings.preview_script), bad=True) return None if not stat_.st_mode & S_IEXEC: self.fm.notify("Preview script `{0}` is not executable!".format( self.settings.preview_script), bad=True) return None data['loading'] = True if 'directimagepreview' in data: data['foundpreview'] = True data['imagepreview'] = True pager.set_image(path) data['loading'] = False return path cacheimg = os.path.join(ranger.args.cachedir, self.sha1_encode(path)) if self.settings.preview_images and \ os.path.isfile(cacheimg) and \ os.path.getmtime(cacheimg) > os.path.getmtime(path): data['foundpreview'] = True data['imagepreview'] = True pager.set_image(cacheimg) data['loading'] = False return cacheimg def on_after(signal): rcode = signal.process.poll() content = signal.loader.stdout_buffer data['foundpreview'] = True if rcode == 0: data[(width, height)] = content elif rcode == 3: data[(-1, height)] = content elif rcode == 4: data[(width, -1)] = content elif rcode == 5: data[(-1, -1)] = content elif rcode == 6: data['imagepreview'] = True elif rcode == 7: data['directimagepreview'] = True elif rcode == 1: data[(-1, -1)] = None data['foundpreview'] = False elif rcode == 2: data[(-1, -1)] = self.read_text_file(path, 1024 * 32) else: data[(-1, -1)] = None if self.thisfile and self.thisfile.realpath == path: self.ui.browser.need_redraw = True data['loading'] = False pager = self.ui.get_pager() if self.thisfile and self.thisfile.is_file: if 'imagepreview' in data: pager.set_image(cacheimg) return cacheimg elif 'directimagepreview' in data: pager.set_image(path) return path else: pager.set_source(self.thisfile.get_preview_source( pager.wid, pager.hei)) return None def on_destroy(signal): # pylint: disable=unused-argument try: del self.previews[path] except KeyError: pass loadable = CommandLoader( args=[self.settings.preview_script, path, str(width), str(height), cacheimg, str(self.settings.preview_images)], read=True, silent=True, descr="Getting preview of %s" % path, ) loadable.signal_bind('after', on_after) loadable.signal_bind('destroy', on_destroy) self.loader.add(loadable) return None @staticmethod def read_text_file(path, count=None): """Encoding-aware reading of a text file.""" try: import chardet except ImportError: # Guess encoding ourselves. These should be the most frequently used ones. encodings = ('utf-8', 'utf-16') for encoding in encodings: try: with codecs.open(path, 'r', encoding=encoding) as fobj: text = fobj.read(count) except UnicodeDecodeError: pass else: LOG.debug("guessed encoding of '%s' as %r", path, encoding) return text else: with open(path, 'rb') as fobj: data = fobj.read(count) result = chardet.detect(data) LOG.debug("chardet guess for '%s': %s", path, result) guessed_encoding = result['encoding'] return codecs.decode(data, guessed_encoding, 'replace') # latin-1 as the last resort with codecs.open(path, 'r', encoding='latin-1', errors='replace') as fobj: return fobj.read(count) # -------------------------- # -- Tabs # -------------------------- def tab_open(self, name, path=None): tab_has_changed = (name != self.current_tab) self.current_tab = name previous_tab = self.thistab try: tab = self.tabs[name] except KeyError: # create a new tab tab = Tab(self.thistab.path) self.tabs[name] = tab self.thistab = tab tab.enter_dir(tab.path, history=False) if path: tab.enter_dir(path, history=True) if previous_tab: tab.inherit_history(previous_tab.history) else: self.thistab = tab if path: tab.enter_dir(path, history=True) else: tab.enter_dir(tab.path, history=False) if tab_has_changed: self.change_mode('normal') self.signal_emit('tab.change', old=previous_tab, new=self.thistab) self.signal_emit('tab.layoutchange') def tab_close(self, name=None): if name is None: name = self.current_tab tab = self.tabs[name] if name == self.current_tab: direction = -1 if name == self.get_tab_list()[-1] else 1 previous = self.current_tab self.tab_move(direction) if previous == self.current_tab: return # can't close last tab if name in self.tabs: del self.tabs[name] self.restorable_tabs.append(tab) self.signal_emit('tab.layoutchange') def tab_restore(self): # NOTE: The name of the tab is not restored. previous_tab = self.thistab if self.restorable_tabs: tab = self.restorable_tabs.pop() for name in range(1, len(self.tabs) + 2): if name not in self.tabs: self.current_tab = name self.tabs[name] = tab tab.enter_dir(tab.path, history=False) self.thistab = tab self.change_mode('normal') self.signal_emit('tab.change', old=previous_tab, new=self.thistab) break def tab_move(self, offset, narg=None): if narg: return self.tab_open(narg) assert isinstance(offset, int) tablist = self.get_tab_list() current_index = tablist.index(self.current_tab) newtab = tablist[(current_index + offset) % len(tablist)] if newtab != self.current_tab: self.tab_open(newtab) return None def tab_new(self, path=None, narg=None): if narg: return self.tab_open(narg, path) i = 1 while i in self.tabs: i += 1 return self.tab_open(i, path) def tab_switch(self, path, create_directory=False): """Switches to tab of given path, opening a new tab as necessary. If path does not exist, it is treated as a directory. """ path = realpath(path) if not os.path.exists(path): file_selection = None if create_directory: try: if not os.path.isdir(path): os.makedirs(path) except OSError as err: self.fm.notify(err, bad=True) return target_directory = path else: # Give benefit of the doubt. potential_parent = os.path.dirname(path) if os.path.exists(potential_parent) and os.path.isdir(potential_parent): target_directory = potential_parent else: self.fm.notify("Unable to resolve given path.", bad=True) return elif os.path.isdir(path): file_selection = None target_directory = path else: file_selection = path target_directory = os.path.dirname(path) for name in self.fm.tabs: tab = self.fm.tabs[name] # Is a tab already open? if tab.path == target_directory: self.fm.tab_open(name=name) if file_selection: self.fm.select_file(file_selection) return self.fm.tab_new(path=target_directory) if file_selection: self.fm.select_file(file_selection) def get_tab_list(self): assert self.tabs, "There must be at least 1 tab at all times" class NaturalOrder(object): # pylint: disable=too-few-public-methods def __init__(self, obj): self.obj = obj def __lt__(self, other): try: return self.obj < other.obj except TypeError: return str(self.obj) < str(other.obj) return sorted(self.tabs, key=NaturalOrder) # -------------------------- # -- Overview of internals # -------------------------- def _run_pager(self, path): self.run(shlex.split(os.environ.get('PAGER', ranger.DEFAULT_PAGER)) + [path]) def dump_keybindings(self, *contexts): if not contexts: contexts = 'browser', 'console', 'pager', 'taskview' temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name temporary_file.write(string.encode('utf-8')) def recurse(before, pointer): for key, value in pointer.items(): keys = before + [key] if isinstance(value, dict): recurse(keys, value) else: write("%12s %s\n" % (construct_keybinding(keys), value)) for context in contexts: write("Keybindings in `%s'\n" % context) if context in self.fm.ui.keymaps: recurse([], self.fm.ui.keymaps[context]) else: write(" None\n") write("\n") temporary_file.flush() self._run_pager(temporary_file.name) def dump_commands(self): temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name temporary_file.write(string.encode('utf-8')) undocumented = [] for cmd_name in sorted(self.commands.commands): cmd = self.commands.commands[cmd_name] if hasattr(cmd, '__doc__') and cmd.__doc__: doc = cleandoc(cmd.__doc__) if doc[0] == ':': write(doc) write("\n\n" + "-" * 60 + "\n") else: undocumented.append(cmd) if undocumented: write("Undocumented commands:\n\n") for cmd in undocumented: write(" :%s\n" % cmd.get_name()) temporary_file.flush() self._run_pager(temporary_file.name) def dump_settings(self): temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name temporary_file.write(string.encode('utf-8')) for setting in sorted(ALLOWED_SETTINGS): write("%30s = %s\n" % (setting, getattr(self.settings, setting))) temporary_file.flush() self._run_pager(temporary_file.name) # -------------------------- # -- File System Operations # -------------------------- def uncut(self): """:uncut Empty the copy buffer. """ self.copy_buffer = set() self.do_cut = False self.ui.browser.main_column.request_redraw() def copy(self, mode='set', narg=None, dirarg=None): """:copy [mode=set] Copy the selected items. Modes are: 'set', 'add', 'remove'. """ assert mode in ('set', 'add', 'remove', 'toggle') cwd = self.thisdir if not narg and not dirarg: selected = (fobj for fobj in self.thistab.get_selection() if fobj in cwd.files) else: if not dirarg and narg: direction = Direction(down=1) offset = 0 else: direction = Direction(dirarg) offset = 1 pos, selected = direction.select(override=narg, lst=cwd.files, current=cwd.pointer, pagesize=self.ui.termsize[0], offset=offset) cwd.pointer = pos cwd.correct_pointer() if mode == 'set': self.copy_buffer = set(selected) elif mode == 'add': self.copy_buffer.update(set(selected)) elif mode == 'remove': self.copy_buffer.difference_update(set(selected)) elif mode == 'toggle': self.copy_buffer.symmetric_difference_update(set(selected)) self.do_cut = False self.ui.browser.main_column.request_redraw() def cut(self, mode='set', narg=None, dirarg=None): """:cut [mode=set] Cut the selected items. Modes are: 'set, 'add, 'remove. """ self.copy(mode=mode, narg=narg, dirarg=dirarg) self.do_cut = True self.ui.browser.main_column.request_redraw() def paste_symlink(self, relative=False): copied_files = self.copy_buffer for fobj in copied_files: new_name = next_available_filename(fobj.basename) self.notify(new_name) try: if relative: relative_symlink(fobj.path, join(self.fm.thisdir.path, new_name)) else: symlink(fobj.path, join(self.fm.thisdir.path, new_name)) except OSError as ex: self.notify('Failed to paste symlink: View log for more info', bad=True, exception=ex) def paste_hardlink(self): for fobj in self.copy_buffer: new_name = next_available_filename(fobj.basename) try: link(fobj.path, join(self.fm.thisdir.path, new_name)) except OSError as ex: self.notify('Failed to paste hardlink: View log for more info', bad=True, exception=ex) def paste_hardlinked_subtree(self): for fobj in self.copy_buffer: try: target_path = join(self.fm.thisdir.path, fobj.basename) self._recurse_hardlinked_tree(fobj.path, target_path) except OSError as ex: self.notify('Failed to paste hardlinked subtree: View log for more info', bad=True, exception=ex) def _recurse_hardlinked_tree(self, source_path, target_path): if isdir(source_path): if not exists(target_path): os.mkdir(target_path, stat(source_path).st_mode) for item in listdir(source_path): self._recurse_hardlinked_tree( join(source_path, item), join(target_path, item)) else: if not exists(target_path) \ or stat(source_path).st_ino != stat(target_path).st_ino: link(source_path, next_available_filename(target_path)) def paste(self, overwrite=False, append=False): """:paste Paste the selected items into the current directory. """ loadable = CopyLoader(self.copy_buffer, self.do_cut, overwrite) self.loader.add(loadable, append=append) self.do_cut = False def delete(self, files=None): # XXX: warn when deleting mount points/unseen marked files? self.notify("Deleting!") # COMPAT: old command.py use fm.delete() without arguments if files is None: files = (fobj.path for fobj in self.thistab.get_selection()) files = [os.path.abspath(path) for path in files] for path in files: # Untag the deleted files. for tag in self.fm.tags.tags: if str(tag).startswith(path): self.fm.tags.remove(tag) self.copy_buffer = set(fobj for fobj in self.copy_buffer if fobj.path not in files) for path in files: if isdir(path) and not os.path.islink(path): try: shutil.rmtree(path) except OSError as err: self.notify(err) else: try: os.remove(path) except OSError as err: self.notify(err) self.thistab.ensure_correct_pointer() def mkdir(self, name): try: os.makedirs(os.path.join(self.thisdir.path, name)) except OSError as err: self.notify(err) def rename(self, src, dest): if hasattr(src, 'path'): src = src.path try: os.makedirs(os.path.dirname(dest)) except OSError: pass try: os.rename(src, dest) except OSError as err: self.notify(err) return False return True
gpl-3.0
[ 3, 961, 570, 365, 1777, 402, 519, 12974, 12, 314, 8559, 570, 5256, 14, 199, 3, 844, 26, 1664, 14629, 1015, 650, 12, 1937, 314, 570, 298, 5580, 4149, 2, 367, 2436, 14, 199, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1278, 12, 3215, 13, 4037, 13, 22431, 13, 826, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 199, 646, 6010, 199, 646, 747, 199, 504, 747, 492, 2142, 12, 15296, 12, 27483, 12, 5672, 199, 504, 747, 14, 515, 492, 4263, 12, 26004, 12, 3363, 515, 12, 3495, 199, 646, 295, 199, 646, 16701, 199, 646, 5145, 199, 646, 1059, 199, 646, 5549, 199, 504, 6485, 492, 15158, 460, 679, 199, 504, 5672, 492, 428, 63, 41, 10276, 199, 504, 8337, 492, 7793, 17, 199, 504, 984, 492, 1015, 63, 815, 199, 504, 2050, 492, 28138, 199, 199, 646, 519, 12974, 199, 504, 519, 12974, 14, 832, 14, 6874, 492, 25596, 414, 199, 504, 519, 12974, 14, 832, 14, 6188, 63, 13380, 492, 3847, 63, 13380, 199, 504, 519, 12974, 14, 832, 14, 498, 9140, 63, 2087, 492, 790, 63, 475, 63, 875, 12, 6982, 63, 498, 9140, 199, 504, 519, 12974, 14, 832, 14, 5641, 63, 3765, 492, 5218, 63, 3513, 199, 504, 519, 12974, 14, 832, 14, 2184, 63, 4561, 63, 1501, 492, 2163, 63, 4561, 63, 1501, 199, 504, 519, 12974, 14, 832, 14, 20546, 274, 492, 12345, 1119, 63, 2469, 12, 4319, 43, 63, 10761, 199, 504, 519, 12974, 14, 1018, 14, 5555, 492, 3814, 2988, 24290, 12, 13303, 24290, 199, 504, 519, 12974, 14, 1018, 14, 2902, 492, 23159, 199, 504, 519, 12974, 14, 3600, 14, 3619, 492, 15191, 199, 504, 519, 12974, 14, 3600, 14, 493, 492, 3814, 199, 504, 519, 12974, 14, 1018, 14, 3422, 492, 5817, 5455, 12, 11247, 5455, 199, 504, 519, 12974, 14, 3600, 14, 1751, 492, 27805, 1149, 63, 13931, 12, 27805, 1149, 63, 15514, 421, 199, 9410, 1092, 63, 8784, 275, 3886, 60, 88, 614, 60, 88, 614, 9410, 1092, 63, 13533, 63, 2826, 63, 7041, 60, 88, 614, 60, 614, 4335, 199, 199, 4947, 275, 28138, 3460, 354, 3368, 421, 199, 533, 485, 24673, 4231, 8, 875, 14, 4231, 304, 272, 408, 33, 1978, 367, 10004, 4655, 16954, 315, 3718, 624, 272, 11172, 275, 519, 12974, 14, 9410, 1092, 63, 32717, 540, 272, 1305, 3401, 275, 519, 2, 13040, 65, 13, 90, 16, 13, 25, 3672, 2, 421, 199, 533, 24367, 8, 221, 327, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 842, 13, 2987, 12, 7354, 13, 3479, 13, 3455, 13, 2474, 267, 3814, 2988, 24290, 12, 13303, 24290, 304, 339, 327, 10652, 9460, 272, 327, 1553, 10082, 5817, 83, 272, 327, 10652, 9460, 339, 768, 4639, 272, 347, 4458, 837, 267, 408, 26, 2224, 398, 18704, 314, 2240, 14, 267, 408, 267, 746, 14838, 339, 347, 5305, 8, 277, 304, 267, 408, 26, 3958, 398, 15510, 314, 570, 2609, 12, 5436, 316, 314, 2082, 3335, 12, 13101, 8012, 21599, 1101, 267, 408, 267, 2269, 63, 515, 275, 291, 14, 3749, 694, 14, 515, 267, 291, 14, 657, 4196, 275, 1052, 267, 291, 14, 28737, 63, 7112, 2801, 17, 9, 267, 291, 14, 4200, 63, 694, 8, 1753, 63, 515, 9, 267, 291, 14, 1461, 63, 632, 360, 3302, 358, 267, 340, 291, 14, 2343, 26, 288, 291, 14, 2343, 14, 3958, 342, 267, 291, 14, 20546, 274, 14, 9233, 63, 888, 342, 267, 291, 14, 10886, 14, 2969, 14, 5186, 342, 339, 347, 1570, 63, 632, 8, 277, 12, 818, 29, 403, 304, 267, 408, 26, 1461, 63, 632, 665, 632, 30, 398, 7743, 818, 370, 298, 16948, 2, 334, 5592, 9, 503, 298, 3302, 2, 818, 14, 267, 408, 267, 340, 818, 365, 488, 26, 288, 291, 14, 10886, 14, 6814, 360, 16626, 26, 1570, 63, 632, 665, 632, 4206, 4875, 29, 549, 9, 288, 372, 267, 340, 818, 508, 291, 14, 632, 26, 221, 327, 4287, 26, 3507, 29, 2732, 13, 1114, 13, 5182, 13, 7463, 288, 372, 267, 340, 818, 508, 283, 16948, 356, 288, 291, 423, 16948, 63, 1712, 63, 928, 275, 291, 14, 3749, 694, 14, 3929, 288, 291, 423, 16948, 63, 1185, 63, 23356, 275, 378, 288, 291, 423, 6352, 63, 5592, 275, 663, 8, 277, 14, 3749, 694, 14, 17938, 63, 1744, 9, 288, 291, 14, 1657, 63, 1725, 8, 637, 29, 1397, 291, 423, 16948, 63, 4471, 12, 12155, 944, 29, 797, 9, 267, 916, 818, 508, 283, 3302, 356, 288, 340, 291, 14, 632, 508, 283, 16948, 356, 221, 327, 4287, 26, 3507, 29, 2732, 13, 1114, 13, 5182, 13, 7463, 355, 291, 423, 16948, 63, 1712, 63, 928, 275, 488, 355, 291, 423, 16948, 63, 1185, 63, 23356, 275, 488, 355, 291, 423, 6352, 63, 5592, 275, 488, 267, 587, 26, 288, 372, 267, 291, 14, 632, 275, 818, 267, 291, 14, 1907, 14, 1205, 14, 1069, 63, 581, 1773, 342, 339, 347, 663, 63, 1422, 63, 504, 63, 875, 8, 277, 12, 945, 63, 354, 12, 574, 12, 2257, 515, 29, 403, 12, 3762, 29, 403, 304, 267, 340, 945, 63, 354, 440, 315, 27805, 1149, 63, 13931, 26, 288, 746, 1722, 480, 1918, 945, 4310, 18633, 83, 7, 1630, 440, 2187, 2, 450, 945, 63, 354, 9, 267, 340, 440, 1228, 8, 585, 12, 620, 304, 288, 746, 1722, 480, 1918, 574, 367, 376, 945, 4839, 370, 506, 282, 1059, 2685, 398, 291, 14, 1751, 14, 409, 8, 1422, 63, 354, 12, 291, 423, 1122, 63, 1422, 63, 585, 8, 1422, 63, 354, 12, 574, 395, 2079, 2257, 515, 12, 3762, 9, 339, 347, 485, 1122, 63, 1422, 63, 585, 8, 221, 327, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1107, 13, 15384, 288, 291, 12, 536, 12, 574, 304, 267, 2943, 275, 291, 14, 10886, 14, 1751, 14, 1313, 63, 1618, 8, 354, 9, 267, 340, 2155, 315, 2943, 26, 288, 340, 574, 14, 2325, 342, 315, 661, 3910, 297, 283, 1997, 297, 283, 16, 735, 355, 372, 756, 288, 916, 574, 14, 2325, 342, 315, 661, 2052, 297, 283 ]
[ 961, 570, 365, 1777, 402, 519, 12974, 12, 314, 8559, 570, 5256, 14, 199, 3, 844, 26, 1664, 14629, 1015, 650, 12, 1937, 314, 570, 298, 5580, 4149, 2, 367, 2436, 14, 199, 199, 3, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1278, 12, 3215, 13, 4037, 13, 22431, 13, 826, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 199, 646, 6010, 199, 646, 747, 199, 504, 747, 492, 2142, 12, 15296, 12, 27483, 12, 5672, 199, 504, 747, 14, 515, 492, 4263, 12, 26004, 12, 3363, 515, 12, 3495, 199, 646, 295, 199, 646, 16701, 199, 646, 5145, 199, 646, 1059, 199, 646, 5549, 199, 504, 6485, 492, 15158, 460, 679, 199, 504, 5672, 492, 428, 63, 41, 10276, 199, 504, 8337, 492, 7793, 17, 199, 504, 984, 492, 1015, 63, 815, 199, 504, 2050, 492, 28138, 199, 199, 646, 519, 12974, 199, 504, 519, 12974, 14, 832, 14, 6874, 492, 25596, 414, 199, 504, 519, 12974, 14, 832, 14, 6188, 63, 13380, 492, 3847, 63, 13380, 199, 504, 519, 12974, 14, 832, 14, 498, 9140, 63, 2087, 492, 790, 63, 475, 63, 875, 12, 6982, 63, 498, 9140, 199, 504, 519, 12974, 14, 832, 14, 5641, 63, 3765, 492, 5218, 63, 3513, 199, 504, 519, 12974, 14, 832, 14, 2184, 63, 4561, 63, 1501, 492, 2163, 63, 4561, 63, 1501, 199, 504, 519, 12974, 14, 832, 14, 20546, 274, 492, 12345, 1119, 63, 2469, 12, 4319, 43, 63, 10761, 199, 504, 519, 12974, 14, 1018, 14, 5555, 492, 3814, 2988, 24290, 12, 13303, 24290, 199, 504, 519, 12974, 14, 1018, 14, 2902, 492, 23159, 199, 504, 519, 12974, 14, 3600, 14, 3619, 492, 15191, 199, 504, 519, 12974, 14, 3600, 14, 493, 492, 3814, 199, 504, 519, 12974, 14, 1018, 14, 3422, 492, 5817, 5455, 12, 11247, 5455, 199, 504, 519, 12974, 14, 3600, 14, 1751, 492, 27805, 1149, 63, 13931, 12, 27805, 1149, 63, 15514, 421, 199, 9410, 1092, 63, 8784, 275, 3886, 60, 88, 614, 60, 88, 614, 9410, 1092, 63, 13533, 63, 2826, 63, 7041, 60, 88, 614, 60, 614, 4335, 199, 199, 4947, 275, 28138, 3460, 354, 3368, 421, 199, 533, 485, 24673, 4231, 8, 875, 14, 4231, 304, 272, 408, 33, 1978, 367, 10004, 4655, 16954, 315, 3718, 624, 272, 11172, 275, 519, 12974, 14, 9410, 1092, 63, 32717, 540, 272, 1305, 3401, 275, 519, 2, 13040, 65, 13, 90, 16, 13, 25, 3672, 2, 421, 199, 533, 24367, 8, 221, 327, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 842, 13, 2987, 12, 7354, 13, 3479, 13, 3455, 13, 2474, 267, 3814, 2988, 24290, 12, 13303, 24290, 304, 339, 327, 10652, 9460, 272, 327, 1553, 10082, 5817, 83, 272, 327, 10652, 9460, 339, 768, 4639, 272, 347, 4458, 837, 267, 408, 26, 2224, 398, 18704, 314, 2240, 14, 267, 408, 267, 746, 14838, 339, 347, 5305, 8, 277, 304, 267, 408, 26, 3958, 398, 15510, 314, 570, 2609, 12, 5436, 316, 314, 2082, 3335, 12, 13101, 8012, 21599, 1101, 267, 408, 267, 2269, 63, 515, 275, 291, 14, 3749, 694, 14, 515, 267, 291, 14, 657, 4196, 275, 1052, 267, 291, 14, 28737, 63, 7112, 2801, 17, 9, 267, 291, 14, 4200, 63, 694, 8, 1753, 63, 515, 9, 267, 291, 14, 1461, 63, 632, 360, 3302, 358, 267, 340, 291, 14, 2343, 26, 288, 291, 14, 2343, 14, 3958, 342, 267, 291, 14, 20546, 274, 14, 9233, 63, 888, 342, 267, 291, 14, 10886, 14, 2969, 14, 5186, 342, 339, 347, 1570, 63, 632, 8, 277, 12, 818, 29, 403, 304, 267, 408, 26, 1461, 63, 632, 665, 632, 30, 398, 7743, 818, 370, 298, 16948, 2, 334, 5592, 9, 503, 298, 3302, 2, 818, 14, 267, 408, 267, 340, 818, 365, 488, 26, 288, 291, 14, 10886, 14, 6814, 360, 16626, 26, 1570, 63, 632, 665, 632, 4206, 4875, 29, 549, 9, 288, 372, 267, 340, 818, 508, 291, 14, 632, 26, 221, 327, 4287, 26, 3507, 29, 2732, 13, 1114, 13, 5182, 13, 7463, 288, 372, 267, 340, 818, 508, 283, 16948, 356, 288, 291, 423, 16948, 63, 1712, 63, 928, 275, 291, 14, 3749, 694, 14, 3929, 288, 291, 423, 16948, 63, 1185, 63, 23356, 275, 378, 288, 291, 423, 6352, 63, 5592, 275, 663, 8, 277, 14, 3749, 694, 14, 17938, 63, 1744, 9, 288, 291, 14, 1657, 63, 1725, 8, 637, 29, 1397, 291, 423, 16948, 63, 4471, 12, 12155, 944, 29, 797, 9, 267, 916, 818, 508, 283, 3302, 356, 288, 340, 291, 14, 632, 508, 283, 16948, 356, 221, 327, 4287, 26, 3507, 29, 2732, 13, 1114, 13, 5182, 13, 7463, 355, 291, 423, 16948, 63, 1712, 63, 928, 275, 488, 355, 291, 423, 16948, 63, 1185, 63, 23356, 275, 488, 355, 291, 423, 6352, 63, 5592, 275, 488, 267, 587, 26, 288, 372, 267, 291, 14, 632, 275, 818, 267, 291, 14, 1907, 14, 1205, 14, 1069, 63, 581, 1773, 342, 339, 347, 663, 63, 1422, 63, 504, 63, 875, 8, 277, 12, 945, 63, 354, 12, 574, 12, 2257, 515, 29, 403, 12, 3762, 29, 403, 304, 267, 340, 945, 63, 354, 440, 315, 27805, 1149, 63, 13931, 26, 288, 746, 1722, 480, 1918, 945, 4310, 18633, 83, 7, 1630, 440, 2187, 2, 450, 945, 63, 354, 9, 267, 340, 440, 1228, 8, 585, 12, 620, 304, 288, 746, 1722, 480, 1918, 574, 367, 376, 945, 4839, 370, 506, 282, 1059, 2685, 398, 291, 14, 1751, 14, 409, 8, 1422, 63, 354, 12, 291, 423, 1122, 63, 1422, 63, 585, 8, 1422, 63, 354, 12, 574, 395, 2079, 2257, 515, 12, 3762, 9, 339, 347, 485, 1122, 63, 1422, 63, 585, 8, 221, 327, 4287, 26, 3507, 29, 7354, 13, 3479, 13, 1107, 13, 15384, 288, 291, 12, 536, 12, 574, 304, 267, 2943, 275, 291, 14, 10886, 14, 1751, 14, 1313, 63, 1618, 8, 354, 9, 267, 340, 2155, 315, 2943, 26, 288, 340, 574, 14, 2325, 342, 315, 661, 3910, 297, 283, 1997, 297, 283, 16, 735, 355, 372, 756, 288, 916, 574, 14, 2325, 342, 315, 661, 2052, 297, 283, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
gangadhar-kadam/mtn-erpnext
setup/doctype/naming_series/naming_series.py
6
5012
# ERPNext - web based ERP (http://erpnext.com) # Copyright (C) 2012 Web Notes Technologies Pvt Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import unicode_literals import webnotes from webnotes.utils import cstr from webnotes import msgprint import webnotes.model.doctype sql = webnotes.conn.sql class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl def get_transactions(self, arg=None): return { "transactions": "\n".join([''] + sorted(list(set( webnotes.conn.sql_list("""select parent from `tabDocField` where fieldname='naming_series'""") + webnotes.conn.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'""") )))), "prefixes": "\n".join([''] + [i[0] for i in sql("""select name from tabSeries""")]) } def scrub_options_list(self, ol): options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol]) return options def update_series(self, arg=None): """update series list""" self.check_duplicate() series_list = self.doc.set_options.split("\n") # set in doctype self.set_series_for(self.doc.select_doc_for_series, series_list) # create series map(self.insert_series, series_list) msgprint('Series Updated') return self.get_transactions() def set_series_for(self, doctype, ol): options = self.scrub_options_list(ol) # validate names for i in options: self.validate_series_name(i) if self.doc.user_must_always_select: options = [''] + options default = '' else: default = options[0] # update in property setter from webnotes.model.doc import Document prop_dict = {'options': "\n".join(options), 'default': default} for prop in prop_dict: ps_exists = webnotes.conn.sql("""SELECT name FROM `tabProperty Setter` WHERE doc_type = %s AND field_name = 'naming_series' AND property = %s""", (doctype, prop)) if ps_exists: ps = Document('Property Setter', ps_exists[0][0]) ps.value = prop_dict[prop] ps.save() else: ps = Document('Property Setter', fielddata = { 'doctype_or_field': 'DocField', 'doc_type': doctype, 'field_name': 'naming_series', 'property': prop, 'value': prop_dict[prop], 'property_type': 'Select', }) ps.save(1) self.doc.set_options = "\n".join(options) webnotes.clear_cache(doctype=doctype) def check_duplicate(self): from core.doctype.doctype.doctype import DocType dt = DocType() parent = list(set( webnotes.conn.sql_list("""select dt.name from `tabDocField` df, `tabDocType` dt where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""", self.doc.select_doc_for_series) + webnotes.conn.sql_list("""select dt.name from `tabCustom Field` df, `tabDocType` dt where dt.name = df.dt and df.fieldname='naming_series' and dt.name != %s""", self.doc.select_doc_for_series) )) sr = [[webnotes.model.doctype.get_property(p, 'options', 'naming_series'), p] for p in parent] options = self.scrub_options_list(self.doc.set_options.split("\n")) for series in options: dt.validate_series(series, self.doc.select_doc_for_series) for i in sr: if i[0]: if series in i[0].split("\n"): msgprint("Oops! Series name %s is already in use in %s. \ Please select a new one" % (series, i[1]), raise_exception=1) def validate_series_name(self, n): import re if not re.match("^[a-zA-Z0-9-/.#]*$", n): msgprint('Special Characters except "-" and "/" not allowed in naming series', raise_exception=True) def get_options(self, arg=''): sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, 'options', 'naming_series') return sr def get_current(self, arg=None): """get series current""" self.doc.current_value = webnotes.conn.sql("""select current from tabSeries where name=%s""", self.doc.prefix)[0][0] def insert_series(self, series): """insert series if missing""" if not webnotes.conn.exists('Series', series): sql("insert into tabSeries (name, current) values (%s,0)", (series)) def update_series_start(self): if self.doc.prefix: self.insert_series(self.doc.prefix) sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.current_value,self.doc.prefix)) msgprint("Series Updated Successfully") else: msgprint("Please select prefix first")
agpl-3.0
[ 3, 221, 6758, 5765, 446, 3330, 4079, 221, 6758, 334, 1014, 921, 281, 23416, 14, 957, 9, 199, 3, 1898, 334, 35, 9, 6029, 6001, 8144, 19215, 29053, 12126, 199, 3, 221, 199, 3, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 221, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 221, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 646, 23154, 199, 199, 504, 23154, 14, 1208, 492, 286, 495, 199, 504, 23154, 492, 1499, 1361, 199, 646, 23154, 14, 1238, 14, 6356, 199, 199, 3009, 275, 23154, 14, 1631, 14, 3009, 199, 199, 533, 5454, 804, 26, 199, 198, 318, 636, 826, 721, 277, 12, 366, 12, 15396, 304, 507, 198, 277, 14, 1301, 12, 291, 14, 1301, 513, 275, 366, 12, 15396, 421, 198, 318, 664, 63, 13754, 8, 277, 12, 1680, 29, 403, 304, 507, 198, 1107, 469, 686, 198, 2, 13754, 582, 1867, 78, 1674, 904, 2941, 418, 435, 3355, 8, 513, 8, 409, 8, 1585, 198, 30307, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 1676, 1871, 198, 504, 658, 2902, 3768, 792, 64, 2382, 18887, 534, 26919, 63, 5602, 7, 6141, 28932, 198, 11, 23154, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 4487, 687, 658, 2902, 7223, 5024, 64, 221, 1871, 198, 4509, 18887, 534, 26919, 63, 5602, 7, 6141, 1585, 198, 1724, 395, 686, 198, 2, 14124, 582, 1867, 78, 1674, 904, 2941, 418, 435, 359, 73, 59, 16, 61, 367, 284, 315, 28932, 198, 3009, 4852, 2416, 536, 687, 5174, 9641, 6141, 566, 507, 198, 93, 8299, 198, 318, 19270, 456, 63, 1419, 63, 513, 8, 277, 12, 9113, 304, 507, 198, 1419, 275, 2457, 8, 2734, 671, 26, 671, 12, 359, 67, 495, 8, 78, 14, 4142, 8801, 1913, 342, 367, 302, 315, 9113, 566, 507, 198, 1107, 1511, 421, 198, 318, 1678, 63, 5602, 8, 277, 12, 1680, 29, 403, 304, 507, 198, 624, 873, 6779, 769, 624, 507, 198, 277, 14, 1074, 63, 11081, 342, 507, 198, 5602, 63, 513, 275, 291, 14, 1301, 14, 409, 63, 1419, 14, 1294, 4582, 78, 531, 9068, 198, 3, 663, 315, 13265, 507, 198, 277, 14, 409, 63, 5602, 63, 509, 8, 277, 14, 1301, 14, 2416, 63, 1301, 63, 509, 63, 5602, 12, 6779, 63, 513, 9, 9068, 198, 3, 1218, 6779, 507, 198, 1130, 8, 277, 14, 3176, 63, 5602, 12, 6779, 63, 513, 9, 9068, 198, 1328, 1361, 360, 9641, 6162, 68, 358, 9068, 198, 1107, 291, 14, 362, 63, 13754, 342, 8299, 198, 318, 663, 63, 5602, 63, 509, 8, 277, 12, 13265, 12, 9113, 304, 507, 198, 1419, 275, 291, 14, 11047, 456, 63, 1419, 63, 513, 8, 393, 9, 9068, 198, 3, 4107, 1561, 507, 198, 509, 284, 315, 1511, 26, 291, 14, 3502, 63, 5602, 63, 354, 8, 73, 9, 9068, 198, 692, 291, 14, 1301, 14, 751, 63, 7790, 63, 9223, 63, 2416, 26, 686, 198, 1419, 275, 24506, 435, 1511, 686, 198, 885, 275, 2125, 507, 198, 2836, 26, 686, 198, 885, 275, 1511, 59, 16, 61, 9068, 198, 3, 1678, 315, 3324, 18743, 507, 198, 504, 23154, 14, 1238, 14, 1301, 492, 7543, 507, 198, 4469, 63, 807, 275, 791, 1419, 356, 1867, 78, 1674, 904, 8, 1419, 395, 283, 885, 356, 849, 93, 507, 198, 509, 5931, 315, 5931, 63, 807, 26, 686, 198, 1190, 63, 2444, 275, 23154, 14, 1631, 14, 3009, 4852, 4859, 536, 4442, 658, 2902, 3697, 2494, 351, 64, 1871, 198, 17688, 1382, 63, 466, 275, 450, 83, 2401, 901, 63, 354, 275, 283, 26919, 63, 5602, 7, 1871, 198, 3649, 3324, 275, 450, 83, 7208, 334, 6356, 12, 5931, 430, 686, 198, 692, 7347, 63, 2444, 26, 1585, 198, 1190, 275, 7543, 360, 3697, 2494, 351, 297, 7347, 63, 2444, 59, 16, 1527, 16, 566, 1585, 198, 1190, 14, 585, 275, 5931, 63, 807, 59, 4469, 61, 1585, 198, 1190, 14, 2117, 342, 686, 198, 2836, 26, 1585, 198, 1190, 275, 7543, 360, 3697, 2494, 351, 297, 901, 576, 275, 469, 1871, 198, 5121, 79, 3667, 63, 269, 63, 698, 356, 283, 3768, 792, 297, 1871, 198, 5121, 679, 63, 466, 356, 13265, 12, 1871, 198, 7, 698, 63, 354, 356, 283, 26919, 63, 5602, 297, 1871, 198, 7, 1829, 356, 5931, 12, 1871, 198, 7, 585, 356, 5931, 63, 807, 59, 4469, 467, 1871, 198, 7, 1829, 63, 466, 356, 283, 5446, 297, 1585, 198, 1552, 1585, 198, 1190, 14, 2117, 8, 17, 9, 2742, 198, 277, 14, 1301, 14, 409, 63, 1419, 275, 1867, 78, 1674, 904, 8, 1419, 9, 2742, 198, 30307, 14, 3584, 63, 1637, 8, 6356, 29, 6356, 9, 1585, 199, 198, 318, 1104, 63, 11081, 8, 277, 304, 507, 198, 504, 6170, 14, 6356, 14, 6356, 14, 6356, 492, 5454, 804, 507, 198, 3583, 275, 5454, 804, 342, 28550, 198, 1708, 275, 769, 8, 409, 8, 686, 198, 30307, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 4487, 14, 354, 28932, 198, 504, 658, 2902, 3768, 792, 64, 4051, 12, 658, 2902, 3768, 804, 64, 4487, 28932, 198, 4509, 4487, 14, 354, 275, 4051, 14, 1708, 436, 4051, 14, 13646, 534, 26919, 63, 5602, 7, 436, 4487, 14, 354, 1137, 450, 83, 7208, 1585, 198, 277, 14, 1301, 14, 2416, 63, 1301, 63, 509, 63, 5602, 9, 686, 198, 11, 23154, 14, 1631, 14, 3009, 63, 513, 4852 ]
[ 221, 6758, 5765, 446, 3330, 4079, 221, 6758, 334, 1014, 921, 281, 23416, 14, 957, 9, 199, 3, 1898, 334, 35, 9, 6029, 6001, 8144, 19215, 29053, 12126, 199, 3, 221, 199, 3, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 221, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 221, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 646, 23154, 199, 199, 504, 23154, 14, 1208, 492, 286, 495, 199, 504, 23154, 492, 1499, 1361, 199, 646, 23154, 14, 1238, 14, 6356, 199, 199, 3009, 275, 23154, 14, 1631, 14, 3009, 199, 199, 533, 5454, 804, 26, 199, 198, 318, 636, 826, 721, 277, 12, 366, 12, 15396, 304, 507, 198, 277, 14, 1301, 12, 291, 14, 1301, 513, 275, 366, 12, 15396, 421, 198, 318, 664, 63, 13754, 8, 277, 12, 1680, 29, 403, 304, 507, 198, 1107, 469, 686, 198, 2, 13754, 582, 1867, 78, 1674, 904, 2941, 418, 435, 3355, 8, 513, 8, 409, 8, 1585, 198, 30307, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 1676, 1871, 198, 504, 658, 2902, 3768, 792, 64, 2382, 18887, 534, 26919, 63, 5602, 7, 6141, 28932, 198, 11, 23154, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 4487, 687, 658, 2902, 7223, 5024, 64, 221, 1871, 198, 4509, 18887, 534, 26919, 63, 5602, 7, 6141, 1585, 198, 1724, 395, 686, 198, 2, 14124, 582, 1867, 78, 1674, 904, 2941, 418, 435, 359, 73, 59, 16, 61, 367, 284, 315, 28932, 198, 3009, 4852, 2416, 536, 687, 5174, 9641, 6141, 566, 507, 198, 93, 8299, 198, 318, 19270, 456, 63, 1419, 63, 513, 8, 277, 12, 9113, 304, 507, 198, 1419, 275, 2457, 8, 2734, 671, 26, 671, 12, 359, 67, 495, 8, 78, 14, 4142, 8801, 1913, 342, 367, 302, 315, 9113, 566, 507, 198, 1107, 1511, 421, 198, 318, 1678, 63, 5602, 8, 277, 12, 1680, 29, 403, 304, 507, 198, 624, 873, 6779, 769, 624, 507, 198, 277, 14, 1074, 63, 11081, 342, 507, 198, 5602, 63, 513, 275, 291, 14, 1301, 14, 409, 63, 1419, 14, 1294, 4582, 78, 531, 9068, 198, 3, 663, 315, 13265, 507, 198, 277, 14, 409, 63, 5602, 63, 509, 8, 277, 14, 1301, 14, 2416, 63, 1301, 63, 509, 63, 5602, 12, 6779, 63, 513, 9, 9068, 198, 3, 1218, 6779, 507, 198, 1130, 8, 277, 14, 3176, 63, 5602, 12, 6779, 63, 513, 9, 9068, 198, 1328, 1361, 360, 9641, 6162, 68, 358, 9068, 198, 1107, 291, 14, 362, 63, 13754, 342, 8299, 198, 318, 663, 63, 5602, 63, 509, 8, 277, 12, 13265, 12, 9113, 304, 507, 198, 1419, 275, 291, 14, 11047, 456, 63, 1419, 63, 513, 8, 393, 9, 9068, 198, 3, 4107, 1561, 507, 198, 509, 284, 315, 1511, 26, 291, 14, 3502, 63, 5602, 63, 354, 8, 73, 9, 9068, 198, 692, 291, 14, 1301, 14, 751, 63, 7790, 63, 9223, 63, 2416, 26, 686, 198, 1419, 275, 24506, 435, 1511, 686, 198, 885, 275, 2125, 507, 198, 2836, 26, 686, 198, 885, 275, 1511, 59, 16, 61, 9068, 198, 3, 1678, 315, 3324, 18743, 507, 198, 504, 23154, 14, 1238, 14, 1301, 492, 7543, 507, 198, 4469, 63, 807, 275, 791, 1419, 356, 1867, 78, 1674, 904, 8, 1419, 395, 283, 885, 356, 849, 93, 507, 198, 509, 5931, 315, 5931, 63, 807, 26, 686, 198, 1190, 63, 2444, 275, 23154, 14, 1631, 14, 3009, 4852, 4859, 536, 4442, 658, 2902, 3697, 2494, 351, 64, 1871, 198, 17688, 1382, 63, 466, 275, 450, 83, 2401, 901, 63, 354, 275, 283, 26919, 63, 5602, 7, 1871, 198, 3649, 3324, 275, 450, 83, 7208, 334, 6356, 12, 5931, 430, 686, 198, 692, 7347, 63, 2444, 26, 1585, 198, 1190, 275, 7543, 360, 3697, 2494, 351, 297, 7347, 63, 2444, 59, 16, 1527, 16, 566, 1585, 198, 1190, 14, 585, 275, 5931, 63, 807, 59, 4469, 61, 1585, 198, 1190, 14, 2117, 342, 686, 198, 2836, 26, 1585, 198, 1190, 275, 7543, 360, 3697, 2494, 351, 297, 901, 576, 275, 469, 1871, 198, 5121, 79, 3667, 63, 269, 63, 698, 356, 283, 3768, 792, 297, 1871, 198, 5121, 679, 63, 466, 356, 13265, 12, 1871, 198, 7, 698, 63, 354, 356, 283, 26919, 63, 5602, 297, 1871, 198, 7, 1829, 356, 5931, 12, 1871, 198, 7, 585, 356, 5931, 63, 807, 59, 4469, 467, 1871, 198, 7, 1829, 63, 466, 356, 283, 5446, 297, 1585, 198, 1552, 1585, 198, 1190, 14, 2117, 8, 17, 9, 2742, 198, 277, 14, 1301, 14, 409, 63, 1419, 275, 1867, 78, 1674, 904, 8, 1419, 9, 2742, 198, 30307, 14, 3584, 63, 1637, 8, 6356, 29, 6356, 9, 1585, 199, 198, 318, 1104, 63, 11081, 8, 277, 304, 507, 198, 504, 6170, 14, 6356, 14, 6356, 14, 6356, 492, 5454, 804, 507, 198, 3583, 275, 5454, 804, 342, 28550, 198, 1708, 275, 769, 8, 409, 8, 686, 198, 30307, 14, 1631, 14, 3009, 63, 513, 4852, 2416, 4487, 14, 354, 28932, 198, 504, 658, 2902, 3768, 792, 64, 4051, 12, 658, 2902, 3768, 804, 64, 4487, 28932, 198, 4509, 4487, 14, 354, 275, 4051, 14, 1708, 436, 4051, 14, 13646, 534, 26919, 63, 5602, 7, 436, 4487, 14, 354, 1137, 450, 83, 7208, 1585, 198, 277, 14, 1301, 14, 2416, 63, 1301, 63, 509, 63, 5602, 9, 686, 198, 11, 23154, 14, 1631, 14, 3009, 63, 513, 4852, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
unnikrishnankgs/va
venv/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/dataframe/transforms/sparsify.py
76
2727
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Transforms Dense to Sparse Tensor.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.learn.python.learn.dataframe import transform from tensorflow.python.framework import dtypes from tensorflow.python.framework import sparse_tensor from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops class Sparsify(transform.TensorFlowTransform): """Transforms Dense to Sparse Tensor.""" def __init__(self, strip_value): super(Sparsify, self).__init__() self._strip_value = strip_value @transform.parameter def strip_value(self): return self._strip_value @property def name(self): return "Sparsify" @property def input_valency(self): return 1 @property def _output_names(self): return "output", def _apply_transform(self, input_tensors, **kwargs): """Applies the transformation to the `transform_input`. Args: input_tensors: a list of Tensors representing the input to the Transform. **kwargs: Additional keyword arguments, unused here. Returns: A namedtuple of Tensors representing the transformed output. """ d = input_tensors[0] if self.strip_value is np.nan: strip_hot = math_ops.is_nan(d) else: strip_hot = math_ops.equal(d, array_ops.constant([self.strip_value], dtype=d.dtype)) keep_hot = math_ops.logical_not(strip_hot) length = array_ops.reshape(array_ops.shape(d), []) indices = array_ops.boolean_mask(math_ops.range(length), keep_hot) values = array_ops.boolean_mask(d, keep_hot) sparse_indices = array_ops.reshape( math_ops.cast(indices, dtypes.int64), [-1, 1]) shape = math_ops.cast(array_ops.shape(d), dtypes.int64) # pylint: disable=not-callable return self.return_type( sparse_tensor.SparseTensor(sparse_indices, values, shape))
bsd-2-clause
[ 3, 1898, 7800, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 199, 624, 3188, 3351, 20847, 370, 14531, 5878, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 2828, 14, 4643, 14, 1548, 14, 4643, 14, 23878, 492, 5793, 199, 199, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 5178, 63, 3128, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 421, 199, 533, 428, 462, 338, 1399, 8, 4711, 14, 26998, 6939, 304, 523, 408, 3188, 3351, 20847, 370, 14531, 5878, 1041, 819, 347, 636, 826, 721, 277, 12, 6202, 63, 585, 304, 272, 1613, 8, 51, 462, 338, 1399, 12, 291, 2843, 826, 4533, 272, 291, 423, 1913, 63, 585, 275, 6202, 63, 585, 819, 768, 4711, 14, 5329, 523, 347, 6202, 63, 585, 8, 277, 304, 272, 372, 291, 423, 1913, 63, 585, 819, 768, 1829, 523, 347, 536, 8, 277, 304, 272, 372, 298, 51, 462, 338, 1399, 2, 819, 768, 1829, 523, 347, 1324, 63, 3042, 552, 1480, 8, 277, 304, 272, 372, 413, 819, 768, 1829, 523, 347, 485, 1199, 63, 1247, 8, 277, 304, 272, 372, 298, 1199, 401, 819, 347, 485, 4998, 63, 4711, 8, 277, 12, 1324, 63, 10206, 12, 1011, 958, 304, 272, 408, 2640, 6528, 314, 13315, 370, 314, 658, 4711, 63, 1210, 2313, 339, 3033, 26, 489, 1324, 63, 10206, 26, 282, 769, 402, 28373, 6144, 314, 1324, 370, 267, 314, 19463, 14, 489, 1011, 958, 26, 10961, 4252, 2368, 12, 9563, 2348, 14, 339, 1803, 26, 267, 437, 12863, 402, 28373, 6144, 314, 14834, 1072, 14, 272, 408, 272, 366, 275, 1324, 63, 10206, 59, 16, 61, 339, 340, 291, 14, 1913, 63, 585, 365, 980, 14, 4304, 26, 489, 6202, 63, 8885, 275, 3473, 63, 1483, 14, 374, 63, 4304, 8, 68, 9, 272, 587, 26, 489, 6202, 63, 8885, 275, 3473, 63, 1483, 14, 1452, 8, 68, 12, 639, 1625, 63, 1483, 14, 4083, 779, 277, 14, 1913, 63, 585, 467, 8105, 2152, 29, 68, 14, 2271, 430, 272, 4215, 63, 8885, 275, 3473, 63, 1483, 14, 7954, 63, 1397, 8, 1913, 63, 8885, 9, 339, 2582, 275, 1625, 63, 1483, 14, 5217, 8, 1144, 63, 1483, 14, 1392, 8, 68, 395, 3073, 272, 4918, 275, 1625, 63, 1483, 14, 4871, 63, 2629, 8, 3442, 63, 1483, 14, 1842, 8, 1267, 395, 4215, 63, 8885, 9, 272, 1338, 275, 1625, 63, 1483, 14, 4871, 63, 2629, 8, 68, 12, 4215, 63, 8885, 9, 339, 5178, 63, 4108, 275, 1625, 63, 1483, 14, 5217, 8, 267, 3473, 63, 1483, 14, 2931, 8, 4108, 12, 6674, 14, 442, 772, 395, 5243, 17, 12, 413, 566, 272, 2215, 275, 3473, 63, 1483, 14, 2931, 8, 1144, 63, 1483, 14, 1392, 8, 68, 395, 6674, 14, 442, 772, 9, 339, 327, 4287, 26, 3507, 29, 1397, 13, 8296, 272, 372, 291, 14, 1107, 63, 466, 8, 267, 5178, 63, 3128, 14, 12079, 8, 4421, 63, 4108, 12, 1338, 12, 2215, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 7800, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 199, 624, 3188, 3351, 20847, 370, 14531, 5878, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 2828, 14, 4643, 14, 1548, 14, 4643, 14, 23878, 492, 5793, 199, 199, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 5178, 63, 3128, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 421, 199, 533, 428, 462, 338, 1399, 8, 4711, 14, 26998, 6939, 304, 523, 408, 3188, 3351, 20847, 370, 14531, 5878, 1041, 819, 347, 636, 826, 721, 277, 12, 6202, 63, 585, 304, 272, 1613, 8, 51, 462, 338, 1399, 12, 291, 2843, 826, 4533, 272, 291, 423, 1913, 63, 585, 275, 6202, 63, 585, 819, 768, 4711, 14, 5329, 523, 347, 6202, 63, 585, 8, 277, 304, 272, 372, 291, 423, 1913, 63, 585, 819, 768, 1829, 523, 347, 536, 8, 277, 304, 272, 372, 298, 51, 462, 338, 1399, 2, 819, 768, 1829, 523, 347, 1324, 63, 3042, 552, 1480, 8, 277, 304, 272, 372, 413, 819, 768, 1829, 523, 347, 485, 1199, 63, 1247, 8, 277, 304, 272, 372, 298, 1199, 401, 819, 347, 485, 4998, 63, 4711, 8, 277, 12, 1324, 63, 10206, 12, 1011, 958, 304, 272, 408, 2640, 6528, 314, 13315, 370, 314, 658, 4711, 63, 1210, 2313, 339, 3033, 26, 489, 1324, 63, 10206, 26, 282, 769, 402, 28373, 6144, 314, 1324, 370, 267, 314, 19463, 14, 489, 1011, 958, 26, 10961, 4252, 2368, 12, 9563, 2348, 14, 339, 1803, 26, 267, 437, 12863, 402, 28373, 6144, 314, 14834, 1072, 14, 272, 408, 272, 366, 275, 1324, 63, 10206, 59, 16, 61, 339, 340, 291, 14, 1913, 63, 585, 365, 980, 14, 4304, 26, 489, 6202, 63, 8885, 275, 3473, 63, 1483, 14, 374, 63, 4304, 8, 68, 9, 272, 587, 26, 489, 6202, 63, 8885, 275, 3473, 63, 1483, 14, 1452, 8, 68, 12, 639, 1625, 63, 1483, 14, 4083, 779, 277, 14, 1913, 63, 585, 467, 8105, 2152, 29, 68, 14, 2271, 430, 272, 4215, 63, 8885, 275, 3473, 63, 1483, 14, 7954, 63, 1397, 8, 1913, 63, 8885, 9, 339, 2582, 275, 1625, 63, 1483, 14, 5217, 8, 1144, 63, 1483, 14, 1392, 8, 68, 395, 3073, 272, 4918, 275, 1625, 63, 1483, 14, 4871, 63, 2629, 8, 3442, 63, 1483, 14, 1842, 8, 1267, 395, 4215, 63, 8885, 9, 272, 1338, 275, 1625, 63, 1483, 14, 4871, 63, 2629, 8, 68, 12, 4215, 63, 8885, 9, 339, 5178, 63, 4108, 275, 1625, 63, 1483, 14, 5217, 8, 267, 3473, 63, 1483, 14, 2931, 8, 4108, 12, 6674, 14, 442, 772, 395, 5243, 17, 12, 413, 566, 272, 2215, 275, 3473, 63, 1483, 14, 2931, 8, 1144, 63, 1483, 14, 1392, 8, 68, 395, 6674, 14, 442, 772, 9, 339, 327, 4287, 26, 3507, 29, 1397, 13, 8296, 272, 372, 291, 14, 1107, 63, 466, 8, 267, 5178, 63, 3128, 14, 12079, 8, 4421, 63, 4108, 12, 1338, 12, 2215, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1,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sqlalchemy/alembic/versions/3a938526b35d_add_docker_volume_size.py
17
1037
# Copyright 2015 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Add docker volume size column Revision ID: 3a938526b35d Revises: 5793cd26898d Create Date: 2015-02-23 14:32:00.086650 """ # revision identifiers, used by Alembic. revision = '3a938526b35d' down_revision = '5793cd26898d' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('baymodel', sa.Column('docker_volume_size', sa.Integer(), nullable=True))
apache-2.0
[ 3, 1898, 6900, 14260, 2752, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 624, 1123, 12424, 3301, 1568, 2763, 199, 199, 12714, 2870, 26, 650, 65, 25, 13846, 1479, 66, 1276, 68, 199, 497, 433, 874, 26, 959, 26153, 2866, 1479, 13176, 68, 199, 2499, 6148, 26, 6900, 13, 996, 13, 1789, 4329, 26, 708, 26, 383, 14, 16, 13465, 1400, 199, 199, 624, 199, 199, 3, 6974, 14154, 12, 1202, 701, 6832, 20596, 14, 199, 5792, 275, 283, 19, 65, 25, 13846, 1479, 66, 1276, 68, 7, 199, 2110, 63, 5792, 275, 283, 1641, 3129, 2866, 1479, 13176, 68, 7, 199, 199, 504, 30960, 20596, 492, 1687, 199, 646, 8335, 465, 2937, 421, 199, 318, 10754, 837, 272, 1687, 14, 525, 63, 2301, 360, 19558, 1238, 297, 2937, 14, 4547, 360, 9991, 63, 2405, 63, 890, 297, 2937, 14, 2674, 1062, 2116, 7854, 29, 549, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 6900, 14260, 2752, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 624, 1123, 12424, 3301, 1568, 2763, 199, 199, 12714, 2870, 26, 650, 65, 25, 13846, 1479, 66, 1276, 68, 199, 497, 433, 874, 26, 959, 26153, 2866, 1479, 13176, 68, 199, 2499, 6148, 26, 6900, 13, 996, 13, 1789, 4329, 26, 708, 26, 383, 14, 16, 13465, 1400, 199, 199, 624, 199, 199, 3, 6974, 14154, 12, 1202, 701, 6832, 20596, 14, 199, 5792, 275, 283, 19, 65, 25, 13846, 1479, 66, 1276, 68, 7, 199, 2110, 63, 5792, 275, 283, 1641, 3129, 2866, 1479, 13176, 68, 7, 199, 199, 504, 30960, 20596, 492, 1687, 199, 646, 8335, 465, 2937, 421, 199, 318, 10754, 837, 272, 1687, 14, 525, 63, 2301, 360, 19558, 1238, 297, 2937, 14, 4547, 360, 9991, 63, 2405, 63, 890, 297, 2937, 14, 2674, 1062, 2116, 7854, 29, 549, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ndevenish/simplehistogram
simplehist/binning.py
1
2817
# coding: utf-8 """ bins.py Copyright (c) 2011 Nicholas Devenish <n.e.devenish@sussex.ac.uk> Contains the logic for creating and inspecting sequences of bins """ __license__ = """Copyright (c) 2011 Nicholas Devenish <n.e.devenish@sussex.ac.uk> MIT License <http://www.opensource.org/licenses/mit-license.php> """ import numpy class BinError(Exception): pass # class Bin(object): # """Represents a single bin""" # def __init__(self, lowedge, highedge): # self.lowedge = lowedge # self.highedge = highedge # self.width = highedge - lowedge # self.center = lowedge + width/2. class BinningScheme(object): """Holds all the information on a particular scheme of binning, for one axis""" def __init__(self, binarray): """Create a binning scheme from a source set of bins""" if len(binarray) == 1: raise BinError("Must provide more that one value for a single bin") # Calculate the number of bins if len(binarray) == 0: bincount = 0 else: bincount = len(binarray)-1 # Ensure the bins are numerically sequential if not tuple(binarray) == tuple(sorted(binarray)): raise BinError("Bins must be numerically ascending") self._bintuple = tuple(binarray) def __len__(self): if len(self._bintuple) is 0: return 0 return len(self._bintuple)-1 def __getitem__(self, key): return self._bintuple[key] @property def centers(self): """Returns the bin centers for every bin""" vals = [] for i, low in enumerate(self._bintuple[:-1]): high = self._bintuple[i+1] vals.append(low + (high-low)/2.) return tuple(vals) @property def lowedges(self): """Returns the bin lower edges""" return self._bintuple[:-1] @property def edges(self): """Returns the bin lower edges""" return self._bintuple def search_bins(value, bins, depth = 0): "Search an array of sequential bin edges for the correct bin" # depth += 1 # spacing = " " * depth # # print spacing + "Searching:", bins # if len(bins) == 2: # print spacing + "Found single bin" return 0 # Grab the center bin central = (len(bins)-1) // 2 # print spacing + "Central =", central, "(" + str(bins[central]) + ")" # Is this higher than our value if bins[central] > value: # Search below # print spacing + "Searching below" found = search_bins(value, bins[:central+1], depth) return found # Is the center bin lower than our value? if bins[central] <= value: # Search above # print spacing + "Searching Above" found = search_bins(value, bins[central:], depth) # print spacing + "Search at level %d of" % depth, bins[central:], "returned", found return central + found raise RuntimeError("Didn't match any bin!")
mit
[ 3, 2803, 26, 2774, 13, 24, 199, 199, 624, 199, 11329, 14, 647, 199, 199, 7384, 334, 67, 9, 7760, 653, 1158, 393, 305, 1487, 1856, 2453, 665, 78, 14, 69, 14, 271, 1856, 2453, 32, 25253, 20160, 14, 645, 14, 3210, 30, 199, 199, 6906, 314, 9661, 367, 6425, 436, 6485, 316, 8013, 402, 13341, 199, 624, 199, 199, 363, 1682, 363, 275, 408, 7384, 334, 67, 9, 7760, 653, 1158, 393, 305, 1487, 1856, 2453, 665, 78, 14, 69, 14, 271, 1856, 2453, 32, 25253, 20160, 14, 645, 14, 3210, 30, 199, 13965, 844, 665, 1014, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 30, 199, 624, 199, 199, 646, 2680, 199, 199, 533, 32613, 547, 8, 1726, 304, 523, 986, 199, 199, 3, 1021, 32613, 8, 785, 304, 199, 3, 257, 408, 18089, 282, 2849, 2517, 624, 199, 3, 257, 347, 636, 826, 721, 277, 12, 6465, 5173, 12, 4721, 5173, 304, 199, 3, 258, 291, 14, 674, 5173, 275, 6465, 5173, 199, 3, 258, 291, 14, 6260, 5173, 275, 4721, 5173, 199, 3, 258, 291, 14, 2063, 275, 4721, 5173, 446, 6465, 5173, 199, 3, 258, 291, 14, 4218, 275, 6465, 5173, 435, 3462, 15, 18, 14, 199, 199, 533, 32613, 1835, 19530, 8, 785, 304, 523, 408, 40, 8250, 1006, 314, 2556, 641, 282, 6770, 5687, 402, 2517, 1835, 12, 367, 1373, 3114, 624, 523, 347, 636, 826, 721, 277, 12, 2517, 1144, 304, 272, 408, 2499, 282, 2517, 1835, 5687, 687, 282, 1350, 663, 402, 13341, 624, 2286, 340, 822, 8, 1393, 1144, 9, 508, 413, 26, 489, 746, 32613, 547, 480, 13757, 5647, 1655, 626, 1373, 574, 367, 282, 2849, 2517, 531, 2126, 272, 327, 12707, 314, 1329, 402, 13341, 272, 340, 822, 8, 1393, 1144, 9, 508, 378, 26, 489, 2517, 835, 275, 378, 272, 587, 26, 489, 2517, 835, 275, 822, 8, 1393, 1144, 7216, 17, 2286, 327, 7523, 314, 13341, 787, 8950, 1183, 23381, 272, 340, 440, 2008, 8, 1393, 1144, 9, 508, 2008, 8, 5917, 8, 1393, 1144, 2298, 489, 746, 32613, 547, 480, 34, 3617, 1471, 506, 8950, 1183, 24525, 531, 2286, 291, 423, 66, 442, 1363, 275, 2008, 8, 1393, 1144, 9, 12244, 347, 636, 552, 721, 277, 304, 272, 340, 822, 8, 277, 423, 66, 442, 1363, 9, 365, 378, 26, 489, 372, 378, 272, 372, 822, 8, 277, 423, 66, 442, 1363, 7216, 17, 12244, 347, 636, 6095, 721, 277, 12, 790, 304, 272, 372, 291, 423, 66, 442, 1363, 59, 498, 61, 12244, 768, 1829, 523, 347, 19190, 8, 277, 304, 272, 408, 3407, 314, 2517, 19190, 367, 4036, 2517, 624, 272, 5322, 275, 942, 272, 367, 284, 12, 6465, 315, 3874, 8, 277, 423, 66, 442, 1363, 4439, 17, 4682, 489, 4721, 275, 291, 423, 66, 442, 1363, 59, 73, 11, 17, 61, 489, 5322, 14, 740, 8, 674, 435, 334, 6260, 13, 674, 2447, 18, 4959, 272, 372, 2008, 8, 3643, 9, 12244, 768, 1829, 523, 347, 6465, 6929, 8, 277, 304, 272, 408, 3407, 314, 2517, 5117, 8207, 624, 272, 372, 291, 423, 66, 442, 1363, 4439, 17, 61, 12244, 768, 1829, 523, 347, 8207, 8, 277, 304, 272, 408, 3407, 314, 2517, 5117, 8207, 624, 272, 372, 291, 423, 66, 442, 1363, 421, 199, 318, 2754, 63, 11329, 8, 585, 12, 13341, 12, 5818, 275, 378, 304, 523, 298, 5278, 376, 1625, 402, 23381, 2517, 8207, 367, 314, 3211, 2517, 2, 523, 327, 5818, 847, 413, 523, 327, 19621, 275, 298, 221, 298, 627, 5818, 523, 327, 16421, 327, 870, 19621, 435, 298, 5278, 316, 6783, 13341, 523, 327, 16421, 340, 822, 8, 11329, 9, 508, 499, 26, 272, 327, 870, 19621, 435, 298, 3601, 2849, 2517, 2, 272, 372, 378, 819, 327, 29225, 314, 8126, 2517, 523, 18796, 275, 334, 552, 8, 11329, 7216, 17, 9, 5001, 499, 523, 327, 870, 19621, 435, 298, 25290, 20815, 18796, 12, 26054, 435, 620, 8, 11329, 59, 16067, 566, 435, 19607, 819, 327, 6596, 642, 10948, 2419, 4154, 574, 523, 340, 13341, 59, 16067, 61, 690, 574, 26, 272, 327, 8730, 5084, 272, 327, 870, 19621, 435, 298, 5278, 316, 5084, 2, 272, 1911, 275, 221, 2754, 63, 11329, 8, 585, 12, 13341, 1491, 16067, 11, 17, 467, 5818, 9, 272, 372, 1911, 819, 327, 6596, 314, 8126, 2517, 5117, 2419, 4154, 574, 31, 523, 340, 13341, 59, 16067, 61, 2695, 574, 26, 272, 327, 8730, 3432, 272, 327, 870, 19621, 435, 298, 5278, 316, 437, 3395, 2, 272, 1911, 275, 221, 2754, 63, 11329, 8, 585, 12, 13341, 59, 16067, 8429, 5818, 9, 199, 3, 259, 870, 19621, 435, 298, 5278, 737, 2166, 450, 68, 402, 2, 450, 5818, 12, 13341, 59, 16067, 8429, 298, 19065, 401, 1911, 272, 372, 18796, 435, 1911, 819, 746, 6064, 480, 17366, 78, 1133, 1336, 1263, 2517, 9124, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2803, 26, 2774, 13, 24, 199, 199, 624, 199, 11329, 14, 647, 199, 199, 7384, 334, 67, 9, 7760, 653, 1158, 393, 305, 1487, 1856, 2453, 665, 78, 14, 69, 14, 271, 1856, 2453, 32, 25253, 20160, 14, 645, 14, 3210, 30, 199, 199, 6906, 314, 9661, 367, 6425, 436, 6485, 316, 8013, 402, 13341, 199, 624, 199, 199, 363, 1682, 363, 275, 408, 7384, 334, 67, 9, 7760, 653, 1158, 393, 305, 1487, 1856, 2453, 665, 78, 14, 69, 14, 271, 1856, 2453, 32, 25253, 20160, 14, 645, 14, 3210, 30, 199, 13965, 844, 665, 1014, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 30, 199, 624, 199, 199, 646, 2680, 199, 199, 533, 32613, 547, 8, 1726, 304, 523, 986, 199, 199, 3, 1021, 32613, 8, 785, 304, 199, 3, 257, 408, 18089, 282, 2849, 2517, 624, 199, 3, 257, 347, 636, 826, 721, 277, 12, 6465, 5173, 12, 4721, 5173, 304, 199, 3, 258, 291, 14, 674, 5173, 275, 6465, 5173, 199, 3, 258, 291, 14, 6260, 5173, 275, 4721, 5173, 199, 3, 258, 291, 14, 2063, 275, 4721, 5173, 446, 6465, 5173, 199, 3, 258, 291, 14, 4218, 275, 6465, 5173, 435, 3462, 15, 18, 14, 199, 199, 533, 32613, 1835, 19530, 8, 785, 304, 523, 408, 40, 8250, 1006, 314, 2556, 641, 282, 6770, 5687, 402, 2517, 1835, 12, 367, 1373, 3114, 624, 523, 347, 636, 826, 721, 277, 12, 2517, 1144, 304, 272, 408, 2499, 282, 2517, 1835, 5687, 687, 282, 1350, 663, 402, 13341, 624, 2286, 340, 822, 8, 1393, 1144, 9, 508, 413, 26, 489, 746, 32613, 547, 480, 13757, 5647, 1655, 626, 1373, 574, 367, 282, 2849, 2517, 531, 2126, 272, 327, 12707, 314, 1329, 402, 13341, 272, 340, 822, 8, 1393, 1144, 9, 508, 378, 26, 489, 2517, 835, 275, 378, 272, 587, 26, 489, 2517, 835, 275, 822, 8, 1393, 1144, 7216, 17, 2286, 327, 7523, 314, 13341, 787, 8950, 1183, 23381, 272, 340, 440, 2008, 8, 1393, 1144, 9, 508, 2008, 8, 5917, 8, 1393, 1144, 2298, 489, 746, 32613, 547, 480, 34, 3617, 1471, 506, 8950, 1183, 24525, 531, 2286, 291, 423, 66, 442, 1363, 275, 2008, 8, 1393, 1144, 9, 12244, 347, 636, 552, 721, 277, 304, 272, 340, 822, 8, 277, 423, 66, 442, 1363, 9, 365, 378, 26, 489, 372, 378, 272, 372, 822, 8, 277, 423, 66, 442, 1363, 7216, 17, 12244, 347, 636, 6095, 721, 277, 12, 790, 304, 272, 372, 291, 423, 66, 442, 1363, 59, 498, 61, 12244, 768, 1829, 523, 347, 19190, 8, 277, 304, 272, 408, 3407, 314, 2517, 19190, 367, 4036, 2517, 624, 272, 5322, 275, 942, 272, 367, 284, 12, 6465, 315, 3874, 8, 277, 423, 66, 442, 1363, 4439, 17, 4682, 489, 4721, 275, 291, 423, 66, 442, 1363, 59, 73, 11, 17, 61, 489, 5322, 14, 740, 8, 674, 435, 334, 6260, 13, 674, 2447, 18, 4959, 272, 372, 2008, 8, 3643, 9, 12244, 768, 1829, 523, 347, 6465, 6929, 8, 277, 304, 272, 408, 3407, 314, 2517, 5117, 8207, 624, 272, 372, 291, 423, 66, 442, 1363, 4439, 17, 61, 12244, 768, 1829, 523, 347, 8207, 8, 277, 304, 272, 408, 3407, 314, 2517, 5117, 8207, 624, 272, 372, 291, 423, 66, 442, 1363, 421, 199, 318, 2754, 63, 11329, 8, 585, 12, 13341, 12, 5818, 275, 378, 304, 523, 298, 5278, 376, 1625, 402, 23381, 2517, 8207, 367, 314, 3211, 2517, 2, 523, 327, 5818, 847, 413, 523, 327, 19621, 275, 298, 221, 298, 627, 5818, 523, 327, 16421, 327, 870, 19621, 435, 298, 5278, 316, 6783, 13341, 523, 327, 16421, 340, 822, 8, 11329, 9, 508, 499, 26, 272, 327, 870, 19621, 435, 298, 3601, 2849, 2517, 2, 272, 372, 378, 819, 327, 29225, 314, 8126, 2517, 523, 18796, 275, 334, 552, 8, 11329, 7216, 17, 9, 5001, 499, 523, 327, 870, 19621, 435, 298, 25290, 20815, 18796, 12, 26054, 435, 620, 8, 11329, 59, 16067, 566, 435, 19607, 819, 327, 6596, 642, 10948, 2419, 4154, 574, 523, 340, 13341, 59, 16067, 61, 690, 574, 26, 272, 327, 8730, 5084, 272, 327, 870, 19621, 435, 298, 5278, 316, 5084, 2, 272, 1911, 275, 221, 2754, 63, 11329, 8, 585, 12, 13341, 1491, 16067, 11, 17, 467, 5818, 9, 272, 372, 1911, 819, 327, 6596, 314, 8126, 2517, 5117, 2419, 4154, 574, 31, 523, 340, 13341, 59, 16067, 61, 2695, 574, 26, 272, 327, 8730, 3432, 272, 327, 870, 19621, 435, 298, 5278, 316, 437, 3395, 2, 272, 1911, 275, 221, 2754, 63, 11329, 8, 585, 12, 13341, 59, 16067, 8429, 5818, 9, 199, 3, 259, 870, 19621, 435, 298, 5278, 737, 2166, 450, 68, 402, 2, 450, 5818, 12, 13341, 59, 16067, 8429, 298, 19065, 401, 1911, 272, 372, 18796, 435, 1911, 819, 746, 6064, 480, 17366, 78, 1133, 1336, 1263, 2517, 9124, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
freesmartphone/framework
framework/subsystems/opimd/pimd_messages.py
1
29060
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Open PIM Daemon (C) 2008 by Soeren Apel <abraxa@dar-clan.de> (C) 2008 Openmoko, Inc. (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de> (C) 2009 Sebastian Krzyszkowiak <seba.dos1@gmail.com> (C) 2009 Tom "TAsn" Hacohen <tom@stosb.com> GPLv2 or later Messages Domain Plugin Establishes the 'messages' PIM domain and handles all related requests """ from dbus.service import FallbackObject as DBusFBObject from dbus.service import signal as dbus_signal from dbus.service import method as dbus_method #ogsmd interaction from dbus import SystemBus from dbus.proxies import Interface from dbus.exceptions import DBusException from functools import partial import dbus import time import re import logging logger = logging.getLogger('opimd') from domain_manager import DomainManager, Domain from helpers import * from opimd import * from query_manager import SingleQueryHandler, SingleRawSQLQueryHandler import framework.patterns.tasklet as tasklet from framework.config import config, busmap from pimd_generic import GenericDomain from db_handler import DbHandler #----------------------------------------------------------------------------# _DOMAIN_NAME = "Messages" _DBUS_PATH_MESSAGES = DBUS_PATH_BASE_FSO + '/' + _DOMAIN_NAME _DIN_MESSAGES_BASE = DIN_BASE_FSO _DBUS_PATH_QUERIES = _DBUS_PATH_MESSAGES + '/Queries' _DIN_MESSAGES = _DIN_MESSAGES_BASE + '.' + 'Messages' _DIN_ENTRY = _DIN_MESSAGES_BASE + '.' + 'Message' _DIN_QUERY = _DIN_MESSAGES_BASE + '.' + 'MessageQuery' _DIN_FIELDS = _DIN_MESSAGES_BASE + '.' + 'Fields' #----------------------------------------------------------------------------# class MessagesDbHandler(DbHandler): #----------------------------------------------------------------------------# name = 'Messages' domain = None #----------------------------------------------------------------------------# def __init__(self, domain): self.domain = domain self.db_prefix = self.name.lower() self.table_types = ['phonenumber', 'text', 'date', 'boolean'] super(MessagesDbHandler, self).__init__() self.create_db() def get_create_type_index(self, type): if type == "date": return "CREATE INDEX IF NOT EXISTS " + self.db_prefix + "_" + type + \ "_value ON " + self.db_prefix + "_" + type + "(value DESC)" return super(MessagesDbHandler, self).get_create_type_index(type) #----------------------------------------------------------------------------# class QueryManager(DBusFBObject): #----------------------------------------------------------------------------# _queries = None db_handler = None _next_query_id = None # Note: _queries must be a dict so we can remove queries without messing up query IDs def __init__(self, db_handler): """Creates a new QueryManager instance @param entries Set of Entry objects to use""" self.db_handler = db_handler self._queries = {} self._next_query_id = 0 # Initialize the D-Bus-Interface DBusFBObject.__init__( self, conn=busmap["opimd"], object_path=_DBUS_PATH_QUERIES ) # Still necessary? self.interface = _DIN_MESSAGES self.path = _DBUS_PATH_QUERIES def process_query(self, query, dbus_sender): """Handles a query and returns the dbus path of the newly created query result @param query Query to evaluate @param dbus_sender Sender's unique name on the bus @return dbus path of the query result""" query_handler = SingleQueryHandler(query, self.db_handler, dbus_sender) query_id = self._next_query_id self._next_query_id += 1 self._queries[query_id] = query_handler return _DBUS_PATH_QUERIES + '/' + str(query_id) def process_query_threads(self, query, dbus_sender): """Handles a query for threads and returns the dbus path of the newly created query result @param dbus_sender Sender's unique name on the bus @return dbus path of the query result""" db_prefix = self.db_handler.db_prefix query['sql'] = """ SELECT m.""" + db_prefix + """_id """ + db_prefix + """_id, ( SELECT COUNT(*) FROM """ + db_prefix + """_phonenumber WHERE field_name = 'Peer' AND value = p1.value ) TotalCount, ( SELECT COUNT(*) FROM ( """ + db_prefix + """_boolean b JOIN """ + db_prefix + """_phonenumber p ON b.""" + db_prefix + """_id = p.""" + db_prefix + """_id AND b.field_name = 'New' ) JOIN """ + db_prefix + """_text x ON b.""" + db_prefix + """_id = x.""" + db_prefix + """_id AND x.field_name = 'Direction' WHERE b.value = '1' AND x.value = 'in' AND p.field_name = 'Peer' AND p.value = p1.value ) UnreadCount FROM ( """ + db_prefix + """ m JOIN """ + db_prefix + """_date t USING (""" + db_prefix + """_id) ) JOIN """ + db_prefix + """_phonenumber p1 USING (""" + db_prefix + """_id) WHERE t.field_name = 'Timestamp' AND t.value IN ( SELECT MAX(timestamp) timestamp FROM ( ( SELECT date_t.""" + db_prefix + """_id AS """ + db_prefix + """_id, date_t.value AS timestamp FROM """ + db_prefix + """_date AS date_t WHERE date_t.field_name = 'Timestamp' ) res_t JOIN """ + db_prefix + """_phonenumber num_t ON res_t.""" + db_prefix + """_id = num_t.""" + db_prefix + """_id AND num_t.field_name = 'Peer' ) GROUP BY num_t.value ) ORDER BY t.value DESC """ query_handler = SingleRawSQLQueryHandler(query, self.db_handler, dbus_sender) query_id = self._next_query_id self._next_query_id += 1 self._queries[query_id] = query_handler return _DBUS_PATH_QUERIES + '/' + str(query_id) def check_new_entry(self, entry_id): """Checks whether a newly added entry matches one or more queries so they can signal clients @param entry_id Message ID of the message that was added""" for (query_id, query_handler) in self._queries.items(): if query_handler.check_new_entry(entry_id): entry_path = self.id_to_path(entry_id) self.EntryAdded(entry_path, rel_path='/' + str(query_id)) def check_query_id_ok( self, num_id ): """ Checks whether a query ID is existing. Raises InvalidQueryID, if not. """ if not num_id in self._queries: raise InvalidQueryID( "Existing query IDs: %s" % self._queries.keys() ) def EntryAdded(self, path, rel_path=None): self.MessageAdded(path, rel_path=rel_path) @dbus_signal(_DIN_QUERY, "s", rel_path_keyword="rel_path") def MessageAdded(self, path, rel_path=None): pass @dbus_method(_DIN_QUERY, "", "i", rel_path_keyword="rel_path") def GetResultCount(self, rel_path): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) return self._queries[num_id].get_result_count() @dbus_method(_DIN_QUERY, "", "", rel_path_keyword="rel_path", sender_keyword="sender") def Rewind(self, rel_path, sender): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) self._queries[num_id].rewind(sender) @dbus_method(_DIN_QUERY, "i", "", rel_path_keyword="rel_path", sender_keyword="sender") def Skip(self, num_entries, rel_path, sender): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) self._queries[num_id].skip(sender, num_entries) @dbus_method(_DIN_QUERY, "", "s", rel_path_keyword="rel_path", sender_keyword="sender") def GetMessagePath(self, rel_path, sender): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) return self._queries[num_id].get_entry_path(sender) @dbus_method(_DIN_QUERY, "", "a{sv}", rel_path_keyword="rel_path", sender_keyword="sender") def GetResult(self, rel_path, sender): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) return self._queries[num_id].get_result(sender) @dbus_method(_DIN_QUERY, "i", "aa{sv}", rel_path_keyword="rel_path", sender_keyword="sender") def GetMultipleResults(self, num_entries, rel_path, sender): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) return self._queries[num_id].get_multiple_results(sender, num_entries) @dbus_method(_DIN_QUERY, "", "", rel_path_keyword="rel_path") def Dispose(self, rel_path): num_id = int(rel_path[1:]) self.check_query_id_ok( num_id ) # Make sure no one else references the query handler before we remove our reference to it # Otherwise, garbage collection won't actually free its memory self._queries[num_id].dispose() self._queries.__delitem__(num_id) ##----------------------------------------------------------------------------# class MessageDomain(Domain, GenericDomain): #----------------------------------------------------------------------------# name = _DOMAIN_NAME fso_handler = None db_handler = None query_manager = None _dbus_path = None _unread_messages = None DEFAULT_FIELDS = { 'Peer' : 'phonenumber', 'Source' : 'text', 'Direction' : 'text', 'New' : 'boolean', 'Timestamp' : 'date', 'Timezone' : 'timezone', 'Content' : 'text' } def __init__(self): """Creates a new MessageDomain instance""" self._dbus_path = _DBUS_PATH_MESSAGES self.db_handler = MessagesDbHandler(self) self.query_manager = QueryManager(self.db_handler) # Initialize the D-Bus-Interface Domain.__init__( self, conn=busmap["opimd"], object_path=DBUS_PATH_BASE_FSO + '/' + self.name ) self.load_field_types() self.add_default_fields() # Keep frameworkd happy self.interface = _DIN_MESSAGES self.path = _DBUS_PATH_MESSAGES self.fso_handler = MessagesFSO(self) self._unread_messages = len(self.db_handler.query({'Direction': 'in', 'New':1})) #---------------------------------------------------------------------# # dbus methods and signals # #---------------------------------------------------------------------# def NewEntry(self, path): self.NewMessage(path) @dbus_signal(_DIN_MESSAGES, "s") def NewMessage(self, path): pass @dbus_method(_DIN_MESSAGES, "a{sv}", "s") def Add(self, entry_data): """Adds a message to the list, assigning it to the default backend and saving it @param message_data List of fields; format is [Key:Value, Key:Value, ...] @return URI of the newly created d-bus message object""" unread = entry_data.get('New') #Make sure is boolean if unread == None: unread = 0 else: unread = int(unread) if entry_data.get('Direction') == 'in' and unread: self._unread_messages += 1 self.UnreadMessages(self._unread_messages) return self.add(entry_data) @dbus_method(_DIN_MESSAGES, "a{sv}", "s") def AddIncoming(self, entry_data): """Adds a message to the list, and send signal about incoming message @param message_data List of fields; format is [Key:Value, Key:Value, ...] @return URI of the newly created d-bus message object""" message_id = self.Add(entry_data) self.IncomingMessage(message_id) return message_id @dbus_method(_DIN_MESSAGES, "a{sv}s", "s") def GetSingleEntrySingleField(self, query, field_name): """Returns the first message found for a query, making it real easy to query simple things @param query The query object @param field_name The name of the field to return @return The requested data""" return self.get_single_entry_single_field(query, field_name) @dbus_method(_DIN_MESSAGES, "a{sv}", "s", sender_keyword="sender") def Query(self, query, sender): """Processes a query and returns the URI of the resulting query object @param query Query @param sender Unique name of the query sender on the bus @return URI of the query object, e.g. /org.pyneo.PIM/Messages/Queries/4""" return self.query_manager.process_query(query, sender) @dbus_method(_DIN_MESSAGES, "a{sv}", "s", sender_keyword="sender") def QueryThreads(self, query, sender): """Creates a new query for threads and returns the URI of the resulting query object @param sender Unique name of the query sender on the bus @return URI of the query object, e.g. /org.pyneo.PIM/Messages/Queries/4""" return self.query_manager.process_query_threads(query, sender) @dbus_method(_DIN_MESSAGES, "", "i") def GetUnreadMessages(self): return self._unread_messages @dbus_signal(_DIN_MESSAGES, "i") def UnreadMessages(self, amount): pass @dbus_signal(_DIN_MESSAGES, "s") def IncomingMessage(self, message_path): pass @dbus_method(_DIN_ENTRY, "", "a{sv}", rel_path_keyword="rel_path") def GetContent(self, rel_path): num_id = int(rel_path[1:]) self.check_entry_id(num_id) return self.get_content(num_id) @dbus_method(_DIN_ENTRY, "s", "a{sv}", rel_path_keyword="rel_path") def GetMultipleFields(self, field_list, rel_path): num_id = int(rel_path[1:]) return self.get_multiple_fields(num_id, field_list) @dbus_signal(_DIN_MESSAGES, "s") def DeletedMessage(self, path): pass @dbus_signal(_DIN_ENTRY, "", rel_path_keyword="rel_path") def MessageDeleted(self, rel_path=None): pass def EntryDeleted(self, rel_path=None): self.MessageDeleted(rel_path=rel_path) self.DeletedMessage(_DBUS_PATH_MESSAGES+rel_path) @dbus_method(_DIN_ENTRY, "", "", rel_path_keyword="rel_path") def Delete(self, rel_path): num_id = int(rel_path[1:]) self.check_entry_id(num_id) message = self.get_content(num_id) unread = message.get('New') #Make sure is boolean if unread == None: unread = 0 else: unread = int(unread) if unread and message.get('Direction') == 'in': self._unread_messages -= 1 self.UnreadMessages(self._unread_messages) self.delete(num_id) def EntryUpdated(self, data, rel_path=None): self.MessageUpdated(data, rel_path=rel_path) self.UpdatedMessage(_DBUS_PATH_MESSAGES+rel_path, data) @dbus_signal(_DIN_MESSAGES, "sa{sv}") def UpdatedMessage(self, path, data): pass @dbus_signal(_DIN_ENTRY, "a{sv}", rel_path_keyword="rel_path") def MessageUpdated(self, data, rel_path=None): pass @dbus_method(_DIN_ENTRY, "a{sv}", "", rel_path_keyword="rel_path") def Update(self, data, rel_path): num_id = int(rel_path[1:]) self.check_entry_id(num_id) message = self.get_content(num_id) #FIXME: What if it was outgoing and is now incoming? old_unread = message['New'] if message.has_key('New') else False new_unread = data['New'] if data.has_key('New') else False old_in = message['Direction'] == 'in' if message.has_key('Direction') else False new_in = data['Direction'] == 'in' if data.has_key('Direction') else old_in if old_unread and old_in and not new_unread: self._unread_messages -= 1 self.UnreadMessages(self._unread_messages) elif (not old_unread and new_unread and new_in) or \ (old_unread and not old_in and new_unread and new_in): self._unread_messages += 1 self.UnreadMessages(self._unread_messages) self.update(num_id, data) @dbus_method(_DIN_FIELDS, "ss", "") def AddField(self, name, type): self.add_new_field(name, type) @dbus_method(_DIN_FIELDS, "", "a{ss}") def ListFields(self): return self.list_fields() @dbus_method(_DIN_FIELDS, "s", "as") def ListFieldsWithType(self, type): return self.list_fields_with_type(type) @dbus_method(_DIN_FIELDS, "s", "") def DeleteField(self, name): self.remove_field(name) @dbus_method(_DIN_FIELDS, "s", "s") def GetType(self, name): return self.field_type_from_name(name) #----------------------------------------------------------------------------# class MessagesFSO(object): #----------------------------------------------------------------------------# name = 'FSO-Messages-Handler' _gsm_sim_iface = None _UNAVAILABLE_PART = '<???>' domain = None #----------------------------------------------------------------------------# def __init__(self, domain): self.domain = domain self.signals = False self.ready_signal = False self.enable() def __repr__(self): return self.name def dbus_ok(self, *args, **kargs): pass def dbus_err(self, *args, **kargs): pass def process_single_entry(self, data): (status, number, text, props) = data entry = {} #FIXME: removing status and sanitize this function remove seq/etc after getting second message logger.debug("Processing entry \"%s\"...", text) entry['New'] = 1 if status in ('read', 'unread'): entry['Direction'] = 'in' else: entry['Direction'] = 'out' if status in ('read', 'sent'): entry['New'] = 0 entry['Peer'] = number # TODO Handle text properly, i.e. make it on-demand if >1KiB entry['Content'] = text entry['Source'] = 'SMS' entry['SMS-combined_message'] = 0 if props.has_key('timestamp'): try: timestamp = props['timestamp'][:len(props['timestamp'])-6] entry['Timezone'] = props['timestamp'][len(props['timestamp'])-5:] entry['Timestamp'] = int(time.mktime(time.strptime(timestamp))) except ValueError: logger.error("Couldn't handle timestamp!") if props.has_key('csm_seq'): entry['SMS-combined_message'] = 1 entry['SMS-complete_message'] = 0 entry['SMS-csm_seq'+str(props['csm_seq'])+'_content'] = text for field in props: entry['SMS-'+field] = props[field] logger.debug("Message is incoming!") if entry['SMS-combined_message']: logger.debug("It's CSM!") register = 0 try: path = self.domain.GetSingleEntrySingleField({'Direction':'in', 'SMS-combined_message':1, 'SMS-complete_message':0, 'SMS-csm_num':entry['SMS-csm_num'], 'SMS-csm_id':entry['SMS-csm_id'], 'Source':'SMS'},'Path') if path: id = self.domain.path_to_id(path) result = self.domain.get_content(id) new_content = '' complete = 1 edit_data = {} # Make the whole content for i in range(1, entry['SMS-csm_num']+1): if i==entry['SMS-csm_seq']: new_content += entry['Content'] edit_data['SMS-csm_seq'+str(i)+'_content'] = entry['Content'] else: try: new_content += result['SMS-csm_seq'+str(i)+'_content'] except KeyError: new_content += self._UNAVAILABLE_PART complete = 0 if complete: edit_data['SMS-complete_message']=1 edit_data['Content'] = new_content edit_data['New'] = 1 self.domain.Update(edit_data, '/' + str(id)) else: register = 1 if entry['SMS-csm_seq']>1: entry['Content']=self._UNAVAILABLE_PART+entry['Content'] if entry['SMS-csm_seq']<entry['SMS-csm_num']: entry['Content']=entry['Content']+self._UNAVAILABLE_PART logger.debug('CSM: first part') except: register = 1 logger.error('%s: failed to handle CSM message!', self.name) else: register = 1 #If needed to add, add. if register: self.domain.AddIncoming(entry) def disable(self): if self.ready_signal: self.readysignal.remove() self.authsignal.remove() self.ready_signal = False if self.signals: self.imsignal.remove() self.ismsignal.remove() self.imrsignal.remove() self.imrsignal2.remove() self.itmsignal.remove() self.signals = False def enable(self): self.bus = SystemBus() try: self.gsm = self.bus.get_object('org.freesmartphone.ogsmd', '/org/freesmartphone/GSM/Device', True, True) self.gsm_sim_iface = Interface(self.gsm, 'org.freesmartphone.GSM.SIM') self.gsm_sms_iface = Interface(self.gsm, 'org.freesmartphone.GSM.SMS') self.gsm_device_iface = Interface(self.gsm, 'org.freesmartphone.GSM.Device') self.install_signal_handlers() self._initialized = True except DBusException, e: logger.warning("%s: Could not request SIM messagebook from ogsmd (%s)", self.name, e) logger.info("%s: Waiting for SIM being ready...", self.name) if not self.ready_signal: try: self.readysignal = self.bus.add_signal_receiver(self.handle_sim_ready, signal_name='ReadyStatus', dbus_interface='org.freesmartphone.GSM.SIM', bus_name='org.freesmartphone.ogsmd') self.authsignal = self.bus.add_signal_receiver(self.handle_auth_status, signal_name='AuthStatus', dbus_interface='org.freesmartphone.GSM.SIM', bus_name='org.freesmartphone.ogsmd') logger.info('%s: Signal listeners about SIM status installed', self.name) #self.gsm_sim_iface.connect_to_signal("ReadyStatus", self.handle_sim_ready) self.ready_signal = True except: logger.error("%s: Could not install signal handler!", self.name) def process_incoming_stored_entry(self, status, number, text, props, message_id): self.process_single_entry((status, number, text, props)) self.gsm_sim_iface.DeleteMessage(message_id, reply_handler=self.dbus_ok, error_handler=self.dbus_err) def handle_incoming_stored_message(self, message_id): logger.error("Got incoming stored message, shouldn't happen - Storing ourselves and deleting from sim") logger.info("After previous error, trying to take back control for messages") try: self.gsm_device_iface.SetSimBuffersSms(False, reply_handler=self.dbus_ok, error_handler=self.dbus_err) except: logger.warning("Couldn't set sim buffers. This is bad even if you use fsogsmd.") #SHOULD WE DELETE AFTERWARDS? self.gsm_sim_iface.RetrieveMessage( message_id, reply_handler=partial(self.process_incoming_stored_entry, message_id=message_id), error_handler=self.dbus_err ) def handle_incoming_message(self, number, text, props): try: self.process_single_entry(("unread", number, text, props)) self.gsm_sms_iface.AckMessage('', {}, reply_handler=self.dbus_ok, error_handler=self.dbus_err) except Exception, exp: self.gsm_sms_iface.NackMessage('', {}, reply_handler=self.dbus_ok, error_handler=self.dbus_err) logger.error("Message nacked! - Reason: %s", str(exp)) def install_signal_handlers(self): """Hooks to some d-bus signals that are of interest to us""" if not self.signals: try: self.imsignal = self.bus.add_signal_receiver(self.handle_incoming_message, signal_name='IncomingMessage', dbus_interface='org.freesmartphone.GSM.SMS', bus_name='org.freesmartphone.ogsmd') self.ismsignal = self.bus.add_signal_receiver(self.handle_incoming_stored_message, signal_name='IncomingStoredMessage', dbus_interface='org.freesmartphone.GSM.SIM', bus_name='org.freesmartphone.ogsmd') self.imrsignal = self.bus.add_signal_receiver(self.handle_incoming_message_receipt, signal_name='IncomingMessageReceipt', dbus_interface='org.freesmartphone.GSM.SMS', bus_name='org.freesmartphone.ogsmd') self.imrsignal2 = self.bus.add_signal_receiver(self.handle_incoming_message_report, signal_name='IncomingMessageReport', dbus_interface='org.freesmartphone.GSM.SMS', bus_name='org.freesmartphone.ogsmd') self.itmsignal = self.bus.add_signal_receiver(self.handle_incoming_text_message, signal_name='IncomingTextMessage', dbus_interface='org.freesmartphone.GSM.SMS', bus_name='org.freesmartphone.ogsmd') logger.info("%s: Installed signal handlers", self.name) self.signals = True try: self.gsm_device_iface.SetSimBuffersSms(False, reply_handler=self.dbus_ok, error_handler=self.dbus_err) except: logger.warning("Couldn't set sim buffers. Either you are using fsogsmd or something went wrong") except: logger.error("%s: Could not install signal handlers!", self.name) def handle_auth_status(self, ready): if ready=='READY': self.enable() def handle_sim_ready(self, ready): return def handle_incoming_text_message(self, number, timestamp, msg): logger.debug("Adding incoming text message.") entry = {} entry['Content'] = msg entry['Peer'] = number entry['Direction'] = 'in' entry['New'] = 1 entry['Source'] = 'SMS' # We get number of quarters of an hours, convert to minutes: zone = int(timestamp[18:]) * 15 hours = int(zone / 60) minutes = zone - (hours * 60) entry['Timezone'] = timestamp[17:18] + str(hours).zfill(2) + str(minutes).zfill(2) entry['Timestamp'] = int(time.mktime(time.strptime(timestamp[:17], "%y/%m/%d,%H:%M:%S"))) self.domain.AddIncoming(entry) def handle_incoming_message_receipt(self, number, text, props): path = self.domain.GetSingleEntrySingleField({'SMS-message-reference':props['message-reference'], 'Direction':'out', 'Source':'SMS', 'SMS-status-report-request':1, '$phonenumber':number},'Path') if path: rel_path = path.replace('/org/freesmartphone/PIM/Messages','') try: if props['status']==0: self.domain.Update({'SMS-delivered':1, 'SMS-message-reference':''}, rel_path) else: self.domain.Update({'SMS-delivered':0, 'SMS-delivery-status':status, 'SMS-message-reference':''}, rel_path) except: logger.error("%s: Could not store information about delivery report for message %s!", self.name, path) else: logger.info("%s: Delivery report about non-existient message!", self.name) def handle_incoming_message_report(self, id, status, number, contents): path = self.domain.GetSingleEntrySingleField({'SMS-message-reference':id, 'Direction':'out', 'Source':'SMS', 'SMS-status-report-request':1, '$phonenumber':number},'Path') if path: rel_path = path.replace('/org/freesmartphone/PIM/Messages','') try: if status=='SMS_ST_COMPLETED_RECEIVED': self.domain.Update({'SMS-delivered':1, 'SMS-message-reference':''}, rel_path) else: self.domain.Update({'SMS-delivered':0, 'SMS-delivery-status': status, 'SMS-message-reference':''}, rel_path) except: logger.error("%s: Could not store information about delivery report for message %s!", self.name, path) else: logger.info("%s: Delivery report about non-existient message!", self.name)
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 4299, 510, 1469, 577, 8770, 199, 199, 8, 35, 9, 9079, 701, 2002, 69, 828, 437, 28478, 665, 371, 345, 1800, 32, 4460, 13, 429, 290, 14, 271, 30, 199, 8, 35, 9, 9079, 3232, 573, 7697, 12, 3277, 14, 199, 8, 35, 9, 8937, 16922, 283, 45, 2000, 14655, 7, 491, 3844, 281, 665, 77, 416, 14262, 32, 20662, 17142, 13, 4603, 14, 271, 30, 199, 8, 35, 9, 8937, 428, 2871, 1810, 5653, 1804, 30841, 588, 20344, 583, 73, 1151, 665, 261, 2470, 14, 18339, 17, 32, 6799, 14, 957, 30, 199, 8, 35, 9, 8937, 21644, 298, 52, 2822, 78, 2, 869, 13286, 16800, 665, 3151, 32, 270, 736, 66, 14, 957, 30, 199, 28863, 18, 503, 2945, 199, 199, 14508, 14061, 11349, 199, 199, 9169, 13306, 397, 314, 283, 3431, 7, 510, 1469, 2881, 436, 10022, 1006, 4048, 4145, 199, 624, 199, 199, 504, 21140, 14, 1364, 492, 481, 5421, 1692, 465, 6249, 527, 8223, 1692, 199, 504, 21140, 14, 1364, 492, 4673, 465, 21140, 63, 4653, 199, 504, 21140, 14, 1364, 492, 1083, 465, 21140, 63, 765, 199, 3, 79, 458, 1064, 18752, 199, 504, 21140, 492, 6187, 12106, 199, 504, 21140, 14, 17128, 492, 14816, 199, 504, 21140, 14, 3924, 492, 6249, 527, 1726, 199, 504, 9143, 492, 7417, 199, 646, 21140, 199, 646, 900, 199, 199, 646, 295, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 360, 411, 1017, 68, 358, 199, 199, 504, 2881, 63, 2609, 492, 14061, 2988, 12, 14061, 199, 504, 10897, 492, 627, 199, 504, 1687, 1017, 68, 492, 627, 199, 199, 504, 1827, 63, 2609, 492, 13050, 3227, 2461, 12, 13050, 7963, 4657, 3227, 2461, 199, 199, 646, 10059, 14, 7435, 14, 1765, 2723, 465, 2120, 2723, 199, 504, 10059, 14, 888, 492, 1101, 12, 10414, 1130, 199, 199, 504, 299, 1017, 68, 63, 6767, 492, 8307, 7705, 199, 199, 504, 1592, 63, 2232, 492, 28822, 2461, 421, 199, 7656, 4559, 3, 199, 199, 63, 7378, 63, 2339, 275, 298, 14508, 2, 199, 199, 63, 2846, 1668, 63, 3243, 63, 23229, 275, 6249, 1668, 63, 3243, 63, 5825, 63, 38, 4118, 435, 7324, 435, 485, 7378, 63, 2339, 199, 63, 36, 568, 63, 23229, 63, 5825, 275, 577, 568, 63, 5825, 63, 38, 4118, 199, 199, 63, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 275, 485, 2846, 1668, 63, 3243, 63, 23229, 435, 1994, 13611, 7, 199, 199, 63, 36, 568, 63, 23229, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 14508, 7, 199, 63, 36, 568, 63, 7285, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 2209, 7, 199, 63, 36, 568, 63, 11938, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 2209, 3227, 7, 199, 63, 36, 568, 63, 12767, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 7304, 7, 421, 199, 7656, 4559, 3, 199, 533, 27377, 8882, 2461, 8, 8882, 2461, 304, 199, 7656, 4559, 3, 272, 536, 275, 283, 14508, 7, 339, 2881, 275, 488, 199, 7656, 4559, 3, 339, 347, 636, 826, 721, 277, 12, 2881, 304, 2728, 291, 14, 2261, 275, 2881, 398, 291, 14, 697, 63, 1861, 275, 291, 14, 354, 14, 2325, 342, 267, 291, 14, 1224, 63, 1313, 275, 788, 838, 265, 287, 884, 297, 283, 505, 297, 283, 602, 297, 283, 4871, 418, 267, 1613, 8, 14508, 8882, 2461, 12, 291, 2843, 826, 4533, 267, 291, 14, 981, 63, 697, 342, 272, 347, 664, 63, 981, 63, 466, 63, 1080, 8, 277, 12, 730, 304, 267, 340, 730, 508, 298, 602, 582, 288, 372, 298, 8366, 17055, 8036, 2845, 23875, 298, 435, 291, 14, 697, 63, 1861, 435, 14220, 435, 730, 435, 971, 673, 2668, 585, 5258, 298, 435, 291, 14, 697, 63, 1861, 435, 14220, 435, 730, 435, 7340, 585, 23915, 2924, 267, 372, 1613, 8, 14508, 8882, 2461, 12, 291, 680, 362, 63, 981, 63, 466, 63, 1080, 8, 466, 9, 199, 7656, 4559, 3, 199, 533, 8133, 2988, 8, 2846, 527, 8223, 1692, 304, 199, 7656, 4559, 3, 272, 485, 10590, 275, 488, 272, 1592, 63, 2232, 275, 488, 272, 485, 2184, 63, 1131, 63, 344, 275, 488, 339, 327, 3390, 26, 485, 10590, 1471, 506, 282, 1211, 880, 781, 883, 2813, 9212, 1928, 15634, 316, 1536, 1827, 11449, 339, 347, 636, 826, 721, 277, 12, 1592, 63, 2232, 304, 267, 408, 10607, 282, 892, 8133, 2988, 1256, 398, 768, 635, 4811, 2494, 402, 11855, 2251, 370, 675, 624, 398, 291, 14, 697, 63, 2232, 275, 1592, 63, 2232, 267, 291, 423, 10590, 275, 1052, 267, 291, 423, 2184, 63, 1131, 63, 344, 275, 378, 398, 327, 11578, 314, 577, 13, 12106, 13, 4267, 267, 6249, 527, 8223, 1692, 855, 826, 721, 291, 12, 2557, 29, 5610, 1130, 905, 411, 1017, 68, 2255, 909, 63, 515, 3699, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 776, 398, 327, 428, 12587, 5784, 31, 267, 291, 14, 3266, 275, 485, 36, 568, 63, 23229, 267, 291, 14, 515, 275, 485, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 2378, 347, 2112, 63, 1131, 8, 277, 12, 1827, 12, 21140, 63, 8114, 304, 267, 408, 23555, 282, 1827, 436, 2529, 314, 21140, 931, 402, 314, 13903, 2737, 1827, 754, 398, 768, 635, 1827, 8133, 370, 9352, 267, 768, 635, 21140, 63, 8114, 428, 13747, 1159, 3747, 536, 641, 314, 10414, 267, 768, 1107, 21140, 931, 402, 314, 1827, 754, 624, 398, 1827, 63, 2232, 275, 13050, 3227, 2461, 8, 1131, 12, 291, 14, 697, 63, 2232, 12, 21140, 63, 8114, 9, 398, 1827, 63, 344, 275, 291, 423, 2184, 63, 1131, 63, 344, 267, 291, 423, 2184, 63, 1131, 63, 344, 847, 413, 398, 291, 423, 10590, 59, 1131, 63, 344, 61, 275, 1827, 63, 2232, 398, 372, 485, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 435, 7324, 435, 620, 8, 1131, 63, 344, 9, 339, 347, 2112, 63, 1131, 63, 6962, 8, 277, 12, 1827, 12, 21140, 63, 8114, 304, 267 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 4299, 510, 1469, 577, 8770, 199, 199, 8, 35, 9, 9079, 701, 2002, 69, 828, 437, 28478, 665, 371, 345, 1800, 32, 4460, 13, 429, 290, 14, 271, 30, 199, 8, 35, 9, 9079, 3232, 573, 7697, 12, 3277, 14, 199, 8, 35, 9, 8937, 16922, 283, 45, 2000, 14655, 7, 491, 3844, 281, 665, 77, 416, 14262, 32, 20662, 17142, 13, 4603, 14, 271, 30, 199, 8, 35, 9, 8937, 428, 2871, 1810, 5653, 1804, 30841, 588, 20344, 583, 73, 1151, 665, 261, 2470, 14, 18339, 17, 32, 6799, 14, 957, 30, 199, 8, 35, 9, 8937, 21644, 298, 52, 2822, 78, 2, 869, 13286, 16800, 665, 3151, 32, 270, 736, 66, 14, 957, 30, 199, 28863, 18, 503, 2945, 199, 199, 14508, 14061, 11349, 199, 199, 9169, 13306, 397, 314, 283, 3431, 7, 510, 1469, 2881, 436, 10022, 1006, 4048, 4145, 199, 624, 199, 199, 504, 21140, 14, 1364, 492, 481, 5421, 1692, 465, 6249, 527, 8223, 1692, 199, 504, 21140, 14, 1364, 492, 4673, 465, 21140, 63, 4653, 199, 504, 21140, 14, 1364, 492, 1083, 465, 21140, 63, 765, 199, 3, 79, 458, 1064, 18752, 199, 504, 21140, 492, 6187, 12106, 199, 504, 21140, 14, 17128, 492, 14816, 199, 504, 21140, 14, 3924, 492, 6249, 527, 1726, 199, 504, 9143, 492, 7417, 199, 646, 21140, 199, 646, 900, 199, 199, 646, 295, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 360, 411, 1017, 68, 358, 199, 199, 504, 2881, 63, 2609, 492, 14061, 2988, 12, 14061, 199, 504, 10897, 492, 627, 199, 504, 1687, 1017, 68, 492, 627, 199, 199, 504, 1827, 63, 2609, 492, 13050, 3227, 2461, 12, 13050, 7963, 4657, 3227, 2461, 199, 199, 646, 10059, 14, 7435, 14, 1765, 2723, 465, 2120, 2723, 199, 504, 10059, 14, 888, 492, 1101, 12, 10414, 1130, 199, 199, 504, 299, 1017, 68, 63, 6767, 492, 8307, 7705, 199, 199, 504, 1592, 63, 2232, 492, 28822, 2461, 421, 199, 7656, 4559, 3, 199, 199, 63, 7378, 63, 2339, 275, 298, 14508, 2, 199, 199, 63, 2846, 1668, 63, 3243, 63, 23229, 275, 6249, 1668, 63, 3243, 63, 5825, 63, 38, 4118, 435, 7324, 435, 485, 7378, 63, 2339, 199, 63, 36, 568, 63, 23229, 63, 5825, 275, 577, 568, 63, 5825, 63, 38, 4118, 199, 199, 63, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 275, 485, 2846, 1668, 63, 3243, 63, 23229, 435, 1994, 13611, 7, 199, 199, 63, 36, 568, 63, 23229, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 14508, 7, 199, 63, 36, 568, 63, 7285, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 2209, 7, 199, 63, 36, 568, 63, 11938, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 2209, 3227, 7, 199, 63, 36, 568, 63, 12767, 275, 485, 36, 568, 63, 23229, 63, 5825, 435, 7815, 435, 283, 7304, 7, 421, 199, 7656, 4559, 3, 199, 533, 27377, 8882, 2461, 8, 8882, 2461, 304, 199, 7656, 4559, 3, 272, 536, 275, 283, 14508, 7, 339, 2881, 275, 488, 199, 7656, 4559, 3, 339, 347, 636, 826, 721, 277, 12, 2881, 304, 2728, 291, 14, 2261, 275, 2881, 398, 291, 14, 697, 63, 1861, 275, 291, 14, 354, 14, 2325, 342, 267, 291, 14, 1224, 63, 1313, 275, 788, 838, 265, 287, 884, 297, 283, 505, 297, 283, 602, 297, 283, 4871, 418, 267, 1613, 8, 14508, 8882, 2461, 12, 291, 2843, 826, 4533, 267, 291, 14, 981, 63, 697, 342, 272, 347, 664, 63, 981, 63, 466, 63, 1080, 8, 277, 12, 730, 304, 267, 340, 730, 508, 298, 602, 582, 288, 372, 298, 8366, 17055, 8036, 2845, 23875, 298, 435, 291, 14, 697, 63, 1861, 435, 14220, 435, 730, 435, 971, 673, 2668, 585, 5258, 298, 435, 291, 14, 697, 63, 1861, 435, 14220, 435, 730, 435, 7340, 585, 23915, 2924, 267, 372, 1613, 8, 14508, 8882, 2461, 12, 291, 680, 362, 63, 981, 63, 466, 63, 1080, 8, 466, 9, 199, 7656, 4559, 3, 199, 533, 8133, 2988, 8, 2846, 527, 8223, 1692, 304, 199, 7656, 4559, 3, 272, 485, 10590, 275, 488, 272, 1592, 63, 2232, 275, 488, 272, 485, 2184, 63, 1131, 63, 344, 275, 488, 339, 327, 3390, 26, 485, 10590, 1471, 506, 282, 1211, 880, 781, 883, 2813, 9212, 1928, 15634, 316, 1536, 1827, 11449, 339, 347, 636, 826, 721, 277, 12, 1592, 63, 2232, 304, 267, 408, 10607, 282, 892, 8133, 2988, 1256, 398, 768, 635, 4811, 2494, 402, 11855, 2251, 370, 675, 624, 398, 291, 14, 697, 63, 2232, 275, 1592, 63, 2232, 267, 291, 423, 10590, 275, 1052, 267, 291, 423, 2184, 63, 1131, 63, 344, 275, 378, 398, 327, 11578, 314, 577, 13, 12106, 13, 4267, 267, 6249, 527, 8223, 1692, 855, 826, 721, 291, 12, 2557, 29, 5610, 1130, 905, 411, 1017, 68, 2255, 909, 63, 515, 3699, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 776, 398, 327, 428, 12587, 5784, 31, 267, 291, 14, 3266, 275, 485, 36, 568, 63, 23229, 267, 291, 14, 515, 275, 485, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 2378, 347, 2112, 63, 1131, 8, 277, 12, 1827, 12, 21140, 63, 8114, 304, 267, 408, 23555, 282, 1827, 436, 2529, 314, 21140, 931, 402, 314, 13903, 2737, 1827, 754, 398, 768, 635, 1827, 8133, 370, 9352, 267, 768, 635, 21140, 63, 8114, 428, 13747, 1159, 3747, 536, 641, 314, 10414, 267, 768, 1107, 21140, 931, 402, 314, 1827, 754, 624, 398, 1827, 63, 2232, 275, 13050, 3227, 2461, 8, 1131, 12, 291, 14, 697, 63, 2232, 12, 21140, 63, 8114, 9, 398, 1827, 63, 344, 275, 291, 423, 2184, 63, 1131, 63, 344, 267, 291, 423, 2184, 63, 1131, 63, 344, 847, 413, 398, 291, 423, 10590, 59, 1131, 63, 344, 61, 275, 1827, 63, 2232, 398, 372, 485, 2846, 1668, 63, 3243, 63, 2328, 540, 2563, 435, 7324, 435, 620, 8, 1131, 63, 344, 9, 339, 347, 2112, 63, 1131, 63, 6962, 8, 277, 12, 1827, 12, 21140, 63, 8114, 304, 267, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Dino0631/RedRain-Bot
cogs/cogs/notinusecogs/streams.py
7
25768
from discord.ext import commands from .utils.dataIO import dataIO from .utils.chat_formatting import escape_mass_mentions from .utils import checks from collections import defaultdict from string import ascii_letters from random import choice import discord import os import re import aiohttp import asyncio import logging import json class StreamsError(Exception): pass class StreamNotFound(StreamsError): pass class APIError(StreamsError): pass class InvalidCredentials(StreamsError): pass class OfflineStream(StreamsError): pass class Streams: """Streams Alerts for a variety of streaming services""" def __init__(self, bot): self.bot = bot self.twitch_streams = dataIO.load_json("data/streams/twitch.json") self.hitbox_streams = dataIO.load_json("data/streams/hitbox.json") self.mixer_streams = dataIO.load_json("data/streams/beam.json") self.picarto_streams = dataIO.load_json("data/streams/picarto.json") settings = dataIO.load_json("data/streams/settings.json") self.settings = defaultdict(dict, settings) self.messages_cache = defaultdict(list) @commands.command() async def hitbox(self, stream: str): """Checks if hitbox stream is online""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(hitbox\.tv\/)' stream = re.sub(regex, '', stream) try: embed = await self.hitbox_online(stream) except OfflineStream: await self.bot.say(stream + " is offline.") except StreamNotFound: await self.bot.say("That stream doesn't exist.") except APIError: await self.bot.say("Error contacting the API.") else: await self.bot.say(embed=embed) @commands.command(pass_context=True) async def twitch(self, ctx, stream: str): """Checks if twitch stream is online""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(twitch\.tv\/)' stream = re.sub(regex, '', stream) try: data = await self.fetch_twitch_ids(stream, raise_if_none=True) embed = await self.twitch_online(data[0]["_id"]) except OfflineStream: await self.bot.say(stream + " is offline.") except StreamNotFound: await self.bot.say("That stream doesn't exist.") except APIError: await self.bot.say("Error contacting the API.") except InvalidCredentials: await self.bot.say("Owner: Client-ID is invalid or not set. " "See `{}streamset twitchtoken`" "".format(ctx.prefix)) else: await self.bot.say(embed=embed) @commands.command() async def mixer(self, stream: str): """Checks if mixer stream is online""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(mixer\.com\/)' stream = re.sub(regex, '', stream) try: embed = await self.mixer_online(stream) except OfflineStream: await self.bot.say(stream + " is offline.") except StreamNotFound: await self.bot.say("That stream doesn't exist.") except APIError: await self.bot.say("Error contacting the API.") else: await self.bot.say(embed=embed) @commands.command() async def picarto(self, stream: str): """Checks if picarto stream is online""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(picarto\.tv\/)' stream = re.sub(regex, '', stream) try: embed = await self.picarto_online(stream) except OfflineStream: await self.bot.say(stream + " is offline.") except StreamNotFound: await self.bot.say("That stream doesn't exist.") except APIError: await self.bot.say("Error contacting the API.") else: await self.bot.say(embed=embed) @commands.group(pass_context=True, no_pm=True) @checks.mod_or_permissions(manage_server=True) async def streamalert(self, ctx): """Adds/removes stream alerts from the current channel""" if ctx.invoked_subcommand is None: await self.bot.send_cmd_help(ctx) @streamalert.command(name="twitch", pass_context=True) async def twitch_alert(self, ctx, stream: str): """Adds/removes twitch alerts from the current channel""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(twitch\.tv\/)' stream = re.sub(regex, '', stream) channel = ctx.message.channel try: data = await self.fetch_twitch_ids(stream, raise_if_none=True) except StreamNotFound: await self.bot.say("That stream doesn't exist.") return except APIError: await self.bot.say("Error contacting the API.") return except InvalidCredentials: await self.bot.say("Owner: Client-ID is invalid or not set. " "See `{}streamset twitchtoken`" "".format(ctx.prefix)) return enabled = self.enable_or_disable_if_active(self.twitch_streams, stream, channel, _id=data[0]["_id"]) if enabled: await self.bot.say("Alert activated. I will notify this channel " "when {} is live.".format(stream)) else: await self.bot.say("Alert has been removed from this channel.") dataIO.save_json("data/streams/twitch.json", self.twitch_streams) @streamalert.command(name="hitbox", pass_context=True) async def hitbox_alert(self, ctx, stream: str): """Adds/removes hitbox alerts from the current channel""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(hitbox\.tv\/)' stream = re.sub(regex, '', stream) channel = ctx.message.channel try: await self.hitbox_online(stream) except StreamNotFound: await self.bot.say("That stream doesn't exist.") return except APIError: await self.bot.say("Error contacting the API.") return except OfflineStream: pass enabled = self.enable_or_disable_if_active(self.hitbox_streams, stream, channel) if enabled: await self.bot.say("Alert activated. I will notify this channel " "when {} is live.".format(stream)) else: await self.bot.say("Alert has been removed from this channel.") dataIO.save_json("data/streams/hitbox.json", self.hitbox_streams) @streamalert.command(name="mixer", pass_context=True) async def mixer_alert(self, ctx, stream: str): """Adds/removes mixer alerts from the current channel""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(mixer\.com\/)' stream = re.sub(regex, '', stream) channel = ctx.message.channel try: await self.mixer_online(stream) except StreamNotFound: await self.bot.say("That stream doesn't exist.") return except APIError: await self.bot.say("Error contacting the API.") return except OfflineStream: pass enabled = self.enable_or_disable_if_active(self.mixer_streams, stream, channel) if enabled: await self.bot.say("Alert activated. I will notify this channel " "when {} is live.".format(stream)) else: await self.bot.say("Alert has been removed from this channel.") dataIO.save_json("data/streams/beam.json", self.mixer_streams) @streamalert.command(name="picarto", pass_context=True) async def picarto_alert(self, ctx, stream: str): """Adds/removes picarto alerts from the current channel""" stream = escape_mass_mentions(stream) regex = r'^(https?\:\/\/)?(www\.)?(picarto\.tv\/)' stream = re.sub(regex, '', stream) channel = ctx.message.channel try: await self.picarto_online(stream) except StreamNotFound: await self.bot.say("That stream doesn't exist.") return except APIError: await self.bot.say("Error contacting the API.") return except OfflineStream: pass enabled = self.enable_or_disable_if_active(self.picarto_streams, stream, channel) if enabled: await self.bot.say("Alert activated. I will notify this channel " "when {} is live.".format(stream)) else: await self.bot.say("Alert has been removed from this channel.") dataIO.save_json("data/streams/picarto.json", self.picarto_streams) @streamalert.command(name="stop", pass_context=True) async def stop_alert(self, ctx): """Stops all streams alerts in the current channel""" channel = ctx.message.channel streams = ( self.hitbox_streams, self.twitch_streams, self.mixer_streams, self.picarto_streams ) for stream_type in streams: to_delete = [] for s in stream_type: if channel.id in s["CHANNELS"]: s["CHANNELS"].remove(channel.id) if not s["CHANNELS"]: to_delete.append(s) for s in to_delete: stream_type.remove(s) dataIO.save_json("data/streams/twitch.json", self.twitch_streams) dataIO.save_json("data/streams/hitbox.json", self.hitbox_streams) dataIO.save_json("data/streams/beam.json", self.mixer_streams) dataIO.save_json("data/streams/picarto.json", self.picarto_streams) await self.bot.say("There will be no more stream alerts in this " "channel.") @commands.group(pass_context=True) async def streamset(self, ctx): """Stream settings""" if ctx.invoked_subcommand is None: await self.bot.send_cmd_help(ctx) @streamset.command() @checks.is_owner() async def twitchtoken(self, token : str): """Sets the Client-ID for Twitch https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843""" self.settings["TWITCH_TOKEN"] = token dataIO.save_json("data/streams/settings.json", self.settings) await self.bot.say('Twitch Client-ID set.') @streamset.command(pass_context=True, no_pm=True) @checks.admin() async def mention(self, ctx, *, mention_type : str): """Sets mentions for stream alerts Types: everyone, here, none""" server = ctx.message.server mention_type = mention_type.lower() if mention_type in ("everyone", "here"): self.settings[server.id]["MENTION"] = "@" + mention_type await self.bot.say("When a stream is online @\u200b{} will be " "mentioned.".format(mention_type)) elif mention_type == "none": self.settings[server.id]["MENTION"] = "" await self.bot.say("Mentions disabled.") else: await self.bot.send_cmd_help(ctx) dataIO.save_json("data/streams/settings.json", self.settings) @streamset.command(pass_context=True, no_pm=True) @checks.admin() async def autodelete(self, ctx): """Toggles automatic notification deletion for streams that go offline""" server = ctx.message.server settings = self.settings[server.id] current = settings.get("AUTODELETE", True) settings["AUTODELETE"] = not current if settings["AUTODELETE"]: await self.bot.say("Notifications will be automatically deleted " "once the stream goes offline.") else: await self.bot.say("Notifications won't be deleted anymore.") dataIO.save_json("data/streams/settings.json", self.settings) async def hitbox_online(self, stream): url = "https://api.hitbox.tv/media/live/" + stream async with aiohttp.get(url) as r: data = await r.json(encoding='utf-8') if "livestream" not in data: raise StreamNotFound() elif data["livestream"][0]["media_is_live"] == "0": raise OfflineStream() elif data["livestream"][0]["media_is_live"] == "1": return self.hitbox_embed(data) raise APIError() async def twitch_online(self, stream): session = aiohttp.ClientSession() url = "https://api.twitch.tv/kraken/streams/" + stream header = { 'Client-ID': self.settings.get("TWITCH_TOKEN", ""), 'Accept': 'application/vnd.twitchtv.v5+json' } async with session.get(url, headers=header) as r: data = await r.json(encoding='utf-8') await session.close() if r.status == 200: if data["stream"] is None: raise OfflineStream() return self.twitch_embed(data) elif r.status == 400: raise InvalidCredentials() elif r.status == 404: raise StreamNotFound() else: raise APIError() async def mixer_online(self, stream): url = "https://mixer.com/api/v1/channels/" + stream async with aiohttp.get(url) as r: data = await r.json(encoding='utf-8') if r.status == 200: if data["online"] is True: return self.mixer_embed(data) else: raise OfflineStream() elif r.status == 404: raise StreamNotFound() else: raise APIError() async def picarto_online(self, stream): url = "https://api.picarto.tv/v1/channel/name/" + stream async with aiohttp.get(url) as r: data = await r.text(encoding='utf-8') if r.status == 200: data = json.loads(data) if data["online"] is True: return self.picarto_embed(data) else: raise OfflineStream() elif r.status == 404: raise StreamNotFound() else: raise APIError() async def fetch_twitch_ids(self, *streams, raise_if_none=False): def chunks(l): for i in range(0, len(l), 100): yield l[i:i + 100] base_url = "https://api.twitch.tv/kraken/users?login=" header = { 'Client-ID': self.settings.get("TWITCH_TOKEN", ""), 'Accept': 'application/vnd.twitchtv.v5+json' } results = [] for streams_list in chunks(streams): session = aiohttp.ClientSession() url = base_url + ",".join(streams_list) async with session.get(url, headers=header) as r: data = await r.json() if r.status == 200: results.extend(data["users"]) elif r.status == 400: raise InvalidCredentials() else: raise APIError() await session.close() if not results and raise_if_none: raise StreamNotFound() return results def twitch_embed(self, data): channel = data["stream"]["channel"] url = channel["url"] logo = channel["logo"] if logo is None: logo = "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png" status = channel["status"] if not status: status = "Untitled broadcast" embed = discord.Embed(title=status, url=url) embed.set_author(name=channel["display_name"]) embed.add_field(name="Followers", value=channel["followers"]) embed.add_field(name="Total views", value=channel["views"]) embed.set_thumbnail(url=logo) if data["stream"]["preview"]["medium"]: embed.set_image(url=data["stream"]["preview"]["medium"] + self.rnd_attr()) if channel["game"]: embed.set_footer(text="Playing: " + channel["game"]) embed.color = 0x6441A4 return embed def hitbox_embed(self, data): base_url = "https://edge.sf.hitbox.tv" livestream = data["livestream"][0] channel = livestream["channel"] url = channel["channel_link"] embed = discord.Embed(title=livestream["media_status"], url=url) embed.set_author(name=livestream["media_name"]) embed.add_field(name="Followers", value=channel["followers"]) #embed.add_field(name="Views", value=channel["views"]) embed.set_thumbnail(url=base_url + channel["user_logo"]) if livestream["media_thumbnail"]: embed.set_image(url=base_url + livestream["media_thumbnail"] + self.rnd_attr()) embed.set_footer(text="Playing: " + livestream["category_name"]) embed.color = 0x98CB00 return embed def mixer_embed(self, data): default_avatar = ("https://mixer.com/_latest/assets/images/main/" "avatars/default.jpg") user = data["user"] url = "https://mixer.com/" + data["token"] embed = discord.Embed(title=data["name"], url=url) embed.set_author(name=user["username"]) embed.add_field(name="Followers", value=data["numFollowers"]) embed.add_field(name="Total views", value=data["viewersTotal"]) if user["avatarUrl"]: embed.set_thumbnail(url=user["avatarUrl"]) else: embed.set_thumbnail(url=default_avatar) if data["thumbnail"]: embed.set_image(url=data["thumbnail"]["url"] + self.rnd_attr()) embed.color = 0x4C90F3 if data["type"] is not None: embed.set_footer(text="Playing: " + data["type"]["name"]) return embed def picarto_embed(self, data): avatar = ("https://picarto.tv/user_data/usrimg/{}/dsdefault.jpg{}" "".format(data["name"].lower(), self.rnd_attr())) url = "https://picarto.tv/" + data["name"] thumbnail = ("https://thumb.picarto.tv/thumbnail/{}.jpg" "".format(data["name"])) embed = discord.Embed(title=data["title"], url=url) embed.set_author(name=data["name"]) embed.set_image(url=thumbnail + self.rnd_attr()) embed.add_field(name="Followers", value=data["followers"]) embed.add_field(name="Total views", value=data["viewers_total"]) embed.set_thumbnail(url=avatar) embed.color = 0x132332 data["tags"] = ", ".join(data["tags"]) if not data["tags"]: data["tags"] = "None" if data["adult"]: data["adult"] = "NSFW | " else: data["adult"] = "" embed.color = 0x4C90F3 embed.set_footer(text="{adult}Category: {category} | Tags: {tags}" "".format(**data)) return embed def enable_or_disable_if_active(self, streams, stream, channel, _id=None): """Returns True if enabled or False if disabled""" for i, s in enumerate(streams): if s["NAME"] != stream: continue if channel.id in s["CHANNELS"]: streams[i]["CHANNELS"].remove(channel.id) if not s["CHANNELS"]: streams.remove(s) return False else: streams[i]["CHANNELS"].append(channel.id) return True data = {"CHANNELS": [channel.id], "NAME": stream, "ALREADY_ONLINE": False} if _id: data["ID"] = _id streams.append(data) return True async def stream_checker(self): CHECK_DELAY = 60 try: await self._migration_twitch_v5() except InvalidCredentials: print("Error during convertion of twitch usernames to IDs: " "invalid token") except Exception as e: print("Error during convertion of twitch usernames to IDs: " "{}".format(e)) while self == self.bot.get_cog("Streams"): save = False streams = ((self.twitch_streams, self.twitch_online), (self.hitbox_streams, self.hitbox_online), (self.mixer_streams, self.mixer_online), (self.picarto_streams, self.picarto_online)) for streams_list, parser in streams: if parser == self.twitch_online: _type = "ID" else: _type = "NAME" for stream in streams_list: if _type not in stream: continue key = (parser, stream[_type]) try: embed = await parser(stream[_type]) except OfflineStream: if stream["ALREADY_ONLINE"]: stream["ALREADY_ONLINE"] = False save = True await self.delete_old_notifications(key) except: # We don't want our task to die continue else: if stream["ALREADY_ONLINE"]: continue save = True stream["ALREADY_ONLINE"] = True messages_sent = [] for channel_id in stream["CHANNELS"]: channel = self.bot.get_channel(channel_id) if channel is None: continue mention = self.settings.get(channel.server.id, {}).get("MENTION", "") can_speak = channel.permissions_for(channel.server.me).send_messages message = mention + " {} is live!".format(stream["NAME"]) if channel and can_speak: m = await self.bot.send_message(channel, message, embed=embed) messages_sent.append(m) self.messages_cache[key] = messages_sent await asyncio.sleep(0.5) if save: dataIO.save_json("data/streams/twitch.json", self.twitch_streams) dataIO.save_json("data/streams/hitbox.json", self.hitbox_streams) dataIO.save_json("data/streams/beam.json", self.mixer_streams) dataIO.save_json("data/streams/picarto.json", self.picarto_streams) await asyncio.sleep(CHECK_DELAY) async def delete_old_notifications(self, key): for message in self.messages_cache[key]: server = message.server settings = self.settings.get(server.id, {}) is_enabled = settings.get("AUTODELETE", True) try: if is_enabled: await self.bot.delete_message(message) except: pass del self.messages_cache[key] def rnd_attr(self): """Avoids Discord's caching""" return "?rnd=" + "".join([choice(ascii_letters) for i in range(6)]) async def _migration_twitch_v5(self): # Migration of old twitch streams to API v5 to_convert = [] for stream in self.twitch_streams: if "ID" not in stream: to_convert.append(stream["NAME"]) if not to_convert: return results = await self.fetch_twitch_ids(*to_convert) for stream in self.twitch_streams: for result in results: if stream["NAME"].lower() == result["name"].lower(): stream["ID"] = result["_id"] # We might as well delete the invalid / renamed ones self.twitch_streams = [s for s in self.twitch_streams if "ID" in s] dataIO.save_json("data/streams/twitch.json", self.twitch_streams) def check_folders(): if not os.path.exists("data/streams"): print("Creating data/streams folder...") os.makedirs("data/streams") def check_files(): stream_files = ( "twitch.json", "hitbox.json", "beam.json", "picarto.json" ) for filename in stream_files: if not dataIO.is_valid_json("data/streams/" + filename): print("Creating empty {}...".format(filename)) dataIO.save_json("data/streams/" + filename, []) f = "data/streams/settings.json" if not dataIO.is_valid_json(f): print("Creating empty settings.json...") dataIO.save_json(f, {}) def setup(bot): logger = logging.getLogger('aiohttp.client') logger.setLevel(50) # Stops warning spam check_folders() check_files() n = Streams(bot) loop = asyncio.get_event_loop() loop.create_task(n.stream_checker()) bot.add_cog(n)
gpl-3.0
[ 504, 4339, 2181, 14, 832, 492, 3718, 199, 504, 1275, 1208, 14, 576, 2090, 492, 666, 2090, 199, 504, 1275, 1208, 14, 10289, 63, 20034, 492, 4772, 63, 11535, 63, 1410, 852, 199, 504, 1275, 1208, 492, 5920, 199, 504, 5055, 492, 10018, 199, 504, 1059, 492, 13294, 63, 16415, 199, 504, 2196, 492, 7141, 199, 646, 4339, 2181, 199, 646, 747, 199, 646, 295, 199, 646, 30274, 199, 646, 16195, 199, 646, 2050, 199, 646, 2022, 421, 199, 533, 8271, 83, 547, 8, 1726, 304, 272, 986, 421, 199, 533, 8271, 4667, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 3261, 547, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 6378, 13428, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 28856, 604, 3296, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 8271, 83, 26, 272, 408, 19358, 339, 437, 16676, 367, 282, 32246, 402, 18490, 8500, 624, 339, 347, 636, 826, 721, 277, 12, 5888, 304, 267, 291, 14, 3018, 275, 5888, 267, 291, 14, 84, 3111, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 84, 3111, 14, 1001, 531, 267, 291, 14, 12948, 1977, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 12948, 1977, 14, 1001, 531, 267, 291, 14, 13979, 281, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 14529, 14, 1001, 531, 267, 291, 14, 12475, 285, 475, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 12475, 285, 475, 14, 1001, 531, 267, 2202, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 1751, 14, 1001, 531, 267, 291, 14, 1751, 275, 10018, 8, 807, 12, 2202, 9, 267, 291, 14, 3431, 63, 1637, 275, 10018, 8, 513, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 9793, 1977, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 9793, 1977, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 12948, 1977, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 12948, 1977, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 8, 1529, 63, 1100, 29, 549, 9, 272, 5316, 347, 307, 3111, 8, 277, 12, 4027, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 307, 3111, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 84, 3111, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 666, 275, 5517, 291, 14, 3535, 63, 84, 3111, 63, 1580, 8, 1745, 12, 746, 63, 692, 63, 3592, 29, 549, 9, 288, 6441, 275, 5517, 291, 14, 84, 3111, 63, 15178, 8, 576, 59, 16, 7541, 63, 344, 3135, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 871, 6378, 13428, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 14919, 26, 6810, 13, 998, 365, 3866, 503, 440, 663, 14, 298, 3044, 298, 9295, 658, 2440, 1745, 409, 307, 3111, 1418, 64, 2, 3044, 10587, 908, 8, 3799, 14, 1861, 430, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 13667, 281, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 13667, 281, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 13979, 281, 4537, 957, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 13979, 281, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 26559, 285, 475, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 26559, 285, 475, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 12475, 285, 475, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 12475, 285, 475, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587 ]
[ 4339, 2181, 14, 832, 492, 3718, 199, 504, 1275, 1208, 14, 576, 2090, 492, 666, 2090, 199, 504, 1275, 1208, 14, 10289, 63, 20034, 492, 4772, 63, 11535, 63, 1410, 852, 199, 504, 1275, 1208, 492, 5920, 199, 504, 5055, 492, 10018, 199, 504, 1059, 492, 13294, 63, 16415, 199, 504, 2196, 492, 7141, 199, 646, 4339, 2181, 199, 646, 747, 199, 646, 295, 199, 646, 30274, 199, 646, 16195, 199, 646, 2050, 199, 646, 2022, 421, 199, 533, 8271, 83, 547, 8, 1726, 304, 272, 986, 421, 199, 533, 8271, 4667, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 3261, 547, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 6378, 13428, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 28856, 604, 3296, 8, 19358, 547, 304, 272, 986, 421, 199, 533, 8271, 83, 26, 272, 408, 19358, 339, 437, 16676, 367, 282, 32246, 402, 18490, 8500, 624, 339, 347, 636, 826, 721, 277, 12, 5888, 304, 267, 291, 14, 3018, 275, 5888, 267, 291, 14, 84, 3111, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 84, 3111, 14, 1001, 531, 267, 291, 14, 12948, 1977, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 12948, 1977, 14, 1001, 531, 267, 291, 14, 13979, 281, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 14529, 14, 1001, 531, 267, 291, 14, 12475, 285, 475, 63, 11231, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 12475, 285, 475, 14, 1001, 531, 267, 2202, 275, 666, 2090, 14, 912, 63, 1001, 480, 576, 15, 11231, 15, 1751, 14, 1001, 531, 267, 291, 14, 1751, 275, 10018, 8, 807, 12, 2202, 9, 267, 291, 14, 3431, 63, 1637, 275, 10018, 8, 513, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 9793, 1977, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 9793, 1977, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 12948, 1977, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 12948, 1977, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 8, 1529, 63, 1100, 29, 549, 9, 272, 5316, 347, 307, 3111, 8, 277, 12, 4027, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 307, 3111, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 84, 3111, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 666, 275, 5517, 291, 14, 3535, 63, 84, 3111, 63, 1580, 8, 1745, 12, 746, 63, 692, 63, 3592, 29, 549, 9, 288, 6441, 275, 5517, 291, 14, 84, 3111, 63, 15178, 8, 576, 59, 16, 7541, 63, 344, 3135, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 871, 6378, 13428, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 14919, 26, 6810, 13, 998, 365, 3866, 503, 440, 663, 14, 298, 3044, 298, 9295, 658, 2440, 1745, 409, 307, 3111, 1418, 64, 2, 3044, 10587, 908, 8, 3799, 14, 1861, 430, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 13667, 281, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 13667, 281, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 13979, 281, 4537, 957, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 13979, 281, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 6427, 29, 6427, 9, 339, 768, 4405, 14, 1531, 342, 272, 5316, 347, 26559, 285, 475, 8, 277, 12, 2547, 26, 620, 304, 267, 408, 11834, 340, 26559, 285, 475, 2547, 365, 18470, 624, 267, 2547, 275, 4772, 63, 11535, 63, 1410, 852, 8, 1745, 9, 267, 5163, 275, 519, 31996, 2859, 8995, 3427, 6307, 15, 5547, 8, 1544, 20316, 8, 12475, 285, 475, 4537, 6993, 19814, 3171, 267, 2547, 275, 295, 14, 954, 8, 3821, 12, 3260, 2547, 9, 267, 862, 26, 288, 6441, 275, 5517, 291, 14, 12475, 285, 475, 63, 15178, 8, 1745, 9, 267, 871, 28856, 604, 3296, 26, 288, 5517, 291, 14, 3018, 14, 19787, 8, 1745, 435, 298, 365, 26302, 2685, 267, 871, 8271, 4667, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 17231, 2547, 3181, 1133, 2187, 2685, 267, 871, 3261, 547, 26, 288, 5517, 291, 14, 3018, 14, 19787, 480, 547, 8966, 316, 314, 3261, 2685, 267, 587, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
you21979/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/common/system/stack_utils.py
215
2734
# Copyright (C) 2011 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Simple routines for logging, obtaining thread stack information.""" import sys import traceback def log_thread_state(logger, name, thread_id, msg=''): """Log information about the given thread state.""" stack = _find_thread_stack(thread_id) assert(stack is not None) logger("") logger("%s (tid %d) %s" % (name, thread_id, msg)) _log_stack(logger, stack) logger("") def _find_thread_stack(thread_id): """Returns a stack object that can be used to dump a stack trace for the given thread id (or None if the id is not found).""" for tid, stack in sys._current_frames().items(): if tid == thread_id: return stack return None def _log_stack(logger, stack): """Log a stack trace to the logger callback.""" for filename, lineno, name, line in traceback.extract_stack(stack): logger('File: "%s", line %d, in %s' % (filename, lineno, name)) if line: logger(' %s' % line.strip()) def log_traceback(logger, tb): stack = traceback.extract_tb(tb) for frame_str in traceback.format_list(stack): for line in frame_str.split('\n'): if line: logger(" %s" % line)
bsd-3-clause
[ 3, 1898, 334, 35, 9, 7760, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 624, 3184, 14975, 367, 2050, 12, 12408, 2462, 3464, 2556, 1041, 199, 199, 646, 984, 199, 646, 5190, 421, 199, 318, 943, 63, 2671, 63, 929, 8, 2921, 12, 536, 12, 2462, 63, 344, 12, 1499, 9280, 272, 408, 2445, 2556, 3595, 314, 1627, 2462, 1174, 1041, 272, 3464, 275, 485, 1623, 63, 2671, 63, 2340, 8, 2671, 63, 344, 9, 272, 702, 8, 2340, 365, 440, 488, 9, 272, 2512, 10804, 272, 2512, 3647, 83, 334, 5700, 450, 68, 9, 450, 83, 2, 450, 334, 354, 12, 2462, 63, 344, 12, 1499, 430, 272, 485, 793, 63, 2340, 8, 2921, 12, 3464, 9, 272, 2512, 10804, 421, 199, 318, 485, 1623, 63, 2671, 63, 2340, 8, 2671, 63, 344, 304, 272, 408, 3407, 282, 3464, 909, 626, 883, 506, 1202, 370, 5461, 282, 3464, 3307, 367, 272, 314, 1627, 2462, 1305, 334, 269, 488, 340, 314, 1305, 365, 440, 1911, 10477, 272, 367, 11559, 12, 3464, 315, 984, 423, 1818, 63, 8444, 1252, 1744, 837, 267, 340, 11559, 508, 2462, 63, 344, 26, 288, 372, 3464, 272, 372, 488, 421, 199, 318, 485, 793, 63, 2340, 8, 2921, 12, 3464, 304, 272, 408, 2445, 282, 3464, 3307, 370, 314, 2512, 3233, 1041, 272, 367, 1788, 12, 5874, 12, 536, 12, 1004, 315, 5190, 14, 5005, 63, 2340, 8, 2340, 304, 267, 2512, 360, 1173, 26, 2071, 83, 401, 1004, 450, 68, 12, 315, 450, 83, 7, 450, 334, 1501, 12, 5874, 12, 536, 430, 267, 340, 1004, 26, 288, 2512, 360, 221, 450, 83, 7, 450, 1004, 14, 1913, 1012, 421, 199, 318, 943, 63, 6894, 8, 2921, 12, 7070, 304, 272, 3464, 275, 5190, 14, 5005, 63, 5842, 8, 5842, 9, 272, 367, 2787, 63, 495, 315, 5190, 14, 908, 63, 513, 8, 2340, 304, 267, 367, 1004, 315, 2787, 63, 495, 14, 1294, 2258, 78, 735, 288, 340, 1004, 26, 355, 2512, 480, 221, 450, 83, 2, 450, 1004, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 334, 35, 9, 7760, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 624, 3184, 14975, 367, 2050, 12, 12408, 2462, 3464, 2556, 1041, 199, 199, 646, 984, 199, 646, 5190, 421, 199, 318, 943, 63, 2671, 63, 929, 8, 2921, 12, 536, 12, 2462, 63, 344, 12, 1499, 9280, 272, 408, 2445, 2556, 3595, 314, 1627, 2462, 1174, 1041, 272, 3464, 275, 485, 1623, 63, 2671, 63, 2340, 8, 2671, 63, 344, 9, 272, 702, 8, 2340, 365, 440, 488, 9, 272, 2512, 10804, 272, 2512, 3647, 83, 334, 5700, 450, 68, 9, 450, 83, 2, 450, 334, 354, 12, 2462, 63, 344, 12, 1499, 430, 272, 485, 793, 63, 2340, 8, 2921, 12, 3464, 9, 272, 2512, 10804, 421, 199, 318, 485, 1623, 63, 2671, 63, 2340, 8, 2671, 63, 344, 304, 272, 408, 3407, 282, 3464, 909, 626, 883, 506, 1202, 370, 5461, 282, 3464, 3307, 367, 272, 314, 1627, 2462, 1305, 334, 269, 488, 340, 314, 1305, 365, 440, 1911, 10477, 272, 367, 11559, 12, 3464, 315, 984, 423, 1818, 63, 8444, 1252, 1744, 837, 267, 340, 11559, 508, 2462, 63, 344, 26, 288, 372, 3464, 272, 372, 488, 421, 199, 318, 485, 793, 63, 2340, 8, 2921, 12, 3464, 304, 272, 408, 2445, 282, 3464, 3307, 370, 314, 2512, 3233, 1041, 272, 367, 1788, 12, 5874, 12, 536, 12, 1004, 315, 5190, 14, 5005, 63, 2340, 8, 2340, 304, 267, 2512, 360, 1173, 26, 2071, 83, 401, 1004, 450, 68, 12, 315, 450, 83, 7, 450, 334, 1501, 12, 5874, 12, 536, 430, 267, 340, 1004, 26, 288, 2512, 360, 221, 450, 83, 7, 450, 1004, 14, 1913, 1012, 421, 199, 318, 943, 63, 6894, 8, 2921, 12, 7070, 304, 272, 3464, 275, 5190, 14, 5005, 63, 5842, 8, 5842, 9, 272, 367, 2787, 63, 495, 315, 5190, 14, 908, 63, 513, 8, 2340, 304, 267, 367, 1004, 315, 2787, 63, 495, 14, 1294, 2258, 78, 735, 288, 340, 1004, 26, 355, 2512, 480, 221, 450, 83, 2, 450, 1004, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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test_psycopg2_dbapi20.py - DB API conformance test for psycopg2 # # Copyright (C) 2006-2011 Federico Di Gregorio <fog@debian.org> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # In addition, as a special exception, the copyright holders give # permission to link this program with the OpenSSL library (or with # modified versions of OpenSSL that use the same license as OpenSSL), # and distribute linked combinations including the two. # # You must obey the GNU Lesser General Public License in all respects for # all of the code used other than OpenSSL. # # psycopg2 is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. import dbapi20 import dbapi20_tpc from testutils import skip_if_tpc_disabled from testutils import unittest, decorate_all_tests import psycopg2 from testconfig import dsn class Psycopg2Tests(dbapi20.DatabaseAPI20Test): driver = psycopg2 connect_args = () connect_kw_args = {'dsn': dsn} lower_func = 'lower' # For stored procedure test def test_setoutputsize(self): # psycopg2's setoutputsize() is a no-op pass def test_nextset(self): # psycopg2 does not implement nextset() pass class Psycopg2TPCTests(dbapi20_tpc.TwoPhaseCommitTests, unittest.TestCase): driver = psycopg2 def connect(self): return psycopg2.connect(dsn=dsn) decorate_all_tests(Psycopg2TPCTests, skip_if_tpc_disabled) def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == '__main__': unittest.main()
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 511, 63, 20270, 18, 63, 22103, 1165, 14, 647, 446, 6249, 3261, 406, 11478, 511, 367, 15492, 18, 199, 3, 199, 3, 1898, 334, 35, 9, 8315, 13, 8128, 7949, 9910, 331, 3757, 29096, 269, 2308, 221, 665, 545, 71, 32, 23204, 14, 1308, 30, 199, 3, 199, 3, 15492, 18, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 844, 465, 3267, 199, 3, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 1010, 10234, 12, 465, 282, 4539, 1919, 12, 314, 4248, 31976, 8120, 199, 3, 4983, 370, 2142, 642, 2240, 543, 314, 14296, 3555, 334, 269, 543, 199, 3, 6042, 5459, 402, 14296, 626, 675, 314, 2011, 4190, 465, 14296, 395, 199, 3, 436, 11207, 10632, 15821, 5893, 314, 2877, 14, 199, 3, 199, 3, 2047, 1471, 312, 32236, 314, 1664, 6401, 1696, 1684, 844, 315, 1006, 14021, 83, 367, 199, 3, 1006, 402, 314, 1233, 1202, 1163, 2419, 14296, 14, 199, 3, 199, 3, 15492, 18, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 367, 1655, 2436, 14, 199, 199, 646, 29333, 1165, 199, 646, 29333, 1165, 63, 683, 67, 199, 504, 511, 1208, 492, 3372, 63, 692, 63, 683, 67, 63, 7011, 199, 504, 511, 1208, 492, 2882, 12, 24774, 63, 452, 63, 2219, 199, 646, 15492, 18, 199, 199, 504, 511, 888, 492, 366, 5167, 199, 199, 533, 510, 1786, 11476, 18, 2925, 8, 22103, 1165, 14, 7243, 3735, 1165, 774, 304, 272, 5253, 275, 15492, 18, 272, 4907, 63, 589, 275, 6248, 272, 4907, 63, 829, 63, 589, 275, 791, 32510, 356, 366, 5167, 93, 339, 5117, 63, 1532, 275, 283, 2325, 7, 327, 2104, 5489, 17782, 511, 339, 347, 511, 63, 409, 1199, 890, 8, 277, 304, 267, 327, 15492, 18, 1159, 663, 1199, 890, 342, 365, 282, 949, 13, 411, 267, 986, 339, 347, 511, 63, 2184, 409, 8, 277, 304, 267, 327, 15492, 18, 1630, 440, 5669, 2163, 409, 342, 267, 986, 421, 199, 533, 510, 1786, 11476, 18, 52, 4222, 2925, 8, 22103, 1165, 63, 683, 67, 14, 11467, 10521, 11421, 2925, 12, 2882, 14, 1746, 304, 272, 5253, 275, 15492, 18, 339, 347, 4907, 8, 277, 304, 267, 372, 15492, 18, 14, 2242, 8, 32510, 29, 32510, 9, 199, 199, 6518, 323, 63, 452, 63, 2219, 8, 48, 1786, 11476, 18, 52, 4222, 2925, 12, 3372, 63, 692, 63, 683, 67, 63, 7011, 9, 421, 199, 318, 511, 63, 5768, 837, 272, 372, 2882, 14, 15824, 1252, 25998, 3460, 354, 3368, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2882, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 511, 63, 20270, 18, 63, 22103, 1165, 14, 647, 446, 6249, 3261, 406, 11478, 511, 367, 15492, 18, 199, 3, 199, 3, 1898, 334, 35, 9, 8315, 13, 8128, 7949, 9910, 331, 3757, 29096, 269, 2308, 221, 665, 545, 71, 32, 23204, 14, 1308, 30, 199, 3, 199, 3, 15492, 18, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 844, 465, 3267, 199, 3, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 1010, 10234, 12, 465, 282, 4539, 1919, 12, 314, 4248, 31976, 8120, 199, 3, 4983, 370, 2142, 642, 2240, 543, 314, 14296, 3555, 334, 269, 543, 199, 3, 6042, 5459, 402, 14296, 626, 675, 314, 2011, 4190, 465, 14296, 395, 199, 3, 436, 11207, 10632, 15821, 5893, 314, 2877, 14, 199, 3, 199, 3, 2047, 1471, 312, 32236, 314, 1664, 6401, 1696, 1684, 844, 315, 1006, 14021, 83, 367, 199, 3, 1006, 402, 314, 1233, 1202, 1163, 2419, 14296, 14, 199, 3, 199, 3, 15492, 18, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 367, 1655, 2436, 14, 199, 199, 646, 29333, 1165, 199, 646, 29333, 1165, 63, 683, 67, 199, 504, 511, 1208, 492, 3372, 63, 692, 63, 683, 67, 63, 7011, 199, 504, 511, 1208, 492, 2882, 12, 24774, 63, 452, 63, 2219, 199, 646, 15492, 18, 199, 199, 504, 511, 888, 492, 366, 5167, 199, 199, 533, 510, 1786, 11476, 18, 2925, 8, 22103, 1165, 14, 7243, 3735, 1165, 774, 304, 272, 5253, 275, 15492, 18, 272, 4907, 63, 589, 275, 6248, 272, 4907, 63, 829, 63, 589, 275, 791, 32510, 356, 366, 5167, 93, 339, 5117, 63, 1532, 275, 283, 2325, 7, 327, 2104, 5489, 17782, 511, 339, 347, 511, 63, 409, 1199, 890, 8, 277, 304, 267, 327, 15492, 18, 1159, 663, 1199, 890, 342, 365, 282, 949, 13, 411, 267, 986, 339, 347, 511, 63, 2184, 409, 8, 277, 304, 267, 327, 15492, 18, 1630, 440, 5669, 2163, 409, 342, 267, 986, 421, 199, 533, 510, 1786, 11476, 18, 52, 4222, 2925, 8, 22103, 1165, 63, 683, 67, 14, 11467, 10521, 11421, 2925, 12, 2882, 14, 1746, 304, 272, 5253, 275, 15492, 18, 339, 347, 4907, 8, 277, 304, 267, 372, 15492, 18, 14, 2242, 8, 32510, 29, 32510, 9, 199, 199, 6518, 323, 63, 452, 63, 2219, 8, 48, 1786, 11476, 18, 52, 4222, 2925, 12, 3372, 63, 692, 63, 683, 67, 63, 7011, 9, 421, 199, 318, 511, 63, 5768, 837, 272, 372, 2882, 14, 15824, 1252, 25998, 3460, 354, 3368, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2882, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
jfzazo/wireshark-hwgen
src/tools/make-dissector-reg.py
35
9061
#!/usr/bin/env python # # Looks for registration routines in the protocol dissectors, # and assembles C code to call all the routines. # # This is a Python version of the make-reg-dotc shell script. # Running the shell script on Win32 is very very slow because of # all the process-launching that goes on --- multiple greps and # seds for each input file. I wrote this python version so that # less processes would have to be started. import os import sys import re import pickle import hashlib from stat import * VERSION_KEY = '_VERSION' CUR_VERSION = '$Id$' # # The first argument is the directory in which the source files live. # srcdir = sys.argv[1] # # The second argument is either "plugin" or "dissectors"; if it's # "plugin", we build a plugin.c for a plugin, and if it's # "dissectors", we build a register.c for libwireshark. # registertype = sys.argv[2] if registertype in ("plugin", "plugin_wtap"): final_filename = "plugin.c" cache_filename = None preamble = """\ /* * Do not modify this file. Changes will be overwritten. * * Generated automatically from %s. */ """ % (sys.argv[0]) elif registertype in ("dissectors", "dissectorsinfile"): final_filename = "register.c" cache_filename = "register-cache.pkl" preamble = """\ /* * Do not modify this file. Changes will be overwritten. * * Generated automatically by the "register.c" target in * epan/dissectors/Makefile or Makefile.nmake using * %s * and information in epan/dissectors/register-cache.pkl. * * You can force this file to be regenerated completely by deleting * it along with epan/dissectors/register-cache.pkl. */ """ % (sys.argv[0]) else: print(("Unknown output type '%s'" % registertype)) sys.exit(1) # # All subsequent arguments are the files to scan # or the name of a file containing the files to scan # if registertype == "dissectorsinfile": try: dissector_f = open(sys.argv[3]) except IOError: print(("Unable to open input file '%s'" % sys.argv[3])) sys.exit(1) files = [line.rstrip() for line in dissector_f] else: files = sys.argv[3:] # Create the proper list of filenames filenames = [] for file in files: if os.path.isfile(file): filenames.append(file) else: filenames.append(os.path.join(srcdir, file)) if len(filenames) < 1: print("No files found") sys.exit(1) # Look through all files, applying the regex to each line. # If the pattern matches, save the "symbol" section to the # appropriate set. regs = { 'proto_reg': set(), 'handoff_reg': set(), 'wtap_register': set(), } # For those that don't know Python, r"" indicates a raw string, # devoid of Python escapes. proto_regex = r"(?P<symbol>proto_register_[_A-Za-z0-9]+)\s*\(\s*void\s*\)[^;]*$" handoff_regex = r"(?P<symbol>proto_reg_handoff_[_A-Za-z0-9]+)\s*\(\s*void\s*\)[^;]*$" wtap_reg_regex = r"(?P<symbol>wtap_register_[_A-Za-z0-9]+)\s*\([^;]+$" # This table drives the pattern-matching and symbol-harvesting patterns = [ ( 'proto_reg', re.compile(proto_regex, re.MULTILINE) ), ( 'handoff_reg', re.compile(handoff_regex, re.MULTILINE) ), ( 'wtap_register', re.compile(wtap_reg_regex, re.MULTILINE) ), ] # Open our registration symbol cache cache = None if cache_filename: try: cache_file = open(cache_filename, 'rb') cache = pickle.load(cache_file) cache_file.close() if VERSION_KEY not in cache or cache[VERSION_KEY] != CUR_VERSION: cache = {VERSION_KEY: CUR_VERSION} except: cache = {VERSION_KEY: CUR_VERSION} print(("Registering %d files, %d cached" % (len(filenames), len(list(cache.keys()))-1))) # Grep cache_hits = 0 cache_misses = 0 for filename in filenames: file = open(filename) cur_mtime = os.fstat(file.fileno())[ST_MTIME] if cache and filename in cache: cdict = cache[filename] if cur_mtime == cdict['mtime']: cache_hits += 1 # print "Pulling %s from cache" % (filename) regs['proto_reg'] |= set(cdict['proto_reg']) regs['handoff_reg'] |= set(cdict['handoff_reg']) regs['wtap_register'] |= set(cdict['wtap_register']) file.close() continue # We don't have a cache entry if cache is not None: cache_misses += 1 cache[filename] = { 'mtime': cur_mtime, 'proto_reg': [], 'handoff_reg': [], 'wtap_register': [], } # print "Searching %s" % (filename) # Read the whole file into memory contents = file.read() for action in patterns: regex = action[1] for match in regex.finditer(contents): symbol = match.group("symbol") sym_type = action[0] regs[sym_type].add(symbol) if cache is not None: # print "Caching %s for %s: %s" % (sym_type, filename, symbol) cache[filename][sym_type].append(symbol) # We're done with the file contents contets = "" file.close() if cache is not None and cache_filename is not None: cache_file = open(cache_filename, 'wb') pickle.dump(cache, cache_file) cache_file.close() print(("Cache hits: %d, misses: %d" % (cache_hits, cache_misses))) # Make sure we actually processed something if len(regs['proto_reg']) < 1: print("No protocol registrations found") sys.exit(1) # Convert the sets into sorted lists to make the output pretty regs['proto_reg'] = sorted(regs['proto_reg']) regs['handoff_reg'] = sorted(regs['handoff_reg']) regs['wtap_register'] = sorted(regs['wtap_register']) reg_code = "" reg_code += preamble # Make the routine to register all protocols if registertype == "plugin" or registertype == "plugin_wtap": reg_code += """ #include "config.h" #include <gmodule.h> #include "moduleinfo.h" /* plugins are DLLs */ #define WS_BUILD_DLL #include "ws_symbol_export.h" #ifndef ENABLE_STATIC WS_DLL_PUBLIC_DEF void plugin_register (void); WS_DLL_PUBLIC_DEF const gchar version[] = VERSION; /* Start the functions we need for the plugin stuff */ WS_DLL_PUBLIC_DEF void plugin_register (void) { """ else: reg_code += """ #include "register.h" void register_all_protocols(register_cb cb, gpointer client_data) { """ for symbol in regs['proto_reg']: if registertype == "plugin" or registertype == "plugin_wtap": reg_code += " {extern void %s (void); %s ();}\n" % (symbol, symbol) else: reg_code += " {extern void %s (void); if(cb) (*cb)(RA_REGISTER, \"%s\", client_data); %s ();}\n" % (symbol, symbol, symbol) reg_code += "}\n" # Make the routine to register all protocol handoffs if registertype == "plugin" or registertype == "plugin_wtap": reg_code += """ WS_DLL_PUBLIC_DEF void plugin_reg_handoff(void); WS_DLL_PUBLIC_DEF void plugin_reg_handoff(void) { """ else: reg_code += """ void register_all_protocol_handoffs(register_cb cb, gpointer client_data) { """ for symbol in regs['handoff_reg']: if registertype == "plugin" or registertype == "plugin_wtap": reg_code += " {extern void %s (void); %s ();}\n" % (symbol, symbol) else: reg_code += " {extern void %s (void); if(cb) (*cb)(RA_HANDOFF, \"%s\", client_data); %s ();}\n" % (symbol, symbol, symbol) reg_code += "}\n" if registertype == "plugin": reg_code += "#endif\n" elif registertype == "plugin_wtap": reg_code += """ WS_DLL_PUBLIC_DEF void register_wtap_module(void) { """ for symbol in regs['wtap_register']: line = " {extern void %s (void); %s ();}\n" % (symbol, symbol) reg_code += line reg_code += """ } #endif """ else: reg_code += """ static gulong proto_reg_count(void) { return %(proto_reg_len)d; } static gulong handoff_reg_count(void) { return %(handoff_reg_len)d; } gulong register_count(void) { return proto_reg_count() + handoff_reg_count(); } """ % { 'proto_reg_len': len(regs['proto_reg']), 'handoff_reg_len': len(regs['handoff_reg']) } # Compare current and new content and update the file if anything has changed. try: # Python >= 2.6, >= 3.0 reg_code_bytes = bytes(reg_code.encode('utf-8')) except: reg_code_bytes = reg_code new_hash = hashlib.sha1(reg_code_bytes).hexdigest() try: fh = open(final_filename, 'rb') cur_hash = hashlib.sha1(fh.read()).hexdigest() fh.close() except: cur_hash = '' try: if new_hash != cur_hash: print(('Updating ' + final_filename)) fh = open(final_filename, 'w') fh.write(reg_code) fh.close() else: print((final_filename + ' unchanged.')) os.utime(final_filename, None) except OSError: sys.exit('Unable to write ' + final_filename + '.\n') # # Editor modelines - http://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 4 # indent-tabs-mode: nil # End: # # vi: set shiftwidth=4 expandtab: # :indentSize=4:noTabs=true: #
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 12077, 83, 367, 10991, 14975, 315, 314, 4113, 2153, 261, 13451, 12, 199, 3, 436, 22931, 83, 445, 1233, 370, 1240, 1006, 314, 14975, 14, 199, 3, 199, 3, 961, 365, 282, 2018, 1015, 402, 314, 1852, 13, 1135, 13, 3287, 67, 5218, 2884, 14, 199, 3, 26848, 314, 5218, 2884, 641, 13036, 708, 365, 7437, 7437, 11999, 2952, 402, 199, 3, 1006, 314, 2112, 13, 9850, 316, 626, 13538, 641, 10894, 3663, 20595, 83, 436, 199, 3, 542, 795, 367, 1924, 1324, 570, 14, 221, 473, 336, 22665, 642, 2366, 1015, 880, 626, 199, 3, 6656, 10358, 3955, 1172, 370, 506, 8239, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 295, 199, 646, 5927, 199, 646, 8337, 199, 504, 5672, 492, 627, 199, 199, 4612, 63, 3078, 275, 2513, 4612, 7, 199, 7013, 63, 4612, 275, 4505, 1304, 12913, 199, 199, 3, 199, 3, 710, 1642, 1423, 365, 314, 2082, 315, 1314, 314, 1350, 1584, 12166, 14, 199, 3, 199, 17878, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 3, 199, 3, 710, 3499, 1423, 365, 1902, 298, 2718, 2, 503, 298, 2297, 261, 13451, 11436, 340, 652, 1159, 199, 3, 298, 2718, 401, 781, 1900, 282, 3589, 14, 67, 367, 282, 3589, 12, 436, 340, 652, 1159, 199, 3, 298, 2297, 261, 13451, 401, 781, 1900, 282, 2274, 14, 67, 367, 1973, 14249, 2107, 1096, 14, 199, 3, 199, 2683, 466, 275, 984, 14, 3020, 59, 18, 61, 199, 692, 2274, 466, 315, 1689, 2718, 401, 298, 2718, 63, 9115, 439, 2349, 272, 4242, 63, 1501, 275, 298, 2718, 14, 67, 2, 272, 2581, 63, 1501, 275, 488, 272, 19789, 275, 9638, 199, 6331, 199, 627, 4226, 440, 2811, 642, 570, 14, 18784, 911, 506, 20200, 14, 199, 627, 199, 627, 17065, 5847, 687, 450, 83, 14, 199, 11589, 199, 624, 450, 334, 1274, 14, 3020, 59, 16, 566, 199, 4164, 2274, 466, 315, 1689, 2297, 261, 13451, 401, 298, 2297, 22029, 5911, 493, 2349, 272, 4242, 63, 1501, 275, 298, 2683, 14, 67, 2, 272, 2581, 63, 1501, 275, 298, 2683, 13, 1637, 14, 23947, 2, 272, 19789, 275, 9638, 199, 6331, 199, 627, 4226, 440, 2811, 642, 570, 14, 18784, 911, 506, 20200, 14, 199, 627, 199, 627, 17065, 5847, 701, 314, 298, 2683, 14, 67, 2, 1347, 315, 199, 627, 5442, 290, 15, 2297, 261, 13451, 15, 19878, 503, 20618, 14, 78, 1875, 1808, 199, 627, 450, 83, 199, 627, 436, 2556, 315, 5442, 290, 15, 2297, 261, 13451, 15, 2683, 13, 1637, 14, 23947, 14, 199, 627, 199, 627, 2047, 883, 3542, 642, 570, 370, 506, 31904, 14793, 701, 13794, 199, 627, 652, 3180, 543, 5442, 290, 15, 2297, 261, 13451, 15, 2683, 13, 1637, 14, 23947, 14, 199, 11589, 199, 624, 450, 334, 1274, 14, 3020, 59, 16, 566, 199, 2836, 26, 272, 870, 9313, 5912, 1072, 730, 1543, 83, 4065, 450, 2274, 466, 430, 272, 984, 14, 2224, 8, 17, 9, 421, 199, 3, 199, 3, 2900, 13372, 2368, 787, 314, 1584, 370, 8000, 199, 3, 503, 314, 536, 402, 282, 570, 3035, 314, 1584, 370, 8000, 199, 3, 199, 692, 2274, 466, 508, 298, 2297, 22029, 5911, 493, 582, 272, 862, 26, 267, 2153, 22029, 63, 70, 275, 1551, 8, 1274, 14, 3020, 59, 19, 566, 272, 871, 5925, 26, 267, 870, 9313, 6005, 370, 1551, 1324, 570, 1543, 83, 4065, 450, 984, 14, 3020, 59, 19, 2459, 267, 984, 14, 2224, 8, 17, 9, 339, 1584, 275, 359, 604, 14, 6735, 342, 367, 1004, 315, 2153, 22029, 63, 70, 61, 199, 2836, 26, 272, 1584, 275, 984, 14, 3020, 59, 19, 2938, 199, 199, 3, 2790, 314, 5576, 769, 402, 6203, 199, 10309, 275, 942, 199, 509, 570, 315, 1584, 26, 272, 340, 747, 14, 515, 14, 6292, 8, 493, 304, 267, 6203, 14, 740, 8, 493, 9, 272, 587, 26, 267, 6203, 14, 740, 8, 736, 14, 515, 14, 904, 8, 17878, 12, 570, 430, 199, 199, 692, 822, 8, 10309, 9, 665, 413, 26, 272, 870, 480, 1944, 1584, 1911, 531, 272, 984, 14, 2224, 8, 17, 9, 421, 199, 3, 12077, 4012, 1006, 1584, 12, 18876, 314, 5163, 370, 1924, 1004, 14, 199, 3, 982, 314, 3851, 4450, 12, 3354, 314, 298, 5155, 2, 3420, 370, 314, 199, 3, 5827, 663, 14, 199, 23957, 275, 469, 267, 283, 2625, 63, 1135, 356, 663, 1062, 267, 283, 6868, 1997, 63, 1135, 356, 663, 1062, 267, 283, 9115, 439, 63, 2683, 356, 663, 1062, 267, 789, 199, 199, 3, 2104, 5204, 626, 2793, 1133, 5715, 2018, 12, 519, 341, 9126, 282, 3066, 1059, 12, 199, 3, 477, 1647, 402, 2018, 24644, 14, 199, 2625, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 2625, 63, 2683, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 2961, 83, 10, 1647, 60, 83, 7590, 2788, 62, 27, 3672, 17351, 199, 199, 6868, 1997, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 2625, 63, 1135, 63, 6868, 1997, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 2961, 83, 10, 1647, 60, 83, 7590, 2788, 62, 27, 3672, 17351, 199, 199, 9115, 439, 63, 1135, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 9115, 439, 63, 2683, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 7059, 27, 2807, 17351, 199, 199, 3, 961, 1817, 20921, 2310, 314, 3851, 13, 9467, 436, 5272, 13, 32222, 316, 199, 7435, 275, 359, 267, 334, 283, 2625, 63, 1135, 297, 295, 14, 2014, 8, 2625, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 334, 283, 6868, 1997, 63, 1135, 297, 295, 14, 2014, 8, 6868, 1997, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 334, 283, 9115, 439, 63, 2683, 297, 295, 14, 2014, 8, 9115, 439, 63, 1135, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 1622, 199, 199, 3, 3232, 4154, 10991, 5272, 2581, 199, 1637, 275, 488, 199, 692, 2581, 63, 1501, 26, 272, 862, 26, 267, 2581, 63, 493, 275, 1551, 8, 1637, 63 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 12077, 83, 367, 10991, 14975, 315, 314, 4113, 2153, 261, 13451, 12, 199, 3, 436, 22931, 83, 445, 1233, 370, 1240, 1006, 314, 14975, 14, 199, 3, 199, 3, 961, 365, 282, 2018, 1015, 402, 314, 1852, 13, 1135, 13, 3287, 67, 5218, 2884, 14, 199, 3, 26848, 314, 5218, 2884, 641, 13036, 708, 365, 7437, 7437, 11999, 2952, 402, 199, 3, 1006, 314, 2112, 13, 9850, 316, 626, 13538, 641, 10894, 3663, 20595, 83, 436, 199, 3, 542, 795, 367, 1924, 1324, 570, 14, 221, 473, 336, 22665, 642, 2366, 1015, 880, 626, 199, 3, 6656, 10358, 3955, 1172, 370, 506, 8239, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 295, 199, 646, 5927, 199, 646, 8337, 199, 504, 5672, 492, 627, 199, 199, 4612, 63, 3078, 275, 2513, 4612, 7, 199, 7013, 63, 4612, 275, 4505, 1304, 12913, 199, 199, 3, 199, 3, 710, 1642, 1423, 365, 314, 2082, 315, 1314, 314, 1350, 1584, 12166, 14, 199, 3, 199, 17878, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 3, 199, 3, 710, 3499, 1423, 365, 1902, 298, 2718, 2, 503, 298, 2297, 261, 13451, 11436, 340, 652, 1159, 199, 3, 298, 2718, 401, 781, 1900, 282, 3589, 14, 67, 367, 282, 3589, 12, 436, 340, 652, 1159, 199, 3, 298, 2297, 261, 13451, 401, 781, 1900, 282, 2274, 14, 67, 367, 1973, 14249, 2107, 1096, 14, 199, 3, 199, 2683, 466, 275, 984, 14, 3020, 59, 18, 61, 199, 692, 2274, 466, 315, 1689, 2718, 401, 298, 2718, 63, 9115, 439, 2349, 272, 4242, 63, 1501, 275, 298, 2718, 14, 67, 2, 272, 2581, 63, 1501, 275, 488, 272, 19789, 275, 9638, 199, 6331, 199, 627, 4226, 440, 2811, 642, 570, 14, 18784, 911, 506, 20200, 14, 199, 627, 199, 627, 17065, 5847, 687, 450, 83, 14, 199, 11589, 199, 624, 450, 334, 1274, 14, 3020, 59, 16, 566, 199, 4164, 2274, 466, 315, 1689, 2297, 261, 13451, 401, 298, 2297, 22029, 5911, 493, 2349, 272, 4242, 63, 1501, 275, 298, 2683, 14, 67, 2, 272, 2581, 63, 1501, 275, 298, 2683, 13, 1637, 14, 23947, 2, 272, 19789, 275, 9638, 199, 6331, 199, 627, 4226, 440, 2811, 642, 570, 14, 18784, 911, 506, 20200, 14, 199, 627, 199, 627, 17065, 5847, 701, 314, 298, 2683, 14, 67, 2, 1347, 315, 199, 627, 5442, 290, 15, 2297, 261, 13451, 15, 19878, 503, 20618, 14, 78, 1875, 1808, 199, 627, 450, 83, 199, 627, 436, 2556, 315, 5442, 290, 15, 2297, 261, 13451, 15, 2683, 13, 1637, 14, 23947, 14, 199, 627, 199, 627, 2047, 883, 3542, 642, 570, 370, 506, 31904, 14793, 701, 13794, 199, 627, 652, 3180, 543, 5442, 290, 15, 2297, 261, 13451, 15, 2683, 13, 1637, 14, 23947, 14, 199, 11589, 199, 624, 450, 334, 1274, 14, 3020, 59, 16, 566, 199, 2836, 26, 272, 870, 9313, 5912, 1072, 730, 1543, 83, 4065, 450, 2274, 466, 430, 272, 984, 14, 2224, 8, 17, 9, 421, 199, 3, 199, 3, 2900, 13372, 2368, 787, 314, 1584, 370, 8000, 199, 3, 503, 314, 536, 402, 282, 570, 3035, 314, 1584, 370, 8000, 199, 3, 199, 692, 2274, 466, 508, 298, 2297, 22029, 5911, 493, 582, 272, 862, 26, 267, 2153, 22029, 63, 70, 275, 1551, 8, 1274, 14, 3020, 59, 19, 566, 272, 871, 5925, 26, 267, 870, 9313, 6005, 370, 1551, 1324, 570, 1543, 83, 4065, 450, 984, 14, 3020, 59, 19, 2459, 267, 984, 14, 2224, 8, 17, 9, 339, 1584, 275, 359, 604, 14, 6735, 342, 367, 1004, 315, 2153, 22029, 63, 70, 61, 199, 2836, 26, 272, 1584, 275, 984, 14, 3020, 59, 19, 2938, 199, 199, 3, 2790, 314, 5576, 769, 402, 6203, 199, 10309, 275, 942, 199, 509, 570, 315, 1584, 26, 272, 340, 747, 14, 515, 14, 6292, 8, 493, 304, 267, 6203, 14, 740, 8, 493, 9, 272, 587, 26, 267, 6203, 14, 740, 8, 736, 14, 515, 14, 904, 8, 17878, 12, 570, 430, 199, 199, 692, 822, 8, 10309, 9, 665, 413, 26, 272, 870, 480, 1944, 1584, 1911, 531, 272, 984, 14, 2224, 8, 17, 9, 421, 199, 3, 12077, 4012, 1006, 1584, 12, 18876, 314, 5163, 370, 1924, 1004, 14, 199, 3, 982, 314, 3851, 4450, 12, 3354, 314, 298, 5155, 2, 3420, 370, 314, 199, 3, 5827, 663, 14, 199, 23957, 275, 469, 267, 283, 2625, 63, 1135, 356, 663, 1062, 267, 283, 6868, 1997, 63, 1135, 356, 663, 1062, 267, 283, 9115, 439, 63, 2683, 356, 663, 1062, 267, 789, 199, 199, 3, 2104, 5204, 626, 2793, 1133, 5715, 2018, 12, 519, 341, 9126, 282, 3066, 1059, 12, 199, 3, 477, 1647, 402, 2018, 24644, 14, 199, 2625, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 2625, 63, 2683, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 2961, 83, 10, 1647, 60, 83, 7590, 2788, 62, 27, 3672, 17351, 199, 199, 6868, 1997, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 2625, 63, 1135, 63, 6868, 1997, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 2961, 83, 10, 1647, 60, 83, 7590, 2788, 62, 27, 3672, 17351, 199, 199, 9115, 439, 63, 1135, 63, 3821, 275, 519, 24726, 48, 28, 5155, 30, 9115, 439, 63, 2683, 9925, 63, 33, 13, 13163, 13, 90, 16, 13, 25, 18096, 83, 7590, 7059, 27, 2807, 17351, 199, 199, 3, 961, 1817, 20921, 2310, 314, 3851, 13, 9467, 436, 5272, 13, 32222, 316, 199, 7435, 275, 359, 267, 334, 283, 2625, 63, 1135, 297, 295, 14, 2014, 8, 2625, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 334, 283, 6868, 1997, 63, 1135, 297, 295, 14, 2014, 8, 6868, 1997, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 334, 283, 9115, 439, 63, 2683, 297, 295, 14, 2014, 8, 9115, 439, 63, 1135, 63, 3821, 12, 295, 14, 16661, 9, 2318, 267, 1622, 199, 199, 3, 3232, 4154, 10991, 5272, 2581, 199, 1637, 275, 488, 199, 692, 2581, 63, 1501, 26, 272, 862, 26, 267, 2581, 63, 493, 275, 1551, 8, 1637, 63, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
lilleswing/deepchem
examples/hiv/hiv_irv.py
6
1107
""" Script that trains multitask models on hiv dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np import deepchem as dc from deepchem.molnet import load_hiv # Only for debug! np.random.seed(123) # Load hiv dataset n_features = 512 hiv_tasks, hiv_datasets, transformers = load_hiv() train_dataset, valid_dataset, test_dataset = hiv_datasets # Fit models metric = dc.metrics.Metric(dc.metrics.roc_auc_score, np.mean) transformer = dc.trans.IRVTransformer(10, len(hiv_tasks), train_dataset) train_dataset = transformer.transform(train_dataset) valid_dataset = transformer.transform(valid_dataset) model = dc.models.TensorflowMultitaskIRVClassifier( len(hiv_tasks), K=10, batch_size=50, learning_rate=0.001) # Fit trained model model.fit(train_dataset) print("Evaluating model") train_scores = model.evaluate(train_dataset, [metric], transformers) valid_scores = model.evaluate(valid_dataset, [metric], transformers) print("Train scores") print(train_scores) print("Validation scores") print(valid_scores)
mit
[ 624, 199, 5229, 626, 3560, 83, 3510, 1765, 1709, 641, 394, 1003, 4789, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2680, 465, 980, 199, 646, 13217, 24448, 465, 12326, 199, 504, 13217, 24448, 14, 16924, 846, 492, 2248, 63, 72, 1003, 199, 199, 3, 5972, 367, 3105, 1, 199, 1590, 14, 2355, 14, 5176, 8, 4288, 9, 199, 199, 3, 7190, 394, 1003, 4789, 199, 78, 63, 3179, 275, 10574, 199, 72, 1003, 63, 5054, 12, 394, 1003, 63, 12281, 12, 1752, 22932, 275, 2248, 63, 72, 1003, 342, 199, 2834, 63, 5214, 12, 1686, 63, 5214, 12, 511, 63, 5214, 275, 394, 1003, 63, 12281, 199, 199, 3, 25971, 1709, 199, 5165, 275, 12326, 14, 6759, 14, 11119, 8, 3833, 14, 6759, 14, 26786, 63, 19129, 63, 3397, 12, 980, 14, 3670, 9, 199, 199, 19754, 275, 12326, 14, 1515, 14, 3927, 54, 19761, 8, 709, 12, 822, 8, 72, 1003, 63, 5054, 395, 3560, 63, 5214, 9, 199, 2834, 63, 5214, 275, 21484, 14, 4711, 8, 2834, 63, 5214, 9, 199, 1078, 63, 5214, 275, 21484, 14, 4711, 8, 1078, 63, 5214, 9, 199, 199, 1238, 275, 12326, 14, 992, 14, 3861, 1659, 3947, 1765, 3927, 54, 8508, 8, 272, 822, 8, 72, 1003, 63, 5054, 395, 1804, 29, 709, 12, 3522, 63, 890, 29, 1400, 12, 9328, 63, 1866, 29, 16, 14, 4587, 9, 199, 199, 3, 25971, 28161, 1402, 199, 1238, 14, 3269, 8, 2834, 63, 5214, 9, 199, 199, 1361, 480, 10006, 85, 1958, 1402, 531, 199, 2834, 63, 7107, 275, 1402, 14, 7383, 8, 2834, 63, 5214, 12, 359, 5165, 467, 1752, 22932, 9, 199, 1078, 63, 7107, 275, 1402, 14, 7383, 8, 1078, 63, 5214, 12, 359, 5165, 467, 1752, 22932, 9, 199, 199, 1361, 480, 18591, 9342, 531, 199, 1361, 8, 2834, 63, 7107, 9, 199, 199, 1361, 480, 13816, 9342, 531, 199, 1361, 8, 1078, 63, 7107, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 5229, 626, 3560, 83, 3510, 1765, 1709, 641, 394, 1003, 4789, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2680, 465, 980, 199, 646, 13217, 24448, 465, 12326, 199, 504, 13217, 24448, 14, 16924, 846, 492, 2248, 63, 72, 1003, 199, 199, 3, 5972, 367, 3105, 1, 199, 1590, 14, 2355, 14, 5176, 8, 4288, 9, 199, 199, 3, 7190, 394, 1003, 4789, 199, 78, 63, 3179, 275, 10574, 199, 72, 1003, 63, 5054, 12, 394, 1003, 63, 12281, 12, 1752, 22932, 275, 2248, 63, 72, 1003, 342, 199, 2834, 63, 5214, 12, 1686, 63, 5214, 12, 511, 63, 5214, 275, 394, 1003, 63, 12281, 199, 199, 3, 25971, 1709, 199, 5165, 275, 12326, 14, 6759, 14, 11119, 8, 3833, 14, 6759, 14, 26786, 63, 19129, 63, 3397, 12, 980, 14, 3670, 9, 199, 199, 19754, 275, 12326, 14, 1515, 14, 3927, 54, 19761, 8, 709, 12, 822, 8, 72, 1003, 63, 5054, 395, 3560, 63, 5214, 9, 199, 2834, 63, 5214, 275, 21484, 14, 4711, 8, 2834, 63, 5214, 9, 199, 1078, 63, 5214, 275, 21484, 14, 4711, 8, 1078, 63, 5214, 9, 199, 199, 1238, 275, 12326, 14, 992, 14, 3861, 1659, 3947, 1765, 3927, 54, 8508, 8, 272, 822, 8, 72, 1003, 63, 5054, 395, 1804, 29, 709, 12, 3522, 63, 890, 29, 1400, 12, 9328, 63, 1866, 29, 16, 14, 4587, 9, 199, 199, 3, 25971, 28161, 1402, 199, 1238, 14, 3269, 8, 2834, 63, 5214, 9, 199, 199, 1361, 480, 10006, 85, 1958, 1402, 531, 199, 2834, 63, 7107, 275, 1402, 14, 7383, 8, 2834, 63, 5214, 12, 359, 5165, 467, 1752, 22932, 9, 199, 1078, 63, 7107, 275, 1402, 14, 7383, 8, 1078, 63, 5214, 12, 359, 5165, 467, 1752, 22932, 9, 199, 199, 1361, 480, 18591, 9342, 531, 199, 1361, 8, 2834, 63, 7107, 9, 199, 199, 1361, 480, 13816, 9342, 531, 199, 1361, 8, 1078, 63, 7107, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
alivecor/tensorflow
tensorflow/python/training/server_lib_sparse_job_test.py
133
1605
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for tf.GrpcServer.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops from tensorflow.python.platform import test from tensorflow.python.training import server_lib class SparseJobTest(test.TestCase): # TODO(b/34465411): Starting multiple servers with different configurations # in the same test is flaky. Move this test case back into # "server_lib_test.py" when this is no longer the case. def testSparseJob(self): server = server_lib.Server({"local": {37: "localhost:0"}}) with ops.device("/job:local/task:37"): a = constant_op.constant(1.0) with session.Session(server.target) as sess: self.assertEqual(1.0, sess.run(a)) if __name__ == "__main__": test.main()
apache-2.0
[ 3, 1898, 9708, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 2925, 367, 2833, 14, 39, 4354, 3120, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 3228, 14, 1548, 14, 1258, 492, 2351, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4413, 63, 411, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1654, 63, 773, 421, 199, 533, 14531, 6694, 774, 8, 396, 14, 1746, 304, 819, 327, 3254, 8, 66, 15, 1082, 2466, 1477, 845, 304, 24175, 3663, 8037, 543, 3365, 13422, 523, 327, 315, 314, 2011, 511, 365, 17566, 10562, 14, 14171, 642, 511, 1930, 1771, 1901, 523, 327, 298, 1000, 63, 773, 63, 396, 14, 647, 2, 1380, 642, 365, 949, 8088, 314, 1930, 14, 523, 347, 511, 8629, 6694, 8, 277, 304, 272, 1654, 275, 1654, 63, 773, 14, 3120, 6333, 1832, 582, 469, 1401, 26, 298, 5967, 26, 16, 3570, 1552, 272, 543, 4156, 14, 1782, 4769, 2423, 26, 1832, 15, 1765, 26, 1401, 2349, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 17, 14, 16, 9, 339, 543, 2351, 14, 4434, 8, 1000, 14, 1375, 9, 465, 4043, 26, 489, 291, 14, 629, 8, 17, 14, 16, 12, 4043, 14, 1065, 8, 65, 430, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 511, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 9708, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 2925, 367, 2833, 14, 39, 4354, 3120, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 3228, 14, 1548, 14, 1258, 492, 2351, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4413, 63, 411, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1654, 63, 773, 421, 199, 533, 14531, 6694, 774, 8, 396, 14, 1746, 304, 819, 327, 3254, 8, 66, 15, 1082, 2466, 1477, 845, 304, 24175, 3663, 8037, 543, 3365, 13422, 523, 327, 315, 314, 2011, 511, 365, 17566, 10562, 14, 14171, 642, 511, 1930, 1771, 1901, 523, 327, 298, 1000, 63, 773, 63, 396, 14, 647, 2, 1380, 642, 365, 949, 8088, 314, 1930, 14, 523, 347, 511, 8629, 6694, 8, 277, 304, 272, 1654, 275, 1654, 63, 773, 14, 3120, 6333, 1832, 582, 469, 1401, 26, 298, 5967, 26, 16, 3570, 1552, 272, 543, 4156, 14, 1782, 4769, 2423, 26, 1832, 15, 1765, 26, 1401, 2349, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 17, 14, 16, 9, 339, 543, 2351, 14, 4434, 8, 1000, 14, 1375, 9, 465, 4043, 26, 489, 291, 14, 629, 8, 17, 14, 16, 12, 4043, 14, 1065, 8, 65, 430, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 511, 14, 973, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
cloudera/hue
desktop/core/ext-py/cx_Oracle-6.4.1/samples/DatabaseShutdown.py
2
1412
#------------------------------------------------------------------------------ # Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved. # # Portions Copyright 2007-2015, Anthony Tuininga. All rights reserved. # # Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta, # Canada. All rights reserved. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # DatabaseShutdown.py # This script demonstrates shutting down a database using Python. It is only # possible in Oracle 10g Release 2 and higher. The connection used assumes that # the environment variable ORACLE_SID has been set. # # This script requires cx_Oracle 4.3 and higher. #------------------------------------------------------------------------------ import cx_Oracle # need to connect as SYSDBA or SYSOPER connection = cx_Oracle.connect("/", mode = cx_Oracle.SYSDBA) # first shutdown() call must specify the mode, if DBSHUTDOWN_ABORT is used, # there is no need for any of the other steps connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_IMMEDIATE) # now close and dismount the database cursor = connection.cursor() cursor.execute("alter database close normal") cursor.execute("alter database dismount") # perform the final shutdown call connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_FINAL)
apache-2.0
[ 20974, 199, 3, 1898, 7800, 12, 9708, 12, 15309, 436, 15, 269, 2399, 29172, 2335, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 20825, 1898, 10219, 13, 7806, 12, 1626, 898, 89, 377, 85, 7969, 65, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 20825, 1898, 12521, 13, 9488, 12, 3599, 5373, 1148, 334, 6049, 10641, 9, 12126, 2020, 17379, 2106, 1860, 12, 4580, 605, 502, 12, 199, 3, 6855, 10641, 14, 2900, 4481, 4644, 14, 199, 20974, 199, 199, 20974, 199, 3, 8692, 20043, 14, 647, 199, 3, 257, 961, 2884, 23789, 31216, 24761, 1337, 3224, 282, 3050, 1808, 2018, 14, 2779, 365, 1454, 199, 3, 3962, 315, 15309, 1616, 71, 17646, 499, 436, 10948, 14, 710, 1950, 1202, 15194, 626, 199, 3, 314, 3734, 1750, 1549, 1348, 906, 63, 19514, 965, 2757, 663, 14, 199, 3, 199, 3, 961, 2884, 5074, 17280, 63, 21202, 841, 14, 19, 436, 10948, 14, 199, 20974, 199, 199, 646, 17280, 63, 21202, 199, 199, 3, 1929, 370, 4907, 465, 10046, 51, 2846, 33, 503, 10046, 51, 15598, 199, 2105, 275, 17280, 63, 21202, 14, 2242, 27374, 818, 275, 17280, 63, 21202, 14, 13326, 2846, 33, 9, 199, 199, 3, 1642, 12842, 342, 1240, 1471, 4165, 314, 818, 12, 340, 6249, 24340, 8819, 63, 27113, 365, 1202, 12, 199, 3, 2337, 365, 949, 1929, 367, 1263, 402, 314, 1163, 7124, 199, 2105, 14, 8831, 8, 632, 275, 17280, 63, 21202, 14, 2846, 24340, 8819, 63, 1469, 19464, 9, 199, 199, 3, 3063, 4002, 436, 2153, 3956, 314, 3050, 199, 3937, 275, 1950, 14, 3937, 342, 199, 3937, 14, 2526, 480, 11858, 3050, 4002, 3293, 531, 199, 3937, 14, 2526, 480, 11858, 3050, 2153, 3956, 531, 199, 199, 3, 5147, 314, 4242, 12842, 1240, 199, 2105, 14, 8831, 8, 632, 275, 17280, 63, 21202, 14, 2846, 24340, 8819, 63, 29270, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 3, 1898, 7800, 12, 9708, 12, 15309, 436, 15, 269, 2399, 29172, 2335, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 20825, 1898, 10219, 13, 7806, 12, 1626, 898, 89, 377, 85, 7969, 65, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 20825, 1898, 12521, 13, 9488, 12, 3599, 5373, 1148, 334, 6049, 10641, 9, 12126, 2020, 17379, 2106, 1860, 12, 4580, 605, 502, 12, 199, 3, 6855, 10641, 14, 2900, 4481, 4644, 14, 199, 20974, 199, 199, 20974, 199, 3, 8692, 20043, 14, 647, 199, 3, 257, 961, 2884, 23789, 31216, 24761, 1337, 3224, 282, 3050, 1808, 2018, 14, 2779, 365, 1454, 199, 3, 3962, 315, 15309, 1616, 71, 17646, 499, 436, 10948, 14, 710, 1950, 1202, 15194, 626, 199, 3, 314, 3734, 1750, 1549, 1348, 906, 63, 19514, 965, 2757, 663, 14, 199, 3, 199, 3, 961, 2884, 5074, 17280, 63, 21202, 841, 14, 19, 436, 10948, 14, 199, 20974, 199, 199, 646, 17280, 63, 21202, 199, 199, 3, 1929, 370, 4907, 465, 10046, 51, 2846, 33, 503, 10046, 51, 15598, 199, 2105, 275, 17280, 63, 21202, 14, 2242, 27374, 818, 275, 17280, 63, 21202, 14, 13326, 2846, 33, 9, 199, 199, 3, 1642, 12842, 342, 1240, 1471, 4165, 314, 818, 12, 340, 6249, 24340, 8819, 63, 27113, 365, 1202, 12, 199, 3, 2337, 365, 949, 1929, 367, 1263, 402, 314, 1163, 7124, 199, 2105, 14, 8831, 8, 632, 275, 17280, 63, 21202, 14, 2846, 24340, 8819, 63, 1469, 19464, 9, 199, 199, 3, 3063, 4002, 436, 2153, 3956, 314, 3050, 199, 3937, 275, 1950, 14, 3937, 342, 199, 3937, 14, 2526, 480, 11858, 3050, 4002, 3293, 531, 199, 3937, 14, 2526, 480, 11858, 3050, 2153, 3956, 531, 199, 199, 3, 5147, 314, 4242, 12842, 1240, 199, 2105, 14, 8831, 8, 632, 275, 17280, 63, 21202, 14, 2846, 24340, 8819, 63, 29270, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
algolia/algoliasearch-django
tests/test_decorators.py
1
3464
from mock import ( ANY, call, patch ) from django.test import TestCase from algoliasearch_django import algolia_engine from algoliasearch_django.decorators import disable_auto_indexing from .factories import UserFactory, WebsiteFactory from .models import User class DecoratorsTestCase(TestCase): def test_disable_auto_indexing_as_decorator_for_all(self): """Test that the `disable_auto_indexing` should work as a decorator for all the model""" @disable_auto_indexing() def decorated_operation(): WebsiteFactory() UserFactory() def non_decorated_operation(): WebsiteFactory() UserFactory() with patch.object(algolia_engine, 'save_record') as mocked_save_record: decorated_operation() # The decorated method should have prevented the indexing operations mocked_save_record.assert_not_called() with patch.object(algolia_engine, 'save_record') as mocked_save_record: non_decorated_operation() # The non-decorated method is not preventing the indexing operations # (the signal was correctly re-connected for both of the models) mocked_save_record.assert_has_calls([ call( ANY, created=True, raw=False, sender=ANY, signal=ANY, update_fields=None, using=ANY ) ] * 2) def test_disable_auto_indexing_as_decorator_for_model(self): """Test that the `disable_auto_indexing` should work as a decorator for a specific model""" @disable_auto_indexing(model=User) def decorated_operation(): WebsiteFactory() UserFactory() def non_decorated_operation(): WebsiteFactory() UserFactory() with patch.object(algolia_engine, 'save_record') as mocked_save_record: decorated_operation() # The decorated method should have prevented the indexing operation for the `User` model # but not for the `Website` model (we get only one call) mocked_save_record.assert_called_once_with( ANY, created=True, raw=False, sender=ANY, signal=ANY, update_fields=None, using=ANY ) with patch.object(algolia_engine, 'save_record') as mocked_save_record: non_decorated_operation() # The non-decorated method is not preventing the indexing operations # (the signal was correctly re-connected for both of the models) mocked_save_record.assert_has_calls([ call( ANY, created=True, raw=False, sender=ANY, signal=ANY, update_fields=None, using=ANY ) ] * 2) def test_disable_auto_indexing_as_context_manager(self): """Test that the `disable_auto_indexing` should work as a context manager""" with patch.object(algolia_engine, 'save_record') as mocked_save_record: with disable_auto_indexing(): WebsiteFactory() mocked_save_record.assert_not_called() with patch.object(algolia_engine, 'save_record') as mocked_save_record: WebsiteFactory() mocked_save_record.assert_called_once()
mit
[ 504, 1683, 492, 334, 272, 1821, 12, 272, 1240, 12, 272, 3371, 199, 9, 199, 199, 504, 1639, 14, 396, 492, 7640, 199, 199, 504, 24633, 317, 482, 1047, 63, 1176, 492, 24633, 21796, 63, 3908, 199, 504, 24633, 317, 482, 1047, 63, 1176, 14, 11582, 492, 3507, 63, 2495, 63, 28703, 199, 199, 504, 1275, 15406, 492, 16047, 12, 6001, 2124, 2927, 199, 504, 1275, 992, 492, 2876, 421, 199, 533, 13966, 269, 2750, 1746, 8, 1746, 304, 272, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 11547, 63, 509, 63, 452, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 7531, 367, 1006, 314, 1402, 624, 398, 768, 5993, 63, 2495, 63, 28703, 342, 267, 347, 16225, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 347, 2222, 63, 29299, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 16225, 63, 5735, 342, 398, 327, 710, 16225, 1083, 1077, 1172, 876, 1856, 471, 314, 16356, 5331, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1397, 63, 3527, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 2222, 63, 29299, 63, 5735, 342, 398, 327, 710, 2222, 13, 29299, 1083, 365, 440, 7981, 316, 314, 16356, 5331, 267, 327, 334, 1589, 4673, 1990, 6657, 295, 13, 7113, 367, 3865, 402, 314, 1709, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1989, 63, 5352, 779, 288, 1240, 8, 355, 1821, 12, 355, 2737, 29, 549, 12, 355, 3066, 29, 797, 12, 355, 8904, 29, 8974, 12, 355, 4673, 29, 8974, 12, 355, 1678, 63, 955, 29, 403, 12, 355, 1808, 29, 8974, 288, 776, 267, 1622, 627, 499, 9, 339, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 11547, 63, 509, 63, 1238, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 7531, 367, 282, 2488, 1402, 624, 398, 768, 5993, 63, 2495, 63, 28703, 8, 1238, 29, 1899, 9, 267, 347, 16225, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 347, 2222, 63, 29299, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 16225, 63, 5735, 342, 398, 327, 710, 16225, 1083, 1077, 1172, 876, 1856, 471, 314, 16356, 3439, 367, 314, 658, 1899, 64, 1402, 267, 327, 1325, 440, 367, 314, 658, 26354, 64, 1402, 334, 1129, 664, 1454, 1373, 1240, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 1821, 12, 288, 2737, 29, 549, 12, 288, 3066, 29, 797, 12, 288, 8904, 29, 8974, 12, 288, 4673, 29, 8974, 12, 288, 1678, 63, 955, 29, 403, 12, 288, 1808, 29, 8974, 267, 776, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 2222, 63, 29299, 63, 5735, 342, 398, 327, 710, 2222, 13, 29299, 1083, 365, 440, 7981, 316, 314, 16356, 5331, 267, 327, 334, 1589, 4673, 1990, 6657, 295, 13, 7113, 367, 3865, 402, 314, 1709, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1989, 63, 5352, 779, 288, 1240, 8, 355, 1821, 12, 355, 2737, 29, 549, 12, 355, 3066, 29, 797, 12, 355, 8904, 29, 8974, 12, 355, 4673, 29, 8974, 12, 355, 1678, 63, 955, 29, 403, 12, 355, 1808, 29, 8974, 288, 776, 267, 1622, 627, 499, 9, 339, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 1100, 63, 2609, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 1067, 5256, 624, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 543, 3507, 63, 2495, 63, 28703, 837, 355, 6001, 2124, 2927, 342, 398, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1397, 63, 3527, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 6001, 2124, 2927, 342, 398, 16991, 63, 2117, 63, 3059, 14, 479, 63, 3527, 63, 5089, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1683, 492, 334, 272, 1821, 12, 272, 1240, 12, 272, 3371, 199, 9, 199, 199, 504, 1639, 14, 396, 492, 7640, 199, 199, 504, 24633, 317, 482, 1047, 63, 1176, 492, 24633, 21796, 63, 3908, 199, 504, 24633, 317, 482, 1047, 63, 1176, 14, 11582, 492, 3507, 63, 2495, 63, 28703, 199, 199, 504, 1275, 15406, 492, 16047, 12, 6001, 2124, 2927, 199, 504, 1275, 992, 492, 2876, 421, 199, 533, 13966, 269, 2750, 1746, 8, 1746, 304, 272, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 11547, 63, 509, 63, 452, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 7531, 367, 1006, 314, 1402, 624, 398, 768, 5993, 63, 2495, 63, 28703, 342, 267, 347, 16225, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 347, 2222, 63, 29299, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 16225, 63, 5735, 342, 398, 327, 710, 16225, 1083, 1077, 1172, 876, 1856, 471, 314, 16356, 5331, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1397, 63, 3527, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 2222, 63, 29299, 63, 5735, 342, 398, 327, 710, 2222, 13, 29299, 1083, 365, 440, 7981, 316, 314, 16356, 5331, 267, 327, 334, 1589, 4673, 1990, 6657, 295, 13, 7113, 367, 3865, 402, 314, 1709, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1989, 63, 5352, 779, 288, 1240, 8, 355, 1821, 12, 355, 2737, 29, 549, 12, 355, 3066, 29, 797, 12, 355, 8904, 29, 8974, 12, 355, 4673, 29, 8974, 12, 355, 1678, 63, 955, 29, 403, 12, 355, 1808, 29, 8974, 288, 776, 267, 1622, 627, 499, 9, 339, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 11547, 63, 509, 63, 1238, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 7531, 367, 282, 2488, 1402, 624, 398, 768, 5993, 63, 2495, 63, 28703, 8, 1238, 29, 1899, 9, 267, 347, 16225, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 347, 2222, 63, 29299, 63, 5735, 837, 288, 6001, 2124, 2927, 342, 288, 16047, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 16225, 63, 5735, 342, 398, 327, 710, 16225, 1083, 1077, 1172, 876, 1856, 471, 314, 16356, 3439, 367, 314, 658, 1899, 64, 1402, 267, 327, 1325, 440, 367, 314, 658, 26354, 64, 1402, 334, 1129, 664, 1454, 1373, 1240, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 1821, 12, 288, 2737, 29, 549, 12, 288, 3066, 29, 797, 12, 288, 8904, 29, 8974, 12, 288, 4673, 29, 8974, 12, 288, 1678, 63, 955, 29, 403, 12, 288, 1808, 29, 8974, 267, 776, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 2222, 63, 29299, 63, 5735, 342, 398, 327, 710, 2222, 13, 29299, 1083, 365, 440, 7981, 316, 314, 16356, 5331, 267, 327, 334, 1589, 4673, 1990, 6657, 295, 13, 7113, 367, 3865, 402, 314, 1709, 9, 267, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1989, 63, 5352, 779, 288, 1240, 8, 355, 1821, 12, 355, 2737, 29, 549, 12, 355, 3066, 29, 797, 12, 355, 8904, 29, 8974, 12, 355, 4673, 29, 8974, 12, 355, 1678, 63, 955, 29, 403, 12, 355, 1808, 29, 8974, 288, 776, 267, 1622, 627, 499, 9, 339, 347, 511, 63, 5993, 63, 2495, 63, 28703, 63, 305, 63, 1100, 63, 2609, 8, 277, 304, 267, 408, 774, 626, 314, 658, 5993, 63, 2495, 63, 28703, 64, 1077, 1736, 465, 282, 1067, 5256, 624, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 543, 3507, 63, 2495, 63, 28703, 837, 355, 6001, 2124, 2927, 342, 398, 16991, 63, 2117, 63, 3059, 14, 479, 63, 1397, 63, 3527, 342, 398, 543, 3371, 14, 785, 8, 21734, 21796, 63, 3908, 12, 283, 2117, 63, 3059, 358, 465, 16991, 63, 2117, 63, 3059, 26, 288, 6001, 2124, 2927, 342, 398, 16991, 63, 2117, 63, 3059, 14, 479, 63, 3527, 63, 5089, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
scorpionboy30/zerorpc-python
zerorpc/heartbeat.py
12
4650
# -*- coding: utf-8 -*- # Open Source Initiative OSI - The MIT License (MIT):Licensing # # The MIT License (MIT) # Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies # of the Software, and to permit persons to whom the Software is furnished to do # so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import time import gevent.pool import gevent.queue import gevent.event import gevent.local import gevent.lock from .exceptions import * class HeartBeatOnChannel(object): def __init__(self, channel, freq=5, passive=False): self._channel = channel self._heartbeat_freq = freq self._input_queue = gevent.queue.Channel() self._remote_last_hb = None self._lost_remote = False self._recv_task = gevent.spawn(self._recver) self._heartbeat_task = None self._parent_coroutine = gevent.getcurrent() self._compat_v2 = None if not passive: self._start_heartbeat() @property def recv_is_available(self): return self._channel.recv_is_available def __del__(self): self.close() def close(self): if self._heartbeat_task is not None: self._heartbeat_task.kill() self._heartbeat_task = None if self._recv_task is not None: self._recv_task.kill() self._recv_task = None if self._channel is not None: self._channel.close() self._channel = None def _heartbeat(self): while True: gevent.sleep(self._heartbeat_freq) if self._remote_last_hb is None: self._remote_last_hb = time.time() if time.time() > self._remote_last_hb + self._heartbeat_freq * 2: self._lost_remote = True gevent.kill(self._parent_coroutine, self._lost_remote_exception()) break self._channel.emit('_zpc_hb', (0,)) # 0 -> compat with protocol v2 def _start_heartbeat(self): if self._heartbeat_task is None and self._heartbeat_freq is not None: self._heartbeat_task = gevent.spawn(self._heartbeat) def _recver(self): while True: event = self._channel.recv() if self._compat_v2 is None: self._compat_v2 = event.header.get('v', 0) < 3 if event.name == '_zpc_hb': self._remote_last_hb = time.time() self._start_heartbeat() if self._compat_v2: event.name = '_zpc_more' self._input_queue.put(event) else: self._input_queue.put(event) def _lost_remote_exception(self): return LostRemote('Lost remote after {0}s heartbeat'.format( self._heartbeat_freq * 2)) def create_event(self, name, args, xheader=None): if self._compat_v2 and name == '_zpc_more': name = '_zpc_hb' return self._channel.create_event(name, args, xheader) def emit_event(self, event): if self._lost_remote: raise self._lost_remote_exception() self._channel.emit_event(event) def emit(self, name, args, xheader=None): event = self.create_event(name, args, xheader) self.emit_event(event) def recv(self, timeout=None): if self._lost_remote: raise self._lost_remote_exception() try: event = self._input_queue.get(timeout=timeout) except gevent.queue.Empty: raise TimeoutExpired(timeout) return event @property def channel(self): return self._channel @property def context(self): return self._channel.context
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 3232, 5800, 21412, 1905, 25718, 446, 710, 10697, 844, 334, 13965, 304, 44, 530, 25843, 199, 3, 199, 3, 710, 10697, 844, 334, 13965, 9, 199, 3, 1898, 334, 67, 9, 6029, 24716, 9089, 3277, 334, 16374, 32, 3287, 4091, 14, 957, 9, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 402, 199, 3, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 199, 3, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 199, 3, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 199, 3, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 199, 3, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 3, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 199, 3, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 199, 3, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 199, 3, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 199, 3, 4141, 14, 421, 199, 646, 900, 199, 646, 23386, 14, 2293, 199, 646, 23386, 14, 1825, 199, 646, 23386, 14, 1430, 199, 646, 23386, 14, 1832, 199, 646, 23386, 14, 831, 199, 199, 504, 1275, 3924, 492, 627, 421, 199, 533, 5311, 580, 3655, 292, 3314, 5358, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 3623, 12, 9220, 29, 21, 12, 21010, 29, 797, 304, 267, 291, 423, 2775, 275, 3623, 267, 291, 423, 22685, 63, 5646, 275, 9220, 267, 291, 423, 1210, 63, 1825, 275, 23386, 14, 1825, 14, 5358, 342, 267, 291, 423, 3846, 63, 2019, 63, 16168, 275, 488, 267, 291, 423, 22031, 63, 3846, 275, 756, 267, 291, 423, 7637, 63, 1765, 275, 23386, 14, 10212, 8, 277, 423, 2761, 422, 9, 267, 291, 423, 22685, 63, 1765, 275, 488, 267, 291, 423, 1708, 63, 16675, 275, 23386, 14, 362, 1818, 342, 267, 291, 423, 5819, 63, 86, 18, 275, 488, 267, 340, 440, 21010, 26, 288, 291, 423, 928, 63, 22685, 342, 339, 768, 1829, 272, 347, 11904, 63, 374, 63, 4561, 8, 277, 304, 267, 372, 291, 423, 2775, 14, 7637, 63, 374, 63, 4561, 339, 347, 636, 2264, 721, 277, 304, 267, 291, 14, 1600, 342, 339, 347, 4002, 8, 277, 304, 267, 340, 291, 423, 22685, 63, 1765, 365, 440, 488, 26, 288, 291, 423, 22685, 63, 1765, 14, 8997, 342, 288, 291, 423, 22685, 63, 1765, 275, 488, 267, 340, 291, 423, 7637, 63, 1765, 365, 440, 488, 26, 288, 291, 423, 7637, 63, 1765, 14, 8997, 342, 288, 291, 423, 7637, 63, 1765, 275, 488, 267, 340, 291, 423, 2775, 365, 440, 488, 26, 288, 291, 423, 2775, 14, 1600, 342, 288, 291, 423, 2775, 275, 488, 339, 347, 485, 22685, 8, 277, 304, 267, 1830, 715, 26, 288, 23386, 14, 4532, 8, 277, 423, 22685, 63, 5646, 9, 288, 340, 291, 423, 3846, 63, 2019, 63, 16168, 365, 488, 26, 355, 291, 423, 3846, 63, 2019, 63, 16168, 275, 900, 14, 521, 342, 288, 340, 900, 14, 521, 342, 690, 291, 423, 3846, 63, 2019, 63, 16168, 435, 291, 423, 22685, 63, 5646, 627, 499, 26, 355, 291, 423, 22031, 63, 3846, 275, 715, 355, 23386, 14, 8997, 8, 277, 423, 1708, 63, 16675, 12, 717, 291, 423, 22031, 63, 3846, 63, 1971, 1012, 355, 2059, 288, 291, 423, 2775, 14, 8159, 6412, 90, 2352, 63, 16168, 297, 334, 16, 4641, 221, 327, 378, 1035, 8434, 543, 4113, 373, 18, 339, 347, 485, 928, 63, 22685, 8, 277, 304, 267, 340, 291, 423, 22685, 63, 1765, 365, 488, 436, 291, 423, 22685, 63, 5646, 365, 440, 488, 26, 288, 291, 423, 22685, 63, 1765, 275, 23386, 14, 10212, 8, 277, 423, 22685, 9, 339, 347, 485, 2761, 422, 8, 277, 304, 267, 1830, 715, 26, 288, 1566, 275, 291, 423, 2775, 14, 7637, 342, 288, 340, 291, 423, 5819, 63, 86, 18, 365, 488, 26, 355, 291, 423, 5819, 63, 86, 18, 275, 1566, 14, 1291, 14, 362, 360, 86, 297, 378, 9, 665, 650, 288, 340, 1566, 14, 354, 508, 2513, 90, 2352, 63, 16168, 356, 355, 291, 423, 3846, 63, 2019, 63, 16168, 275, 900, 14, 521, 342, 355, 291, 423, 928, 63, 22685, 342, 355, 340, 291, 423, 5819, 63, 86, 18, 26, 490, 1566, 14, 354, 275, 2513, 90, 2352, 63, 6878, 7, 490, 291, 423, 1210, 63, 1825, 14, 524, 8, 1430, 9, 288, 587, 26, 355, 291, 423, 1210, 63, 1825, 14, 524, 8, 1430, 9, 339, 347, 485, 22031, 63, 3846, 63, 1971, 8, 277, 304, 267, 372, 491, 941, 6713, 360, 14074, 3982, 2410, 469, 16, 93, 83, 32015, 1370, 908, 8, 288, 291, 423, 22685, 63, 5646, 627, 499, 430, 339, 347, 1218, 63, 1430, 8, 277, 12, 536, 12, 1249, 12, 671, 1291, 29, 403, 304, 267, 340, 291, 423, 5819, 63, 86, 18, 436, 536, 508, 2513, 90, 2352, 63, 6878, 356, 288, 536, 275, 2513, 90, 2352, 63, 16168, 7, 267, 372, 291, 423, 2775, 14, 981, 63, 1430, 8, 354, 12, 1249, 12, 671, 1291, 9, 339, 347, 8689, 63, 1430, 8, 277, 12, 1566, 304, 267, 340, 291, 423, 22031, 63, 3846, 26, 288, 746, 291, 423, 22031, 63, 3846, 63, 1971, 342, 267, 291, 423, 2775, 14, 8159, 63, 1430, 8, 1430, 9, 339, 347, 8689, 8, 277, 12, 536, 12, 1249, 12, 671, 1291, 29, 403, 304, 267, 1566, 275, 291, 14, 981, 63, 1430 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 3232, 5800, 21412, 1905, 25718, 446, 710, 10697, 844, 334, 13965, 304, 44, 530, 25843, 199, 3, 199, 3, 710, 10697, 844, 334, 13965, 9, 199, 3, 1898, 334, 67, 9, 6029, 24716, 9089, 3277, 334, 16374, 32, 3287, 4091, 14, 957, 9, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 402, 199, 3, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 199, 3, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 199, 3, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 199, 3, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 199, 3, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 3, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 199, 3, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 199, 3, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 199, 3, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 199, 3, 4141, 14, 421, 199, 646, 900, 199, 646, 23386, 14, 2293, 199, 646, 23386, 14, 1825, 199, 646, 23386, 14, 1430, 199, 646, 23386, 14, 1832, 199, 646, 23386, 14, 831, 199, 199, 504, 1275, 3924, 492, 627, 421, 199, 533, 5311, 580, 3655, 292, 3314, 5358, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 3623, 12, 9220, 29, 21, 12, 21010, 29, 797, 304, 267, 291, 423, 2775, 275, 3623, 267, 291, 423, 22685, 63, 5646, 275, 9220, 267, 291, 423, 1210, 63, 1825, 275, 23386, 14, 1825, 14, 5358, 342, 267, 291, 423, 3846, 63, 2019, 63, 16168, 275, 488, 267, 291, 423, 22031, 63, 3846, 275, 756, 267, 291, 423, 7637, 63, 1765, 275, 23386, 14, 10212, 8, 277, 423, 2761, 422, 9, 267, 291, 423, 22685, 63, 1765, 275, 488, 267, 291, 423, 1708, 63, 16675, 275, 23386, 14, 362, 1818, 342, 267, 291, 423, 5819, 63, 86, 18, 275, 488, 267, 340, 440, 21010, 26, 288, 291, 423, 928, 63, 22685, 342, 339, 768, 1829, 272, 347, 11904, 63, 374, 63, 4561, 8, 277, 304, 267, 372, 291, 423, 2775, 14, 7637, 63, 374, 63, 4561, 339, 347, 636, 2264, 721, 277, 304, 267, 291, 14, 1600, 342, 339, 347, 4002, 8, 277, 304, 267, 340, 291, 423, 22685, 63, 1765, 365, 440, 488, 26, 288, 291, 423, 22685, 63, 1765, 14, 8997, 342, 288, 291, 423, 22685, 63, 1765, 275, 488, 267, 340, 291, 423, 7637, 63, 1765, 365, 440, 488, 26, 288, 291, 423, 7637, 63, 1765, 14, 8997, 342, 288, 291, 423, 7637, 63, 1765, 275, 488, 267, 340, 291, 423, 2775, 365, 440, 488, 26, 288, 291, 423, 2775, 14, 1600, 342, 288, 291, 423, 2775, 275, 488, 339, 347, 485, 22685, 8, 277, 304, 267, 1830, 715, 26, 288, 23386, 14, 4532, 8, 277, 423, 22685, 63, 5646, 9, 288, 340, 291, 423, 3846, 63, 2019, 63, 16168, 365, 488, 26, 355, 291, 423, 3846, 63, 2019, 63, 16168, 275, 900, 14, 521, 342, 288, 340, 900, 14, 521, 342, 690, 291, 423, 3846, 63, 2019, 63, 16168, 435, 291, 423, 22685, 63, 5646, 627, 499, 26, 355, 291, 423, 22031, 63, 3846, 275, 715, 355, 23386, 14, 8997, 8, 277, 423, 1708, 63, 16675, 12, 717, 291, 423, 22031, 63, 3846, 63, 1971, 1012, 355, 2059, 288, 291, 423, 2775, 14, 8159, 6412, 90, 2352, 63, 16168, 297, 334, 16, 4641, 221, 327, 378, 1035, 8434, 543, 4113, 373, 18, 339, 347, 485, 928, 63, 22685, 8, 277, 304, 267, 340, 291, 423, 22685, 63, 1765, 365, 488, 436, 291, 423, 22685, 63, 5646, 365, 440, 488, 26, 288, 291, 423, 22685, 63, 1765, 275, 23386, 14, 10212, 8, 277, 423, 22685, 9, 339, 347, 485, 2761, 422, 8, 277, 304, 267, 1830, 715, 26, 288, 1566, 275, 291, 423, 2775, 14, 7637, 342, 288, 340, 291, 423, 5819, 63, 86, 18, 365, 488, 26, 355, 291, 423, 5819, 63, 86, 18, 275, 1566, 14, 1291, 14, 362, 360, 86, 297, 378, 9, 665, 650, 288, 340, 1566, 14, 354, 508, 2513, 90, 2352, 63, 16168, 356, 355, 291, 423, 3846, 63, 2019, 63, 16168, 275, 900, 14, 521, 342, 355, 291, 423, 928, 63, 22685, 342, 355, 340, 291, 423, 5819, 63, 86, 18, 26, 490, 1566, 14, 354, 275, 2513, 90, 2352, 63, 6878, 7, 490, 291, 423, 1210, 63, 1825, 14, 524, 8, 1430, 9, 288, 587, 26, 355, 291, 423, 1210, 63, 1825, 14, 524, 8, 1430, 9, 339, 347, 485, 22031, 63, 3846, 63, 1971, 8, 277, 304, 267, 372, 491, 941, 6713, 360, 14074, 3982, 2410, 469, 16, 93, 83, 32015, 1370, 908, 8, 288, 291, 423, 22685, 63, 5646, 627, 499, 430, 339, 347, 1218, 63, 1430, 8, 277, 12, 536, 12, 1249, 12, 671, 1291, 29, 403, 304, 267, 340, 291, 423, 5819, 63, 86, 18, 436, 536, 508, 2513, 90, 2352, 63, 6878, 356, 288, 536, 275, 2513, 90, 2352, 63, 16168, 7, 267, 372, 291, 423, 2775, 14, 981, 63, 1430, 8, 354, 12, 1249, 12, 671, 1291, 9, 339, 347, 8689, 63, 1430, 8, 277, 12, 1566, 304, 267, 340, 291, 423, 22031, 63, 3846, 26, 288, 746, 291, 423, 22031, 63, 3846, 63, 1971, 342, 267, 291, 423, 2775, 14, 8159, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
prarthitm/edxplatform
common/lib/xmodule/xmodule/library_root_xblock.py
2
5155
""" 'library' XBlock (LibraryRoot) """ import logging from xmodule.studio_editable import StudioEditableModule from xblock.fields import Scope, String, List, Boolean from xblock.fragment import Fragment from xblock.core import XBlock log = logging.getLogger(__name__) # Make '_' a no-op so we can scrape strings. Using lambda instead of # `django.utils.translation.ugettext_noop` because Django cannot be imported in this file _ = lambda text: text class LibraryRoot(XBlock): """ The LibraryRoot is the root XBlock of a content library. All other blocks in the library are its children. It contains metadata such as the library's display_name. """ resources_dir = None display_name = String( help=_("The display name for this component."), default="Library", display_name=_("Library Display Name"), scope=Scope.settings ) advanced_modules = List( display_name=_("Advanced Module List"), help=_("Enter the names of the advanced components to use in your library."), scope=Scope.settings, xml_node=True, ) show_children_previews = Boolean( display_name="Hide children preview", help="Choose if preview of library contents is shown", scope=Scope.user_state, default=True ) has_children = True has_author_view = True def __unicode__(self): return u"Library: {}".format(self.display_name) def __str__(self): return unicode(self).encode('utf-8') def author_view(self, context): """ Renders the Studio preview view. """ fragment = Fragment() self.render_children(context, fragment, can_reorder=False, can_add=True) return fragment def render_children(self, context, fragment, can_reorder=False, can_add=False): # pylint: disable=unused-argument """ Renders the children of the module with HTML appropriate for Studio. Reordering is not supported. """ contents = [] paging = context.get('paging', None) children_count = len(self.children) # pylint: disable=no-member item_start, item_end = 0, children_count # TODO sort children if paging: page_number = paging.get('page_number', 0) raw_page_size = paging.get('page_size', None) page_size = raw_page_size if raw_page_size is not None else children_count item_start, item_end = page_size * page_number, page_size * (page_number + 1) children_to_show = self.children[item_start:item_end] # pylint: disable=no-member force_render = context.get('force_render', None) for child_key in children_to_show: # Children must have a separate context from the library itself. Make a copy. child_context = context.copy() child_context['show_preview'] = self.show_children_previews child_context['can_edit_visibility'] = False child = self.runtime.get_block(child_key) child_view_name = StudioEditableModule.get_preview_view_name(child) if unicode(child.location) == force_render: child_context['show_preview'] = True if child_context['show_preview']: rendered_child = self.runtime.render_child(child, child_view_name, child_context) else: rendered_child = self.runtime.render_child_placeholder(child, child_view_name, child_context) fragment.add_frag_resources(rendered_child) contents.append({ 'id': unicode(child.location), 'content': rendered_child.content, }) fragment.add_content( self.runtime.render_template("studio_render_paged_children_view.html", { 'items': contents, 'xblock_context': context, 'can_add': can_add, 'first_displayed': item_start, 'total_children': children_count, 'displayed_children': len(children_to_show), 'previews': self.show_children_previews }) ) @property def display_org_with_default(self): """ Org display names are not implemented. This just provides API compatibility with CourseDescriptor. Always returns the raw 'org' field from the key. """ return self.scope_ids.usage_id.course_key.org @property def display_number_with_default(self): """ Display numbers are not implemented. This just provides API compatibility with CourseDescriptor. Always returns the raw 'library' field from the key. """ return self.scope_ids.usage_id.course_key.library @XBlock.json_handler def trigger_previews(self, request_body, suffix): # pylint: disable=unused-argument """ Enable or disable previews in studio for library children. """ self.show_children_previews = request_body.get('showChildrenPreviews', self.show_children_previews) return {'showChildrenPreviews': self.show_children_previews}
agpl-3.0
[ 624, 199, 7, 4342, 7, 15398, 334, 7424, 6405, 9, 199, 624, 199, 646, 2050, 199, 199, 504, 9872, 14, 19806, 63, 10820, 492, 13225, 20957, 1224, 2377, 199, 199, 504, 12971, 14, 955, 492, 20488, 12, 2624, 12, 3820, 12, 9411, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 1018, 492, 15398, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 4155, 14135, 282, 949, 13, 411, 880, 781, 883, 10328, 321, 3326, 14, 11719, 2400, 3140, 402, 199, 3, 221, 658, 1176, 14, 1208, 14, 6893, 14, 23499, 63, 12921, 64, 2952, 5634, 3913, 506, 8439, 315, 642, 570, 199, 63, 275, 2400, 1318, 26, 1318, 421, 199, 533, 11243, 6405, 8, 24784, 304, 272, 408, 272, 710, 11243, 6405, 365, 314, 1738, 15398, 402, 282, 1564, 3555, 14, 2900, 1163, 5664, 315, 272, 314, 3555, 787, 2399, 4978, 14, 2779, 3509, 3341, 4066, 465, 314, 3555, 1159, 272, 2929, 63, 354, 14, 272, 408, 272, 5944, 63, 694, 275, 488, 339, 2929, 63, 354, 275, 2624, 8, 267, 1720, 9384, 1918, 2929, 536, 367, 642, 3931, 7651, 267, 849, 628, 7424, 401, 267, 2929, 63, 354, 9384, 7424, 12175, 2812, 1288, 267, 4194, 29, 7812, 14, 1751, 272, 776, 272, 19472, 63, 3112, 275, 3820, 8, 267, 2929, 63, 354, 9384, 23613, 5673, 3820, 1288, 267, 1720, 9384, 8468, 314, 1561, 402, 314, 19472, 7323, 370, 675, 315, 2195, 3555, 7651, 267, 4194, 29, 7812, 14, 1751, 12, 267, 2748, 63, 932, 29, 549, 12, 272, 776, 272, 2498, 63, 3223, 63, 657, 4196, 275, 9411, 8, 267, 2929, 63, 354, 628, 18224, 4978, 19653, 401, 267, 1720, 628, 23932, 340, 19653, 402, 3555, 4072, 365, 9164, 401, 267, 4194, 29, 7812, 14, 751, 63, 929, 12, 267, 849, 29, 549, 272, 776, 272, 965, 63, 3223, 275, 715, 272, 965, 63, 2502, 63, 1345, 275, 715, 339, 347, 636, 2975, 721, 277, 304, 267, 372, 399, 2, 7424, 26, 8352, 908, 8, 277, 14, 2918, 63, 354, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2649, 8, 277, 680, 2143, 360, 1624, 13, 24, 358, 339, 347, 4132, 63, 1345, 8, 277, 12, 1067, 304, 267, 408, 267, 10055, 7735, 314, 13225, 19653, 2455, 14, 267, 408, 267, 7956, 275, 481, 4338, 342, 267, 291, 14, 3352, 63, 3223, 8, 1100, 12, 7956, 12, 883, 63, 29463, 29, 797, 12, 883, 63, 525, 29, 549, 9, 267, 372, 7956, 339, 347, 3795, 63, 3223, 8, 277, 12, 1067, 12, 7956, 12, 883, 63, 29463, 29, 797, 12, 883, 63, 525, 29, 797, 304, 221, 327, 4287, 26, 3507, 29, 8618, 13, 2094, 267, 408, 267, 10055, 7735, 314, 4978, 402, 314, 859, 543, 4163, 5827, 367, 13225, 14, 799, 7128, 365, 440, 3748, 14, 267, 408, 267, 4072, 275, 942, 398, 299, 7407, 275, 1067, 14, 362, 360, 31691, 297, 488, 9, 398, 4978, 63, 835, 275, 822, 8, 277, 14, 3223, 9, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 267, 1242, 63, 928, 12, 1242, 63, 500, 275, 378, 12, 4978, 63, 835, 398, 327, 3254, 4069, 4978, 267, 340, 299, 7407, 26, 288, 2034, 63, 1955, 275, 299, 7407, 14, 362, 360, 1606, 63, 1955, 297, 378, 9, 288, 3066, 63, 1606, 63, 890, 275, 299, 7407, 14, 362, 360, 1606, 63, 890, 297, 488, 9, 288, 2034, 63, 890, 275, 3066, 63, 1606, 63, 890, 340, 3066, 63, 1606, 63, 890, 365, 440, 488, 587, 4978, 63, 835, 288, 1242, 63, 928, 12, 1242, 63, 500, 275, 2034, 63, 890, 627, 2034, 63, 1955, 12, 2034, 63, 890, 627, 334, 1606, 63, 1955, 435, 413, 9, 398, 4978, 63, 475, 63, 2384, 275, 291, 14, 3223, 59, 1053, 63, 928, 26, 1053, 63, 500, 61, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 398, 3542, 63, 3352, 275, 1067, 14, 362, 360, 3990, 63, 3352, 297, 488, 9, 398, 367, 1982, 63, 498, 315, 4978, 63, 475, 63, 2384, 26, 288, 327, 12988, 828, 1471, 1172, 282, 7396, 1067, 687, 314, 3555, 6337, 14, 4155, 282, 1331, 14, 288, 1982, 63, 1100, 275, 1067, 14, 1574, 342, 288, 1982, 63, 1100, 459, 2384, 63, 7780, 418, 275, 291, 14, 2384, 63, 3223, 63, 657, 4196, 288, 1982, 63, 1100, 459, 2425, 63, 3773, 63, 11269, 418, 275, 756, 288, 1982, 275, 291, 14, 7726, 14, 362, 63, 1457, 8, 1739, 63, 498, 9, 288, 1982, 63, 1345, 63, 354, 275, 13225, 20957, 1224, 2377, 14, 362, 63, 7780, 63, 1345, 63, 354, 8, 1739, 9, 953, 340, 2649, 8, 1739, 14, 1985, 9, 508, 3542, 63, 3352, 26, 355, 1982, 63, 1100, 459, 2384, 63, 7780, 418, 275, 715, 953, 340, 1982, 63, 1100, 459, 2384, 63, 7780, 2565, 355, 8018, 63, 1739, 275, 291, 14, 7726, 14, 3352, 63, 1739, 8, 1739, 12, 1982, 63, 1345, 63, 354, 12, 1982, 63, 1100, 9, 288, 587, 26, 355, 8018, 63, 1739, 275, 291, 14, 7726, 14, 3352, 63, 1739, 63, 6199, 8, 1739, 12, 1982, 63, 1345, 63, 354, 12, 1982, 63, 1100, 9, 288, 7956, 14, 525, 63, 11255, 63, 4435, 8, 16841, 63, 1739, 9, 953, 4072, 14, 740, 2561, 355, 283, 344, 356, 2649, 8, 1739, 14, 1985, 395, 355, 283, 1317, 356, 8018, 63, 1739, 14, 1317, 12, 288, 3828, 398, 7956, 14, 525, 63, 1317, 8, 288, 291, 14, 7726, 14, 3352, 63, 1160, 480, 19806, 63, 3352, 63, 1606, 68, 63, 3223, 63, 1345, 14, 1360, 401, 469, 355, 283, 1744, 356, 4072, 12, 355, 283, 11283, 63, 1100, 356, 1067, 12, 355, 283, 2425, 63, 525, 356, 883, 63, 525, 12, 355, 283, 2246, 63, 22283, 356, 1242, 63, 928, 12, 355, 283, 2923, 63, 3223, 356, 4978, 63, 835, 12, 355, 283, 22283, 63, 3223, 356, 822, 8, 3223, 63, 475, 63, 2384, 395, 355, 283, 657, 4196, 356, 291, 14, 2384, 63, 3223, 63, 657, 4196, 288, 3828, 267, 776, 339, 768, 1829, 272, 347, 2929, 63, 1308, 63, 1045, 63, 885, 8, 277, 304, 267, 408, 267, 13125, 2929, 1561, 787, 440, 6366, 14 ]
[ 199, 7, 4342, 7, 15398, 334, 7424, 6405, 9, 199, 624, 199, 646, 2050, 199, 199, 504, 9872, 14, 19806, 63, 10820, 492, 13225, 20957, 1224, 2377, 199, 199, 504, 12971, 14, 955, 492, 20488, 12, 2624, 12, 3820, 12, 9411, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 1018, 492, 15398, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 4155, 14135, 282, 949, 13, 411, 880, 781, 883, 10328, 321, 3326, 14, 11719, 2400, 3140, 402, 199, 3, 221, 658, 1176, 14, 1208, 14, 6893, 14, 23499, 63, 12921, 64, 2952, 5634, 3913, 506, 8439, 315, 642, 570, 199, 63, 275, 2400, 1318, 26, 1318, 421, 199, 533, 11243, 6405, 8, 24784, 304, 272, 408, 272, 710, 11243, 6405, 365, 314, 1738, 15398, 402, 282, 1564, 3555, 14, 2900, 1163, 5664, 315, 272, 314, 3555, 787, 2399, 4978, 14, 2779, 3509, 3341, 4066, 465, 314, 3555, 1159, 272, 2929, 63, 354, 14, 272, 408, 272, 5944, 63, 694, 275, 488, 339, 2929, 63, 354, 275, 2624, 8, 267, 1720, 9384, 1918, 2929, 536, 367, 642, 3931, 7651, 267, 849, 628, 7424, 401, 267, 2929, 63, 354, 9384, 7424, 12175, 2812, 1288, 267, 4194, 29, 7812, 14, 1751, 272, 776, 272, 19472, 63, 3112, 275, 3820, 8, 267, 2929, 63, 354, 9384, 23613, 5673, 3820, 1288, 267, 1720, 9384, 8468, 314, 1561, 402, 314, 19472, 7323, 370, 675, 315, 2195, 3555, 7651, 267, 4194, 29, 7812, 14, 1751, 12, 267, 2748, 63, 932, 29, 549, 12, 272, 776, 272, 2498, 63, 3223, 63, 657, 4196, 275, 9411, 8, 267, 2929, 63, 354, 628, 18224, 4978, 19653, 401, 267, 1720, 628, 23932, 340, 19653, 402, 3555, 4072, 365, 9164, 401, 267, 4194, 29, 7812, 14, 751, 63, 929, 12, 267, 849, 29, 549, 272, 776, 272, 965, 63, 3223, 275, 715, 272, 965, 63, 2502, 63, 1345, 275, 715, 339, 347, 636, 2975, 721, 277, 304, 267, 372, 399, 2, 7424, 26, 8352, 908, 8, 277, 14, 2918, 63, 354, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2649, 8, 277, 680, 2143, 360, 1624, 13, 24, 358, 339, 347, 4132, 63, 1345, 8, 277, 12, 1067, 304, 267, 408, 267, 10055, 7735, 314, 13225, 19653, 2455, 14, 267, 408, 267, 7956, 275, 481, 4338, 342, 267, 291, 14, 3352, 63, 3223, 8, 1100, 12, 7956, 12, 883, 63, 29463, 29, 797, 12, 883, 63, 525, 29, 549, 9, 267, 372, 7956, 339, 347, 3795, 63, 3223, 8, 277, 12, 1067, 12, 7956, 12, 883, 63, 29463, 29, 797, 12, 883, 63, 525, 29, 797, 304, 221, 327, 4287, 26, 3507, 29, 8618, 13, 2094, 267, 408, 267, 10055, 7735, 314, 4978, 402, 314, 859, 543, 4163, 5827, 367, 13225, 14, 799, 7128, 365, 440, 3748, 14, 267, 408, 267, 4072, 275, 942, 398, 299, 7407, 275, 1067, 14, 362, 360, 31691, 297, 488, 9, 398, 4978, 63, 835, 275, 822, 8, 277, 14, 3223, 9, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 267, 1242, 63, 928, 12, 1242, 63, 500, 275, 378, 12, 4978, 63, 835, 398, 327, 3254, 4069, 4978, 267, 340, 299, 7407, 26, 288, 2034, 63, 1955, 275, 299, 7407, 14, 362, 360, 1606, 63, 1955, 297, 378, 9, 288, 3066, 63, 1606, 63, 890, 275, 299, 7407, 14, 362, 360, 1606, 63, 890, 297, 488, 9, 288, 2034, 63, 890, 275, 3066, 63, 1606, 63, 890, 340, 3066, 63, 1606, 63, 890, 365, 440, 488, 587, 4978, 63, 835, 288, 1242, 63, 928, 12, 1242, 63, 500, 275, 2034, 63, 890, 627, 2034, 63, 1955, 12, 2034, 63, 890, 627, 334, 1606, 63, 1955, 435, 413, 9, 398, 4978, 63, 475, 63, 2384, 275, 291, 14, 3223, 59, 1053, 63, 928, 26, 1053, 63, 500, 61, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 398, 3542, 63, 3352, 275, 1067, 14, 362, 360, 3990, 63, 3352, 297, 488, 9, 398, 367, 1982, 63, 498, 315, 4978, 63, 475, 63, 2384, 26, 288, 327, 12988, 828, 1471, 1172, 282, 7396, 1067, 687, 314, 3555, 6337, 14, 4155, 282, 1331, 14, 288, 1982, 63, 1100, 275, 1067, 14, 1574, 342, 288, 1982, 63, 1100, 459, 2384, 63, 7780, 418, 275, 291, 14, 2384, 63, 3223, 63, 657, 4196, 288, 1982, 63, 1100, 459, 2425, 63, 3773, 63, 11269, 418, 275, 756, 288, 1982, 275, 291, 14, 7726, 14, 362, 63, 1457, 8, 1739, 63, 498, 9, 288, 1982, 63, 1345, 63, 354, 275, 13225, 20957, 1224, 2377, 14, 362, 63, 7780, 63, 1345, 63, 354, 8, 1739, 9, 953, 340, 2649, 8, 1739, 14, 1985, 9, 508, 3542, 63, 3352, 26, 355, 1982, 63, 1100, 459, 2384, 63, 7780, 418, 275, 715, 953, 340, 1982, 63, 1100, 459, 2384, 63, 7780, 2565, 355, 8018, 63, 1739, 275, 291, 14, 7726, 14, 3352, 63, 1739, 8, 1739, 12, 1982, 63, 1345, 63, 354, 12, 1982, 63, 1100, 9, 288, 587, 26, 355, 8018, 63, 1739, 275, 291, 14, 7726, 14, 3352, 63, 1739, 63, 6199, 8, 1739, 12, 1982, 63, 1345, 63, 354, 12, 1982, 63, 1100, 9, 288, 7956, 14, 525, 63, 11255, 63, 4435, 8, 16841, 63, 1739, 9, 953, 4072, 14, 740, 2561, 355, 283, 344, 356, 2649, 8, 1739, 14, 1985, 395, 355, 283, 1317, 356, 8018, 63, 1739, 14, 1317, 12, 288, 3828, 398, 7956, 14, 525, 63, 1317, 8, 288, 291, 14, 7726, 14, 3352, 63, 1160, 480, 19806, 63, 3352, 63, 1606, 68, 63, 3223, 63, 1345, 14, 1360, 401, 469, 355, 283, 1744, 356, 4072, 12, 355, 283, 11283, 63, 1100, 356, 1067, 12, 355, 283, 2425, 63, 525, 356, 883, 63, 525, 12, 355, 283, 2246, 63, 22283, 356, 1242, 63, 928, 12, 355, 283, 2923, 63, 3223, 356, 4978, 63, 835, 12, 355, 283, 22283, 63, 3223, 356, 822, 8, 3223, 63, 475, 63, 2384, 395, 355, 283, 657, 4196, 356, 291, 14, 2384, 63, 3223, 63, 657, 4196, 288, 3828, 267, 776, 339, 768, 1829, 272, 347, 2929, 63, 1308, 63, 1045, 63, 885, 8, 277, 304, 267, 408, 267, 13125, 2929, 1561, 787, 440, 6366, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
UrusTeam/android_ndk_toolchain_cross
share/gdb/python/gdb/command/prompt.py
26
2079
# Extended prompt. # Copyright (C) 2011-2016 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """GDB command for working with extended prompts.""" import gdb import gdb.prompt class _ExtendedPrompt(gdb.Parameter): """Set the extended prompt. Usage: set extended-prompt VALUE Substitutions are applied to VALUE to compute the real prompt. The currently defined substitutions are: """ # Add the prompt library's dynamically generated help to the # __doc__ string. __doc__ = __doc__ + gdb.prompt.prompt_help() set_doc = "Set the extended prompt." show_doc = "Show the extended prompt." def __init__(self): super(_ExtendedPrompt, self).__init__("extended-prompt", gdb.COMMAND_SUPPORT, gdb.PARAM_STRING_NOESCAPE) self.value = '' self.hook_set = False def get_show_string (self, pvalue): if self.value is not '': return "The extended prompt is: " + self.value else: return "The extended prompt is not set." def get_set_string (self): if self.hook_set == False: gdb.prompt_hook = self.before_prompt_hook self.hook_set = True return "" def before_prompt_hook(self, current): if self.value is not '': return gdb.prompt.substitute_prompt(self.value) else: return None _ExtendedPrompt()
gpl-2.0
[ 3, 13706, 8457, 14, 199, 3, 1898, 334, 35, 9, 7760, 13, 9261, 2868, 2290, 2752, 12, 3277, 14, 199, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 624, 39, 2846, 1414, 367, 6449, 543, 9243, 29951, 1041, 199, 199, 646, 12124, 199, 646, 12124, 14, 7650, 199, 199, 533, 485, 14107, 20430, 8, 17119, 14, 4720, 304, 339, 408, 1084, 314, 9243, 8457, 14, 199, 199, 7692, 26, 663, 9243, 13, 7650, 21170, 199, 199, 2610, 6329, 8653, 787, 6781, 370, 21170, 370, 4526, 314, 3363, 8457, 14, 199, 199, 1918, 5544, 3247, 20873, 787, 26, 199, 199, 624, 272, 327, 2654, 314, 8457, 3555, 1159, 18774, 4046, 1720, 370, 314, 272, 327, 636, 1301, 363, 1059, 14, 272, 636, 1301, 363, 275, 636, 1301, 363, 435, 12124, 14, 7650, 14, 7650, 63, 3437, 342, 339, 663, 63, 1301, 275, 298, 1084, 314, 9243, 8457, 2122, 272, 2498, 63, 1301, 275, 298, 6824, 314, 9243, 8457, 2122, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 1547, 14107, 20430, 12, 291, 2843, 826, 29093, 10525, 13, 7650, 401, 6343, 12124, 14, 10761, 63, 10640, 12, 6343, 12124, 14, 7258, 63, 5353, 63, 2826, 28879, 9, 267, 291, 14, 585, 275, 2125, 267, 291, 14, 3664, 63, 409, 275, 756, 339, 347, 664, 63, 2384, 63, 875, 334, 277, 12, 299, 585, 304, 267, 340, 291, 14, 585, 365, 440, 8061, 1779, 372, 298, 1918, 9243, 8457, 365, 26, 298, 435, 291, 14, 585, 267, 587, 26, 1779, 372, 298, 1918, 9243, 8457, 365, 440, 663, 2122, 339, 347, 664, 63, 409, 63, 875, 334, 277, 304, 267, 340, 291, 14, 3664, 63, 409, 508, 756, 26, 1779, 12124, 14, 7650, 63, 3664, 275, 291, 14, 5182, 63, 7650, 63, 3664, 1779, 291, 14, 3664, 63, 409, 275, 715, 267, 372, 3087, 339, 347, 2544, 63, 7650, 63, 3664, 8, 277, 12, 1453, 304, 267, 340, 291, 14, 585, 365, 440, 8061, 288, 372, 12124, 14, 7650, 14, 20374, 63, 7650, 8, 277, 14, 585, 9, 267, 587, 26, 288, 372, 488, 199, 199, 63, 14107, 20430, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 13706, 8457, 14, 199, 3, 1898, 334, 35, 9, 7760, 13, 9261, 2868, 2290, 2752, 12, 3277, 14, 199, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 624, 39, 2846, 1414, 367, 6449, 543, 9243, 29951, 1041, 199, 199, 646, 12124, 199, 646, 12124, 14, 7650, 199, 199, 533, 485, 14107, 20430, 8, 17119, 14, 4720, 304, 339, 408, 1084, 314, 9243, 8457, 14, 199, 199, 7692, 26, 663, 9243, 13, 7650, 21170, 199, 199, 2610, 6329, 8653, 787, 6781, 370, 21170, 370, 4526, 314, 3363, 8457, 14, 199, 199, 1918, 5544, 3247, 20873, 787, 26, 199, 199, 624, 272, 327, 2654, 314, 8457, 3555, 1159, 18774, 4046, 1720, 370, 314, 272, 327, 636, 1301, 363, 1059, 14, 272, 636, 1301, 363, 275, 636, 1301, 363, 435, 12124, 14, 7650, 14, 7650, 63, 3437, 342, 339, 663, 63, 1301, 275, 298, 1084, 314, 9243, 8457, 2122, 272, 2498, 63, 1301, 275, 298, 6824, 314, 9243, 8457, 2122, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 1547, 14107, 20430, 12, 291, 2843, 826, 29093, 10525, 13, 7650, 401, 6343, 12124, 14, 10761, 63, 10640, 12, 6343, 12124, 14, 7258, 63, 5353, 63, 2826, 28879, 9, 267, 291, 14, 585, 275, 2125, 267, 291, 14, 3664, 63, 409, 275, 756, 339, 347, 664, 63, 2384, 63, 875, 334, 277, 12, 299, 585, 304, 267, 340, 291, 14, 585, 365, 440, 8061, 1779, 372, 298, 1918, 9243, 8457, 365, 26, 298, 435, 291, 14, 585, 267, 587, 26, 1779, 372, 298, 1918, 9243, 8457, 365, 440, 663, 2122, 339, 347, 664, 63, 409, 63, 875, 334, 277, 304, 267, 340, 291, 14, 3664, 63, 409, 508, 756, 26, 1779, 12124, 14, 7650, 63, 3664, 275, 291, 14, 5182, 63, 7650, 63, 3664, 1779, 291, 14, 3664, 63, 409, 275, 715, 267, 372, 3087, 339, 347, 2544, 63, 7650, 63, 3664, 8, 277, 12, 1453, 304, 267, 340, 291, 14, 585, 365, 440, 8061, 288, 372, 12124, 14, 7650, 14, 20374, 63, 7650, 8, 277, 14, 585, 9, 267, 587, 26, 288, 372, 488, 199, 199, 63, 14107, 20430, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
phihag/youtube-dl
youtube_dl/extractor/makerschannel.py
66
1593
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor class MakersChannelIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?makerschannel\.com/.*(?P<id_type>video|production)_id=(?P<id>[0-9]+)' _TEST = { 'url': 'http://makerschannel.com/en/zoomin/community-highlights?video_id=849', 'md5': '624a512c6969236b5967bf9286345ad1', 'info_dict': { 'id': '849', 'ext': 'mp4', 'title': 'Landing a bus on a plane is an epic win', 'uploader': 'ZoomIn', 'description': 'md5:cd9cca2ea7b69b78be81d07020c97139', } } def _real_extract(self, url): id_type, url_id = re.match(self._VALID_URL, url).groups() webpage = self._download_webpage(url, url_id) video_data = self._html_search_regex(r'<div([^>]+data-%s-id="%s"[^>]+)>' % (id_type, url_id), webpage, 'video data') def extract_data_val(attr, fatal=False): return self._html_search_regex(r'data-%s\s*=\s*"([^"]+)"' % attr, video_data, attr, fatal=fatal) minoto_id = self._search_regex(r'/id/([a-zA-Z0-9]+)', extract_data_val('video-src', True), 'minoto id') return { '_type': 'url_transparent', 'url': 'minoto:%s' % minoto_id, 'id': extract_data_val('video-id', True), 'title': extract_data_val('title', True), 'description': extract_data_val('description'), 'thumbnail': extract_data_val('image'), 'uploader': extract_data_val('channel'), }
unlicense
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 421, 199, 533, 603, 1151, 1192, 5358, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 1544, 20316, 22191, 1192, 2775, 4537, 957, 15, 2795, 2229, 48, 28, 344, 63, 466, 30, 3722, 92, 10777, 9, 63, 344, 29, 2229, 48, 28, 344, 9514, 16, 13, 25, 29716, 272, 485, 2864, 275, 469, 267, 283, 633, 356, 283, 1014, 921, 22191, 1192, 2775, 14, 957, 15, 287, 15, 10598, 262, 15, 9387, 13, 14337, 83, 31, 3722, 63, 344, 29, 14866, 297, 267, 283, 1064, 21, 356, 283, 28062, 65, 7736, 67, 1876, 1876, 10008, 66, 1427, 1822, 4361, 2942, 1184, 9908, 350, 17, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 14866, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 44, 460, 316, 282, 10414, 641, 282, 16388, 365, 376, 5442, 530, 4747, 297, 288, 283, 13671, 356, 283, 26798, 607, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 2866, 25, 30031, 18, 4489, 23, 66, 1876, 66, 2277, 1235, 2835, 68, 1780, 10173, 67, 2576, 7491, 297, 267, 789, 272, 789, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 1305, 63, 466, 12, 1166, 63, 344, 275, 295, 14, 1431, 8, 277, 423, 5600, 63, 2632, 12, 1166, 680, 2634, 342, 267, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 1166, 63, 344, 9, 267, 3991, 63, 576, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 7601, 3015, 7059, 30, 2807, 576, 3295, 83, 13, 344, 5961, 83, 2, 17478, 11896, 3524, 450, 334, 344, 63, 466, 12, 1166, 63, 344, 395, 9248, 12, 283, 3722, 666, 358, 398, 347, 5536, 63, 576, 63, 637, 8, 962, 12, 14294, 29, 797, 304, 288, 372, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 5121, 419, 3295, 83, 60, 83, 23440, 83, 12469, 15710, 20415, 7, 450, 1921, 12, 3991, 63, 576, 12, 1921, 12, 14294, 29, 16208, 9, 267, 1748, 3459, 63, 344, 275, 291, 423, 1733, 63, 3821, 8, 82, 9807, 344, 15, 779, 65, 13, 6353, 13, 58, 16, 13, 25, 28798, 5536, 63, 576, 63, 637, 360, 3722, 13, 2164, 297, 715, 395, 283, 827, 3459, 1305, 358, 398, 372, 469, 288, 2513, 466, 356, 283, 633, 63, 24420, 297, 288, 283, 633, 356, 283, 827, 3459, 2689, 83, 7, 450, 1748, 3459, 63, 344, 12, 288, 283, 344, 356, 5536, 63, 576, 63, 637, 360, 3722, 13, 344, 297, 715, 395, 288, 283, 1213, 356, 5536, 63, 576, 63, 637, 360, 1213, 297, 715, 395, 288, 283, 1802, 356, 5536, 63, 576, 63, 637, 360, 1802, 659, 288, 283, 8311, 356, 5536, 63, 576, 63, 637, 360, 1569, 659, 288, 283, 13671, 356, 5536, 63, 576, 63, 637, 360, 2775, 659, 267, 789, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 421, 199, 533, 603, 1151, 1192, 5358, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 1544, 20316, 22191, 1192, 2775, 4537, 957, 15, 2795, 2229, 48, 28, 344, 63, 466, 30, 3722, 92, 10777, 9, 63, 344, 29, 2229, 48, 28, 344, 9514, 16, 13, 25, 29716, 272, 485, 2864, 275, 469, 267, 283, 633, 356, 283, 1014, 921, 22191, 1192, 2775, 14, 957, 15, 287, 15, 10598, 262, 15, 9387, 13, 14337, 83, 31, 3722, 63, 344, 29, 14866, 297, 267, 283, 1064, 21, 356, 283, 28062, 65, 7736, 67, 1876, 1876, 10008, 66, 1427, 1822, 4361, 2942, 1184, 9908, 350, 17, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 14866, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 44, 460, 316, 282, 10414, 641, 282, 16388, 365, 376, 5442, 530, 4747, 297, 288, 283, 13671, 356, 283, 26798, 607, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 2866, 25, 30031, 18, 4489, 23, 66, 1876, 66, 2277, 1235, 2835, 68, 1780, 10173, 67, 2576, 7491, 297, 267, 789, 272, 789, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 1305, 63, 466, 12, 1166, 63, 344, 275, 295, 14, 1431, 8, 277, 423, 5600, 63, 2632, 12, 1166, 680, 2634, 342, 267, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 1166, 63, 344, 9, 267, 3991, 63, 576, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 7601, 3015, 7059, 30, 2807, 576, 3295, 83, 13, 344, 5961, 83, 2, 17478, 11896, 3524, 450, 334, 344, 63, 466, 12, 1166, 63, 344, 395, 9248, 12, 283, 3722, 666, 358, 398, 347, 5536, 63, 576, 63, 637, 8, 962, 12, 14294, 29, 797, 304, 288, 372, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 5121, 419, 3295, 83, 60, 83, 23440, 83, 12469, 15710, 20415, 7, 450, 1921, 12, 3991, 63, 576, 12, 1921, 12, 14294, 29, 16208, 9, 267, 1748, 3459, 63, 344, 275, 291, 423, 1733, 63, 3821, 8, 82, 9807, 344, 15, 779, 65, 13, 6353, 13, 58, 16, 13, 25, 28798, 5536, 63, 576, 63, 637, 360, 3722, 13, 2164, 297, 715, 395, 283, 827, 3459, 1305, 358, 398, 372, 469, 288, 2513, 466, 356, 283, 633, 63, 24420, 297, 288, 283, 633, 356, 283, 827, 3459, 2689, 83, 7, 450, 1748, 3459, 63, 344, 12, 288, 283, 344, 356, 5536, 63, 576, 63, 637, 360, 3722, 13, 344, 297, 715, 395, 288, 283, 1213, 356, 5536, 63, 576, 63, 637, 360, 1213, 297, 715, 395, 288, 283, 1802, 356, 5536, 63, 576, 63, 637, 360, 1802, 659, 288, 283, 8311, 356, 5536, 63, 576, 63, 637, 360, 1569, 659, 288, 283, 13671, 356, 5536, 63, 576, 63, 637, 360, 2775, 659, 267, 789, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
taiyuanfang/gyp
test/subdirectory/gyptest-subdir-default.py
185
1026
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies building a subsidiary dependent target from a .gyp file in a subdirectory, without specifying an explicit output build directory, and using the subdirectory's solution or project file as the entry point. """ import TestGyp import errno # Android doesn't support running from subdirectories. # Ninja doesn't support relocation. # CMake produces a single CMakeLists.txt in the output directory. test = TestGyp.TestGyp(formats=['!ninja', '!android', '!cmake']) test.run_gyp('prog1.gyp', chdir='src') test.relocate('src', 'relocate/src') chdir = 'relocate/src/subdir' test.build('prog2.gyp', chdir=chdir) test.built_file_must_not_exist('prog1', type=test.EXECUTABLE, chdir=chdir) test.run_built_executable('prog2', chdir=chdir, stdout="Hello from prog2.c\n") test.pass_test()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 10015, 282, 1007, 338, 328, 695, 11410, 1347, 687, 282, 1275, 6179, 570, 315, 282, 199, 954, 3619, 12, 1928, 9176, 376, 5027, 1072, 1900, 2082, 12, 199, 460, 1808, 314, 25094, 1159, 8744, 503, 2199, 570, 465, 314, 2397, 2376, 14, 199, 624, 199, 199, 646, 25688, 199, 646, 7554, 199, 199, 3, 14694, 3181, 1133, 2291, 3879, 687, 24799, 14, 199, 3, 653, 4135, 3181, 1133, 2291, 295, 1985, 14, 199, 3, 21355, 16904, 282, 2849, 21355, 15116, 14, 2424, 315, 314, 1072, 2082, 14, 199, 396, 275, 25688, 14, 774, 13899, 8, 6321, 2968, 1, 8675, 297, 14597, 6238, 297, 14597, 16472, 1105, 199, 199, 396, 14, 1065, 63, 6179, 360, 6595, 17, 14, 6179, 297, 13097, 534, 2164, 358, 199, 199, 396, 14, 18919, 360, 2164, 297, 283, 18919, 15, 2164, 358, 199, 199, 8563, 275, 283, 18919, 15, 2164, 15, 10622, 7, 199, 199, 396, 14, 1506, 360, 6595, 18, 14, 6179, 297, 13097, 29, 8563, 9, 199, 199, 396, 14, 11730, 63, 493, 63, 7790, 63, 1397, 63, 4494, 360, 6595, 17, 297, 730, 29, 396, 14, 21623, 12, 13097, 29, 8563, 9, 199, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 18, 297, 2079, 13097, 29, 8563, 12, 2079, 3839, 628, 6257, 687, 13205, 18, 14, 67, 60, 78, 531, 199, 199, 396, 14, 1529, 63, 396, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 10015, 282, 1007, 338, 328, 695, 11410, 1347, 687, 282, 1275, 6179, 570, 315, 282, 199, 954, 3619, 12, 1928, 9176, 376, 5027, 1072, 1900, 2082, 12, 199, 460, 1808, 314, 25094, 1159, 8744, 503, 2199, 570, 465, 314, 2397, 2376, 14, 199, 624, 199, 199, 646, 25688, 199, 646, 7554, 199, 199, 3, 14694, 3181, 1133, 2291, 3879, 687, 24799, 14, 199, 3, 653, 4135, 3181, 1133, 2291, 295, 1985, 14, 199, 3, 21355, 16904, 282, 2849, 21355, 15116, 14, 2424, 315, 314, 1072, 2082, 14, 199, 396, 275, 25688, 14, 774, 13899, 8, 6321, 2968, 1, 8675, 297, 14597, 6238, 297, 14597, 16472, 1105, 199, 199, 396, 14, 1065, 63, 6179, 360, 6595, 17, 14, 6179, 297, 13097, 534, 2164, 358, 199, 199, 396, 14, 18919, 360, 2164, 297, 283, 18919, 15, 2164, 358, 199, 199, 8563, 275, 283, 18919, 15, 2164, 15, 10622, 7, 199, 199, 396, 14, 1506, 360, 6595, 18, 14, 6179, 297, 13097, 29, 8563, 9, 199, 199, 396, 14, 11730, 63, 493, 63, 7790, 63, 1397, 63, 4494, 360, 6595, 17, 297, 730, 29, 396, 14, 21623, 12, 13097, 29, 8563, 9, 199, 199, 396, 14, 1065, 63, 11730, 63, 5904, 360, 6595, 18, 297, 2079, 13097, 29, 8563, 12, 2079, 3839, 628, 6257, 687, 13205, 18, 14, 67, 60, 78, 531, 199, 199, 396, 14, 1529, 63, 396, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
sonuyos/couchpotato
libs/unrar2/rar_exceptions.py
153
1391
# Copyright (c) 2003-2005 Jimmy Retzlaff, 2008 Konstantin Yegupov # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # Low level interface - see UnRARDLL\UNRARDLL.TXT class ArchiveHeaderBroken(Exception): pass class InvalidRARArchive(Exception): pass class FileOpenError(Exception): pass class IncorrectRARPassword(Exception): pass class InvalidRARArchiveUsage(Exception): pass
gpl-3.0
[ 3, 1898, 334, 67, 9, 13004, 13, 9397, 1603, 20066, 89, 8747, 90, 416, 556, 12, 9079, 1804, 265, 4715, 262, 1488, 5902, 384, 8822, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 199, 3, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 199, 3, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 199, 3, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 199, 3, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 199, 3, 5120, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 3, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 199, 3, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 199, 3, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 1621, 1261, 199, 3, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 199, 3, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 199, 3, 4141, 14, 199, 199, 3, 21766, 2166, 3217, 446, 1937, 1910, 50, 7816, 4464, 60, 1734, 50, 7816, 4464, 14, 17715, 421, 199, 533, 19521, 1912, 2567, 30509, 8, 1726, 304, 986, 199, 533, 6378, 50, 689, 13042, 8, 1726, 304, 986, 199, 533, 3814, 4299, 547, 8, 1726, 304, 986, 199, 533, 1010, 4525, 50, 689, 6139, 8, 1726, 304, 986, 199, 533, 6378, 50, 689, 13042, 7692, 8, 1726, 304, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 334, 67, 9, 13004, 13, 9397, 1603, 20066, 89, 8747, 90, 416, 556, 12, 9079, 1804, 265, 4715, 262, 1488, 5902, 384, 8822, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 199, 3, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 199, 3, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 199, 3, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 199, 3, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 199, 3, 5120, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 3, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 199, 3, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 199, 3, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 1621, 1261, 199, 3, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 199, 3, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 199, 3, 4141, 14, 199, 199, 3, 21766, 2166, 3217, 446, 1937, 1910, 50, 7816, 4464, 60, 1734, 50, 7816, 4464, 14, 17715, 421, 199, 533, 19521, 1912, 2567, 30509, 8, 1726, 304, 986, 199, 533, 6378, 50, 689, 13042, 8, 1726, 304, 986, 199, 533, 3814, 4299, 547, 8, 1726, 304, 986, 199, 533, 1010, 4525, 50, 689, 6139, 8, 1726, 304, 986, 199, 533, 6378, 50, 689, 13042, 7692, 8, 1726, 304, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ForestClaw/forestclaw
applications/paper/transport_cylinder/setplot.py
3
3668
""" Set up the plot figures, axes, and items to be done for each frame. This module is imported by the plotting routines and then the function setplot is called to set the plot parameters. """ from __future__ import absolute_import #-------------------------- def setplot(plotdata=None): #-------------------------- """ Specify what is to be plotted at each frame. Input: plotdata, an instance of ClawPlotData. Output: a modified version of plotdata. """ from clawpack.visclaw import colormaps if plotdata is None: from clawpack.visclaw.data import ClawPlotData plotdata = ClawPlotData() plotdata.clearfigures() # clear any old figures,axes,items data # Figure for pcolor plot plotfigure = plotdata.new_plotfigure(name='q[0]', figno=0) # Set up for axes in this figure: plotaxes = plotfigure.new_plotaxes() plotaxes.xlimits = 'auto' plotaxes.ylimits = 'auto' plotaxes.title = 'q[0]' plotaxes.scaled = True # Set up for item on these axes: plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor') plotitem.plot_var = 0 plotitem.pcolor_cmap = colormaps.yellow_red_blue plotitem.pcolor_cmin = 0.0 plotitem.pcolor_cmax = 1.0 plotitem.add_colorbar = True plotitem.amr_celledges_show = [True, True, False] plotitem.amr_patchedges_show = [True, True] plotitem.show = True # show on plot? # Figure for contour plot plotfigure = plotdata.new_plotfigure(name='contour', figno=1) # Set up for axes in this figure: plotaxes = plotfigure.new_plotaxes() plotaxes.xlimits = 'auto' plotaxes.ylimits = 'auto' plotaxes.title = 'q[0]' plotaxes.scaled = True # Set up for item on these axes: plotitem = plotaxes.new_plotitem(plot_type='2d_contour') plotitem.plot_var = 0 plotitem.contour_nlevels = 20 plotitem.contour_min = 0.01 plotitem.contour_max = 0.99 plotitem.amr_contour_colors = ['b','k','r'] plotitem.show = True # show on plot? #----------------------------------------- # Figures for gauges #----------------------------------------- plotfigure = plotdata.new_plotfigure(name='q', figno=300, \ type='each_gauge') plotfigure.clf_each_gauge = True # Set up for axes in this figure: plotaxes = plotfigure.new_plotaxes() plotaxes.xlimits = 'auto' plotaxes.ylimits = 'auto' plotaxes.title = 'q' # Plot q as blue curve: plotitem = plotaxes.new_plotitem(plot_type='1d_plot') plotitem.plot_var = 0 plotitem.plotstyle = 'b-' #----------------------------------------- # Parameters used only when creating html and/or latex hardcopy # e.g., via clawpack.visclaw.frametools.printframes: plotdata.printfigs = True # print figures plotdata.print_format = 'png' # file format plotdata.print_framenos = 'all' # list of frames to print plotdata.print_fignos = 'all' # list of figures to print plotdata.html = True # create html files of plots? plotdata.html_homelink = '../README.html' # pointer for top of index plotdata.html_movie = 'JSAnimation' # new style, or "4.x" for old style plotdata.latex = True # create latex file of plots? plotdata.latex_figsperline = 2 # layout of plots plotdata.latex_framesperline = 1 # layout of plots plotdata.latex_makepdf = False # also run pdflatex? plotdata.parallel = True # make multiple frame png's at once return plotdata
bsd-2-clause
[ 199, 624, 221, 199, 1084, 1536, 314, 5137, 6085, 1482, 12, 7824, 12, 436, 2974, 370, 506, 4224, 367, 1924, 2787, 14, 199, 199, 2765, 859, 365, 8439, 701, 314, 25174, 14975, 436, 2066, 314, 199, 1593, 663, 2798, 365, 2797, 370, 663, 314, 5137, 2633, 14, 1362, 199, 624, 9948, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 32152, 9460, 199, 318, 663, 2798, 8, 2798, 576, 29, 403, 304, 199, 32152, 9460, 2286, 408, 5591, 13327, 4052, 365, 370, 506, 5137, 471, 737, 1924, 2787, 14, 272, 6924, 26, 221, 5137, 576, 12, 376, 1256, 402, 445, 22277, 10711, 1451, 14, 272, 7242, 26, 282, 6042, 1015, 402, 5137, 576, 14, 2286, 408, 18407, 687, 6108, 87, 1389, 14, 5068, 3995, 87, 492, 3164, 8919, 339, 340, 5137, 576, 365, 488, 26, 267, 687, 6108, 87, 1389, 14, 5068, 3995, 87, 14, 576, 492, 445, 22277, 10711, 1451, 267, 5137, 576, 275, 445, 22277, 10711, 1451, 342, 339, 5137, 576, 14, 3584, 592, 1482, 342, 221, 327, 5436, 1263, 2269, 6085, 1482, 12, 6402, 12, 1744, 666, 1362, 339, 327, 16266, 367, 299, 2326, 5137, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 81, 59, 16, 4300, 6085, 889, 29, 16, 9, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 59, 16, 6616, 272, 299, 320, 22272, 14, 15120, 275, 715, 339, 327, 2494, 1536, 367, 1242, 641, 3520, 7824, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 18, 68, 63, 80, 2326, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 80, 2326, 63, 16513, 275, 3164, 8919, 14, 14514, 63, 581, 63, 6304, 272, 299, 320, 4484, 14, 80, 2326, 63, 67, 827, 275, 378, 14, 16, 272, 299, 320, 4484, 14, 80, 2326, 63, 67, 988, 275, 413, 14, 16, 272, 299, 320, 4484, 14, 525, 63, 30995, 275, 715, 272, 299, 320, 4484, 14, 455, 82, 63, 6067, 1146, 3389, 63, 2384, 275, 359, 549, 12, 715, 12, 756, 61, 272, 299, 320, 4484, 14, 455, 82, 63, 2068, 6929, 63, 2384, 275, 359, 549, 12, 715, 61, 272, 299, 320, 4484, 14, 2384, 275, 715, 755, 327, 2498, 641, 5137, 31, 2286, 327, 16266, 367, 23176, 5137, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 17798, 297, 6085, 889, 29, 17, 9, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 59, 16, 6616, 272, 299, 320, 22272, 14, 15120, 275, 715, 339, 327, 2494, 1536, 367, 1242, 641, 3520, 7824, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 18, 68, 63, 17798, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 17798, 63, 78, 11402, 275, 3388, 272, 299, 320, 4484, 14, 17798, 63, 827, 275, 378, 14, 614, 272, 299, 320, 4484, 14, 17798, 63, 988, 275, 378, 14, 1020, 272, 299, 320, 4484, 14, 455, 82, 63, 17798, 63, 7120, 275, 788, 66, 1673, 75, 1673, 82, 418, 272, 299, 320, 4484, 14, 2384, 275, 715, 755, 327, 2498, 641, 5137, 31, 339, 327, 1444, 9960, 272, 327, 481, 528, 1482, 367, 486, 3844, 3389, 272, 327, 1444, 9960, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 81, 297, 6085, 889, 29, 5863, 12, 971, 490, 730, 534, 10885, 63, 26775, 358, 272, 5137, 8941, 14, 9694, 63, 10885, 63, 26775, 275, 715, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 7, 339, 327, 14794, 1894, 465, 10030, 15318, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 17, 68, 63, 2798, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 2798, 2487, 275, 283, 66, 15668, 339, 327, 1444, 9960, 339, 327, 3897, 1202, 1454, 1380, 6425, 3517, 436, 15, 269, 15571, 7508, 1574, 272, 327, 325, 14, 71, 2020, 4799, 6108, 87, 1389, 14, 5068, 3995, 87, 14, 1943, 2537, 14, 1361, 8444, 26, 339, 5137, 576, 14, 1361, 5513, 275, 715, 4483, 327, 870, 6085, 1482, 272, 5137, 576, 14, 1361, 63, 908, 275, 283, 4524, 7, 3322, 327, 570, 1475, 272, 5137, 576, 14, 1361, 63, 1943, 12712, 275, 283, 452, 7, 3515, 327, 769, 402, 11223, 370, 870, 272, 5137, 576, 14, 1361, 63, 592, 12712, 275, 283, 452, 7, 3322, 327, 769, 402, 6085, 1482, 370, 870, 272, 5137, 576, 14, 1360, 275, 715, 9326, 327, 1218, 3517, 1584, 402, 19695, 31, 272, 5137, 576, 14, 1360, 63, 4219, 1073, 275, 20644, 18195, 14, 1360, 7, 257, 327, 7849, 367, 2746, 402, 1478, 272, 5137, 576, 14, 1360, 63, 10888, 275, 283, 11378, 15957, 7, 420, 327, 892, 3449, 12, 503, 298, 20, 14, 88, 2, 367, 2269, 3449, 272, 5137, 576, 14, 7572, 275, 715, 8540, 327, 1218, 15571, 570, 402, 19695, 31, 272, 5137, 576, 14, 7572, 63, 5513, 529, 604, 275, 499, 3698, 327, 7054, 402, 19695, 272, 5137, 576, 14, 7572, 63, 8444, 529, 604, 275, 413, 260, 327, 7054, 402, 19695, 272, 5137, 576, 14, 7572 ]
[ 624, 221, 199, 1084, 1536, 314, 5137, 6085, 1482, 12, 7824, 12, 436, 2974, 370, 506, 4224, 367, 1924, 2787, 14, 199, 199, 2765, 859, 365, 8439, 701, 314, 25174, 14975, 436, 2066, 314, 199, 1593, 663, 2798, 365, 2797, 370, 663, 314, 5137, 2633, 14, 1362, 199, 624, 9948, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 32152, 9460, 199, 318, 663, 2798, 8, 2798, 576, 29, 403, 304, 199, 32152, 9460, 2286, 408, 5591, 13327, 4052, 365, 370, 506, 5137, 471, 737, 1924, 2787, 14, 272, 6924, 26, 221, 5137, 576, 12, 376, 1256, 402, 445, 22277, 10711, 1451, 14, 272, 7242, 26, 282, 6042, 1015, 402, 5137, 576, 14, 2286, 408, 18407, 687, 6108, 87, 1389, 14, 5068, 3995, 87, 492, 3164, 8919, 339, 340, 5137, 576, 365, 488, 26, 267, 687, 6108, 87, 1389, 14, 5068, 3995, 87, 14, 576, 492, 445, 22277, 10711, 1451, 267, 5137, 576, 275, 445, 22277, 10711, 1451, 342, 339, 5137, 576, 14, 3584, 592, 1482, 342, 221, 327, 5436, 1263, 2269, 6085, 1482, 12, 6402, 12, 1744, 666, 1362, 339, 327, 16266, 367, 299, 2326, 5137, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 81, 59, 16, 4300, 6085, 889, 29, 16, 9, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 59, 16, 6616, 272, 299, 320, 22272, 14, 15120, 275, 715, 339, 327, 2494, 1536, 367, 1242, 641, 3520, 7824, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 18, 68, 63, 80, 2326, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 80, 2326, 63, 16513, 275, 3164, 8919, 14, 14514, 63, 581, 63, 6304, 272, 299, 320, 4484, 14, 80, 2326, 63, 67, 827, 275, 378, 14, 16, 272, 299, 320, 4484, 14, 80, 2326, 63, 67, 988, 275, 413, 14, 16, 272, 299, 320, 4484, 14, 525, 63, 30995, 275, 715, 272, 299, 320, 4484, 14, 455, 82, 63, 6067, 1146, 3389, 63, 2384, 275, 359, 549, 12, 715, 12, 756, 61, 272, 299, 320, 4484, 14, 455, 82, 63, 2068, 6929, 63, 2384, 275, 359, 549, 12, 715, 61, 272, 299, 320, 4484, 14, 2384, 275, 715, 755, 327, 2498, 641, 5137, 31, 2286, 327, 16266, 367, 23176, 5137, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 17798, 297, 6085, 889, 29, 17, 9, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 59, 16, 6616, 272, 299, 320, 22272, 14, 15120, 275, 715, 339, 327, 2494, 1536, 367, 1242, 641, 3520, 7824, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 18, 68, 63, 17798, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 17798, 63, 78, 11402, 275, 3388, 272, 299, 320, 4484, 14, 17798, 63, 827, 275, 378, 14, 614, 272, 299, 320, 4484, 14, 17798, 63, 988, 275, 378, 14, 1020, 272, 299, 320, 4484, 14, 455, 82, 63, 17798, 63, 7120, 275, 788, 66, 1673, 75, 1673, 82, 418, 272, 299, 320, 4484, 14, 2384, 275, 715, 755, 327, 2498, 641, 5137, 31, 339, 327, 1444, 9960, 272, 327, 481, 528, 1482, 367, 486, 3844, 3389, 272, 327, 1444, 9960, 272, 5137, 8941, 275, 5137, 576, 14, 1222, 63, 2798, 8941, 8, 354, 534, 81, 297, 6085, 889, 29, 5863, 12, 971, 490, 730, 534, 10885, 63, 26775, 358, 272, 5137, 8941, 14, 9694, 63, 10885, 63, 26775, 275, 715, 339, 327, 2494, 1536, 367, 7824, 315, 642, 9658, 26, 272, 299, 320, 22272, 275, 5137, 8941, 14, 1222, 63, 80, 320, 22272, 342, 272, 299, 320, 22272, 14, 88, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 89, 9368, 275, 283, 2495, 7, 272, 299, 320, 22272, 14, 1213, 275, 283, 81, 7, 339, 327, 14794, 1894, 465, 10030, 15318, 26, 272, 299, 320, 4484, 275, 299, 320, 22272, 14, 1222, 63, 80, 320, 4484, 8, 2798, 63, 466, 534, 17, 68, 63, 2798, 358, 272, 299, 320, 4484, 14, 2798, 63, 1391, 275, 378, 272, 299, 320, 4484, 14, 2798, 2487, 275, 283, 66, 15668, 339, 327, 1444, 9960, 339, 327, 3897, 1202, 1454, 1380, 6425, 3517, 436, 15, 269, 15571, 7508, 1574, 272, 327, 325, 14, 71, 2020, 4799, 6108, 87, 1389, 14, 5068, 3995, 87, 14, 1943, 2537, 14, 1361, 8444, 26, 339, 5137, 576, 14, 1361, 5513, 275, 715, 4483, 327, 870, 6085, 1482, 272, 5137, 576, 14, 1361, 63, 908, 275, 283, 4524, 7, 3322, 327, 570, 1475, 272, 5137, 576, 14, 1361, 63, 1943, 12712, 275, 283, 452, 7, 3515, 327, 769, 402, 11223, 370, 870, 272, 5137, 576, 14, 1361, 63, 592, 12712, 275, 283, 452, 7, 3322, 327, 769, 402, 6085, 1482, 370, 870, 272, 5137, 576, 14, 1360, 275, 715, 9326, 327, 1218, 3517, 1584, 402, 19695, 31, 272, 5137, 576, 14, 1360, 63, 4219, 1073, 275, 20644, 18195, 14, 1360, 7, 257, 327, 7849, 367, 2746, 402, 1478, 272, 5137, 576, 14, 1360, 63, 10888, 275, 283, 11378, 15957, 7, 420, 327, 892, 3449, 12, 503, 298, 20, 14, 88, 2, 367, 2269, 3449, 272, 5137, 576, 14, 7572, 275, 715, 8540, 327, 1218, 15571, 570, 402, 19695, 31, 272, 5137, 576, 14, 7572, 63, 5513, 529, 604, 275, 499, 3698, 327, 7054, 402, 19695, 272, 5137, 576, 14, 7572, 63, 8444, 529, 604, 275, 413, 260, 327, 7054, 402, 19695, 272, 5137, 576, 14, 7572, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN', '%Y-%m-%d': '%Y.%m.%d.', '%Y-%m-%d %H:%M:%S': '%Y.%m.%d. %H:%M:%S', '%s rows deleted': '%s sorok t\xc3\xb6rl\xc5\x91dtek', '%s rows updated': '%s sorok friss\xc3\xadt\xc5\x91dtek', 'Available databases and tables': 'El\xc3\xa9rhet\xc5\x91 adatb\xc3\xa1zisok \xc3\xa9s t\xc3\xa1bl\xc3\xa1k', 'Cannot be empty': 'Nem lehet \xc3\xbcres', 'Check to delete': 'T\xc3\xb6rl\xc3\xa9shez v\xc3\xa1laszd ki', 'Client IP': 'Client IP', 'Controller': 'Controller', 'Copyright': 'Copyright', 'Current request': 'Jelenlegi lek\xc3\xa9rdez\xc3\xa9s', 'Current response': 'Jelenlegi v\xc3\xa1lasz', 'Current session': 'Jelenlegi folyamat', 'DB Model': 'DB Model', 'Database': 'Adatb\xc3\xa1zis', 'Delete:': 'T\xc3\xb6r\xc3\xb6l:', 'Description': 'Description', 'E-mail': 'E-mail', 'Edit': 'Szerkeszt', 'Edit This App': 'Alkalmaz\xc3\xa1st szerkeszt', 'Edit current record': 'Aktu\xc3\xa1lis bejegyz\xc3\xa9s szerkeszt\xc3\xa9se', 'First name': 'First name', 'Group ID': 'Group ID', 'Hello World': 'Hello Vil\xc3\xa1g', 'Import/Export': 'Import/Export', 'Index': 'Index', 'Internal State': 'Internal State', 'Invalid Query': 'Hib\xc3\xa1s lek\xc3\xa9rdez\xc3\xa9s', 'Invalid email': 'Invalid email', 'Last name': 'Last name', 'Layout': 'Szerkezet', 'Main Menu': 'F\xc5\x91men\xc3\xbc', 'Menu Model': 'Men\xc3\xbc model', 'Name': 'Name', 'New Record': '\xc3\x9aj bejegyz\xc3\xa9s', 'No databases in this application': 'Nincs adatb\xc3\xa1zis ebben az alkalmaz\xc3\xa1sban', 'Origin': 'Origin', 'Password': 'Password', 'Powered by': 'Powered by', 'Query:': 'Lek\xc3\xa9rdez\xc3\xa9s:', 'Record ID': 'Record ID', 'Registration key': 'Registration key', 'Reset Password key': 'Reset Password key', 'Role': 'Role', 'Rows in table': 'Sorok a t\xc3\xa1bl\xc3\xa1ban', 'Rows selected': 'Kiv\xc3\xa1lasztott sorok', 'Stylesheet': 'Stylesheet', 'Sure you want to delete this object?': 'Biztos t\xc3\xb6rli ezt az objektumot?', 'Table name': 'Table name', 'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.', 'Timestamp': 'Timestamp', 'Update:': 'Friss\xc3\xadt:', 'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.', 'User ID': 'User ID', 'View': 'N\xc3\xa9zet', 'Welcome %s': 'Welcome %s', 'Welcome to web2py': 'Isten hozott a web2py-ban', 'appadmin is disabled because insecure channel': 'az appadmin a biztons\xc3\xa1gtalan csatorna miatt letiltva', 'cache': 'gyors\xc3\xadt\xc3\xb3t\xc3\xa1r', 'change password': 'jelsz\xc3\xb3 megv\xc3\xa1ltoztat\xc3\xa1sa', 'Online examples': 'online p\xc3\xa9ld\xc3\xa1k\xc3\xa9rt kattints ide', 'Administrative interface': 'az adminisztr\xc3\xa1ci\xc3\xb3s fel\xc3\xbclet\xc3\xa9rt kattints ide', 'customize me!': 'v\xc3\xa1ltoztass meg!', 'data uploaded': 'adat felt\xc3\xb6ltve', 'database': 'adatb\xc3\xa1zis', 'database %s select': 'adatb\xc3\xa1zis %s kiv\xc3\xa1laszt\xc3\xa1s', 'db': 'db', 'design': 'design', 'done!': 'k\xc3\xa9sz!', 'edit profile': 'profil szerkeszt\xc3\xa9se', 'export as csv file': 'export\xc3\xa1l csv f\xc3\xa1jlba', 'insert new': '\xc3\xbaj beilleszt\xc3\xa9se', 'insert new %s': '\xc3\xbaj beilleszt\xc3\xa9se %s', 'invalid request': 'hib\xc3\xa1s k\xc3\xa9r\xc3\xa9s', 'login': 'bel\xc3\xa9p', 'logout': 'kil\xc3\xa9p', 'lost password': 'elveszett jelsz\xc3\xb3', 'new record inserted': '\xc3\xbaj bejegyz\xc3\xa9s felv\xc3\xa9ve', 'next 100 rows': 'k\xc3\xb6vetkez\xc5\x91 100 sor', 'or import from csv file': 'vagy bet\xc3\xb6lt\xc3\xa9s csv f\xc3\xa1jlb\xc3\xb3l', 'previous 100 rows': 'el\xc5\x91z\xc5\x91 100 sor', 'record': 'bejegyz\xc3\xa9s', 'record does not exist': 'bejegyz\xc3\xa9s nem l\xc3\xa9tezik', 'record id': 'bejegyz\xc3\xa9s id', 'register': 'regisztr\xc3\xa1ci\xc3\xb3', 'selected': 'kiv\xc3\xa1lasztott', 'state': '\xc3\xa1llapot', 'table': 't\xc3\xa1bla', 'unable to parse csv file': 'nem lehet a csv f\xc3\xa1jlt beolvasni', }
gpl-3.0
[ 3, 2803, 26, 2774, 24, 199, 91, 199, 4065, 873, 2, 365, 376, 2716, 3965, 2839, 298, 698, 17, 25641, 1222, 585, 3985, 1674, 2047, 3913, 1678, 503, 3145, 314, 2058, 402, 282, 10593, 356, 5522, 873, 2, 365, 376, 2716, 3965, 2839, 298, 698, 17, 25641, 1222, 585, 3985, 1674, 2047, 3913, 1678, 503, 3145, 314, 2058, 402, 282, 10593, 297, 199, 5956, 57, 3295, 77, 3295, 68, 356, 1543, 57, 4111, 77, 4111, 68, 3130, 199, 5956, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 356, 1543, 57, 4111, 77, 4111, 68, 14, 450, 40, 2689, 45, 2689, 51, 297, 199, 5956, 83, 4730, 5463, 356, 1543, 83, 308, 269, 745, 307, 60, 1812, 19, 60, 1774, 22, 4308, 60, 1812, 21, 60, 88, 3328, 68, 266, 75, 297, 199, 5956, 83, 4730, 4588, 356, 1543, 83, 308, 269, 745, 289, 322, 385, 60, 1812, 19, 60, 10135, 84, 60, 1812, 21, 60, 88, 3328, 68, 266, 75, 297, 199, 7, 11464, 16219, 436, 6716, 356, 283, 10420, 60, 1812, 19, 60, 1800, 25, 17157, 386, 60, 1812, 21, 60, 88, 3328, 1503, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 745, 971, 1812, 19, 60, 1800, 25, 83, 307, 60, 1812, 19, 60, 1800, 17, 3345, 60, 1812, 19, 60, 1800, 17, 75, 297, 199, 7, 6612, 506, 2701, 356, 283, 4698, 77, 1026, 72, 386, 971, 1812, 19, 60, 10323, 470, 297, 199, 7, 1799, 370, 3145, 356, 283, 52, 60, 1812, 19, 60, 1774, 22, 4308, 60, 1812, 19, 60, 1800, 25, 19195, 90, 373, 60, 1812, 19, 60, 1800, 17, 12536, 23670, 1022, 73, 297, 199, 7, 3041, 3531, 356, 283, 3041, 3531, 297, 199, 7, 7506, 356, 283, 7506, 297, 199, 7, 7384, 356, 283, 7384, 297, 199, 7, 5639, 1056, 356, 283, 27888, 552, 4170, 73, 1026, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 5639, 1177, 356, 283, 27888, 552, 4170, 73, 373, 60, 1812, 19, 60, 1800, 17, 12536, 90, 297, 199, 7, 5639, 2351, 356, 283, 27888, 552, 4170, 73, 1699, 89, 455, 292, 297, 199, 7, 2846, 5822, 356, 283, 2846, 5822, 297, 199, 7, 7243, 356, 283, 2767, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 297, 199, 7, 5392, 25156, 283, 52, 60, 1812, 19, 60, 1774, 22, 82, 60, 1812, 19, 60, 1774, 22, 76, 6536, 199, 7, 5831, 356, 283, 5831, 297, 199, 7, 37, 13, 1198, 356, 283, 37, 13, 1198, 297, 199, 7, 4685, 356, 283, 51, 2282, 9246, 90, 84, 297, 199, 7, 4685, 961, 4693, 356, 283, 2439, 26446, 391, 90, 60, 1812, 19, 60, 1800, 17, 270, 308, 2282, 9246, 90, 84, 297, 199, 7, 4685, 1453, 2777, 356, 283, 33, 5973, 85, 60, 1812, 19, 60, 1800, 17, 14392, 506, 6532, 4312, 90, 60, 1812, 19, 60, 1800, 25, 83, 308, 2282, 9246, 90, 84, 60, 1812, 19, 60, 1800, 25, 261, 297, 199, 7, 7147, 536, 356, 283, 7147, 536, 297, 199, 7, 2448, 2870, 356, 283, 2448, 2870, 297, 199, 7, 6257, 13064, 356, 283, 6257, 812, 382, 60, 1812, 19, 60, 1800, 17, 71, 297, 199, 7, 6295, 15, 11399, 356, 283, 6295, 15, 11399, 297, 199, 7, 2681, 356, 283, 2681, 297, 199, 7, 8405, 8511, 356, 283, 8405, 8511, 297, 199, 7, 3364, 8133, 356, 283, 40, 1892, 60, 1812, 19, 60, 1800, 17, 83, 1026, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 3364, 3031, 356, 283, 3364, 3031, 297, 199, 7, 6090, 536, 356, 283, 6090, 536, 297, 199, 7, 4798, 356, 283, 51, 2282, 415, 90, 386, 297, 199, 7, 6756, 18281, 356, 283, 38, 60, 1812, 21, 60, 88, 3328, 1410, 60, 1812, 19, 60, 10323, 297, 199, 7, 5977, 5822, 356, 283, 29230, 60, 1812, 19, 60, 10323, 1402, 297, 199, 7, 985, 356, 283, 985, 297, 199, 7, 4665, 12651, 356, 1557, 1812, 19, 60, 88, 25, 9091, 506, 6532, 4312, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 1944, 16219, 315, 642, 4223, 356, 283, 46, 262, 1259, 1503, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 325, 2501, 287, 24978, 741, 26446, 391, 90, 60, 1812, 19, 60, 1800, 17, 9264, 290, 297, 199, 7, 12834, 356, 283, 12834, 297, 199, 7, 6139, 356, 283, 6139, 297, 199, 7, 23432, 16179, 701, 356, 283, 23432, 16179, 701, 297, 199, 7, 3227, 25156, 283, 2553, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 6536, 199, 7, 5433, 2870, 356, 283, 5433, 2870, 297, 199, 7, 11757, 790, 356, 283, 11757, 790, 297, 199, 7, 9637, 13635, 790, 356, 283, 9637, 13635, 790, 297, 199, 7, 7422, 356, 283, 7422, 297, 199, 7, 13405, 315, 1817, 356, 283, 51, 269, 745, 282, 307, 60, 1812, 19, 60, 1800, 17, 3345, 60, 1812, 19, 60, 1800, 17, 13206, 297, 199, 7, 13405, 4895, 356, 283, 43, 1003, 60, 1812, 19, 60, 1800, 17, 12536, 90, 13280, 84, 308, 269, 745, 297, 199, 7, 30349, 3797, 356, 283, 30349, 3797, 297, 199, 7, 51, 608, 1265, 2934, 370, 3145, 642, 909, 28867, 283, 34, 565, 14543, 307, 60, 1812, 19, 60, 1774, 22, 82, 317, 325, 90, 84, 24978, 1559, 5711, 84, 453, 357, 7044, 199, 7, 3186, 536, 356, 283, 3186, 536, 297, 199, 7, 1918, 298, 1131, 2, 365, 282, 5558, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 3985, 585, 3985, 1674, 27173, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 697, 14, 1224, 18, 14, 698, 18, 2, 2058, 315, 282, 5385, 10593, 10586, 283, 1918, 298, 1131, 2, 365, 282, 5558, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 3985, 585, 3985, 1674, 27173, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 697, 14, 1224, 18, 14, 698, 18, 2, 2058, 315, 282, 5385, 10593, 3130, 199, 7, 10239, 356, 283, 10239, 297, 199, 7 ]
[ 2803, 26, 2774, 24, 199, 91, 199, 4065, 873, 2, 365, 376, 2716, 3965, 2839, 298, 698, 17, 25641, 1222, 585, 3985, 1674, 2047, 3913, 1678, 503, 3145, 314, 2058, 402, 282, 10593, 356, 5522, 873, 2, 365, 376, 2716, 3965, 2839, 298, 698, 17, 25641, 1222, 585, 3985, 1674, 2047, 3913, 1678, 503, 3145, 314, 2058, 402, 282, 10593, 297, 199, 5956, 57, 3295, 77, 3295, 68, 356, 1543, 57, 4111, 77, 4111, 68, 3130, 199, 5956, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 356, 1543, 57, 4111, 77, 4111, 68, 14, 450, 40, 2689, 45, 2689, 51, 297, 199, 5956, 83, 4730, 5463, 356, 1543, 83, 308, 269, 745, 307, 60, 1812, 19, 60, 1774, 22, 4308, 60, 1812, 21, 60, 88, 3328, 68, 266, 75, 297, 199, 5956, 83, 4730, 4588, 356, 1543, 83, 308, 269, 745, 289, 322, 385, 60, 1812, 19, 60, 10135, 84, 60, 1812, 21, 60, 88, 3328, 68, 266, 75, 297, 199, 7, 11464, 16219, 436, 6716, 356, 283, 10420, 60, 1812, 19, 60, 1800, 25, 17157, 386, 60, 1812, 21, 60, 88, 3328, 1503, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 745, 971, 1812, 19, 60, 1800, 25, 83, 307, 60, 1812, 19, 60, 1800, 17, 3345, 60, 1812, 19, 60, 1800, 17, 75, 297, 199, 7, 6612, 506, 2701, 356, 283, 4698, 77, 1026, 72, 386, 971, 1812, 19, 60, 10323, 470, 297, 199, 7, 1799, 370, 3145, 356, 283, 52, 60, 1812, 19, 60, 1774, 22, 4308, 60, 1812, 19, 60, 1800, 25, 19195, 90, 373, 60, 1812, 19, 60, 1800, 17, 12536, 23670, 1022, 73, 297, 199, 7, 3041, 3531, 356, 283, 3041, 3531, 297, 199, 7, 7506, 356, 283, 7506, 297, 199, 7, 7384, 356, 283, 7384, 297, 199, 7, 5639, 1056, 356, 283, 27888, 552, 4170, 73, 1026, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 5639, 1177, 356, 283, 27888, 552, 4170, 73, 373, 60, 1812, 19, 60, 1800, 17, 12536, 90, 297, 199, 7, 5639, 2351, 356, 283, 27888, 552, 4170, 73, 1699, 89, 455, 292, 297, 199, 7, 2846, 5822, 356, 283, 2846, 5822, 297, 199, 7, 7243, 356, 283, 2767, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 297, 199, 7, 5392, 25156, 283, 52, 60, 1812, 19, 60, 1774, 22, 82, 60, 1812, 19, 60, 1774, 22, 76, 6536, 199, 7, 5831, 356, 283, 5831, 297, 199, 7, 37, 13, 1198, 356, 283, 37, 13, 1198, 297, 199, 7, 4685, 356, 283, 51, 2282, 9246, 90, 84, 297, 199, 7, 4685, 961, 4693, 356, 283, 2439, 26446, 391, 90, 60, 1812, 19, 60, 1800, 17, 270, 308, 2282, 9246, 90, 84, 297, 199, 7, 4685, 1453, 2777, 356, 283, 33, 5973, 85, 60, 1812, 19, 60, 1800, 17, 14392, 506, 6532, 4312, 90, 60, 1812, 19, 60, 1800, 25, 83, 308, 2282, 9246, 90, 84, 60, 1812, 19, 60, 1800, 25, 261, 297, 199, 7, 7147, 536, 356, 283, 7147, 536, 297, 199, 7, 2448, 2870, 356, 283, 2448, 2870, 297, 199, 7, 6257, 13064, 356, 283, 6257, 812, 382, 60, 1812, 19, 60, 1800, 17, 71, 297, 199, 7, 6295, 15, 11399, 356, 283, 6295, 15, 11399, 297, 199, 7, 2681, 356, 283, 2681, 297, 199, 7, 8405, 8511, 356, 283, 8405, 8511, 297, 199, 7, 3364, 8133, 356, 283, 40, 1892, 60, 1812, 19, 60, 1800, 17, 83, 1026, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 3364, 3031, 356, 283, 3364, 3031, 297, 199, 7, 6090, 536, 356, 283, 6090, 536, 297, 199, 7, 4798, 356, 283, 51, 2282, 415, 90, 386, 297, 199, 7, 6756, 18281, 356, 283, 38, 60, 1812, 21, 60, 88, 3328, 1410, 60, 1812, 19, 60, 10323, 297, 199, 7, 5977, 5822, 356, 283, 29230, 60, 1812, 19, 60, 10323, 1402, 297, 199, 7, 985, 356, 283, 985, 297, 199, 7, 4665, 12651, 356, 1557, 1812, 19, 60, 88, 25, 9091, 506, 6532, 4312, 90, 60, 1812, 19, 60, 1800, 25, 83, 297, 199, 7, 1944, 16219, 315, 642, 4223, 356, 283, 46, 262, 1259, 1503, 292, 66, 60, 1812, 19, 60, 1800, 17, 90, 374, 325, 2501, 287, 24978, 741, 26446, 391, 90, 60, 1812, 19, 60, 1800, 17, 9264, 290, 297, 199, 7, 12834, 356, 283, 12834, 297, 199, 7, 6139, 356, 283, 6139, 297, 199, 7, 23432, 16179, 701, 356, 283, 23432, 16179, 701, 297, 199, 7, 3227, 25156, 283, 2553, 75, 60, 1812, 19, 60, 1800, 25, 82, 271, 90, 60, 1812, 19, 60, 1800, 25, 83, 6536, 199, 7, 5433, 2870, 356, 283, 5433, 2870, 297, 199, 7, 11757, 790, 356, 283, 11757, 790, 297, 199, 7, 9637, 13635, 790, 356, 283, 9637, 13635, 790, 297, 199, 7, 7422, 356, 283, 7422, 297, 199, 7, 13405, 315, 1817, 356, 283, 51, 269, 745, 282, 307, 60, 1812, 19, 60, 1800, 17, 3345, 60, 1812, 19, 60, 1800, 17, 13206, 297, 199, 7, 13405, 4895, 356, 283, 43, 1003, 60, 1812, 19, 60, 1800, 17, 12536, 90, 13280, 84, 308, 269, 745, 297, 199, 7, 30349, 3797, 356, 283, 30349, 3797, 297, 199, 7, 51, 608, 1265, 2934, 370, 3145, 642, 909, 28867, 283, 34, 565, 14543, 307, 60, 1812, 19, 60, 1774, 22, 82, 317, 325, 90, 84, 24978, 1559, 5711, 84, 453, 357, 7044, 199, 7, 3186, 536, 356, 283, 3186, 536, 297, 199, 7, 1918, 298, 1131, 2, 365, 282, 5558, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 3985, 585, 3985, 1674, 27173, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 697, 14, 1224, 18, 14, 698, 18, 2, 2058, 315, 282, 5385, 10593, 10586, 283, 1918, 298, 1131, 2, 365, 282, 5558, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 3985, 585, 3985, 1674, 27173, 2839, 298, 697, 14, 1224, 17, 14, 698, 17, 389, 697, 14, 1224, 18, 14, 698, 18, 2, 2058, 315, 282, 5385, 10593, 3130, 199, 7, 10239, 356, 283, 10239, 297, 199, 7, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
righthandabacus/shadowsocks
tests/test.py
1016
5029
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import absolute_import, division, print_function, \ with_statement import sys import os import signal import select import time import argparse from subprocess import Popen, PIPE python = ['python'] default_url = 'http://localhost/' parser = argparse.ArgumentParser(description='test Shadowsocks') parser.add_argument('-c', '--client-conf', type=str, default=None) parser.add_argument('-s', '--server-conf', type=str, default=None) parser.add_argument('-a', '--client-args', type=str, default=None) parser.add_argument('-b', '--server-args', type=str, default=None) parser.add_argument('--with-coverage', action='store_true', default=None) parser.add_argument('--should-fail', action='store_true', default=None) parser.add_argument('--tcp-only', action='store_true', default=None) parser.add_argument('--url', type=str, default=default_url) parser.add_argument('--dns', type=str, default='8.8.8.8') config = parser.parse_args() if config.with_coverage: python = ['coverage', 'run', '-p', '-a'] client_args = python + ['shadowsocks/local.py', '-v'] server_args = python + ['shadowsocks/server.py', '-v'] if config.client_conf: client_args.extend(['-c', config.client_conf]) if config.server_conf: server_args.extend(['-c', config.server_conf]) else: server_args.extend(['-c', config.client_conf]) if config.client_args: client_args.extend(config.client_args.split()) if config.server_args: server_args.extend(config.server_args.split()) else: server_args.extend(config.client_args.split()) if config.url == default_url: server_args.extend(['--forbidden-ip', '']) p1 = Popen(server_args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) p2 = Popen(client_args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) p3 = None p4 = None p3_fin = False p4_fin = False # 1 shadowsocks started # 2 curl started # 3 curl finished # 4 dig started # 5 dig finished stage = 1 try: local_ready = False server_ready = False fdset = [p1.stdout, p2.stdout, p1.stderr, p2.stderr] while True: r, w, e = select.select(fdset, [], fdset) if e: break for fd in r: line = fd.readline() if not line: if stage == 2 and fd == p3.stdout: stage = 3 if stage == 4 and fd == p4.stdout: stage = 5 if bytes != str: line = str(line, 'utf8') sys.stderr.write(line) if line.find('starting local') >= 0: local_ready = True if line.find('starting server') >= 0: server_ready = True if stage == 1: time.sleep(2) p3 = Popen(['curl', config.url, '-v', '-L', '--socks5-hostname', '127.0.0.1:1081', '-m', '15', '--connect-timeout', '10'], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) if p3 is not None: fdset.append(p3.stdout) fdset.append(p3.stderr) stage = 2 else: sys.exit(1) if stage == 3 and p3 is not None: fdset.remove(p3.stdout) fdset.remove(p3.stderr) r = p3.wait() if config.should_fail: if r == 0: sys.exit(1) else: if r != 0: sys.exit(1) if config.tcp_only: break p4 = Popen(['socksify', 'dig', '@%s' % config.dns, 'www.google.com'], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) if p4 is not None: fdset.append(p4.stdout) fdset.append(p4.stderr) stage = 4 else: sys.exit(1) if stage == 5: r = p4.wait() if config.should_fail: if r == 0: sys.exit(1) print('test passed (expecting failure)') else: if r != 0: sys.exit(1) print('test passed') break finally: for p in [p1, p2]: try: os.kill(p.pid, signal.SIGINT) os.waitpid(p.pid, 0) except OSError: pass
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 6900, 286, 674, 11530, 89, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 971, 272, 543, 63, 6242, 199, 199, 646, 984, 199, 646, 747, 199, 646, 4673, 199, 646, 3504, 199, 646, 900, 199, 646, 7534, 199, 504, 3873, 492, 13995, 12, 22773, 199, 199, 1548, 275, 788, 1548, 418, 199, 199, 885, 63, 633, 275, 283, 1014, 921, 5967, 4805, 199, 199, 2087, 275, 7534, 14, 10730, 8, 1802, 534, 396, 5244, 8369, 21234, 358, 199, 2087, 14, 525, 63, 2094, 3654, 67, 297, 2850, 1258, 13, 2190, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 83, 297, 2850, 1000, 13, 2190, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 65, 297, 2850, 1258, 13, 589, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 66, 297, 2850, 1000, 13, 589, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 1045, 13, 10828, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 5626, 13, 1633, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 8815, 13, 2118, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 633, 297, 730, 29, 495, 12, 849, 29, 885, 63, 633, 9, 199, 2087, 14, 525, 63, 2094, 4517, 5797, 297, 730, 29, 495, 12, 849, 534, 24, 14, 24, 14, 24, 14, 24, 358, 199, 199, 888, 275, 1798, 14, 1122, 63, 589, 342, 199, 199, 692, 1101, 14, 1045, 63, 10828, 26, 272, 2366, 275, 788, 10828, 297, 283, 1065, 297, 2475, 80, 297, 2475, 65, 418, 199, 199, 1258, 63, 589, 275, 2366, 435, 788, 14714, 21234, 15, 1832, 14, 647, 297, 2475, 86, 418, 199, 1000, 63, 589, 275, 2366, 435, 788, 14714, 21234, 15, 1000, 14, 647, 297, 2475, 86, 418, 199, 199, 692, 1101, 14, 1258, 63, 2190, 26, 272, 1890, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1258, 63, 2190, 566, 272, 340, 1101, 14, 1000, 63, 2190, 26, 267, 1654, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1000, 63, 2190, 566, 272, 587, 26, 267, 1654, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1258, 63, 2190, 566, 199, 692, 1101, 14, 1258, 63, 589, 26, 272, 1890, 63, 589, 14, 2880, 8, 888, 14, 1258, 63, 589, 14, 1294, 1012, 272, 340, 1101, 14, 1000, 63, 589, 26, 267, 1654, 63, 589, 14, 2880, 8, 888, 14, 1000, 63, 589, 14, 1294, 1012, 272, 587, 26, 267, 1654, 63, 589, 14, 2880, 8, 888, 14, 1258, 63, 589, 14, 1294, 1012, 199, 692, 1101, 14, 633, 508, 849, 63, 633, 26, 272, 1654, 63, 589, 14, 2880, 18510, 29293, 13, 711, 297, 283, 1105, 199, 199, 80, 17, 275, 13995, 8, 1000, 63, 589, 12, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29, 6089, 12, 4002, 63, 14240, 29, 549, 9, 199, 80, 18, 275, 13995, 8, 1258, 63, 589, 12, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29, 6089, 12, 4002, 63, 14240, 29, 549, 9, 199, 80, 19, 275, 488, 199, 80, 20, 275, 488, 199, 80, 19, 63, 2408, 275, 756, 199, 80, 20, 63, 2408, 275, 756, 199, 199, 3, 413, 15084, 21234, 8239, 199, 3, 499, 26145, 8239, 199, 3, 650, 26145, 9158, 199, 3, 841, 31190, 8239, 199, 3, 959, 31190, 9158, 199, 8614, 275, 413, 199, 199, 893, 26, 272, 2257, 63, 2179, 275, 756, 272, 1654, 63, 2179, 275, 756, 272, 6111, 409, 275, 359, 80, 17, 14, 2703, 12, 299, 18, 14, 2703, 12, 299, 17, 14, 3083, 12, 299, 18, 14, 3083, 61, 272, 1830, 715, 26, 267, 519, 12, 336, 12, 325, 275, 3504, 14, 2416, 8, 2592, 409, 12, 990, 6111, 409, 9, 267, 340, 325, 26, 288, 2059, 398, 367, 6111, 315, 519, 26, 288, 1004, 275, 6111, 14, 6407, 342, 288, 340, 440, 1004, 26, 355, 340, 9546, 508, 499, 436, 6111, 508, 299, 19, 14, 2703, 26, 490, 9546, 275, 650, 355, 340, 9546, 508, 841, 436, 6111, 508, 299, 20, 14, 2703, 26, 490, 9546, 275, 959, 288, 340, 2783, 1137, 620, 26, 355, 1004, 275, 620, 8, 604, 12, 283, 1624, 24, 358, 288, 984, 14, 3083, 14, 952, 8, 604, 9, 288, 340, 1004, 14, 1623, 360, 15769, 2257, 358, 2356, 378, 26, 355, 2257, 63, 2179, 275, 715, 288, 340, 1004, 14, 1623, 360, 15769, 1654, 358, 2356, 378, 26, 355, 1654, 63, 2179, 275, 715, 398, 340, 9546, 508, 413, 26, 288, 900, 14, 4532, 8, 18, 9, 953, 299, 19, 275, 13995, 2941, 17096, 297, 1101, 14, 633, 12, 2475, 86, 297, 2475, 44, 297, 717, 2850, 21234, 21, 13, 4269, 297, 283, 4195, 14, 16, 14, 16, 14, 17, 26, 709, 2835, 297, 717, 2475, 77, 297, 283, 1046, 297, 2850, 2242, 13, 2593, 297, 283, 709, 995, 2432, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 6900, 286, 674, 11530, 89, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 971, 272, 543, 63, 6242, 199, 199, 646, 984, 199, 646, 747, 199, 646, 4673, 199, 646, 3504, 199, 646, 900, 199, 646, 7534, 199, 504, 3873, 492, 13995, 12, 22773, 199, 199, 1548, 275, 788, 1548, 418, 199, 199, 885, 63, 633, 275, 283, 1014, 921, 5967, 4805, 199, 199, 2087, 275, 7534, 14, 10730, 8, 1802, 534, 396, 5244, 8369, 21234, 358, 199, 2087, 14, 525, 63, 2094, 3654, 67, 297, 2850, 1258, 13, 2190, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 83, 297, 2850, 1000, 13, 2190, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 65, 297, 2850, 1258, 13, 589, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 3654, 66, 297, 2850, 1000, 13, 589, 297, 730, 29, 495, 12, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 1045, 13, 10828, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 5626, 13, 1633, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 8815, 13, 2118, 297, 1595, 534, 1617, 63, 2052, 297, 849, 29, 403, 9, 199, 2087, 14, 525, 63, 2094, 4517, 633, 297, 730, 29, 495, 12, 849, 29, 885, 63, 633, 9, 199, 2087, 14, 525, 63, 2094, 4517, 5797, 297, 730, 29, 495, 12, 849, 534, 24, 14, 24, 14, 24, 14, 24, 358, 199, 199, 888, 275, 1798, 14, 1122, 63, 589, 342, 199, 199, 692, 1101, 14, 1045, 63, 10828, 26, 272, 2366, 275, 788, 10828, 297, 283, 1065, 297, 2475, 80, 297, 2475, 65, 418, 199, 199, 1258, 63, 589, 275, 2366, 435, 788, 14714, 21234, 15, 1832, 14, 647, 297, 2475, 86, 418, 199, 1000, 63, 589, 275, 2366, 435, 788, 14714, 21234, 15, 1000, 14, 647, 297, 2475, 86, 418, 199, 199, 692, 1101, 14, 1258, 63, 2190, 26, 272, 1890, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1258, 63, 2190, 566, 272, 340, 1101, 14, 1000, 63, 2190, 26, 267, 1654, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1000, 63, 2190, 566, 272, 587, 26, 267, 1654, 63, 589, 14, 2880, 24829, 67, 297, 1101, 14, 1258, 63, 2190, 566, 199, 692, 1101, 14, 1258, 63, 589, 26, 272, 1890, 63, 589, 14, 2880, 8, 888, 14, 1258, 63, 589, 14, 1294, 1012, 272, 340, 1101, 14, 1000, 63, 589, 26, 267, 1654, 63, 589, 14, 2880, 8, 888, 14, 1000, 63, 589, 14, 1294, 1012, 272, 587, 26, 267, 1654, 63, 589, 14, 2880, 8, 888, 14, 1258, 63, 589, 14, 1294, 1012, 199, 692, 1101, 14, 633, 508, 849, 63, 633, 26, 272, 1654, 63, 589, 14, 2880, 18510, 29293, 13, 711, 297, 283, 1105, 199, 199, 80, 17, 275, 13995, 8, 1000, 63, 589, 12, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29, 6089, 12, 4002, 63, 14240, 29, 549, 9, 199, 80, 18, 275, 13995, 8, 1258, 63, 589, 12, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29, 6089, 12, 4002, 63, 14240, 29, 549, 9, 199, 80, 19, 275, 488, 199, 80, 20, 275, 488, 199, 80, 19, 63, 2408, 275, 756, 199, 80, 20, 63, 2408, 275, 756, 199, 199, 3, 413, 15084, 21234, 8239, 199, 3, 499, 26145, 8239, 199, 3, 650, 26145, 9158, 199, 3, 841, 31190, 8239, 199, 3, 959, 31190, 9158, 199, 8614, 275, 413, 199, 199, 893, 26, 272, 2257, 63, 2179, 275, 756, 272, 1654, 63, 2179, 275, 756, 272, 6111, 409, 275, 359, 80, 17, 14, 2703, 12, 299, 18, 14, 2703, 12, 299, 17, 14, 3083, 12, 299, 18, 14, 3083, 61, 272, 1830, 715, 26, 267, 519, 12, 336, 12, 325, 275, 3504, 14, 2416, 8, 2592, 409, 12, 990, 6111, 409, 9, 267, 340, 325, 26, 288, 2059, 398, 367, 6111, 315, 519, 26, 288, 1004, 275, 6111, 14, 6407, 342, 288, 340, 440, 1004, 26, 355, 340, 9546, 508, 499, 436, 6111, 508, 299, 19, 14, 2703, 26, 490, 9546, 275, 650, 355, 340, 9546, 508, 841, 436, 6111, 508, 299, 20, 14, 2703, 26, 490, 9546, 275, 959, 288, 340, 2783, 1137, 620, 26, 355, 1004, 275, 620, 8, 604, 12, 283, 1624, 24, 358, 288, 984, 14, 3083, 14, 952, 8, 604, 9, 288, 340, 1004, 14, 1623, 360, 15769, 2257, 358, 2356, 378, 26, 355, 2257, 63, 2179, 275, 715, 288, 340, 1004, 14, 1623, 360, 15769, 1654, 358, 2356, 378, 26, 355, 1654, 63, 2179, 275, 715, 398, 340, 9546, 508, 413, 26, 288, 900, 14, 4532, 8, 18, 9, 953, 299, 19, 275, 13995, 2941, 17096, 297, 1101, 14, 633, 12, 2475, 86, 297, 2475, 44, 297, 717, 2850, 21234, 21, 13, 4269, 297, 283, 4195, 14, 16, 14, 16, 14, 17, 26, 709, 2835, 297, 717, 2475, 77, 297, 283, 1046, 297, 2850, 2242, 13, 2593, 297, 283, 709, 995, 2432, 9009, 29, 6089, 12, 3839, 29, 6089, 12, 4635, 29, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
szilveszter/django
django/utils/daemonize.py
169
2046
import os import sys from . import six buffering = int(six.PY3) # No unbuffered text I/O on Python 3 (#20815). if os.name == 'posix': def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null', umask=0o022): "Robustly turn into a UNIX daemon, running in our_home_dir." # First fork try: if os.fork() > 0: sys.exit(0) # kill off parent except OSError as e: sys.stderr.write("fork #1 failed: (%d) %s\n" % (e.errno, e.strerror)) sys.exit(1) os.setsid() os.chdir(our_home_dir) os.umask(umask) # Second fork try: if os.fork() > 0: os._exit(0) except OSError as e: sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror)) os._exit(1) si = open('/dev/null', 'r') so = open(out_log, 'a+', buffering) se = open(err_log, 'a+', buffering) os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(se.fileno(), sys.stderr.fileno()) # Set custom file descriptors so that they get proper buffering. sys.stdout, sys.stderr = so, se else: def become_daemon(our_home_dir='.', out_log=None, err_log=None, umask=0o022): """ If we're not running under a POSIX system, just simulate the daemon mode by doing redirections and directory changing. """ os.chdir(our_home_dir) os.umask(umask) sys.stdin.close() sys.stdout.close() sys.stderr.close() if err_log: sys.stderr = open(err_log, 'a', buffering) else: sys.stderr = NullDevice() if out_log: sys.stdout = open(out_log, 'a', buffering) else: sys.stdout = NullDevice() class NullDevice: "A writeable object that writes to nowhere -- like /dev/null." def write(self, s): pass
bsd-3-clause
[ 646, 747, 199, 646, 984, 199, 199, 504, 1275, 492, 3816, 199, 199, 2738, 316, 275, 1109, 8, 4174, 14, 4521, 19, 9, 263, 327, 3091, 625, 17605, 1318, 473, 15, 47, 641, 2018, 650, 15196, 10630, 1046, 680, 199, 199, 692, 747, 14, 354, 508, 283, 9228, 356, 272, 347, 8649, 63, 10824, 8, 567, 63, 4219, 63, 694, 534, 3130, 734, 63, 793, 8805, 2374, 15, 2307, 297, 1993, 2329, 63, 793, 8805, 2374, 15, 2307, 297, 29812, 29, 16, 79, 16348, 304, 267, 298, 3863, 15549, 590, 7485, 1901, 282, 22242, 11128, 12, 3879, 315, 4154, 63, 4219, 63, 694, 2122, 267, 327, 7758, 14926, 267, 862, 26, 288, 340, 747, 14, 11796, 342, 690, 378, 26, 355, 984, 14, 2224, 8, 16, 9, 258, 327, 14561, 2331, 1676, 267, 871, 6440, 465, 325, 26, 288, 984, 14, 3083, 14, 952, 480, 11796, 327, 17, 3405, 26, 4366, 68, 9, 450, 83, 60, 78, 2, 450, 334, 69, 14, 7931, 12, 325, 14, 20395, 430, 288, 984, 14, 2224, 8, 17, 9, 267, 747, 14, 409, 4148, 342, 267, 747, 14, 8563, 8, 567, 63, 4219, 63, 694, 9, 267, 747, 14, 18315, 8, 18315, 9, 398, 327, 16707, 14926, 267, 862, 26, 288, 340, 747, 14, 11796, 342, 690, 378, 26, 355, 747, 423, 2224, 8, 16, 9, 267, 871, 6440, 465, 325, 26, 288, 984, 14, 3083, 14, 952, 480, 11796, 327, 18, 3405, 26, 4366, 68, 9, 450, 83, 60, 78, 2, 450, 334, 69, 14, 7931, 12, 325, 14, 20395, 430, 288, 747, 423, 2224, 8, 17, 9, 398, 13877, 275, 1551, 2336, 2374, 15, 2307, 297, 283, 82, 358, 267, 880, 275, 1551, 8, 548, 63, 793, 12, 283, 65, 7386, 21033, 9, 267, 542, 275, 1551, 8, 1508, 63, 793, 12, 283, 65, 7386, 21033, 9, 267, 747, 14, 11048, 18, 8, 338, 14, 9843, 1062, 984, 14, 6626, 14, 9843, 1012, 267, 747, 14, 11048, 18, 8, 1152, 14, 9843, 1062, 984, 14, 2703, 14, 9843, 1012, 267, 747, 14, 11048, 18, 8, 261, 14, 9843, 1062, 984, 14, 3083, 14, 9843, 1012, 267, 327, 2494, 3537, 570, 15428, 880, 626, 2985, 664, 5576, 21033, 14, 267, 984, 14, 2703, 12, 984, 14, 3083, 275, 880, 12, 542, 199, 2836, 26, 272, 347, 8649, 63, 10824, 8, 567, 63, 4219, 63, 694, 534, 3130, 734, 63, 793, 29, 403, 12, 2329, 63, 793, 29, 403, 12, 29812, 29, 16, 79, 16348, 304, 267, 408, 267, 982, 781, 3984, 440, 3879, 1334, 282, 18169, 2656, 12, 2951, 20577, 314, 11128, 267, 818, 701, 9689, 295, 27917, 436, 2082, 13729, 14, 267, 408, 267, 747, 14, 8563, 8, 567, 63, 4219, 63, 694, 9, 267, 747, 14, 18315, 8, 18315, 9, 267, 984, 14, 6626, 14, 1600, 342, 267, 984, 14, 2703, 14, 1600, 342, 267, 984, 14, 3083, 14, 1600, 342, 267, 340, 2329, 63, 793, 26, 288, 984, 14, 3083, 275, 1551, 8, 1508, 63, 793, 12, 283, 65, 297, 21033, 9, 267, 587, 26, 288, 984, 14, 3083, 275, 12119, 2510, 342, 267, 340, 734, 63, 793, 26, 288, 984, 14, 2703, 275, 1551, 8, 548, 63, 793, 12, 283, 65, 297, 21033, 9, 267, 587, 26, 288, 984, 14, 2703, 275, 12119, 2510, 342, 339, 1021, 12119, 2510, 26, 267, 298, 33, 2218, 461, 909, 626, 14511, 370, 3063, 1681, 1553, 2839, 1182, 2374, 15, 2307, 2122, 267, 347, 2218, 8, 277, 12, 308, 304, 288, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 747, 199, 646, 984, 199, 199, 504, 1275, 492, 3816, 199, 199, 2738, 316, 275, 1109, 8, 4174, 14, 4521, 19, 9, 263, 327, 3091, 625, 17605, 1318, 473, 15, 47, 641, 2018, 650, 15196, 10630, 1046, 680, 199, 199, 692, 747, 14, 354, 508, 283, 9228, 356, 272, 347, 8649, 63, 10824, 8, 567, 63, 4219, 63, 694, 534, 3130, 734, 63, 793, 8805, 2374, 15, 2307, 297, 1993, 2329, 63, 793, 8805, 2374, 15, 2307, 297, 29812, 29, 16, 79, 16348, 304, 267, 298, 3863, 15549, 590, 7485, 1901, 282, 22242, 11128, 12, 3879, 315, 4154, 63, 4219, 63, 694, 2122, 267, 327, 7758, 14926, 267, 862, 26, 288, 340, 747, 14, 11796, 342, 690, 378, 26, 355, 984, 14, 2224, 8, 16, 9, 258, 327, 14561, 2331, 1676, 267, 871, 6440, 465, 325, 26, 288, 984, 14, 3083, 14, 952, 480, 11796, 327, 17, 3405, 26, 4366, 68, 9, 450, 83, 60, 78, 2, 450, 334, 69, 14, 7931, 12, 325, 14, 20395, 430, 288, 984, 14, 2224, 8, 17, 9, 267, 747, 14, 409, 4148, 342, 267, 747, 14, 8563, 8, 567, 63, 4219, 63, 694, 9, 267, 747, 14, 18315, 8, 18315, 9, 398, 327, 16707, 14926, 267, 862, 26, 288, 340, 747, 14, 11796, 342, 690, 378, 26, 355, 747, 423, 2224, 8, 16, 9, 267, 871, 6440, 465, 325, 26, 288, 984, 14, 3083, 14, 952, 480, 11796, 327, 18, 3405, 26, 4366, 68, 9, 450, 83, 60, 78, 2, 450, 334, 69, 14, 7931, 12, 325, 14, 20395, 430, 288, 747, 423, 2224, 8, 17, 9, 398, 13877, 275, 1551, 2336, 2374, 15, 2307, 297, 283, 82, 358, 267, 880, 275, 1551, 8, 548, 63, 793, 12, 283, 65, 7386, 21033, 9, 267, 542, 275, 1551, 8, 1508, 63, 793, 12, 283, 65, 7386, 21033, 9, 267, 747, 14, 11048, 18, 8, 338, 14, 9843, 1062, 984, 14, 6626, 14, 9843, 1012, 267, 747, 14, 11048, 18, 8, 1152, 14, 9843, 1062, 984, 14, 2703, 14, 9843, 1012, 267, 747, 14, 11048, 18, 8, 261, 14, 9843, 1062, 984, 14, 3083, 14, 9843, 1012, 267, 327, 2494, 3537, 570, 15428, 880, 626, 2985, 664, 5576, 21033, 14, 267, 984, 14, 2703, 12, 984, 14, 3083, 275, 880, 12, 542, 199, 2836, 26, 272, 347, 8649, 63, 10824, 8, 567, 63, 4219, 63, 694, 534, 3130, 734, 63, 793, 29, 403, 12, 2329, 63, 793, 29, 403, 12, 29812, 29, 16, 79, 16348, 304, 267, 408, 267, 982, 781, 3984, 440, 3879, 1334, 282, 18169, 2656, 12, 2951, 20577, 314, 11128, 267, 818, 701, 9689, 295, 27917, 436, 2082, 13729, 14, 267, 408, 267, 747, 14, 8563, 8, 567, 63, 4219, 63, 694, 9, 267, 747, 14, 18315, 8, 18315, 9, 267, 984, 14, 6626, 14, 1600, 342, 267, 984, 14, 2703, 14, 1600, 342, 267, 984, 14, 3083, 14, 1600, 342, 267, 340, 2329, 63, 793, 26, 288, 984, 14, 3083, 275, 1551, 8, 1508, 63, 793, 12, 283, 65, 297, 21033, 9, 267, 587, 26, 288, 984, 14, 3083, 275, 12119, 2510, 342, 267, 340, 734, 63, 793, 26, 288, 984, 14, 2703, 275, 1551, 8, 548, 63, 793, 12, 283, 65, 297, 21033, 9, 267, 587, 26, 288, 984, 14, 2703, 275, 12119, 2510, 342, 339, 1021, 12119, 2510, 26, 267, 298, 33, 2218, 461, 909, 626, 14511, 370, 3063, 1681, 1553, 2839, 1182, 2374, 15, 2307, 2122, 267, 347, 2218, 8, 277, 12, 308, 304, 288, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
diox/zamboni
lib/iarc_v2/client.py
1
7197
# -*- coding: utf8 -*- import datetime import requests from urlparse import urljoin from uuid import UUID from django.conf import settings from django.db import transaction import commonware.log from post_request_task.task import task from lib.iarc_v2.serializers import IARCV2RatingListSerializer from mkt.site.helpers import absolutify from mkt.translations.utils import no_translation from mkt.users.models import UserProfile log = commonware.log.getLogger('z.iarc_v2') class IARCException(Exception): pass def _iarc_headers(): """HTTP headers to include in each request to IARC.""" return { 'StoreID': settings.IARC_V2_STORE_ID, 'StorePassword': settings.IARC_V2_STORE_PASSWORD, } def _iarc_request(endpoint_name, data): """Wrapper around requests.post which handles url generation from the endpoint_name and auth headers. Returns data as a dict.""" url = urljoin(settings.IARC_V2_SERVICE_ENDPOINT, endpoint_name) headers = _iarc_headers() response = requests.post(url, headers=headers, json=data) try: value = response.json() except ValueError: value = {} return value def _iarc_app_data(app): """App data that IARC needs in PushCert response / AttachToCert request.""" from mkt.webapps.models import Webapp author = app.listed_authors[0] if app.listed_authors else UserProfile() with no_translation(app.default_locale): app_name = unicode(Webapp.with_deleted.get(pk=app.pk).name) data = { 'Publish': app.is_public(), 'ProductName': app_name, 'StoreProductID': app.guid, 'StoreProductURL': absolutify(app.get_url_path()), # We want an identifier that does not change when users attached to # an app are shuffled around, so just use the app PK as developer id. 'StoreDeveloperID': app.pk, # PushCert and AttachToCert docs use a different property for the # developer email address, use both just in case. 'DeveloperEmail': author.email, 'EmailAddress': author.email, 'CompanyName': app.developer_name, } return data def get_rating_changes(date=None): """ Call GetRatingChange to get all changes from IARC within 24 hours of the specified date (using today by default), and apply them to the corresponding Webapps. FIXME: Could add support for pagination, but very low priority since we will never ever get anywhere close to 500 rating changes in a single day. """ from mkt.webapps.models import IARCCert # EndDate should be the most recent one. end_date = date or datetime.datetime.utcnow() start_date = end_date - datetime.timedelta(days=1) log.info('Calling IARC GetRatingChanges from %s to %s', start_date.strftime('%Y-%m-%d'), end_date.strftime('%Y-%m-%d')) data = _iarc_request('GetRatingChanges', { 'StartDate': start_date.strftime('%Y-%m-%d'), 'EndDate': end_date.strftime('%Y-%m-%d'), 'MaxRows': 500, # Limit. 'StartRowIndex': 0 # Offset. }) for row in data.get('CertList', []): # Find app through Cert ID, ignoring unknown certs. try: cert = IARCCert.objects.get(cert_id=UUID(row['CertID']).get_hex()) except IARCCert.DoesNotExist: continue serializer = IARCV2RatingListSerializer(instance=cert.app, data=row) if serializer.is_valid(): rating_bodies = [body.id for body in serializer.validated_data['ratings'].keys()] serializer.save(rating_bodies=rating_bodies) return data @transaction.atomic def search_and_attach_cert(app, cert_id): """Call SearchCerts to get all info about an existing cert from IARC and apply that info to the Webapp instance passed. Then, call AttachToCert to notify IARC that we're attaching the cert to that Webapp.""" serializer = search_cert(app, cert_id) if serializer.is_valid(): serializer.save() else: raise IARCException('SearchCerts failed, invalid data!') data = _attach_to_cert(app, cert_id) if data.get('ResultCode') != 'Success': # If AttachToCert failed, we need to rollback the save we did earlier, # we raise an exception to do that since we are in an @atomic block. raise IARCException(data.get('ErrorMessage', 'AttachToCert failed!')) return data def search_cert(app, cert_id): """Ask IARC for information about a cert.""" log.info('Calling IARC SearchCert for app %s, cert %s', app.pk, unicode(UUID(cert_id))) data = _iarc_request('SearchCerts', {'CertID': unicode(UUID(cert_id))}) # We don't care about MatchFound, serializer won't find the right fields # if no match is found. serializer = IARCV2RatingListSerializer(instance=app, data=data) return serializer def _attach_to_cert(app, cert_id): """Tell IARC to attach a cert to an app.""" data = _iarc_app_data(app) data['CertID'] = unicode(UUID(cert_id)) log.info('Calling IARC AttachToCert for app %s, cert %s', app.pk, data['CertID']) return _iarc_request('AttachToCert', data) @task def publish(app_id): """Delayed task to tell IARC we published an app.""" from mkt.webapps.models import IARCCert, Webapp try: app = Webapp.with_deleted.get(pk=app_id) except Webapp.DoesNotExist: return try: cert_id = app.iarc_cert.cert_id data = _update_certs(app_id, cert_id, 'Publish') except IARCCert.DoesNotExist: data = None return data @task def unpublish(app_id): """Delayed task to tell IARC we unpublished an app.""" from mkt.webapps.models import IARCCert, Webapp try: app = Webapp.with_deleted.get(pk=app_id) except Webapp.DoesNotExist: return try: cert_id = app.iarc_cert.cert_id data = _update_certs(app_id, cert_id, 'Unpublish') except IARCCert.DoesNotExist: data = None return data def refresh(app): """Refresh an app IARC information by asking IARC about its certificate.""" serializer = search_cert(app, app.iarc_cert.cert_id) serializer.save() # FIXME: implement UpdateStoreAttributes for when the app developer email # changes. def _update_certs(app_id, cert_id, action): """ UpdateCerts to tell IARC when we publish or unpublish a product. Endpoint can handle batch updates, but we only need one at a time. Arguments: cert_id -- Globally unique ID for certificate. action -- One of [InvalidateCert, Unpublish, UpdateStoreAttributes, Publish]. Return: Update object. ResultCode (string) -- Success or Failure ErrorId (string) -- Can pass on to IARC for debugging. ErrorMessage (string) -- Human-readable error message """ data = { 'UpdateList': [{ 'CertID': unicode(UUID(cert_id)), 'Action': action, }] } log.info('Calling IARC UpdateCert %s for app %s, cert %s', action, app_id, data['UpdateList'][0]['CertID']) return _iarc_request('UpdateCerts', data)
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 24, 1882, 199, 646, 2197, 199, 646, 4145, 199, 504, 7097, 492, 20818, 199, 504, 5377, 492, 11134, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6008, 199, 199, 646, 2863, 1068, 14, 793, 199, 504, 2963, 63, 1069, 63, 1765, 14, 1765, 492, 2120, 199, 199, 504, 1973, 14, 73, 9912, 63, 86, 18, 14, 12844, 492, 473, 689, 12847, 18, 32533, 1296, 7299, 199, 504, 21825, 14, 2124, 14, 7546, 492, 2853, 393, 935, 1399, 199, 504, 21825, 14, 13982, 14, 1208, 492, 949, 63, 6893, 199, 504, 21825, 14, 3707, 14, 992, 492, 19037, 199, 199, 793, 275, 2863, 1068, 14, 793, 14, 5572, 360, 90, 14, 73, 9912, 63, 86, 18, 358, 421, 199, 533, 473, 24028, 1726, 8, 1726, 304, 272, 986, 421, 199, 318, 485, 73, 9912, 63, 2139, 837, 272, 408, 2856, 2323, 370, 2387, 315, 1924, 1056, 370, 473, 24028, 1041, 272, 372, 469, 267, 283, 5502, 998, 356, 2202, 14, 41, 24028, 63, 54, 18, 63, 16169, 63, 998, 12, 267, 283, 5502, 6139, 356, 2202, 14, 41, 24028, 63, 54, 18, 63, 16169, 63, 9032, 12, 272, 789, 421, 199, 318, 485, 73, 9912, 63, 1069, 8, 6520, 63, 354, 12, 666, 304, 272, 408, 4590, 6818, 4145, 14, 1932, 1314, 10022, 1166, 10152, 687, 314, 272, 6037, 63, 354, 436, 1790, 2323, 14, 1803, 666, 465, 282, 1211, 1041, 272, 1166, 275, 20818, 8, 1751, 14, 41, 24028, 63, 54, 18, 63, 10486, 63, 21054, 12, 6037, 63, 354, 9, 272, 2323, 275, 485, 73, 9912, 63, 2139, 342, 272, 1177, 275, 4145, 14, 1932, 8, 633, 12, 2323, 29, 2139, 12, 2022, 29, 576, 9, 272, 862, 26, 267, 574, 275, 1177, 14, 1001, 342, 272, 871, 1722, 26, 267, 574, 275, 1052, 272, 372, 574, 421, 199, 318, 485, 73, 9912, 63, 571, 63, 576, 8, 571, 304, 272, 408, 2640, 666, 626, 473, 24028, 4839, 315, 22643, 14768, 1177, 1182, 21328, 1378, 14768, 1056, 1041, 272, 687, 21825, 14, 2520, 5181, 14, 992, 492, 6001, 571, 339, 4132, 275, 1145, 14, 15023, 63, 8149, 59, 16, 61, 340, 1145, 14, 15023, 63, 8149, 587, 19037, 342, 272, 543, 949, 63, 6893, 8, 571, 14, 885, 63, 5508, 304, 267, 1145, 63, 354, 275, 2649, 8, 5926, 571, 14, 1045, 63, 6062, 14, 362, 8, 2051, 29, 571, 14, 2051, 680, 354, 9, 272, 666, 275, 469, 267, 283, 13956, 356, 1145, 14, 374, 63, 3455, 1062, 267, 283, 5884, 985, 356, 1145, 63, 354, 12, 267, 283, 5502, 5884, 998, 356, 1145, 14, 9473, 12, 267, 283, 5502, 5884, 2632, 356, 2853, 393, 935, 1399, 8, 571, 14, 362, 63, 633, 63, 515, 4000, 267, 327, 2136, 2934, 376, 5148, 626, 1630, 440, 1570, 1380, 4390, 10102, 370, 267, 327, 376, 1145, 787, 28126, 1146, 6818, 12, 880, 2951, 675, 314, 1145, 18368, 465, 15030, 1305, 14, 267, 283, 5502, 31032, 998, 356, 1145, 14, 2051, 12, 267, 327, 22643, 14768, 436, 21328, 1378, 14768, 9149, 675, 282, 3365, 3324, 367, 314, 267, 327, 15030, 3031, 2287, 12, 675, 3865, 2951, 315, 1930, 14, 267, 283, 31032, 7035, 356, 4132, 14, 2123, 12, 267, 283, 7035, 1476, 356, 4132, 14, 2123, 12, 267, 283, 16063, 985, 356, 1145, 14, 11071, 63, 354, 12, 272, 789, 272, 372, 666, 421, 199, 318, 664, 63, 10417, 63, 6627, 8, 602, 29, 403, 304, 272, 408, 272, 6523, 2372, 32533, 4001, 370, 664, 1006, 4493, 687, 473, 24028, 4453, 5504, 10857, 402, 314, 272, 2013, 1434, 334, 4941, 11168, 701, 849, 395, 436, 4838, 3062, 370, 314, 272, 5226, 6001, 5181, 14, 339, 7600, 26, 18615, 1050, 2291, 367, 21192, 12, 1325, 7437, 6465, 7464, 3967, 781, 272, 911, 7078, 14433, 664, 26523, 4002, 370, 6891, 18360, 4493, 315, 282, 2849, 5382, 14, 272, 408, 272, 687, 21825, 14, 2520, 5181, 14, 992, 492, 473, 689, 2571, 15299, 339, 327, 9599, 2506, 1077, 506, 314, 4750, 8058, 1373, 14, 272, 1284, 63, 602, 275, 1434, 503, 2197, 14, 2083, 14, 10779, 342, 272, 1343, 63, 602, 275, 1284, 63, 602, 446, 2197, 14, 7473, 8, 4899, 29, 17, 9, 272, 943, 14, 815, 360, 23796, 473, 24028, 2372, 32533, 13907, 687, 450, 83, 370, 450, 83, 297, 1467, 1343, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 1284, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 1333, 272, 666, 275, 485, 73, 9912, 63, 1069, 360, 1002, 32533, 13907, 297, 469, 267, 283, 3162, 2506, 356, 1343, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 267, 283, 3005, 2506, 356, 1284, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 267, 283, 4261, 13405, 356, 6891, 12, 221, 327, 22672, 14, 267, 283, 3162, 5810, 2681, 356, 378, 221, 327, 29432, 14, 272, 3828, 272, 367, 1962, 315, 666, 14, 362, 360, 14768, 1296, 297, 12319, 267, 327, 6668, 1145, 4012, 11002, 84, 2870, 12, 17289, 5809, 25949, 14, 267, 862, 26, 288, 6250, 275, 473, 689, 2571, 15299, 14, 1462, 14, 362, 8, 4736, 63, 344, 29, 8757, 8, 1143, 459, 14768, 998, 13227, 362, 63, 4097, 1012, 267, 871, 473, 689, 2571, 15299, 14, 7400, 26, 288, 1980, 267, 9146, 275, 473, 689, 12847, 18, 32533, 1296, 7299, 8, 842, 29, 4736, 14, 571, 12, 666, 29, 1143, 9, 267, 340, 9146, 14, 374, 63, 1078, 837, 288, 18360, 63, 656, 18245, 275, 359, 2030, 14, 344, 367, 2396, 2490, 315, 9146, 14, 24372, 63, 576, 459, 17565, 780, 2278, 1612, 5106, 288, 9146, 14, 2117, 8, 10417, 63, 656, 18245, 29, 10417, 63, 656, 18245, 9, 272, 372, 666, 421, 199, 32, 5945, 14, 10910, 199, 318, 2754, 63, 460, 63, 5040, 63, 4736, 8, 571, 12, 6250, 63, 344, 304, 272, 408, 2176, 8730, 7851, 1086, 370, 664, 1006, 2256, 3595, 376, 3411, 6250, 687, 473, 24028, 436, 272, 4838, 626, 2256, 370, 314, 6001, 571, 1256, 3032, 14, 9442, 12, 1240, 21328, 1378, 14768, 272, 370, 11705, 473, 24028, 626, 781, 3984, 6554, 316, 314, 6250, 370 ]
[ 1882, 2803, 26, 2774, 24, 1882, 199, 646, 2197, 199, 646, 4145, 199, 504, 7097, 492, 20818, 199, 504, 5377, 492, 11134, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6008, 199, 199, 646, 2863, 1068, 14, 793, 199, 504, 2963, 63, 1069, 63, 1765, 14, 1765, 492, 2120, 199, 199, 504, 1973, 14, 73, 9912, 63, 86, 18, 14, 12844, 492, 473, 689, 12847, 18, 32533, 1296, 7299, 199, 504, 21825, 14, 2124, 14, 7546, 492, 2853, 393, 935, 1399, 199, 504, 21825, 14, 13982, 14, 1208, 492, 949, 63, 6893, 199, 504, 21825, 14, 3707, 14, 992, 492, 19037, 199, 199, 793, 275, 2863, 1068, 14, 793, 14, 5572, 360, 90, 14, 73, 9912, 63, 86, 18, 358, 421, 199, 533, 473, 24028, 1726, 8, 1726, 304, 272, 986, 421, 199, 318, 485, 73, 9912, 63, 2139, 837, 272, 408, 2856, 2323, 370, 2387, 315, 1924, 1056, 370, 473, 24028, 1041, 272, 372, 469, 267, 283, 5502, 998, 356, 2202, 14, 41, 24028, 63, 54, 18, 63, 16169, 63, 998, 12, 267, 283, 5502, 6139, 356, 2202, 14, 41, 24028, 63, 54, 18, 63, 16169, 63, 9032, 12, 272, 789, 421, 199, 318, 485, 73, 9912, 63, 1069, 8, 6520, 63, 354, 12, 666, 304, 272, 408, 4590, 6818, 4145, 14, 1932, 1314, 10022, 1166, 10152, 687, 314, 272, 6037, 63, 354, 436, 1790, 2323, 14, 1803, 666, 465, 282, 1211, 1041, 272, 1166, 275, 20818, 8, 1751, 14, 41, 24028, 63, 54, 18, 63, 10486, 63, 21054, 12, 6037, 63, 354, 9, 272, 2323, 275, 485, 73, 9912, 63, 2139, 342, 272, 1177, 275, 4145, 14, 1932, 8, 633, 12, 2323, 29, 2139, 12, 2022, 29, 576, 9, 272, 862, 26, 267, 574, 275, 1177, 14, 1001, 342, 272, 871, 1722, 26, 267, 574, 275, 1052, 272, 372, 574, 421, 199, 318, 485, 73, 9912, 63, 571, 63, 576, 8, 571, 304, 272, 408, 2640, 666, 626, 473, 24028, 4839, 315, 22643, 14768, 1177, 1182, 21328, 1378, 14768, 1056, 1041, 272, 687, 21825, 14, 2520, 5181, 14, 992, 492, 6001, 571, 339, 4132, 275, 1145, 14, 15023, 63, 8149, 59, 16, 61, 340, 1145, 14, 15023, 63, 8149, 587, 19037, 342, 272, 543, 949, 63, 6893, 8, 571, 14, 885, 63, 5508, 304, 267, 1145, 63, 354, 275, 2649, 8, 5926, 571, 14, 1045, 63, 6062, 14, 362, 8, 2051, 29, 571, 14, 2051, 680, 354, 9, 272, 666, 275, 469, 267, 283, 13956, 356, 1145, 14, 374, 63, 3455, 1062, 267, 283, 5884, 985, 356, 1145, 63, 354, 12, 267, 283, 5502, 5884, 998, 356, 1145, 14, 9473, 12, 267, 283, 5502, 5884, 2632, 356, 2853, 393, 935, 1399, 8, 571, 14, 362, 63, 633, 63, 515, 4000, 267, 327, 2136, 2934, 376, 5148, 626, 1630, 440, 1570, 1380, 4390, 10102, 370, 267, 327, 376, 1145, 787, 28126, 1146, 6818, 12, 880, 2951, 675, 314, 1145, 18368, 465, 15030, 1305, 14, 267, 283, 5502, 31032, 998, 356, 1145, 14, 2051, 12, 267, 327, 22643, 14768, 436, 21328, 1378, 14768, 9149, 675, 282, 3365, 3324, 367, 314, 267, 327, 15030, 3031, 2287, 12, 675, 3865, 2951, 315, 1930, 14, 267, 283, 31032, 7035, 356, 4132, 14, 2123, 12, 267, 283, 7035, 1476, 356, 4132, 14, 2123, 12, 267, 283, 16063, 985, 356, 1145, 14, 11071, 63, 354, 12, 272, 789, 272, 372, 666, 421, 199, 318, 664, 63, 10417, 63, 6627, 8, 602, 29, 403, 304, 272, 408, 272, 6523, 2372, 32533, 4001, 370, 664, 1006, 4493, 687, 473, 24028, 4453, 5504, 10857, 402, 314, 272, 2013, 1434, 334, 4941, 11168, 701, 849, 395, 436, 4838, 3062, 370, 314, 272, 5226, 6001, 5181, 14, 339, 7600, 26, 18615, 1050, 2291, 367, 21192, 12, 1325, 7437, 6465, 7464, 3967, 781, 272, 911, 7078, 14433, 664, 26523, 4002, 370, 6891, 18360, 4493, 315, 282, 2849, 5382, 14, 272, 408, 272, 687, 21825, 14, 2520, 5181, 14, 992, 492, 473, 689, 2571, 15299, 339, 327, 9599, 2506, 1077, 506, 314, 4750, 8058, 1373, 14, 272, 1284, 63, 602, 275, 1434, 503, 2197, 14, 2083, 14, 10779, 342, 272, 1343, 63, 602, 275, 1284, 63, 602, 446, 2197, 14, 7473, 8, 4899, 29, 17, 9, 272, 943, 14, 815, 360, 23796, 473, 24028, 2372, 32533, 13907, 687, 450, 83, 370, 450, 83, 297, 1467, 1343, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 1284, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 1333, 272, 666, 275, 485, 73, 9912, 63, 1069, 360, 1002, 32533, 13907, 297, 469, 267, 283, 3162, 2506, 356, 1343, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 267, 283, 3005, 2506, 356, 1284, 63, 602, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 267, 283, 4261, 13405, 356, 6891, 12, 221, 327, 22672, 14, 267, 283, 3162, 5810, 2681, 356, 378, 221, 327, 29432, 14, 272, 3828, 272, 367, 1962, 315, 666, 14, 362, 360, 14768, 1296, 297, 12319, 267, 327, 6668, 1145, 4012, 11002, 84, 2870, 12, 17289, 5809, 25949, 14, 267, 862, 26, 288, 6250, 275, 473, 689, 2571, 15299, 14, 1462, 14, 362, 8, 4736, 63, 344, 29, 8757, 8, 1143, 459, 14768, 998, 13227, 362, 63, 4097, 1012, 267, 871, 473, 689, 2571, 15299, 14, 7400, 26, 288, 1980, 267, 9146, 275, 473, 689, 12847, 18, 32533, 1296, 7299, 8, 842, 29, 4736, 14, 571, 12, 666, 29, 1143, 9, 267, 340, 9146, 14, 374, 63, 1078, 837, 288, 18360, 63, 656, 18245, 275, 359, 2030, 14, 344, 367, 2396, 2490, 315, 9146, 14, 24372, 63, 576, 459, 17565, 780, 2278, 1612, 5106, 288, 9146, 14, 2117, 8, 10417, 63, 656, 18245, 29, 10417, 63, 656, 18245, 9, 272, 372, 666, 421, 199, 32, 5945, 14, 10910, 199, 318, 2754, 63, 460, 63, 5040, 63, 4736, 8, 571, 12, 6250, 63, 344, 304, 272, 408, 2176, 8730, 7851, 1086, 370, 664, 1006, 2256, 3595, 376, 3411, 6250, 687, 473, 24028, 436, 272, 4838, 626, 2256, 370, 314, 6001, 571, 1256, 3032, 14, 9442, 12, 1240, 21328, 1378, 14768, 272, 370, 11705, 473, 24028, 626, 781, 3984, 6554, 316, 314, 6250, 370, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
openhatch/oh-mainline
vendor/packages/decorator/setup.py
23
1678
try: from setuptools import setup except ImportError: from distutils.core import setup import os.path def getversion(fname): """Get the __version__ reading the file: works both in Python 2.X and 3.X, whereas direct importing would break in Python 3.X with a syntax error""" for line in open(fname): if line.startswith('__version__'): return eval(line[13:]) raise NameError('Missing __version__ in decorator.py') VERSION = getversion( os.path.join(os.path.dirname(__file__), 'src/decorator.py')) if __name__ == '__main__': setup(name='decorator', version=VERSION, description='Better living through Python with decorators', long_description=open('README.txt').read(), author='Michele Simionato', author_email='michele.simionato@gmail.com', url='http://pypi.python.org/pypi/decorator', license="BSD License", package_dir = {'': 'src'}, py_modules = ['decorator'], keywords="decorators generic utility", platforms=["All"], classifiers=['Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities'], use_2to3=True, zip_safe=False)
agpl-3.0
[ 893, 26, 272, 687, 9116, 492, 3272, 199, 2590, 3545, 26, 272, 687, 7065, 14, 1018, 492, 3272, 199, 646, 747, 14, 515, 199, 199, 318, 664, 1023, 8, 5252, 304, 272, 408, 1002, 314, 636, 1023, 363, 7664, 314, 570, 26, 5419, 3865, 315, 2018, 499, 14, 56, 436, 650, 14, 56, 12, 272, 29781, 4125, 16306, 3955, 2059, 315, 2018, 650, 14, 56, 543, 282, 6302, 1125, 624, 272, 367, 1004, 315, 1551, 8, 5252, 304, 267, 340, 1004, 14, 2460, 10714, 1023, 12168, 288, 372, 3468, 8, 604, 59, 969, 5728, 272, 746, 12746, 360, 7718, 636, 1023, 363, 315, 7531, 14, 647, 358, 199, 199, 4612, 275, 664, 1023, 8, 272, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 2164, 15, 11547, 14, 647, 1333, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 3272, 8, 354, 534, 11547, 297, 881, 1015, 29, 4612, 12, 881, 1369, 534, 24472, 351, 1212, 4007, 4012, 2018, 543, 20419, 297, 881, 1846, 63, 1802, 29, 1490, 360, 18195, 14, 2424, 1959, 739, 1062, 881, 4132, 534, 14738, 595, 274, 10751, 1636, 11318, 297, 881, 4132, 63, 2123, 534, 2664, 595, 274, 14, 5206, 1636, 11318, 32, 6799, 14, 957, 297, 881, 1166, 534, 1014, 921, 17343, 14, 1548, 14, 1308, 15, 17343, 15, 11547, 297, 881, 4190, 628, 15400, 844, 401, 881, 2559, 63, 694, 275, 791, 356, 283, 2164, 2267, 881, 1134, 63, 3112, 275, 788, 11547, 995, 881, 7681, 628, 11582, 7809, 11420, 401, 881, 10677, 6270, 2422, 2255, 881, 19137, 2968, 23753, 9795, 3800, 959, 446, 24114, 15, 933, 461, 297, 2432, 283, 23910, 23975, 3800, 23493, 297, 2432, 283, 3761, 3800, 25718, 26330, 3800, 6289, 844, 297, 2432, 283, 23604, 4889, 8466, 3800, 20144, 297, 2432, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 2432, 283, 11411, 8466, 3800, 2018, 297, 2432, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 2432, 283, 12157, 3800, 2290, 15290, 3800, 31454, 297, 2432, 283, 12157, 3800, 738, 17933, 995, 881, 675, 63, 18, 475, 19, 29, 549, 12, 881, 3482, 63, 3489, 29, 797, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 26, 272, 687, 9116, 492, 3272, 199, 2590, 3545, 26, 272, 687, 7065, 14, 1018, 492, 3272, 199, 646, 747, 14, 515, 199, 199, 318, 664, 1023, 8, 5252, 304, 272, 408, 1002, 314, 636, 1023, 363, 7664, 314, 570, 26, 5419, 3865, 315, 2018, 499, 14, 56, 436, 650, 14, 56, 12, 272, 29781, 4125, 16306, 3955, 2059, 315, 2018, 650, 14, 56, 543, 282, 6302, 1125, 624, 272, 367, 1004, 315, 1551, 8, 5252, 304, 267, 340, 1004, 14, 2460, 10714, 1023, 12168, 288, 372, 3468, 8, 604, 59, 969, 5728, 272, 746, 12746, 360, 7718, 636, 1023, 363, 315, 7531, 14, 647, 358, 199, 199, 4612, 275, 664, 1023, 8, 272, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 2164, 15, 11547, 14, 647, 1333, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 3272, 8, 354, 534, 11547, 297, 881, 1015, 29, 4612, 12, 881, 1369, 534, 24472, 351, 1212, 4007, 4012, 2018, 543, 20419, 297, 881, 1846, 63, 1802, 29, 1490, 360, 18195, 14, 2424, 1959, 739, 1062, 881, 4132, 534, 14738, 595, 274, 10751, 1636, 11318, 297, 881, 4132, 63, 2123, 534, 2664, 595, 274, 14, 5206, 1636, 11318, 32, 6799, 14, 957, 297, 881, 1166, 534, 1014, 921, 17343, 14, 1548, 14, 1308, 15, 17343, 15, 11547, 297, 881, 4190, 628, 15400, 844, 401, 881, 2559, 63, 694, 275, 791, 356, 283, 2164, 2267, 881, 1134, 63, 3112, 275, 788, 11547, 995, 881, 7681, 628, 11582, 7809, 11420, 401, 881, 10677, 6270, 2422, 2255, 881, 19137, 2968, 23753, 9795, 3800, 959, 446, 24114, 15, 933, 461, 297, 2432, 283, 23910, 23975, 3800, 23493, 297, 2432, 283, 3761, 3800, 25718, 26330, 3800, 6289, 844, 297, 2432, 283, 23604, 4889, 8466, 3800, 20144, 297, 2432, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 2432, 283, 11411, 8466, 3800, 2018, 297, 2432, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 2432, 283, 12157, 3800, 2290, 15290, 3800, 31454, 297, 2432, 283, 12157, 3800, 738, 17933, 995, 881, 675, 63, 18, 475, 19, 29, 549, 12, 881, 3482, 63, 3489, 29, 797, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: vultr_dns_domain_facts short_description: Gather facts about the Vultr DNS domains available. description: - Gather facts about DNS domains available in Vultr. version_added: "2.7" author: "Yanis Guenane (@Spredzy)" extends_documentation_fragment: vultr ''' EXAMPLES = r''' - name: Gather Vultr DNS domains facts local_action: module: vultr_dns_domains_facts - name: Print the gathered facts debug: var: ansible_facts.vultr_dns_domain_facts ''' RETURN = r''' --- vultr_api: description: Response from Vultr API with a few additions/modification returned: success type: complex contains: api_account: description: Account used in the ini file to select the key returned: success type: string sample: default api_timeout: description: Timeout used for the API requests returned: success type: int sample: 60 api_retries: description: Amount of max retries for the API requests returned: success type: int sample: 5 api_endpoint: description: Endpoint used for the API requests returned: success type: string sample: "https://api.vultr.com" vultr_dns_domain_facts: description: Response from Vultr API returned: success type: complex contains: "vultr_dns_domain_facts": [ { "date_created": "2018-07-19 07:14:21", "domain": "ansibletest.com" } ] ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.vultr import ( Vultr, vultr_argument_spec, ) class AnsibleVultrDnsDomainFacts(Vultr): def __init__(self, module): super(AnsibleVultrDnsDomainFacts, self).__init__(module, "vultr_dns_domain_facts") self.returns = { "date_created": dict(), "domain": dict(), } def get_domains(self): return self.api_query(path="/v1/dns/list") def main(): argument_spec = vultr_argument_spec() module = AnsibleModule( argument_spec=argument_spec, supports_check_mode=True, ) domain_facts = AnsibleVultrDnsDomainFacts(module) result = domain_facts.get_result(domain_facts.get_domains()) ansible_facts = { 'vultr_dns_domain_facts': result['vultr_dns_domain_facts'] } module.exit_json(ansible_facts=ansible_facts, **result) if __name__ == '__main__': main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 334, 67, 9, 14894, 12, 1488, 7199, 12436, 287, 5865, 665, 89, 7199, 11, 4853, 32, 6051, 287, 5865, 14, 1308, 30, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 199, 199, 8948, 275, 519, 2344, 199, 2595, 199, 578, 26, 373, 427, 82, 63, 5797, 63, 2261, 63, 5047, 199, 3612, 63, 1802, 26, 19634, 9036, 3595, 314, 812, 427, 82, 10237, 14006, 2808, 14, 199, 1802, 26, 523, 446, 19634, 9036, 3595, 10237, 14006, 2808, 315, 812, 427, 82, 14, 199, 1023, 63, 3270, 26, 298, 18, 14, 23, 2, 199, 2502, 26, 298, 57, 7199, 12436, 287, 5865, 8593, 5058, 581, 3605, 2924, 199, 11036, 63, 9970, 63, 7677, 26, 373, 427, 82, 199, 2344, 199, 199, 8918, 275, 519, 2344, 199, 13, 536, 26, 19634, 812, 427, 82, 10237, 14006, 9036, 523, 2257, 63, 1287, 26, 272, 859, 26, 373, 427, 82, 63, 5797, 63, 9756, 63, 5047, 199, 199, 13, 536, 26, 9101, 314, 16072, 31051, 9036, 523, 3105, 26, 272, 2729, 26, 3242, 63, 5047, 14, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 199, 2344, 199, 199, 9677, 275, 519, 2344, 199, 2595, 199, 86, 427, 82, 63, 1246, 26, 523, 1369, 26, 7232, 687, 812, 427, 82, 3261, 543, 282, 9284, 32113, 15, 20945, 523, 2138, 26, 3182, 523, 730, 26, 6114, 523, 3509, 26, 272, 2986, 63, 2048, 26, 489, 1369, 26, 9973, 1202, 315, 314, 20364, 570, 370, 3504, 314, 790, 489, 2138, 26, 3182, 489, 730, 26, 1059, 489, 2690, 26, 849, 272, 2986, 63, 2593, 26, 489, 1369, 26, 12878, 1202, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1109, 489, 2690, 26, 5212, 272, 2986, 63, 10937, 26, 489, 1369, 26, 26701, 402, 1390, 10086, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1109, 489, 2690, 26, 959, 272, 2986, 63, 6520, 26, 489, 1369, 26, 9599, 1403, 1202, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1059, 489, 2690, 26, 298, 2859, 921, 1246, 14, 86, 427, 82, 14, 957, 2, 199, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 26, 523, 1369, 26, 7232, 687, 812, 427, 82, 3261, 523, 2138, 26, 3182, 523, 730, 26, 6114, 523, 3509, 26, 272, 298, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 582, 359, 489, 469, 267, 298, 602, 63, 3966, 582, 298, 12682, 13, 1780, 13, 1167, 24937, 26, 1079, 26, 2025, 401, 267, 298, 2261, 582, 298, 4853, 396, 14, 957, 2, 489, 789, 272, 1622, 199, 2344, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 86, 427, 82, 492, 334, 272, 812, 427, 82, 12, 272, 373, 427, 82, 63, 2094, 63, 1650, 12, 199, 9, 421, 199, 533, 2622, 54, 427, 82, 27664, 7705, 25821, 8, 54, 427, 82, 304, 339, 347, 636, 826, 721, 277, 12, 859, 304, 267, 1613, 8, 10047, 54, 427, 82, 27664, 7705, 25821, 12, 291, 2843, 826, 721, 578, 12, 298, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 531, 398, 291, 14, 5808, 275, 469, 288, 298, 602, 63, 3966, 582, 1211, 1062, 288, 298, 2261, 582, 1211, 1062, 267, 789, 339, 347, 664, 63, 9756, 8, 277, 304, 267, 372, 291, 14, 1246, 63, 1131, 8, 515, 9555, 86, 17, 15, 5797, 15, 513, 531, 421, 199, 318, 2446, 837, 272, 1423, 63, 1650, 275, 373, 427, 82, 63, 2094, 63, 1650, 342, 339, 859, 275, 6953, 8, 267, 1423, 63, 1650, 29, 2094, 63, 1650, 12, 267, 5171, 63, 1074, 63, 632, 29, 549, 12, 272, 776, 339, 2881, 63, 5047, 275, 2622, 54, 427, 82, 27664, 7705, 25821, 8, 578, 9, 272, 754, 275, 2881, 63, 5047, 14, 362, 63, 1099, 8, 2261, 63, 5047, 14, 362, 63, 9756, 1012, 272, 3242, 63, 5047, 275, 469, 267, 283, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 356, 754, 459, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 418, 272, 789, 272, 859, 14, 2224, 63, 1001, 8, 4853, 63, 5047, 29, 4853, 63, 5047, 12, 1011, 1099, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 334, 67, 9, 14894, 12, 1488, 7199, 12436, 287, 5865, 665, 89, 7199, 11, 4853, 32, 6051, 287, 5865, 14, 1308, 30, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 199, 199, 8948, 275, 519, 2344, 199, 2595, 199, 578, 26, 373, 427, 82, 63, 5797, 63, 2261, 63, 5047, 199, 3612, 63, 1802, 26, 19634, 9036, 3595, 314, 812, 427, 82, 10237, 14006, 2808, 14, 199, 1802, 26, 523, 446, 19634, 9036, 3595, 10237, 14006, 2808, 315, 812, 427, 82, 14, 199, 1023, 63, 3270, 26, 298, 18, 14, 23, 2, 199, 2502, 26, 298, 57, 7199, 12436, 287, 5865, 8593, 5058, 581, 3605, 2924, 199, 11036, 63, 9970, 63, 7677, 26, 373, 427, 82, 199, 2344, 199, 199, 8918, 275, 519, 2344, 199, 13, 536, 26, 19634, 812, 427, 82, 10237, 14006, 9036, 523, 2257, 63, 1287, 26, 272, 859, 26, 373, 427, 82, 63, 5797, 63, 9756, 63, 5047, 199, 199, 13, 536, 26, 9101, 314, 16072, 31051, 9036, 523, 3105, 26, 272, 2729, 26, 3242, 63, 5047, 14, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 199, 2344, 199, 199, 9677, 275, 519, 2344, 199, 2595, 199, 86, 427, 82, 63, 1246, 26, 523, 1369, 26, 7232, 687, 812, 427, 82, 3261, 543, 282, 9284, 32113, 15, 20945, 523, 2138, 26, 3182, 523, 730, 26, 6114, 523, 3509, 26, 272, 2986, 63, 2048, 26, 489, 1369, 26, 9973, 1202, 315, 314, 20364, 570, 370, 3504, 314, 790, 489, 2138, 26, 3182, 489, 730, 26, 1059, 489, 2690, 26, 849, 272, 2986, 63, 2593, 26, 489, 1369, 26, 12878, 1202, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1109, 489, 2690, 26, 5212, 272, 2986, 63, 10937, 26, 489, 1369, 26, 26701, 402, 1390, 10086, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1109, 489, 2690, 26, 959, 272, 2986, 63, 6520, 26, 489, 1369, 26, 9599, 1403, 1202, 367, 314, 3261, 4145, 489, 2138, 26, 3182, 489, 730, 26, 1059, 489, 2690, 26, 298, 2859, 921, 1246, 14, 86, 427, 82, 14, 957, 2, 199, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 26, 523, 1369, 26, 7232, 687, 812, 427, 82, 3261, 523, 2138, 26, 3182, 523, 730, 26, 6114, 523, 3509, 26, 272, 298, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 582, 359, 489, 469, 267, 298, 602, 63, 3966, 582, 298, 12682, 13, 1780, 13, 1167, 24937, 26, 1079, 26, 2025, 401, 267, 298, 2261, 582, 298, 4853, 396, 14, 957, 2, 489, 789, 272, 1622, 199, 2344, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 86, 427, 82, 492, 334, 272, 812, 427, 82, 12, 272, 373, 427, 82, 63, 2094, 63, 1650, 12, 199, 9, 421, 199, 533, 2622, 54, 427, 82, 27664, 7705, 25821, 8, 54, 427, 82, 304, 339, 347, 636, 826, 721, 277, 12, 859, 304, 267, 1613, 8, 10047, 54, 427, 82, 27664, 7705, 25821, 12, 291, 2843, 826, 721, 578, 12, 298, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 531, 398, 291, 14, 5808, 275, 469, 288, 298, 602, 63, 3966, 582, 1211, 1062, 288, 298, 2261, 582, 1211, 1062, 267, 789, 339, 347, 664, 63, 9756, 8, 277, 304, 267, 372, 291, 14, 1246, 63, 1131, 8, 515, 9555, 86, 17, 15, 5797, 15, 513, 531, 421, 199, 318, 2446, 837, 272, 1423, 63, 1650, 275, 373, 427, 82, 63, 2094, 63, 1650, 342, 339, 859, 275, 6953, 8, 267, 1423, 63, 1650, 29, 2094, 63, 1650, 12, 267, 5171, 63, 1074, 63, 632, 29, 549, 12, 272, 776, 339, 2881, 63, 5047, 275, 2622, 54, 427, 82, 27664, 7705, 25821, 8, 578, 9, 272, 754, 275, 2881, 63, 5047, 14, 362, 63, 1099, 8, 2261, 63, 5047, 14, 362, 63, 9756, 1012, 272, 3242, 63, 5047, 275, 469, 267, 283, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 356, 754, 459, 86, 427, 82, 63, 5797, 63, 2261, 63, 5047, 418, 272, 789, 272, 859, 14, 2224, 63, 1001, 8, 4853, 63, 5047, 29, 4853, 63, 5047, 12, 1011, 1099, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
googlearchive/rgc-models
response_model/python/metric_learning/end_to_end/stimulus_response_embedding.py
1
11824
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== r"""Jointly embed stimulus, response from multiple retina. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path import numpy as np import random import tensorflow as tf from tensorflow.python.client.model_analyzer import PrintModelAnalysis from absl import app from absl import gfile import retina.response_model.python.metric_learning.end_to_end.bookkeeping as bookkeeping # pylint: disable-unused-import import retina.response_model.python.metric_learning.end_to_end.config as config # defines all the flags # pylint: enable-unused-import import retina.response_model.python.metric_learning.end_to_end.data_util as data_util import retina.response_model.python.metric_learning.end_to_end.partitions as partitions import retina.response_model.python.metric_learning.end_to_end.prosthesis as prosthesis import retina.response_model.python.metric_learning.end_to_end.sr_embedding_models as sr_models import retina.response_model.python.metric_learning.end_to_end.sr_embedding_models_experimental as sr_models_expt import retina.response_model.python.metric_learning.end_to_end.encoding_models_experimental as encoding_models_expt import retina.response_model.python.metric_learning.end_to_end.sr_embedding_baseline_models as sr_baseline_models import retina.response_model.python.metric_learning.end_to_end.testing as testing import retina.response_model.python.metric_learning.end_to_end.training as training import retina.response_model.python.metric_learning.end_to_end.sample_datasets as sample_datasets import retina.response_model.python.metric_learning.end_to_end.sample_datasets_2 as sample_datasets_2 FLAGS = tf.app.flags.FLAGS def main(unused_argv=()): np.random.seed(23) tf.set_random_seed(1234) random.seed(50) # Load stimulus-response data. # Collect population response across retinas in the list 'responses'. # Stimulus for each retina is indicated by 'stim_id', # which is found in 'stimuli' dictionary. datasets = gfile.ListDirectory(FLAGS.src_dir) stimuli = {} responses = [] for icnt, idataset in enumerate(datasets): fullpath = os.path.join(FLAGS.src_dir, idataset) if gfile.IsDirectory(fullpath): key = 'stim_%d' % icnt op = data_util.get_stimulus_response(FLAGS.src_dir, idataset, key, boundary=FLAGS.valid_cells_boundary, if_get_stim=True) stimulus, resp, dimx, dimy, _ = op stimuli.update({key: stimulus}) responses += resp # Get training and testing partitions. # Generate partitions # The partitions for the taskid should be listed in partition_file. op = partitions.get_partitions(FLAGS.partition_file, FLAGS.taskid) training_datasets, testing_datasets = op with tf.Session() as sess: # Get stimulus-response embedding. if FLAGS.mode == 0: is_training = True if FLAGS.mode == 1: is_training = True if FLAGS.mode == 2: is_training = True print('NOTE: is_training = True in test') if FLAGS.mode == 3: is_training = True print('NOTE: is_training = True in test') sample_fcn = sample_datasets if (FLAGS.sr_model == 'convolutional_embedding'): embedding = sr_models.convolutional_embedding(FLAGS.sr_model, sess, is_training, dimx, dimy) if (FLAGS.sr_model == 'convolutional_embedding_expt' or FLAGS.sr_model == 'convolutional_embedding_margin_expt' or FLAGS.sr_model == 'convolutional_embedding_inner_product_expt' or FLAGS.sr_model == 'convolutional_embedding_gauss_expt' or FLAGS.sr_model == 'convolutional_embedding_kernel_expt'): embedding = sr_models_expt.convolutional_embedding_experimental( FLAGS.sr_model, sess, is_training, dimx, dimy) if FLAGS.sr_model == 'convolutional_autoembedder': embedding = sr_models_expt.convolutional_autoembedder(sess, is_training, dimx, dimy) if FLAGS.sr_model == 'convolutional_autoembedder_l2': embedding = sr_models_expt.convolutional_autoembedder(sess, is_training, dimx, dimy, loss='log_sum_exp') if FLAGS.sr_model == 'convolutional_encoder' or FLAGS.sr_model == 'convolutional_encoder_2': embedding = encoding_models_expt.convolutional_encoder(sess, is_training, dimx, dimy) if FLAGS.sr_model == 'convolutional_encoder_using_retina_id': model = encoding_models_expt.convolutional_encoder_using_retina_id embedding = model(sess, is_training, dimx, dimy, len(responses)) sample_fcn = sample_datasets_2 if (FLAGS.sr_model == 'residual') or (FLAGS.sr_model == 'residual_inner_product') : embedding = sr_models_expt.residual_experimental(FLAGS.sr_model, sess, is_training, dimx, dimy) if FLAGS.sr_model == 'lin_rank1' or FLAGS.sr_model == 'lin_rank1_blind': if ((len(training_datasets) != 1) and (training_datasets != testing_datasets)): raise ValueError('Identical training/testing data' ' (exactly 1) supported') n_cells = responses[training_datasets[0]]['responses'].shape[1] cell_locations = responses[training_datasets[0]]['map_cell_grid'] cell_masks = responses[training_datasets[0]]['mask_cells'] firing_rates = responses[training_datasets[0]]['mean_firing_rate'] cell_type = responses[training_datasets[0]]['cell_type'].squeeze() model_fn = sr_baseline_models.linear_rank1_models embedding = model_fn(FLAGS.sr_model, sess, dimx, dimy, n_cells, center_locations=cell_locations, cell_masks=cell_masks, firing_rates=firing_rates, cell_type=cell_type, time_window=30) # print model graph PrintModelAnalysis(tf.get_default_graph()) # Get filename, initialize model file_name = bookkeeping.get_filename(training_datasets, testing_datasets, FLAGS.beta, FLAGS.sr_model) tf.logging.info('Filename: %s' % file_name) saver_var, start_iter = bookkeeping.initialize_model(FLAGS.save_folder, file_name, sess) # Setup summary ops. # Save separate summary for each retina (both training/testing). summary_ops = [] for iret in np.arange(len(responses)): r_list = [] r1 = tf.summary.scalar('loss_%d' % iret, embedding.loss) r_list += [r1] if hasattr(embedding, 'accuracy_tf'): r2 = tf.summary.scalar('accuracy_%d' % iret, embedding.accuracy_tf) r_list += [r2] if FLAGS.sr_model == 'convolutional_autoembedder' or FLAGS.sr_model =='convolutional_autoembedder_l2': r3 = tf.summary.scalar('loss_triplet_%d' % iret, embedding.loss_triplet) r4 = tf.summary.scalar('loss_stim_decode_from_resp_%d' % iret, embedding.loss_stim_decode_from_resp) r5 = tf.summary.scalar('loss_stim_decode_from_stim_%d' % iret, embedding.loss_stim_decode_from_stim) r6 = tf.summary.scalar('loss_resp_decode_from_resp_%d' % iret, embedding.loss_resp_decode_from_resp) r7 = tf.summary.scalar('loss_resp_decode_from_stim_%d' % iret, embedding.loss_resp_decode_from_stim) r_list += [r3, r4, r5, r6, r7] ''' chosen_stim = 2 bound = FLAGS.valid_cells_boundary r8 = tf.summary.image('stim_decode_from_stim_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.stim_decode_from_stim[chosen_stim, bound:80-bound, bound:40-bound, 3], 0), 3)) r9 = tf.summary.image('stim_decode_from_resp_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.stim_decode_from_resp[chosen_stim, bound:80-bound, bound:40-bound, 3], 0), 3)) r10 = tf.summary.image('resp_decode_from_stim_chann0_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.resp_decode_from_stim[chosen_stim, bound:80-bound, bound:40-bound, 0], 0), 3)) r11 = tf.summary.image('resp_decode_from_resp_chann0_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.resp_decode_from_resp[chosen_stim, bound:80-bound, bound:40-bound, 0], 0), 3)) r12 = tf.summary.image('resp_decode_from_stim_chann1_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.resp_decode_from_stim[chosen_stim, bound:80-bound, bound:40-bound, 1], 0), 3)) r13 = tf.summary.image('resp_decode_from_resp_chann1_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.resp_decode_from_resp[chosen_stim, bound:80-bound, bound:40-bound, 1], 0), 3)) r14 = tf.summary.image('resp_chann0_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.anchor_model.responses_embed_1[chosen_stim, bound:80-bound, bound:40-bound, 0], 0), 3)) r15 = tf.summary.image('resp_chann1_%d' % iret, tf.expand_dims(tf.expand_dims(embedding.anchor_model.responses_embed_1[chosen_stim, bound:80-bound, bound:40-bound, 1], 0), 3)) r_list += [r8, r9, r10, r11, r12, r13, r14, r15] ''' summary_ops += [tf.summary.merge(r_list)] # Setup summary writers. summary_writers = [] for loc in ['train', 'test']: summary_location = os.path.join(FLAGS.save_folder, file_name, 'summary_' + loc) summary_writer = tf.summary.FileWriter(summary_location, sess.graph) summary_writers += [summary_writer] # Separate tests for encoding or metric learning, # prosthesis usage or just neuroscience usage. if FLAGS.mode == 3: testing.test_encoding(training_datasets, testing_datasets, responses, stimuli, embedding, sess, file_name, sample_fcn) elif FLAGS.mode == 2: prosthesis.stimulate(embedding, sess, file_name, dimx, dimy) elif FLAGS.mode == 1: testing.test_metric(training_datasets, testing_datasets, responses, stimuli, embedding, sess, file_name) else: training.training(start_iter, sess, embedding, summary_writers, summary_ops, saver_var, training_datasets, testing_datasets, responses, stimuli, file_name, sample_fcn, summary_freq=500, save_freq=500) if __name__ == '__main__': app.run(main)
apache-2.0
[ 3, 1898, 14894, 4475, 20376, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 82, 624, 30219, 590, 6441, 29965, 15909, 12, 1177, 687, 3663, 295, 1346, 65, 14, 199, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 747, 14, 515, 199, 646, 2680, 465, 980, 199, 646, 2196, 199, 646, 3228, 465, 2833, 199, 504, 3228, 14, 1548, 14, 1258, 14, 1238, 63, 17965, 492, 9101, 1685, 13182, 199, 504, 2853, 76, 492, 1145, 199, 504, 2853, 76, 492, 26532, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 2706, 3250, 316, 465, 6719, 3250, 316, 199, 3, 4287, 26, 3507, 13, 8618, 13, 646, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 888, 465, 1101, 221, 327, 7890, 1006, 314, 3285, 199, 3, 4287, 26, 4756, 13, 8618, 13, 646, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 576, 63, 1974, 465, 666, 63, 1974, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 12553, 465, 16394, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 496, 270, 426, 2316, 465, 557, 270, 426, 2316, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 992, 465, 11483, 63, 992, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 992, 63, 18924, 465, 11483, 63, 992, 63, 476, 541, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 2991, 63, 992, 63, 18924, 465, 2644, 63, 992, 63, 476, 541, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 14232, 63, 992, 465, 11483, 63, 14232, 63, 992, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 4776, 465, 5343, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 7588, 465, 6093, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 3271, 63, 12281, 465, 2690, 63, 12281, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 3271, 63, 12281, 63, 18, 465, 2690, 63, 12281, 63, 18, 199, 199, 4831, 275, 2833, 14, 571, 14, 2469, 14, 4831, 421, 199, 318, 2446, 8, 8618, 63, 3020, 23603, 819, 980, 14, 2355, 14, 5176, 8, 1789, 9, 523, 2833, 14, 409, 63, 2355, 63, 5176, 8, 4321, 9, 523, 2196, 14, 5176, 8, 1400, 9, 819, 327, 7190, 29965, 15909, 13, 1310, 666, 14, 523, 327, 19649, 16423, 1177, 9371, 295, 1346, 305, 315, 314, 769, 283, 10360, 1370, 523, 327, 428, 2906, 15909, 367, 1924, 295, 1346, 65, 365, 22141, 701, 283, 31739, 63, 344, 297, 523, 327, 1314, 365, 1911, 315, 283, 31739, 13987, 7, 2600, 14, 523, 13148, 275, 26532, 14, 1296, 6231, 8, 4831, 14, 2164, 63, 694, 9, 523, 29965, 13987, 275, 1052, 523, 9320, 275, 942, 523, 367, 284, 6507, 12, 284, 5214, 315, 3874, 8, 12281, 304, 272, 26404, 275, 747, 14, 515, 14, 904, 8, 4831, 14, 2164, 63, 694, 12, 284, 5214, 9, 272, 340, 26532, 14, 1831, 6231, 8, 17943, 304, 489, 790, 275, 283, 31739, 4970, 68, 7, 450, 284, 6507, 489, 1687, 275, 666, 63, 1974, 14, 362, 63, 31739, 15909, 63, 1310, 8, 4831, 14, 2164, 63, 694, 12, 284, 5214, 12, 790, 12, 5644, 8424, 29, 4831, 14, 1078, 63, 9041, 63, 9891, 12, 5644, 340, 63, 362, 63, 31739, 29, 549, 9, 489, 29965, 15909, 12, 3085, 12, 8134, 88, 12, 487, 1662, 12, 485, 275, 1687, 489, 29965, 13987, 14, 873, 2561, 498, 26, 29965, 15909, 1552, 489, 9320, 847, 3085, 819, 327, 2372, 6093, 436, 5343, 16394, 14, 523, 327, 7958, 16394, 523, 327, 710, 16394, 367, 314, 2120, 344, 1077, 506, 10532, 315, 6484, 63, 493, 14, 819, 1687, 275, 16394, 14, 362, 63, 12553, 8, 4831, 14, 5312, 63, 493, 12, 12846, 14, 1765, 344, 9, 523, 6093, 63, 12281, 12, 5343, 63, 12281, 275, 1687, 819, 543, 2833, 14, 4434, 342, 465, 4043, 26, 339, 327, 2372, 29965, 15909, 13, 1310, 12452, 14, 272, 340, 12846, 14, 632, 508, 378, 26, 489, 365, 63, 7588, 275, 715, 272, 340, 12846, 14, 632, 508, 413, 26, 489, 365, 63, 7588, 275, 715, 272, 340, 12846, 14, 632, 508, 499, 26, 489, 365, 63, 7588, 275, 715, 489, 870, 360, 19855, 26, 365, 63, 7588, 275, 715, 315, 511, 358, 272, 340, 12846, 14 ]
[ 1898, 14894, 4475, 20376, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 82, 624, 30219, 590, 6441, 29965, 15909, 12, 1177, 687, 3663, 295, 1346, 65, 14, 199, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 747, 14, 515, 199, 646, 2680, 465, 980, 199, 646, 2196, 199, 646, 3228, 465, 2833, 199, 504, 3228, 14, 1548, 14, 1258, 14, 1238, 63, 17965, 492, 9101, 1685, 13182, 199, 504, 2853, 76, 492, 1145, 199, 504, 2853, 76, 492, 26532, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 2706, 3250, 316, 465, 6719, 3250, 316, 199, 3, 4287, 26, 3507, 13, 8618, 13, 646, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 888, 465, 1101, 221, 327, 7890, 1006, 314, 3285, 199, 3, 4287, 26, 4756, 13, 8618, 13, 646, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 576, 63, 1974, 465, 666, 63, 1974, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 12553, 465, 16394, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 496, 270, 426, 2316, 465, 557, 270, 426, 2316, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 992, 465, 11483, 63, 992, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 992, 63, 18924, 465, 11483, 63, 992, 63, 476, 541, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 2991, 63, 992, 63, 18924, 465, 2644, 63, 992, 63, 476, 541, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 5474, 63, 14275, 63, 14232, 63, 992, 465, 11483, 63, 14232, 63, 992, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 4776, 465, 5343, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 7588, 465, 6093, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 3271, 63, 12281, 465, 2690, 63, 12281, 199, 646, 295, 1346, 65, 14, 1310, 63, 1238, 14, 1548, 14, 5165, 63, 10546, 14, 500, 63, 475, 63, 500, 14, 3271, 63, 12281, 63, 18, 465, 2690, 63, 12281, 63, 18, 199, 199, 4831, 275, 2833, 14, 571, 14, 2469, 14, 4831, 421, 199, 318, 2446, 8, 8618, 63, 3020, 23603, 819, 980, 14, 2355, 14, 5176, 8, 1789, 9, 523, 2833, 14, 409, 63, 2355, 63, 5176, 8, 4321, 9, 523, 2196, 14, 5176, 8, 1400, 9, 819, 327, 7190, 29965, 15909, 13, 1310, 666, 14, 523, 327, 19649, 16423, 1177, 9371, 295, 1346, 305, 315, 314, 769, 283, 10360, 1370, 523, 327, 428, 2906, 15909, 367, 1924, 295, 1346, 65, 365, 22141, 701, 283, 31739, 63, 344, 297, 523, 327, 1314, 365, 1911, 315, 283, 31739, 13987, 7, 2600, 14, 523, 13148, 275, 26532, 14, 1296, 6231, 8, 4831, 14, 2164, 63, 694, 9, 523, 29965, 13987, 275, 1052, 523, 9320, 275, 942, 523, 367, 284, 6507, 12, 284, 5214, 315, 3874, 8, 12281, 304, 272, 26404, 275, 747, 14, 515, 14, 904, 8, 4831, 14, 2164, 63, 694, 12, 284, 5214, 9, 272, 340, 26532, 14, 1831, 6231, 8, 17943, 304, 489, 790, 275, 283, 31739, 4970, 68, 7, 450, 284, 6507, 489, 1687, 275, 666, 63, 1974, 14, 362, 63, 31739, 15909, 63, 1310, 8, 4831, 14, 2164, 63, 694, 12, 284, 5214, 12, 790, 12, 5644, 8424, 29, 4831, 14, 1078, 63, 9041, 63, 9891, 12, 5644, 340, 63, 362, 63, 31739, 29, 549, 9, 489, 29965, 15909, 12, 3085, 12, 8134, 88, 12, 487, 1662, 12, 485, 275, 1687, 489, 29965, 13987, 14, 873, 2561, 498, 26, 29965, 15909, 1552, 489, 9320, 847, 3085, 819, 327, 2372, 6093, 436, 5343, 16394, 14, 523, 327, 7958, 16394, 523, 327, 710, 16394, 367, 314, 2120, 344, 1077, 506, 10532, 315, 6484, 63, 493, 14, 819, 1687, 275, 16394, 14, 362, 63, 12553, 8, 4831, 14, 5312, 63, 493, 12, 12846, 14, 1765, 344, 9, 523, 6093, 63, 12281, 12, 5343, 63, 12281, 275, 1687, 819, 543, 2833, 14, 4434, 342, 465, 4043, 26, 339, 327, 2372, 29965, 15909, 13, 1310, 12452, 14, 272, 340, 12846, 14, 632, 508, 378, 26, 489, 365, 63, 7588, 275, 715, 272, 340, 12846, 14, 632, 508, 413, 26, 489, 365, 63, 7588, 275, 715, 272, 340, 12846, 14, 632, 508, 499, 26, 489, 365, 63, 7588, 275, 715, 489, 870, 360, 19855, 26, 365, 63, 7588, 275, 715, 315, 511, 358, 272, 340, 12846, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
endlessm/chromium-browser
tools/perf/measurements/dual_metric_measurement.py
3
1304
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.web_perf import story_test from telemetry.web_perf import timeline_based_measurement class DualMetricMeasurement(story_test.StoryTest): """Test class supporting both ad hoc measurements and trace based metrics. Currently only works with PressStory pages, which implement GetMeasurements(). """ def __init__(self, tbm_options): super(DualMetricMeasurement, self).__init__() # Only enable tracing if metrics have been specified. if tbm_options.GetTimelineBasedMetrics(): self._tbm_test = timeline_based_measurement.TimelineBasedMeasurement( tbm_options) self._enable_tracing = True else: self._enable_tracing = False def WillRunStory(self, platform): if self._enable_tracing: self._tbm_test.WillRunStory(platform) def Measure(self, platform, results): for value in results.current_story.GetMeasurements(): results.AddMeasurement(**value) if self._enable_tracing: self._tbm_test.Measure(platform, results) def DidRunStory(self, platform, results): if self._enable_tracing: self._tbm_test.DidRunStory(platform, results)
bsd-3-clause
[ 3, 1898, 14894, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 504, 17298, 14, 2520, 63, 9452, 492, 19222, 63, 396, 199, 504, 17298, 14, 2520, 63, 9452, 492, 20780, 63, 6788, 63, 17912, 421, 199, 533, 577, 1061, 11119, 18611, 434, 8, 17372, 63, 396, 14, 25120, 774, 304, 523, 408, 774, 1021, 21038, 3865, 1503, 394, 679, 32619, 436, 3307, 4079, 7186, 14, 339, 13550, 1454, 5419, 543, 23583, 25120, 6497, 12, 1314, 5669, 272, 2372, 18611, 1470, 1252, 523, 408, 523, 347, 636, 826, 721, 277, 12, 7070, 77, 63, 1419, 304, 272, 1613, 8, 30585, 11119, 18611, 434, 12, 291, 2843, 826, 4533, 272, 327, 5972, 4756, 23465, 340, 7186, 1172, 2757, 2013, 14, 272, 340, 7070, 77, 63, 1419, 14, 1002, 27097, 20409, 17213, 837, 489, 291, 423, 5842, 77, 63, 396, 275, 20780, 63, 6788, 63, 17912, 14, 27097, 20409, 18611, 434, 8, 881, 7070, 77, 63, 1419, 9, 489, 291, 423, 4296, 63, 21635, 275, 715, 272, 587, 26, 489, 291, 423, 4296, 63, 21635, 275, 756, 819, 347, 12823, 2540, 25120, 8, 277, 12, 4298, 304, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 20326, 2540, 25120, 8, 3246, 9, 819, 347, 22933, 8, 277, 12, 4298, 12, 2058, 304, 272, 367, 574, 315, 2058, 14, 1818, 63, 17372, 14, 1002, 18611, 1470, 837, 489, 2058, 14, 1123, 18611, 434, 3682, 585, 9, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 18611, 8, 3246, 12, 2058, 9, 819, 347, 29503, 2540, 25120, 8, 277, 12, 4298, 12, 2058, 304, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 17366, 2540, 25120, 8, 3246, 12, 2058, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 14894, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 504, 17298, 14, 2520, 63, 9452, 492, 19222, 63, 396, 199, 504, 17298, 14, 2520, 63, 9452, 492, 20780, 63, 6788, 63, 17912, 421, 199, 533, 577, 1061, 11119, 18611, 434, 8, 17372, 63, 396, 14, 25120, 774, 304, 523, 408, 774, 1021, 21038, 3865, 1503, 394, 679, 32619, 436, 3307, 4079, 7186, 14, 339, 13550, 1454, 5419, 543, 23583, 25120, 6497, 12, 1314, 5669, 272, 2372, 18611, 1470, 1252, 523, 408, 523, 347, 636, 826, 721, 277, 12, 7070, 77, 63, 1419, 304, 272, 1613, 8, 30585, 11119, 18611, 434, 12, 291, 2843, 826, 4533, 272, 327, 5972, 4756, 23465, 340, 7186, 1172, 2757, 2013, 14, 272, 340, 7070, 77, 63, 1419, 14, 1002, 27097, 20409, 17213, 837, 489, 291, 423, 5842, 77, 63, 396, 275, 20780, 63, 6788, 63, 17912, 14, 27097, 20409, 18611, 434, 8, 881, 7070, 77, 63, 1419, 9, 489, 291, 423, 4296, 63, 21635, 275, 715, 272, 587, 26, 489, 291, 423, 4296, 63, 21635, 275, 756, 819, 347, 12823, 2540, 25120, 8, 277, 12, 4298, 304, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 20326, 2540, 25120, 8, 3246, 9, 819, 347, 22933, 8, 277, 12, 4298, 12, 2058, 304, 272, 367, 574, 315, 2058, 14, 1818, 63, 17372, 14, 1002, 18611, 1470, 837, 489, 2058, 14, 1123, 18611, 434, 3682, 585, 9, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 18611, 8, 3246, 12, 2058, 9, 819, 347, 29503, 2540, 25120, 8, 277, 12, 4298, 12, 2058, 304, 272, 340, 291, 423, 4296, 63, 21635, 26, 489, 291, 423, 5842, 77, 63, 396, 14, 17366, 2540, 25120, 8, 3246, 12, 2058, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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ode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Image tools interfaces ~~~~~~~~~~~~~~~~~~~~~~ """ import nibabel as nb import numpy as np from skimage import morphology as sim from scipy.ndimage.morphology import binary_fill_holes from nilearn.masking import compute_epi_mask from nilearn.image import concat_imgs from nipype import logging from nipype.utils.filemanip import fname_presuffix from nipype.interfaces.base import ( traits, isdefined, TraitedSpec, BaseInterfaceInputSpec, File, InputMultiPath, SimpleInterface ) LOGGER = logging.getLogger('nipype.interface') class MaskEPIInputSpec(BaseInterfaceInputSpec): in_files = InputMultiPath(File(exists=True), mandatory=True, desc='input EPI or list of files') lower_cutoff = traits.Float(0.2, usedefault=True) upper_cutoff = traits.Float(0.85, usedefault=True) connected = traits.Bool(True, usedefault=True) enhance_t2 = traits.Bool(False, usedefault=True, desc='enhance T2 contrast on image') opening = traits.Int(2, usedefault=True) closing = traits.Bool(True, usedefault=True) fill_holes = traits.Bool(True, usedefault=True) exclude_zeros = traits.Bool(False, usedefault=True) ensure_finite = traits.Bool(True, usedefault=True) target_affine = traits.Either(None, traits.File(exists=True), default=None, usedefault=True) target_shape = traits.Either(None, traits.File(exists=True), default=None, usedefault=True) no_sanitize = traits.Bool(False, usedefault=True) class MaskEPIOutputSpec(TraitedSpec): out_mask = File(exists=True, desc='output mask') class MaskEPI(SimpleInterface): input_spec = MaskEPIInputSpec output_spec = MaskEPIOutputSpec def _run_interface(self, runtime): in_files = self.inputs.in_files if self.inputs.enhance_t2: in_files = [_enhance_t2_contrast(f, newpath=runtime.cwd) for f in in_files] masknii = compute_epi_mask( in_files, lower_cutoff=self.inputs.lower_cutoff, upper_cutoff=self.inputs.upper_cutoff, connected=self.inputs.connected, opening=self.inputs.opening, exclude_zeros=self.inputs.exclude_zeros, ensure_finite=self.inputs.ensure_finite, target_affine=self.inputs.target_affine, target_shape=self.inputs.target_shape ) if self.inputs.closing: closed = sim.binary_closing(masknii.get_data().astype( np.uint8), sim.ball(1)).astype(np.uint8) masknii = masknii.__class__(closed, masknii.affine, masknii.header) if self.inputs.fill_holes: filled = binary_fill_holes(masknii.get_data().astype( np.uint8), sim.ball(6)).astype(np.uint8) masknii = masknii.__class__(filled, masknii.affine, masknii.header) if self.inputs.no_sanitize: in_file = self.inputs.in_files if isinstance(in_file, list): in_file = in_file[0] nii = nb.load(in_file) qform, code = nii.get_qform(coded=True) masknii.set_qform(qform, int(code)) sform, code = nii.get_sform(coded=True) masknii.set_sform(sform, int(code)) self._results['out_mask'] = fname_presuffix( self.inputs.in_files[0], suffix='_mask', newpath=runtime.cwd) masknii.to_filename(self._results['out_mask']) return runtime class MergeInputSpec(BaseInterfaceInputSpec): in_files = InputMultiPath(File(exists=True), mandatory=True, desc='input list of files to merge') dtype = traits.Enum('f4', 'f8', 'u1', 'u2', 'u4', 'i2', 'i4', usedefault=True, desc='numpy dtype of output image') header_source = File(exists=True, desc='a Nifti file from which the header should be copied') compress = traits.Bool(True, usedefault=True, desc='Use gzip compression on .nii output') class MergeOutputSpec(TraitedSpec): out_file = File(exists=True, desc='output merged file') class Merge(SimpleInterface): input_spec = MergeInputSpec output_spec = MergeOutputSpec def _run_interface(self, runtime): ext = '.nii.gz' if self.inputs.compress else '.nii' self._results['out_file'] = fname_presuffix( self.inputs.in_files[0], suffix='_merged' + ext, newpath=runtime.cwd, use_ext=False) new_nii = concat_imgs(self.inputs.in_files, dtype=self.inputs.dtype) if isdefined(self.inputs.header_source): src_hdr = nb.load(self.inputs.header_source).header new_nii.header.set_xyzt_units(t=src_hdr.get_xyzt_units()[-1]) new_nii.header.set_zooms(list(new_nii.header.get_zooms()[:3]) + [src_hdr.get_zooms()[3]]) new_nii.to_filename(self._results['out_file']) return runtime def _enhance_t2_contrast(in_file, newpath=None, offset=0.5): """ Performs a logarithmic transformation of intensity that effectively splits brain and background and makes the overall distribution more Gaussian. """ out_file = fname_presuffix(in_file, suffix='_t1enh', newpath=newpath) nii = nb.load(in_file) data = nii.get_data() maxd = data.max() newdata = np.log(offset + data / maxd) newdata -= newdata.min() newdata *= maxd / newdata.max() nii = nii.__class__(newdata, nii.affine, nii.header) nii.to_filename(out_file) return out_file
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 325, 19309, 26, 1882, 818, 26, 2366, 27, 1134, 13, 3724, 13, 2743, 26, 841, 27, 4363, 13, 8741, 13, 632, 26, 32644, 1882, 199, 3, 1321, 26, 663, 18133, 29, 1548, 23014, 29, 20, 6714, 29, 20, 5584, 29, 20, 10844, 26, 199, 624, 199, 3491, 7249, 8386, 199, 9753, 2878, 1714, 421, 199, 624, 199, 646, 302, 1892, 902, 465, 8526, 199, 646, 2680, 465, 980, 199, 504, 2386, 1569, 492, 21333, 21936, 4956, 465, 4389, 199, 504, 7026, 14, 78, 23335, 14, 12416, 21936, 4956, 492, 3366, 63, 4498, 63, 31110, 199, 199, 504, 302, 441, 1060, 14, 2629, 316, 492, 4526, 63, 69, 1038, 63, 2629, 199, 504, 302, 441, 1060, 14, 1569, 492, 17159, 63, 1017, 458, 199, 199, 504, 302, 711, 514, 492, 2050, 199, 504, 302, 711, 514, 14, 1208, 14, 493, 29798, 492, 6748, 63, 24919, 2875, 199, 504, 302, 711, 514, 14, 7436, 14, 1095, 492, 334, 272, 19692, 12, 365, 4037, 12, 12643, 5703, 5307, 12, 3523, 4267, 3205, 5307, 12, 272, 3814, 12, 6924, 3947, 2042, 12, 5870, 4267, 199, 9, 199, 199, 10186, 275, 2050, 14, 5572, 360, 78, 711, 514, 14, 3266, 358, 421, 199, 533, 17581, 37, 2252, 3205, 5307, 8, 1563, 4267, 3205, 5307, 304, 272, 315, 63, 1725, 275, 6924, 3947, 2042, 8, 1173, 8, 2444, 29, 549, 395, 15230, 29, 549, 12, 2892, 4328, 534, 1210, 662, 2252, 503, 769, 402, 1584, 358, 272, 5117, 63, 17708, 275, 19692, 14, 5136, 8, 16, 14, 18, 12, 675, 885, 29, 549, 9, 272, 7008, 63, 17708, 275, 19692, 14, 5136, 8, 16, 14, 2426, 12, 675, 885, 29, 549, 9, 272, 8539, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 655, 14666, 63, 84, 18, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 12, 2490, 4328, 534, 287, 14666, 377, 18, 30347, 641, 1834, 358, 272, 13618, 275, 19692, 14, 3241, 8, 18, 12, 675, 885, 29, 549, 9, 272, 11261, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 5554, 63, 31110, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 5760, 63, 4250, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 9, 272, 4868, 63, 8005, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 1347, 63, 9181, 1132, 275, 19692, 14, 37, 1711, 8, 403, 12, 19692, 14, 1173, 8, 2444, 29, 549, 395, 3303, 849, 29, 403, 12, 675, 885, 29, 549, 9, 272, 1347, 63, 1392, 275, 19692, 14, 37, 1711, 8, 403, 12, 19692, 14, 1173, 8, 2444, 29, 549, 395, 639, 849, 29, 403, 12, 675, 885, 29, 549, 9, 272, 949, 63, 18177, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 9, 421, 199, 533, 17581, 6102, 2090, 337, 524, 5307, 8, 2437, 5703, 5307, 304, 272, 734, 63, 2629, 275, 3814, 8, 2444, 29, 549, 12, 4328, 534, 1199, 3656, 358, 421, 199, 533, 17581, 37, 2252, 8, 3184, 4267, 304, 272, 1324, 63, 1650, 275, 17581, 37, 2252, 3205, 5307, 272, 1072, 63, 1650, 275, 17581, 6102, 2090, 337, 524, 5307, 339, 347, 485, 1065, 63, 3266, 8, 277, 12, 8836, 304, 398, 315, 63, 1725, 275, 291, 14, 3711, 14, 262, 63, 1725, 398, 340, 291, 14, 3711, 14, 287, 14666, 63, 84, 18, 26, 288, 315, 63, 1725, 275, 15500, 287, 14666, 63, 84, 18, 63, 17926, 270, 8, 70, 12, 30965, 29, 7726, 14, 6525, 9, 717, 367, 289, 315, 315, 63, 1725, 61, 398, 3656, 78, 5908, 275, 4526, 63, 69, 1038, 63, 2629, 8, 288, 315, 63, 1725, 12, 288, 5117, 63, 17708, 29, 277, 14, 3711, 14, 2325, 63, 17708, 12, 288, 7008, 63, 17708, 29, 277, 14, 3711, 14, 4142, 63, 17708, 12, 288, 8539, 29, 277, 14, 3711, 14, 7113, 12, 288, 13618, 29, 277, 14, 3711, 14, 21849, 12, 288, 5760, 63, 4250, 29, 277, 14, 3711, 14, 5473, 63, 4250, 12, 288, 4868, 63, 8005, 29, 277, 14, 3711, 14, 7505, 63, 8005, 12, 288, 1347, 63, 9181, 1132, 29, 277, 14, 3711, 14, 1375, 63, 9181, 1132, 12, 288, 1347, 63, 1392, 29, 277, 14, 3711, 14, 1375, 63, 1392, 267, 776, 398, 340, 291, 14, 3711, 14, 11707, 26, 288, 6876, 275, 4389, 14, 3008, 63, 11707, 8, 2629, 78, 5908, 14, 362, 63, 576, 1252, 6041, 8, 355, 980, 14, 1635, 24, 395, 4389, 14, 8571, 8, 17, 4992, 6041, 8, 1590, 14, 1635, 24, 9, 288, 3656, 78, 5908, 275, 3656, 78, 5908, 855, 533, 721, 5938, 12, 3656, 78, 5908, 14, 9181, 1132, 12, 3147, 3656, 78, 5908, 14, 1291, 9, 398, 340, 291, 14, 3711, 14, 4498, 63, 31110, 26, 288, 13457, 275, 3366, 63, 4498, 63, 31110, 8, 2629, 78, 5908, 14, 362, 63, 576, 1252, 6041, 8, 355, 980, 14, 1635, 24, 395, 4389, 14, 8571, 8, 22, 4992, 6041, 8, 1590, 14, 1635, 24, 9, 288, 3656, 78, 5908, 275, 3656, 78, 5908, 855, 533, 721, 17647, 12, 3656, 78, 5908, 14, 9181, 1132, 12, 3147, 3656, 78, 5908, 14, 1291, 9, 398, 340, 291, 14, 3711, 14, 889, 63, 18177, 26, 288, 315, 63, 493, 275, 291, 14, 3711, 14, 262, 63, 1725, 288, 340, 1228, 8, 262, 63, 493, 12, 769, 304, 355, 315, 63, 493, 275, 315, 63, 493, 59, 16, 61, 288, 302, 5908, 275, 8526, 14, 912, 8, 262, 63, 493, 9, 288, 1894, 964, 12, 1233, 275, 302, 5908, 14, 362, 63, 81, 964, 8, 15282, 29, 549, 9, 288, 3656, 78, 5908, 14, 409, 63, 81, 964, 8, 81, 964, 12, 1109, 8, 600, 430, 288, 308, 964, 12, 1233, 275, 302, 5908, 14, 362, 63, 83, 964, 8, 15282, 29, 549, 9, 288, 3656, 78, 5908, 14, 409, 63, 83, 964, 8, 83, 964, 12, 1109, 8, 600, 430, 398, 291, 423, 2604, 459, 548, 63, 2629, 418, 275, 6748, 63, 24919, 2875, 8, 288, 291, 14 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 325, 19309, 26, 1882, 818, 26, 2366, 27, 1134, 13, 3724, 13, 2743, 26, 841, 27, 4363, 13, 8741, 13, 632, 26, 32644, 1882, 199, 3, 1321, 26, 663, 18133, 29, 1548, 23014, 29, 20, 6714, 29, 20, 5584, 29, 20, 10844, 26, 199, 624, 199, 3491, 7249, 8386, 199, 9753, 2878, 1714, 421, 199, 624, 199, 646, 302, 1892, 902, 465, 8526, 199, 646, 2680, 465, 980, 199, 504, 2386, 1569, 492, 21333, 21936, 4956, 465, 4389, 199, 504, 7026, 14, 78, 23335, 14, 12416, 21936, 4956, 492, 3366, 63, 4498, 63, 31110, 199, 199, 504, 302, 441, 1060, 14, 2629, 316, 492, 4526, 63, 69, 1038, 63, 2629, 199, 504, 302, 441, 1060, 14, 1569, 492, 17159, 63, 1017, 458, 199, 199, 504, 302, 711, 514, 492, 2050, 199, 504, 302, 711, 514, 14, 1208, 14, 493, 29798, 492, 6748, 63, 24919, 2875, 199, 504, 302, 711, 514, 14, 7436, 14, 1095, 492, 334, 272, 19692, 12, 365, 4037, 12, 12643, 5703, 5307, 12, 3523, 4267, 3205, 5307, 12, 272, 3814, 12, 6924, 3947, 2042, 12, 5870, 4267, 199, 9, 199, 199, 10186, 275, 2050, 14, 5572, 360, 78, 711, 514, 14, 3266, 358, 421, 199, 533, 17581, 37, 2252, 3205, 5307, 8, 1563, 4267, 3205, 5307, 304, 272, 315, 63, 1725, 275, 6924, 3947, 2042, 8, 1173, 8, 2444, 29, 549, 395, 15230, 29, 549, 12, 2892, 4328, 534, 1210, 662, 2252, 503, 769, 402, 1584, 358, 272, 5117, 63, 17708, 275, 19692, 14, 5136, 8, 16, 14, 18, 12, 675, 885, 29, 549, 9, 272, 7008, 63, 17708, 275, 19692, 14, 5136, 8, 16, 14, 2426, 12, 675, 885, 29, 549, 9, 272, 8539, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 655, 14666, 63, 84, 18, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 12, 2490, 4328, 534, 287, 14666, 377, 18, 30347, 641, 1834, 358, 272, 13618, 275, 19692, 14, 3241, 8, 18, 12, 675, 885, 29, 549, 9, 272, 11261, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 5554, 63, 31110, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 5760, 63, 4250, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 9, 272, 4868, 63, 8005, 275, 19692, 14, 10349, 8, 549, 12, 675, 885, 29, 549, 9, 272, 1347, 63, 9181, 1132, 275, 19692, 14, 37, 1711, 8, 403, 12, 19692, 14, 1173, 8, 2444, 29, 549, 395, 3303, 849, 29, 403, 12, 675, 885, 29, 549, 9, 272, 1347, 63, 1392, 275, 19692, 14, 37, 1711, 8, 403, 12, 19692, 14, 1173, 8, 2444, 29, 549, 395, 639, 849, 29, 403, 12, 675, 885, 29, 549, 9, 272, 949, 63, 18177, 275, 19692, 14, 10349, 8, 797, 12, 675, 885, 29, 549, 9, 421, 199, 533, 17581, 6102, 2090, 337, 524, 5307, 8, 2437, 5703, 5307, 304, 272, 734, 63, 2629, 275, 3814, 8, 2444, 29, 549, 12, 4328, 534, 1199, 3656, 358, 421, 199, 533, 17581, 37, 2252, 8, 3184, 4267, 304, 272, 1324, 63, 1650, 275, 17581, 37, 2252, 3205, 5307, 272, 1072, 63, 1650, 275, 17581, 6102, 2090, 337, 524, 5307, 339, 347, 485, 1065, 63, 3266, 8, 277, 12, 8836, 304, 398, 315, 63, 1725, 275, 291, 14, 3711, 14, 262, 63, 1725, 398, 340, 291, 14, 3711, 14, 287, 14666, 63, 84, 18, 26, 288, 315, 63, 1725, 275, 15500, 287, 14666, 63, 84, 18, 63, 17926, 270, 8, 70, 12, 30965, 29, 7726, 14, 6525, 9, 717, 367, 289, 315, 315, 63, 1725, 61, 398, 3656, 78, 5908, 275, 4526, 63, 69, 1038, 63, 2629, 8, 288, 315, 63, 1725, 12, 288, 5117, 63, 17708, 29, 277, 14, 3711, 14, 2325, 63, 17708, 12, 288, 7008, 63, 17708, 29, 277, 14, 3711, 14, 4142, 63, 17708, 12, 288, 8539, 29, 277, 14, 3711, 14, 7113, 12, 288, 13618, 29, 277, 14, 3711, 14, 21849, 12, 288, 5760, 63, 4250, 29, 277, 14, 3711, 14, 5473, 63, 4250, 12, 288, 4868, 63, 8005, 29, 277, 14, 3711, 14, 7505, 63, 8005, 12, 288, 1347, 63, 9181, 1132, 29, 277, 14, 3711, 14, 1375, 63, 9181, 1132, 12, 288, 1347, 63, 1392, 29, 277, 14, 3711, 14, 1375, 63, 1392, 267, 776, 398, 340, 291, 14, 3711, 14, 11707, 26, 288, 6876, 275, 4389, 14, 3008, 63, 11707, 8, 2629, 78, 5908, 14, 362, 63, 576, 1252, 6041, 8, 355, 980, 14, 1635, 24, 395, 4389, 14, 8571, 8, 17, 4992, 6041, 8, 1590, 14, 1635, 24, 9, 288, 3656, 78, 5908, 275, 3656, 78, 5908, 855, 533, 721, 5938, 12, 3656, 78, 5908, 14, 9181, 1132, 12, 3147, 3656, 78, 5908, 14, 1291, 9, 398, 340, 291, 14, 3711, 14, 4498, 63, 31110, 26, 288, 13457, 275, 3366, 63, 4498, 63, 31110, 8, 2629, 78, 5908, 14, 362, 63, 576, 1252, 6041, 8, 355, 980, 14, 1635, 24, 395, 4389, 14, 8571, 8, 22, 4992, 6041, 8, 1590, 14, 1635, 24, 9, 288, 3656, 78, 5908, 275, 3656, 78, 5908, 855, 533, 721, 17647, 12, 3656, 78, 5908, 14, 9181, 1132, 12, 3147, 3656, 78, 5908, 14, 1291, 9, 398, 340, 291, 14, 3711, 14, 889, 63, 18177, 26, 288, 315, 63, 493, 275, 291, 14, 3711, 14, 262, 63, 1725, 288, 340, 1228, 8, 262, 63, 493, 12, 769, 304, 355, 315, 63, 493, 275, 315, 63, 493, 59, 16, 61, 288, 302, 5908, 275, 8526, 14, 912, 8, 262, 63, 493, 9, 288, 1894, 964, 12, 1233, 275, 302, 5908, 14, 362, 63, 81, 964, 8, 15282, 29, 549, 9, 288, 3656, 78, 5908, 14, 409, 63, 81, 964, 8, 81, 964, 12, 1109, 8, 600, 430, 288, 308, 964, 12, 1233, 275, 302, 5908, 14, 362, 63, 83, 964, 8, 15282, 29, 549, 9, 288, 3656, 78, 5908, 14, 409, 63, 83, 964, 8, 83, 964, 12, 1109, 8, 600, 430, 398, 291, 423, 2604, 459, 548, 63, 2629, 418, 275, 6748, 63, 24919, 2875, 8, 288, 291, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Idematica/django-oscar
oscar/apps/dashboard/reports/utils.py
78
1231
from oscar.core.loading import get_class, get_classes OrderReportGenerator = get_class('order.reports', 'OrderReportGenerator') ProductReportGenerator, UserReportGenerator \ = get_classes('analytics.reports', ['ProductReportGenerator', 'UserReportGenerator']) OpenBasketReportGenerator, SubmittedBasketReportGenerator \ = get_classes('basket.reports', ['OpenBasketReportGenerator', 'SubmittedBasketReportGenerator']) OfferReportGenerator = get_class('offer.reports', 'OfferReportGenerator') VoucherReportGenerator = get_class('voucher.reports', 'VoucherReportGenerator') class GeneratorRepository(object): generators = [OrderReportGenerator, ProductReportGenerator, UserReportGenerator, OpenBasketReportGenerator, SubmittedBasketReportGenerator, VoucherReportGenerator, OfferReportGenerator] def get_report_generators(self): return self.generators def get_generator(self, code): for generator in self.generators: if generator.code == code: return generator return None
bsd-3-clause
[ 504, 312, 22707, 14, 1018, 14, 8786, 492, 664, 63, 533, 12, 664, 63, 2888, 199, 4738, 7457, 7599, 275, 664, 63, 533, 360, 1648, 14, 15629, 297, 283, 4738, 7457, 7599, 358, 199, 5884, 7457, 7599, 12, 2876, 7457, 7599, 971, 272, 275, 664, 63, 2888, 360, 20211, 14, 15629, 297, 788, 5884, 7457, 7599, 297, 3147, 283, 1899, 7457, 7599, 1105, 199, 4299, 34, 12351, 7457, 7599, 12, 4804, 4485, 34, 12351, 7457, 7599, 971, 272, 275, 664, 63, 2888, 360, 18136, 14, 15629, 297, 788, 4299, 34, 12351, 7457, 7599, 297, 3660, 283, 2610, 4485, 34, 12351, 7457, 7599, 1105, 199, 22154, 7457, 7599, 275, 664, 63, 533, 360, 12786, 14, 15629, 297, 283, 22154, 7457, 7599, 358, 199, 54, 10795, 7457, 7599, 275, 664, 63, 533, 360, 16637, 14, 15629, 297, 283, 54, 10795, 7457, 7599, 358, 421, 199, 533, 15042, 15614, 8, 785, 304, 339, 16952, 275, 359, 4738, 7457, 7599, 12, 2116, 12705, 7457, 7599, 12, 2116, 2876, 7457, 7599, 12, 2116, 3232, 34, 12351, 7457, 7599, 12, 2116, 4804, 4485, 34, 12351, 7457, 7599, 12, 2116, 812, 10795, 7457, 7599, 12, 2116, 593, 1260, 7457, 7599, 61, 339, 347, 664, 63, 3070, 63, 20748, 8, 277, 304, 267, 372, 291, 14, 20748, 339, 347, 664, 63, 4679, 8, 277, 12, 1233, 304, 267, 367, 4306, 315, 291, 14, 20748, 26, 288, 340, 4306, 14, 600, 508, 1233, 26, 355, 372, 4306, 267, 372, 488, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 312, 22707, 14, 1018, 14, 8786, 492, 664, 63, 533, 12, 664, 63, 2888, 199, 4738, 7457, 7599, 275, 664, 63, 533, 360, 1648, 14, 15629, 297, 283, 4738, 7457, 7599, 358, 199, 5884, 7457, 7599, 12, 2876, 7457, 7599, 971, 272, 275, 664, 63, 2888, 360, 20211, 14, 15629, 297, 788, 5884, 7457, 7599, 297, 3147, 283, 1899, 7457, 7599, 1105, 199, 4299, 34, 12351, 7457, 7599, 12, 4804, 4485, 34, 12351, 7457, 7599, 971, 272, 275, 664, 63, 2888, 360, 18136, 14, 15629, 297, 788, 4299, 34, 12351, 7457, 7599, 297, 3660, 283, 2610, 4485, 34, 12351, 7457, 7599, 1105, 199, 22154, 7457, 7599, 275, 664, 63, 533, 360, 12786, 14, 15629, 297, 283, 22154, 7457, 7599, 358, 199, 54, 10795, 7457, 7599, 275, 664, 63, 533, 360, 16637, 14, 15629, 297, 283, 54, 10795, 7457, 7599, 358, 421, 199, 533, 15042, 15614, 8, 785, 304, 339, 16952, 275, 359, 4738, 7457, 7599, 12, 2116, 12705, 7457, 7599, 12, 2116, 2876, 7457, 7599, 12, 2116, 3232, 34, 12351, 7457, 7599, 12, 2116, 4804, 4485, 34, 12351, 7457, 7599, 12, 2116, 812, 10795, 7457, 7599, 12, 2116, 593, 1260, 7457, 7599, 61, 339, 347, 664, 63, 3070, 63, 20748, 8, 277, 304, 267, 372, 291, 14, 20748, 339, 347, 664, 63, 4679, 8, 277, 12, 1233, 304, 267, 367, 4306, 315, 291, 14, 20748, 26, 288, 340, 4306, 14, 600, 508, 1233, 26, 355, 372, 4306, 267, 372, 488, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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!~/.wine/drive_c/Python25/python.exe # -*- coding: utf-8 -*- # Copyright (c) 2009-2014, Mario Vilas # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice,this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """ Breakpoints. @group Breakpoints: Breakpoint, CodeBreakpoint, PageBreakpoint, HardwareBreakpoint, BufferWatch, Hook, ApiHook @group Warnings: BreakpointWarning, BreakpointCallbackWarning """ __revision__ = "$Id$" __all__ = [ # Base class for breakpoints 'Breakpoint', # Breakpoint implementations 'CodeBreakpoint', 'PageBreakpoint', 'HardwareBreakpoint', # Hooks and watches 'Hook', 'ApiHook', 'BufferWatch', # Warnings 'BreakpointWarning', 'BreakpointCallbackWarning', ] from winappdbg import win32 from winappdbg import compat import sys from winappdbg.process import Process, Thread from winappdbg.util import DebugRegister, MemoryAddresses from winappdbg.textio import HexDump import ctypes import warnings import traceback #============================================================================== class BreakpointWarning (UserWarning): """ This warning is issued when a non-fatal error occurs that's related to breakpoints. """ class BreakpointCallbackWarning (RuntimeWarning): """ This warning is issued when an uncaught exception was raised by a breakpoint's user-defined callback. """ #============================================================================== class Breakpoint (object): """ Base class for breakpoints. Here's the breakpoints state machine. @see: L{CodeBreakpoint}, L{PageBreakpoint}, L{HardwareBreakpoint} @group Breakpoint states: DISABLED, ENABLED, ONESHOT, RUNNING @group State machine: hit, disable, enable, one_shot, running, is_disabled, is_enabled, is_one_shot, is_running, get_state, get_state_name @group Information: get_address, get_size, get_span, is_here @group Conditional breakpoints: is_conditional, is_unconditional, get_condition, set_condition, eval_condition @group Automatic breakpoints: is_automatic, is_interactive, get_action, set_action, run_action @cvar DISABLED: I{Disabled} S{->} Enabled, OneShot @cvar ENABLED: I{Enabled} S{->} I{Running}, Disabled @cvar ONESHOT: I{OneShot} S{->} I{Disabled} @cvar RUNNING: I{Running} S{->} I{Enabled}, Disabled @type DISABLED: int @type ENABLED: int @type ONESHOT: int @type RUNNING: int @type stateNames: dict E{lb} int S{->} str E{rb} @cvar stateNames: User-friendly names for each breakpoint state. @type typeName: str @cvar typeName: User friendly breakpoint type string. """ # I don't think transitions Enabled <-> OneShot should be allowed... plus # it would require special handling to avoid setting the same bp twice DISABLED = 0 ENABLED = 1 ONESHOT = 2 RUNNING = 3 typeName = 'breakpoint' stateNames = { DISABLED : 'disabled', ENABLED : 'enabled', ONESHOT : 'one shot', RUNNING : 'running', } def __init__(self, address, size = 1, condition = True, action = None): """ Breakpoint object. @type address: int @param address: Memory address for breakpoint. @type size: int @param size: Size of breakpoint in bytes (defaults to 1). @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object. """ self.__address = address self.__size = size self.__state = self.DISABLED self.set_condition(condition) self.set_action(action) def __repr__(self): if self.is_disabled(): state = 'Disabled' else: state = 'Active (%s)' % self.get_state_name() if self.is_conditional(): condition = 'conditional' else: condition = 'unconditional' name = self.typeName size = self.get_size() if size == 1: address = HexDump.address( self.get_address() ) else: begin = self.get_address() end = begin + size begin = HexDump.address(begin) end = HexDump.address(end) address = "range %s-%s" % (begin, end) msg = "<%s %s %s at remote address %s>" msg = msg % (state, condition, name, address) return msg #------------------------------------------------------------------------------ def is_disabled(self): """ @rtype: bool @return: C{True} if the breakpoint is in L{DISABLED} state. """ return self.get_state() == self.DISABLED def is_enabled(self): """ @rtype: bool @return: C{True} if the breakpoint is in L{ENABLED} state. """ return self.get_state() == self.ENABLED def is_one_shot(self): """ @rtype: bool @return: C{True} if the breakpoint is in L{ONESHOT} state. """ return self.get_state() == self.ONESHOT def is_running(self): """ @rtype: bool @return: C{True} if the breakpoint is in L{RUNNING} state. """ return self.get_state() == self.RUNNING def is_here(self, address): """ @rtype: bool @return: C{True} if the address is within the range of the breakpoint. """ begin = self.get_address() end = begin + self.get_size() return begin <= address < end def get_address(self): """ @rtype: int @return: The target memory address for the breakpoint. """ return self.__address def get_size(self): """ @rtype: int @return: The size in bytes of the breakpoint. """ return self.__size def get_span(self): """ @rtype: tuple( int, int ) @return: Starting and ending address of the memory range covered by the breakpoint. """ address = self.get_address() size = self.get_size() return ( address, address + size ) def get_state(self): """ @rtype: int @return: The current state of the breakpoint (L{DISABLED}, L{ENABLED}, L{ONESHOT}, L{RUNNING}). """ return self.__state def get_state_name(self): """ @rtype: str @return: The name of the current state of the breakpoint. """ return self.stateNames[ self.get_state() ] #------------------------------------------------------------------------------ def is_conditional(self): """ @see: L{__init__} @rtype: bool @return: C{True} if the breakpoint has a condition callback defined. """ # Do not evaluate as boolean! Test for identity with True instead. return self.__condition is not True def is_unconditional(self): """ @rtype: bool @return: C{True} if the breakpoint doesn't have a condition callback defined. """ # Do not evaluate as boolean! Test for identity with True instead. return self.__condition is True def get_condition(self): """ @rtype: bool, function @return: Returns the condition callback for conditional breakpoints. Returns C{True} for unconditional breakpoints. """ return self.__condition def set_condition(self, condition = True): """ Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function. """ if condition is None: self.__condition = True else: self.__condition = condition def eval_condition(self, event): """ Evaluates the breakpoint condition, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. @rtype: bool @return: C{True} to dispatch the event, C{False} otherwise. """ condition = self.get_condition() if condition is True: # shortcut for unconditional breakpoints return True if callable(condition): try: return bool( condition(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint condition callback %r" " raised an exception: %s") msg = msg % (condition, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return bool( condition ) # force evaluation now #------------------------------------------------------------------------------ def is_automatic(self): """ @rtype: bool @return: C{True} if the breakpoint has an action callback defined. """ return self.__action is not None def is_interactive(self): """ @rtype: bool @return: C{True} if the breakpoint doesn't have an action callback defined. """ return self.__action is None def get_action(self): """ @rtype: bool, function @return: Returns the action callback for automatic breakpoints. Returns C{None} for interactive breakpoints. """ return self.__action def set_action(self, action = None): """ Sets a new action callback for the breakpoint. @type action: function @param action: (Optional) Action callback function. """ self.__action = action def run_action(self, event): """ Executes the breakpoint action callback, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. """ action = self.get_action() if action is not None: try: return bool( action(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint action callback %r" " raised an exception: %s") msg = msg % (action, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return True #------------------------------------------------------------------------------ def __bad_transition(self, state): """ Raises an C{AssertionError} exception for an invalid state transition. @see: L{stateNames} @type state: int @param state: Intended breakpoint state. @raise Exception: Always. """ statemsg = "" oldState = self.stateNames[ self.get_state() ] newState = self.stateNames[ state ] msg = "Invalid state transition (%s -> %s)" \ " for breakpoint at address %s" msg = msg % (oldState, newState, HexDump.address(self.get_address())) raise AssertionError(msg) def disable(self, aProcess, aThread): """ Transition to L{DISABLED} state. - When hit: OneShot S{->} Disabled - Forced by user: Enabled, OneShot, Running S{->} Disabled - Transition from running state may require special handling by the breakpoint implementation class. @type aProcess: L{Process} @param aProcess: Process object. @type aThread: L{Thread} @param aThread: Thread object. """ ## if self.__state not in (self.ENABLED, self.ONESHOT, self.RUNNING): ## self.__bad_transition(self.DISABLED) self.__state = self.DISABLED def enable(self, aProcess, aThread): """ Transition to L{ENABLED} state. - When hit: Running S{->} Enabled - Forced by user: Disabled, Running S{->} Enabled - Transition from running state may require special handling by the breakpoint implementation class. @type aProcess: L{Process} @param aProcess: Process object. @type aThread: L{Thread} @param aThread: Thread object. """ ## if self.__state not in (self.DISABLED, self.RUNNING): ## self.__bad_transition(self.ENABLED) self.__state = self.ENABLED def one_shot(self, aProcess, aThread): """ Transition to L{ONESHOT} state. - Forced by user: Disabled S{->} OneShot @type aProcess: L{Process} @param aProcess: Process object. @type aThread: L{Thread} @param aThread: Thread object. """ ## if self.__state != self.DISABLED: ## self.__bad_transition(self.ONESHOT) self.__state = self.ONESHOT def running(self, aProcess, aThread): """ Transition to L{RUNNING} state. - When hit: Enabled S{->} Running @type aProcess: L{Process} @param aProcess: Process object. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__state != self.ENABLED: self.__bad_transition(self.RUNNING) self.__state = self.RUNNING def hit(self, event): """ Notify a breakpoint that it's been hit. This triggers the corresponding state transition and sets the C{breakpoint} property of the given L{Event} object. @see: L{disable}, L{enable}, L{one_shot}, L{running} @type event: L{Event} @param event: Debug event to handle (depends on the breakpoint type). @raise AssertionError: Disabled breakpoints can't be hit. """ aProcess = event.get_process() aThread = event.get_thread() state = self.get_state() event.breakpoint = self if state == self.ENABLED: self.running(aProcess, aThread) elif state == self.RUNNING: self.enable(aProcess, aThread) elif state == self.ONESHOT: self.disable(aProcess, aThread) elif state == self.DISABLED: # this should not happen msg = "Hit a disabled breakpoint at address %s" msg = msg % HexDump.address( self.get_address() ) warnings.warn(msg, BreakpointWarning) #============================================================================== # XXX TODO # Check if the user is trying to set a code breakpoint on a memory mapped file, # so we don't end up writing the int3 instruction in the file by accident. class CodeBreakpoint (Breakpoint): """ Code execution breakpoints (using an int3 opcode). @see: L{Debug.break_at} @type bpInstruction: str @cvar bpInstruction: Breakpoint instruction for the current processor. """ typeName = 'code breakpoint' if win32.arch in (win32.ARCH_I386, win32.ARCH_AMD64): bpInstruction = '\xCC' # int 3 def __init__(self, address, condition = True, action = None): """ Code breakpoint object. @see: L{Breakpoint.__init__} @type address: int @param address: Memory address for breakpoint. @type condition: function @param condition: (Optional) Condition callback function. @type action: function @param action: (Optional) Action callback function. """ if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64): msg = "Code breakpoints not supported for %s" % win32.arch raise NotImplementedError(msg) Breakpoint.__init__(self, address, len(self.bpInstruction), condition, action) self.__previousValue = self.bpInstruction def __set_bp(self, aProcess): """ Writes a breakpoint instruction at the target address. @type aProcess: L{Process} @param aProcess: Process object. """ address = self.get_address() self.__previousValue = aProcess.read(address, len(self.bpInstruction)) if self.__previousValue == self.bpInstruction: msg = "Possible overlapping code breakpoints at %s" msg = msg % HexDump.address(address) warnings.warn(msg, BreakpointWarning) aProcess.write(address, self.bpInstruction) def __clear_bp(self, aProcess): """ Restores the original byte at the target address. @type aProcess: L{Process} @param aProcess: Process object. """ address = self.get_address() currentValue = aProcess.read(address, len(self.bpInstruction)) if currentValue == self.bpInstruction: # Only restore the previous value if the int3 is still there. aProcess.write(self.get_address(), self.__previousValue) else: self.__previousValue = currentValue msg = "Overwritten code breakpoint at %s" msg = msg % HexDump.address(address) warnings.warn(msg, BreakpointWarning) def disable(self, aProcess, aThread): if not self.is_disabled() and not self.is_running(): self.__clear_bp(aProcess) super(CodeBreakpoint, self).disable(aProcess, aThread) def enable(self, aProcess, aThread): if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aProcess) super(CodeBreakpoint, self).enable(aProcess, aThread) def one_shot(self, aProcess, aThread): if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aProcess) super(CodeBreakpoint, self).one_shot(aProcess, aThread) # FIXME race condition here (however unlikely) # If another thread runs on over the target address while # the breakpoint is in RUNNING state, we'll miss it. There # is a solution to this but it's somewhat complicated, so # I'm leaving it for another version of the debugger. :( def running(self, aProcess, aThread): if self.is_enabled(): self.__clear_bp(aProcess) aThread.set_tf() super(CodeBreakpoint, self).running(aProcess, aThread) #============================================================================== # TODO: # * If the original page was already a guard page, the exception should be # passed to the debugee instead of being handled by the debugger. # * If the original page was already a guard page, it should NOT be converted # to a no-access page when disabling the breakpoint. # * If the page permissions were modified after the breakpoint was enabled, # no change should be done on them when disabling the breakpoint. For this # we need to remember the original page permissions instead of blindly # setting and clearing the guard page bit on them. # * Some pages seem to be "magic" and resist all attempts at changing their # protect bits (for example the pages where the PEB and TEB reside). Maybe # a more descriptive error message could be shown in this case. class PageBreakpoint (Breakpoint): """ Page access breakpoint (using guard pages). @see: L{Debug.watch_buffer} @group Information: get_size_in_pages """ typeName = 'page breakpoint' #------------------------------------------------------------------------------ def __init__(self, address, pages = 1, condition = True, action = None): """ Page breakpoint object. @see: L{Breakpoint.__init__} @type address: int @param address: Memory address for breakpoint. @type pages: int @param address: Size of breakpoint in pages. @type condition: function @param condition: (Optional) Condition callback function. @type action: function @param action: (Optional) Action callback function. """ Breakpoint.__init__(self, address, pages * MemoryAddresses.pageSize, condition, action) ## if (address & 0x00000FFF) != 0: floordiv_align = long(address) // long(MemoryAddresses.pageSize) truediv_align = float(address) / float(MemoryAddresses.pageSize) if floordiv_align != truediv_align: msg = "Address of page breakpoint " \ "must be aligned to a page size boundary " \ "(value %s received)" % HexDump.address(address) raise ValueError(msg) def get_size_in_pages(self): """ @rtype: int @return: The size in pages of the breakpoint. """ # The size is always a multiple of the page size. return self.get_size() // MemoryAddresses.pageSize def __set_bp(self, aProcess): """ Sets the target pages as guard pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() dwSize = self.get_size() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect | win32.PAGE_GUARD aProcess.mprotect(lpAddress, dwSize, flNewProtect) def __clear_bp(self, aProcess): """ Restores the original permissions of the target pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD aProcess.mprotect(lpAddress, self.get_size(), flNewProtect) def disable(self, aProcess, aThread): if not self.is_disabled(): self.__clear_bp(aProcess) super(PageBreakpoint, self).disable(aProcess, aThread) def enable(self, aProcess, aThread): if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64): msg = "Only one-shot page breakpoints are supported for %s" raise NotImplementedError(msg % win32.arch) if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aProcess) super(PageBreakpoint, self).enable(aProcess, aThread) def one_shot(self, aProcess, aThread): if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aProcess) super(PageBreakpoint, self).one_shot(aProcess, aThread) def running(self, aProcess, aThread): aThread.set_tf() super(PageBreakpoint, self).running(aProcess, aThread) #============================================================================== class HardwareBreakpoint (Breakpoint): """ Hardware breakpoint (using debug registers). @see: L{Debug.watch_variable} @group Information: get_slot, get_trigger, get_watch @group Trigger flags: BREAK_ON_EXECUTION, BREAK_ON_WRITE, BREAK_ON_ACCESS @group Watch size flags: WATCH_BYTE, WATCH_WORD, WATCH_DWORD, WATCH_QWORD @type BREAK_ON_EXECUTION: int @cvar BREAK_ON_EXECUTION: Break on execution. @type BREAK_ON_WRITE: int @cvar BREAK_ON_WRITE: Break on write. @type BREAK_ON_ACCESS: int @cvar BREAK_ON_ACCESS: Break on read or write. @type WATCH_BYTE: int @cvar WATCH_BYTE: Watch a byte. @type WATCH_WORD: int @cvar WATCH_WORD: Watch a word (2 bytes). @type WATCH_DWORD: int @cvar WATCH_DWORD: Watch a double word (4 bytes). @type WATCH_QWORD: int @cvar WATCH_QWORD: Watch one quad word (8 bytes). @type validTriggers: tuple @cvar validTriggers: Valid trigger flag values. @type validWatchSizes: tuple @cvar validWatchSizes: Valid watch flag values. """ typeName = 'hardware breakpoint' BREAK_ON_EXECUTION = DebugRegister.BREAK_ON_EXECUTION BREAK_ON_WRITE = DebugRegister.BREAK_ON_WRITE BREAK_ON_ACCESS = DebugRegister.BREAK_ON_ACCESS WATCH_BYTE = DebugRegister.WATCH_BYTE WATCH_WORD = DebugRegister.WATCH_WORD WATCH_DWORD = DebugRegister.WATCH_DWORD WATCH_QWORD = DebugRegister.WATCH_QWORD validTriggers = ( BREAK_ON_EXECUTION, BREAK_ON_WRITE, BREAK_ON_ACCESS, ) validWatchSizes = ( WATCH_BYTE, WATCH_WORD, WATCH_DWORD, WATCH_QWORD, ) def __init__(self, address, triggerFlag = BREAK_ON_ACCESS, sizeFlag = WATCH_DWORD, condition = True, action = None): """ Hardware breakpoint object. @see: L{Breakpoint.__init__} @type address: int @param address: Memory address for breakpoint. @type triggerFlag: int @param triggerFlag: Trigger of breakpoint. Must be one of the following: - L{BREAK_ON_EXECUTION} Break on code execution. - L{BREAK_ON_WRITE} Break on memory read or write. - L{BREAK_ON_ACCESS} Break on memory write. @type sizeFlag: int @param sizeFlag: Size of breakpoint. Must be one of the following: - L{WATCH_BYTE} One (1) byte in size. - L{WATCH_WORD} Two (2) bytes in size. - L{WATCH_DWORD} Four (4) bytes in size. - L{WATCH_QWORD} Eight (8) bytes in size. @type condition: function @param condition: (Optional) Condition callback function. @type action: function @param action: (Optional) Action callback function. """ if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64): msg = "Hardware breakpoints not supported for %s" % win32.arch raise NotImplementedError(msg) if sizeFlag == self.WATCH_BYTE: size = 1 elif sizeFlag == self.WATCH_WORD: size = 2 elif sizeFlag == self.WATCH_DWORD: size = 4 elif sizeFlag == self.WATCH_QWORD: size = 8 else: msg = "Invalid size flag for hardware breakpoint (%s)" msg = msg % repr(sizeFlag) raise ValueError(msg) if triggerFlag not in self.validTriggers: msg = "Invalid trigger flag for hardware breakpoint (%s)" msg = msg % repr(triggerFlag) raise ValueError(msg) Breakpoint.__init__(self, address, size, condition, action) self.__trigger = triggerFlag self.__watch = sizeFlag self.__slot = None def __clear_bp(self, aThread): """ Clears this breakpoint from the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is not None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) DebugRegister.clear_bp(ctx, self.__slot) aThread.set_context(ctx) self.__slot = None finally: aThread.resume() def __set_bp(self, aThread): """ Sets this breakpoint in the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) self.__slot = DebugRegister.find_slot(ctx) if self.__slot is None: msg = "No available hardware breakpoint slots for thread ID %d" msg = msg % aThread.get_tid() raise RuntimeError(msg) DebugRegister.set_bp(ctx, self.__slot, self.get_address(), self.__trigger, self.__watch) aThread.set_context(ctx) finally: aThread.resume() def get_slot(self): """ @rtype: int @return: The debug register number used by this breakpoint, or C{None} if the breakpoint is not active. """ return self.__slot def get_trigger(self): """ @see: L{validTriggers} @rtype: int @return: The breakpoint trigger flag. """ return self.__trigger def get_watch(self): """ @see: L{validWatchSizes} @rtype: int @return: The breakpoint watch flag. """ return self.__watch def disable(self, aProcess, aThread): if not self.is_disabled(): self.__clear_bp(aThread) super(HardwareBreakpoint, self).disable(aProcess, aThread) def enable(self, aProcess, aThread): if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aThread) super(HardwareBreakpoint, self).enable(aProcess, aThread) def one_shot(self, aProcess, aThread): if not self.is_enabled() and not self.is_one_shot(): self.__set_bp(aThread) super(HardwareBreakpoint, self).one_shot(aProcess, aThread) def running(self, aProcess, aThread): self.__clear_bp(aThread) super(HardwareBreakpoint, self).running(aProcess, aThread) aThread.set_tf() #============================================================================== # XXX FIXME # # The implementation of function hooks is very simple. A breakpoint is set at # the entry point. Each time it's hit the "pre" callback is executed. If a # "post" callback was defined, a one-shot breakpoint is set at the return # address - and when that breakpoint hits, the "post" callback is executed. # # Functions hooks, as they are implemented now, don't work correctly for # recursive functions. The problem is we don't know when to remove the # breakpoint at the return address. Also there could be more than one return # address. # # One possible solution would involve a dictionary of lists, where the key # would be the thread ID and the value a stack of return addresses. But we # still don't know what to do if the "wrong" return address is hit for some # reason (maybe check the stack pointer?). Or if both a code and a hardware # breakpoint are hit simultaneously. # # For now, the workaround for the user is to set only the "pre" callback for # functions that are known to be recursive. # # If an exception is thrown by a hooked function and caught by one of it's # parent functions, the "post" callback won't be called and weird stuff may # happen. A possible solution is to put a breakpoint in the system call that # unwinds the stack, to detect this case and remove the "post" breakpoint. # # Hooks may also behave oddly if the return address is overwritten by a buffer # overflow bug (this is similar to the exception problem). But it's probably a # minor issue since when you're fuzzing a function for overflows you're usually # not interested in the return value anyway. # TODO: an API to modify the hooked function's arguments class Hook (object): """ Factory class to produce hook objects. Used by L{Debug.hook_function} and L{Debug.stalk_function}. When you try to instance this class, one of the architecture specific implementations is returned instead. Instances act as an action callback for code breakpoints set at the beginning of a function. It automatically retrieves the parameters from the stack, sets a breakpoint at the return address and retrieves the return value from the function call. @see: L{_Hook_i386}, L{_Hook_amd64} @type useHardwareBreakpoints: bool @cvar useHardwareBreakpoints: C{True} to try to use hardware breakpoints, C{False} otherwise. """ # This is a factory class that returns # the architecture specific implementation. def __new__(cls, *argv, **argd): try: arch = argd['arch'] del argd['arch'] except KeyError: try: arch = argv[4] argv = argv[:4] + argv[5:] except IndexError: raise TypeError("Missing 'arch' argument!") if arch is None: arch = win32.arch if arch == win32.ARCH_I386: return _Hook_i386(*argv, **argd) if arch == win32.ARCH_AMD64: return _Hook_amd64(*argv, **argd) return object.__new__(cls, *argv, **argd) # XXX FIXME # # Hardware breakpoints don't work correctly (or al all) in old VirtualBox # versions (3.0 and below). # # Maybe there should be a way to autodetect the buggy VirtualBox versions # and tell Hook objects not to use hardware breakpoints? # # For now the workaround is to manually set this variable to True when # WinAppDbg is installed on a physical machine. # useHardwareBreakpoints = False def __init__(self, preCB = None, postCB = None, paramCount = None, signature = None, arch = None): """ @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @type arch: str @param arch: (Optional) Target architecture. Defaults to the current architecture. See: L{win32.arch} """ self.__preCB = preCB self.__postCB = postCB self.__paramStack = dict() # tid -> list of tuple( arg, arg, arg... ) self._paramCount = paramCount if win32.arch != win32.ARCH_I386: self.useHardwareBreakpoints = False if win32.bits == 64 and paramCount and not signature: signature = (win32.QWORD,) * paramCount if signature: self._signature = self._calc_signature(signature) else: self._signature = None def _cast_signature_pointers_to_void(self, signature): c_void_p = ctypes.c_void_p c_char_p = ctypes.c_char_p c_wchar_p = ctypes.c_wchar_p _Pointer = ctypes._Pointer cast = ctypes.cast for i in compat.xrange(len(signature)): t = signature[i] if t is not c_void_p and (issubclass(t, _Pointer) \ or t in [c_char_p, c_wchar_p]): signature[i] = cast(t, c_void_p) def _calc_signature(self, signature): raise NotImplementedError( "Hook signatures are not supported for architecture: %s" \ % win32.arch) def _get_return_address(self, aProcess, aThread): return None def _get_function_arguments(self, aProcess, aThread): if self._signature or self._paramCount: raise NotImplementedError( "Hook signatures are not supported for architecture: %s" \ % win32.arch) return () def _get_return_value(self, aThread): return None # By using break_at() to set a process-wide breakpoint on the function's # return address, we might hit a race condition when more than one thread # is being debugged. # # Hardware breakpoints should be used instead. But since a thread can run # out of those, we need to fall back to this method when needed. def __call__(self, event): """ Handles the breakpoint event on entry of the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @raise WindowsError: An error occured. """ debug = event.debug dwProcessId = event.get_pid() dwThreadId = event.get_tid() aProcess = event.get_process() aThread = event.get_thread() # Get the return address and function arguments. ra = self._get_return_address(aProcess, aThread) params = self._get_function_arguments(aProcess, aThread) # Keep the function arguments for later use. self.__push_params(dwThreadId, params) # If we need to hook the return from the function... bHookedReturn = False if ra is not None and self.__postCB is not None: # Try to set a one shot hardware breakpoint at the return address. useHardwareBreakpoints = self.useHardwareBreakpoints if useHardwareBreakpoints: try: debug.define_hardware_breakpoint( dwThreadId, ra, event.debug.BP_BREAK_ON_EXECUTION, event.debug.BP_WATCH_BYTE, True, self.__postCallAction_hwbp ) debug.enable_one_shot_hardware_breakpoint(dwThreadId, ra) bHookedReturn = True except Exception: e = sys.exc_info()[1] useHardwareBreakpoints = False msg = ("Failed to set hardware breakpoint" " at address %s for thread ID %d") msg = msg % (HexDump.address(ra), dwThreadId) warnings.warn(msg, BreakpointWarning) # If not possible, set a code breakpoint instead. if not useHardwareBreakpoints: try: debug.break_at(dwProcessId, ra, self.__postCallAction_codebp) bHookedReturn = True except Exception: e = sys.exc_info()[1] msg = ("Failed to set code breakpoint" " at address %s for process ID %d") msg = msg % (HexDump.address(ra), dwProcessId) warnings.warn(msg, BreakpointWarning) # Call the "pre" callback. try: self.__callHandler(self.__preCB, event, ra, *params) # If no "post" callback is defined, forget the function arguments. finally: if not bHookedReturn: self.__pop_params(dwThreadId) def __postCallAction_hwbp(self, event): """ Handles hardware breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Single step event. """ # Remove the one shot hardware breakpoint # at the return address location in the stack. tid = event.get_tid() address = event.breakpoint.get_address() event.debug.erase_hardware_breakpoint(tid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid) def __postCallAction_codebp(self, event): """ Handles code breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ # If the breakpoint was accidentally hit by another thread, # pass it to the debugger instead of calling the "post" callback. # # XXX FIXME: # I suppose this check will fail under some weird conditions... # tid = event.get_tid() if tid not in self.__paramStack: return True # Remove the code breakpoint at the return address. pid = event.get_pid() address = event.breakpoint.get_address() event.debug.dont_break_at(pid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid) def __postCallAction(self, event): """ Calls the "post" callback. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ aThread = event.get_thread() retval = self._get_return_value(aThread) self.__callHandler(self.__postCB, event, retval) def __callHandler(self, callback, event, *params): """ Calls a "pre" or "post" handler, if set. @type callback: function @param callback: Callback function to call. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @type params: tuple @param params: Parameters for the callback function. """ if callback is not None: event.hook = self callback(event, *params) def __push_params(self, tid, params): """ Remembers the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. @type params: tuple( arg, arg, arg... ) @param params: Tuple of arguments. """ stack = self.__paramStack.get( tid, [] ) stack.append(params) self.__paramStack[tid] = stack def __pop_params(self, tid): """ Forgets the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. """ stack = self.__paramStack[tid] stack.pop() if not stack: del self.__paramStack[tid] def get_params(self, tid): """ Returns the parameters found in the stack when the hooked function was last called by this thread. @type tid: int @param tid: Thread global ID. @rtype: tuple( arg, arg, arg... ) @return: Tuple of arguments. """ try: params = self.get_params_stack(tid)[-1] except IndexError: msg = "Hooked function called from thread %d already returned" raise IndexError(msg % tid) return params def get_params_stack(self, tid): """ Returns the parameters found in the stack each time the hooked function was called by this thread and hasn't returned yet. @type tid: int @param tid: Thread global ID. @rtype: list of tuple( arg, arg, arg... ) @return: List of argument tuples. """ try: stack = self.__paramStack[tid] except KeyError: msg = "Hooked function was not called from thread %d" raise KeyError(msg % tid) return stack def hook(self, debug, pid, address): """ Installs the function hook at a given process and address. @see: L{unhook} @warning: Do not call from an function hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. @type address: int @param address: Function address. """ return debug.break_at(pid, address, self) def unhook(self, debug, pid, address): """ Removes the function hook at a given process and address. @see: L{hook} @warning: Do not call from an function hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. @type address: int @param address: Function address. """ return debug.dont_break_at(pid, address) class _Hook_i386 (Hook): """ Implementation details for L{Hook} on the L{win32.ARCH_I386} architecture. """ # We don't want to inherit the parent class __new__ method. __new__ = object.__new__ def _calc_signature(self, signature): self._cast_signature_pointers_to_void(signature) class Arguments (ctypes.Structure): _fields_ = [ ("arg_%s" % i, signature[i]) \ for i in compat.xrange(len(signature) - 1, -1, -1) ] return Arguments def _get_return_address(self, aProcess, aThread): return aProcess.read_pointer( aThread.get_sp() ) def _get_function_arguments(self, aProcess, aThread): if self._signature: params = aThread.read_stack_structure(self._signature, offset = win32.sizeof(win32.LPVOID)) elif self._paramCount: params = aThread.read_stack_dwords(self._paramCount, offset = win32.sizeof(win32.LPVOID)) else: params = () return params def _get_return_value(self, aThread): ctx = aThread.get_context(win32.CONTEXT_INTEGER) return ctx['Eax'] class _Hook_amd64 (Hook): """ Implementation details for L{Hook} on the L{win32.ARCH_AMD64} architecture. """ # We don't want to inherit the parent class __new__ method. __new__ = object.__new__ # Make a list of floating point types. __float_types = ( ctypes.c_double, ctypes.c_float, ) # Long doubles are not supported in old versions of ctypes! try: __float_types += (ctypes.c_longdouble,) except AttributeError: pass def _calc_signature(self, signature): self._cast_signature_pointers_to_void(signature) float_types = self.__float_types c_sizeof = ctypes.sizeof reg_size = c_sizeof(ctypes.c_size_t) reg_int_sig = [] reg_float_sig = [] stack_sig = [] for i in compat.xrange(len(signature)): arg = signature[i] name = "arg_%d" % i stack_sig.insert( 0, (name, arg) ) if i < 4: if type(arg) in float_types: reg_float_sig.append( (name, arg) ) elif c_sizeof(arg) <= reg_size: reg_int_sig.append( (name, arg) ) else: msg = ("Hook signatures don't support structures" " within the first 4 arguments of a function" " for the %s architecture") % win32.arch raise NotImplementedError(msg) if reg_int_sig: class RegisterArguments (ctypes.Structure): _fields_ = reg_int_sig else: RegisterArguments = None if reg_float_sig: class FloatArguments (ctypes.Structure): _fields_ = reg_float_sig else: FloatArguments = None if stack_sig: class StackArguments (ctypes.Structure): _fields_ = stack_sig else: StackArguments = None return (len(signature), RegisterArguments, FloatArguments, StackArguments) def _get_return_address(self, aProcess, aThread): return aProcess.read_pointer( aThread.get_sp() ) def _get_function_arguments(self, aProcess, aThread): if self._signature: (args_count, RegisterArguments, FloatArguments, StackArguments) = self._signature arguments = {} if StackArguments: address = aThread.get_sp() + win32.sizeof(win32.LPVOID) stack_struct = aProcess.read_structure(address, StackArguments) stack_args = dict( [ (name, stack_struct.__getattribute__(name)) for (name, type) in stack_struct._fields_ ] ) arguments.update(stack_args) flags = 0 if RegisterArguments: flags = flags | win32.CONTEXT_INTEGER if FloatArguments: flags = flags | win32.CONTEXT_MMX_REGISTERS if flags: ctx = aThread.get_context(flags) if RegisterArguments: buffer = (win32.QWORD * 4)(ctx['Rcx'], ctx['Rdx'], ctx['R8'], ctx['R9']) reg_args = self._get_arguments_from_buffer(buffer, RegisterArguments) arguments.update(reg_args) if FloatArguments: buffer = (win32.M128A * 4)(ctx['XMM0'], ctx['XMM1'], ctx['XMM2'], ctx['XMM3']) float_args = self._get_arguments_from_buffer(buffer, FloatArguments) arguments.update(float_args) params = tuple( [ arguments["arg_%d" % i] for i in compat.xrange(args_count) ] ) else: params = () return params def _get_arguments_from_buffer(self, buffer, structure): b_ptr = ctypes.pointer(buffer) v_ptr = ctypes.cast(b_ptr, ctypes.c_void_p) s_ptr = ctypes.cast(v_ptr, ctypes.POINTER(structure)) struct = s_ptr.contents return dict( [ (name, struct.__getattribute__(name)) for (name, type) in struct._fields_ ] ) def _get_return_value(self, aThread): ctx = aThread.get_context(win32.CONTEXT_INTEGER) return ctx['Rax'] #------------------------------------------------------------------------------ # This class acts as a factory of Hook objects, one per target process. # Said objects are deleted by the unhook() method. class ApiHook (object): """ Used by L{EventHandler}. This class acts as an action callback for code breakpoints set at the beginning of a function. It automatically retrieves the parameters from the stack, sets a breakpoint at the return address and retrieves the return value from the function call. @see: L{EventHandler.apiHooks} @type modName: str @ivar modName: Module name. @type procName: str @ivar procName: Procedure name. """ def __init__(self, eventHandler, modName, procName, paramCount = None, signature = None): """ @type eventHandler: L{EventHandler} @param eventHandler: Event handler instance. This is where the hook callbacks are to be defined (see below). @type modName: str @param modName: Module name. @type procName: str @param procName: Procedure name. The pre and post callbacks will be deduced from it. For example, if the procedure is "LoadLibraryEx" the callback routines will be "pre_LoadLibraryEx" and "post_LoadLibraryEx". The signature for the callbacks should be something like this:: def pre_LoadLibraryEx(self, event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) def post_LoadLibraryEx(self, event, return_value): # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. """ self.__modName = modName self.__procName = procName self.__paramCount = paramCount self.__signature = signature self.__preCB = getattr(eventHandler, 'pre_%s' % procName, None) self.__postCB = getattr(eventHandler, 'post_%s' % procName, None) self.__hook = dict() def __call__(self, event): """ Handles the breakpoint event on entry of the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @raise WindowsError: An error occured. """ pid = event.get_pid() try: hook = self.__hook[pid] except KeyError: hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, event.get_process().get_arch() ) self.__hook[pid] = hook return hook(event) @property def modName(self): return self.__modName @property def procName(self): return self.__procName def hook(self, debug, pid): """ Installs the API hook on a given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ label = "%s!%s" % (self.__modName, self.__procName) try: hook = self.__hook[pid] except KeyError: try: aProcess = debug.system.get_process(pid) except KeyError: aProcess = Process(pid) hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, aProcess.get_arch() ) self.__hook[pid] = hook hook.hook(debug, pid, label) def unhook(self, debug, pid): """ Removes the API hook from the given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ try: hook = self.__hook[pid] except KeyError: return label = "%s!%s" % (self.__modName, self.__procName) hook.unhook(debug, pid, label) del self.__hook[pid] #============================================================================== class BufferWatch (object): """ Returned by L{Debug.watch_buffer}. This object uniquely references a buffer being watched, even if there are multiple watches set on the exact memory region. @type pid: int @ivar pid: Process ID. @type start: int @ivar start: Memory address of the start of the buffer. @type end: int @ivar end: Memory address of the end of the buffer. @type action: callable @ivar action: Action callback. @type oneshot: bool @ivar oneshot: C{True} for one shot breakpoints, C{False} otherwise. """ def __init__(self, pid, start, end, action = None, oneshot = False): self.__pid = pid self.__start = start self.__end = end self.__action = action self.__oneshot = oneshot @property def pid(self): return self.__pid @property def start(self): return self.__start @property def end(self): return self.__end @property def action(self): return self.__action @property def oneshot(self): return self.__oneshot def match(self, address): """ Determine if the given memory address lies within the watched buffer. @rtype: bool @return: C{True} if the given memory address lies within the watched buffer, C{False} otherwise. """ return self.__start <= address < self.__end #============================================================================== class _BufferWatchCondition (object): """ Used by L{Debug.watch_buffer}. This class acts as a condition callback for page breakpoints. It emulates page breakpoints that can overlap and/or take up less than a page's size. """ def __init__(self): self.__ranges = list() # list of BufferWatch in definition order def add(self, bw): """ Adds a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. """ self.__ranges.append(bw) def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise def remove_last_match(self, address, size): """ Removes the last buffer from the watch object to match the given address and size. @type address: int @param address: Memory address of buffer to stop watching. @type size: int @param size: Size in bytes of buffer to stop watching. @rtype: int @return: Number of matching elements found. Only the last one to be added is actually deleted upon calling this method. This counter allows you to know if there are more matching elements and how many. """ count = 0 start = address end = address + size - 1 matched = None for item in self.__ranges: if item.match(start) and item.match(end): matched = item count += 1 self.__ranges.remove(matched) return count def count(self): """ @rtype: int @return: Number of buffers being watched. """ return len(self.__ranges) def __call__(self, event): """ Breakpoint condition callback. This method will also call the action callbacks for each buffer being watched. @type event: L{ExceptionEvent} @param event: Guard page exception event. @rtype: bool @return: C{True} if the address being accessed belongs to at least one of the buffers that was being watched and had no action callback. """ address = event.get_exception_information(1) bCondition = False for bw in self.__ranges: bMatched = bw.match(address) try: action = bw.action if bMatched and action is not None: try: action(event) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint action callback %r" " raised an exception: %s") msg = msg % (action, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) else: bCondition = bCondition or bMatched finally: if bMatched and bw.oneshot: event.debug.dont_watch_buffer(bw) return bCondition #============================================================================== class _BreakpointContainer (object): """ Encapsulates the capability to contain Breakpoint objects. @group Breakpoints: break_at, watch_variable, watch_buffer, hook_function, dont_break_at, dont_watch_variable, dont_watch_buffer, dont_hook_function, unhook_function, break_on_error, dont_break_on_error @group Stalking: stalk_at, stalk_variable, stalk_buffer, stalk_function, dont_stalk_at, dont_stalk_variable, dont_stalk_buffer, dont_stalk_function @group Tracing: is_tracing, get_traced_tids, start_tracing, stop_tracing, start_tracing_process, stop_tracing_process, start_tracing_all, stop_tracing_all @group Symbols: resolve_label, resolve_exported_function @group Advanced breakpoint use: define_code_breakpoint, define_page_breakpoint, define_hardware_breakpoint, has_code_breakpoint, has_page_breakpoint, has_hardware_breakpoint, get_code_breakpoint, get_page_breakpoint, get_hardware_breakpoint, erase_code_breakpoint, erase_page_breakpoint, erase_hardware_breakpoint, enable_code_breakpoint, enable_page_breakpoint, enable_hardware_breakpoint, enable_one_shot_code_breakpoint, enable_one_shot_page_breakpoint, enable_one_shot_hardware_breakpoint, disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint @group Listing breakpoints: get_all_breakpoints, get_all_code_breakpoints, get_all_page_breakpoints, get_all_hardware_breakpoints, get_process_breakpoints, get_process_code_breakpoints, get_process_page_breakpoints, get_process_hardware_breakpoints, get_thread_hardware_breakpoints, get_all_deferred_code_breakpoints, get_process_deferred_code_breakpoints @group Batch operations on breakpoints: enable_all_breakpoints, enable_one_shot_all_breakpoints, disable_all_breakpoints, erase_all_breakpoints, enable_process_breakpoints, enable_one_shot_process_breakpoints, disable_process_breakpoints, erase_process_breakpoints @group Breakpoint types: BP_TYPE_ANY, BP_TYPE_CODE, BP_TYPE_PAGE, BP_TYPE_HARDWARE @group Breakpoint states: BP_STATE_DISABLED, BP_STATE_ENABLED, BP_STATE_ONESHOT, BP_STATE_RUNNING @group Memory breakpoint trigger flags: BP_BREAK_ON_EXECUTION, BP_BREAK_ON_WRITE, BP_BREAK_ON_ACCESS @group Memory breakpoint size flags: BP_WATCH_BYTE, BP_WATCH_WORD, BP_WATCH_DWORD, BP_WATCH_QWORD @type BP_TYPE_ANY: int @cvar BP_TYPE_ANY: To get all breakpoints @type BP_TYPE_CODE: int @cvar BP_TYPE_CODE: To get code breakpoints only @type BP_TYPE_PAGE: int @cvar BP_TYPE_PAGE: To get page breakpoints only @type BP_TYPE_HARDWARE: int @cvar BP_TYPE_HARDWARE: To get hardware breakpoints only @type BP_STATE_DISABLED: int @cvar BP_STATE_DISABLED: Breakpoint is disabled. @type BP_STATE_ENABLED: int @cvar BP_STATE_ENABLED: Breakpoint is enabled. @type BP_STATE_ONESHOT: int @cvar BP_STATE_ONESHOT: Breakpoint is enabled for one shot. @type BP_STATE_RUNNING: int @cvar BP_STATE_RUNNING: Breakpoint is running (recently hit). @type BP_BREAK_ON_EXECUTION: int @cvar BP_BREAK_ON_EXECUTION: Break on code execution. @type BP_BREAK_ON_WRITE: int @cvar BP_BREAK_ON_WRITE: Break on memory write. @type BP_BREAK_ON_ACCESS: int @cvar BP_BREAK_ON_ACCESS: Break on memory read or write. """ # Breakpoint types BP_TYPE_ANY = 0 # to get all breakpoints BP_TYPE_CODE = 1 BP_TYPE_PAGE = 2 BP_TYPE_HARDWARE = 3 # Breakpoint states BP_STATE_DISABLED = Breakpoint.DISABLED BP_STATE_ENABLED = Breakpoint.ENABLED BP_STATE_ONESHOT = Breakpoint.ONESHOT BP_STATE_RUNNING = Breakpoint.RUNNING # Memory breakpoint trigger flags BP_BREAK_ON_EXECUTION = HardwareBreakpoint.BREAK_ON_EXECUTION BP_BREAK_ON_WRITE = HardwareBreakpoint.BREAK_ON_WRITE BP_BREAK_ON_ACCESS = HardwareBreakpoint.BREAK_ON_ACCESS # Memory breakpoint size flags BP_WATCH_BYTE = HardwareBreakpoint.WATCH_BYTE BP_WATCH_WORD = HardwareBreakpoint.WATCH_WORD BP_WATCH_QWORD = HardwareBreakpoint.WATCH_QWORD BP_WATCH_DWORD = HardwareBreakpoint.WATCH_DWORD def __init__(self): self.__codeBP = dict() # (pid, address) -> CodeBreakpoint self.__pageBP = dict() # (pid, address) -> PageBreakpoint self.__hardwareBP = dict() # tid -> [ HardwareBreakpoint ] self.__runningBP = dict() # tid -> set( Breakpoint ) self.__tracing = set() # set( tid ) self.__deferredBP = dict() # pid -> label -> (action, oneshot) #------------------------------------------------------------------------------ # This operates on the dictionary of running breakpoints. # Since the bps are meant to stay alive no cleanup is done here. def __get_running_bp_set(self, tid): "Auxiliary method." return self.__runningBP.get(tid, ()) def __add_running_bp(self, tid, bp): "Auxiliary method." if tid not in self.__runningBP: self.__runningBP[tid] = set() self.__runningBP[tid].add(bp) def __del_running_bp(self, tid, bp): "Auxiliary method." self.__runningBP[tid].remove(bp) if not self.__runningBP[tid]: del self.__runningBP[tid] def __del_running_bp_from_all_threads(self, bp): "Auxiliary method." for (tid, bpset) in compat.iteritems(self.__runningBP): if bp in bpset: bpset.remove(bp) self.system.get_thread(tid).clear_tf() #------------------------------------------------------------------------------ # This is the cleanup code. Mostly called on response to exit/unload debug # events. If possible it shouldn't raise exceptions on runtime errors. # The main goal here is to avoid memory or handle leaks. def __cleanup_breakpoint(self, event, bp): "Auxiliary method." try: process = event.get_process() thread = event.get_thread() bp.disable(process, thread) # clear the debug regs / trap flag except Exception: pass bp.set_condition(True) # break possible circular reference bp.set_action(None) # break possible circular reference def __cleanup_thread(self, event): """ Auxiliary method for L{_notify_exit_thread} and L{_notify_exit_process}. """ tid = event.get_tid() # Cleanup running breakpoints try: for bp in self.__runningBP[tid]: self.__cleanup_breakpoint(event, bp) del self.__runningBP[tid] except KeyError: pass # Cleanup hardware breakpoints try: for bp in self.__hardwareBP[tid]: self.__cleanup_breakpoint(event, bp) del self.__hardwareBP[tid] except KeyError: pass # Cleanup set of threads being traced if tid in self.__tracing: self.__tracing.remove(tid) def __cleanup_process(self, event): """ Auxiliary method for L{_notify_exit_process}. """ pid = event.get_pid() process = event.get_process() # Cleanup code breakpoints for (bp_pid, bp_address) in compat.keys(self.__codeBP): if bp_pid == pid: bp = self.__codeBP[ (bp_pid, bp_address) ] self.__cleanup_breakpoint(event, bp) del self.__codeBP[ (bp_pid, bp_address) ] # Cleanup page breakpoints for (bp_pid, bp_address) in compat.keys(self.__pageBP): if bp_pid == pid: bp = self.__pageBP[ (bp_pid, bp_address) ] self.__cleanup_breakpoint(event, bp) del self.__pageBP[ (bp_pid, bp_address) ] # Cleanup deferred code breakpoints try: del self.__deferredBP[pid] except KeyError: pass def __cleanup_module(self, event): """ Auxiliary method for L{_notify_unload_dll}. """ pid = event.get_pid() process = event.get_process() module = event.get_module() # Cleanup thread breakpoints on this module for tid in process.iter_thread_ids(): thread = process.get_thread(tid) # Running breakpoints if tid in self.__runningBP: bplist = list(self.__runningBP[tid]) for bp in bplist: bp_address = bp.get_address() if process.get_module_at_address(bp_address) == module: self.__cleanup_breakpoint(event, bp) self.__runningBP[tid].remove(bp) # Hardware breakpoints if tid in self.__hardwareBP: bplist = list(self.__hardwareBP[tid]) for bp in bplist: bp_address = bp.get_address() if process.get_module_at_address(bp_address) == module: self.__cleanup_breakpoint(event, bp) self.__hardwareBP[tid].remove(bp) # Cleanup code breakpoints on this module for (bp_pid, bp_address) in compat.keys(self.__codeBP): if bp_pid == pid: if process.get_module_at_address(bp_address) == module: bp = self.__codeBP[ (bp_pid, bp_address) ] self.__cleanup_breakpoint(event, bp) del self.__codeBP[ (bp_pid, bp_address) ] # Cleanup page breakpoints on this module for (bp_pid, bp_address) in compat.keys(self.__pageBP): if bp_pid == pid: if process.get_module_at_address(bp_address) == module: bp = self.__pageBP[ (bp_pid, bp_address) ] self.__cleanup_breakpoint(event, bp) del self.__pageBP[ (bp_pid, bp_address) ] #------------------------------------------------------------------------------ # Defining breakpoints. # Code breakpoints. def define_code_breakpoint(self, dwProcessId, address, condition = True, action = None): """ Creates a disabled code breakpoint at the given address. @see: L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint}, L{erase_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the code instruction to break at. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{CodeBreakpoint} @return: The code breakpoint object. """ process = self.system.get_process(dwProcessId) bp = CodeBreakpoint(address, condition, action) key = (dwProcessId, bp.get_address()) if key in self.__codeBP: msg = "Already exists (PID %d) : %r" raise KeyError(msg % (dwProcessId, self.__codeBP[key])) self.__codeBP[key] = bp return bp # Page breakpoints. def define_page_breakpoint(self, dwProcessId, address, pages = 1, condition = True, action = None): """ Creates a disabled page breakpoint at the given address. @see: L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the first page to watch. @type pages: int @param pages: Number of pages to watch. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ process = self.system.get_process(dwProcessId) bp = PageBreakpoint(address, pages, condition, action) begin = bp.get_address() end = begin + bp.get_size() address = begin pageSize = MemoryAddresses.pageSize while address < end: key = (dwProcessId, address) if key in self.__pageBP: msg = "Already exists (PID %d) : %r" msg = msg % (dwProcessId, self.__pageBP[key]) raise KeyError(msg) address = address + pageSize address = begin while address < end: key = (dwProcessId, address) self.__pageBP[key] = bp address = address + pageSize return bp # Hardware breakpoints. def define_hardware_breakpoint(self, dwThreadId, address, triggerFlag = BP_BREAK_ON_ACCESS, sizeFlag = BP_WATCH_DWORD, condition = True, action = None): """ Creates a disabled hardware breakpoint at the given address. @see: L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint}, L{erase_hardware_breakpoint} @note: Hardware breakpoints do not seem to work properly on VirtualBox. See U{http://www.virtualbox.org/ticket/477}. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address to watch. @type triggerFlag: int @param triggerFlag: Trigger of breakpoint. Must be one of the following: - L{BP_BREAK_ON_EXECUTION} Break on code execution. - L{BP_BREAK_ON_WRITE} Break on memory read or write. - L{BP_BREAK_ON_ACCESS} Break on memory write. @type sizeFlag: int @param sizeFlag: Size of breakpoint. Must be one of the following: - L{BP_WATCH_BYTE} One (1) byte in size. - L{BP_WATCH_WORD} Two (2) bytes in size. - L{BP_WATCH_DWORD} Four (4) bytes in size. - L{BP_WATCH_QWORD} Eight (8) bytes in size. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{HardwareBreakpoint} @return: The hardware breakpoint object. """ thread = self.system.get_thread(dwThreadId) bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition, action) begin = bp.get_address() end = begin + bp.get_size() if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for oldbp in bpSet: old_begin = oldbp.get_address() old_end = old_begin + oldbp.get_size() if MemoryAddresses.do_ranges_intersect(begin, end, old_begin, old_end): msg = "Already exists (TID %d) : %r" % (dwThreadId, oldbp) raise KeyError(msg) else: bpSet = set() self.__hardwareBP[dwThreadId] = bpSet bpSet.add(bp) return bp #------------------------------------------------------------------------------ # Checking breakpoint definitions. def has_code_breakpoint(self, dwProcessId, address): """ Checks if a code breakpoint is defined at the given address. @see: L{define_code_breakpoint}, L{get_code_breakpoint}, L{erase_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise. """ return (dwProcessId, address) in self.__codeBP def has_page_breakpoint(self, dwProcessId, address): """ Checks if a page breakpoint is defined at the given address. @see: L{define_page_breakpoint}, L{get_page_breakpoint}, L{erase_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise. """ return (dwProcessId, address) in self.__pageBP def has_hardware_breakpoint(self, dwThreadId, address): """ Checks if a hardware breakpoint is defined at the given address. @see: L{define_hardware_breakpoint}, L{get_hardware_breakpoint}, L{erase_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise. """ if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for bp in bpSet: if bp.get_address() == address: return True return False #------------------------------------------------------------------------------ # Getting breakpoints. def get_code_breakpoint(self, dwProcessId, address): """ Returns the internally used breakpoint object, for the code breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint}, L{erase_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{CodeBreakpoint} @return: The code breakpoint object. """ key = (dwProcessId, address) if key not in self.__codeBP: msg = "No breakpoint at process %d, address %s" address = HexDump.address(address) raise KeyError(msg % (dwProcessId, address)) return self.__codeBP[key] def get_page_breakpoint(self, dwProcessId, address): """ Returns the internally used breakpoint object, for the page breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ key = (dwProcessId, address) if key not in self.__pageBP: msg = "No breakpoint at process %d, address %s" address = HexDump.addresS(address) raise KeyError(msg % (dwProcessId, address)) return self.__pageBP[key] def get_hardware_breakpoint(self, dwThreadId, address): """ Returns the internally used breakpoint object, for the code breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_code_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint}, L{erase_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{HardwareBreakpoint} @return: The hardware breakpoint object. """ if dwThreadId not in self.__hardwareBP: msg = "No hardware breakpoints set for thread %d" raise KeyError(msg % dwThreadId) for bp in self.__hardwareBP[dwThreadId]: if bp.is_here(address): return bp msg = "No hardware breakpoint at thread %d, address %s" raise KeyError(msg % (dwThreadId, HexDump.address(address))) #------------------------------------------------------------------------------ # Enabling and disabling breakpoints. def enable_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None) # XXX HACK thread is not used def enable_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None) # XXX HACK thread is not used def enable_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @note: Do not set hardware breakpoints while processing the system breakpoint event. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(None, t) # XXX HACK process is not used def enable_one_shot_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address for only one shot. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None) # XXX HACK thread is not used def enable_one_shot_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address for only one shot. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None) # XXX HACK thread is not used def enable_one_shot_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address for only one shot. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(None, t) # XXX HACK process is not used def disable_code_breakpoint(self, dwProcessId, address): """ Disables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint} L{enable_one_shot_code_breakpoint}, L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None) # XXX HACK thread is not used def disable_page_breakpoint(self, dwProcessId, address): """ Disables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint} L{enable_one_shot_page_breakpoint}, L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None) # XXX HACK thread is not used def disable_hardware_breakpoint(self, dwThreadId, address): """ Disables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint} L{enable_one_shot_hardware_breakpoint}, L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) p = t.get_process() bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp(dwThreadId, bp) bp.disable(p, t) #------------------------------------------------------------------------------ # Undefining (erasing) breakpoints. def erase_code_breakpoint(self, dwProcessId, address): """ Erases the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_code_breakpoint(dwProcessId, address) if not bp.is_disabled(): self.disable_code_breakpoint(dwProcessId, address) del self.__codeBP[ (dwProcessId, address) ] def erase_page_breakpoint(self, dwProcessId, address): """ Erases the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_page_breakpoint(dwProcessId, address) begin = bp.get_address() end = begin + bp.get_size() if not bp.is_disabled(): self.disable_page_breakpoint(dwProcessId, address) address = begin pageSize = MemoryAddresses.pageSize while address < end: del self.__pageBP[ (dwProcessId, address) ] address = address + pageSize def erase_hardware_breakpoint(self, dwThreadId, address): """ Erases the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_hardware_breakpoint(dwThreadId, address) if not bp.is_disabled(): self.disable_hardware_breakpoint(dwThreadId, address) bpSet = self.__hardwareBP[dwThreadId] bpSet.remove(bp) if not bpSet: del self.__hardwareBP[dwThreadId] #------------------------------------------------------------------------------ # Listing breakpoints. def get_all_breakpoints(self): """ Returns all breakpoint objects as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints. """ bplist = list() # Get the code breakpoints. for (pid, bp) in self.get_all_code_breakpoints(): bplist.append( (pid, None, bp) ) # Get the page breakpoints. for (pid, bp) in self.get_all_page_breakpoints(): bplist.append( (pid, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_all_hardware_breakpoints(): pid = self.system.get_thread(tid).get_pid() bplist.append( (pid, tid, bp) ) # Return the list of breakpoints. return bplist def get_all_code_breakpoints(self): """ @rtype: list of tuple( int, L{CodeBreakpoint} ) @return: All code breakpoints as a list of tuples (pid, bp). """ return [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__codeBP) ] def get_all_page_breakpoints(self): """ @rtype: list of tuple( int, L{PageBreakpoint} ) @return: All page breakpoints as a list of tuples (pid, bp). """ ## return list( set( [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__pageBP) ] ) ) result = set() for ((pid, address), bp) in compat.iteritems(self.__pageBP): result.add( (pid, bp) ) return list(result) def get_all_hardware_breakpoints(self): """ @rtype: list of tuple( int, L{HardwareBreakpoint} ) @return: All hardware breakpoints as a list of tuples (tid, bp). """ result = list() for (tid, bplist) in compat.iteritems(self.__hardwareBP): for bp in bplist: result.append( (tid, bp) ) return result def get_process_breakpoints(self, dwProcessId): """ Returns all breakpoint objects for the given process as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints for the given process. """ bplist = list() # Get the code breakpoints. for bp in self.get_process_code_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the page breakpoints. for bp in self.get_process_page_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_process_hardware_breakpoints(dwProcessId): pid = self.system.get_thread(tid).get_pid() bplist.append( (dwProcessId, tid, bp) ) # Return the list of breakpoints. return bplist def get_process_code_breakpoints(self, dwProcessId): """ @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of L{CodeBreakpoint} @return: All code breakpoints for the given process. """ return [ bp for ((pid, address), bp) in compat.iteritems(self.__codeBP) \ if pid == dwProcessId ] def get_process_page_breakpoints(self, dwProcessId): """ @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of L{PageBreakpoint} @return: All page breakpoints for the given process. """ return [ bp for ((pid, address), bp) in compat.iteritems(self.__pageBP) \ if pid == dwProcessId ] def get_thread_hardware_breakpoints(self, dwThreadId): """ @see: L{get_process_hardware_breakpoints} @type dwThreadId: int @param dwThreadId: Thread global ID. @rtype: list of L{HardwareBreakpoint} @return: All hardware breakpoints for the given thread. """ result = list() for (tid, bplist) in compat.iteritems(self.__hardwareBP): if tid == dwThreadId: for bp in bplist: result.append(bp) return result def get_process_hardware_breakpoints(self, dwProcessId): """ @see: L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( int, L{HardwareBreakpoint} ) @return: All hardware breakpoints for each thread in the given process as a list of tuples (tid, bp). """ result = list() aProcess = self.system.get_process(dwProcessId) for dwThreadId in aProcess.iter_thread_ids(): if dwThreadId in self.__hardwareBP: bplist = self.__hardwareBP[dwThreadId] for bp in bplist: result.append( (dwThreadId, bp) ) return result ## def get_all_hooks(self): ## """ ## @see: L{get_process_hooks} ## ## @rtype: list of tuple( int, int, L{Hook} ) ## @return: All defined hooks as a list of tuples (pid, address, hook). ## """ ## return [ (pid, address, hook) \ ## for ((pid, address), hook) in self.__hook_objects ] ## ## def get_process_hooks(self, dwProcessId): ## """ ## @see: L{get_all_hooks} ## ## @type dwProcessId: int ## @param dwProcessId: Process global ID. ## ## @rtype: list of tuple( int, int, L{Hook} ) ## @return: All hooks for the given process as a list of tuples ## (pid, address, hook). ## """ ## return [ (pid, address, hook) \ ## for ((pid, address), hook) in self.__hook_objects \ ## if pid == dwProcessId ] #------------------------------------------------------------------------------ # Batch operations on all breakpoints. def enable_all_breakpoints(self): """ Enables all disabled breakpoints in all processes. @see: enable_code_breakpoint, enable_page_breakpoint, enable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_hardware_breakpoint(tid, bp.get_address()) def enable_one_shot_all_breakpoints(self): """ Enables for one shot all disabled breakpoints in all processes. @see: enable_one_shot_code_breakpoint, enable_one_shot_page_breakpoint, enable_one_shot_hardware_breakpoint """ # disable code breakpoints for one shot for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for one shot for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for one shot for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(tid, bp.get_address()) def disable_all_breakpoints(self): """ Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.disable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.disable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.disable_hardware_breakpoint(tid, bp.get_address()) def erase_all_breakpoints(self): """ Erases all breakpoints in all processes. @see: erase_code_breakpoint, erase_page_breakpoint, erase_hardware_breakpoint """ # This should be faster but let's not trust the GC so much :P # self.disable_all_breakpoints() # self.__codeBP = dict() # self.__pageBP = dict() # self.__hardwareBP = dict() # self.__runningBP = dict() # self.__hook_objects = dict() ## # erase hooks ## for (pid, address, hook) in self.get_all_hooks(): ## self.dont_hook_function(pid, address) # erase code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.erase_code_breakpoint(pid, bp.get_address()) # erase page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.erase_page_breakpoint(pid, bp.get_address()) # erase hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.erase_hardware_breakpoint(tid, bp.get_address()) #------------------------------------------------------------------------------ # Batch operations on breakpoints per process. def enable_process_breakpoints(self, dwProcessId): """ Enables all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_hardware_breakpoint(dwThreadId, bp.get_address()) def enable_one_shot_process_breakpoints(self, dwProcessId): """ Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for one shot for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for one shot for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints for one shot if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(dwThreadId, bp.get_address()) def disable_process_breakpoints(self, dwProcessId): """ Disables all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.disable_code_breakpoint(dwProcessId, bp.get_address()) # disable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.disable_page_breakpoint(dwProcessId, bp.get_address()) # disable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.disable_hardware_breakpoint(dwThreadId, bp.get_address()) def erase_process_breakpoints(self, dwProcessId): """ Erases all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable breakpoints first # if an error occurs, no breakpoint is erased self.disable_process_breakpoints(dwProcessId) ## # erase hooks ## for address, hook in self.get_process_hooks(dwProcessId): ## self.dont_hook_function(dwProcessId, address) # erase code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.erase_code_breakpoint(dwProcessId, bp.get_address()) # erase page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.erase_page_breakpoint(dwProcessId, bp.get_address()) # erase hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.erase_hardware_breakpoint(dwThreadId, bp.get_address()) #------------------------------------------------------------------------------ # Internal handlers of debug events. def _notify_guard_page(self, event): """ Notify breakpoints of a guard page exception event. @type event: L{ExceptionEvent} @param event: Guard page exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_fault_address() pid = event.get_pid() bCallHandler = True # Align address to page boundary. mask = ~(MemoryAddresses.pageSize - 1) address = address & mask # Do we have an active page breakpoint there? key = (pid, address) if key in self.__pageBP: bp = self.__pageBP[key] if bp.is_enabled() or bp.is_one_shot(): # Breakpoint is ours. event.continueStatus = win32.DBG_CONTINUE ## event.continueStatus = win32.DBG_EXCEPTION_HANDLED # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bp.run_action(event) bCallHandler = False else: bCallHandler = bCondition # If we don't have a breakpoint here pass the exception to the debugee. # This is a normally occurring exception so we shouldn't swallow it. else: event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED return bCallHandler def _notify_breakpoint(self, event): """ Notify breakpoints of a breakpoint exception event. @type event: L{ExceptionEvent} @param event: Breakpoint exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_exception_address() pid = event.get_pid() bCallHandler = True # Do we have an active code breakpoint there? key = (pid, address) if key in self.__codeBP: bp = self.__codeBP[key] if not bp.is_disabled(): # Change the program counter (PC) to the exception address. # This accounts for the change in PC caused by # executing the breakpoint instruction, no matter # the size of it. aThread = event.get_thread() aThread.set_pc(address) # Swallow the exception. event.continueStatus = win32.DBG_CONTINUE # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bCallHandler = bp.run_action(event) else: bCallHandler = bCondition # Handle the system breakpoint. # TODO: examine the stack trace to figure out if it's really a # system breakpoint or an antidebug trick. The caller should be # inside ntdll if it's legit. elif event.get_process().is_system_defined_breakpoint(address): event.continueStatus = win32.DBG_CONTINUE # In hostile mode, if we don't have a breakpoint here pass the # exception to the debugee. In normal mode assume all breakpoint # exceptions are to be handled by the debugger. else: if self.in_hostile_mode(): event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED else: event.continueStatus = win32.DBG_CONTINUE return bCallHandler def _notify_single_step(self, event): """ Notify breakpoints of a single step exception event. @type event: L{ExceptionEvent} @param event: Single step exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ pid = event.get_pid() tid = event.get_tid() aThread = event.get_thread() aProcess = event.get_process() bCallHandler = True bIsOurs = False # In hostile mode set the default to pass the exception to the debugee. # If we later determine the exception is ours, hide it instead. old_continueStatus = event.continueStatus try: if self.in_hostile_mode(): event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED # Single step support is implemented on x86/x64 architectures only. if self.system.arch not in (win32.ARCH_I386, win32.ARCH_AMD64): return bCallHandler # In hostile mode, read the last executed bytes to try to detect # some antidebug tricks. Skip this check in normal mode because # it'd slow things down. # # FIXME: weird opcode encodings may bypass this check! # # bFakeSingleStep: Ice Breakpoint undocumented instruction. # bHideTrapFlag: Don't let pushf instructions get the real value of # the trap flag. # bNextIsPopFlags: Don't let popf instructions clear the trap flag. # bFakeSingleStep = False bLastIsPushFlags = False bNextIsPopFlags = False if self.in_hostile_mode(): pc = aThread.get_pc() c = aProcess.read_char(pc - 1) if c == 0xF1: # int1 bFakeSingleStep = True elif c == 0x9C: # pushf bLastIsPushFlags = True c = aProcess.peek_char(pc) if c == 0x66: # the only valid prefix for popf c = aProcess.peek_char(pc + 1) if c == 0x9D: # popf if bLastIsPushFlags: bLastIsPushFlags = False # they cancel each other out else: bNextIsPopFlags = True # When the thread is in tracing mode, # don't pass the exception to the debugee # and set the trap flag again. if self.is_tracing(tid): bIsOurs = True if not bFakeSingleStep: event.continueStatus = win32.DBG_CONTINUE aThread.set_tf() # Don't let the debugee read or write the trap flag. # This code works in 32 and 64 bits thanks to the endianness. if bLastIsPushFlags or bNextIsPopFlags: sp = aThread.get_sp() flags = aProcess.read_dword(sp) if bLastIsPushFlags: flags &= ~Thread.Flags.Trap else: # if bNextIsPopFlags: flags |= Thread.Flags.Trap aProcess.write_dword(sp, flags) # Handle breakpoints in RUNNING state. running = self.__get_running_bp_set(tid) if running: bIsOurs = True if not bFakeSingleStep: event.continueStatus = win32.DBG_CONTINUE bCallHandler = False while running: try: running.pop().hit(event) except Exception: e = sys.exc_info()[1] warnings.warn(str(e), BreakpointWarning) # Handle hardware breakpoints. if tid in self.__hardwareBP: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) Dr6 = ctx['Dr6'] ctx['Dr6'] = Dr6 & DebugRegister.clearHitMask aThread.set_context(ctx) bFoundBreakpoint = False bCondition = False hwbpList = [ bp for bp in self.__hardwareBP[tid] ] for bp in hwbpList: if not bp in self.__hardwareBP[tid]: continue # it was removed by a user-defined callback slot = bp.get_slot() if (slot is not None) and \ (Dr6 & DebugRegister.hitMask[slot]): if not bFoundBreakpoint: #set before actions are called if not bFakeSingleStep: event.continueStatus = win32.DBG_CONTINUE bFoundBreakpoint = True bIsOurs = True bp.hit(event) if bp.is_running(): self.__add_running_bp(tid, bp) bThisCondition = bp.eval_condition(event) if bThisCondition and bp.is_automatic(): bp.run_action(event) bThisCondition = False bCondition = bCondition or bThisCondition if bFoundBreakpoint: bCallHandler = bCondition # Always call the user-defined handler # when the thread is in tracing mode. if self.is_tracing(tid): bCallHandler = True # If we're not in hostile mode, by default we assume all single # step exceptions are caused by the debugger. if not bIsOurs and not self.in_hostile_mode(): aThread.clear_tf() # If the user hit Control-C while we were inside the try block, # set the default continueStatus back. except: event.continueStatus = old_continueStatus raise return bCallHandler def _notify_load_dll(self, event): """ Notify the loading of a DLL. @type event: L{LoadDLLEvent} @param event: Load DLL event. @rtype: bool @return: C{True} to call the user-defined handler, C{False} otherwise. """ self.__set_deferred_breakpoints(event) return True def _notify_unload_dll(self, event): """ Notify the unloading of a DLL. @type event: L{UnloadDLLEvent} @param event: Unload DLL event. @rtype: bool @return: C{True} to call the user-defined handler, C{False} otherwise. """ self.__cleanup_module(event) return True def _notify_exit_thread(self, event): """ Notify the termination of a thread. @type event: L{ExitThreadEvent} @param event: Exit thread event. @rtype: bool @return: C{True} to call the user-defined handler, C{False} otherwise. """ self.__cleanup_thread(event) return True def _notify_exit_process(self, event): """ Notify the termination of a process. @type event: L{ExitProcessEvent} @param event: Exit process event. @rtype: bool @return: C{True} to call the user-defined handler, C{False} otherwise. """ self.__cleanup_process(event) self.__cleanup_thread(event) return True #------------------------------------------------------------------------------ # This is the high level breakpoint interface. Here we don't have to care # about defining or enabling breakpoints, and many errors are ignored # (like for example setting the same breakpoint twice, here the second # breakpoint replaces the first, much like in WinDBG). It should be easier # and more intuitive, if less detailed. It also allows the use of deferred # breakpoints. #------------------------------------------------------------------------------ # Code breakpoints def __set_break(self, pid, address, action, oneshot): """ Used by L{break_at} and L{stalk_at}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @type oneshot: bool @param oneshot: C{True} for one-shot breakpoints, C{False} otherwise. @rtype: L{Breakpoint} @return: Returns the new L{Breakpoint} object, or C{None} if the label couldn't be resolved and the breakpoint was deferred. Deferred breakpoints are set when the DLL they point to is loaded. """ if type(address) not in (int, long): label = address try: address = self.system.get_process(pid).resolve_label(address) if not address: raise Exception() except Exception: try: deferred = self.__deferredBP[pid] except KeyError: deferred = dict() self.__deferredBP[pid] = deferred if label in deferred: msg = "Redefined deferred code breakpoint at %s in process ID %d" msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning) deferred[label] = (action, oneshot) return None if self.has_code_breakpoint(pid, address): bp = self.get_code_breakpoint(pid, address) if bp.get_action() != action: # can't use "is not", fails for bound methods bp.set_action(action) msg = "Redefined code breakpoint at %s in process ID %d" msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning) else: self.define_code_breakpoint(pid, address, True, action) bp = self.get_code_breakpoint(pid, address) if oneshot: if not bp.is_one_shot(): self.enable_one_shot_code_breakpoint(pid, address) else: if not bp.is_enabled(): self.enable_code_breakpoint(pid, address) return bp def __clear_break(self, pid, address): """ Used by L{dont_break_at} and L{dont_stalk_at}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. """ if type(address) not in (int, long): unknown = True label = address try: deferred = self.__deferredBP[pid] del deferred[label] unknown = False except KeyError: ## traceback.print_last() # XXX DEBUG pass aProcess = self.system.get_process(pid) try: address = aProcess.resolve_label(label) if not address: raise Exception() except Exception: ## traceback.print_last() # XXX DEBUG if unknown: msg = ("Can't clear unknown code breakpoint" " at %s in process ID %d") msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning) return if self.has_code_breakpoint(pid, address): self.erase_code_breakpoint(pid, address) def __set_deferred_breakpoints(self, event): """ Used internally. Sets all deferred breakpoints for a DLL when it's loaded. @type event: L{LoadDLLEvent} @param event: Load DLL event. """ pid = event.get_pid() try: deferred = self.__deferredBP[pid] except KeyError: return aProcess = event.get_process() for (label, (action, oneshot)) in deferred.items(): try: address = aProcess.resolve_label(label) except Exception: continue del deferred[label] try: self.__set_break(pid, address, action, oneshot) except Exception: msg = "Can't set deferred breakpoint %s at process ID %d" msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning) def get_all_deferred_code_breakpoints(self): """ Returns a list of deferred code breakpoints. @rtype: tuple of (int, str, callable, bool) @return: Tuple containing the following elements: - Process ID where to set the breakpoint. - Label pointing to the address where to set the breakpoint. - Action callback for the breakpoint. - C{True} of the breakpoint is one-shot, C{False} otherwise. """ result = [] for pid, deferred in compat.iteritems(self.__deferredBP): for (label, (action, oneshot)) in compat.iteritems(deferred): result.add( (pid, label, action, oneshot) ) return result def get_process_deferred_code_breakpoints(self, dwProcessId): """ Returns a list of deferred code breakpoints. @type dwProcessId: int @param dwProcessId: Process ID. @rtype: tuple of (int, str, callable, bool) @return: Tuple containing the following elements: - Label pointing to the address where to set the breakpoint. - Action callback for the breakpoint. - C{True} of the breakpoint is one-shot, C{False} otherwise. """ return [ (label, action, oneshot) for (label, (action, oneshot)) in compat.iteritems(self.__deferredBP.get(dwProcessId, {})) ] def stalk_at(self, pid, address, action = None): """ Sets a one shot code breakpoint at the given process and address. If instead of an address you pass a label, the breakpoint may be deferred until the DLL it points to is loaded. @see: L{break_at}, L{dont_stalk_at} @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred. """ bp = self.__set_break(pid, address, action, oneshot = True) return bp is not None def break_at(self, pid, address, action = None): """ Sets a code breakpoint at the given process and address. If instead of an address you pass a label, the breakpoint may be deferred until the DLL it points to is loaded. @see: L{stalk_at}, L{dont_break_at} @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred. """ bp = self.__set_break(pid, address, action, oneshot = False) return bp is not None def dont_break_at(self, pid, address): """ Clears a code breakpoint set by L{break_at}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. """ self.__clear_break(pid, address) def dont_stalk_at(self, pid, address): """ Clears a code breakpoint set by L{stalk_at}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. """ self.__clear_break(pid, address) #------------------------------------------------------------------------------ # Function hooks def hook_function(self, pid, address, preCB = None, postCB = None, paramCount = None, signature = None): """ Sets a function hook at the given address. If instead of an address you pass a label, the hook may be deferred until the DLL it points to is loaded. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @rtype: bool @return: C{True} if the hook was set immediately, or C{False} if it was deferred. """ try: aProcess = self.system.get_process(pid) except KeyError: aProcess = Process(pid) arch = aProcess.get_arch() hookObj = Hook(preCB, postCB, paramCount, signature, arch) bp = self.break_at(pid, address, hookObj) return bp is not None def stalk_function(self, pid, address, preCB = None, postCB = None, paramCount = None, signature = None): """ Sets a one-shot function hook at the given address. If instead of an address you pass a label, the hook may be deferred until the DLL it points to is loaded. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred. """ try: aProcess = self.system.get_process(pid) except KeyError: aProcess = Process(pid) arch = aProcess.get_arch() hookObj = Hook(preCB, postCB, paramCount, signature, arch) bp = self.stalk_at(pid, address, hookObj) return bp is not None def dont_hook_function(self, pid, address): """ Removes a function hook set by L{hook_function}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. """ self.dont_break_at(pid, address) # alias unhook_function = dont_hook_function def dont_stalk_function(self, pid, address): """ Removes a function hook set by L{stalk_function}. @type pid: int @param pid: Process global ID. @type address: int or str @param address: Memory address of code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. """ self.dont_stalk_at(pid, address) #------------------------------------------------------------------------------ # Variable watches def __set_variable_watch(self, tid, address, size, action): """ Used by L{watch_variable} and L{stalk_variable}. @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to watch. @type size: int @param size: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. @rtype: L{HardwareBreakpoint} @return: Hardware breakpoint at the requested address. """ # TODO # We should merge the breakpoints instead of overwriting them. # We'll have the same problem as watch_buffer and we'll need to change # the API again. if size == 1: sizeFlag = self.BP_WATCH_BYTE elif size == 2: sizeFlag = self.BP_WATCH_WORD elif size == 4: sizeFlag = self.BP_WATCH_DWORD elif size == 8: sizeFlag = self.BP_WATCH_QWORD else: raise ValueError("Bad size for variable watch: %r" % size) if self.has_hardware_breakpoint(tid, address): warnings.warn( "Hardware breakpoint in thread %d at address %s was overwritten!" \ % (tid, HexDump.address(address, self.system.get_thread(tid).get_bits())), BreakpointWarning) bp = self.get_hardware_breakpoint(tid, address) if bp.get_trigger() != self.BP_BREAK_ON_ACCESS or \ bp.get_watch() != sizeFlag: self.erase_hardware_breakpoint(tid, address) self.define_hardware_breakpoint(tid, address, self.BP_BREAK_ON_ACCESS, sizeFlag, True, action) bp = self.get_hardware_breakpoint(tid, address) else: self.define_hardware_breakpoint(tid, address, self.BP_BREAK_ON_ACCESS, sizeFlag, True, action) bp = self.get_hardware_breakpoint(tid, address) return bp def __clear_variable_watch(self, tid, address): """ Used by L{dont_watch_variable} and L{dont_stalk_variable}. @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to stop watching. """ if self.has_hardware_breakpoint(tid, address): self.erase_hardware_breakpoint(tid, address) def watch_variable(self, tid, address, size, action = None): """ Sets a hardware breakpoint at the given thread, address and size. @see: L{dont_watch_variable} @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to watch. @type size: int @param size: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ bp = self.__set_variable_watch(tid, address, size, action) if not bp.is_enabled(): self.enable_hardware_breakpoint(tid, address) def stalk_variable(self, tid, address, size, action = None): """ Sets a one-shot hardware breakpoint at the given thread, address and size. @see: L{dont_watch_variable} @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to watch. @type size: int @param size: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ bp = self.__set_variable_watch(tid, address, size, action) if not bp.is_one_shot(): self.enable_one_shot_hardware_breakpoint(tid, address) def dont_watch_variable(self, tid, address): """ Clears a hardware breakpoint set by L{watch_variable}. @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to stop watching. """ self.__clear_variable_watch(tid, address) def dont_stalk_variable(self, tid, address): """ Clears a hardware breakpoint set by L{stalk_variable}. @type tid: int @param tid: Thread global ID. @type address: int @param address: Memory address of variable to stop watching. """ self.__clear_variable_watch(tid, address) #------------------------------------------------------------------------------ # Buffer watches def __set_buffer_watch(self, pid, address, size, action, bOneShot): """ Used by L{watch_buffer} and L{stalk_buffer}. @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @param size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @type bOneShot: bool @param bOneShot: C{True} to set a one-shot breakpoint, C{False} to set a normal breakpoint. """ # Check the size isn't zero or negative. if size < 1: raise ValueError("Bad size for buffer watch: %r" % size) # Create the buffer watch identifier. bw = BufferWatch(pid, address, address + size, action, bOneShot) # Get the base address and size in pages required for this buffer. base = MemoryAddresses.align_address_to_page_start(address) limit = MemoryAddresses.align_address_to_page_end(address + size) pages = MemoryAddresses.get_buffer_size_in_pages(address, size) try: # For each page: # + if a page breakpoint exists reuse it # + if it doesn't exist define it bset = set() # all breakpoints used nset = set() # newly defined breakpoints cset = set() # condition objects page_addr = base pageSize = MemoryAddresses.pageSize while page_addr < limit: # If a breakpoints exists, reuse it. if self.has_page_breakpoint(pid, page_addr): bp = self.get_page_breakpoint(pid, page_addr) if bp not in bset: condition = bp.get_condition() if not condition in cset: if not isinstance(condition,_BufferWatchCondition): # this shouldn't happen unless you tinkered # with it or defined your own page breakpoints # manually. msg = "Can't watch buffer at page %s" msg = msg % HexDump.address(page_addr) raise RuntimeError(msg) cset.add(condition) bset.add(bp) # If it doesn't, define it. else: condition = _BufferWatchCondition() bp = self.define_page_breakpoint(pid, page_addr, 1, condition = condition) bset.add(bp) nset.add(bp) cset.add(condition) # Next page. page_addr = page_addr + pageSize # For each breakpoint, enable it if needed. aProcess = self.system.get_process(pid) for bp in bset: if bp.is_disabled() or bp.is_one_shot(): bp.enable(aProcess, None) # On error... except: # Erase the newly defined breakpoints. for bp in nset: try: self.erase_page_breakpoint(pid, bp.get_address()) except: pass # Pass the exception to the caller raise # For each condition object, add the new buffer. for condition in cset: condition.add(bw) def __clear_buffer_watch_old_method(self, pid, address, size): """ Used by L{dont_watch_buffer} and L{dont_stalk_buffer}. @warn: Deprecated since WinAppDbg 1.5. @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to stop watching. @type size: int @param size: Size in bytes of buffer to stop watching. """ warnings.warn("Deprecated since WinAppDbg 1.5", DeprecationWarning) # Check the size isn't zero or negative. if size < 1: raise ValueError("Bad size for buffer watch: %r" % size) # Get the base address and size in pages required for this buffer. base = MemoryAddresses.align_address_to_page_start(address) limit = MemoryAddresses.align_address_to_page_end(address + size) pages = MemoryAddresses.get_buffer_size_in_pages(address, size) # For each page, get the breakpoint and it's condition object. # For each condition, remove the buffer. # For each breakpoint, if no buffers are on watch, erase it. cset = set() # condition objects page_addr = base pageSize = MemoryAddresses.pageSize while page_addr < limit: if self.has_page_breakpoint(pid, page_addr): bp = self.get_page_breakpoint(pid, page_addr) condition = bp.get_condition() if condition not in cset: if not isinstance(condition, _BufferWatchCondition): # this shouldn't happen unless you tinkered with it # or defined your own page breakpoints manually. continue cset.add(condition) condition.remove_last_match(address, size) if condition.count() == 0: try: self.erase_page_breakpoint(pid, bp.get_address()) except WindowsError: pass page_addr = page_addr + pageSize def __clear_buffer_watch(self, bw): """ Used by L{dont_watch_buffer} and L{dont_stalk_buffer}. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. """ # Get the PID and the start and end addresses of the buffer. pid = bw.pid start = bw.start end = bw.end # Get the base address and size in pages required for the buffer. base = MemoryAddresses.align_address_to_page_start(start) limit = MemoryAddresses.align_address_to_page_end(end) pages = MemoryAddresses.get_buffer_size_in_pages(start, end - start) # For each page, get the breakpoint and it's condition object. # For each condition, remove the buffer. # For each breakpoint, if no buffers are on watch, erase it. cset = set() # condition objects page_addr = base pageSize = MemoryAddresses.pageSize while page_addr < limit: if self.has_page_breakpoint(pid, page_addr): bp = self.get_page_breakpoint(pid, page_addr) condition = bp.get_condition() if condition not in cset: if not isinstance(condition, _BufferWatchCondition): # this shouldn't happen unless you tinkered with it # or defined your own page breakpoints manually. continue cset.add(condition) condition.remove(bw) if condition.count() == 0: try: self.erase_page_breakpoint(pid, bp.get_address()) except WindowsError: msg = "Cannot remove page breakpoint at address %s" msg = msg % HexDump.address( bp.get_address() ) warnings.warn(msg, BreakpointWarning) page_addr = page_addr + pageSize def watch_buffer(self, pid, address, size, action = None): """ Sets a page breakpoint and notifies when the given buffer is accessed. @see: L{dont_watch_variable} @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @param size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, False) def stalk_buffer(self, pid, address, size, action = None): """ Sets a one-shot page breakpoint and notifies when the given buffer is accessed. @see: L{dont_watch_variable} @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @param size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, True) def dont_watch_buffer(self, bw, *argv, **argd): """ Clears a page breakpoint set by L{watch_buffer}. @type bw: L{BufferWatch} @param bw: Buffer watch identifier returned by L{watch_buffer}. """ # The sane way to do it. if not (argv or argd): self.__clear_buffer_watch(bw) # Backwards compatibility with WinAppDbg 1.4. else: argv = list(argv) argv.insert(0, bw) if 'pid' in argd: argv.insert(0, argd.pop('pid')) if 'address' in argd: argv.insert(1, argd.pop('address')) if 'size' in argd: argv.insert(2, argd.pop('size')) if argd: raise TypeError("Wrong arguments for dont_watch_buffer()") try: pid, address, size = argv except ValueError: raise TypeError("Wrong arguments for dont_watch_buffer()") self.__clear_buffer_watch_old_method(pid, address, size) def dont_stalk_buffer(self, bw, *argv, **argd): """ Clears a page breakpoint set by L{stalk_buffer}. @type bw: L{BufferWatch} @param bw: Buffer watch identifier returned by L{stalk_buffer}. """ self.dont_watch_buffer(bw, *argv, **argd) #------------------------------------------------------------------------------ # Tracing # XXX TODO # Add "action" parameter to tracing mode def __start_tracing(self, thread): """ @type thread: L{Thread} @param thread: Thread to start tracing. """ tid = thread.get_tid() if not tid in self.__tracing: thread.set_tf() self.__tracing.add(tid) def __stop_tracing(self, thread): """ @type thread: L{Thread} @param thread: Thread to stop tracing. """ tid = thread.get_tid() if tid in self.__tracing: self.__tracing.remove(tid) if thread.is_alive(): thread.clear_tf() def is_tracing(self, tid): """ @type tid: int @param tid: Thread global ID. @rtype: bool @return: C{True} if the thread is being traced, C{False} otherwise. """ return tid in self.__tracing def get_traced_tids(self): """ Retrieves the list of global IDs of all threads being traced. @rtype: list( int... ) @return: List of thread global IDs. """ tids = list(self.__tracing) tids.sort() return tids def start_tracing(self, tid): """ Start tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to start tracing. """ if not self.is_tracing(tid): thread = self.system.get_thread(tid) self.__start_tracing(thread) def stop_tracing(self, tid): """ Stop tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to stop tracing. """ if self.is_tracing(tid): thread = self.system.get_thread(tid) self.__stop_tracing(thread) def start_tracing_process(self, pid): """ Start tracing mode for all threads in the given process. @type pid: int @param pid: Global ID of process to start tracing. """ for thread in self.system.get_process(pid).iter_threads(): self.__start_tracing(thread) def stop_tracing_process(self, pid): """ Stop tracing mode for all threads in the given process. @type pid: int @param pid: Global ID of process to stop tracing. """ for thread in self.system.get_process(pid).iter_threads(): self.__stop_tracing(thread) def start_tracing_all(self): """ Start tracing mode for all threads in all debugees. """ for pid in self.get_debugee_pids(): self.start_tracing_process(pid) def stop_tracing_all(self): """ Stop tracing mode for all threads in all debugees. """ for pid in self.get_debugee_pids(): self.stop_tracing_process(pid) #------------------------------------------------------------------------------ # Break on LastError values (only available since Windows Server 2003) def break_on_error(self, pid, errorCode): """ Sets or clears the system breakpoint for a given Win32 error code. Use L{Process.is_system_defined_breakpoint} to tell if a breakpoint exception was caused by a system breakpoint or by the application itself (for example because of a failed assertion in the code). @note: This functionality is only available since Windows Server 2003. In 2003 it only breaks on error values set externally to the kernel32.dll library, but this was fixed in Windows Vista. @warn: This method will fail if the debug symbols for ntdll (kernel32 in Windows 2003) are not present. For more information see: L{System.fix_symbol_store_path}. @see: U{http://www.nynaeve.net/?p=147} @type pid: int @param pid: Process ID. @type errorCode: int @param errorCode: Win32 error code to stop on. Set to C{0} or C{ERROR_SUCCESS} to clear the breakpoint instead. @raise NotImplementedError: The functionality is not supported in this system. @raise WindowsError: An error occurred while processing this request. """ aProcess = self.system.get_process(pid) address = aProcess.get_break_on_error_ptr() if not address: raise NotImplementedError( "The functionality is not supported in this system.") aProcess.write_dword(address, errorCode) def dont_break_on_error(self, pid): """ Alias to L{break_on_error}C{(pid, ERROR_SUCCESS)}. @type pid: int @param pid: Process ID. @raise NotImplementedError: The functionality is not supported in this system. @raise WindowsError: An error occurred while processing this request. """ self.break_on_error(pid, 0) #------------------------------------------------------------------------------ # Simplified symbol resolving, useful for hooking functions def resolve_exported_function(self, pid, modName, procName): """ Resolves the exported DLL function for the given process. @type pid: int @param pid: Process global ID. @type modName: str @param modName: Name of the module that exports the function. @type procName: str @param procName: Name of the exported function to resolve. @rtype: int, None @return: On success, the address of the exported function. On failure, returns C{None}. """ aProcess = self.system.get_process(pid) aModule = aProcess.get_module_by_name(modName) if not aModule: aProcess.scan_modules() aModule = aProcess.get_module_by_name(modName) if aModule: address = aModule.resolve(procName) return address return None def resolve_label(self, pid, label): """ Resolves a label for the given process. @type pid: int @param pid: Process global ID. @type label: str @param label: Label to resolve. @rtype: int @return: Memory address pointed to by the label. @raise ValueError: The label is malformed or impossible to resolve. @raise RuntimeError: Cannot resolve the module or function. """ return self.get_process(pid).resolve_label(label)
apache-2.0
[ 3168, 94, 8083, 87, 1132, 15, 9541, 63, 67, 15, 4718, 821, 15, 1548, 14, 5803, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 334, 67, 9, 8937, 13, 7280, 12, 603, 6936, 812, 382, 305, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 4245, 12, 199, 3, 755, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 755, 4245, 12, 3749, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 755, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 314, 4248, 16712, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 755, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 298, 1179, 2281, 2, 199, 3, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 199, 3, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 199, 3, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 11489, 1549, 6483, 6262, 199, 3, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 199, 3, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 199, 3, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 199, 3, 7066, 12, 9644, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 199, 3, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 199, 3, 9726, 1634, 9712, 9784, 14, 199, 199, 624, 199, 13948, 3438, 14, 199, 199, 32, 923, 22535, 3438, 26, 272, 22535, 1403, 12, 5495, 28944, 12, 10331, 28944, 12, 22825, 1068, 28944, 12, 272, 26661, 13978, 12, 24837, 12, 13986, 8481, 199, 199, 32, 923, 644, 2627, 26, 272, 22535, 1403, 3849, 12, 22535, 1403, 2806, 3849, 199, 624, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 363, 452, 363, 275, 359, 339, 327, 3523, 1021, 367, 28906, 272, 283, 28944, 297, 339, 327, 22535, 1403, 12591, 272, 283, 3034, 28944, 297, 272, 283, 3276, 28944, 297, 272, 283, 23219, 28944, 297, 339, 327, 24837, 83, 436, 9626, 397, 272, 283, 8481, 297, 272, 283, 7394, 8481, 297, 272, 283, 3299, 13978, 297, 339, 327, 644, 2627, 272, 283, 28944, 3849, 297, 272, 283, 28944, 2806, 3849, 297, 339, 1622, 199, 199, 504, 4747, 571, 16310, 492, 4747, 708, 199, 504, 4747, 571, 16310, 492, 8434, 199, 646, 984, 199, 504, 4747, 571, 16310, 14, 1412, 492, 7132, 12, 11086, 199, 504, 4747, 571, 16310, 14, 1974, 492, 14245, 7099, 12, 15825, 20826, 199, 504, 4747, 571, 16310, 14, 3858, 4538, 492, 28333, 11772, 199, 199, 646, 5577, 199, 646, 3598, 199, 646, 5190, 199, 199, 31436, 199, 199, 533, 22535, 1403, 3849, 334, 32114, 304, 272, 408, 272, 961, 5721, 365, 21117, 1380, 282, 2222, 13, 16208, 1125, 11058, 626, 1159, 4048, 370, 272, 28906, 14, 272, 408, 199, 199, 533, 22535, 1403, 2806, 3849, 334, 14357, 3849, 304, 272, 408, 272, 961, 5721, 365, 21117, 1380, 376, 625, 24872, 1919, 1990, 4915, 701, 282, 272, 17944, 1159, 922, 13, 4037, 3233, 14, 272, 408, 199, 199, 31436, 199, 199, 533, 22535, 1403, 334, 785, 304, 272, 408, 272, 3523, 1021, 367, 28906, 14, 272, 11842, 1159, 314, 28906, 1174, 6844, 14, 339, 768, 3239, 26, 491, 91, 3034, 28944, 1386, 491, 91, 3276, 28944, 1386, 491, 91, 23219, 28944, 93, 339, 768, 923, 22535, 1403, 6363, 26, 267, 32147, 36, 12, 27926, 36, 12, 5258, 654, 40, 1387, 12, 21277, 6024, 272, 768, 923, 8511, 6844, 26, 267, 9793, 12, 3507, 12, 4756, 12, 1373, 63, 2782, 12, 3879, 12, 267, 365, 63, 7011, 12, 365, 63, 3827, 12, 365, 63, 368, 63, 2782, 12, 365, 63, 5720, 12, 267, 664, 63, 929, 12, 664, 63, 929, 63, 354, 272, 768, 923, 17064, 26, 267, 664, 63, 1562, 12, 664, 63, 890, 12, 664, 63, 3751, 12, 365, 63, 1681, 272, 768, 923, 24191, 28906, 26, 267, 365, 63, 14353, 12, 365, 63, 324, 14353, 12, 267, 664, 63, 5394, 12, 663, 63, 5394, 12, 3468, 63, 5394, 272, 768, 923, 9195, 3889, 28906, 26, 267, 365, 63, 23292, 12, 365, 63, 13543, 12, 267, 664, 63, 1287, 12, 663, 63, 1287, 12, 1255, 63, 1287, 339, 768, 26781, 32147, 36, 26, 473, 91, 15049, 93, 428, 91, 5118, 93, 3447, 1909, 12, 7309, 2662, 357, 272, 768, 26781, 27926, 36, 26, 221, 473, 91, 6589, 93, 221, 428, 91, 5118, 93, 473, 91, 9602, 1386, 5289, 1909, 272, 768, 26781, 5258, 654, 40, 1387, 26, 221, 473, 91, 4395, 2662, 357, 93, 221, 428, 91, 5118, 93, 473, 91, 15049, 93, 272, 768, 26781, 21277, 6024, 26, 221, 473, 91, 9602, 93, 221, 428, 91, 5118, 93, 473, 91, 6589, 1386, 5289, 1909, 339, 768, 466, 32147, 36, 26, 1109, 272, 768, 466, 27926, 36, 26, 221, 1109, 272, 768, 466, 5258, 654, 40, 1387, 26, 221, 1109, 272, 768, 466, 21277, 6024, 26, 221, 1109, 339, 768, 466, 1174, 5866, 26, 1211, 662, 91, 6374, 93, 1109, 428, 91, 5118, 93, 620, 662, 91, 4848, 93, 272, 768, 26781, 1174, 5866, 26, 2876, 13, 17317, 1561, 367, 1924, 17944, 1174, 14, 339, 768, 466, 730, 985, 26, 620, 272, 768, 26781, 730, 985, 26, 2876, 21428, 17944, 730, 1059, 14, 272, 408, 339, 327, 473, 2793, 1133, 13516, 19077, 3447, 1909, 665, 5118, 7309, 2662, 357, 1077, 506, 4370, 1396, 12254, 272, 327, 221, 652, 3955, 4409 ]
[ 94, 8083, 87, 1132, 15, 9541, 63, 67, 15, 4718, 821, 15, 1548, 14, 5803, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 334, 67, 9, 8937, 13, 7280, 12, 603, 6936, 812, 382, 305, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 4245, 12, 199, 3, 755, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 755, 4245, 12, 3749, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 755, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 314, 4248, 16712, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 755, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 298, 1179, 2281, 2, 199, 3, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 199, 3, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 199, 3, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 11489, 1549, 6483, 6262, 199, 3, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 199, 3, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 199, 3, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 199, 3, 7066, 12, 9644, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 199, 3, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 199, 3, 9726, 1634, 9712, 9784, 14, 199, 199, 624, 199, 13948, 3438, 14, 199, 199, 32, 923, 22535, 3438, 26, 272, 22535, 1403, 12, 5495, 28944, 12, 10331, 28944, 12, 22825, 1068, 28944, 12, 272, 26661, 13978, 12, 24837, 12, 13986, 8481, 199, 199, 32, 923, 644, 2627, 26, 272, 22535, 1403, 3849, 12, 22535, 1403, 2806, 3849, 199, 624, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 363, 452, 363, 275, 359, 339, 327, 3523, 1021, 367, 28906, 272, 283, 28944, 297, 339, 327, 22535, 1403, 12591, 272, 283, 3034, 28944, 297, 272, 283, 3276, 28944, 297, 272, 283, 23219, 28944, 297, 339, 327, 24837, 83, 436, 9626, 397, 272, 283, 8481, 297, 272, 283, 7394, 8481, 297, 272, 283, 3299, 13978, 297, 339, 327, 644, 2627, 272, 283, 28944, 3849, 297, 272, 283, 28944, 2806, 3849, 297, 339, 1622, 199, 199, 504, 4747, 571, 16310, 492, 4747, 708, 199, 504, 4747, 571, 16310, 492, 8434, 199, 646, 984, 199, 504, 4747, 571, 16310, 14, 1412, 492, 7132, 12, 11086, 199, 504, 4747, 571, 16310, 14, 1974, 492, 14245, 7099, 12, 15825, 20826, 199, 504, 4747, 571, 16310, 14, 3858, 4538, 492, 28333, 11772, 199, 199, 646, 5577, 199, 646, 3598, 199, 646, 5190, 199, 199, 31436, 199, 199, 533, 22535, 1403, 3849, 334, 32114, 304, 272, 408, 272, 961, 5721, 365, 21117, 1380, 282, 2222, 13, 16208, 1125, 11058, 626, 1159, 4048, 370, 272, 28906, 14, 272, 408, 199, 199, 533, 22535, 1403, 2806, 3849, 334, 14357, 3849, 304, 272, 408, 272, 961, 5721, 365, 21117, 1380, 376, 625, 24872, 1919, 1990, 4915, 701, 282, 272, 17944, 1159, 922, 13, 4037, 3233, 14, 272, 408, 199, 199, 31436, 199, 199, 533, 22535, 1403, 334, 785, 304, 272, 408, 272, 3523, 1021, 367, 28906, 14, 272, 11842, 1159, 314, 28906, 1174, 6844, 14, 339, 768, 3239, 26, 491, 91, 3034, 28944, 1386, 491, 91, 3276, 28944, 1386, 491, 91, 23219, 28944, 93, 339, 768, 923, 22535, 1403, 6363, 26, 267, 32147, 36, 12, 27926, 36, 12, 5258, 654, 40, 1387, 12, 21277, 6024, 272, 768, 923, 8511, 6844, 26, 267, 9793, 12, 3507, 12, 4756, 12, 1373, 63, 2782, 12, 3879, 12, 267, 365, 63, 7011, 12, 365, 63, 3827, 12, 365, 63, 368, 63, 2782, 12, 365, 63, 5720, 12, 267, 664, 63, 929, 12, 664, 63, 929, 63, 354, 272, 768, 923, 17064, 26, 267, 664, 63, 1562, 12, 664, 63, 890, 12, 664, 63, 3751, 12, 365, 63, 1681, 272, 768, 923, 24191, 28906, 26, 267, 365, 63, 14353, 12, 365, 63, 324, 14353, 12, 267, 664, 63, 5394, 12, 663, 63, 5394, 12, 3468, 63, 5394, 272, 768, 923, 9195, 3889, 28906, 26, 267, 365, 63, 23292, 12, 365, 63, 13543, 12, 267, 664, 63, 1287, 12, 663, 63, 1287, 12, 1255, 63, 1287, 339, 768, 26781, 32147, 36, 26, 473, 91, 15049, 93, 428, 91, 5118, 93, 3447, 1909, 12, 7309, 2662, 357, 272, 768, 26781, 27926, 36, 26, 221, 473, 91, 6589, 93, 221, 428, 91, 5118, 93, 473, 91, 9602, 1386, 5289, 1909, 272, 768, 26781, 5258, 654, 40, 1387, 26, 221, 473, 91, 4395, 2662, 357, 93, 221, 428, 91, 5118, 93, 473, 91, 15049, 93, 272, 768, 26781, 21277, 6024, 26, 221, 473, 91, 9602, 93, 221, 428, 91, 5118, 93, 473, 91, 6589, 1386, 5289, 1909, 339, 768, 466, 32147, 36, 26, 1109, 272, 768, 466, 27926, 36, 26, 221, 1109, 272, 768, 466, 5258, 654, 40, 1387, 26, 221, 1109, 272, 768, 466, 21277, 6024, 26, 221, 1109, 339, 768, 466, 1174, 5866, 26, 1211, 662, 91, 6374, 93, 1109, 428, 91, 5118, 93, 620, 662, 91, 4848, 93, 272, 768, 26781, 1174, 5866, 26, 2876, 13, 17317, 1561, 367, 1924, 17944, 1174, 14, 339, 768, 466, 730, 985, 26, 620, 272, 768, 26781, 730, 985, 26, 2876, 21428, 17944, 730, 1059, 14, 272, 408, 339, 327, 473, 2793, 1133, 13516, 19077, 3447, 1909, 665, 5118, 7309, 2662, 357, 1077, 506,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
bcarr092/CSignal
test/test_driver.py
1
1372
#!/usr/local/bin/python import csignal_tests import unittest import sys from test_csignal import TestsCSignal from test_bit_packer import TestsBitPacker from test_bit_stream import TestsBitStream from test_conv import TestsConv from test_signal_operations import TestsSignalOperations csignal_tests.cpc_log_set_log_level( csignal_tests.CPC_LOG_LEVEL_NO_LOGGING ) csignal_tests.csignal_initialize() alltests = unittest.TestSuite ( [ \ unittest.TestLoader().loadTestsFromTestCase( TestsCSignal ), \ unittest.TestLoader().loadTestsFromTestCase( TestsBitPacker ), \ unittest.TestLoader().loadTestsFromTestCase( TestsBitStream ), \ unittest.TestLoader().loadTestsFromTestCase( TestsConv ), \ unittest.TestLoader().loadTestsFromTestCase( TestsSignalOperations), \ ] ) result = unittest.TextTestRunner( verbosity=2 ).run( alltests ) csignal_tests.csignal_terminate() if( len( result.errors ) == 0 and len( result.failures ) == 0 ): sys.exit( 0 ) else: sys.exit( -1 )
apache-2.0
[ 3381, 2647, 15, 1832, 15, 1393, 15, 1548, 199, 199, 646, 286, 4653, 63, 2219, 2476, 17388, 199, 646, 2882, 6208, 221, 199, 646, 984, 12268, 199, 504, 511, 63, 67, 4653, 492, 6496, 3298, 1030, 279, 199, 504, 511, 63, 2075, 63, 1389, 281, 492, 6496, 4734, 2305, 281, 199, 504, 511, 63, 2075, 63, 1745, 492, 6496, 4734, 3296, 199, 504, 511, 63, 5598, 492, 6496, 11596, 199, 504, 511, 63, 4653, 63, 8170, 492, 6496, 11274, 12929, 199, 199, 67, 4653, 63, 2219, 14, 1850, 67, 63, 793, 63, 409, 63, 793, 63, 1896, 8, 286, 4653, 63, 2219, 14, 2890, 35, 63, 4947, 63, 11817, 63, 2826, 63, 27896, 776, 199, 199, 67, 4653, 63, 2219, 14, 67, 4653, 63, 8489, 342, 199, 199, 452, 2219, 275, 2882, 14, 10591, 334, 359, 2476, 7861, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 3298, 1030, 279, 2318, 9668, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 4734, 2305, 281, 2318, 9326, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 4734, 3296, 2318, 9326, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 11596, 2318, 14516, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 11274, 12929, 395, 5185, 971, 28134, 1622, 776, 199, 199, 1099, 275, 2882, 14, 24285, 8, 8661, 29, 18, 7092, 1065, 8, 1006, 2219, 776, 199, 199, 67, 4653, 63, 2219, 14, 67, 4653, 63, 14478, 342, 199, 199, 692, 8, 822, 8, 754, 14, 2550, 776, 508, 378, 436, 822, 8, 754, 14, 9968, 776, 508, 378, 3461, 272, 984, 14, 2224, 8, 378, 776, 199, 2836, 26, 272, 984, 14, 2224, 8, 446, 17, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1832, 15, 1393, 15, 1548, 199, 199, 646, 286, 4653, 63, 2219, 2476, 17388, 199, 646, 2882, 6208, 221, 199, 646, 984, 12268, 199, 504, 511, 63, 67, 4653, 492, 6496, 3298, 1030, 279, 199, 504, 511, 63, 2075, 63, 1389, 281, 492, 6496, 4734, 2305, 281, 199, 504, 511, 63, 2075, 63, 1745, 492, 6496, 4734, 3296, 199, 504, 511, 63, 5598, 492, 6496, 11596, 199, 504, 511, 63, 4653, 63, 8170, 492, 6496, 11274, 12929, 199, 199, 67, 4653, 63, 2219, 14, 1850, 67, 63, 793, 63, 409, 63, 793, 63, 1896, 8, 286, 4653, 63, 2219, 14, 2890, 35, 63, 4947, 63, 11817, 63, 2826, 63, 27896, 776, 199, 199, 67, 4653, 63, 2219, 14, 67, 4653, 63, 8489, 342, 199, 199, 452, 2219, 275, 2882, 14, 10591, 334, 359, 2476, 7861, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 3298, 1030, 279, 2318, 9668, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 4734, 2305, 281, 2318, 9326, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 4734, 3296, 2318, 9326, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 11596, 2318, 14516, 971, 199, 2882, 14, 15824, 1252, 26946, 8, 6496, 11274, 12929, 395, 5185, 971, 28134, 1622, 776, 199, 199, 1099, 275, 2882, 14, 24285, 8, 8661, 29, 18, 7092, 1065, 8, 1006, 2219, 776, 199, 199, 67, 4653, 63, 2219, 14, 67, 4653, 63, 14478, 342, 199, 199, 692, 8, 822, 8, 754, 14, 2550, 776, 508, 378, 436, 822, 8, 754, 14, 9968, 776, 508, 378, 3461, 272, 984, 14, 2224, 8, 378, 776, 199, 2836, 26, 272, 984, 14, 2224, 8, 446, 17, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
WebSpider/headphones
lib/yaml/nodes.py
985
1440
class Node(object): def __init__(self, tag, value, start_mark, end_mark): self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark def __repr__(self): value = self.value #if isinstance(value, list): # if len(value) == 0: # value = '<empty>' # elif len(value) == 1: # value = '<1 item>' # else: # value = '<%d items>' % len(value) #else: # if len(value) > 75: # value = repr(value[:70]+u' ... ') # else: # value = repr(value) value = repr(value) return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) class ScalarNode(Node): id = 'scalar' def __init__(self, tag, value, start_mark=None, end_mark=None, style=None): self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark self.style = style class CollectionNode(Node): def __init__(self, tag, value, start_mark=None, end_mark=None, flow_style=None): self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark self.flow_style = flow_style class SequenceNode(CollectionNode): id = 'sequence' class MappingNode(CollectionNode): id = 'mapping'
gpl-3.0
[ 199, 533, 5013, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 1343, 63, 1657, 12, 1284, 63, 1657, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 272, 347, 636, 2722, 721, 277, 304, 267, 574, 275, 291, 14, 585, 267, 327, 692, 1228, 8, 585, 12, 769, 304, 267, 327, 259, 340, 822, 8, 585, 9, 508, 378, 26, 267, 327, 263, 574, 275, 2650, 1667, 3524, 267, 327, 259, 916, 822, 8, 585, 9, 508, 413, 26, 267, 327, 263, 574, 275, 2650, 17, 1242, 3524, 267, 327, 259, 587, 26, 267, 327, 263, 574, 275, 18342, 68, 2974, 3524, 450, 822, 8, 585, 9, 267, 327, 2836, 26, 267, 327, 259, 340, 822, 8, 585, 9, 690, 13098, 26, 267, 327, 263, 574, 275, 4700, 8, 585, 1491, 2760, 2807, 85, 7, 2263, 5320, 267, 327, 259, 587, 26, 267, 327, 263, 574, 275, 4700, 8, 585, 9, 267, 574, 275, 4700, 8, 585, 9, 267, 372, 1543, 83, 8, 1450, 2458, 82, 12, 574, 2458, 83, 3171, 450, 334, 277, 855, 533, 4914, 354, 3108, 291, 14, 1450, 12, 574, 9, 199, 199, 533, 24289, 1716, 8, 1716, 304, 272, 1305, 275, 283, 7033, 7, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 288, 1343, 63, 1657, 29, 403, 12, 1284, 63, 1657, 29, 403, 12, 3449, 29, 403, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 267, 291, 14, 2487, 275, 3449, 199, 199, 533, 18003, 1716, 8, 1716, 304, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 288, 1343, 63, 1657, 29, 403, 12, 1284, 63, 1657, 29, 403, 12, 6369, 63, 2487, 29, 403, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 267, 291, 14, 1659, 63, 2487, 275, 6369, 63, 2487, 199, 199, 533, 10975, 1716, 8, 7768, 1716, 304, 272, 1305, 275, 283, 4041, 7, 199, 199, 533, 12340, 1716, 8, 7768, 1716, 304, 272, 1305, 275, 283, 4745, 7, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 533, 5013, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 1343, 63, 1657, 12, 1284, 63, 1657, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 272, 347, 636, 2722, 721, 277, 304, 267, 574, 275, 291, 14, 585, 267, 327, 692, 1228, 8, 585, 12, 769, 304, 267, 327, 259, 340, 822, 8, 585, 9, 508, 378, 26, 267, 327, 263, 574, 275, 2650, 1667, 3524, 267, 327, 259, 916, 822, 8, 585, 9, 508, 413, 26, 267, 327, 263, 574, 275, 2650, 17, 1242, 3524, 267, 327, 259, 587, 26, 267, 327, 263, 574, 275, 18342, 68, 2974, 3524, 450, 822, 8, 585, 9, 267, 327, 2836, 26, 267, 327, 259, 340, 822, 8, 585, 9, 690, 13098, 26, 267, 327, 263, 574, 275, 4700, 8, 585, 1491, 2760, 2807, 85, 7, 2263, 5320, 267, 327, 259, 587, 26, 267, 327, 263, 574, 275, 4700, 8, 585, 9, 267, 574, 275, 4700, 8, 585, 9, 267, 372, 1543, 83, 8, 1450, 2458, 82, 12, 574, 2458, 83, 3171, 450, 334, 277, 855, 533, 4914, 354, 3108, 291, 14, 1450, 12, 574, 9, 199, 199, 533, 24289, 1716, 8, 1716, 304, 272, 1305, 275, 283, 7033, 7, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 288, 1343, 63, 1657, 29, 403, 12, 1284, 63, 1657, 29, 403, 12, 3449, 29, 403, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 267, 291, 14, 2487, 275, 3449, 199, 199, 533, 18003, 1716, 8, 1716, 304, 272, 347, 636, 826, 721, 277, 12, 1947, 12, 574, 12, 288, 1343, 63, 1657, 29, 403, 12, 1284, 63, 1657, 29, 403, 12, 6369, 63, 2487, 29, 403, 304, 267, 291, 14, 1450, 275, 1947, 267, 291, 14, 585, 275, 574, 267, 291, 14, 928, 63, 1657, 275, 1343, 63, 1657, 267, 291, 14, 500, 63, 1657, 275, 1284, 63, 1657, 267, 291, 14, 1659, 63, 2487, 275, 6369, 63, 2487, 199, 199, 533, 10975, 1716, 8, 7768, 1716, 304, 272, 1305, 275, 283, 4041, 7, 199, 199, 533, 12340, 1716, 8, 7768, 1716, 304, 272, 1305, 275, 283, 4745, 7, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
xiaotdl/ansible
lib/ansible/plugins/inventory/script.py
147
1055
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. ############################################# # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible import constants as C from . import InventoryParser class InventoryScriptParser(InventoryParser): CONDITION="is_file(%s) and is_executable(%s)"
gpl-3.0
[ 3, 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 26634, 8776, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 747, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 1275, 492, 19337, 2842, 199, 199, 533, 19337, 5229, 2842, 8, 19304, 2842, 304, 339, 1868, 31247, 628, 374, 63, 493, 4042, 83, 9, 436, 365, 63, 5904, 4042, 83, 2924, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 26634, 8776, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 747, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 1275, 492, 19337, 2842, 199, 199, 533, 19337, 5229, 2842, 8, 19304, 2842, 304, 339, 1868, 31247, 628, 374, 63, 493, 4042, 83, 9, 436, 365, 63, 5904, 4042, 83, 2924, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Semi-global/edx-platform
lms/djangoapps/courseware/masquerade.py
113
10385
''' ---------------------------------------- Masquerade ---------------------------------------- Allow course staff to see a student or staff view of courseware. Which kind of view has been selected is stored in the session state. ''' import logging from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from django.views.decorators.http import require_POST from student.models import CourseEnrollment from util.json_request import expect_json, JsonResponse from opaque_keys.edx.keys import CourseKey from xblock.fragment import Fragment from xblock.runtime import KeyValueStore log = logging.getLogger(__name__) # The key used to store a user's course-level masquerade information in the Django session. # The value is a dict from course keys to CourseMasquerade objects. MASQUERADE_SETTINGS_KEY = 'masquerade_settings' # The key used to store temporary XBlock field data in the Django session. This is where field # data is stored to avoid modifying the state of the user we are masquerading as. MASQUERADE_DATA_KEY = 'masquerade_data' class CourseMasquerade(object): """ Masquerade settings for a particular course. """ def __init__(self, course_key, role='student', user_partition_id=None, group_id=None, user_name=None): # All parameters to this function must be named identically to the corresponding attribute. # If you remove or rename an attribute, also update the __setstate__() method to migrate # old data from users' sessions. self.course_key = course_key self.role = role self.user_partition_id = user_partition_id self.group_id = group_id self.user_name = user_name def __setstate__(self, state): """ Ensure that all attributes are initialised when unpickling CourseMasquerade objects. Users might still have CourseMasquerade objects from older versions of the code in their session. These old objects might not have all attributes set, possibly resulting in AttributeErrors. """ self.__init__(**state) @require_POST @login_required @expect_json def handle_ajax(request, course_key_string): """ Handle AJAX posts to update the current user's masquerade for the specified course. The masquerade settings are stored in the Django session as a dict from course keys to CourseMasquerade objects. """ course_key = CourseKey.from_string(course_key_string) masquerade_settings = request.session.get(MASQUERADE_SETTINGS_KEY, {}) request_json = request.json role = request_json.get('role', 'student') group_id = request_json.get('group_id', None) user_partition_id = request_json.get('user_partition_id', None) if group_id is not None else None user_name = request_json.get('user_name', None) if user_name: users_in_course = CourseEnrollment.objects.users_enrolled_in(course_key) try: if '@' in user_name: user_name = users_in_course.get(email=user_name).username else: users_in_course.get(username=user_name) except User.DoesNotExist: return JsonResponse({ 'success': False, 'error': _( 'There is no user with the username or email address {user_name} ' 'enrolled in this course.' ).format(user_name=user_name) }) masquerade_settings[course_key] = CourseMasquerade( course_key, role=role, user_partition_id=user_partition_id, group_id=group_id, user_name=user_name, ) request.session[MASQUERADE_SETTINGS_KEY] = masquerade_settings return JsonResponse({'success': True}) def setup_masquerade(request, course_key, staff_access=False, reset_masquerade_data=False): """ Sets up masquerading for the current user within the current request. The request's user is updated to have a 'masquerade_settings' attribute with the dict of all masqueraded settings if called from within a request context. The function then returns a pair (CourseMasquerade, User) with the masquerade settings for the specified course key or None if there isn't one, and the user we are masquerading as or request.user if masquerading as a specific user is not active. If the reset_masquerade_data flag is set, the field data stored in the session will be cleared. """ if ( request.user is None or not settings.FEATURES.get('ENABLE_MASQUERADE', False) or not staff_access ): return None, request.user if reset_masquerade_data: request.session.pop(MASQUERADE_DATA_KEY, None) masquerade_settings = request.session.setdefault(MASQUERADE_SETTINGS_KEY, {}) # Store the masquerade settings on the user so it can be accessed without the request request.user.masquerade_settings = masquerade_settings course_masquerade = masquerade_settings.get(course_key, None) masquerade_user = None if course_masquerade and course_masquerade.user_name: try: masquerade_user = CourseEnrollment.objects.users_enrolled_in(course_key).get( username=course_masquerade.user_name ) except User.DoesNotExist: # This can only happen if the user was unenrolled from the course since masquerading # was enabled. We silently reset the masquerading configuration in this case. course_masquerade = None del masquerade_settings[course_key] request.session.modified = True else: # Store the masquerading settings on the masquerade_user as well, since this user will # be used in some places instead of request.user. masquerade_user.masquerade_settings = request.user.masquerade_settings masquerade_user.real_user = request.user return course_masquerade, masquerade_user or request.user def get_course_masquerade(user, course_key): """ Returns the masquerade for the current user for the specified course. If no masquerade has been installed, then a default no-op masquerade is returned. """ masquerade_settings = getattr(user, 'masquerade_settings', {}) return masquerade_settings.get(course_key, None) def get_masquerade_role(user, course_key): """ Returns the role that the user is masquerading as, or None if no masquerade is in effect. """ course_masquerade = get_course_masquerade(user, course_key) return course_masquerade.role if course_masquerade else None def is_masquerading_as_student(user, course_key): """ Returns true if the user is a staff member masquerading as a student. """ return get_masquerade_role(user, course_key) == 'student' def is_masquerading_as_specific_student(user, course_key): # pylint: disable=invalid-name """ Returns whether the user is a staff member masquerading as a specific student. """ course_masquerade = get_course_masquerade(user, course_key) return bool(course_masquerade and course_masquerade.user_name) def get_masquerading_group_info(user, course_key): """ If the user is masquerading as belonging to a group, then this method returns two values: the id of the group, and the id of the user partition that the group belongs to. If the user is not masquerading as a group, then None is returned. """ course_masquerade = get_course_masquerade(user, course_key) if not course_masquerade: return None, None return course_masquerade.group_id, course_masquerade.user_partition_id # Sentinel object to mark deleted objects in the session cache _DELETED_SENTINEL = object() class MasqueradingKeyValueStore(KeyValueStore): """ A `KeyValueStore` to avoid affecting the user state when masquerading. This `KeyValueStore` wraps an underlying `KeyValueStore`. Reads are forwarded to the underlying store, but writes go to a Django session (or other dictionary-like object). """ def __init__(self, kvs, session): """ Arguments: kvs: The KeyValueStore to wrap. session: The Django session used to store temporary data in. """ self.kvs = kvs self.session = session self.session_data = session.setdefault(MASQUERADE_DATA_KEY, {}) def _serialize_key(self, key): """ Convert the key of Type KeyValueStore.Key to a string. Keys are not JSON-serializable, so we can't use them as keys for the Django session. The implementation is taken from cms/djangoapps/contentstore/views/session_kv_store.py. """ return repr(tuple(key)) def get(self, key): key_str = self._serialize_key(key) try: value = self.session_data[key_str] except KeyError: return self.kvs.get(key) else: if value is _DELETED_SENTINEL: raise KeyError(key_str) return value def set(self, key, value): self.session_data[self._serialize_key(key)] = value self.session.modified = True def delete(self, key): # We can't simply delete the key from the session, since it might still exist in the kvs, # which we are not allowed to modify, so we mark it as deleted by setting it to # _DELETED_SENTINEL in the session. self.set(key, _DELETED_SENTINEL) def has(self, key): try: value = self.session_data[self._serialize_key(key)] except KeyError: return self.kvs.has(key) else: return value != _DELETED_SENTINEL def filter_displayed_blocks(block, unused_view, frag, unused_context): """ A wrapper to only show XBlocks that set `show_in_read_only_mode` when masquerading as a specific user. We don't want to modify the state of the user we are masquerading as, so we can't show XBlocks that store information outside of the XBlock fields API. """ if getattr(block, 'show_in_read_only_mode', False): return frag return Fragment( _(u'This type of component cannot be shown while viewing the course as a specific student.') )
agpl-3.0
[ 2344, 199, 32111, 603, 305, 30622, 11016, 518, 199, 7852, 2518, 12622, 370, 1937, 282, 6474, 503, 12622, 2455, 402, 20736, 14, 199, 31619, 4928, 402, 2455, 965, 2757, 4895, 365, 5489, 315, 314, 2351, 1174, 14, 199, 2344, 199, 199, 646, 2050, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1014, 492, 4409, 63, 4030, 199, 504, 6474, 14, 992, 492, 18946, 199, 504, 4884, 14, 1001, 63, 1069, 492, 4282, 63, 1001, 12, 21072, 199, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 22574, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 7726, 492, 2606, 1110, 5502, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 710, 790, 1202, 370, 3877, 282, 922, 1159, 2518, 13, 1896, 28065, 30622, 2556, 315, 314, 5634, 2351, 14, 199, 3, 710, 574, 365, 282, 1211, 687, 2518, 2883, 370, 5531, 45, 305, 30622, 2251, 14, 199, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 275, 283, 5892, 30622, 63, 1751, 7, 199, 199, 3, 710, 790, 1202, 370, 3877, 7937, 15398, 901, 666, 315, 314, 5634, 2351, 14, 221, 961, 365, 2382, 901, 199, 3, 666, 365, 5489, 370, 5126, 24662, 314, 1174, 402, 314, 922, 781, 787, 28065, 16891, 5384, 465, 14, 199, 45, 1179, 2328, 540, 33, 1093, 63, 3998, 63, 3078, 275, 283, 5892, 30622, 63, 576, 7, 421, 199, 533, 5531, 45, 305, 30622, 8, 785, 304, 272, 408, 272, 603, 305, 30622, 2202, 367, 282, 6770, 2518, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 2518, 63, 498, 12, 4719, 534, 5500, 297, 922, 63, 5312, 63, 344, 29, 403, 12, 1572, 63, 344, 29, 403, 12, 922, 63, 354, 29, 403, 304, 267, 327, 2900, 2633, 370, 642, 805, 1471, 506, 4310, 6120, 17269, 370, 314, 5226, 2225, 14, 267, 327, 982, 1265, 2813, 503, 11441, 376, 2225, 12, 2597, 1678, 314, 636, 17212, 4533, 1083, 370, 12810, 267, 327, 2269, 666, 687, 4390, 7, 12184, 14, 267, 291, 14, 1972, 63, 498, 275, 2518, 63, 498, 267, 291, 14, 3756, 275, 4719, 267, 291, 14, 751, 63, 5312, 63, 344, 275, 922, 63, 5312, 63, 344, 267, 291, 14, 923, 63, 344, 275, 1572, 63, 344, 267, 291, 14, 751, 63, 354, 275, 922, 63, 354, 339, 347, 636, 17212, 721, 277, 12, 1174, 304, 267, 408, 267, 7523, 626, 1006, 3004, 787, 2536, 9096, 1380, 625, 24773, 5531, 45, 305, 30622, 2251, 14, 398, 20123, 5594, 5139, 1172, 5531, 45, 305, 30622, 2251, 687, 12731, 5459, 402, 314, 1233, 315, 3932, 267, 2351, 14, 221, 5723, 2269, 2251, 5594, 440, 1172, 1006, 3004, 663, 12, 12570, 9183, 315, 267, 4281, 83, 14, 267, 408, 267, 291, 855, 826, 14155, 929, 9, 421, 199, 32, 4365, 63, 4030, 199, 32, 2886, 63, 2427, 199, 32, 4921, 63, 1001, 199, 318, 2429, 63, 12774, 8, 1069, 12, 2518, 63, 498, 63, 875, 304, 272, 408, 272, 8690, 437, 42, 9839, 22238, 370, 1678, 314, 1453, 922, 1159, 28065, 30622, 367, 314, 2013, 2518, 14, 272, 710, 28065, 30622, 2202, 787, 5489, 315, 314, 5634, 2351, 465, 282, 1211, 687, 2518, 2883, 272, 370, 5531, 45, 305, 30622, 2251, 14, 272, 408, 272, 2518, 63, 498, 275, 22574, 14, 504, 63, 875, 8, 1972, 63, 498, 63, 875, 9, 272, 28065, 30622, 63, 1751, 275, 1056, 14, 1730, 14, 362, 8, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 12, 5009, 272, 1056, 63, 1001, 275, 1056, 14, 1001, 272, 4719, 275, 1056, 63, 1001, 14, 362, 360, 3756, 297, 283, 5500, 358, 272, 1572, 63, 344, 275, 1056, 63, 1001, 14, 362, 360, 923, 63, 344, 297, 488, 9, 272, 922, 63, 5312, 63, 344, 275, 1056, 63, 1001, 14, 362, 360, 751, 63, 5312, 63, 344, 297, 488, 9, 340, 1572, 63, 344, 365, 440, 488, 587, 488, 272, 922, 63, 354, 275, 1056, 63, 1001, 14, 362, 360, 751, 63, 354, 297, 488, 9, 272, 340, 922, 63, 354, 26, 267, 4390, 63, 262, 63, 1972, 275, 18946, 14, 1462, 14, 3707, 63, 22428, 63, 262, 8, 1972, 63, 498, 9, 267, 862, 26, 288, 340, 22143, 315, 922, 63, 354, 26, 355, 922, 63, 354, 275, 4390, 63, 262, 63, 1972, 14, 362, 8, 2123, 29, 751, 63, 354, 680, 2473, 288, 587, 26, 355, 4390, 63, 262, 63, 1972, 14, 362, 8, 2473, 29, 751, 63, 354, 9, 267, 871, 2876, 14, 7400, 26, 288, 372, 21072, 2561, 355, 283, 3742, 356, 756, 12, 355, 283, 705, 356, 12561, 490, 283, 10924, 365, 949, 922, 543, 314, 3434, 503, 3031, 2287, 469, 751, 63, 354, 93, 283, 490, 283, 22428, 315, 642, 2518, 3530, 355, 7092, 908, 8, 751, 63, 354, 29, 751, 63, 354, 9, 288, 3828, 272, 28065, 30622, 63, 1751, 59, 1972, 63, 498, 61, 275, 5531, 45, 305, 30622, 8, 267, 2518, 63, 498, 12, 267, 4719, 29, 3756, 12, 267, 922, 63, 5312, 63, 344, 29, 751, 63, 5312, 63, 344, 12, 267, 1572, 63, 344, 29, 923, 63, 344, 12, 267, 922, 63, 354, 29, 751, 63, 354, 12, 272, 776, 272, 1056, 14, 1730, 59, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 61, 275, 28065, 30622, 63, 1751, 272, 372, 21072, 3252, 3742, 356, 715, 1552, 421, 199, 318, 3272, 63, 5892, 30622, 8, 1069, 12, 2518, 63, 498, 12, 12622, 63, 2732, 29, 797, 12, 5305, 63, 5892, 30622, 63, 576, 29, 797, 304, 272, 408, 272, 10729, 1536, 28065, 16891, 5384, 367, 314, 1453, 922, 4453, 314, 1453, 1056, 14, 710, 1056, 1159, 922, 365, 272, 4588, 370, 1172, 282, 283, 5892, 30622, 63, 1751, 7, 2225, 543, 314, 1211, 402, 1006, 28065, 16891, 3074, 2202, 340, 272, 2797, 687, 4453, 282, 1056, 1067, 14, 710, 805, 2066, 2529, 282, 4092, 334, 6979, 45 ]
[ 199, 32111, 603, 305, 30622, 11016, 518, 199, 7852, 2518, 12622, 370, 1937, 282, 6474, 503, 12622, 2455, 402, 20736, 14, 199, 31619, 4928, 402, 2455, 965, 2757, 4895, 365, 5489, 315, 314, 2351, 1174, 14, 199, 2344, 199, 199, 646, 2050, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1014, 492, 4409, 63, 4030, 199, 504, 6474, 14, 992, 492, 18946, 199, 504, 4884, 14, 1001, 63, 1069, 492, 4282, 63, 1001, 12, 21072, 199, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 22574, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 7726, 492, 2606, 1110, 5502, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 710, 790, 1202, 370, 3877, 282, 922, 1159, 2518, 13, 1896, 28065, 30622, 2556, 315, 314, 5634, 2351, 14, 199, 3, 710, 574, 365, 282, 1211, 687, 2518, 2883, 370, 5531, 45, 305, 30622, 2251, 14, 199, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 275, 283, 5892, 30622, 63, 1751, 7, 199, 199, 3, 710, 790, 1202, 370, 3877, 7937, 15398, 901, 666, 315, 314, 5634, 2351, 14, 221, 961, 365, 2382, 901, 199, 3, 666, 365, 5489, 370, 5126, 24662, 314, 1174, 402, 314, 922, 781, 787, 28065, 16891, 5384, 465, 14, 199, 45, 1179, 2328, 540, 33, 1093, 63, 3998, 63, 3078, 275, 283, 5892, 30622, 63, 576, 7, 421, 199, 533, 5531, 45, 305, 30622, 8, 785, 304, 272, 408, 272, 603, 305, 30622, 2202, 367, 282, 6770, 2518, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 2518, 63, 498, 12, 4719, 534, 5500, 297, 922, 63, 5312, 63, 344, 29, 403, 12, 1572, 63, 344, 29, 403, 12, 922, 63, 354, 29, 403, 304, 267, 327, 2900, 2633, 370, 642, 805, 1471, 506, 4310, 6120, 17269, 370, 314, 5226, 2225, 14, 267, 327, 982, 1265, 2813, 503, 11441, 376, 2225, 12, 2597, 1678, 314, 636, 17212, 4533, 1083, 370, 12810, 267, 327, 2269, 666, 687, 4390, 7, 12184, 14, 267, 291, 14, 1972, 63, 498, 275, 2518, 63, 498, 267, 291, 14, 3756, 275, 4719, 267, 291, 14, 751, 63, 5312, 63, 344, 275, 922, 63, 5312, 63, 344, 267, 291, 14, 923, 63, 344, 275, 1572, 63, 344, 267, 291, 14, 751, 63, 354, 275, 922, 63, 354, 339, 347, 636, 17212, 721, 277, 12, 1174, 304, 267, 408, 267, 7523, 626, 1006, 3004, 787, 2536, 9096, 1380, 625, 24773, 5531, 45, 305, 30622, 2251, 14, 398, 20123, 5594, 5139, 1172, 5531, 45, 305, 30622, 2251, 687, 12731, 5459, 402, 314, 1233, 315, 3932, 267, 2351, 14, 221, 5723, 2269, 2251, 5594, 440, 1172, 1006, 3004, 663, 12, 12570, 9183, 315, 267, 4281, 83, 14, 267, 408, 267, 291, 855, 826, 14155, 929, 9, 421, 199, 32, 4365, 63, 4030, 199, 32, 2886, 63, 2427, 199, 32, 4921, 63, 1001, 199, 318, 2429, 63, 12774, 8, 1069, 12, 2518, 63, 498, 63, 875, 304, 272, 408, 272, 8690, 437, 42, 9839, 22238, 370, 1678, 314, 1453, 922, 1159, 28065, 30622, 367, 314, 2013, 2518, 14, 272, 710, 28065, 30622, 2202, 787, 5489, 315, 314, 5634, 2351, 465, 282, 1211, 687, 2518, 2883, 272, 370, 5531, 45, 305, 30622, 2251, 14, 272, 408, 272, 2518, 63, 498, 275, 22574, 14, 504, 63, 875, 8, 1972, 63, 498, 63, 875, 9, 272, 28065, 30622, 63, 1751, 275, 1056, 14, 1730, 14, 362, 8, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 12, 5009, 272, 1056, 63, 1001, 275, 1056, 14, 1001, 272, 4719, 275, 1056, 63, 1001, 14, 362, 360, 3756, 297, 283, 5500, 358, 272, 1572, 63, 344, 275, 1056, 63, 1001, 14, 362, 360, 923, 63, 344, 297, 488, 9, 272, 922, 63, 5312, 63, 344, 275, 1056, 63, 1001, 14, 362, 360, 751, 63, 5312, 63, 344, 297, 488, 9, 340, 1572, 63, 344, 365, 440, 488, 587, 488, 272, 922, 63, 354, 275, 1056, 63, 1001, 14, 362, 360, 751, 63, 354, 297, 488, 9, 272, 340, 922, 63, 354, 26, 267, 4390, 63, 262, 63, 1972, 275, 18946, 14, 1462, 14, 3707, 63, 22428, 63, 262, 8, 1972, 63, 498, 9, 267, 862, 26, 288, 340, 22143, 315, 922, 63, 354, 26, 355, 922, 63, 354, 275, 4390, 63, 262, 63, 1972, 14, 362, 8, 2123, 29, 751, 63, 354, 680, 2473, 288, 587, 26, 355, 4390, 63, 262, 63, 1972, 14, 362, 8, 2473, 29, 751, 63, 354, 9, 267, 871, 2876, 14, 7400, 26, 288, 372, 21072, 2561, 355, 283, 3742, 356, 756, 12, 355, 283, 705, 356, 12561, 490, 283, 10924, 365, 949, 922, 543, 314, 3434, 503, 3031, 2287, 469, 751, 63, 354, 93, 283, 490, 283, 22428, 315, 642, 2518, 3530, 355, 7092, 908, 8, 751, 63, 354, 29, 751, 63, 354, 9, 288, 3828, 272, 28065, 30622, 63, 1751, 59, 1972, 63, 498, 61, 275, 5531, 45, 305, 30622, 8, 267, 2518, 63, 498, 12, 267, 4719, 29, 3756, 12, 267, 922, 63, 5312, 63, 344, 29, 751, 63, 5312, 63, 344, 12, 267, 1572, 63, 344, 29, 923, 63, 344, 12, 267, 922, 63, 354, 29, 751, 63, 354, 12, 272, 776, 272, 1056, 14, 1730, 59, 45, 1179, 2328, 540, 33, 1093, 63, 13931, 63, 3078, 61, 275, 28065, 30622, 63, 1751, 272, 372, 21072, 3252, 3742, 356, 715, 1552, 421, 199, 318, 3272, 63, 5892, 30622, 8, 1069, 12, 2518, 63, 498, 12, 12622, 63, 2732, 29, 797, 12, 5305, 63, 5892, 30622, 63, 576, 29, 797, 304, 272, 408, 272, 10729, 1536, 28065, 16891, 5384, 367, 314, 1453, 922, 4453, 314, 1453, 1056, 14, 710, 1056, 1159, 922, 365, 272, 4588, 370, 1172, 282, 283, 5892, 30622, 63, 1751, 7, 2225, 543, 314, 1211, 402, 1006, 28065, 16891, 3074, 2202, 340, 272, 2797, 687, 4453, 282, 1056, 1067, 14, 710, 805, 2066, 2529, 282, 4092, 334, 6979, 45, 0 ]
[ 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]
orekyuu/intellij-community
python/lib/Lib/distutils/command/clean.py
135
2918
"""distutils.command.clean Implements the Distutils 'clean' command.""" # contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18 # This module should be kept compatible with Python 2.1. __revision__ = "$Id: clean.py 38532 2005-03-03 08:12:27Z loewis $" import os from distutils.core import Command from distutils.dir_util import remove_tree from distutils import log class clean (Command): description = "clean up temporary files from 'build' command" user_options = [ ('build-base=', 'b', "base build directory (default: 'build.build-base')"), ('build-lib=', None, "build directory for all modules (default: 'build.build-lib')"), ('build-temp=', 't', "temporary build directory (default: 'build.build-temp')"), ('build-scripts=', None, "build directory for scripts (default: 'build.build-scripts')"), ('bdist-base=', None, "temporary directory for built distributions"), ('all', 'a', "remove all build output, not just temporary by-products") ] boolean_options = ['all'] def initialize_options(self): self.build_base = None self.build_lib = None self.build_temp = None self.build_scripts = None self.bdist_base = None self.all = None def finalize_options(self): self.set_undefined_options('build', ('build_base', 'build_base'), ('build_lib', 'build_lib'), ('build_scripts', 'build_scripts'), ('build_temp', 'build_temp')) self.set_undefined_options('bdist', ('bdist_base', 'bdist_base')) def run(self): # remove the build/temp.<plat> directory (unless it's already # gone) if os.path.exists(self.build_temp): remove_tree(self.build_temp, dry_run=self.dry_run) else: log.debug("'%s' does not exist -- can't clean it", self.build_temp) if self.all: # remove build directories for directory in (self.build_lib, self.bdist_base, self.build_scripts): if os.path.exists(directory): remove_tree(directory, dry_run=self.dry_run) else: log.warn("'%s' does not exist -- can't clean it", directory) # just for the heck of it, try to remove the base build directory: # we might have emptied it right now, but if not we don't care if not self.dry_run: try: os.rmdir(self.build_base) log.info("removing '%s'", self.build_base) except OSError: pass # class clean
apache-2.0
[ 624, 13350, 14, 1531, 14, 3118, 199, 199, 29452, 314, 12577, 283, 3118, 7, 1414, 1041, 199, 199, 3, 406, 24855, 701, 699, 1810, 5653, 1804, 274, 1132, 344, 455, 665, 915, 11908, 32, 1259, 14, 5411, 13, 9264, 14, 271, 6244, 3483, 12293, 13, 1644, 13, 1085, 199, 199, 3, 961, 859, 1077, 506, 16204, 9025, 543, 2018, 499, 14, 17, 14, 199, 199, 363, 5792, 363, 275, 7880, 1304, 26, 3633, 14, 647, 650, 2426, 708, 11811, 13, 1644, 13, 1644, 19363, 26, 713, 26, 1465, 58, 560, 546, 374, 2672, 2, 199, 199, 646, 747, 199, 504, 7065, 14, 1018, 492, 5817, 199, 504, 7065, 14, 694, 63, 1974, 492, 2813, 63, 2350, 199, 504, 7065, 492, 943, 199, 199, 533, 3633, 334, 3110, 304, 339, 1369, 275, 298, 3118, 1536, 7937, 1584, 687, 283, 1506, 7, 1414, 2, 272, 922, 63, 1419, 275, 359, 267, 661, 1506, 13, 1095, 4009, 283, 66, 297, 268, 298, 1095, 1900, 2082, 334, 885, 26, 283, 1506, 14, 1506, 13, 1095, 358, 1288, 267, 661, 1506, 13, 773, 4009, 488, 12, 268, 298, 1506, 2082, 367, 1006, 4621, 334, 885, 26, 283, 1506, 14, 1506, 13, 773, 358, 1288, 267, 661, 1506, 13, 808, 4009, 283, 84, 297, 268, 298, 13555, 1900, 2082, 334, 885, 26, 283, 1506, 14, 1506, 13, 808, 358, 1288, 267, 661, 1506, 13, 6429, 4009, 488, 12, 268, 298, 1506, 2082, 367, 10554, 334, 885, 26, 283, 1506, 14, 1506, 13, 6429, 358, 1288, 267, 661, 17403, 13, 1095, 4009, 488, 12, 268, 298, 13555, 2082, 367, 6137, 10208, 1288, 267, 661, 452, 297, 283, 65, 297, 268, 298, 2168, 1006, 1900, 1072, 12, 440, 2951, 7937, 701, 13, 13336, 531, 272, 1622, 339, 5046, 63, 1419, 275, 788, 452, 418, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 291, 14, 1506, 63, 1095, 275, 488, 267, 291, 14, 1506, 63, 773, 275, 488, 267, 291, 14, 1506, 63, 808, 275, 488, 267, 291, 14, 1506, 63, 6429, 275, 488, 267, 291, 14, 17403, 63, 1095, 275, 488, 267, 291, 14, 452, 275, 488, 339, 347, 17284, 63, 1419, 8, 277, 304, 267, 291, 14, 409, 63, 10705, 63, 1419, 360, 1506, 297, 3521, 661, 1506, 63, 1095, 297, 283, 1506, 63, 1095, 659, 3521, 661, 1506, 63, 773, 297, 283, 1506, 63, 773, 659, 3521, 661, 1506, 63, 6429, 297, 283, 1506, 63, 6429, 659, 3521, 661, 1506, 63, 808, 297, 283, 1506, 63, 808, 1333, 267, 291, 14, 409, 63, 10705, 63, 1419, 360, 17403, 297, 3521, 661, 17403, 63, 1095, 297, 283, 17403, 63, 1095, 1333, 339, 347, 1255, 8, 277, 304, 267, 327, 2813, 314, 1900, 15, 808, 21455, 14156, 30, 2082, 334, 18447, 652, 1159, 2575, 267, 327, 21737, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 277, 14, 1506, 63, 808, 304, 288, 2813, 63, 2350, 8, 277, 14, 1506, 63, 808, 12, 9951, 63, 1065, 29, 277, 14, 10481, 63, 1065, 9, 267, 587, 26, 288, 943, 14, 1757, 21065, 83, 7, 1630, 440, 2187, 1553, 883, 1133, 3633, 652, 401, 1993, 291, 14, 1506, 63, 808, 9, 398, 340, 291, 14, 452, 26, 288, 327, 2813, 1900, 6602, 288, 367, 2082, 315, 334, 277, 14, 1506, 63, 773, 12, 2892, 291, 14, 17403, 63, 1095, 12, 2892, 291, 14, 1506, 63, 6429, 304, 355, 340, 747, 14, 515, 14, 2444, 8, 3619, 304, 490, 2813, 63, 2350, 8, 3619, 12, 9951, 63, 1065, 29, 277, 14, 10481, 63, 1065, 9, 355, 587, 26, 490, 943, 14, 4050, 21065, 83, 7, 1630, 440, 2187, 1553, 883, 1133, 3633, 652, 401, 2490, 2082, 9, 398, 327, 2951, 367, 314, 946, 346, 402, 652, 12, 862, 370, 2813, 314, 1300, 1900, 2082, 26, 267, 327, 781, 5594, 1172, 9052, 29307, 652, 2451, 3063, 12, 1325, 340, 440, 781, 2793, 1133, 10296, 267, 340, 440, 291, 14, 10481, 63, 1065, 26, 288, 862, 26, 355, 747, 14, 19405, 8, 277, 14, 1506, 63, 1095, 9, 355, 943, 14, 815, 480, 264, 7665, 1543, 83, 4662, 291, 14, 1506, 63, 1095, 9, 288, 871, 6440, 26, 355, 986, 199, 199, 3, 1021, 3633, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 13350, 14, 1531, 14, 3118, 199, 199, 29452, 314, 12577, 283, 3118, 7, 1414, 1041, 199, 199, 3, 406, 24855, 701, 699, 1810, 5653, 1804, 274, 1132, 344, 455, 665, 915, 11908, 32, 1259, 14, 5411, 13, 9264, 14, 271, 6244, 3483, 12293, 13, 1644, 13, 1085, 199, 199, 3, 961, 859, 1077, 506, 16204, 9025, 543, 2018, 499, 14, 17, 14, 199, 199, 363, 5792, 363, 275, 7880, 1304, 26, 3633, 14, 647, 650, 2426, 708, 11811, 13, 1644, 13, 1644, 19363, 26, 713, 26, 1465, 58, 560, 546, 374, 2672, 2, 199, 199, 646, 747, 199, 504, 7065, 14, 1018, 492, 5817, 199, 504, 7065, 14, 694, 63, 1974, 492, 2813, 63, 2350, 199, 504, 7065, 492, 943, 199, 199, 533, 3633, 334, 3110, 304, 339, 1369, 275, 298, 3118, 1536, 7937, 1584, 687, 283, 1506, 7, 1414, 2, 272, 922, 63, 1419, 275, 359, 267, 661, 1506, 13, 1095, 4009, 283, 66, 297, 268, 298, 1095, 1900, 2082, 334, 885, 26, 283, 1506, 14, 1506, 13, 1095, 358, 1288, 267, 661, 1506, 13, 773, 4009, 488, 12, 268, 298, 1506, 2082, 367, 1006, 4621, 334, 885, 26, 283, 1506, 14, 1506, 13, 773, 358, 1288, 267, 661, 1506, 13, 808, 4009, 283, 84, 297, 268, 298, 13555, 1900, 2082, 334, 885, 26, 283, 1506, 14, 1506, 13, 808, 358, 1288, 267, 661, 1506, 13, 6429, 4009, 488, 12, 268, 298, 1506, 2082, 367, 10554, 334, 885, 26, 283, 1506, 14, 1506, 13, 6429, 358, 1288, 267, 661, 17403, 13, 1095, 4009, 488, 12, 268, 298, 13555, 2082, 367, 6137, 10208, 1288, 267, 661, 452, 297, 283, 65, 297, 268, 298, 2168, 1006, 1900, 1072, 12, 440, 2951, 7937, 701, 13, 13336, 531, 272, 1622, 339, 5046, 63, 1419, 275, 788, 452, 418, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 291, 14, 1506, 63, 1095, 275, 488, 267, 291, 14, 1506, 63, 773, 275, 488, 267, 291, 14, 1506, 63, 808, 275, 488, 267, 291, 14, 1506, 63, 6429, 275, 488, 267, 291, 14, 17403, 63, 1095, 275, 488, 267, 291, 14, 452, 275, 488, 339, 347, 17284, 63, 1419, 8, 277, 304, 267, 291, 14, 409, 63, 10705, 63, 1419, 360, 1506, 297, 3521, 661, 1506, 63, 1095, 297, 283, 1506, 63, 1095, 659, 3521, 661, 1506, 63, 773, 297, 283, 1506, 63, 773, 659, 3521, 661, 1506, 63, 6429, 297, 283, 1506, 63, 6429, 659, 3521, 661, 1506, 63, 808, 297, 283, 1506, 63, 808, 1333, 267, 291, 14, 409, 63, 10705, 63, 1419, 360, 17403, 297, 3521, 661, 17403, 63, 1095, 297, 283, 17403, 63, 1095, 1333, 339, 347, 1255, 8, 277, 304, 267, 327, 2813, 314, 1900, 15, 808, 21455, 14156, 30, 2082, 334, 18447, 652, 1159, 2575, 267, 327, 21737, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 277, 14, 1506, 63, 808, 304, 288, 2813, 63, 2350, 8, 277, 14, 1506, 63, 808, 12, 9951, 63, 1065, 29, 277, 14, 10481, 63, 1065, 9, 267, 587, 26, 288, 943, 14, 1757, 21065, 83, 7, 1630, 440, 2187, 1553, 883, 1133, 3633, 652, 401, 1993, 291, 14, 1506, 63, 808, 9, 398, 340, 291, 14, 452, 26, 288, 327, 2813, 1900, 6602, 288, 367, 2082, 315, 334, 277, 14, 1506, 63, 773, 12, 2892, 291, 14, 17403, 63, 1095, 12, 2892, 291, 14, 1506, 63, 6429, 304, 355, 340, 747, 14, 515, 14, 2444, 8, 3619, 304, 490, 2813, 63, 2350, 8, 3619, 12, 9951, 63, 1065, 29, 277, 14, 10481, 63, 1065, 9, 355, 587, 26, 490, 943, 14, 4050, 21065, 83, 7, 1630, 440, 2187, 1553, 883, 1133, 3633, 652, 401, 2490, 2082, 9, 398, 327, 2951, 367, 314, 946, 346, 402, 652, 12, 862, 370, 2813, 314, 1300, 1900, 2082, 26, 267, 327, 781, 5594, 1172, 9052, 29307, 652, 2451, 3063, 12, 1325, 340, 440, 781, 2793, 1133, 10296, 267, 340, 440, 291, 14, 10481, 63, 1065, 26, 288, 862, 26, 355, 747, 14, 19405, 8, 277, 14, 1506, 63, 1095, 9, 355, 943, 14, 815, 480, 264, 7665, 1543, 83, 4662, 291, 14, 1506, 63, 1095, 9, 288, 871, 6440, 26, 355, 986, 199, 199, 3, 1021, 3633, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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criptome_multihits_v1.py
6
3886
''' Created on Jun 8, 2012 @author: mkiyer ''' import sys import logging import argparse import os # local imports import chimerascan.pysam as pysam from chimerascan.lib import config from chimerascan.lib.base import imin2 from chimerascan.lib.sam import parse_pe_reads, copy_read from chimerascan.lib.feature import TranscriptFeature from chimerascan.lib.transcriptome_to_genome import \ build_tid_transcript_genome_map, \ transcript_to_genome_pos def annotate_multihits(reads, tid_tx_genome_map): hits = set() for r in reads: if r.is_unmapped: continue assert r.rname in tid_tx_genome_map # use the position that is most 5' relative to genome left_tid, left_strand, left_pos = transcript_to_genome_pos(r.rname, r.pos, tid_tx_genome_map) right_tid, right_strand, right_pos = transcript_to_genome_pos(r.rname, r.aend-1, tid_tx_genome_map) tid = left_tid pos = imin2(left_pos, right_pos) hits.add((tid, pos)) for i,r in enumerate(reads): # annotate reads with 'HI', and 'IH' tags r.tags = r.tags + [("HI",i), ("IH",len(reads)), ("NH",len(hits))] return len(hits) def filter_multihits(transcript_file, input_bam_file, output_bam_file, max_multihits=1): logging.debug("Reading transcript features") transcripts = list(TranscriptFeature.parse(open(transcript_file))) # parse and convert sam -> bam inbamfh = pysam.Samfile(input_bam_file, "rb") outbamfh = pysam.Samfile(output_bam_file, "wb", template=inbamfh) # build a transcript to genome coordinate map tid_tx_genome_map = build_tid_transcript_genome_map(outbamfh, transcripts) num_frags = 0 logging.debug("Annotating and filtering multihits") for pe_reads in parse_pe_reads(inbamfh): mate_num_hits = [] for reads in pe_reads: num_hits = annotate_multihits(reads, tid_tx_genome_map) mate_num_hits.append(num_hits) new_pe_reads = [[],[]] if mate_num_hits[0] > max_multihits: r = copy_read(pe_reads[0][0]) r.is_unmapped = True r.is_proper_pair = False r.is_secondary = False r.rname = -1 r.pos = 0 if mate_num_hits[1] > max_multihits: r.mate_is_unmapped = True r.mrnm = -1 r.mpos = 0 new_pe_reads[0] = [r] else: new_pe_reads[0] = pe_reads[0] if mate_num_hits[1] > max_multihits: r = copy_read(pe_reads[1][0]) r.is_unmapped = True r.is_proper_pair = False r.is_secondary = False r.rname = -1 r.pos = 0 if mate_num_hits[0] > max_multihits: r.mate_is_unmapped = True r.mrnm = -1 r.mpos = 0 new_pe_reads[1] = [r] else: new_pe_reads[1] = pe_reads[1] for reads in pe_reads: for r in reads: outbamfh.write(r) num_frags += 1 logging.debug("Found %d fragments" % (num_frags)) inbamfh.close() outbamfh.close() return config.JOB_SUCCESS def main(): logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") parser = argparse.ArgumentParser() parser.add_argument("--max-multihits", dest="max_multihits", type=int) parser.add_argument("transcript_file") parser.add_argument("input_bam_file") parser.add_argument("output_bam_file") args = parser.parse_args() return filter_multihits(args.transcript_file, args.input_bam_file, args.output_bam_file, args.max_multihits) if __name__ == '__main__': sys.exit(main())
gpl-3.0
[ 2344, 199, 10502, 641, 1603, 324, 1695, 12, 6029, 199, 199, 32, 2502, 26, 333, 8810, 23009, 199, 2344, 199, 646, 984, 199, 646, 2050, 199, 646, 7534, 199, 646, 747, 199, 199, 3, 2257, 8925, 199, 646, 682, 6267, 305, 2425, 14, 15983, 455, 465, 10382, 455, 199, 504, 682, 6267, 305, 2425, 14, 773, 492, 1101, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 1095, 492, 284, 827, 18, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 21660, 492, 2198, 63, 321, 63, 15656, 12, 1331, 63, 739, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 4445, 492, 19894, 1579, 5968, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 3936, 729, 5816, 278, 63, 475, 63, 27776, 492, 971, 272, 1900, 63, 5700, 63, 21656, 63, 27776, 63, 1130, 12, 971, 272, 27229, 63, 475, 63, 27776, 63, 1712, 199, 199, 318, 28987, 63, 3029, 16595, 8, 15656, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 304, 272, 19745, 275, 663, 342, 272, 367, 519, 315, 11597, 26, 267, 340, 519, 14, 374, 63, 324, 11663, 26, 288, 1980, 267, 702, 519, 14, 82, 354, 315, 11559, 63, 2347, 63, 27776, 63, 1130, 267, 327, 675, 314, 3421, 626, 365, 4750, 959, 7, 3847, 370, 29924, 267, 3602, 63, 5700, 12, 3602, 63, 30964, 12, 3602, 63, 1712, 275, 27229, 63, 475, 63, 27776, 63, 1712, 8, 82, 14, 82, 354, 12, 519, 14, 1712, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 267, 2451, 63, 5700, 12, 2451, 63, 30964, 12, 2451, 63, 1712, 275, 27229, 63, 475, 63, 27776, 63, 1712, 8, 82, 14, 82, 354, 12, 519, 14, 65, 500, 13, 17, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 267, 11559, 275, 3602, 63, 5700, 267, 2086, 275, 284, 827, 18, 8, 3039, 63, 1712, 12, 2451, 63, 1712, 9, 267, 19745, 14, 525, 1332, 5700, 12, 2086, 430, 272, 367, 284, 12, 82, 315, 3874, 8, 15656, 304, 267, 327, 28987, 11597, 543, 283, 11183, 297, 436, 283, 19824, 7, 3762, 267, 519, 14, 2969, 275, 519, 14, 2969, 435, 10003, 11183, 401, 73, 395, 1689, 19824, 401, 552, 8, 15656, 1826, 1689, 46, 40, 401, 552, 8, 16595, 10524, 272, 372, 822, 8, 16595, 9, 199, 199, 318, 2457, 63, 3029, 16595, 8, 21656, 63, 493, 12, 1324, 63, 21112, 63, 493, 12, 1072, 63, 21112, 63, 493, 12, 2151, 1390, 63, 3029, 16595, 29, 17, 304, 272, 2050, 14, 1757, 480, 20568, 27229, 4534, 531, 272, 7115, 6429, 275, 769, 8, 14612, 1579, 5968, 14, 1122, 8, 1490, 8, 21656, 63, 493, 1724, 272, 327, 2198, 436, 3957, 31626, 1035, 330, 455, 272, 315, 21112, 12853, 275, 10382, 455, 14, 51, 455, 493, 8, 1210, 63, 21112, 63, 493, 12, 298, 4848, 531, 272, 734, 21112, 12853, 275, 10382, 455, 14, 51, 455, 493, 8, 1199, 63, 21112, 63, 493, 12, 298, 6603, 401, 1978, 29, 262, 21112, 12853, 9, 272, 327, 1900, 282, 27229, 370, 29924, 10021, 2341, 259, 272, 11559, 63, 2347, 63, 27776, 63, 1130, 275, 1900, 63, 5700, 63, 21656, 63, 27776, 63, 1130, 8, 548, 21112, 12853, 12, 7115, 6429, 9, 272, 1967, 63, 21844, 458, 275, 378, 272, 2050, 14, 1757, 480, 21761, 1958, 436, 14545, 3510, 16595, 531, 272, 367, 4837, 63, 15656, 315, 2198, 63, 321, 63, 15656, 8, 262, 21112, 12853, 304, 18418, 333, 323, 63, 1507, 63, 16595, 275, 942, 267, 367, 11597, 315, 4837, 63, 15656, 26, 288, 1967, 63, 16595, 275, 28987, 63, 3029, 16595, 8, 15656, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 288, 333, 323, 63, 1507, 63, 16595, 14, 740, 8, 1507, 63, 16595, 9, 267, 892, 63, 321, 63, 15656, 275, 3474, 6922, 2677, 267, 340, 333, 323, 63, 1507, 63, 16595, 59, 16, 61, 690, 1390, 63, 3029, 16595, 26, 288, 519, 275, 1331, 63, 739, 8, 321, 63, 15656, 59, 16, 1527, 16, 566, 288, 519, 14, 374, 63, 324, 11663, 275, 715, 288, 519, 14, 374, 63, 28314, 63, 3852, 275, 756, 288, 519, 14, 374, 63, 12371, 275, 756, 288, 519, 14, 82, 354, 275, 446, 17, 288, 519, 14, 1712, 275, 378, 288, 340, 333, 323, 63, 1507, 63, 16595, 59, 17, 61, 690, 1390, 63, 3029, 16595, 26, 355, 519, 14, 17684, 63, 374, 63, 324, 11663, 275, 715, 355, 519, 14, 13118, 10756, 275, 446, 17, 355, 519, 14, 311, 736, 275, 378, 288, 892, 63, 321, 63, 15656, 59, 16, 61, 275, 359, 82, 61, 267, 587, 26, 288, 892, 63, 321, 63, 15656, 59, 16, 61, 275, 4837, 63, 15656, 59, 16, 61, 267, 340, 333, 323, 63, 1507, 63, 16595, 59, 17, 61, 690, 1390, 63, 3029, 16595, 26, 288, 519, 275, 1331, 63, 739, 8, 321, 63, 15656, 59, 17, 1527, 16, 566, 288, 519, 14, 374, 63, 324, 11663, 275, 715, 288, 519, 14, 374, 63, 28314, 63, 3852, 275, 756, 288, 519, 14, 374, 63, 12371, 275, 756, 288, 519, 14, 82, 354, 275, 446, 17, 288, 519, 14, 1712, 275, 378, 288, 340, 333, 323, 63, 1507, 63, 16595, 59, 16, 61, 690, 1390, 63, 3029, 16595, 26, 355, 519, 14, 17684, 63, 374, 63, 324, 11663, 275, 715, 355, 519, 14, 13118, 10756, 275, 446, 17, 355, 519, 14, 311, 736, 275, 378, 288, 892, 63, 321, 63, 15656, 59, 17, 61, 275, 359, 82, 61, 267, 587, 26, 288, 892, 63, 321, 63, 15656, 59, 17, 61, 275, 4837, 63, 15656, 59, 17, 61, 267, 367, 11597, 315, 4837, 63, 15656, 26, 288, 367, 519, 315, 11597, 26, 355, 734, 21112, 12853, 14, 952, 8, 82, 9, 267, 1967, 63, 21844, 458, 847, 413, 272, 2050, 14, 1757, 480, 3601, 450, 68, 21495, 2, 450, 334, 1507, 63, 21844, 458, 430, 272, 315, 21112, 12853, 14, 1600, 342, 272, 734, 21112, 12853, 14, 1600, 342, 272, 372, 1101, 14, 14879, 63, 12779, 199, 199, 318, 2446, 837, 272, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 5287, 12, 717, 1475, 17662, 18331, 9, 83, 446, 2818, 354, 9, 83, 446, 2818, 20056, 9, 83, 446 ]
[ 199, 10502, 641, 1603, 324, 1695, 12, 6029, 199, 199, 32, 2502, 26, 333, 8810, 23009, 199, 2344, 199, 646, 984, 199, 646, 2050, 199, 646, 7534, 199, 646, 747, 199, 199, 3, 2257, 8925, 199, 646, 682, 6267, 305, 2425, 14, 15983, 455, 465, 10382, 455, 199, 504, 682, 6267, 305, 2425, 14, 773, 492, 1101, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 1095, 492, 284, 827, 18, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 21660, 492, 2198, 63, 321, 63, 15656, 12, 1331, 63, 739, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 4445, 492, 19894, 1579, 5968, 199, 504, 682, 6267, 305, 2425, 14, 773, 14, 3936, 729, 5816, 278, 63, 475, 63, 27776, 492, 971, 272, 1900, 63, 5700, 63, 21656, 63, 27776, 63, 1130, 12, 971, 272, 27229, 63, 475, 63, 27776, 63, 1712, 199, 199, 318, 28987, 63, 3029, 16595, 8, 15656, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 304, 272, 19745, 275, 663, 342, 272, 367, 519, 315, 11597, 26, 267, 340, 519, 14, 374, 63, 324, 11663, 26, 288, 1980, 267, 702, 519, 14, 82, 354, 315, 11559, 63, 2347, 63, 27776, 63, 1130, 267, 327, 675, 314, 3421, 626, 365, 4750, 959, 7, 3847, 370, 29924, 267, 3602, 63, 5700, 12, 3602, 63, 30964, 12, 3602, 63, 1712, 275, 27229, 63, 475, 63, 27776, 63, 1712, 8, 82, 14, 82, 354, 12, 519, 14, 1712, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 267, 2451, 63, 5700, 12, 2451, 63, 30964, 12, 2451, 63, 1712, 275, 27229, 63, 475, 63, 27776, 63, 1712, 8, 82, 14, 82, 354, 12, 519, 14, 65, 500, 13, 17, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 267, 11559, 275, 3602, 63, 5700, 267, 2086, 275, 284, 827, 18, 8, 3039, 63, 1712, 12, 2451, 63, 1712, 9, 267, 19745, 14, 525, 1332, 5700, 12, 2086, 430, 272, 367, 284, 12, 82, 315, 3874, 8, 15656, 304, 267, 327, 28987, 11597, 543, 283, 11183, 297, 436, 283, 19824, 7, 3762, 267, 519, 14, 2969, 275, 519, 14, 2969, 435, 10003, 11183, 401, 73, 395, 1689, 19824, 401, 552, 8, 15656, 1826, 1689, 46, 40, 401, 552, 8, 16595, 10524, 272, 372, 822, 8, 16595, 9, 199, 199, 318, 2457, 63, 3029, 16595, 8, 21656, 63, 493, 12, 1324, 63, 21112, 63, 493, 12, 1072, 63, 21112, 63, 493, 12, 2151, 1390, 63, 3029, 16595, 29, 17, 304, 272, 2050, 14, 1757, 480, 20568, 27229, 4534, 531, 272, 7115, 6429, 275, 769, 8, 14612, 1579, 5968, 14, 1122, 8, 1490, 8, 21656, 63, 493, 1724, 272, 327, 2198, 436, 3957, 31626, 1035, 330, 455, 272, 315, 21112, 12853, 275, 10382, 455, 14, 51, 455, 493, 8, 1210, 63, 21112, 63, 493, 12, 298, 4848, 531, 272, 734, 21112, 12853, 275, 10382, 455, 14, 51, 455, 493, 8, 1199, 63, 21112, 63, 493, 12, 298, 6603, 401, 1978, 29, 262, 21112, 12853, 9, 272, 327, 1900, 282, 27229, 370, 29924, 10021, 2341, 259, 272, 11559, 63, 2347, 63, 27776, 63, 1130, 275, 1900, 63, 5700, 63, 21656, 63, 27776, 63, 1130, 8, 548, 21112, 12853, 12, 7115, 6429, 9, 272, 1967, 63, 21844, 458, 275, 378, 272, 2050, 14, 1757, 480, 21761, 1958, 436, 14545, 3510, 16595, 531, 272, 367, 4837, 63, 15656, 315, 2198, 63, 321, 63, 15656, 8, 262, 21112, 12853, 304, 18418, 333, 323, 63, 1507, 63, 16595, 275, 942, 267, 367, 11597, 315, 4837, 63, 15656, 26, 288, 1967, 63, 16595, 275, 28987, 63, 3029, 16595, 8, 15656, 12, 11559, 63, 2347, 63, 27776, 63, 1130, 9, 288, 333, 323, 63, 1507, 63, 16595, 14, 740, 8, 1507, 63, 16595, 9, 267, 892, 63, 321, 63, 15656, 275, 3474, 6922, 2677, 267, 340, 333, 323, 63, 1507, 63, 16595, 59, 16, 61, 690, 1390, 63, 3029, 16595, 26, 288, 519, 275, 1331, 63, 739, 8, 321, 63, 15656, 59, 16, 1527, 16, 566, 288, 519, 14, 374, 63, 324, 11663, 275, 715, 288, 519, 14, 374, 63, 28314, 63, 3852, 275, 756, 288, 519, 14, 374, 63, 12371, 275, 756, 288, 519, 14, 82, 354, 275, 446, 17, 288, 519, 14, 1712, 275, 378, 288, 340, 333, 323, 63, 1507, 63, 16595, 59, 17, 61, 690, 1390, 63, 3029, 16595, 26, 355, 519, 14, 17684, 63, 374, 63, 324, 11663, 275, 715, 355, 519, 14, 13118, 10756, 275, 446, 17, 355, 519, 14, 311, 736, 275, 378, 288, 892, 63, 321, 63, 15656, 59, 16, 61, 275, 359, 82, 61, 267, 587, 26, 288, 892, 63, 321, 63, 15656, 59, 16, 61, 275, 4837, 63, 15656, 59, 16, 61, 267, 340, 333, 323, 63, 1507, 63, 16595, 59, 17, 61, 690, 1390, 63, 3029, 16595, 26, 288, 519, 275, 1331, 63, 739, 8, 321, 63, 15656, 59, 17, 1527, 16, 566, 288, 519, 14, 374, 63, 324, 11663, 275, 715, 288, 519, 14, 374, 63, 28314, 63, 3852, 275, 756, 288, 519, 14, 374, 63, 12371, 275, 756, 288, 519, 14, 82, 354, 275, 446, 17, 288, 519, 14, 1712, 275, 378, 288, 340, 333, 323, 63, 1507, 63, 16595, 59, 16, 61, 690, 1390, 63, 3029, 16595, 26, 355, 519, 14, 17684, 63, 374, 63, 324, 11663, 275, 715, 355, 519, 14, 13118, 10756, 275, 446, 17, 355, 519, 14, 311, 736, 275, 378, 288, 892, 63, 321, 63, 15656, 59, 17, 61, 275, 359, 82, 61, 267, 587, 26, 288, 892, 63, 321, 63, 15656, 59, 17, 61, 275, 4837, 63, 15656, 59, 17, 61, 267, 367, 11597, 315, 4837, 63, 15656, 26, 288, 367, 519, 315, 11597, 26, 355, 734, 21112, 12853, 14, 952, 8, 82, 9, 267, 1967, 63, 21844, 458, 847, 413, 272, 2050, 14, 1757, 480, 3601, 450, 68, 21495, 2, 450, 334, 1507, 63, 21844, 458, 430, 272, 315, 21112, 12853, 14, 1600, 342, 272, 734, 21112, 12853, 14, 1600, 342, 272, 372, 1101, 14, 14879, 63, 12779, 199, 199, 318, 2446, 837, 272, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 5287, 12, 717, 1475, 17662, 18331, 9, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
AccelAI/accel.ai
flask-aws/lib/python2.7/site-packages/werkzeug/contrib/limiter.py
295
1333
# -*- coding: utf-8 -*- """ werkzeug.contrib.limiter ~~~~~~~~~~~~~~~~~~~~~~~~ A middleware that limits incoming data. This works around problems with Trac_ or Django_ because those directly stream into the memory. .. _Trac: http://trac.edgewall.org/ .. _Django: http://www.djangoproject.com/ :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from warnings import warn from werkzeug.wsgi import LimitedStream class StreamLimitMiddleware(object): """Limits the input stream to a given number of bytes. This is useful if you have a WSGI application that reads form data into memory (django for example) and you don't want users to harm the server by uploading tons of data. Default is 10MB .. versionchanged:: 0.9 Deprecated middleware. """ def __init__(self, app, maximum_size=1024 * 1024 * 10): warn(DeprecationWarning('This middleware is deprecated')) self.app = app self.maximum_size = maximum_size def __call__(self, environ, start_response): limit = min(self.maximum_size, int(environ.get('CONTENT_LENGTH') or 0)) environ['wsgi.input'] = LimitedStream(environ['wsgi.input'], limit) return self.app(environ, start_response)
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 272, 10380, 14, 2828, 14, 7919, 272, 18294, 4919, 339, 437, 10816, 626, 10976, 12467, 666, 14, 221, 961, 5419, 6818, 8826, 543, 272, 377, 6457, 63, 503, 5634, 63, 2952, 5204, 5370, 2547, 1901, 314, 4402, 14, 339, 2508, 485, 2437, 67, 26, 1455, 921, 23047, 14, 5173, 7567, 14, 1308, 15, 272, 2508, 485, 9323, 26, 1455, 921, 1544, 14, 14013, 14, 957, 15, 339, 520, 7307, 26, 334, 67, 9, 6927, 701, 314, 22798, 11682, 12, 1937, 10610, 367, 1655, 2436, 14, 272, 520, 1682, 26, 6289, 12, 1937, 5113, 367, 1655, 2436, 14, 199, 624, 199, 504, 3598, 492, 7987, 199, 199, 504, 10380, 14, 6508, 492, 23954, 3296, 421, 199, 533, 8271, 8407, 6608, 8, 785, 304, 272, 408, 24480, 314, 1324, 2547, 370, 282, 1627, 1329, 402, 2783, 14, 221, 961, 365, 2997, 340, 272, 1265, 1172, 282, 9279, 4223, 626, 11597, 1824, 666, 1901, 4402, 334, 1176, 367, 272, 2893, 9, 436, 1265, 2793, 1133, 2934, 4390, 370, 394, 5362, 314, 1654, 701, 24349, 307, 4654, 402, 272, 666, 14, 339, 3758, 365, 1616, 4567, 339, 2508, 16434, 447, 378, 14, 25, 2126, 17993, 10816, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1145, 12, 5696, 63, 890, 29, 7727, 627, 6619, 627, 1616, 304, 267, 7987, 8, 15561, 360, 2765, 10816, 365, 5906, 1333, 267, 291, 14, 571, 275, 1145, 267, 291, 14, 11555, 63, 890, 275, 5696, 63, 890, 339, 347, 636, 1250, 721, 277, 12, 6160, 12, 1343, 63, 1310, 304, 267, 2304, 275, 1748, 8, 277, 14, 11555, 63, 890, 12, 1109, 8, 2314, 14, 362, 360, 9663, 63, 9127, 358, 503, 378, 430, 267, 6160, 459, 6508, 14, 1210, 418, 275, 23954, 3296, 8, 2314, 459, 6508, 14, 1210, 995, 2304, 9, 267, 372, 291, 14, 571, 8, 2314, 12, 1343, 63, 1310, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 272, 10380, 14, 2828, 14, 7919, 272, 18294, 4919, 339, 437, 10816, 626, 10976, 12467, 666, 14, 221, 961, 5419, 6818, 8826, 543, 272, 377, 6457, 63, 503, 5634, 63, 2952, 5204, 5370, 2547, 1901, 314, 4402, 14, 339, 2508, 485, 2437, 67, 26, 1455, 921, 23047, 14, 5173, 7567, 14, 1308, 15, 272, 2508, 485, 9323, 26, 1455, 921, 1544, 14, 14013, 14, 957, 15, 339, 520, 7307, 26, 334, 67, 9, 6927, 701, 314, 22798, 11682, 12, 1937, 10610, 367, 1655, 2436, 14, 272, 520, 1682, 26, 6289, 12, 1937, 5113, 367, 1655, 2436, 14, 199, 624, 199, 504, 3598, 492, 7987, 199, 199, 504, 10380, 14, 6508, 492, 23954, 3296, 421, 199, 533, 8271, 8407, 6608, 8, 785, 304, 272, 408, 24480, 314, 1324, 2547, 370, 282, 1627, 1329, 402, 2783, 14, 221, 961, 365, 2997, 340, 272, 1265, 1172, 282, 9279, 4223, 626, 11597, 1824, 666, 1901, 4402, 334, 1176, 367, 272, 2893, 9, 436, 1265, 2793, 1133, 2934, 4390, 370, 394, 5362, 314, 1654, 701, 24349, 307, 4654, 402, 272, 666, 14, 339, 3758, 365, 1616, 4567, 339, 2508, 16434, 447, 378, 14, 25, 2126, 17993, 10816, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1145, 12, 5696, 63, 890, 29, 7727, 627, 6619, 627, 1616, 304, 267, 7987, 8, 15561, 360, 2765, 10816, 365, 5906, 1333, 267, 291, 14, 571, 275, 1145, 267, 291, 14, 11555, 63, 890, 275, 5696, 63, 890, 339, 347, 636, 1250, 721, 277, 12, 6160, 12, 1343, 63, 1310, 304, 267, 2304, 275, 1748, 8, 277, 14, 11555, 63, 890, 12, 1109, 8, 2314, 14, 362, 360, 9663, 63, 9127, 358, 503, 378, 430, 267, 6160, 459, 6508, 14, 1210, 418, 275, 23954, 3296, 8, 2314, 459, 6508, 14, 1210, 995, 2304, 9, 267, 372, 291, 14, 571, 8, 2314, 12, 1343, 63, 1310, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
mfcabrera/luigi
luigi/tools/deps.py
12
4701
#!/usr/bin/env python # Finds all tasks and task outputs on the dependency paths from the given downstream task T # up to the given source/upstream task S (optional). If the upstream task is not given, # all upstream tasks on all dependancy paths of T will be returned. # Terms: # if the execution of Task T depends on the output of task S on a dependancy graph, # T is called a downstream/sink task, S is called an upstream/source task. # This is useful and practical way to find all upstream tasks of task T. # For example suppose you have a daily computation that starts with a task named Daily. # And suppose you have another task named Aggregate. Daily triggers a few tasks # which eventually trigger Aggregate. Now, suppose you find a bug in Aggregate. # You fixed the bug and now you want to rerun it, including all it's upstream deps. # # To do that you run: # bin/deps.py --module daily_module Aggregate --daily-param1 xxx --upstream-family Daily # # This will output all the tasks on the dependency path between Daily and Aggregate. In # effect, this is how you find all upstream tasks for Aggregate. Now you can delete its # output and run Aggregate again. Daily will eventually trigget Aggregate and all tasks on # the way. # # The same code here might be used as a CLI tool as well as a python module. # In python, invoke find_deps(task, upstream_name) to get a set of all task instances on the # paths between task T and upstream task S. You can then use the task instances to delete their output or # perform other computation based on that. # # Example: # # PYTHONPATH=$PYTHONPATH:/path/to/your/luigi/tasks bin/deps.py \ # --module my.tasks MyDownstreamTask # --downstream_task_param1 123456 # [--upstream-family MyUpstreamTask] # from __future__ import print_function import luigi.interface from luigi.contrib.ssh import RemoteTarget from luigi.postgres import PostgresTarget from luigi.s3 import S3Target from luigi.target import FileSystemTarget from luigi.task import flatten from luigi import parameter import sys from luigi.cmdline_parser import CmdlineParser import collections def get_task_requires(task): return set(flatten(task.requires())) def dfs_paths(start_task, goal_task_family, path=None): if path is None: path = [start_task] if start_task.task_family == goal_task_family or goal_task_family is None: for item in path: yield item for next in get_task_requires(start_task) - set(path): for t in dfs_paths(next, goal_task_family, path + [next]): yield t class upstream(luigi.task.Config): ''' Used to provide the parameter upstream-family ''' family = parameter.Parameter(default=None) def find_deps(task, upstream_task_family): ''' Finds all dependencies that start with the given task and have a path to upstream_task_family Returns all deps on all paths between task and upstream ''' return set([t for t in dfs_paths(task, upstream_task_family)]) def find_deps_cli(): ''' Finds all tasks on all paths from provided CLI task ''' cmdline_args = sys.argv[1:] with CmdlineParser.global_instance(cmdline_args) as cp: return find_deps(cp.get_task_obj(), upstream().family) def get_task_output_description(task_output): ''' Returns a task's output as a string ''' output_description = "n/a" if isinstance(task_output, RemoteTarget): output_description = "[SSH] {0}:{1}".format(task_output._fs.remote_context.host, task_output.path) elif isinstance(task_output, S3Target): output_description = "[S3] {0}".format(task_output.path) elif isinstance(task_output, FileSystemTarget): output_description = "[FileSystem] {0}".format(task_output.path) elif isinstance(task_output, PostgresTarget): output_description = "[DB] {0}:{1}".format(task_output.host, task_output.table) else: output_description = "to be determined" return output_description def main(): deps = find_deps_cli() for task in deps: task_output = task.output() if isinstance(task_output, dict): output_descriptions = [get_task_output_description(output) for label, output in task_output.items()] elif isinstance(task_output, collections.Iterable): output_descriptions = [get_task_output_description(output) for output in task_output] else: output_descriptions = [get_task_output_description(task_output)] print(" TASK: {0}".format(task)) for desc in output_descriptions: print(" : {0}".format(desc)) if __name__ == '__main__': main()
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 421, 199, 3, 31434, 1006, 6527, 436, 2120, 4704, 641, 314, 5936, 3792, 687, 314, 1627, 3224, 1745, 2120, 377, 199, 3, 1536, 370, 314, 1627, 1350, 15, 20099, 2120, 428, 334, 4144, 680, 982, 314, 18932, 2120, 365, 440, 1627, 12, 199, 3, 1006, 18932, 6527, 641, 1006, 11687, 9844, 3792, 402, 377, 911, 506, 2138, 14, 199, 199, 3, 13861, 706, 26, 199, 3, 340, 221, 314, 6451, 402, 8495, 377, 8350, 641, 314, 1072, 402, 2120, 428, 641, 282, 11687, 9844, 3343, 12, 199, 3, 221, 377, 365, 2797, 282, 3224, 1745, 15, 11279, 2120, 12, 428, 365, 2797, 376, 18932, 15, 1365, 2120, 14, 199, 199, 3, 961, 365, 2997, 436, 20594, 3294, 4340, 370, 2342, 1006, 18932, 6527, 402, 2120, 377, 14, 199, 3, 2104, 2893, 1029, 4070, 1265, 1172, 282, 26122, 14009, 626, 9174, 543, 282, 2120, 4310, 577, 17550, 14, 199, 3, 6061, 1029, 4070, 1265, 1172, 4573, 2120, 4310, 29397, 14, 577, 17550, 18899, 282, 9284, 6527, 199, 3, 1314, 21356, 6804, 29397, 14, 7356, 12, 1029, 4070, 1265, 2342, 282, 6519, 315, 29397, 14, 199, 3, 2047, 6317, 314, 6519, 436, 3063, 1265, 2934, 370, 295, 1065, 652, 12, 5893, 1006, 652, 1159, 18932, 10140, 14, 199, 3, 199, 3, 4005, 886, 626, 1265, 1255, 26, 199, 3, 420, 2517, 15, 5846, 14, 647, 1553, 578, 26122, 63, 578, 29397, 1553, 18621, 13, 635, 17, 26571, 1553, 20099, 13, 6606, 577, 17550, 199, 3, 199, 3, 961, 911, 1072, 1006, 314, 6527, 641, 314, 5936, 931, 3382, 577, 17550, 436, 29397, 14, 1010, 199, 3, 7763, 12, 642, 365, 4212, 1265, 2342, 1006, 18932, 6527, 367, 29397, 14, 7356, 1265, 883, 3145, 2399, 199, 3, 1072, 436, 1255, 29397, 4020, 14, 577, 17550, 911, 21356, 3229, 71, 362, 29397, 436, 1006, 6527, 641, 199, 3, 314, 4340, 14, 199, 3, 199, 3, 710, 2011, 1233, 2348, 5594, 506, 1202, 465, 282, 14214, 4744, 465, 5521, 465, 282, 2366, 859, 14, 199, 3, 1010, 2366, 12, 12677, 2342, 63, 5846, 8, 1765, 12, 18932, 63, 354, 9, 370, 664, 282, 663, 402, 1006, 2120, 4454, 641, 314, 199, 3, 3792, 3382, 2120, 377, 436, 18932, 2120, 428, 14, 2047, 883, 2066, 675, 314, 2120, 4454, 370, 3145, 3932, 1072, 503, 199, 3, 5147, 1163, 14009, 4079, 641, 626, 14, 199, 3, 199, 3, 5679, 26, 199, 3, 199, 3, 31176, 28617, 29266, 11254, 515, 15, 475, 15, 12695, 15, 26795, 15, 5054, 2517, 15, 5846, 14, 647, 971, 199, 3, 1553, 578, 3002, 14, 5054, 221, 4932, 3514, 1745, 4476, 199, 3, 1553, 2110, 1745, 63, 1765, 63, 635, 17, 14763, 1367, 199, 3, 19344, 20099, 13, 6606, 4932, 1721, 1745, 4476, 61, 199, 3, 421, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 19485, 14, 3266, 199, 504, 19485, 14, 2828, 14, 5510, 492, 17283, 4277, 199, 504, 19485, 14, 10675, 492, 7711, 7266, 4277, 199, 504, 19485, 14, 83, 19, 492, 428, 19, 4277, 199, 504, 19485, 14, 1375, 492, 23754, 4277, 199, 504, 19485, 14, 1765, 492, 9378, 199, 504, 19485, 492, 2725, 199, 646, 984, 199, 504, 19485, 14, 15612, 63, 2087, 492, 26005, 604, 2842, 199, 646, 5055, 421, 199, 318, 664, 63, 1765, 63, 6537, 8, 1765, 304, 272, 372, 663, 8, 8487, 8, 1765, 14, 6537, 4059, 421, 199, 318, 366, 2319, 63, 3771, 8, 928, 63, 1765, 12, 14850, 63, 1765, 63, 6606, 12, 931, 29, 403, 304, 272, 340, 931, 365, 488, 26, 267, 931, 275, 359, 928, 63, 1765, 61, 272, 340, 1343, 63, 1765, 14, 1765, 63, 6606, 508, 14850, 63, 1765, 63, 6606, 503, 14850, 63, 1765, 63, 6606, 365, 488, 26, 267, 367, 1242, 315, 931, 26, 288, 1995, 1242, 272, 367, 2163, 315, 664, 63, 1765, 63, 6537, 8, 928, 63, 1765, 9, 446, 663, 8, 515, 304, 267, 367, 307, 315, 366, 2319, 63, 3771, 8, 2184, 12, 14850, 63, 1765, 63, 6606, 12, 931, 435, 359, 2184, 4682, 288, 1995, 307, 421, 199, 533, 18932, 8, 26795, 14, 1765, 14, 2028, 304, 272, 1449, 272, 8051, 370, 5647, 314, 2725, 18932, 13, 6606, 272, 1449, 272, 9614, 275, 2725, 14, 4720, 8, 885, 29, 403, 9, 421, 199, 318, 2342, 63, 5846, 8, 1765, 12, 18932, 63, 1765, 63, 6606, 304, 272, 1449, 272, 31434, 1006, 5124, 626, 1343, 543, 314, 1627, 2120, 436, 1172, 282, 931, 272, 370, 18932, 63, 1765, 63, 6606, 339, 1803, 1006, 10140, 641, 1006, 3792, 3382, 2120, 436, 18932, 272, 1449, 272, 372, 663, 779, 84, 367, 307, 315, 366, 2319, 63, 3771, 8, 1765, 12, 18932, 63, 1765, 63, 6606, 3948, 421, 199, 318, 2342, 63, 5846, 63, 2764, 837, 272, 1449, 272, 31434, 1006, 6527, 641, 1006, 3792, 687, 2741, 14214, 2120, 272, 1449, 272, 21206, 63, 589, 275, 984, 14, 3020, 59, 17, 2938, 272, 543, 26005, 604, 2842, 14, 2966, 63, 842, 8, 15612, 63, 589, 9, 465, 7667, 26, 267, 372, 2342, 63, 5846, 8, 1850, 14, 362, 63, 1765, 63, 1113, 1062, 18932, 1252, 6606, 9, 421, 199, 318, 664, 63, 1765, 63, 1199, 63, 1802, 8, 1765, 63, 1199, 304, 272, 1449, 272, 1803, 282, 2120, 1159, 1072, 465, 282, 1059, 272, 1449, 272, 1072, 63, 1802, 275, 298, 78, 15, 65, 2, 339, 340, 1228, 8, 1765, 63, 1199, 12, 17283, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 13716, 61, 469, 16, 16495, 17, 5469, 908, 8, 1765, 63, 1199, 423, 2319, 14, 3846, 63, 1100, 14, 1102, 12, 2120, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 428, 19, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 51, 19, 61, 469, 16, 5469, 908, 8, 1765, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 23754, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 17521, 61, 469, 16, 5469, 908, 8, 1765, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 7711, 7266, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 2846, 61, 469, 16, 16495, 17, 5469, 908, 8, 1765 ]
[ 2647, 15, 1393, 15, 1813, 2366, 421, 199, 3, 31434, 1006, 6527, 436, 2120, 4704, 641, 314, 5936, 3792, 687, 314, 1627, 3224, 1745, 2120, 377, 199, 3, 1536, 370, 314, 1627, 1350, 15, 20099, 2120, 428, 334, 4144, 680, 982, 314, 18932, 2120, 365, 440, 1627, 12, 199, 3, 1006, 18932, 6527, 641, 1006, 11687, 9844, 3792, 402, 377, 911, 506, 2138, 14, 199, 199, 3, 13861, 706, 26, 199, 3, 340, 221, 314, 6451, 402, 8495, 377, 8350, 641, 314, 1072, 402, 2120, 428, 641, 282, 11687, 9844, 3343, 12, 199, 3, 221, 377, 365, 2797, 282, 3224, 1745, 15, 11279, 2120, 12, 428, 365, 2797, 376, 18932, 15, 1365, 2120, 14, 199, 199, 3, 961, 365, 2997, 436, 20594, 3294, 4340, 370, 2342, 1006, 18932, 6527, 402, 2120, 377, 14, 199, 3, 2104, 2893, 1029, 4070, 1265, 1172, 282, 26122, 14009, 626, 9174, 543, 282, 2120, 4310, 577, 17550, 14, 199, 3, 6061, 1029, 4070, 1265, 1172, 4573, 2120, 4310, 29397, 14, 577, 17550, 18899, 282, 9284, 6527, 199, 3, 1314, 21356, 6804, 29397, 14, 7356, 12, 1029, 4070, 1265, 2342, 282, 6519, 315, 29397, 14, 199, 3, 2047, 6317, 314, 6519, 436, 3063, 1265, 2934, 370, 295, 1065, 652, 12, 5893, 1006, 652, 1159, 18932, 10140, 14, 199, 3, 199, 3, 4005, 886, 626, 1265, 1255, 26, 199, 3, 420, 2517, 15, 5846, 14, 647, 1553, 578, 26122, 63, 578, 29397, 1553, 18621, 13, 635, 17, 26571, 1553, 20099, 13, 6606, 577, 17550, 199, 3, 199, 3, 961, 911, 1072, 1006, 314, 6527, 641, 314, 5936, 931, 3382, 577, 17550, 436, 29397, 14, 1010, 199, 3, 7763, 12, 642, 365, 4212, 1265, 2342, 1006, 18932, 6527, 367, 29397, 14, 7356, 1265, 883, 3145, 2399, 199, 3, 1072, 436, 1255, 29397, 4020, 14, 577, 17550, 911, 21356, 3229, 71, 362, 29397, 436, 1006, 6527, 641, 199, 3, 314, 4340, 14, 199, 3, 199, 3, 710, 2011, 1233, 2348, 5594, 506, 1202, 465, 282, 14214, 4744, 465, 5521, 465, 282, 2366, 859, 14, 199, 3, 1010, 2366, 12, 12677, 2342, 63, 5846, 8, 1765, 12, 18932, 63, 354, 9, 370, 664, 282, 663, 402, 1006, 2120, 4454, 641, 314, 199, 3, 3792, 3382, 2120, 377, 436, 18932, 2120, 428, 14, 2047, 883, 2066, 675, 314, 2120, 4454, 370, 3145, 3932, 1072, 503, 199, 3, 5147, 1163, 14009, 4079, 641, 626, 14, 199, 3, 199, 3, 5679, 26, 199, 3, 199, 3, 31176, 28617, 29266, 11254, 515, 15, 475, 15, 12695, 15, 26795, 15, 5054, 2517, 15, 5846, 14, 647, 971, 199, 3, 1553, 578, 3002, 14, 5054, 221, 4932, 3514, 1745, 4476, 199, 3, 1553, 2110, 1745, 63, 1765, 63, 635, 17, 14763, 1367, 199, 3, 19344, 20099, 13, 6606, 4932, 1721, 1745, 4476, 61, 199, 3, 421, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 19485, 14, 3266, 199, 504, 19485, 14, 2828, 14, 5510, 492, 17283, 4277, 199, 504, 19485, 14, 10675, 492, 7711, 7266, 4277, 199, 504, 19485, 14, 83, 19, 492, 428, 19, 4277, 199, 504, 19485, 14, 1375, 492, 23754, 4277, 199, 504, 19485, 14, 1765, 492, 9378, 199, 504, 19485, 492, 2725, 199, 646, 984, 199, 504, 19485, 14, 15612, 63, 2087, 492, 26005, 604, 2842, 199, 646, 5055, 421, 199, 318, 664, 63, 1765, 63, 6537, 8, 1765, 304, 272, 372, 663, 8, 8487, 8, 1765, 14, 6537, 4059, 421, 199, 318, 366, 2319, 63, 3771, 8, 928, 63, 1765, 12, 14850, 63, 1765, 63, 6606, 12, 931, 29, 403, 304, 272, 340, 931, 365, 488, 26, 267, 931, 275, 359, 928, 63, 1765, 61, 272, 340, 1343, 63, 1765, 14, 1765, 63, 6606, 508, 14850, 63, 1765, 63, 6606, 503, 14850, 63, 1765, 63, 6606, 365, 488, 26, 267, 367, 1242, 315, 931, 26, 288, 1995, 1242, 272, 367, 2163, 315, 664, 63, 1765, 63, 6537, 8, 928, 63, 1765, 9, 446, 663, 8, 515, 304, 267, 367, 307, 315, 366, 2319, 63, 3771, 8, 2184, 12, 14850, 63, 1765, 63, 6606, 12, 931, 435, 359, 2184, 4682, 288, 1995, 307, 421, 199, 533, 18932, 8, 26795, 14, 1765, 14, 2028, 304, 272, 1449, 272, 8051, 370, 5647, 314, 2725, 18932, 13, 6606, 272, 1449, 272, 9614, 275, 2725, 14, 4720, 8, 885, 29, 403, 9, 421, 199, 318, 2342, 63, 5846, 8, 1765, 12, 18932, 63, 1765, 63, 6606, 304, 272, 1449, 272, 31434, 1006, 5124, 626, 1343, 543, 314, 1627, 2120, 436, 1172, 282, 931, 272, 370, 18932, 63, 1765, 63, 6606, 339, 1803, 1006, 10140, 641, 1006, 3792, 3382, 2120, 436, 18932, 272, 1449, 272, 372, 663, 779, 84, 367, 307, 315, 366, 2319, 63, 3771, 8, 1765, 12, 18932, 63, 1765, 63, 6606, 3948, 421, 199, 318, 2342, 63, 5846, 63, 2764, 837, 272, 1449, 272, 31434, 1006, 6527, 641, 1006, 3792, 687, 2741, 14214, 2120, 272, 1449, 272, 21206, 63, 589, 275, 984, 14, 3020, 59, 17, 2938, 272, 543, 26005, 604, 2842, 14, 2966, 63, 842, 8, 15612, 63, 589, 9, 465, 7667, 26, 267, 372, 2342, 63, 5846, 8, 1850, 14, 362, 63, 1765, 63, 1113, 1062, 18932, 1252, 6606, 9, 421, 199, 318, 664, 63, 1765, 63, 1199, 63, 1802, 8, 1765, 63, 1199, 304, 272, 1449, 272, 1803, 282, 2120, 1159, 1072, 465, 282, 1059, 272, 1449, 272, 1072, 63, 1802, 275, 298, 78, 15, 65, 2, 339, 340, 1228, 8, 1765, 63, 1199, 12, 17283, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 13716, 61, 469, 16, 16495, 17, 5469, 908, 8, 1765, 63, 1199, 423, 2319, 14, 3846, 63, 1100, 14, 1102, 12, 2120, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 428, 19, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 51, 19, 61, 469, 16, 5469, 908, 8, 1765, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 23754, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 17521, 61, 469, 16, 5469, 908, 8, 1765, 63, 1199, 14, 515, 9, 272, 916, 1228, 8, 1765, 63, 1199, 12, 7711, 7266, 4277, 304, 267, 1072, 63, 1802, 275, 7369, 2846, 61, 469, 16, 16495, 17, 5469, 908, 8, 1765, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
angryrancor/kivy
examples/android/takepicture/main.py
38
2522
''' Take picture ============ .. author:: Mathieu Virbel <mat@kivy.org> Little example to demonstrate how to start an Intent, and get the result. When you use the Android.startActivityForResult(), the result will be dispatched into onActivityResult. You can catch the event with the android.activity API from python-for-android project. If you want to compile it, don't forget to add the CAMERA permission:: ./build.py --name 'TakePicture' --package org.test.takepicture \ --permission CAMERA --version 1 \ --private ~/code/kivy/examples/android/takepicture \ debug installd ''' __version__ = '0.1' from kivy.app import App from os.path import exists from jnius import autoclass, cast from android import activity from functools import partial from kivy.clock import Clock from kivy.uix.scatter import Scatter from kivy.properties import StringProperty from PIL import Image Intent = autoclass('android.content.Intent') PythonActivity = autoclass('org.renpy.android.PythonActivity') MediaStore = autoclass('android.provider.MediaStore') Uri = autoclass('android.net.Uri') Environment = autoclass('android.os.Environment') class Picture(Scatter): source = StringProperty(None) class TakePictureApp(App): def build(self): self.index = 0 activity.bind(on_activity_result=self.on_activity_result) def get_filename(self): while True: self.index += 1 fn = (Environment.getExternalStorageDirectory().getPath() + '/takepicture{}.jpg'.format(self.index)) if not exists(fn): return fn def take_picture(self): intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) self.last_fn = self.get_filename() self.uri = Uri.parse('file://' + self.last_fn) self.uri = cast('android.os.Parcelable', self.uri) intent.putExtra(MediaStore.EXTRA_OUTPUT, self.uri) PythonActivity.mActivity.startActivityForResult(intent, 0x123) def on_activity_result(self, requestCode, resultCode, intent): if requestCode == 0x123: Clock.schedule_once(partial(self.add_picture, self.last_fn), 0) def add_picture(self, fn, *args): im = Image.open(fn) width, height = im.size im.thumbnail((width / 4, height / 4), Image.ANTIALIAS) im.save(fn, quality=95) self.root.add_widget(Picture(source=fn, center=self.root.center)) def on_pause(self): return True TakePictureApp().run()
mit
[ 2344, 199, 27200, 24945, 199, 5769, 199, 199, 703, 4132, 447, 21066, 29364, 812, 723, 20621, 665, 569, 32, 16941, 14, 1308, 30, 199, 199, 44, 390, 1118, 2893, 370, 23789, 18161, 4212, 370, 1343, 376, 1010, 767, 12, 436, 664, 314, 754, 14, 199, 11423, 1265, 675, 314, 14694, 14, 928, 14350, 1858, 2889, 1062, 314, 754, 911, 506, 7634, 379, 199, 9924, 641, 14350, 2889, 14, 2047, 883, 8579, 314, 1566, 543, 314, 15516, 14, 8240, 3261, 199, 504, 2366, 13, 509, 13, 6238, 2199, 14, 199, 199, 3917, 1265, 2934, 370, 6555, 652, 12, 2793, 1133, 19459, 370, 1050, 314, 445, 1156, 540, 33, 4983, 447, 339, 16605, 1506, 14, 647, 1553, 354, 283, 27200, 29439, 7, 1553, 2491, 5981, 14, 396, 14, 11066, 12538, 971, 288, 1553, 5693, 445, 1156, 540, 33, 1553, 1023, 413, 971, 288, 1553, 4239, 6146, 15, 600, 15, 16941, 15, 8589, 15, 6238, 15, 11066, 12538, 971, 288, 3105, 3907, 68, 199, 199, 2344, 199, 199, 363, 1023, 363, 275, 283, 16, 14, 17, 7, 199, 199, 504, 17227, 14, 571, 492, 4693, 199, 504, 747, 14, 515, 492, 3495, 199, 504, 1335, 8445, 527, 492, 2599, 533, 12, 9106, 199, 504, 15516, 492, 10679, 199, 504, 9143, 492, 7417, 199, 504, 17227, 14, 9597, 492, 32425, 199, 504, 17227, 14, 24263, 14, 13512, 492, 428, 20569, 199, 504, 17227, 14, 3282, 492, 2624, 3697, 199, 199, 504, 14937, 492, 6047, 199, 199, 607, 767, 275, 2599, 533, 360, 6238, 14, 1317, 14, 607, 767, 358, 199, 4718, 14350, 275, 2599, 533, 360, 1308, 14, 828, 647, 14, 6238, 14, 4718, 14350, 358, 199, 11398, 5502, 275, 2599, 533, 360, 6238, 14, 3780, 14, 11398, 5502, 358, 199, 14014, 275, 2599, 533, 360, 6238, 14, 846, 14, 14014, 358, 199, 8263, 275, 2599, 533, 360, 6238, 14, 736, 14, 8263, 358, 421, 199, 533, 19835, 5722, 8, 51, 20569, 304, 272, 1350, 275, 2624, 3697, 8, 403, 9, 421, 199, 533, 18146, 29439, 2640, 8, 2640, 304, 272, 347, 1900, 8, 277, 304, 267, 291, 14, 1080, 275, 378, 267, 10679, 14, 3409, 8, 265, 63, 8240, 63, 1099, 29, 277, 14, 265, 63, 8240, 63, 1099, 9, 339, 347, 664, 63, 1501, 8, 277, 304, 267, 1830, 715, 26, 288, 291, 14, 1080, 847, 413, 288, 4325, 275, 334, 8263, 14, 362, 11389, 6408, 6231, 1252, 362, 2042, 342, 435, 2116, 1994, 11066, 12538, 31270, 8476, 1370, 908, 8, 277, 14, 1080, 430, 288, 340, 440, 3495, 8, 2324, 304, 355, 372, 4325, 339, 347, 5452, 63, 12538, 8, 277, 304, 267, 21020, 275, 1010, 767, 8, 11398, 5502, 14, 10052, 63, 9438, 63, 28342, 3942, 9, 267, 291, 14, 2019, 63, 2324, 275, 291, 14, 362, 63, 1501, 342, 267, 291, 14, 2302, 275, 738, 322, 14, 1122, 360, 493, 22399, 435, 291, 14, 2019, 63, 2324, 9, 267, 291, 14, 2302, 275, 9106, 360, 6238, 14, 736, 14, 1262, 6067, 461, 297, 291, 14, 2302, 9, 267, 21020, 14, 524, 7426, 8, 11398, 5502, 14, 18555, 63, 8414, 12, 291, 14, 2302, 9, 267, 2018, 14350, 14, 77, 14350, 14, 928, 14350, 1858, 2889, 8, 17456, 12, 378, 88, 4288, 9, 339, 347, 641, 63, 8240, 63, 1099, 8, 277, 12, 1056, 3034, 12, 754, 3034, 12, 21020, 304, 267, 340, 1056, 3034, 508, 378, 88, 4288, 26, 288, 32425, 14, 7211, 63, 5089, 8, 6672, 8, 277, 14, 525, 63, 12538, 12, 291, 14, 2019, 63, 2324, 395, 378, 9, 339, 347, 1050, 63, 12538, 8, 277, 12, 4325, 12, 627, 589, 304, 267, 3416, 275, 6047, 14, 1490, 8, 2324, 9, 267, 3462, 12, 4569, 275, 3416, 14, 890, 267, 3416, 14, 8311, 1332, 2063, 1182, 841, 12, 4569, 1182, 841, 395, 6047, 14, 1441, 4938, 11352, 9, 267, 3416, 14, 2117, 8, 2324, 12, 11030, 29, 2720, 9, 267, 291, 14, 1231, 14, 525, 63, 3440, 8, 29439, 8, 1365, 29, 2324, 12, 8126, 29, 277, 14, 1231, 14, 4218, 430, 339, 347, 641, 63, 11241, 8, 277, 304, 267, 372, 715, 199, 199, 27200, 29439, 2640, 1252, 1065, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 27200, 24945, 199, 5769, 199, 199, 703, 4132, 447, 21066, 29364, 812, 723, 20621, 665, 569, 32, 16941, 14, 1308, 30, 199, 199, 44, 390, 1118, 2893, 370, 23789, 18161, 4212, 370, 1343, 376, 1010, 767, 12, 436, 664, 314, 754, 14, 199, 11423, 1265, 675, 314, 14694, 14, 928, 14350, 1858, 2889, 1062, 314, 754, 911, 506, 7634, 379, 199, 9924, 641, 14350, 2889, 14, 2047, 883, 8579, 314, 1566, 543, 314, 15516, 14, 8240, 3261, 199, 504, 2366, 13, 509, 13, 6238, 2199, 14, 199, 199, 3917, 1265, 2934, 370, 6555, 652, 12, 2793, 1133, 19459, 370, 1050, 314, 445, 1156, 540, 33, 4983, 447, 339, 16605, 1506, 14, 647, 1553, 354, 283, 27200, 29439, 7, 1553, 2491, 5981, 14, 396, 14, 11066, 12538, 971, 288, 1553, 5693, 445, 1156, 540, 33, 1553, 1023, 413, 971, 288, 1553, 4239, 6146, 15, 600, 15, 16941, 15, 8589, 15, 6238, 15, 11066, 12538, 971, 288, 3105, 3907, 68, 199, 199, 2344, 199, 199, 363, 1023, 363, 275, 283, 16, 14, 17, 7, 199, 199, 504, 17227, 14, 571, 492, 4693, 199, 504, 747, 14, 515, 492, 3495, 199, 504, 1335, 8445, 527, 492, 2599, 533, 12, 9106, 199, 504, 15516, 492, 10679, 199, 504, 9143, 492, 7417, 199, 504, 17227, 14, 9597, 492, 32425, 199, 504, 17227, 14, 24263, 14, 13512, 492, 428, 20569, 199, 504, 17227, 14, 3282, 492, 2624, 3697, 199, 199, 504, 14937, 492, 6047, 199, 199, 607, 767, 275, 2599, 533, 360, 6238, 14, 1317, 14, 607, 767, 358, 199, 4718, 14350, 275, 2599, 533, 360, 1308, 14, 828, 647, 14, 6238, 14, 4718, 14350, 358, 199, 11398, 5502, 275, 2599, 533, 360, 6238, 14, 3780, 14, 11398, 5502, 358, 199, 14014, 275, 2599, 533, 360, 6238, 14, 846, 14, 14014, 358, 199, 8263, 275, 2599, 533, 360, 6238, 14, 736, 14, 8263, 358, 421, 199, 533, 19835, 5722, 8, 51, 20569, 304, 272, 1350, 275, 2624, 3697, 8, 403, 9, 421, 199, 533, 18146, 29439, 2640, 8, 2640, 304, 272, 347, 1900, 8, 277, 304, 267, 291, 14, 1080, 275, 378, 267, 10679, 14, 3409, 8, 265, 63, 8240, 63, 1099, 29, 277, 14, 265, 63, 8240, 63, 1099, 9, 339, 347, 664, 63, 1501, 8, 277, 304, 267, 1830, 715, 26, 288, 291, 14, 1080, 847, 413, 288, 4325, 275, 334, 8263, 14, 362, 11389, 6408, 6231, 1252, 362, 2042, 342, 435, 2116, 1994, 11066, 12538, 31270, 8476, 1370, 908, 8, 277, 14, 1080, 430, 288, 340, 440, 3495, 8, 2324, 304, 355, 372, 4325, 339, 347, 5452, 63, 12538, 8, 277, 304, 267, 21020, 275, 1010, 767, 8, 11398, 5502, 14, 10052, 63, 9438, 63, 28342, 3942, 9, 267, 291, 14, 2019, 63, 2324, 275, 291, 14, 362, 63, 1501, 342, 267, 291, 14, 2302, 275, 738, 322, 14, 1122, 360, 493, 22399, 435, 291, 14, 2019, 63, 2324, 9, 267, 291, 14, 2302, 275, 9106, 360, 6238, 14, 736, 14, 1262, 6067, 461, 297, 291, 14, 2302, 9, 267, 21020, 14, 524, 7426, 8, 11398, 5502, 14, 18555, 63, 8414, 12, 291, 14, 2302, 9, 267, 2018, 14350, 14, 77, 14350, 14, 928, 14350, 1858, 2889, 8, 17456, 12, 378, 88, 4288, 9, 339, 347, 641, 63, 8240, 63, 1099, 8, 277, 12, 1056, 3034, 12, 754, 3034, 12, 21020, 304, 267, 340, 1056, 3034, 508, 378, 88, 4288, 26, 288, 32425, 14, 7211, 63, 5089, 8, 6672, 8, 277, 14, 525, 63, 12538, 12, 291, 14, 2019, 63, 2324, 395, 378, 9, 339, 347, 1050, 63, 12538, 8, 277, 12, 4325, 12, 627, 589, 304, 267, 3416, 275, 6047, 14, 1490, 8, 2324, 9, 267, 3462, 12, 4569, 275, 3416, 14, 890, 267, 3416, 14, 8311, 1332, 2063, 1182, 841, 12, 4569, 1182, 841, 395, 6047, 14, 1441, 4938, 11352, 9, 267, 3416, 14, 2117, 8, 2324, 12, 11030, 29, 2720, 9, 267, 291, 14, 1231, 14, 525, 63, 3440, 8, 29439, 8, 1365, 29, 2324, 12, 8126, 29, 277, 14, 1231, 14, 4218, 430, 339, 347, 641, 63, 11241, 8, 277, 304, 267, 372, 715, 199, 199, 27200, 29439, 2640, 1252, 1065, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
TheTypoMaster/linux-pm
tools/perf/scripts/python/sctop.py
1996
2102
# system call top # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Periodically displays system-wide system call totals, broken down by # syscall. If a [comm] arg is specified, only syscalls called by # [comm] are displayed. If an [interval] arg is specified, the display # will be refreshed every [interval] seconds. The default interval is # 3 seconds. import os, sys, thread, time sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * from Util import * usage = "perf script -s sctop.py [comm] [interval]\n"; for_comm = None default_interval = 3 interval = default_interval if len(sys.argv) > 3: sys.exit(usage) if len(sys.argv) > 2: for_comm = sys.argv[1] interval = int(sys.argv[2]) elif len(sys.argv) > 1: try: interval = int(sys.argv[1]) except ValueError: for_comm = sys.argv[1] interval = default_interval syscalls = autodict() def trace_begin(): thread.start_new_thread(print_syscall_totals, (interval,)) pass def raw_syscalls__sys_enter(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, common_callchain, id, args): if for_comm is not None: if common_comm != for_comm: return try: syscalls[id] += 1 except TypeError: syscalls[id] = 1 def syscalls__sys_enter(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, id, args): raw_syscalls__sys_enter(**locals()) def print_syscall_totals(interval): while 1: clear_term() if for_comm is not None: print "\nsyscall events for %s:\n\n" % (for_comm), else: print "\nsyscall events:\n\n", print "%-40s %10s\n" % ("event", "count"), print "%-40s %10s\n" % ("----------------------------------------", \ "----------"), for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ reverse = True): try: print "%-40s %10d\n" % (syscall_name(id), val), except TypeError: pass syscalls.clear() time.sleep(interval)
gpl-2.0
[ 3, 2656, 1240, 2746, 199, 3, 334, 67, 9, 7129, 12, 21644, 29385, 665, 29453, 32, 6799, 14, 957, 30, 199, 3, 3909, 1334, 314, 2895, 402, 314, 1664, 14629, 844, 1015, 499, 199, 3, 199, 3, 3492, 11273, 1183, 17561, 2656, 13, 13062, 2656, 1240, 23576, 12, 10529, 3224, 701, 199, 3, 18901, 14, 221, 982, 282, 359, 1404, 61, 1680, 365, 2013, 12, 1454, 19473, 2797, 701, 199, 3, 359, 1404, 61, 787, 9080, 14, 982, 376, 359, 4284, 61, 1680, 365, 2013, 12, 314, 2929, 199, 3, 911, 506, 9236, 379, 4036, 359, 4284, 61, 4696, 14, 221, 710, 849, 6252, 365, 199, 3, 650, 4696, 14, 199, 199, 646, 747, 12, 984, 12, 2462, 12, 900, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 199, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 504, 11672, 492, 627, 199, 504, 21248, 492, 627, 199, 199, 3807, 275, 298, 9452, 2884, 446, 83, 308, 319, 411, 14, 647, 359, 1404, 61, 359, 4284, 7272, 78, 11436, 199, 199, 509, 63, 1404, 275, 488, 199, 885, 63, 4284, 275, 650, 199, 4284, 275, 849, 63, 4284, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 650, 26, 199, 198, 1274, 14, 2224, 8, 3807, 9, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 499, 26, 199, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 199, 198, 4284, 275, 1109, 8, 1274, 14, 3020, 59, 18, 566, 199, 4164, 822, 8, 1274, 14, 3020, 9, 690, 413, 26, 199, 198, 893, 26, 507, 198, 4284, 275, 1109, 8, 1274, 14, 3020, 59, 17, 566, 199, 198, 2590, 1722, 26, 507, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 507, 198, 4284, 275, 849, 63, 4284, 199, 199, 14507, 275, 27477, 342, 199, 199, 318, 3307, 63, 5037, 837, 199, 198, 2671, 14, 928, 63, 1222, 63, 2671, 8, 1361, 63, 19444, 63, 17552, 12, 334, 4284, 4641, 199, 198, 1529, 199, 199, 318, 3066, 63, 14507, 363, 1274, 63, 4200, 8, 1430, 63, 354, 12, 1067, 12, 2863, 63, 3541, 12, 199, 198, 2330, 63, 4855, 12, 2863, 63, 9618, 12, 2863, 63, 3150, 12, 2863, 63, 1404, 12, 199, 198, 2330, 63, 1250, 4429, 12, 1305, 12, 1249, 304, 199, 198, 692, 367, 63, 1404, 365, 440, 488, 26, 507, 198, 692, 2863, 63, 1404, 1137, 367, 63, 1404, 26, 686, 198, 1107, 199, 198, 893, 26, 507, 198, 14507, 59, 344, 61, 847, 413, 199, 198, 2590, 3146, 26, 507, 198, 14507, 59, 344, 61, 275, 413, 199, 199, 318, 19473, 363, 1274, 63, 4200, 8, 1430, 63, 354, 12, 1067, 12, 2863, 63, 3541, 12, 199, 198, 2330, 63, 4855, 12, 2863, 63, 9618, 12, 2863, 63, 3150, 12, 2863, 63, 1404, 12, 199, 198, 344, 12, 1249, 304, 199, 198, 1773, 63, 14507, 363, 1274, 63, 4200, 3682, 9350, 1012, 199, 199, 318, 870, 63, 19444, 63, 17552, 8, 4284, 304, 199, 198, 6710, 413, 26, 507, 198, 3584, 63, 5125, 342, 507, 198, 692, 367, 63, 1404, 365, 440, 488, 26, 686, 198, 1361, 1867, 26605, 4474, 367, 450, 83, 3427, 78, 60, 78, 2, 450, 334, 509, 63, 1404, 395, 507, 198, 2836, 26, 686, 198, 1361, 1867, 26605, 4474, 3427, 78, 60, 78, 401, 2742, 198, 1361, 18301, 2167, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 1430, 401, 298, 835, 1288, 507, 198, 1361, 18301, 2167, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 32111, 401, 971, 5264, 298, 9460, 1288, 2742, 198, 509, 1305, 12, 1139, 315, 3355, 8, 14507, 14, 4611, 1062, 790, 275, 2400, 8, 75, 12, 373, 304, 334, 86, 12, 1022, 395, 971, 4671, 420, 3837, 275, 715, 304, 686, 198, 893, 26, 1585, 198, 1361, 18301, 2167, 83, 221, 450, 709, 68, 60, 78, 2, 450, 334, 19444, 63, 354, 8, 344, 395, 1139, 395, 686, 198, 2590, 3146, 26, 1585, 198, 1529, 507, 198, 14507, 14, 3584, 342, 507, 198, 521, 14, 4532, 8, 4284, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2656, 1240, 2746, 199, 3, 334, 67, 9, 7129, 12, 21644, 29385, 665, 29453, 32, 6799, 14, 957, 30, 199, 3, 3909, 1334, 314, 2895, 402, 314, 1664, 14629, 844, 1015, 499, 199, 3, 199, 3, 3492, 11273, 1183, 17561, 2656, 13, 13062, 2656, 1240, 23576, 12, 10529, 3224, 701, 199, 3, 18901, 14, 221, 982, 282, 359, 1404, 61, 1680, 365, 2013, 12, 1454, 19473, 2797, 701, 199, 3, 359, 1404, 61, 787, 9080, 14, 982, 376, 359, 4284, 61, 1680, 365, 2013, 12, 314, 2929, 199, 3, 911, 506, 9236, 379, 4036, 359, 4284, 61, 4696, 14, 221, 710, 849, 6252, 365, 199, 3, 650, 4696, 14, 199, 199, 646, 747, 12, 984, 12, 2462, 12, 900, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 199, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 504, 11672, 492, 627, 199, 504, 21248, 492, 627, 199, 199, 3807, 275, 298, 9452, 2884, 446, 83, 308, 319, 411, 14, 647, 359, 1404, 61, 359, 4284, 7272, 78, 11436, 199, 199, 509, 63, 1404, 275, 488, 199, 885, 63, 4284, 275, 650, 199, 4284, 275, 849, 63, 4284, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 650, 26, 199, 198, 1274, 14, 2224, 8, 3807, 9, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 499, 26, 199, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 199, 198, 4284, 275, 1109, 8, 1274, 14, 3020, 59, 18, 566, 199, 4164, 822, 8, 1274, 14, 3020, 9, 690, 413, 26, 199, 198, 893, 26, 507, 198, 4284, 275, 1109, 8, 1274, 14, 3020, 59, 17, 566, 199, 198, 2590, 1722, 26, 507, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 507, 198, 4284, 275, 849, 63, 4284, 199, 199, 14507, 275, 27477, 342, 199, 199, 318, 3307, 63, 5037, 837, 199, 198, 2671, 14, 928, 63, 1222, 63, 2671, 8, 1361, 63, 19444, 63, 17552, 12, 334, 4284, 4641, 199, 198, 1529, 199, 199, 318, 3066, 63, 14507, 363, 1274, 63, 4200, 8, 1430, 63, 354, 12, 1067, 12, 2863, 63, 3541, 12, 199, 198, 2330, 63, 4855, 12, 2863, 63, 9618, 12, 2863, 63, 3150, 12, 2863, 63, 1404, 12, 199, 198, 2330, 63, 1250, 4429, 12, 1305, 12, 1249, 304, 199, 198, 692, 367, 63, 1404, 365, 440, 488, 26, 507, 198, 692, 2863, 63, 1404, 1137, 367, 63, 1404, 26, 686, 198, 1107, 199, 198, 893, 26, 507, 198, 14507, 59, 344, 61, 847, 413, 199, 198, 2590, 3146, 26, 507, 198, 14507, 59, 344, 61, 275, 413, 199, 199, 318, 19473, 363, 1274, 63, 4200, 8, 1430, 63, 354, 12, 1067, 12, 2863, 63, 3541, 12, 199, 198, 2330, 63, 4855, 12, 2863, 63, 9618, 12, 2863, 63, 3150, 12, 2863, 63, 1404, 12, 199, 198, 344, 12, 1249, 304, 199, 198, 1773, 63, 14507, 363, 1274, 63, 4200, 3682, 9350, 1012, 199, 199, 318, 870, 63, 19444, 63, 17552, 8, 4284, 304, 199, 198, 6710, 413, 26, 507, 198, 3584, 63, 5125, 342, 507, 198, 692, 367, 63, 1404, 365, 440, 488, 26, 686, 198, 1361, 1867, 26605, 4474, 367, 450, 83, 3427, 78, 60, 78, 2, 450, 334, 509, 63, 1404, 395, 507, 198, 2836, 26, 686, 198, 1361, 1867, 26605, 4474, 3427, 78, 60, 78, 401, 2742, 198, 1361, 18301, 2167, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 1430, 401, 298, 835, 1288, 507, 198, 1361, 18301, 2167, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 32111, 401, 971, 5264, 298, 9460, 1288, 2742, 198, 509, 1305, 12, 1139, 315, 3355, 8, 14507, 14, 4611, 1062, 790, 275, 2400, 8, 75, 12, 373, 304, 334, 86, 12, 1022, 395, 971, 4671, 420, 3837, 275, 715, 304, 686, 198, 893, 26, 1585, 198, 1361, 18301, 2167, 83, 221, 450, 709, 68, 60, 78, 2, 450, 334, 19444, 63, 354, 8, 344, 395, 1139, 395, 686, 198, 2590, 3146, 26, 1585, 198, 1529, 507, 198, 14507, 14, 3584, 342, 507, 198, 521, 14, 4532, 8, 4284, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
40223123/finaltestone
static/Brython3.1.3-20150514-095342/Lib/unittest/test/testmock/testwith.py
739
5806
import unittest from warnings import catch_warnings from unittest.test.testmock.support import is_instance from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call something = sentinel.Something something_else = sentinel.SomethingElse class WithTest(unittest.TestCase): def test_with_statement(self): with patch('%s.something' % __name__, sentinel.Something2): self.assertEqual(something, sentinel.Something2, "unpatched") self.assertEqual(something, sentinel.Something) def test_with_statement_exception(self): try: with patch('%s.something' % __name__, sentinel.Something2): self.assertEqual(something, sentinel.Something2, "unpatched") raise Exception('pow') except Exception: pass else: self.fail("patch swallowed exception") self.assertEqual(something, sentinel.Something) def test_with_statement_as(self): with patch('%s.something' % __name__) as mock_something: self.assertEqual(something, mock_something, "unpatched") self.assertTrue(is_instance(mock_something, MagicMock), "patching wrong type") self.assertEqual(something, sentinel.Something) def test_patch_object_with_statement(self): class Foo(object): something = 'foo' original = Foo.something with patch.object(Foo, 'something'): self.assertNotEqual(Foo.something, original, "unpatched") self.assertEqual(Foo.something, original) def test_with_statement_nested(self): with catch_warnings(record=True): with patch('%s.something' % __name__) as mock_something, patch('%s.something_else' % __name__) as mock_something_else: self.assertEqual(something, mock_something, "unpatched") self.assertEqual(something_else, mock_something_else, "unpatched") self.assertEqual(something, sentinel.Something) self.assertEqual(something_else, sentinel.SomethingElse) def test_with_statement_specified(self): with patch('%s.something' % __name__, sentinel.Patched) as mock_something: self.assertEqual(something, mock_something, "unpatched") self.assertEqual(mock_something, sentinel.Patched, "wrong patch") self.assertEqual(something, sentinel.Something) def testContextManagerMocking(self): mock = Mock() mock.__enter__ = Mock() mock.__exit__ = Mock() mock.__exit__.return_value = False with mock as m: self.assertEqual(m, mock.__enter__.return_value) mock.__enter__.assert_called_with() mock.__exit__.assert_called_with(None, None, None) def test_context_manager_with_magic_mock(self): mock = MagicMock() with self.assertRaises(TypeError): with mock: 'foo' + 3 mock.__enter__.assert_called_with() self.assertTrue(mock.__exit__.called) def test_with_statement_same_attribute(self): with patch('%s.something' % __name__, sentinel.Patched) as mock_something: self.assertEqual(something, mock_something, "unpatched") with patch('%s.something' % __name__) as mock_again: self.assertEqual(something, mock_again, "unpatched") self.assertEqual(something, mock_something, "restored with wrong instance") self.assertEqual(something, sentinel.Something, "not restored") def test_with_statement_imbricated(self): with patch('%s.something' % __name__) as mock_something: self.assertEqual(something, mock_something, "unpatched") with patch('%s.something_else' % __name__) as mock_something_else: self.assertEqual(something_else, mock_something_else, "unpatched") self.assertEqual(something, sentinel.Something) self.assertEqual(something_else, sentinel.SomethingElse) def test_dict_context_manager(self): foo = {} with patch.dict(foo, {'a': 'b'}): self.assertEqual(foo, {'a': 'b'}) self.assertEqual(foo, {}) with self.assertRaises(NameError): with patch.dict(foo, {'a': 'b'}): self.assertEqual(foo, {'a': 'b'}) raise NameError('Konrad') self.assertEqual(foo, {}) class TestMockOpen(unittest.TestCase): def test_mock_open(self): mock = mock_open() with patch('%s.open' % __name__, mock, create=True) as patched: self.assertIs(patched, mock) open('foo') mock.assert_called_once_with('foo') def test_mock_open_context_manager(self): mock = mock_open() handle = mock.return_value with patch('%s.open' % __name__, mock, create=True): with open('foo') as f: f.read() expected_calls = [call('foo'), call().__enter__(), call().read(), call().__exit__(None, None, None)] self.assertEqual(mock.mock_calls, expected_calls) self.assertIs(f, handle) def test_explicit_mock(self): mock = MagicMock() mock_open(mock) with patch('%s.open' % __name__, mock, create=True) as patched: self.assertIs(patched, mock) open('foo') mock.assert_called_once_with('foo') def test_read_data(self): mock = mock_open(read_data='foo') with patch('%s.open' % __name__, mock, create=True): h = open('bar') result = h.read() self.assertEqual(result, 'foo') if __name__ == '__main__': unittest.main()
agpl-3.0
[ 646, 2882, 199, 504, 3598, 492, 8579, 63, 5451, 199, 199, 504, 2882, 14, 396, 14, 396, 1805, 14, 4058, 492, 365, 63, 842, 199, 504, 2882, 14, 1805, 492, 10079, 12, 4420, 12, 3371, 12, 13792, 12, 1683, 63, 1490, 12, 1240, 4388, 199, 10297, 221, 275, 13792, 14, 20641, 199, 10297, 63, 2836, 221, 275, 13792, 14, 20641, 26836, 4388, 199, 533, 8777, 774, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 1045, 63, 6242, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 20641, 18, 304, 288, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 18, 12, 298, 324, 22631, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 1971, 8, 277, 304, 267, 862, 26, 288, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 20641, 18, 304, 355, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 18, 12, 298, 324, 22631, 531, 355, 746, 2186, 360, 8278, 358, 267, 871, 2186, 26, 288, 986, 267, 587, 26, 288, 291, 14, 1633, 480, 2068, 5584, 6541, 1919, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 305, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 288, 291, 14, 1815, 8, 374, 63, 842, 8, 1805, 63, 10297, 12, 10079, 395, 1169, 298, 2068, 316, 6835, 730, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 2068, 63, 785, 63, 1045, 63, 6242, 8, 277, 304, 267, 1021, 8024, 8, 785, 304, 288, 6020, 275, 283, 1421, 7, 267, 3379, 275, 8024, 14, 10297, 267, 543, 3371, 14, 785, 8, 5686, 12, 283, 10297, 735, 288, 291, 14, 7418, 8, 5686, 14, 10297, 12, 3379, 12, 298, 324, 22631, 531, 267, 291, 14, 629, 8, 5686, 14, 10297, 12, 3379, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 6376, 8, 277, 304, 267, 543, 8579, 63, 5451, 8, 3059, 29, 549, 304, 288, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 12, 3371, 3508, 83, 14, 10297, 63, 2836, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 63, 2836, 26, 355, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 355, 291, 14, 629, 8, 10297, 63, 2836, 12, 1683, 63, 10297, 63, 2836, 12, 639, 298, 324, 22631, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 267, 291, 14, 629, 8, 10297, 63, 2836, 12, 13792, 14, 20641, 26836, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 10085, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 11173, 379, 9, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 288, 291, 14, 629, 8, 1805, 63, 10297, 12, 13792, 14, 11173, 379, 12, 298, 10603, 3371, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 2998, 2988, 3346, 316, 8, 277, 304, 267, 1683, 275, 4420, 342, 267, 1683, 855, 4200, 363, 275, 4420, 342, 267, 1683, 855, 2224, 363, 275, 4420, 342, 267, 1683, 855, 2224, 4343, 1107, 63, 585, 275, 756, 398, 543, 1683, 465, 333, 26, 288, 291, 14, 629, 8, 77, 12, 1683, 855, 4200, 4343, 1107, 63, 585, 9, 267, 1683, 855, 4200, 4343, 479, 63, 3527, 63, 1045, 342, 267, 1683, 855, 2224, 4343, 479, 63, 3527, 63, 1045, 8, 403, 12, 488, 12, 488, 9, 2378, 347, 511, 63, 1100, 63, 2609, 63, 1045, 63, 11523, 63, 1805, 8, 277, 304, 267, 1683, 275, 10079, 342, 398, 543, 291, 14, 1855, 8, 4333, 304, 288, 543, 1683, 26, 355, 283, 1421, 7, 435, 650, 267, 1683, 855, 4200, 4343, 479, 63, 3527, 63, 1045, 342, 267, 291, 14, 1815, 8, 1805, 855, 2224, 4343, 3527, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 7191, 63, 3215, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 11173, 379, 9, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 953, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 14199, 26, 355, 291, 14, 629, 8, 10297, 12, 1683, 63, 14199, 12, 298, 324, 22631, 531, 953, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 2490, 298, 3911, 2908, 543, 6835, 1256, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 12, 298, 1397, 14429, 531, 2378, 347, 511, 63, 1045, 63, 6242, 63, 73, 887, 1567, 972, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 953, 543, 3371, 3508, 83, 14, 10297, 63, 2836, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 63, 2836, 26, 355, 291, 14, 629, 8, 10297, 63, 2836, 12, 1683, 63, 10297, 63, 2836, 12, 639, 298, 324, 22631, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 267, 291, 14, 629, 8, 10297, 63, 2836, 12, 13792, 14, 20641, 26836, 9, 2378, 347, 511, 63, 807, 63, 1100, 63, 2609, 8, 277, 304, 267, 3925, 275, 1052, 267, 543, 3371, 14, 807, 8, 1421, 12, 791, 65, 356, 283, 66, 936, 304, 288, 291, 14, 629, 8, 1421, 12, 791, 65, 356, 283, 66, 3071, 267, 291, 14, 629, 8, 1421, 12, 5009, 398, 543, 291, 14, 1855, 8, 985, 547, 304, 288, 543, 3371, 14, 807, 8, 1421, 12, 791, 65, 356, 283, 66, 936, 304, 355, 291, 14, 629, 8, 1421, 12, 791, 65, 356, 283, 66, 3071, 355, 746, 12746 ]
[ 2882, 199, 504, 3598, 492, 8579, 63, 5451, 199, 199, 504, 2882, 14, 396, 14, 396, 1805, 14, 4058, 492, 365, 63, 842, 199, 504, 2882, 14, 1805, 492, 10079, 12, 4420, 12, 3371, 12, 13792, 12, 1683, 63, 1490, 12, 1240, 4388, 199, 10297, 221, 275, 13792, 14, 20641, 199, 10297, 63, 2836, 221, 275, 13792, 14, 20641, 26836, 4388, 199, 533, 8777, 774, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 1045, 63, 6242, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 20641, 18, 304, 288, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 18, 12, 298, 324, 22631, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 1971, 8, 277, 304, 267, 862, 26, 288, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 20641, 18, 304, 355, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 18, 12, 298, 324, 22631, 531, 355, 746, 2186, 360, 8278, 358, 267, 871, 2186, 26, 288, 986, 267, 587, 26, 288, 291, 14, 1633, 480, 2068, 5584, 6541, 1919, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 305, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 288, 291, 14, 1815, 8, 374, 63, 842, 8, 1805, 63, 10297, 12, 10079, 395, 1169, 298, 2068, 316, 6835, 730, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 63, 2068, 63, 785, 63, 1045, 63, 6242, 8, 277, 304, 267, 1021, 8024, 8, 785, 304, 288, 6020, 275, 283, 1421, 7, 267, 3379, 275, 8024, 14, 10297, 267, 543, 3371, 14, 785, 8, 5686, 12, 283, 10297, 735, 288, 291, 14, 7418, 8, 5686, 14, 10297, 12, 3379, 12, 298, 324, 22631, 531, 267, 291, 14, 629, 8, 5686, 14, 10297, 12, 3379, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 6376, 8, 277, 304, 267, 543, 8579, 63, 5451, 8, 3059, 29, 549, 304, 288, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 12, 3371, 3508, 83, 14, 10297, 63, 2836, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 63, 2836, 26, 355, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 355, 291, 14, 629, 8, 10297, 63, 2836, 12, 1683, 63, 10297, 63, 2836, 12, 639, 298, 324, 22631, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 267, 291, 14, 629, 8, 10297, 63, 2836, 12, 13792, 14, 20641, 26836, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 10085, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 11173, 379, 9, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 288, 291, 14, 629, 8, 1805, 63, 10297, 12, 13792, 14, 11173, 379, 12, 298, 10603, 3371, 531, 267, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 2378, 347, 511, 2998, 2988, 3346, 316, 8, 277, 304, 267, 1683, 275, 4420, 342, 267, 1683, 855, 4200, 363, 275, 4420, 342, 267, 1683, 855, 2224, 363, 275, 4420, 342, 267, 1683, 855, 2224, 4343, 1107, 63, 585, 275, 756, 398, 543, 1683, 465, 333, 26, 288, 291, 14, 629, 8, 77, 12, 1683, 855, 4200, 4343, 1107, 63, 585, 9, 267, 1683, 855, 4200, 4343, 479, 63, 3527, 63, 1045, 342, 267, 1683, 855, 2224, 4343, 479, 63, 3527, 63, 1045, 8, 403, 12, 488, 12, 488, 9, 2378, 347, 511, 63, 1100, 63, 2609, 63, 1045, 63, 11523, 63, 1805, 8, 277, 304, 267, 1683, 275, 10079, 342, 398, 543, 291, 14, 1855, 8, 4333, 304, 288, 543, 1683, 26, 355, 283, 1421, 7, 435, 650, 267, 1683, 855, 4200, 4343, 479, 63, 3527, 63, 1045, 342, 267, 291, 14, 1815, 8, 1805, 855, 2224, 4343, 3527, 9, 2378, 347, 511, 63, 1045, 63, 6242, 63, 7191, 63, 3215, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3108, 13792, 14, 11173, 379, 9, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 953, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 14199, 26, 355, 291, 14, 629, 8, 10297, 12, 1683, 63, 14199, 12, 298, 324, 22631, 531, 953, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 2490, 298, 3911, 2908, 543, 6835, 1256, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 12, 298, 1397, 14429, 531, 2378, 347, 511, 63, 1045, 63, 6242, 63, 73, 887, 1567, 972, 8, 277, 304, 267, 543, 3371, 3508, 83, 14, 10297, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 26, 288, 291, 14, 629, 8, 10297, 12, 1683, 63, 10297, 12, 298, 324, 22631, 531, 953, 543, 3371, 3508, 83, 14, 10297, 63, 2836, 7, 450, 636, 354, 3368, 465, 1683, 63, 10297, 63, 2836, 26, 355, 291, 14, 629, 8, 10297, 63, 2836, 12, 1683, 63, 10297, 63, 2836, 12, 639, 298, 324, 22631, 531, 398, 291, 14, 629, 8, 10297, 12, 13792, 14, 20641, 9, 267, 291, 14, 629, 8, 10297, 63, 2836, 12, 13792, 14, 20641, 26836, 9, 2378, 347, 511, 63, 807, 63, 1100, 63, 2609, 8, 277, 304, 267, 3925, 275, 1052, 267, 543, 3371, 14, 807, 8, 1421, 12, 791, 65, 356, 283, 66, 936, 304, 288, 291, 14, 629, 8, 1421, 12, 791, 65, 356, 283, 66, 3071, 267, 291, 14, 629, 8, 1421, 12, 5009,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
nekohayo/meld
meld/vc/cvs.py
2
7183
### Copyright (C) 2002-2005 Stephen Kennedy <stevek@gnome.org> ### Redistribution and use in source and binary forms, with or without ### modification, are permitted provided that the following conditions ### are met: ### ### 1. Redistributions of source code must retain the above copyright ### notice, this list of conditions and the following disclaimer. ### 2. Redistributions in binary form must reproduce the above copyright ### notice, this list of conditions and the following disclaimer in the ### documentation and/or other materials provided with the distribution. ### THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ### IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ### OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ### IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ### INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ### NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ### DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ### THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ### (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os from gettext import gettext as _ import re import time from meld import misc import _vc class Vc(_vc.Vc): CMD = "cvs" # CVSNT is a drop-in replacement for CVS; if found, it is used instead ALT_CMD = "cvsnt" NAME = "CVS" VC_DIR = "CVS" VC_ROOT_WALK = False PATCH_INDEX_RE = "^Index:(.*)$" def __init__(self, location): super(Vc, self).__init__(location) if not _vc.call(["which", self.ALT_CMD]): self.CMD = self.ALT_CMD def commit_command(self, message): return [self.CMD,"commit","-m",message] def diff_command(self): return [self.CMD,"diff","-u"] def update_command(self): return [self.CMD,"update"] def add_command(self, binary=0): if binary: return [self.CMD,"add","-kb"] return [self.CMD,"add"] def remove_command(self, force=0): return [self.CMD,"rm","-f"] def revert_command(self): return [self.CMD,"update","-C"] def valid_repo(self): if _vc.call([self.CMD, "version"], cwd=self.root): return False else: return True def _get_dirsandfiles(self, directory, dirs, files): try: entries = open(os.path.join(directory, self.VC_DIR, "Entries")).read() # poor mans universal newline entries = entries.replace("\r","\n").replace("\n\n","\n") except IOError, e: # no cvs dir d = map(lambda x: _vc.Dir(x[1],x[0], _vc.STATE_NONE), dirs) f = map(lambda x: _vc.File(x[1],x[0], _vc.STATE_NONE, None), files) return d,f try: logentries = open(os.path.join(directory, self.VC_DIR, "Entries.Log")).read() except IOError, e: pass else: matches = re.findall("^([AR])\s*(.+)$(?m)", logentries) toadd = [] for match in matches: if match[0] == "A": toadd.append( match[1] ) elif match[0] == "R": try: toadd.remove( match[1] ) except ValueError: pass else: print "Unknown Entries.Log line '%s'" % match[0] entries += "\n".join(toadd) retfiles = [] retdirs = [] matches = re.findall("^(D?)/([^/]+)/(.+)$(?m)", entries) matches.sort() for match in matches: isdir = match[0] name = match[1] path = os.path.join(directory, name) rev, date, options, tag = match[2].split("/") if tag: tag = tag[1:] if isdir: if os.path.exists(path): state = _vc.STATE_NORMAL else: state = _vc.STATE_MISSING retdirs.append( _vc.Dir(path,name,state) ) else: if rev.startswith("-"): state = _vc.STATE_REMOVED elif date=="dummy timestamp": if rev[0] == "0": state = _vc.STATE_NEW else: print "Revision '%s' not understood" % rev elif date=="dummy timestamp from new-entry": state = _vc.STATE_MODIFIED else: date = re.sub(r"\s*\d+", lambda x : "%3i" % int(x.group()), date, 1) plus = date.find("+") if plus >= 0: state = _vc.STATE_CONFLICT try: txt = open(path, "U").read() except IOError: pass else: if txt.find("\n=======\n") == -1: state = _vc.STATE_MODIFIED else: try: mtime = os.stat(path).st_mtime except OSError: state = _vc.STATE_MISSING else: if time.asctime(time.gmtime(mtime))==date: state = _vc.STATE_NORMAL else: state = _vc.STATE_MODIFIED retfiles.append( _vc.File(path, name, state, rev, tag, options) ) # known cvsfiles = map(lambda x: x[1], matches) # ignored try: ignored = open(os.path.join(os.environ["HOME"], ".cvsignore")).read().split() except (IOError, KeyError): ignored = [] try: ignored += open( os.path.join(directory, ".cvsignore")).read().split() except IOError: pass if len(ignored): try: regexes = [ misc.shell_to_regex(i)[:-1] for i in ignored ] ignore_re = re.compile( "(" + "|".join(regexes) + ")" ) except re.error, e: misc.run_dialog(_("Error converting to a regular expression\n" "The pattern was '%s'\n" "The error was '%s'") % (",".join(ignored), e)) else: class dummy(object): def match(self, *args): return None ignore_re = dummy() for f,path in files: if f not in cvsfiles: state = ignore_re.match(f) is None and _vc.STATE_NONE or _vc.STATE_IGNORED retfiles.append( _vc.File(path, f, state, "") ) for d,path in dirs: if d not in cvsfiles: state = ignore_re.match(d) is None and _vc.STATE_NONE or _vc.STATE_IGNORED retdirs.append( _vc.Dir(path, d, state) ) return retdirs, retfiles
gpl-2.0
[ 5680, 1898, 334, 35, 9, 14790, 13, 9397, 17854, 17579, 1804, 287, 7439, 89, 665, 1597, 432, 75, 32, 784, 1377, 14, 1308, 30, 199, 199, 5680, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 5680, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 199, 5680, 787, 7647, 26, 199, 5680, 221, 199, 5680, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 5680, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 5680, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 5680, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 5680, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 199, 5680, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 1124, 1179, 2281, 891, 2401, 1821, 7168, 1549, 199, 5680, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 2990, 199, 5680, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 5680, 1621, 4825, 6461, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 5680, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 199, 5680, 2845, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 5680, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 5680, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 5680, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 199, 5680, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 646, 747, 199, 504, 9796, 492, 9796, 465, 485, 199, 646, 295, 199, 646, 900, 199, 504, 562, 1447, 492, 18576, 199, 646, 485, 6737, 199, 199, 533, 812, 67, 1547, 6737, 14, 54, 67, 304, 272, 25548, 275, 298, 28151, 2, 272, 327, 445, 7428, 12460, 365, 282, 5978, 13, 262, 8343, 367, 445, 7428, 27, 340, 1911, 12, 652, 365, 1202, 3140, 272, 12112, 52, 63, 9744, 275, 298, 28151, 343, 2, 272, 13637, 275, 298, 35, 7428, 2, 272, 24955, 63, 3022, 275, 298, 35, 7428, 2, 272, 24955, 63, 5441, 63, 55, 748, 43, 275, 756, 272, 510, 8078, 63, 10215, 63, 907, 275, 18129, 2681, 20334, 12432, 17351, 339, 347, 636, 826, 721, 277, 12, 2909, 304, 267, 1613, 8, 54, 67, 12, 291, 2843, 826, 721, 1985, 9, 267, 340, 440, 485, 6737, 14, 1250, 5234, 6777, 401, 291, 14, 19600, 63, 9744, 4682, 288, 291, 14, 9744, 275, 291, 14, 19600, 63, 9744, 339, 347, 5532, 63, 1531, 8, 277, 12, 1245, 304, 267, 372, 359, 277, 14, 9744, 4589, 3543, 2266, 13, 77, 401, 1188, 61, 272, 347, 3915, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 3028, 2266, 13, 85, 937, 272, 347, 1678, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 873, 937, 272, 347, 1050, 63, 1531, 8, 277, 12, 3366, 29, 16, 304, 267, 340, 3366, 26, 288, 372, 359, 277, 14, 9744, 4589, 525, 2266, 13, 7862, 937, 267, 372, 359, 277, 14, 9744, 4589, 525, 937, 272, 347, 2813, 63, 1531, 8, 277, 12, 3542, 29, 16, 304, 267, 372, 359, 277, 14, 9744, 4589, 5682, 2266, 13, 70, 937, 272, 347, 23347, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 873, 2266, 13, 35, 937, 272, 347, 1686, 63, 3417, 8, 277, 304, 267, 340, 485, 6737, 14, 1250, 779, 277, 14, 9744, 12, 298, 1023, 2255, 8288, 29, 277, 14, 1231, 304, 288, 372, 756, 267, 587, 26, 288, 372, 715, 339, 347, 485, 362, 63, 3220, 460, 1725, 8, 277, 12, 2082, 12, 7606, 12, 1584, 304, 398, 862, 26, 288, 4811, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 291, 14, 9454, 63, 3022, 12, 298, 17816, 21688, 739, 342, 288, 327, 1115, 269, 333, 796, 17508, 8057, 288, 4811, 275, 4811, 14, 1814, 4582, 82, 2266, 60, 78, 3471, 1814, 4582, 78, 60, 78, 2266, 60, 78, 531, 267, 871, 5925, 12, 325, 26, 327, 949, 286, 3122, 2935, 288, 366, 275, 2341, 8, 2734, 671, 26, 485, 6737, 14, 3567, 8, 88, 59, 17, 467, 88, 59, 16, 467, 485, 6737, 14, 6689, 63, 9185, 395, 7606, 9, 288, 289, 275, 2341, 8, 2734, 671, 26, 485, 6737, 14, 1173, 8, 88, 59, 17, 467, 88, 59, 16, 467, 485, 6737, 14, 6689, 63, 9185, 12, 488, 395, 1584, 9, 288, 372, 366, 12, 70, 398, 862, 26, 288, 943, 3189, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 291, 14, 9454, 63, 3022, 12, 298, 17816, 14, 2445, 21688, 739, 342, 267, 871, 5925, 12, 325, 26, 288, 986, 267, 587, 26, 288, 4450, 275, 295, 14, 6452, 18523, 779, 689, 27147, 83, 5830, 6977, 9, 4, 2229, 77, 4186, 943, 3189, 9, 288, 370, 525, 275, 942, 288, 367, 1336, 315, 4450, 26, 355, 340, 1336, 59, 16, 61, 508, 298, 33, 582, 490, 370, 525, 14, 740, 8, 1336, 59, 17, 61, 776, 355, 916, 1336, 59, 16, 61, 508, 298, 50, 582, 490, 862, 26, 717, 370, 525, 14, 2168, 8, 1336, 59, 17, 61, 776, 490, 871, 1722, 26, 717, 986, 355, 587, 26, 490, 870, 298, 5912, 23450, 1996, 14, 2445, 1004, 1543, 83, 4065, 450, 1336, 59, 16, 61, 288, 4811, 847, 1867, 78, 1674, 904, 8, 475, 525, 9, 398, 2203, 1725, 275, 942, 267, 2203, 3220, 275, 942, 267, 4450, 275, 295, 14, 6452, 18523, 8, 36, 31, 2447, 7059, 15251, 15136, 6977, 9, 4, 2229, 77, 4186, 4811, 9, 267, 4450, 14, 3191, 342, 398, 367, 1336, 315, 4450, 26, 288, 26004, 275, 1336, 59, 16, 61, 288, 536, 275, 1336, 59, 17, 61, 288, 931, 275, 747, 14, 515, 14, 904, 8, 3619, 12, 536, 9, 288, 6822, 12, 1434, 12, 1511, 12, 1947, 275, 1336, 59, 18, 1055, 1294, 19031, 288, 340, 1947, 26, 355, 1947, 275, 1947 ]
[ 1898, 334, 35, 9, 14790, 13, 9397, 17854, 17579, 1804, 287, 7439, 89, 665, 1597, 432, 75, 32, 784, 1377, 14, 1308, 30, 199, 199, 5680, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 5680, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 199, 5680, 787, 7647, 26, 199, 5680, 221, 199, 5680, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 5680, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 5680, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 5680, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 5680, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 199, 5680, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 1124, 1179, 2281, 891, 2401, 1821, 7168, 1549, 199, 5680, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 2990, 199, 5680, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 5680, 1621, 4825, 6461, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 5680, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 199, 5680, 2845, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 5680, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 5680, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 5680, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 199, 5680, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 646, 747, 199, 504, 9796, 492, 9796, 465, 485, 199, 646, 295, 199, 646, 900, 199, 504, 562, 1447, 492, 18576, 199, 646, 485, 6737, 199, 199, 533, 812, 67, 1547, 6737, 14, 54, 67, 304, 272, 25548, 275, 298, 28151, 2, 272, 327, 445, 7428, 12460, 365, 282, 5978, 13, 262, 8343, 367, 445, 7428, 27, 340, 1911, 12, 652, 365, 1202, 3140, 272, 12112, 52, 63, 9744, 275, 298, 28151, 343, 2, 272, 13637, 275, 298, 35, 7428, 2, 272, 24955, 63, 3022, 275, 298, 35, 7428, 2, 272, 24955, 63, 5441, 63, 55, 748, 43, 275, 756, 272, 510, 8078, 63, 10215, 63, 907, 275, 18129, 2681, 20334, 12432, 17351, 339, 347, 636, 826, 721, 277, 12, 2909, 304, 267, 1613, 8, 54, 67, 12, 291, 2843, 826, 721, 1985, 9, 267, 340, 440, 485, 6737, 14, 1250, 5234, 6777, 401, 291, 14, 19600, 63, 9744, 4682, 288, 291, 14, 9744, 275, 291, 14, 19600, 63, 9744, 339, 347, 5532, 63, 1531, 8, 277, 12, 1245, 304, 267, 372, 359, 277, 14, 9744, 4589, 3543, 2266, 13, 77, 401, 1188, 61, 272, 347, 3915, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 3028, 2266, 13, 85, 937, 272, 347, 1678, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 873, 937, 272, 347, 1050, 63, 1531, 8, 277, 12, 3366, 29, 16, 304, 267, 340, 3366, 26, 288, 372, 359, 277, 14, 9744, 4589, 525, 2266, 13, 7862, 937, 267, 372, 359, 277, 14, 9744, 4589, 525, 937, 272, 347, 2813, 63, 1531, 8, 277, 12, 3542, 29, 16, 304, 267, 372, 359, 277, 14, 9744, 4589, 5682, 2266, 13, 70, 937, 272, 347, 23347, 63, 1531, 8, 277, 304, 267, 372, 359, 277, 14, 9744, 4589, 873, 2266, 13, 35, 937, 272, 347, 1686, 63, 3417, 8, 277, 304, 267, 340, 485, 6737, 14, 1250, 779, 277, 14, 9744, 12, 298, 1023, 2255, 8288, 29, 277, 14, 1231, 304, 288, 372, 756, 267, 587, 26, 288, 372, 715, 339, 347, 485, 362, 63, 3220, 460, 1725, 8, 277, 12, 2082, 12, 7606, 12, 1584, 304, 398, 862, 26, 288, 4811, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 291, 14, 9454, 63, 3022, 12, 298, 17816, 21688, 739, 342, 288, 327, 1115, 269, 333, 796, 17508, 8057, 288, 4811, 275, 4811, 14, 1814, 4582, 82, 2266, 60, 78, 3471, 1814, 4582, 78, 60, 78, 2266, 60, 78, 531, 267, 871, 5925, 12, 325, 26, 327, 949, 286, 3122, 2935, 288, 366, 275, 2341, 8, 2734, 671, 26, 485, 6737, 14, 3567, 8, 88, 59, 17, 467, 88, 59, 16, 467, 485, 6737, 14, 6689, 63, 9185, 395, 7606, 9, 288, 289, 275, 2341, 8, 2734, 671, 26, 485, 6737, 14, 1173, 8, 88, 59, 17, 467, 88, 59, 16, 467, 485, 6737, 14, 6689, 63, 9185, 12, 488, 395, 1584, 9, 288, 372, 366, 12, 70, 398, 862, 26, 288, 943, 3189, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 291, 14, 9454, 63, 3022, 12, 298, 17816, 14, 2445, 21688, 739, 342, 267, 871, 5925, 12, 325, 26, 288, 986, 267, 587, 26, 288, 4450, 275, 295, 14, 6452, 18523, 779, 689, 27147, 83, 5830, 6977, 9, 4, 2229, 77, 4186, 943, 3189, 9, 288, 370, 525, 275, 942, 288, 367, 1336, 315, 4450, 26, 355, 340, 1336, 59, 16, 61, 508, 298, 33, 582, 490, 370, 525, 14, 740, 8, 1336, 59, 17, 61, 776, 355, 916, 1336, 59, 16, 61, 508, 298, 50, 582, 490, 862, 26, 717, 370, 525, 14, 2168, 8, 1336, 59, 17, 61, 776, 490, 871, 1722, 26, 717, 986, 355, 587, 26, 490, 870, 298, 5912, 23450, 1996, 14, 2445, 1004, 1543, 83, 4065, 450, 1336, 59, 16, 61, 288, 4811, 847, 1867, 78, 1674, 904, 8, 475, 525, 9, 398, 2203, 1725, 275, 942, 267, 2203, 3220, 275, 942, 267, 4450, 275, 295, 14, 6452, 18523, 8, 36, 31, 2447, 7059, 15251, 15136, 6977, 9, 4, 2229, 77, 4186, 4811, 9, 267, 4450, 14, 3191, 342, 398, 367, 1336, 315, 4450, 26, 288, 26004, 275, 1336, 59, 16, 61, 288, 536, 275, 1336, 59, 17, 61, 288, 931, 275, 747, 14, 515, 14, 904, 8, 3619, 12, 536, 9, 288, 6822, 12, 1434, 12, 1511, 12, 1947, 275, 1336, 59, 18, 1055, 1294, 19031, 288, 340, 1947, 26, 355, 1947, 275, 1947, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
anryko/ansible
lib/ansible/modules/network/panos/_panos_cert_gen_ssh.py
37
6369
#!/usr/bin/python # -*- coding: utf-8 -*- # # Ansible module to manage PaloAltoNetworks Firewall # (c) 2016, techbizdev <techbizdev@paloaltonetworks.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. DOCUMENTATION = ''' --- module: panos_cert_gen_ssh short_description: generates a self-signed certificate using SSH protocol with SSH key description: - This module generates a self-signed certificate that can be used by GlobalProtect client, SSL connector, or - otherwise. Root certificate must be preset on the system first. This module depends on paramiko for ssh. author: "Luigi Mori (@jtschichold), Ivan Bojer (@ivanbojer)" version_added: "2.3" requirements: - paramiko deprecated: alternative: Use U(https://galaxy.ansible.com/PaloAltoNetworks/paloaltonetworks) instead. removed_in: "2.12" why: Consolidating code base. notes: - Checkmode is not supported. options: ip_address: description: - IP address (or hostname) of PAN-OS device being configured. required: true key_filename: description: - Location of the filename that is used for the auth. Either I(key_filename) or I(password) is required. required: true password: description: - Password credentials to use for auth. Either I(key_filename) or I(password) is required. required: true cert_friendly_name: description: - Human friendly certificate name (not CN but just a friendly name). required: true cert_cn: description: - Certificate CN (common name) embedded in the certificate signature. required: true signed_by: description: - Undersigning authority (CA) that MUST already be presents on the device. required: true rsa_nbits: description: - Number of bits used by the RSA algorithm for the certificate generation. default: "2048" ''' EXAMPLES = ''' # Generates a new self-signed certificate using ssh - name: generate self signed certificate panos_cert_gen_ssh: ip_address: "192.168.1.1" password: "paloalto" cert_cn: "1.1.1.1" cert_friendly_name: "test123" signed_by: "root-ca" ''' RETURN = ''' # Default return values ''' ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'community'} from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.compat.paramiko import paramiko import time _PROMPTBUFF = 4096 def wait_with_timeout(module, shell, prompt, timeout=60): now = time.time() result = "" while True: if shell.recv_ready(): result += shell.recv(_PROMPTBUFF) endresult = result.strip() if len(endresult) != 0 and endresult[-1] == prompt: break if time.time() - now > timeout: module.fail_json(msg="Timeout waiting for prompt") return result def generate_cert(module, ip_address, key_filename, password, cert_cn, cert_friendly_name, signed_by, rsa_nbits): stdout = "" client = paramiko.SSHClient() # add policy to accept all host keys, I haven't found # a way to retrieve the instance SSH key fingerprint from AWS client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) if not key_filename: client.connect(ip_address, username="admin", password=password) else: client.connect(ip_address, username="admin", key_filename=key_filename) shell = client.invoke_shell() # wait for the shell to start buff = wait_with_timeout(module, shell, ">") stdout += buff # generate self-signed certificate if isinstance(cert_cn, list): cert_cn = cert_cn[0] cmd = 'request certificate generate signed-by {0} certificate-name {1} name {2} algorithm RSA rsa-nbits {3}\n'.format( signed_by, cert_friendly_name, cert_cn, rsa_nbits) shell.send(cmd) # wait for the shell to complete buff = wait_with_timeout(module, shell, ">") stdout += buff # exit shell.send('exit\n') if 'Success' not in buff: module.fail_json(msg="Error generating self signed certificate: " + stdout) client.close() return stdout def main(): argument_spec = dict( ip_address=dict(required=True), key_filename=dict(), password=dict(no_log=True), cert_cn=dict(required=True), cert_friendly_name=dict(required=True), rsa_nbits=dict(default='2048'), signed_by=dict(required=True) ) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False, required_one_of=[['key_filename', 'password']]) if paramiko is None: module.fail_json(msg='paramiko is required for this module') ip_address = module.params["ip_address"] key_filename = module.params["key_filename"] password = module.params["password"] cert_cn = module.params["cert_cn"] cert_friendly_name = module.params["cert_friendly_name"] signed_by = module.params["signed_by"] rsa_nbits = module.params["rsa_nbits"] try: stdout = generate_cert(module, ip_address, key_filename, password, cert_cn, cert_friendly_name, signed_by, rsa_nbits) except Exception as exc: module.fail_json(msg=to_native(exc)) module.exit_json(changed=True, msg="okey dokey") if __name__ == '__main__': main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 2622, 859, 370, 9635, 510, 12201, 2439, 475, 30551, 15967, 7567, 199, 3, 334, 67, 9, 7800, 12, 28222, 66, 565, 2374, 665, 15970, 66, 565, 2374, 32, 80, 12201, 4478, 25759, 12243, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 21379, 736, 63, 4736, 63, 2268, 63, 5510, 199, 3612, 63, 1802, 26, 12821, 282, 291, 13, 1737, 5897, 1808, 12027, 4113, 543, 12027, 790, 199, 1802, 26, 272, 446, 961, 859, 12821, 282, 291, 13, 1737, 5897, 626, 883, 506, 1202, 701, 13641, 919, 5302, 1890, 12, 7799, 13252, 12, 503, 272, 446, 4257, 14, 12826, 5897, 1471, 506, 876, 409, 641, 314, 2656, 1642, 14, 961, 859, 8350, 641, 26162, 367, 8635, 14, 199, 2502, 26, 298, 18176, 13721, 603, 16039, 8593, 74, 1086, 335, 1158, 1753, 395, 473, 20662, 5088, 74, 281, 8593, 1003, 290, 656, 74, 281, 2924, 199, 1023, 63, 3270, 26, 298, 18, 14, 19, 2, 199, 7538, 26, 272, 446, 26162, 199, 6667, 26, 272, 13943, 26, 3645, 738, 8, 2859, 921, 24806, 14, 4853, 14, 957, 15, 48, 12201, 2439, 475, 30551, 15, 80, 12201, 4478, 25759, 12243, 9, 3140, 14, 272, 4829, 63, 262, 26, 298, 18, 14, 713, 2, 272, 10842, 26, 1448, 18533, 1958, 1233, 1300, 14, 199, 5983, 26, 272, 446, 2670, 632, 365, 440, 3748, 14, 199, 1419, 26, 272, 3384, 63, 1562, 26, 267, 1369, 26, 288, 446, 3531, 2287, 334, 269, 6246, 9, 402, 510, 879, 13, 3100, 2243, 3769, 7526, 14, 267, 1415, 26, 2549, 272, 790, 63, 1501, 26, 267, 1369, 26, 288, 446, 12625, 402, 314, 1788, 626, 365, 1202, 367, 314, 1790, 14, 13083, 473, 8, 498, 63, 1501, 9, 503, 473, 8, 2060, 9, 365, 1415, 14, 267, 1415, 26, 2549, 272, 2505, 26, 267, 1369, 26, 288, 446, 13635, 6235, 370, 675, 367, 1790, 14, 13083, 473, 8, 498, 63, 1501, 9, 503, 473, 8, 2060, 9, 365, 1415, 14, 267, 1415, 26, 2549, 272, 6250, 63, 17317, 63, 354, 26, 267, 1369, 26, 288, 446, 869, 7652, 21428, 5897, 536, 334, 1397, 445, 46, 1325, 2951, 282, 21428, 536, 680, 267, 1415, 26, 2549, 272, 6250, 63, 6413, 26, 267, 1369, 26, 288, 446, 12904, 445, 46, 334, 2330, 536, 9, 12169, 315, 314, 5897, 4955, 14, 267, 1415, 26, 2549, 272, 10514, 63, 991, 26, 267, 1369, 26, 288, 446, 25010, 23238, 18330, 334, 3263, 9, 626, 18095, 2575, 506, 3451, 83, 641, 314, 2243, 14, 267, 1415, 26, 2549, 272, 23609, 63, 4994, 1405, 26, 267, 1369, 26, 288, 446, 4860, 402, 5821, 1202, 701, 314, 18471, 5563, 367, 314, 5897, 10152, 14, 267, 849, 26, 298, 18343, 2, 199, 2344, 199, 199, 8918, 275, 1449, 199, 3, 21687, 282, 892, 291, 13, 1737, 5897, 1808, 8635, 199, 13, 536, 26, 3550, 291, 10514, 5897, 523, 21379, 736, 63, 4736, 63, 2268, 63, 5510, 26, 272, 3384, 63, 1562, 26, 298, 5756, 14, 6568, 14, 17, 14, 17, 2, 272, 2505, 26, 298, 80, 12201, 279, 475, 2, 272, 6250, 63, 6413, 26, 298, 17, 14, 17, 14, 17, 14, 17, 2, 272, 6250, 63, 17317, 63, 354, 26, 298, 396, 4288, 2, 272, 10514, 63, 991, 26, 298, 1231, 13, 696, 2, 199, 2344, 199, 199, 9677, 275, 1449, 199, 3, 3758, 372, 1338, 199, 2344, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 6667, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 6106, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 5819, 14, 635, 16625, 492, 26162, 199, 646, 900, 199, 199, 63, 2514, 26178, 10255, 275, 17125, 421, 199, 318, 3618, 63, 1045, 63, 2593, 8, 578, 12, 5218, 12, 8457, 12, 2653, 29, 2259, 304, 272, 3063, 275, 900, 14, 521, 342, 272, 754, 275, 3087, 272, 1830, 715, 26, 267, 340, 5218, 14, 7637, 63, 2179, 837, 288, 754, 847, 5218, 14, 7637, 1547, 2514, 26178, 10255, 9, 288, 1284, 1099, 275, 754, 14, 1913, 342, 288, 340, 822, 8, 500, 1099, 9, 1137, 378, 436, 1284, 1099, 1988, 17, 61, 508, 8457, 26, 355, 2059, 398, 340, 900, 14, 521, 342, 446, 3063, 690, 2653, 26, 288, 859, 14, 1633, 63, 1001, 8, 1328, 628, 6372, 10923, 367, 8457, 531, 339, 372, 754, 421, 199, 318, 3550, 63, 4736, 8, 578, 12, 3384, 63, 1562, 12, 790, 63, 1501, 12, 2505, 12, 2116, 6250, 63, 6413, 12, 6250, 63, 17317, 63, 354, 12, 10514, 63, 991, 12, 23609, 63, 4994, 1405, 304, 272, 3839, 275, 3087, 339, 1890, 275, 26162, 14, 13716, 3041, 342, 339, 327, 1050, 4592, 370, 4729, 1006, 1591, 2883, 12, 473, 19051, 1133, 1911, 272, 327, 282, 4340, 370, 8044, 314, 1256, 12027, 790, 18020, 687, 10168, 272, 1890, 14, 409, 63, 4752, 63, 1102, 63, 498, 63, 3185, 8, 635, 16625, 14, 3358, 1123, 4845, 1012, 339 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 2622, 859, 370, 9635, 510, 12201, 2439, 475, 30551, 15967, 7567, 199, 3, 334, 67, 9, 7800, 12, 28222, 66, 565, 2374, 665, 15970, 66, 565, 2374, 32, 80, 12201, 4478, 25759, 12243, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 21379, 736, 63, 4736, 63, 2268, 63, 5510, 199, 3612, 63, 1802, 26, 12821, 282, 291, 13, 1737, 5897, 1808, 12027, 4113, 543, 12027, 790, 199, 1802, 26, 272, 446, 961, 859, 12821, 282, 291, 13, 1737, 5897, 626, 883, 506, 1202, 701, 13641, 919, 5302, 1890, 12, 7799, 13252, 12, 503, 272, 446, 4257, 14, 12826, 5897, 1471, 506, 876, 409, 641, 314, 2656, 1642, 14, 961, 859, 8350, 641, 26162, 367, 8635, 14, 199, 2502, 26, 298, 18176, 13721, 603, 16039, 8593, 74, 1086, 335, 1158, 1753, 395, 473, 20662, 5088, 74, 281, 8593, 1003, 290, 656, 74, 281, 2924, 199, 1023, 63, 3270, 26, 298, 18, 14, 19, 2, 199, 7538, 26, 272, 446, 26162, 199, 6667, 26, 272, 13943, 26, 3645, 738, 8, 2859, 921, 24806, 14, 4853, 14, 957, 15, 48, 12201, 2439, 475, 30551, 15, 80, 12201, 4478, 25759, 12243, 9, 3140, 14, 272, 4829, 63, 262, 26, 298, 18, 14, 713, 2, 272, 10842, 26, 1448, 18533, 1958, 1233, 1300, 14, 199, 5983, 26, 272, 446, 2670, 632, 365, 440, 3748, 14, 199, 1419, 26, 272, 3384, 63, 1562, 26, 267, 1369, 26, 288, 446, 3531, 2287, 334, 269, 6246, 9, 402, 510, 879, 13, 3100, 2243, 3769, 7526, 14, 267, 1415, 26, 2549, 272, 790, 63, 1501, 26, 267, 1369, 26, 288, 446, 12625, 402, 314, 1788, 626, 365, 1202, 367, 314, 1790, 14, 13083, 473, 8, 498, 63, 1501, 9, 503, 473, 8, 2060, 9, 365, 1415, 14, 267, 1415, 26, 2549, 272, 2505, 26, 267, 1369, 26, 288, 446, 13635, 6235, 370, 675, 367, 1790, 14, 13083, 473, 8, 498, 63, 1501, 9, 503, 473, 8, 2060, 9, 365, 1415, 14, 267, 1415, 26, 2549, 272, 6250, 63, 17317, 63, 354, 26, 267, 1369, 26, 288, 446, 869, 7652, 21428, 5897, 536, 334, 1397, 445, 46, 1325, 2951, 282, 21428, 536, 680, 267, 1415, 26, 2549, 272, 6250, 63, 6413, 26, 267, 1369, 26, 288, 446, 12904, 445, 46, 334, 2330, 536, 9, 12169, 315, 314, 5897, 4955, 14, 267, 1415, 26, 2549, 272, 10514, 63, 991, 26, 267, 1369, 26, 288, 446, 25010, 23238, 18330, 334, 3263, 9, 626, 18095, 2575, 506, 3451, 83, 641, 314, 2243, 14, 267, 1415, 26, 2549, 272, 23609, 63, 4994, 1405, 26, 267, 1369, 26, 288, 446, 4860, 402, 5821, 1202, 701, 314, 18471, 5563, 367, 314, 5897, 10152, 14, 267, 849, 26, 298, 18343, 2, 199, 2344, 199, 199, 8918, 275, 1449, 199, 3, 21687, 282, 892, 291, 13, 1737, 5897, 1808, 8635, 199, 13, 536, 26, 3550, 291, 10514, 5897, 523, 21379, 736, 63, 4736, 63, 2268, 63, 5510, 26, 272, 3384, 63, 1562, 26, 298, 5756, 14, 6568, 14, 17, 14, 17, 2, 272, 2505, 26, 298, 80, 12201, 279, 475, 2, 272, 6250, 63, 6413, 26, 298, 17, 14, 17, 14, 17, 14, 17, 2, 272, 6250, 63, 17317, 63, 354, 26, 298, 396, 4288, 2, 272, 10514, 63, 991, 26, 298, 1231, 13, 696, 2, 199, 2344, 199, 199, 9677, 275, 1449, 199, 3, 3758, 372, 1338, 199, 2344, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 6667, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 6106, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 5819, 14, 635, 16625, 492, 26162, 199, 646, 900, 199, 199, 63, 2514, 26178, 10255, 275, 17125, 421, 199, 318, 3618, 63, 1045, 63, 2593, 8, 578, 12, 5218, 12, 8457, 12, 2653, 29, 2259, 304, 272, 3063, 275, 900, 14, 521, 342, 272, 754, 275, 3087, 272, 1830, 715, 26, 267, 340, 5218, 14, 7637, 63, 2179, 837, 288, 754, 847, 5218, 14, 7637, 1547, 2514, 26178, 10255, 9, 288, 1284, 1099, 275, 754, 14, 1913, 342, 288, 340, 822, 8, 500, 1099, 9, 1137, 378, 436, 1284, 1099, 1988, 17, 61, 508, 8457, 26, 355, 2059, 398, 340, 900, 14, 521, 342, 446, 3063, 690, 2653, 26, 288, 859, 14, 1633, 63, 1001, 8, 1328, 628, 6372, 10923, 367, 8457, 531, 339, 372, 754, 421, 199, 318, 3550, 63, 4736, 8, 578, 12, 3384, 63, 1562, 12, 790, 63, 1501, 12, 2505, 12, 2116, 6250, 63, 6413, 12, 6250, 63, 17317, 63, 354, 12, 10514, 63, 991, 12, 23609, 63, 4994, 1405, 304, 272, 3839, 275, 3087, 339, 1890, 275, 26162, 14, 13716, 3041, 342, 339, 327, 1050, 4592, 370, 4729, 1006, 1591, 2883, 12, 473, 19051, 1133, 1911, 272, 327, 282, 4340, 370, 8044, 314, 1256, 12027, 790, 18020, 687, 10168, 272, 1890, 14, 409, 63, 4752, 63, 1102, 63, 498, 63, 3185, 8, 635, 16625, 14, 3358, 1123, 4845, 1012, 339, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
wbarfuss/pyunicorn
pyunicorn/climate/spearman.py
2
4757
#!/usr/bin/python # -*- coding: utf-8 -*- # # This file is part of pyunicorn. # Copyright (C) 2008--2015 Jonathan F. Donges and pyunicorn authors # URL: <http://www.pik-potsdam.de/members/donges/software> # License: BSD (3-clause) """ Provides classes for generating and analyzing complex climate networks. """ # # Import essential packages # # Import NumPy for the array object and fast numerics import numpy as np # Import cnTsonisClimateNetwork for TsonisClimateNetwork class from .tsonis import TsonisClimateNetwork # # Define class TsonisClimateNetwork # class SpearmanClimateNetwork(TsonisClimateNetwork): """ Encapsulate a Spearman climate network. The Spearman climate network is constructed from the Spearman rank order correlation matrix (Spearman's rho). Spearman's rho is more robust with respect to ouliers and non-gaussian data distributions than the Pearson correlation coefficient used in :class:`TsonisClimateNetwork`. Hence, Spearman climate networks are undirected due to the symmetry of the Spearman's rho matrix. """ # # Defines internal methods # def __init__(self, data, threshold=None, link_density=None, non_local=False, node_weight_type="surface", winter_only=True, silence_level=0): """ Initialize an instance of :class:`SpearmanClimateNetwork`. .. note:: Either threshold **OR** link_density have to be given! Possible choices for ``node_weight_type``: - None (constant unit weights) - "surface" (cos lat) - "irrigation" (cos**2 lat) :type data: :class:`.ClimateData` :arg data: The climate data used for network construction. :arg float threshold: The threshold of similarity measure, above which two nodes are linked in the network. :arg float link_density: The networks's desired link density. :arg bool non_local: Determines, whether links between spatially close nodes should be suppressed. :arg str node_weight_type: The type of geographical node weight to be used. :arg bool winter_only: Determines, whether only data points from the winter months (December, January and February) should be used for analysis. Possibly, this further suppresses the annual cycle in the time series. :arg int silence_level: The inverse level of verbosity of the object. """ if silence_level <= 1: print "Generating a Spearman climate network..." # Call constructor of parent class TsonisClimateNetwork TsonisClimateNetwork.__init__(self, data=data, threshold=threshold, link_density=link_density, non_local=non_local, node_weight_type=node_weight_type, winter_only=winter_only, silence_level=silence_level) def __str__(self): """ Returns a string representation of SpearmanClimateNetwork. """ return ('SpearmanClimateNetwork:\n' + TsonisClimateNetwork.__str__(self)) # # Defines methods to calculate the correlation matrix # @staticmethod def rank_time_series(anomaly): """ Return rank time series. Ranks are generated individually for each time series. :type anomaly: 2D Numpy array [time, index] :arg anomaly: The anomaly time series to be converted into ranks. :rtype: 2D Numpy array [time, index] :return: the rank time series. """ # Obtain rank time series rank_time_series = anomaly.argsort(axis=0).argsort(axis=0) return rank_time_series def _calculate_correlation(self, anomaly): """ Return Spearman's rho matrix at zero lag. :type anomaly: 2D Numpy array (time, index) :arg anomaly: the anomaly time series from to calculate the correlation matrix at zero lag. :rtype: 2D Numpy array (index, index) :return: the Spearman's rho matrix at zero lag. """ if self.silence_level <= 1: print "Calculating Spearman Rho matrix at zero lag from anomaly \ values..." # Convert anomaly time series to time series of ranks ranks = self.rank_time_series(anomaly) # Cast to float32 type to save memory since correlation coefficients # are not needed in high floating point precision. spearman_rho = np.corrcoef(ranks.transpose()).astype("float32") return spearman_rho
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 1134, 29067, 14, 199, 3, 1898, 334, 35, 9, 9079, 306, 7806, 1603, 265, 1619, 290, 481, 14, 7529, 3389, 436, 1134, 29067, 11462, 199, 3, 2851, 26, 665, 1014, 921, 1544, 14, 1038, 75, 13, 14173, 3893, 455, 14, 271, 15, 6334, 15, 13196, 3389, 15, 15619, 30, 199, 3, 844, 26, 6289, 334, 19, 13, 8501, 9, 199, 199, 624, 199, 17473, 3992, 367, 12999, 436, 5909, 20135, 6114, 286, 31583, 11759, 14, 199, 624, 199, 199, 3, 199, 3, 221, 3161, 22829, 1009, 6117, 199, 3, 199, 199, 3, 221, 3161, 20602, 367, 314, 1625, 909, 436, 7377, 10330, 11818, 199, 646, 2680, 465, 980, 199, 199, 3, 221, 3161, 20087, 52, 834, 374, 35, 31583, 4491, 367, 377, 834, 374, 35, 31583, 4491, 1021, 199, 504, 1275, 84, 834, 374, 492, 377, 834, 374, 35, 31583, 4491, 421, 199, 3, 199, 3, 221, 13930, 1021, 377, 834, 374, 35, 31583, 4491, 199, 3, 199, 199, 533, 428, 16343, 1237, 35, 31583, 4491, 8, 52, 834, 374, 35, 31583, 4491, 304, 339, 408, 272, 3447, 12029, 5434, 282, 428, 16343, 1237, 286, 31583, 2784, 14, 339, 710, 428, 16343, 1237, 286, 31583, 2784, 365, 14701, 687, 314, 428, 16343, 1237, 6915, 1865, 272, 21280, 3634, 334, 51, 16343, 1237, 1159, 17908, 680, 428, 16343, 1237, 1159, 17908, 365, 1655, 23399, 543, 272, 14021, 370, 312, 13987, 1192, 436, 2222, 13, 22911, 666, 10208, 2419, 314, 510, 2210, 834, 272, 21280, 9421, 1202, 315, 520, 533, 1705, 52, 834, 374, 35, 31583, 4491, 2313, 339, 869, 4894, 12, 428, 16343, 1237, 286, 31583, 11759, 787, 625, 12080, 7037, 370, 314, 30246, 402, 314, 272, 428, 16343, 1237, 1159, 17908, 3634, 14, 272, 408, 339, 327, 272, 327, 221, 25022, 5007, 3102, 272, 327, 339, 347, 636, 826, 721, 277, 12, 666, 12, 8765, 29, 403, 12, 2142, 63, 15669, 29, 403, 12, 326, 2222, 63, 1832, 29, 797, 12, 1031, 63, 3463, 63, 466, 628, 10992, 401, 336, 1058, 63, 2118, 29, 549, 12, 326, 9767, 21225, 63, 1896, 29, 16, 304, 267, 408, 267, 11578, 376, 1256, 402, 520, 533, 1705, 51, 16343, 1237, 35, 31583, 4491, 2313, 398, 2508, 5317, 447, 1779, 13083, 8765, 1011, 726, 538, 2142, 63, 15669, 1172, 370, 506, 1627, 1, 398, 18558, 3415, 367, 1124, 932, 63, 3463, 63, 466, 18983, 881, 446, 488, 334, 4083, 4137, 4931, 9, 881, 446, 298, 10992, 2, 334, 5197, 8396, 9, 881, 446, 298, 723, 322, 5360, 2, 334, 5197, 538, 18, 8396, 9, 398, 520, 466, 666, 26, 520, 533, 5026, 35, 31583, 1451, 64, 267, 520, 1273, 666, 26, 710, 286, 31583, 666, 1202, 367, 2784, 14538, 14, 267, 520, 1273, 2069, 8765, 26, 710, 8765, 402, 22838, 9775, 12, 3432, 1314, 288, 2877, 3380, 787, 10632, 315, 314, 2784, 14, 267, 520, 1273, 2069, 2142, 63, 15669, 26, 710, 11759, 1159, 6387, 2142, 13650, 14, 267, 520, 1273, 2155, 2222, 63, 1832, 26, 22391, 12, 3775, 6220, 3382, 5844, 9406, 4002, 288, 3380, 1077, 506, 30581, 14, 267, 520, 1273, 620, 1031, 63, 3463, 63, 466, 26, 710, 730, 402, 8509, 2180, 2652, 1031, 5401, 370, 506, 288, 1202, 14, 267, 520, 1273, 2155, 336, 1058, 63, 2118, 26, 22391, 12, 3775, 1454, 666, 4501, 687, 314, 288, 336, 1058, 20096, 334, 872, 26381, 12, 17474, 20527, 436, 21141, 26709, 9, 1077, 506, 1202, 367, 288, 11284, 14, 25987, 9312, 12, 642, 9848, 4973, 4357, 314, 21172, 1061, 8643, 315, 314, 288, 900, 6779, 14, 267, 520, 1273, 1109, 9767, 21225, 63, 1896, 26, 710, 11484, 2166, 402, 8661, 402, 314, 909, 14, 267, 408, 398, 340, 9767, 21225, 63, 1896, 2695, 413, 26, 288, 870, 298, 29244, 282, 428, 16343, 1237, 286, 31583, 2784, 11500, 398, 327, 221, 6523, 3787, 402, 1676, 1021, 377, 834, 374, 35, 31583, 4491, 267, 377, 834, 374, 35, 31583, 4491, 855, 826, 721, 277, 12, 666, 29, 576, 12, 8765, 29, 7227, 12, 4228, 2142, 63, 15669, 29, 1073, 63, 15669, 12, 4228, 2222, 63, 1832, 29, 2865, 63, 1832, 12, 4228, 1031, 63, 3463, 63, 466, 29, 932, 63, 3463, 63, 466, 12, 4228, 336, 1058, 63, 2118, 29, 87, 1058, 63, 2118, 12, 4228, 9767, 21225, 63, 1896, 29, 338, 17072, 63, 1896, 9, 339, 347, 636, 495, 721, 277, 304, 267, 408, 267, 1803, 282, 1059, 6025, 402, 428, 16343, 1237, 35, 31583, 4491, 14, 267, 408, 267, 372, 661, 51, 16343, 1237, 35, 31583, 4491, 3427, 78, 7, 435, 355, 377, 834, 374, 35, 31583, 4491, 855, 495, 721, 277, 430, 339, 327, 272, 327, 221, 25022, 3102, 370, 8671, 314, 21280, 3634, 272, 327, 339, 768, 4639, 272, 347, 6915, 63, 521, 63, 5602, 8, 32048, 304, 267, 408, 267, 1432, 6915, 900, 6779, 14, 398, 820, 25088, 787, 4046, 7814, 3163, 367, 1924, 900, 6779, 14, 398, 520, 466, 28813, 26, 499, 36, 20535, 1625, 359, 521, 12, 1478, 61, 267, 520, 1273, 28813, 26, 710, 28813, 900, 6779, 370, 506, 6702, 1901, 6915, 83, 14, 398, 520, 4500, 26, 499, 36, 20535, 1625, 359, 521, 12, 1478, 61, 267, 520, 1107, 26, 314, 6915, 900, 6779, 14, 267, 408, 267, 327, 221, 17985, 877, 6915, 900, 6779, 267, 6915, 63, 521, 63, 5602, 275, 28813, 14, 20188, 8, 3127, 29, 16, 680, 20188, 8, 3127, 29, 16, 9, 398, 372, 6915, 63, 521, 63, 5602, 339, 347, 485, 12063, 63, 26487, 8, 277, 12, 28813, 304, 267, 408, 267, 1432, 428, 16343, 1237, 1159, 17908, 3634, 737, 4697, 17891, 14, 398, 520, 466, 28813, 26, 499, 36, 20535, 1625, 334, 521, 12, 1478, 9, 267, 520, 1273, 28813, 26, 314, 28813, 900, 6779, 687, 370, 8671, 314, 21280, 2151, 3634, 737, 4697, 17891, 14, 398, 520, 4500, 26, 499, 36, 20535, 1625, 334, 1080, 12, 1478, 9, 267, 520, 1107, 26, 314, 428, 16343, 1237, 1159, 17908, 3634, 737, 4697, 17891, 14, 267, 408, 267, 340, 291, 14, 338, 17072, 63, 1896, 2695, 413, 26, 288, 870 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 1134, 29067, 14, 199, 3, 1898, 334, 35, 9, 9079, 306, 7806, 1603, 265, 1619, 290, 481, 14, 7529, 3389, 436, 1134, 29067, 11462, 199, 3, 2851, 26, 665, 1014, 921, 1544, 14, 1038, 75, 13, 14173, 3893, 455, 14, 271, 15, 6334, 15, 13196, 3389, 15, 15619, 30, 199, 3, 844, 26, 6289, 334, 19, 13, 8501, 9, 199, 199, 624, 199, 17473, 3992, 367, 12999, 436, 5909, 20135, 6114, 286, 31583, 11759, 14, 199, 624, 199, 199, 3, 199, 3, 221, 3161, 22829, 1009, 6117, 199, 3, 199, 199, 3, 221, 3161, 20602, 367, 314, 1625, 909, 436, 7377, 10330, 11818, 199, 646, 2680, 465, 980, 199, 199, 3, 221, 3161, 20087, 52, 834, 374, 35, 31583, 4491, 367, 377, 834, 374, 35, 31583, 4491, 1021, 199, 504, 1275, 84, 834, 374, 492, 377, 834, 374, 35, 31583, 4491, 421, 199, 3, 199, 3, 221, 13930, 1021, 377, 834, 374, 35, 31583, 4491, 199, 3, 199, 199, 533, 428, 16343, 1237, 35, 31583, 4491, 8, 52, 834, 374, 35, 31583, 4491, 304, 339, 408, 272, 3447, 12029, 5434, 282, 428, 16343, 1237, 286, 31583, 2784, 14, 339, 710, 428, 16343, 1237, 286, 31583, 2784, 365, 14701, 687, 314, 428, 16343, 1237, 6915, 1865, 272, 21280, 3634, 334, 51, 16343, 1237, 1159, 17908, 680, 428, 16343, 1237, 1159, 17908, 365, 1655, 23399, 543, 272, 14021, 370, 312, 13987, 1192, 436, 2222, 13, 22911, 666, 10208, 2419, 314, 510, 2210, 834, 272, 21280, 9421, 1202, 315, 520, 533, 1705, 52, 834, 374, 35, 31583, 4491, 2313, 339, 869, 4894, 12, 428, 16343, 1237, 286, 31583, 11759, 787, 625, 12080, 7037, 370, 314, 30246, 402, 314, 272, 428, 16343, 1237, 1159, 17908, 3634, 14, 272, 408, 339, 327, 272, 327, 221, 25022, 5007, 3102, 272, 327, 339, 347, 636, 826, 721, 277, 12, 666, 12, 8765, 29, 403, 12, 2142, 63, 15669, 29, 403, 12, 326, 2222, 63, 1832, 29, 797, 12, 1031, 63, 3463, 63, 466, 628, 10992, 401, 336, 1058, 63, 2118, 29, 549, 12, 326, 9767, 21225, 63, 1896, 29, 16, 304, 267, 408, 267, 11578, 376, 1256, 402, 520, 533, 1705, 51, 16343, 1237, 35, 31583, 4491, 2313, 398, 2508, 5317, 447, 1779, 13083, 8765, 1011, 726, 538, 2142, 63, 15669, 1172, 370, 506, 1627, 1, 398, 18558, 3415, 367, 1124, 932, 63, 3463, 63, 466, 18983, 881, 446, 488, 334, 4083, 4137, 4931, 9, 881, 446, 298, 10992, 2, 334, 5197, 8396, 9, 881, 446, 298, 723, 322, 5360, 2, 334, 5197, 538, 18, 8396, 9, 398, 520, 466, 666, 26, 520, 533, 5026, 35, 31583, 1451, 64, 267, 520, 1273, 666, 26, 710, 286, 31583, 666, 1202, 367, 2784, 14538, 14, 267, 520, 1273, 2069, 8765, 26, 710, 8765, 402, 22838, 9775, 12, 3432, 1314, 288, 2877, 3380, 787, 10632, 315, 314, 2784, 14, 267, 520, 1273, 2069, 2142, 63, 15669, 26, 710, 11759, 1159, 6387, 2142, 13650, 14, 267, 520, 1273, 2155, 2222, 63, 1832, 26, 22391, 12, 3775, 6220, 3382, 5844, 9406, 4002, 288, 3380, 1077, 506, 30581, 14, 267, 520, 1273, 620, 1031, 63, 3463, 63, 466, 26, 710, 730, 402, 8509, 2180, 2652, 1031, 5401, 370, 506, 288, 1202, 14, 267, 520, 1273, 2155, 336, 1058, 63, 2118, 26, 22391, 12, 3775, 1454, 666, 4501, 687, 314, 288, 336, 1058, 20096, 334, 872, 26381, 12, 17474, 20527, 436, 21141, 26709, 9, 1077, 506, 1202, 367, 288, 11284, 14, 25987, 9312, 12, 642, 9848, 4973, 4357, 314, 21172, 1061, 8643, 315, 314, 288, 900, 6779, 14, 267, 520, 1273, 1109, 9767, 21225, 63, 1896, 26, 710, 11484, 2166, 402, 8661, 402, 314, 909, 14, 267, 408, 398, 340, 9767, 21225, 63, 1896, 2695, 413, 26, 288, 870, 298, 29244, 282, 428, 16343, 1237, 286, 31583, 2784, 11500, 398, 327, 221, 6523, 3787, 402, 1676, 1021, 377, 834, 374, 35, 31583, 4491, 267, 377, 834, 374, 35, 31583, 4491, 855, 826, 721, 277, 12, 666, 29, 576, 12, 8765, 29, 7227, 12, 4228, 2142, 63, 15669, 29, 1073, 63, 15669, 12, 4228, 2222, 63, 1832, 29, 2865, 63, 1832, 12, 4228, 1031, 63, 3463, 63, 466, 29, 932, 63, 3463, 63, 466, 12, 4228, 336, 1058, 63, 2118, 29, 87, 1058, 63, 2118, 12, 4228, 9767, 21225, 63, 1896, 29, 338, 17072, 63, 1896, 9, 339, 347, 636, 495, 721, 277, 304, 267, 408, 267, 1803, 282, 1059, 6025, 402, 428, 16343, 1237, 35, 31583, 4491, 14, 267, 408, 267, 372, 661, 51, 16343, 1237, 35, 31583, 4491, 3427, 78, 7, 435, 355, 377, 834, 374, 35, 31583, 4491, 855, 495, 721, 277, 430, 339, 327, 272, 327, 221, 25022, 3102, 370, 8671, 314, 21280, 3634, 272, 327, 339, 768, 4639, 272, 347, 6915, 63, 521, 63, 5602, 8, 32048, 304, 267, 408, 267, 1432, 6915, 900, 6779, 14, 398, 820, 25088, 787, 4046, 7814, 3163, 367, 1924, 900, 6779, 14, 398, 520, 466, 28813, 26, 499, 36, 20535, 1625, 359, 521, 12, 1478, 61, 267, 520, 1273, 28813, 26, 710, 28813, 900, 6779, 370, 506, 6702, 1901, 6915, 83, 14, 398, 520, 4500, 26, 499, 36, 20535, 1625, 359, 521, 12, 1478, 61, 267, 520, 1107, 26, 314, 6915, 900, 6779, 14, 267, 408, 267, 327, 221, 17985, 877, 6915, 900, 6779, 267, 6915, 63, 521, 63, 5602, 275, 28813, 14, 20188, 8, 3127, 29, 16, 680, 20188, 8, 3127, 29, 16, 9, 398, 372, 6915, 63, 521, 63, 5602, 339, 347, 485, 12063, 63, 26487, 8, 277, 12, 28813, 304, 267, 408, 267, 1432, 428, 16343, 1237, 1159, 17908, 3634, 737, 4697, 17891, 14, 398, 520, 466, 28813, 26, 499, 36, 20535, 1625, 334, 521, 12, 1478, 9, 267, 520, 1273, 28813, 26, 314, 28813, 900, 6779, 687, 370, 8671, 314, 21280, 2151, 3634, 737, 4697, 17891, 14, 398, 520, 4500, 26, 499, 36, 20535, 1625, 334, 1080, 12, 1478, 9, 267, 520, 1107, 26, 314, 428, 16343, 1237, 1159, 17908, 3634, 737, 4697, 17891, 14, 267, 408, 267, 340, 291, 14, 338, 17072, 63, 1896, 2695, 413, 26, 288, 870, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
shuggiefisher/django-on-google-app-engine-base
django/contrib/comments/forms.py
245
8730
import time import datetime from django import forms from django.forms.util import ErrorDict from django.conf import settings from django.contrib.contenttypes.models import ContentType from models import Comment from django.utils.crypto import salted_hmac, constant_time_compare from django.utils.encoding import force_unicode from django.utils.hashcompat import sha_constructor from django.utils.text import get_text_list from django.utils.translation import ungettext, ugettext_lazy as _ COMMENT_MAX_LENGTH = getattr(settings,'COMMENT_MAX_LENGTH', 3000) class CommentSecurityForm(forms.Form): """ Handles the security aspects (anti-spoofing) for comment forms. """ content_type = forms.CharField(widget=forms.HiddenInput) object_pk = forms.CharField(widget=forms.HiddenInput) timestamp = forms.IntegerField(widget=forms.HiddenInput) security_hash = forms.CharField(min_length=40, max_length=40, widget=forms.HiddenInput) def __init__(self, target_object, data=None, initial=None): self.target_object = target_object if initial is None: initial = {} initial.update(self.generate_security_data()) super(CommentSecurityForm, self).__init__(data=data, initial=initial) def security_errors(self): """Return just those errors associated with security""" errors = ErrorDict() for f in ["honeypot", "timestamp", "security_hash"]: if f in self.errors: errors[f] = self.errors[f] return errors def clean_security_hash(self): """Check the security hash.""" security_hash_dict = { 'content_type' : self.data.get("content_type", ""), 'object_pk' : self.data.get("object_pk", ""), 'timestamp' : self.data.get("timestamp", ""), } expected_hash = self.generate_security_hash(**security_hash_dict) actual_hash = self.cleaned_data["security_hash"] if not constant_time_compare(expected_hash, actual_hash): # Fallback to Django 1.2 method for compatibility # PendingDeprecationWarning <- here to remind us to remove this # fallback in Django 1.5 expected_hash_old = self._generate_security_hash_old(**security_hash_dict) if not constant_time_compare(expected_hash_old, actual_hash): raise forms.ValidationError("Security hash check failed.") return actual_hash def clean_timestamp(self): """Make sure the timestamp isn't too far (> 2 hours) in the past.""" ts = self.cleaned_data["timestamp"] if time.time() - ts > (2 * 60 * 60): raise forms.ValidationError("Timestamp check failed") return ts def generate_security_data(self): """Generate a dict of security data for "initial" data.""" timestamp = int(time.time()) security_dict = { 'content_type' : str(self.target_object._meta), 'object_pk' : str(self.target_object._get_pk_val()), 'timestamp' : str(timestamp), 'security_hash' : self.initial_security_hash(timestamp), } return security_dict def initial_security_hash(self, timestamp): """ Generate the initial security hash from self.content_object and a (unix) timestamp. """ initial_security_dict = { 'content_type' : str(self.target_object._meta), 'object_pk' : str(self.target_object._get_pk_val()), 'timestamp' : str(timestamp), } return self.generate_security_hash(**initial_security_dict) def generate_security_hash(self, content_type, object_pk, timestamp): """ Generate a HMAC security hash from the provided info. """ info = (content_type, object_pk, timestamp) key_salt = "django.contrib.forms.CommentSecurityForm" value = "-".join(info) return salted_hmac(key_salt, value).hexdigest() def _generate_security_hash_old(self, content_type, object_pk, timestamp): """Generate a (SHA1) security hash from the provided info.""" # Django 1.2 compatibility info = (content_type, object_pk, timestamp, settings.SECRET_KEY) return sha_constructor("".join(info)).hexdigest() class CommentDetailsForm(CommentSecurityForm): """ Handles the specific details of the comment (name, comment, etc.). """ name = forms.CharField(label=_("Name"), max_length=50) email = forms.EmailField(label=_("Email address")) url = forms.URLField(label=_("URL"), required=False) comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, max_length=COMMENT_MAX_LENGTH) def get_comment_object(self): """ Return a new (unsaved) comment object based on the information in this form. Assumes that the form is already validated and will throw a ValueError if not. Does not set any of the fields that would come from a Request object (i.e. ``user`` or ``ip_address``). """ if not self.is_valid(): raise ValueError("get_comment_object may only be called on valid forms") CommentModel = self.get_comment_model() new = CommentModel(**self.get_comment_create_data()) new = self.check_for_duplicate_comment(new) return new def get_comment_model(self): """ Get the comment model to create with this form. Subclasses in custom comment apps should override this, get_comment_create_data, and perhaps check_for_duplicate_comment to provide custom comment models. """ return Comment def get_comment_create_data(self): """ Returns the dict of data to be used to create a comment. Subclasses in custom comment apps that override get_comment_model can override this method to add extra fields onto a custom comment model. """ return dict( content_type = ContentType.objects.get_for_model(self.target_object), object_pk = force_unicode(self.target_object._get_pk_val()), user_name = self.cleaned_data["name"], user_email = self.cleaned_data["email"], user_url = self.cleaned_data["url"], comment = self.cleaned_data["comment"], submit_date = datetime.datetime.now(), site_id = settings.SITE_ID, is_public = True, is_removed = False, ) def check_for_duplicate_comment(self, new): """ Check that a submitted comment isn't a duplicate. This might be caused by someone posting a comment twice. If it is a dup, silently return the *previous* comment. """ possible_duplicates = self.get_comment_model()._default_manager.using( self.target_object._state.db ).filter( content_type = new.content_type, object_pk = new.object_pk, user_name = new.user_name, user_email = new.user_email, user_url = new.user_url, ) for old in possible_duplicates: if old.submit_date.date() == new.submit_date.date() and old.comment == new.comment: return old return new def clean_comment(self): """ If COMMENTS_ALLOW_PROFANITIES is False, check that the comment doesn't contain anything in PROFANITIES_LIST. """ comment = self.cleaned_data["comment"] if settings.COMMENTS_ALLOW_PROFANITIES == False: bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()] if bad_words: plural = len(bad_words) > 1 raise forms.ValidationError(ungettext( "Watch your mouth! The word %s is not allowed here.", "Watch your mouth! The words %s are not allowed here.", plural) % \ get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and')) return comment class CommentForm(CommentDetailsForm): honeypot = forms.CharField(required=False, label=_('If you enter anything in this field '\ 'your comment will be treated as spam')) def clean_honeypot(self): """Check that nothing's been entered into the honeypot.""" value = self.cleaned_data["honeypot"] if value: raise forms.ValidationError(self.fields["honeypot"].label) return value
bsd-3-clause
[ 646, 900, 199, 646, 2197, 199, 199, 504, 1639, 492, 4513, 199, 504, 1639, 14, 3351, 14, 1974, 492, 4520, 2141, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 10778, 14, 992, 492, 14501, 199, 504, 1709, 492, 6819, 199, 504, 1639, 14, 1208, 14, 10316, 492, 18641, 471, 63, 18537, 12, 4413, 63, 521, 63, 5785, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2975, 199, 504, 1639, 14, 1208, 14, 2227, 5819, 492, 7793, 63, 1880, 199, 504, 1639, 14, 1208, 14, 505, 492, 664, 63, 505, 63, 513, 199, 504, 1639, 14, 1208, 14, 6893, 492, 26843, 12, 10366, 63, 6395, 465, 485, 199, 199, 10973, 63, 4283, 63, 9127, 275, 2519, 8, 1751, 2584, 10973, 63, 4283, 63, 9127, 297, 29664, 9, 199, 199, 533, 6819, 7676, 2821, 8, 3351, 14, 2821, 304, 272, 408, 272, 23873, 314, 6391, 17435, 83, 334, 4466, 13, 22522, 1618, 316, 9, 367, 3721, 4513, 14, 272, 408, 272, 1564, 63, 466, 221, 275, 4513, 14, 2183, 8, 3440, 29, 3351, 14, 25419, 9, 272, 909, 63, 2051, 258, 275, 4513, 14, 2183, 8, 3440, 29, 3351, 14, 25419, 9, 272, 4913, 258, 275, 4513, 14, 3901, 8, 3440, 29, 3351, 14, 25419, 9, 272, 6391, 63, 2227, 275, 4513, 14, 2183, 8, 827, 63, 1267, 29, 2167, 12, 1390, 63, 1267, 29, 2167, 12, 3938, 29, 3351, 14, 25419, 9, 339, 347, 636, 826, 721, 277, 12, 1347, 63, 785, 12, 666, 29, 403, 12, 2536, 29, 403, 304, 267, 291, 14, 1375, 63, 785, 275, 1347, 63, 785, 267, 340, 2536, 365, 488, 26, 288, 2536, 275, 1052, 267, 2536, 14, 873, 8, 277, 14, 4208, 63, 4416, 63, 576, 1012, 267, 1613, 8, 7488, 7676, 2821, 12, 291, 2843, 826, 721, 576, 29, 576, 12, 2536, 29, 2747, 9, 339, 347, 6391, 63, 2550, 8, 277, 304, 267, 408, 1767, 2951, 5204, 2552, 4568, 543, 6391, 624, 267, 2552, 275, 4520, 2141, 342, 267, 367, 289, 315, 2097, 72, 368, 2279, 357, 401, 298, 3954, 401, 298, 4416, 63, 2227, 6229, 288, 340, 289, 315, 291, 14, 2550, 26, 355, 2552, 59, 70, 61, 275, 291, 14, 2550, 59, 70, 61, 267, 372, 2552, 339, 347, 3633, 63, 4416, 63, 2227, 8, 277, 304, 267, 408, 1799, 314, 6391, 2631, 1041, 267, 6391, 63, 2227, 63, 807, 275, 469, 288, 283, 1317, 63, 466, 7, 520, 291, 14, 576, 14, 362, 480, 1317, 63, 466, 401, 16241, 288, 283, 785, 63, 2051, 7, 520, 291, 14, 576, 14, 362, 480, 785, 63, 2051, 401, 16241, 288, 283, 3954, 7, 520, 291, 14, 576, 14, 362, 480, 3954, 401, 16241, 267, 789, 267, 1420, 63, 2227, 275, 291, 14, 4208, 63, 4416, 63, 2227, 3682, 4416, 63, 2227, 63, 807, 9, 267, 3503, 63, 2227, 275, 291, 14, 8275, 63, 576, 905, 4416, 63, 2227, 937, 267, 340, 440, 4413, 63, 521, 63, 5785, 8, 2062, 63, 2227, 12, 3503, 63, 2227, 304, 288, 327, 481, 5421, 370, 5634, 413, 14, 18, 1083, 367, 7163, 288, 327, 29216, 15561, 25549, 2348, 370, 18798, 688, 2739, 370, 2813, 642, 288, 327, 9567, 315, 5634, 413, 14, 21, 288, 1420, 63, 2227, 63, 1753, 275, 291, 423, 4208, 63, 4416, 63, 2227, 63, 1753, 3682, 4416, 63, 2227, 63, 807, 9, 288, 340, 440, 4413, 63, 521, 63, 5785, 8, 2062, 63, 2227, 63, 1753, 12, 3503, 63, 2227, 304, 355, 746, 4513, 14, 8172, 480, 7676, 2631, 1104, 3405, 2685, 267, 372, 3503, 63, 2227, 339, 347, 3633, 63, 3954, 8, 277, 304, 267, 408, 5483, 3238, 314, 4913, 5712, 1133, 4634, 12474, 334, 30, 499, 10857, 9, 315, 314, 13541, 1041, 267, 6714, 275, 291, 14, 8275, 63, 576, 905, 3954, 937, 267, 340, 900, 14, 521, 342, 446, 6714, 690, 334, 18, 627, 5212, 627, 5212, 304, 288, 746, 4513, 14, 8172, 480, 10239, 1104, 3405, 531, 267, 372, 6714, 339, 347, 3550, 63, 4416, 63, 576, 8, 277, 304, 267, 408, 6864, 282, 1211, 402, 6391, 666, 367, 298, 2747, 2, 666, 1041, 267, 4913, 275, 1109, 8, 521, 14, 521, 1012, 267, 6391, 63, 807, 275, 257, 469, 288, 283, 1317, 63, 466, 7, 221, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 2024, 395, 288, 283, 785, 63, 2051, 7, 258, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 362, 63, 2051, 63, 637, 4000, 288, 283, 3954, 7, 258, 520, 620, 8, 3954, 395, 288, 283, 4416, 63, 2227, 7, 520, 291, 14, 2747, 63, 4416, 63, 2227, 8, 3954, 395, 267, 789, 267, 372, 6391, 63, 807, 339, 347, 2536, 63, 4416, 63, 2227, 8, 277, 12, 4913, 304, 267, 408, 267, 7958, 314, 2536, 6391, 2631, 687, 291, 14, 1317, 63, 785, 267, 436, 282, 334, 11864, 9, 4913, 14, 267, 408, 398, 2536, 63, 4416, 63, 807, 275, 469, 288, 283, 1317, 63, 466, 7, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 2024, 395, 288, 283, 785, 63, 2051, 7, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 362, 63, 2051, 63, 637, 4000, 288, 283, 3954, 7, 520, 620, 8, 3954, 395, 881, 789, 267, 372, 291, 14, 4208, 63, 4416, 63, 2227, 3682, 2747, 63, 4416, 63, 807, 9, 339, 347, 3550, 63, 4416, 63, 2227, 8, 277, 12, 1564, 63, 466, 12, 909, 63, 2051, 12, 4913, 304, 267, 408, 267, 7958, 282, 29817, 6391, 2631, 687, 314, 2741, 2256, 14, 267, 408, 267, 2256, 275, 334, 1317, 63, 466, 12, 909, 63, 2051, 12, 4913, 9, 267, 790, 63, 12597, 275, 298, 1176, 14, 2828, 14, 3351, 14, 7488, 7676, 2821, 2, 267, 574, 275, 3905, 1674, 904, 8, 815, 9, 267, 372, 18641, 471, 63, 18537, 8, 498, 63, 12597, 12, 574, 680, 11453, 342, 339, 347, 485, 4208, 63, 4416, 63, 2227, 63, 1753, 8, 277, 12, 1564, 63, 466, 12, 909, 63, 2051, 12, 4913, 304, 267, 408, 6864, 282, 334, 8461, 17, 9, 6391, 2631, 687, 314, 2741, 2256, 1041, 267, 327, 5634, 413, 14, 18, 7163, 267, 2256, 275, 334, 1317, 63, 466 ]
[ 900, 199, 646, 2197, 199, 199, 504, 1639, 492, 4513, 199, 504, 1639, 14, 3351, 14, 1974, 492, 4520, 2141, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 10778, 14, 992, 492, 14501, 199, 504, 1709, 492, 6819, 199, 504, 1639, 14, 1208, 14, 10316, 492, 18641, 471, 63, 18537, 12, 4413, 63, 521, 63, 5785, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2975, 199, 504, 1639, 14, 1208, 14, 2227, 5819, 492, 7793, 63, 1880, 199, 504, 1639, 14, 1208, 14, 505, 492, 664, 63, 505, 63, 513, 199, 504, 1639, 14, 1208, 14, 6893, 492, 26843, 12, 10366, 63, 6395, 465, 485, 199, 199, 10973, 63, 4283, 63, 9127, 275, 2519, 8, 1751, 2584, 10973, 63, 4283, 63, 9127, 297, 29664, 9, 199, 199, 533, 6819, 7676, 2821, 8, 3351, 14, 2821, 304, 272, 408, 272, 23873, 314, 6391, 17435, 83, 334, 4466, 13, 22522, 1618, 316, 9, 367, 3721, 4513, 14, 272, 408, 272, 1564, 63, 466, 221, 275, 4513, 14, 2183, 8, 3440, 29, 3351, 14, 25419, 9, 272, 909, 63, 2051, 258, 275, 4513, 14, 2183, 8, 3440, 29, 3351, 14, 25419, 9, 272, 4913, 258, 275, 4513, 14, 3901, 8, 3440, 29, 3351, 14, 25419, 9, 272, 6391, 63, 2227, 275, 4513, 14, 2183, 8, 827, 63, 1267, 29, 2167, 12, 1390, 63, 1267, 29, 2167, 12, 3938, 29, 3351, 14, 25419, 9, 339, 347, 636, 826, 721, 277, 12, 1347, 63, 785, 12, 666, 29, 403, 12, 2536, 29, 403, 304, 267, 291, 14, 1375, 63, 785, 275, 1347, 63, 785, 267, 340, 2536, 365, 488, 26, 288, 2536, 275, 1052, 267, 2536, 14, 873, 8, 277, 14, 4208, 63, 4416, 63, 576, 1012, 267, 1613, 8, 7488, 7676, 2821, 12, 291, 2843, 826, 721, 576, 29, 576, 12, 2536, 29, 2747, 9, 339, 347, 6391, 63, 2550, 8, 277, 304, 267, 408, 1767, 2951, 5204, 2552, 4568, 543, 6391, 624, 267, 2552, 275, 4520, 2141, 342, 267, 367, 289, 315, 2097, 72, 368, 2279, 357, 401, 298, 3954, 401, 298, 4416, 63, 2227, 6229, 288, 340, 289, 315, 291, 14, 2550, 26, 355, 2552, 59, 70, 61, 275, 291, 14, 2550, 59, 70, 61, 267, 372, 2552, 339, 347, 3633, 63, 4416, 63, 2227, 8, 277, 304, 267, 408, 1799, 314, 6391, 2631, 1041, 267, 6391, 63, 2227, 63, 807, 275, 469, 288, 283, 1317, 63, 466, 7, 520, 291, 14, 576, 14, 362, 480, 1317, 63, 466, 401, 16241, 288, 283, 785, 63, 2051, 7, 520, 291, 14, 576, 14, 362, 480, 785, 63, 2051, 401, 16241, 288, 283, 3954, 7, 520, 291, 14, 576, 14, 362, 480, 3954, 401, 16241, 267, 789, 267, 1420, 63, 2227, 275, 291, 14, 4208, 63, 4416, 63, 2227, 3682, 4416, 63, 2227, 63, 807, 9, 267, 3503, 63, 2227, 275, 291, 14, 8275, 63, 576, 905, 4416, 63, 2227, 937, 267, 340, 440, 4413, 63, 521, 63, 5785, 8, 2062, 63, 2227, 12, 3503, 63, 2227, 304, 288, 327, 481, 5421, 370, 5634, 413, 14, 18, 1083, 367, 7163, 288, 327, 29216, 15561, 25549, 2348, 370, 18798, 688, 2739, 370, 2813, 642, 288, 327, 9567, 315, 5634, 413, 14, 21, 288, 1420, 63, 2227, 63, 1753, 275, 291, 423, 4208, 63, 4416, 63, 2227, 63, 1753, 3682, 4416, 63, 2227, 63, 807, 9, 288, 340, 440, 4413, 63, 521, 63, 5785, 8, 2062, 63, 2227, 63, 1753, 12, 3503, 63, 2227, 304, 355, 746, 4513, 14, 8172, 480, 7676, 2631, 1104, 3405, 2685, 267, 372, 3503, 63, 2227, 339, 347, 3633, 63, 3954, 8, 277, 304, 267, 408, 5483, 3238, 314, 4913, 5712, 1133, 4634, 12474, 334, 30, 499, 10857, 9, 315, 314, 13541, 1041, 267, 6714, 275, 291, 14, 8275, 63, 576, 905, 3954, 937, 267, 340, 900, 14, 521, 342, 446, 6714, 690, 334, 18, 627, 5212, 627, 5212, 304, 288, 746, 4513, 14, 8172, 480, 10239, 1104, 3405, 531, 267, 372, 6714, 339, 347, 3550, 63, 4416, 63, 576, 8, 277, 304, 267, 408, 6864, 282, 1211, 402, 6391, 666, 367, 298, 2747, 2, 666, 1041, 267, 4913, 275, 1109, 8, 521, 14, 521, 1012, 267, 6391, 63, 807, 275, 257, 469, 288, 283, 1317, 63, 466, 7, 221, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 2024, 395, 288, 283, 785, 63, 2051, 7, 258, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 362, 63, 2051, 63, 637, 4000, 288, 283, 3954, 7, 258, 520, 620, 8, 3954, 395, 288, 283, 4416, 63, 2227, 7, 520, 291, 14, 2747, 63, 4416, 63, 2227, 8, 3954, 395, 267, 789, 267, 372, 6391, 63, 807, 339, 347, 2536, 63, 4416, 63, 2227, 8, 277, 12, 4913, 304, 267, 408, 267, 7958, 314, 2536, 6391, 2631, 687, 291, 14, 1317, 63, 785, 267, 436, 282, 334, 11864, 9, 4913, 14, 267, 408, 398, 2536, 63, 4416, 63, 807, 275, 469, 288, 283, 1317, 63, 466, 7, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 2024, 395, 288, 283, 785, 63, 2051, 7, 520, 620, 8, 277, 14, 1375, 63, 785, 423, 362, 63, 2051, 63, 637, 4000, 288, 283, 3954, 7, 520, 620, 8, 3954, 395, 881, 789, 267, 372, 291, 14, 4208, 63, 4416, 63, 2227, 3682, 2747, 63, 4416, 63, 807, 9, 339, 347, 3550, 63, 4416, 63, 2227, 8, 277, 12, 1564, 63, 466, 12, 909, 63, 2051, 12, 4913, 304, 267, 408, 267, 7958, 282, 29817, 6391, 2631, 687, 314, 2741, 2256, 14, 267, 408, 267, 2256, 275, 334, 1317, 63, 466, 12, 909, 63, 2051, 12, 4913, 9, 267, 790, 63, 12597, 275, 298, 1176, 14, 2828, 14, 3351, 14, 7488, 7676, 2821, 2, 267, 574, 275, 3905, 1674, 904, 8, 815, 9, 267, 372, 18641, 471, 63, 18537, 8, 498, 63, 12597, 12, 574, 680, 11453, 342, 339, 347, 485, 4208, 63, 4416, 63, 2227, 63, 1753, 8, 277, 12, 1564, 63, 466, 12, 909, 63, 2051, 12, 4913, 304, 267, 408, 6864, 282, 334, 8461, 17, 9, 6391, 2631, 687, 314, 2741, 2256, 1041, 267, 327, 5634, 413, 14, 18, 7163, 267, 2256, 275, 334, 1317, 63, 466, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
davisein/jitsudone
django/django/contrib/localflavor/nl/forms.py
87
2859
""" NL-specific Form helpers """ from __future__ import absolute_import import re from django.contrib.localflavor.nl.nl_provinces import PROVINCE_CHOICES from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, Select from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ pc_re = re.compile('^\d{4}[A-Z]{2}$') sofi_re = re.compile('^\d{9}$') numeric_re = re.compile('^\d+$') class NLZipCodeField(Field): """ A Dutch postal code field. """ default_error_messages = { 'invalid': _('Enter a valid postal code'), } def clean(self, value): super(NLZipCodeField, self).clean(value) if value in EMPTY_VALUES: return u'' value = value.strip().upper().replace(' ', '') if not pc_re.search(value): raise ValidationError(self.error_messages['invalid']) if int(value[:4]) < 1000: raise ValidationError(self.error_messages['invalid']) return u'%s %s' % (value[:4], value[4:]) class NLProvinceSelect(Select): """ A Select widget that uses a list of provinces of the Netherlands as its choices. """ def __init__(self, attrs=None): super(NLProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) class NLPhoneNumberField(Field): """ A Dutch telephone number field. """ default_error_messages = { 'invalid': _('Enter a valid phone number'), } def clean(self, value): super(NLPhoneNumberField, self).clean(value) if value in EMPTY_VALUES: return u'' phone_nr = re.sub('[\-\s\(\)]', '', smart_unicode(value)) if len(phone_nr) == 10 and numeric_re.search(phone_nr): return value if phone_nr[:3] == '+31' and len(phone_nr) == 12 and \ numeric_re.search(phone_nr[3:]): return value raise ValidationError(self.error_messages['invalid']) class NLSoFiNumberField(Field): """ A Dutch social security number (SoFi/BSN) field. http://nl.wikipedia.org/wiki/Sofinummer """ default_error_messages = { 'invalid': _('Enter a valid SoFi number'), } def clean(self, value): super(NLSoFiNumberField, self).clean(value) if value in EMPTY_VALUES: return u'' if not sofi_re.search(value): raise ValidationError(self.error_messages['invalid']) if int(value) == 0: raise ValidationError(self.error_messages['invalid']) checksum = 0 for i in range(9, 1, -1): checksum += int(value[9-i]) * i checksum -= int(value[-1]) if checksum % 11 != 0: raise ValidationError(self.error_messages['invalid']) return value
bsd-3-clause
[ 624, 199, 14176, 13, 6100, 8204, 10897, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 295, 199, 199, 504, 1639, 14, 2828, 14, 320, 696, 276, 4271, 14, 7530, 14, 7530, 63, 496, 11908, 823, 492, 3611, 54, 568, 2089, 63, 16236, 199, 504, 1639, 14, 1018, 14, 11346, 492, 16589, 63, 15514, 199, 504, 1639, 14, 3351, 492, 8505, 199, 504, 1639, 14, 3351, 14, 955, 492, 5024, 12, 9496, 199, 504, 1639, 14, 1208, 14, 2991, 492, 11179, 63, 2975, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 421, 199, 2352, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 91, 20, 22857, 33, 13, 58, 8194, 18, 93, 9988, 199, 1152, 329, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 91, 25, 93, 9988, 199, 6677, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 11, 9988, 199, 199, 533, 24719, 8674, 3034, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 2963, 279, 1233, 901, 14, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 2963, 279, 1233, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 8674, 3034, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 574, 275, 574, 14, 1913, 1252, 4142, 1252, 1814, 360, 1656, 4074, 267, 340, 440, 13171, 63, 264, 14, 1733, 8, 585, 304, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 340, 1109, 8, 585, 1491, 20, 566, 665, 5198, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 372, 399, 5956, 83, 450, 83, 7, 450, 334, 585, 1491, 20, 467, 574, 59, 20, 5728, 199, 199, 533, 24719, 919, 86, 2855, 5446, 8, 5446, 304, 272, 408, 272, 437, 9496, 3938, 626, 4440, 282, 769, 402, 557, 11908, 823, 402, 314, 5612, 728, 31813, 465, 2399, 272, 3415, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3290, 29, 403, 304, 267, 1613, 8, 14176, 919, 86, 2855, 5446, 12, 291, 2843, 826, 721, 3288, 12, 3415, 29, 2514, 54, 568, 2089, 63, 16236, 9, 199, 199, 533, 24719, 25640, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 14001, 9339, 1329, 901, 14, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 14617, 1329, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 25640, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 14617, 63, 7865, 275, 295, 14, 954, 360, 7023, 2696, 83, 29323, 1874, 297, 3260, 11179, 63, 2975, 8, 585, 430, 398, 340, 822, 8, 9339, 63, 7865, 9, 508, 1616, 436, 8950, 63, 264, 14, 1733, 8, 9339, 63, 7865, 304, 288, 372, 574, 398, 340, 14617, 63, 7865, 1491, 19, 61, 508, 6681, 2192, 7, 436, 822, 8, 9339, 63, 7865, 9, 508, 3144, 436, 971, 1779, 8950, 63, 264, 14, 1733, 8, 9339, 63, 7865, 59, 19, 28847, 288, 372, 574, 398, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 199, 199, 533, 24719, 5158, 9047, 3259, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 20295, 6391, 1329, 334, 5158, 9047, 15, 34, 8199, 9, 901, 14, 339, 1455, 921, 7530, 14, 13961, 14, 1308, 15, 6797, 15, 51, 1618, 262, 453, 2626, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 2002, 9047, 1329, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 5158, 9047, 3259, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 340, 440, 880, 329, 63, 264, 14, 1733, 8, 585, 304, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 340, 1109, 8, 585, 9, 508, 378, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 9040, 275, 378, 267, 367, 284, 315, 1425, 8, 25, 12, 413, 12, 446, 17, 304, 288, 9040, 847, 1109, 8, 585, 59, 25, 13, 73, 566, 627, 284, 267, 9040, 4862, 1109, 8, 585, 1988, 17, 566, 398, 340, 9040, 450, 4119, 1137, 378, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 372, 574, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 14176, 13, 6100, 8204, 10897, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 295, 199, 199, 504, 1639, 14, 2828, 14, 320, 696, 276, 4271, 14, 7530, 14, 7530, 63, 496, 11908, 823, 492, 3611, 54, 568, 2089, 63, 16236, 199, 504, 1639, 14, 1018, 14, 11346, 492, 16589, 63, 15514, 199, 504, 1639, 14, 3351, 492, 8505, 199, 504, 1639, 14, 3351, 14, 955, 492, 5024, 12, 9496, 199, 504, 1639, 14, 1208, 14, 2991, 492, 11179, 63, 2975, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 421, 199, 2352, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 91, 20, 22857, 33, 13, 58, 8194, 18, 93, 9988, 199, 1152, 329, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 91, 25, 93, 9988, 199, 6677, 63, 264, 275, 295, 14, 2014, 9097, 60, 68, 11, 9988, 199, 199, 533, 24719, 8674, 3034, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 2963, 279, 1233, 901, 14, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 2963, 279, 1233, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 8674, 3034, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 574, 275, 574, 14, 1913, 1252, 4142, 1252, 1814, 360, 1656, 4074, 267, 340, 440, 13171, 63, 264, 14, 1733, 8, 585, 304, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 340, 1109, 8, 585, 1491, 20, 566, 665, 5198, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 372, 399, 5956, 83, 450, 83, 7, 450, 334, 585, 1491, 20, 467, 574, 59, 20, 5728, 199, 199, 533, 24719, 919, 86, 2855, 5446, 8, 5446, 304, 272, 408, 272, 437, 9496, 3938, 626, 4440, 282, 769, 402, 557, 11908, 823, 402, 314, 5612, 728, 31813, 465, 2399, 272, 3415, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3290, 29, 403, 304, 267, 1613, 8, 14176, 919, 86, 2855, 5446, 12, 291, 2843, 826, 721, 3288, 12, 3415, 29, 2514, 54, 568, 2089, 63, 16236, 9, 199, 199, 533, 24719, 25640, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 14001, 9339, 1329, 901, 14, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 14617, 1329, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 25640, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 14617, 63, 7865, 275, 295, 14, 954, 360, 7023, 2696, 83, 29323, 1874, 297, 3260, 11179, 63, 2975, 8, 585, 430, 398, 340, 822, 8, 9339, 63, 7865, 9, 508, 1616, 436, 8950, 63, 264, 14, 1733, 8, 9339, 63, 7865, 304, 288, 372, 574, 398, 340, 14617, 63, 7865, 1491, 19, 61, 508, 6681, 2192, 7, 436, 822, 8, 9339, 63, 7865, 9, 508, 3144, 436, 971, 1779, 8950, 63, 264, 14, 1733, 8, 9339, 63, 7865, 59, 19, 28847, 288, 372, 574, 398, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 199, 199, 533, 24719, 5158, 9047, 3259, 792, 8, 792, 304, 272, 408, 272, 437, 577, 337, 335, 20295, 6391, 1329, 334, 5158, 9047, 15, 34, 8199, 9, 901, 14, 339, 1455, 921, 7530, 14, 13961, 14, 1308, 15, 6797, 15, 51, 1618, 262, 453, 2626, 272, 408, 272, 849, 63, 705, 63, 3431, 275, 469, 267, 283, 3197, 356, 4018, 8468, 282, 1686, 2002, 9047, 1329, 659, 272, 789, 339, 347, 3633, 8, 277, 12, 574, 304, 267, 1613, 8, 14176, 5158, 9047, 3259, 792, 12, 291, 680, 3118, 8, 585, 9, 267, 340, 574, 315, 16589, 63, 15514, 26, 288, 372, 399, 891, 398, 340, 440, 880, 329, 63, 264, 14, 1733, 8, 585, 304, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 340, 1109, 8, 585, 9, 508, 378, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 9040, 275, 378, 267, 367, 284, 315, 1425, 8, 25, 12, 413, 12, 446, 17, 304, 288, 9040, 847, 1109, 8, 585, 59, 25, 13, 73, 566, 627, 284, 267, 9040, 4862, 1109, 8, 585, 1988, 17, 566, 398, 340, 9040, 450, 4119, 1137, 378, 26, 288, 746, 8505, 8, 277, 14, 705, 63, 3431, 459, 3197, 1105, 398, 372, 574, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
fentas/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/msgutil.py
658
7598
# Copyright 2011, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Message related utilities. Note: request.connection.write/read are used in this module, even though mod_python document says that they should be used only in connection handlers. Unfortunately, we have no other options. For example, request.write/read are not suitable because they don't allow direct raw bytes writing/reading. """ import Queue import threading # Export Exception symbols from msgutil for backward compatibility from mod_pywebsocket._stream_base import ConnectionTerminatedException from mod_pywebsocket._stream_base import InvalidFrameException from mod_pywebsocket._stream_base import BadOperationException from mod_pywebsocket._stream_base import UnsupportedFrameException # An API for handler to send/receive WebSocket messages. def close_connection(request): """Close connection. Args: request: mod_python request. """ request.ws_stream.close_connection() def send_message(request, payload_data, end=True, binary=False): """Send a message (or part of a message). Args: request: mod_python request. payload_data: unicode text or str binary to send. end: True to terminate a message. False to send payload_data as part of a message that is to be terminated by next or later send_message call with end=True. binary: send payload_data as binary frame(s). Raises: BadOperationException: when server already terminated. """ request.ws_stream.send_message(payload_data, end, binary) def receive_message(request): """Receive a WebSocket frame and return its payload as a text in unicode or a binary in str. Args: request: mod_python request. Raises: InvalidFrameException: when client send invalid frame. UnsupportedFrameException: when client send unsupported frame e.g. some of reserved bit is set but no extension can recognize it. InvalidUTF8Exception: when client send a text frame containing any invalid UTF-8 string. ConnectionTerminatedException: when the connection is closed unexpectedly. BadOperationException: when client already terminated. """ return request.ws_stream.receive_message() def send_ping(request, body=''): request.ws_stream.send_ping(body) class MessageReceiver(threading.Thread): """This class receives messages from the client. This class provides three ways to receive messages: blocking, non-blocking, and via callback. Callback has the highest precedence. Note: This class should not be used with the standalone server for wss because pyOpenSSL used by the server raises a fatal error if the socket is accessed from multiple threads. """ def __init__(self, request, onmessage=None): """Construct an instance. Args: request: mod_python request. onmessage: a function to be called when a message is received. May be None. If not None, the function is called on another thread. In that case, MessageReceiver.receive and MessageReceiver.receive_nowait are useless because they will never return any messages. """ threading.Thread.__init__(self) self._request = request self._queue = Queue.Queue() self._onmessage = onmessage self._stop_requested = False self.setDaemon(True) self.start() def run(self): try: while not self._stop_requested: message = receive_message(self._request) if self._onmessage: self._onmessage(message) else: self._queue.put(message) finally: close_connection(self._request) def receive(self): """ Receive a message from the channel, blocking. Returns: message as a unicode string. """ return self._queue.get() def receive_nowait(self): """ Receive a message from the channel, non-blocking. Returns: message as a unicode string if available. None otherwise. """ try: message = self._queue.get_nowait() except Queue.Empty: message = None return message def stop(self): """Request to stop this instance. The instance will be stopped after receiving the next message. This method may not be very useful, but there is no clean way in Python to forcefully stop a running thread. """ self._stop_requested = True class MessageSender(threading.Thread): """This class sends messages to the client. This class provides both synchronous and asynchronous ways to send messages. Note: This class should not be used with the standalone server for wss because pyOpenSSL used by the server raises a fatal error if the socket is accessed from multiple threads. """ def __init__(self, request): """Construct an instance. Args: request: mod_python request. """ threading.Thread.__init__(self) self._request = request self._queue = Queue.Queue() self.setDaemon(True) self.start() def run(self): while True: message, condition = self._queue.get() condition.acquire() send_message(self._request, message) condition.notify() condition.release() def send(self, message): """Send a message, blocking.""" condition = threading.Condition() condition.acquire() self._queue.put((message, condition)) condition.wait() def send_nowait(self, message): """Send a message, non-blocking.""" self._queue.put((message, threading.Condition())) # vi:sts=4 sw=4 et
bsd-3-clause
[ 3, 1898, 7760, 12, 4475, 3277, 14, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 421, 199, 624, 2209, 4048, 15841, 14, 199, 199, 7443, 26, 1056, 14, 2105, 14, 952, 15, 739, 787, 1202, 315, 642, 859, 12, 2755, 10617, 199, 1494, 63, 1548, 2213, 20065, 626, 2985, 1077, 506, 1202, 1454, 315, 1950, 199, 5586, 14, 31076, 12, 781, 1172, 949, 1163, 1511, 14, 2104, 2893, 12, 199, 1069, 14, 952, 15, 739, 787, 440, 11233, 2952, 2985, 2793, 1133, 2040, 4125, 3066, 199, 2394, 3575, 15, 19332, 14, 199, 624, 421, 199, 646, 10703, 199, 646, 5796, 421, 199, 3, 20220, 2186, 6698, 687, 1499, 1974, 367, 13388, 7163, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 8113, 12154, 972, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 6378, 3160, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 8857, 6044, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 19022, 3160, 1726, 421, 199, 3, 1626, 3261, 367, 3016, 370, 3222, 15, 9391, 18846, 3788, 14, 199, 318, 4002, 63, 2105, 8, 1069, 304, 272, 408, 4724, 1950, 14, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 272, 408, 272, 1056, 14, 3569, 63, 1745, 14, 1600, 63, 2105, 342, 421, 199, 318, 3222, 63, 1188, 8, 1069, 12, 4886, 63, 576, 12, 1284, 29, 549, 12, 3366, 29, 797, 304, 272, 408, 6795, 282, 1245, 334, 269, 1777, 402, 282, 1245, 680, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 267, 4886, 63, 576, 26, 2649, 1318, 503, 620, 3366, 370, 3222, 14, 267, 1284, 26, 715, 370, 15095, 282, 1245, 14, 1467, 756, 370, 3222, 4886, 63, 576, 465, 1777, 402, 282, 1245, 626, 365, 370, 506, 1467, 15745, 701, 2163, 503, 2945, 3222, 63, 1188, 1240, 543, 1284, 29, 549, 14, 267, 3366, 26, 3222, 4886, 63, 576, 465, 3366, 2787, 8, 83, 680, 272, 6218, 26, 267, 8857, 6044, 1726, 26, 1380, 1654, 2575, 15745, 14, 272, 408, 272, 1056, 14, 3569, 63, 1745, 14, 2254, 63, 1188, 8, 4749, 63, 576, 12, 1284, 12, 3366, 9, 421, 199, 318, 9128, 63, 1188, 8, 1069, 304, 272, 408, 14235, 282, 18846, 2787, 436, 372, 2399, 4886, 465, 282, 1318, 315, 272, 2649, 503, 282, 3366, 315, 620, 14, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 272, 6218, 26, 267, 6378, 3160, 1726, 26, 258, 1380, 1890, 3222, 3866, 2787, 14, 267, 19022, 3160, 1726, 26, 1380, 1890, 3222, 16313, 2787, 325, 14, 71, 14, 2005, 3521, 402, 4644, 4546, 365, 663, 1325, 949, 3329, 883, 3521, 27159, 652, 14, 267, 6378, 6610, 24, 1726, 26, 420, 1380, 1890, 3222, 282, 1318, 2787, 3035, 1263, 3521, 3866, 9094, 13, 24, 1059, 14, 267, 8113, 12154, 972, 1726, 26, 1380, 314, 1950, 365, 6876, 3521, 10537, 590, 14, 267, 8857, 6044, 1726, 26, 258, 1380, 1890, 2575, 15745, 14, 272, 408, 272, 372, 1056, 14, 3569, 63, 1745, 14, 9391, 63, 1188, 342, 421, 199, 318, 3222, 63, 4073, 8, 1069, 12, 2396, 9280, 272, 1056, 14, 3569, 63, 1745, 14, 2254, 63, 4073, 8, 2030, 9, 421, 199, 533, 6430, 21800, 8, 12562, 14, 4436, 304, 272, 408, 2765, 1021, 23192, 3788, 687, 314, 1890, 14, 339, 961, 1021, 6571, 7795, 15217, 370, 9128, 3788, 26, 14592, 12, 272, 2222, 13, 13091, 12, 436, 4799, 3233, 14, 17555, 965, 314, 15356, 13823, 14, 339, 3390, 26, 961, 1021, 1077, 440, 506, 1202, 543, 314, 18042, 1654, 367, 336, 385, 272, 2952, 1134, 22791, 1202, 701, 314, 1654, 6534, 282, 14294, 1125, 340, 314, 2838, 272, 365, 13810, 687, 3663, 7183, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1056, 12, 641, 1188, 29, 403, 304, 267, 408, 11493, 376, 1256, 14, 398, 3033, 26, 288, 1056, 26, 3413, 63, 1548, 1056, 14, 288, 641, 1188, 26, 282, 805, 370, 506, 2797, 1380, 282, 1245, 365, 3086, 14, 2432, 10162, 506, 488, 14, 982, 440, 488, 12, 314, 805, 365, 2797, 641, 2432, 4573, 2462, 14, 1010, 626, 1930, 12, 6430, 21800, 14, 9391, 2432, 436, 6430, 21800, 14, 9391, 63, 20870, 787, 31291, 2432, 2952, 2985, 911, 7078, 372, 1263, 3788, 14, 267, 408, 398, 5796, 14, 4436, 855, 826, 721 ]
[ 1898, 7760, 12, 4475, 3277, 14, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 421, 199, 624, 2209, 4048, 15841, 14, 199, 199, 7443, 26, 1056, 14, 2105, 14, 952, 15, 739, 787, 1202, 315, 642, 859, 12, 2755, 10617, 199, 1494, 63, 1548, 2213, 20065, 626, 2985, 1077, 506, 1202, 1454, 315, 1950, 199, 5586, 14, 31076, 12, 781, 1172, 949, 1163, 1511, 14, 2104, 2893, 12, 199, 1069, 14, 952, 15, 739, 787, 440, 11233, 2952, 2985, 2793, 1133, 2040, 4125, 3066, 199, 2394, 3575, 15, 19332, 14, 199, 624, 421, 199, 646, 10703, 199, 646, 5796, 421, 199, 3, 20220, 2186, 6698, 687, 1499, 1974, 367, 13388, 7163, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 8113, 12154, 972, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 6378, 3160, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 8857, 6044, 1726, 199, 504, 3413, 63, 21387, 423, 1745, 63, 1095, 492, 19022, 3160, 1726, 421, 199, 3, 1626, 3261, 367, 3016, 370, 3222, 15, 9391, 18846, 3788, 14, 199, 318, 4002, 63, 2105, 8, 1069, 304, 272, 408, 4724, 1950, 14, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 272, 408, 272, 1056, 14, 3569, 63, 1745, 14, 1600, 63, 2105, 342, 421, 199, 318, 3222, 63, 1188, 8, 1069, 12, 4886, 63, 576, 12, 1284, 29, 549, 12, 3366, 29, 797, 304, 272, 408, 6795, 282, 1245, 334, 269, 1777, 402, 282, 1245, 680, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 267, 4886, 63, 576, 26, 2649, 1318, 503, 620, 3366, 370, 3222, 14, 267, 1284, 26, 715, 370, 15095, 282, 1245, 14, 1467, 756, 370, 3222, 4886, 63, 576, 465, 1777, 402, 282, 1245, 626, 365, 370, 506, 1467, 15745, 701, 2163, 503, 2945, 3222, 63, 1188, 1240, 543, 1284, 29, 549, 14, 267, 3366, 26, 3222, 4886, 63, 576, 465, 3366, 2787, 8, 83, 680, 272, 6218, 26, 267, 8857, 6044, 1726, 26, 1380, 1654, 2575, 15745, 14, 272, 408, 272, 1056, 14, 3569, 63, 1745, 14, 2254, 63, 1188, 8, 4749, 63, 576, 12, 1284, 12, 3366, 9, 421, 199, 318, 9128, 63, 1188, 8, 1069, 304, 272, 408, 14235, 282, 18846, 2787, 436, 372, 2399, 4886, 465, 282, 1318, 315, 272, 2649, 503, 282, 3366, 315, 620, 14, 339, 3033, 26, 267, 1056, 26, 3413, 63, 1548, 1056, 14, 272, 6218, 26, 267, 6378, 3160, 1726, 26, 258, 1380, 1890, 3222, 3866, 2787, 14, 267, 19022, 3160, 1726, 26, 1380, 1890, 3222, 16313, 2787, 325, 14, 71, 14, 2005, 3521, 402, 4644, 4546, 365, 663, 1325, 949, 3329, 883, 3521, 27159, 652, 14, 267, 6378, 6610, 24, 1726, 26, 420, 1380, 1890, 3222, 282, 1318, 2787, 3035, 1263, 3521, 3866, 9094, 13, 24, 1059, 14, 267, 8113, 12154, 972, 1726, 26, 1380, 314, 1950, 365, 6876, 3521, 10537, 590, 14, 267, 8857, 6044, 1726, 26, 258, 1380, 1890, 2575, 15745, 14, 272, 408, 272, 372, 1056, 14, 3569, 63, 1745, 14, 9391, 63, 1188, 342, 421, 199, 318, 3222, 63, 4073, 8, 1069, 12, 2396, 9280, 272, 1056, 14, 3569, 63, 1745, 14, 2254, 63, 4073, 8, 2030, 9, 421, 199, 533, 6430, 21800, 8, 12562, 14, 4436, 304, 272, 408, 2765, 1021, 23192, 3788, 687, 314, 1890, 14, 339, 961, 1021, 6571, 7795, 15217, 370, 9128, 3788, 26, 14592, 12, 272, 2222, 13, 13091, 12, 436, 4799, 3233, 14, 17555, 965, 314, 15356, 13823, 14, 339, 3390, 26, 961, 1021, 1077, 440, 506, 1202, 543, 314, 18042, 1654, 367, 336, 385, 272, 2952, 1134, 22791, 1202, 701, 314, 1654, 6534, 282, 14294, 1125, 340, 314, 2838, 272, 365, 13810, 687, 3663, 7183, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1056, 12, 641, 1188, 29, 403, 304, 267, 408, 11493, 376, 1256, 14, 398, 3033, 26, 288, 1056, 26, 3413, 63, 1548, 1056, 14, 288, 641, 1188, 26, 282, 805, 370, 506, 2797, 1380, 282, 1245, 365, 3086, 14, 2432,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
dgnorth/drift-base
driftbase/api/machines.py
1
8672
import logging import datetime from six.moves import http_client from flask import request, url_for, g, jsonify from flask.views import MethodView import marshmallow as ma from flask_restx import reqparse from flask_smorest import Blueprint, abort from drift.core.extensions.urlregistry import Endpoints from dateutil import parser from drift.core.extensions.schemachecker import simple_schema_request from drift.core.extensions.jwt import requires_roles from driftbase.models.db import Machine, MachineEvent log = logging.getLogger(__name__) bp = Blueprint("machines", __name__, url_prefix="/machines", description="Battleserver machine instances") endpoints = Endpoints() def drift_init_extension(app, api, **kwargs): api.register_blueprint(bp) endpoints.init_app(app) def utcnow(): return datetime.datetime.utcnow() @bp.route('', endpoint='list') class MachinesAPI(MethodView): """The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new publicIP address for example, it will get a new machine resource. """ get_args = reqparse.RequestParser() get_args.add_argument("realm", type=str, help="Missing realm. Should be one of: aws, local", required=True) get_args.add_argument("instance_name", help="Missing instance_name. Should be computer name", type=str, required=True) get_args.add_argument("instance_id", type=str, required=False) get_args.add_argument("instance_type", type=str, required=False) get_args.add_argument("placement", type=str, required=False) get_args.add_argument("public_ip", type=str, required=False) get_args.add_argument("rows", type=int, required=False) @requires_roles("service") #@namespace.expect(get_args) def get(self): """ Get a list of machines """ args = self.get_args.parse_args() num_rows = args.get("rows") or 100 query = g.db.query(Machine) if args.get("realm", None) not in ("aws", "local"): abort(http_client.BAD_REQUEST, description="realm must be 'aws' or 'local'") if args["realm"] == "local": query = query.filter(Machine.realm == "local", Machine.instance_name == args["instance_name"]) else: missing = [] for param in ("instance_id", "instance_type", "placement", "public_ip"): if not args[param]: missing.append(param) if missing: abort(http_client.BAD_REQUEST, description="missing required parameters: %s" % ", ".join(missing)) query = query.filter(Machine.realm == args["realm"], Machine.instance_name == args["instance_name"], Machine.instance_id == args["instance_id"], Machine.instance_type == args["instance_type"], Machine.placement == args["placement"], Machine.public_ip == args["public_ip"], ) query = query.order_by(-Machine.machine_id) query = query.limit(num_rows) rows = query.all() ret = [] for row in rows: record = row.as_dict() record["url"] = url_for("machines.entry", machine_id=row.machine_id, _external=True) ret.append(record) return jsonify(ret) @requires_roles("service") @simple_schema_request({ "realm": {"type": "string", }, "instance_id": {"type": "string", }, "instance_type": {"type": "string", }, "instance_name": {"type": "string", }, "placement": {"type": "string", }, "public_ip": {"format": "ip-address", }, "private_ip": {"format": "ip-address", }, "machine_info": {"type": "object", }, "details": {"type": "object", }, "group_name": {"type": "string", }, }, required=["realm", "instance_name"]) def post(self): """ Register a machine """ args = request.json log.info("registering a battleserver machine for realm %s from ip %s", args.get("realm"), args.get("public_ip")) machine = Machine(realm=args.get("realm"), instance_id=args.get("instance_id"), instance_type=args.get("instance_type"), instance_name=args.get("instance_name"), placement=args.get("placement"), public_ip=args.get("public_ip"), private_ip=args.get("private_ip"), machine_info=args.get("machine_info"), details=args.get("details"), group_name=args.get("group_name") ) g.db.add(machine) g.db.commit() machine_id = machine.machine_id resource_uri = url_for("machines.entry", machine_id=machine_id, _external=True) response_header = { "Location": resource_uri, } log.info("Battleserver machine %s has been registered on public ip %s", machine_id, args.get("public_ip")) return jsonify({"machine_id": machine_id, "url": resource_uri }), http_client.CREATED, response_header @bp.route('/<int:machine_id>', endpoint='entry') class MachineAPI(MethodView): """ Information about specific machines """ @requires_roles("service") def get(self, machine_id): """ Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json """ row = g.db.query(Machine).get(machine_id) if not row: log.warning("Requested a non-existant machine: %s", machine_id) abort(http_client.NOT_FOUND, description="Machine not found") record = row.as_dict() record["url"] = url_for("machines.entry", machine_id=machine_id, _external=True) record["servers_url"] = url_for("servers.list", machine_id=machine_id, _external=True) record["matches_url"] = url_for("matches.list", machine_id=machine_id, _external=True) log.debug("Returning info for battleserver machine %s", machine_id) return jsonify(record) @requires_roles("service") @simple_schema_request({ "machine_info": {"type": "object", }, "status": {"type": "object", }, "details": {"type": "object", }, "config": {"type": "object", }, "statistics": {"type": "object", }, "group_name": {"type": "string"}, "events": {"type": "array"} }, required=[]) def put(self, machine_id): """ Update machine Heartbeat and update the machine reference """ args = request.json row = g.db.query(Machine).get(machine_id) if not row: abort(http_client.NOT_FOUND, description="Machine not found") last_heartbeat = row.heartbeat_date row.heartbeat_date = utcnow() if args.get("status"): row.status = args["status"] if args.get("details"): row.details = args["details"] if args.get("config"): row.config = args["config"] if args.get("statistics"): row.statistics = args["statistics"] if args.get("group_name"): row.group_name = args["group_name"] if args.get("events"): for event in args["events"]: timestamp = parser.parse(event["timestamp"]) event_row = MachineEvent(event_type_name=event["event"], machine_id=machine_id, details=event, create_date=timestamp) g.db.add(event_row) g.db.commit() return jsonify({"last_heartbeat": last_heartbeat}) @endpoints.register def endpoint_info(*args): ret = {"machines": url_for("machines.list", _external=True)} return ret
mit
[ 646, 2050, 202, 199, 646, 2197, 2999, 199, 504, 3816, 14, 4912, 492, 1455, 63, 1258, 2999, 199, 504, 7209, 492, 1056, 12, 1166, 63, 509, 12, 486, 12, 23819, 202, 199, 504, 7209, 14, 4196, 492, 9075, 2768, 202, 199, 646, 7557, 609, 2174, 674, 465, 610, 202, 199, 504, 7209, 63, 3911, 88, 492, 2648, 1122, 202, 199, 504, 7209, 63, 83, 573, 3911, 492, 22447, 1361, 12, 12004, 202, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 633, 5189, 492, 9599, 3438, 202, 199, 504, 22208, 492, 1798, 2999, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 3629, 6743, 492, 3486, 63, 3629, 63, 1069, 202, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 30033, 492, 5074, 63, 8050, 2999, 199, 504, 366, 6501, 1095, 14, 992, 14, 697, 492, 18722, 12, 18722, 2390, 2999, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 8065, 199, 10913, 275, 22447, 1361, 480, 26489, 401, 636, 354, 3108, 1166, 63, 1861, 9555, 26489, 401, 1369, 628, 34, 29274, 1000, 6844, 4454, 531, 202, 199, 14461, 275, 9599, 3438, 342, 8065, 199, 318, 366, 6501, 63, 826, 63, 3435, 8, 571, 12, 2986, 12, 1011, 958, 304, 1128, 2986, 14, 2683, 63, 15918, 8, 10913, 9, 1128, 16173, 14, 826, 63, 571, 8, 571, 9, 8065, 199, 318, 221, 10779, 837, 1128, 372, 2197, 14, 2083, 14, 10779, 342, 8065, 199, 32, 10913, 14, 4449, 8594, 6037, 534, 513, 358, 202, 199, 533, 30611, 3746, 3735, 8, 3767, 2768, 304, 1128, 408, 1918, 3217, 370, 330, 29274, 1000, 20601, 14, 7048, 14095, 6844, 1128, 334, 509, 2893, 7062, 18, 1256, 9, 965, 282, 6844, 2073, 2348, 14, 7048, 1128, 6844, 2073, 965, 4697, 503, 1655, 330, 29274, 1000, 5944, 14, 1128, 437, 6844, 365, 3247, 465, 282, 663, 402, 314, 2633, 367, 314, 2963, 1240, 5084, 14, 1128, 982, 376, 1256, 7545, 282, 892, 4575, 1772, 2287, 367, 2893, 12, 652, 911, 1128, 664, 282, 892, 6844, 2073, 14, 1128, 408, 1128, 664, 63, 589, 275, 2648, 1122, 14, 2017, 2842, 342, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 7728, 401, 730, 29, 495, 12, 1720, 628, 7718, 10482, 14, 7719, 506, 1373, 402, 26, 11488, 12, 2257, 401, 202, 2079, 1415, 29, 549, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 354, 401, 1720, 628, 7718, 1256, 63, 354, 14, 7719, 506, 24189, 536, 401, 202, 2079, 730, 29, 495, 12, 1415, 29, 549, 9, 2958, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 344, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 466, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 16748, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 3455, 63, 711, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 3838, 401, 730, 29, 442, 12, 1415, 29, 797, 9, 2958, 768, 6537, 63, 8050, 480, 1364, 531, 1128, 9213, 3251, 14, 4921, 8, 362, 63, 589, 9, 1128, 347, 664, 8, 277, 304, 1039, 408, 1039, 2372, 282, 769, 402, 20601, 1039, 408, 1039, 1249, 275, 291, 14, 362, 63, 589, 14, 1122, 63, 589, 342, 1039, 1967, 63, 3838, 275, 1249, 14, 362, 480, 3838, 531, 503, 2948, 1039, 1827, 275, 486, 14, 697, 14, 1131, 8, 8412, 9, 1039, 340, 1249, 14, 362, 480, 7728, 401, 488, 9, 440, 315, 1689, 7231, 401, 298, 1832, 2349, 1675, 12004, 8, 1014, 63, 1258, 14, 9439, 63, 6780, 12, 1369, 628, 7728, 1471, 506, 283, 7231, 7, 503, 283, 1832, 9859, 4341, 340, 1249, 905, 7728, 937, 508, 298, 1832, 582, 1675, 1827, 275, 1827, 14, 1541, 8, 8412, 14, 7728, 508, 298, 1832, 401, 202, 639, 18722, 14, 842, 63, 354, 508, 1249, 905, 842, 63, 354, 3135, 1039, 587, 26, 1675, 4124, 275, 942, 1675, 367, 1215, 315, 1689, 842, 63, 344, 401, 298, 842, 63, 466, 401, 298, 16748, 401, 298, 3455, 63, 711, 2349, 2628, 340, 440, 1249, 59, 635, 2189, 4906, 4124, 14, 740, 8, 635, 9, 1675, 340, 4124, 26, 2628, 12004, 8, 1014, 63, 1258, 14, 9439, 63, 6780, 12, 202, 1993, 1369, 628, 4752, 1415, 2633, 26, 450, 83, 2, 450, 3872, 3680, 904, 8, 4752, 430, 1675, 1827, 275, 1827, 14, 1541, 8, 8412, 14, 7728, 508, 1249, 905, 7728, 2255, 202, 639, 18722, 14, 842, 63, 354, 508, 1249, 905, 842, 63, 354, 2255, 202, 639, 18722, 14, 842, 63, 344, 508, 1249, 905, 842, 63, 344, 2255, 202, 639, 18722, 14, 842, 63, 466, 508, 1249, 905, 842, 63, 466, 2255, 202, 639, 18722, 14, 16748, 508, 1249, 905, 16748, 2255, 202, 639, 18722, 14, 3455, 63, 711, 508, 1249, 905, 3455, 63, 711, 2255, 202, 639, 776, 1675, 1827, 275, 1827, 14, 1648, 63, 991, 2801, 8412, 14, 6744, 63, 344, 9, 1039, 1827, 275, 1827, 14, 3097, 8, 1507, 63, 3838, 9, 1039, 4730, 275, 1827, 14, 452, 342, 1039, 2203, 275, 942, 1039, 367, 1962, 315, 4730, 26, 1675, 2777, 275, 1962, 14, 305, 63, 807, 342, 1675, 2777, 905, 633, 937, 275, 1166, 63, 509, 480, 26489, 14, 2373, 401, 6844, 63, 344, 29, 1143, 14, 6744, 63, 344, 12, 485, 5159, 29, 549, 9, 1675, 2203, 14, 740, 8, 3059, 9, 4341, 372, 23819, 8, 3292, 9, 2958, 768, 6537, 63, 8050, 480, 1364, 531, 1128, 768, 4129, 63, 3629, 63, 1069, 2561, 1039, 298, 7728, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 344, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 466, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 354, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 16748, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 3455, 63, 711, 582, 2420, 908, 582, 298, 711, 13, 1562, 401, 1660, 1039, 298, 4239, 63, 711, 582, 2420, 908, 582, 298, 711, 13 ]
[ 2050, 202, 199, 646, 2197, 2999, 199, 504, 3816, 14, 4912, 492, 1455, 63, 1258, 2999, 199, 504, 7209, 492, 1056, 12, 1166, 63, 509, 12, 486, 12, 23819, 202, 199, 504, 7209, 14, 4196, 492, 9075, 2768, 202, 199, 646, 7557, 609, 2174, 674, 465, 610, 202, 199, 504, 7209, 63, 3911, 88, 492, 2648, 1122, 202, 199, 504, 7209, 63, 83, 573, 3911, 492, 22447, 1361, 12, 12004, 202, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 633, 5189, 492, 9599, 3438, 202, 199, 504, 22208, 492, 1798, 2999, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 3629, 6743, 492, 3486, 63, 3629, 63, 1069, 202, 199, 504, 366, 6501, 14, 1018, 14, 5359, 14, 30033, 492, 5074, 63, 8050, 2999, 199, 504, 366, 6501, 1095, 14, 992, 14, 697, 492, 18722, 12, 18722, 2390, 2999, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 8065, 199, 10913, 275, 22447, 1361, 480, 26489, 401, 636, 354, 3108, 1166, 63, 1861, 9555, 26489, 401, 1369, 628, 34, 29274, 1000, 6844, 4454, 531, 202, 199, 14461, 275, 9599, 3438, 342, 8065, 199, 318, 366, 6501, 63, 826, 63, 3435, 8, 571, 12, 2986, 12, 1011, 958, 304, 1128, 2986, 14, 2683, 63, 15918, 8, 10913, 9, 1128, 16173, 14, 826, 63, 571, 8, 571, 9, 8065, 199, 318, 221, 10779, 837, 1128, 372, 2197, 14, 2083, 14, 10779, 342, 8065, 199, 32, 10913, 14, 4449, 8594, 6037, 534, 513, 358, 202, 199, 533, 30611, 3746, 3735, 8, 3767, 2768, 304, 1128, 408, 1918, 3217, 370, 330, 29274, 1000, 20601, 14, 7048, 14095, 6844, 1128, 334, 509, 2893, 7062, 18, 1256, 9, 965, 282, 6844, 2073, 2348, 14, 7048, 1128, 6844, 2073, 965, 4697, 503, 1655, 330, 29274, 1000, 5944, 14, 1128, 437, 6844, 365, 3247, 465, 282, 663, 402, 314, 2633, 367, 314, 2963, 1240, 5084, 14, 1128, 982, 376, 1256, 7545, 282, 892, 4575, 1772, 2287, 367, 2893, 12, 652, 911, 1128, 664, 282, 892, 6844, 2073, 14, 1128, 408, 1128, 664, 63, 589, 275, 2648, 1122, 14, 2017, 2842, 342, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 7728, 401, 730, 29, 495, 12, 1720, 628, 7718, 10482, 14, 7719, 506, 1373, 402, 26, 11488, 12, 2257, 401, 202, 2079, 1415, 29, 549, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 354, 401, 1720, 628, 7718, 1256, 63, 354, 14, 7719, 506, 24189, 536, 401, 202, 2079, 730, 29, 495, 12, 1415, 29, 549, 9, 2958, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 344, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 842, 63, 466, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 16748, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 3455, 63, 711, 401, 730, 29, 495, 12, 1415, 29, 797, 9, 1128, 664, 63, 589, 14, 525, 63, 2094, 480, 3838, 401, 730, 29, 442, 12, 1415, 29, 797, 9, 2958, 768, 6537, 63, 8050, 480, 1364, 531, 1128, 9213, 3251, 14, 4921, 8, 362, 63, 589, 9, 1128, 347, 664, 8, 277, 304, 1039, 408, 1039, 2372, 282, 769, 402, 20601, 1039, 408, 1039, 1249, 275, 291, 14, 362, 63, 589, 14, 1122, 63, 589, 342, 1039, 1967, 63, 3838, 275, 1249, 14, 362, 480, 3838, 531, 503, 2948, 1039, 1827, 275, 486, 14, 697, 14, 1131, 8, 8412, 9, 1039, 340, 1249, 14, 362, 480, 7728, 401, 488, 9, 440, 315, 1689, 7231, 401, 298, 1832, 2349, 1675, 12004, 8, 1014, 63, 1258, 14, 9439, 63, 6780, 12, 1369, 628, 7728, 1471, 506, 283, 7231, 7, 503, 283, 1832, 9859, 4341, 340, 1249, 905, 7728, 937, 508, 298, 1832, 582, 1675, 1827, 275, 1827, 14, 1541, 8, 8412, 14, 7728, 508, 298, 1832, 401, 202, 639, 18722, 14, 842, 63, 354, 508, 1249, 905, 842, 63, 354, 3135, 1039, 587, 26, 1675, 4124, 275, 942, 1675, 367, 1215, 315, 1689, 842, 63, 344, 401, 298, 842, 63, 466, 401, 298, 16748, 401, 298, 3455, 63, 711, 2349, 2628, 340, 440, 1249, 59, 635, 2189, 4906, 4124, 14, 740, 8, 635, 9, 1675, 340, 4124, 26, 2628, 12004, 8, 1014, 63, 1258, 14, 9439, 63, 6780, 12, 202, 1993, 1369, 628, 4752, 1415, 2633, 26, 450, 83, 2, 450, 3872, 3680, 904, 8, 4752, 430, 1675, 1827, 275, 1827, 14, 1541, 8, 8412, 14, 7728, 508, 1249, 905, 7728, 2255, 202, 639, 18722, 14, 842, 63, 354, 508, 1249, 905, 842, 63, 354, 2255, 202, 639, 18722, 14, 842, 63, 344, 508, 1249, 905, 842, 63, 344, 2255, 202, 639, 18722, 14, 842, 63, 466, 508, 1249, 905, 842, 63, 466, 2255, 202, 639, 18722, 14, 16748, 508, 1249, 905, 16748, 2255, 202, 639, 18722, 14, 3455, 63, 711, 508, 1249, 905, 3455, 63, 711, 2255, 202, 639, 776, 1675, 1827, 275, 1827, 14, 1648, 63, 991, 2801, 8412, 14, 6744, 63, 344, 9, 1039, 1827, 275, 1827, 14, 3097, 8, 1507, 63, 3838, 9, 1039, 4730, 275, 1827, 14, 452, 342, 1039, 2203, 275, 942, 1039, 367, 1962, 315, 4730, 26, 1675, 2777, 275, 1962, 14, 305, 63, 807, 342, 1675, 2777, 905, 633, 937, 275, 1166, 63, 509, 480, 26489, 14, 2373, 401, 6844, 63, 344, 29, 1143, 14, 6744, 63, 344, 12, 485, 5159, 29, 549, 9, 1675, 2203, 14, 740, 8, 3059, 9, 4341, 372, 23819, 8, 3292, 9, 2958, 768, 6537, 63, 8050, 480, 1364, 531, 1128, 768, 4129, 63, 3629, 63, 1069, 2561, 1039, 298, 7728, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 344, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 466, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 842, 63, 354, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 16748, 582, 2420, 466, 582, 298, 875, 401, 1660, 1039, 298, 3455, 63, 711, 582, 2420, 908, 582, 298, 711, 13, 1562, 401, 1660, 1039, 298, 4239, 63, 711, 582, 2420, 908, 582, 298, 711, 13, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
flask-admin/flask-admin
examples/tinymongo/app.py
5
3592
""" Example of Flask-Admin using TinyDB with TinyMongo refer to README.txt for instructions Author: Bruno Rocha <@rochacbruno> Based in PyMongo Example and TinyMongo """ import flask_admin as admin from flask import Flask from flask_admin.contrib.pymongo import ModelView, filters from flask_admin.form import Select2Widget from flask_admin.model.fields import InlineFieldList, InlineFormField from wtforms import fields, form from tinymongo import TinyMongoClient # Create application app = Flask(__name__) # Create dummy secrey key so we can use sessions app.config['SECRET_KEY'] = '123456790' # Create models in a JSON file localted at DATAFOLDER = '/tmp/flask_admin_test' conn = TinyMongoClient(DATAFOLDER) db = conn.test # create some users for testing # for i in range(30): # db.user.insert({'name': 'Mike %s' % i}) # User admin class InnerForm(form.Form): name = fields.StringField('Name') test = fields.StringField('Test') class UserForm(form.Form): foo = fields.StringField('foo') name = fields.StringField('Name') email = fields.StringField('Email') password = fields.StringField('Password') # Inner form inner = InlineFormField(InnerForm) # Form list form_list = InlineFieldList(InlineFormField(InnerForm)) class UserView(ModelView): column_list = ('name', 'email', 'password', 'foo') column_sortable_list = ('name', 'email', 'password') form = UserForm page_size = 20 can_set_page_size = True # Tweet view class TweetForm(form.Form): name = fields.StringField('Name') user_id = fields.SelectField('User', widget=Select2Widget()) text = fields.StringField('Text') testie = fields.BooleanField('Test') class TweetView(ModelView): column_list = ('name', 'user_name', 'text') column_sortable_list = ('name', 'text') column_filters = (filters.FilterEqual('name', 'Name'), filters.FilterNotEqual('name', 'Name'), filters.FilterLike('name', 'Name'), filters.FilterNotLike('name', 'Name'), filters.BooleanEqualFilter('testie', 'Testie')) # column_searchable_list = ('name', 'text') form = TweetForm def get_list(self, *args, **kwargs): count, data = super(TweetView, self).get_list(*args, **kwargs) # Contribute user_name to the models for item in data: item['user_name'] = db.user.find_one( {'_id': item['user_id']} )['name'] return count, data # Contribute list of user choices to the forms def _feed_user_choices(self, form): users = db.user.find(fields=('name',)) form.user_id.choices = [(str(x['_id']), x['name']) for x in users] return form def create_form(self): form = super(TweetView, self).create_form() return self._feed_user_choices(form) def edit_form(self, obj): form = super(TweetView, self).edit_form(obj) return self._feed_user_choices(form) # Correct user_id reference before saving def on_model_change(self, form, model): user_id = model.get('user_id') model['user_id'] = user_id return model # Flask views @app.route('/') def index(): return '<a href="/admin/">Click me to get to Admin!</a>' if __name__ == '__main__': # Create admin admin = admin.Admin(app, name='Example: TinyMongo - TinyDB') # Add views admin.add_view(UserView(db.user, 'User')) admin.add_view(TweetView(db.tweet, 'Tweets')) # Start app app.run(debug=True)
bsd-3-clause
[ 624, 199, 9846, 402, 16704, 13, 4880, 1808, 11947, 2846, 543, 11947, 20393, 199, 21928, 370, 27781, 14, 2424, 367, 15794, 199, 199, 5949, 26, 221, 699, 1065, 79, 6848, 9518, 665, 32, 293, 335, 26940, 1065, 79, 30, 199, 20409, 315, 1611, 20393, 5679, 436, 11947, 20393, 199, 624, 199, 646, 7209, 63, 2113, 465, 4628, 199, 504, 7209, 492, 16704, 199, 504, 7209, 63, 2113, 14, 2828, 14, 29380, 492, 5822, 2768, 12, 4766, 199, 504, 7209, 63, 2113, 14, 964, 492, 9496, 18, 3339, 199, 504, 7209, 63, 2113, 14, 1238, 14, 955, 492, 24789, 792, 1296, 12, 24789, 2821, 792, 199, 504, 24756, 3351, 492, 1504, 12, 1824, 199, 199, 504, 29128, 9217, 492, 11947, 20393, 3041, 199, 199, 3, 2790, 4223, 199, 571, 275, 16704, 3460, 354, 3368, 199, 199, 3, 2790, 7283, 542, 1353, 89, 790, 880, 781, 883, 675, 12184, 199, 571, 14, 888, 459, 12961, 63, 3078, 418, 275, 283, 19060, 22252, 7, 199, 199, 3, 2790, 1709, 315, 282, 4840, 570, 2257, 471, 737, 199, 199, 3998, 19041, 275, 1994, 2791, 15, 15720, 63, 2113, 63, 396, 7, 199, 199, 1631, 275, 11947, 20393, 3041, 8, 3998, 19041, 9, 199, 697, 275, 2557, 14, 396, 199, 199, 3, 1218, 2005, 4390, 367, 5343, 199, 3, 367, 284, 315, 1425, 8, 1216, 304, 199, 3, 258, 1592, 14, 751, 14, 3176, 3252, 354, 356, 283, 45, 7455, 450, 83, 7, 450, 284, 1552, 421, 199, 3, 2876, 4628, 199, 533, 19646, 2821, 8, 964, 14, 2821, 304, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 511, 275, 1504, 14, 14912, 360, 774, 358, 421, 199, 533, 2876, 2821, 8, 964, 14, 2821, 304, 272, 3925, 275, 1504, 14, 14912, 360, 1421, 358, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 3031, 275, 1504, 14, 14912, 360, 7035, 358, 272, 2505, 275, 1504, 14, 14912, 360, 6139, 358, 339, 327, 19646, 1824, 272, 6506, 275, 24789, 2821, 792, 8, 22964, 2821, 9, 339, 327, 8204, 769, 272, 1824, 63, 513, 275, 24789, 792, 1296, 8, 10307, 2821, 792, 8, 22964, 2821, 430, 421, 199, 533, 2876, 2768, 8, 1685, 2768, 304, 272, 2763, 63, 513, 275, 661, 354, 297, 283, 2123, 297, 283, 2060, 297, 283, 1421, 358, 272, 2763, 63, 3191, 461, 63, 513, 275, 661, 354, 297, 283, 2123, 297, 283, 2060, 358, 339, 1824, 275, 2876, 2821, 339, 2034, 63, 890, 275, 3388, 272, 883, 63, 409, 63, 1606, 63, 890, 275, 715, 421, 199, 3, 377, 11554, 2455, 199, 533, 377, 11554, 2821, 8, 964, 14, 2821, 304, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 922, 63, 344, 275, 1504, 14, 5446, 792, 360, 1899, 297, 3938, 29, 5446, 18, 3339, 1012, 272, 1318, 275, 1504, 14, 14912, 360, 1872, 358, 339, 511, 1873, 275, 1504, 14, 5036, 360, 774, 358, 421, 199, 533, 377, 11554, 2768, 8, 1685, 2768, 304, 272, 2763, 63, 513, 275, 661, 354, 297, 283, 751, 63, 354, 297, 283, 505, 358, 272, 2763, 63, 3191, 461, 63, 513, 275, 661, 354, 297, 283, 505, 358, 339, 2763, 63, 4273, 275, 334, 4273, 14, 4131, 591, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 1763, 591, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 12545, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 1763, 12545, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4082, 591, 4131, 360, 396, 1873, 297, 283, 774, 1873, 1333, 339, 327, 2763, 63, 1733, 461, 63, 513, 275, 661, 354, 297, 283, 505, 358, 339, 1824, 275, 377, 11554, 2821, 339, 347, 664, 63, 513, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 2338, 12, 666, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 362, 63, 513, 2031, 589, 12, 1011, 958, 9, 398, 327, 1448, 999, 922, 63, 354, 370, 314, 1709, 267, 367, 1242, 315, 666, 26, 288, 1242, 459, 751, 63, 354, 418, 275, 1592, 14, 751, 14, 1623, 63, 368, 8, 355, 32136, 344, 356, 1242, 459, 751, 63, 344, 12074, 288, 776, 459, 354, 418, 398, 372, 2338, 12, 666, 339, 327, 1448, 999, 769, 402, 922, 3415, 370, 314, 4513, 272, 347, 485, 3871, 63, 751, 63, 4577, 8, 277, 12, 1824, 304, 267, 4390, 275, 1592, 14, 751, 14, 1623, 8, 955, 7782, 354, 16829, 267, 1824, 14, 751, 63, 344, 14, 4577, 275, 3842, 495, 8, 88, 8680, 344, 3815, 671, 459, 354, 1105, 367, 671, 315, 4390, 61, 267, 372, 1824, 339, 347, 1218, 63, 964, 8, 277, 304, 267, 1824, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 981, 63, 964, 342, 267, 372, 291, 423, 3871, 63, 751, 63, 4577, 8, 964, 9, 339, 347, 5283, 63, 964, 8, 277, 12, 1559, 304, 267, 1824, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 3773, 63, 964, 8, 1113, 9, 267, 372, 291, 423, 3871, 63, 751, 63, 4577, 8, 964, 9, 339, 327, 31057, 922, 63, 344, 3659, 2544, 13369, 272, 347, 641, 63, 1238, 63, 1461, 8, 277, 12, 1824, 12, 1402, 304, 267, 922, 63, 344, 275, 1402, 14, 362, 360, 751, 63, 344, 358, 267, 1402, 459, 751, 63, 344, 418, 275, 922, 63, 344, 398, 372, 1402, 421, 199, 3, 16704, 6858, 199, 32, 571, 14, 4449, 7825, 199, 318, 1478, 837, 272, 372, 2650, 65, 4369, 9555, 2113, 26049, 12040, 562, 370, 664, 370, 9516, 28718, 65, 3524, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 327, 2790, 4628, 272, 4628, 275, 4628, 14, 4880, 8, 571, 12, 536, 534, 9846, 26, 11947, 20393, 446, 11947, 2846, 358, 339, 327, 2654, 6858, 272, 4628, 14, 525, 63, 1345, 8, 1899, 2768, 8, 697, 14, 751, 12, 283, 1899, 1333, 272, 4628, 14, 525, 63, 1345, 8, 52, 11554, 2768, 8, 697, 14, 23508, 12, 283, 52, 18588, 1333, 339, 327, 7707, 1145, 272, 1145, 14, 1065, 8, 1757, 29, 549, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 9846, 402, 16704, 13, 4880, 1808, 11947, 2846, 543, 11947, 20393, 199, 21928, 370, 27781, 14, 2424, 367, 15794, 199, 199, 5949, 26, 221, 699, 1065, 79, 6848, 9518, 665, 32, 293, 335, 26940, 1065, 79, 30, 199, 20409, 315, 1611, 20393, 5679, 436, 11947, 20393, 199, 624, 199, 646, 7209, 63, 2113, 465, 4628, 199, 504, 7209, 492, 16704, 199, 504, 7209, 63, 2113, 14, 2828, 14, 29380, 492, 5822, 2768, 12, 4766, 199, 504, 7209, 63, 2113, 14, 964, 492, 9496, 18, 3339, 199, 504, 7209, 63, 2113, 14, 1238, 14, 955, 492, 24789, 792, 1296, 12, 24789, 2821, 792, 199, 504, 24756, 3351, 492, 1504, 12, 1824, 199, 199, 504, 29128, 9217, 492, 11947, 20393, 3041, 199, 199, 3, 2790, 4223, 199, 571, 275, 16704, 3460, 354, 3368, 199, 199, 3, 2790, 7283, 542, 1353, 89, 790, 880, 781, 883, 675, 12184, 199, 571, 14, 888, 459, 12961, 63, 3078, 418, 275, 283, 19060, 22252, 7, 199, 199, 3, 2790, 1709, 315, 282, 4840, 570, 2257, 471, 737, 199, 199, 3998, 19041, 275, 1994, 2791, 15, 15720, 63, 2113, 63, 396, 7, 199, 199, 1631, 275, 11947, 20393, 3041, 8, 3998, 19041, 9, 199, 697, 275, 2557, 14, 396, 199, 199, 3, 1218, 2005, 4390, 367, 5343, 199, 3, 367, 284, 315, 1425, 8, 1216, 304, 199, 3, 258, 1592, 14, 751, 14, 3176, 3252, 354, 356, 283, 45, 7455, 450, 83, 7, 450, 284, 1552, 421, 199, 3, 2876, 4628, 199, 533, 19646, 2821, 8, 964, 14, 2821, 304, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 511, 275, 1504, 14, 14912, 360, 774, 358, 421, 199, 533, 2876, 2821, 8, 964, 14, 2821, 304, 272, 3925, 275, 1504, 14, 14912, 360, 1421, 358, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 3031, 275, 1504, 14, 14912, 360, 7035, 358, 272, 2505, 275, 1504, 14, 14912, 360, 6139, 358, 339, 327, 19646, 1824, 272, 6506, 275, 24789, 2821, 792, 8, 22964, 2821, 9, 339, 327, 8204, 769, 272, 1824, 63, 513, 275, 24789, 792, 1296, 8, 10307, 2821, 792, 8, 22964, 2821, 430, 421, 199, 533, 2876, 2768, 8, 1685, 2768, 304, 272, 2763, 63, 513, 275, 661, 354, 297, 283, 2123, 297, 283, 2060, 297, 283, 1421, 358, 272, 2763, 63, 3191, 461, 63, 513, 275, 661, 354, 297, 283, 2123, 297, 283, 2060, 358, 339, 1824, 275, 2876, 2821, 339, 2034, 63, 890, 275, 3388, 272, 883, 63, 409, 63, 1606, 63, 890, 275, 715, 421, 199, 3, 377, 11554, 2455, 199, 533, 377, 11554, 2821, 8, 964, 14, 2821, 304, 272, 536, 275, 1504, 14, 14912, 360, 985, 358, 272, 922, 63, 344, 275, 1504, 14, 5446, 792, 360, 1899, 297, 3938, 29, 5446, 18, 3339, 1012, 272, 1318, 275, 1504, 14, 14912, 360, 1872, 358, 339, 511, 1873, 275, 1504, 14, 5036, 360, 774, 358, 421, 199, 533, 377, 11554, 2768, 8, 1685, 2768, 304, 272, 2763, 63, 513, 275, 661, 354, 297, 283, 751, 63, 354, 297, 283, 505, 358, 272, 2763, 63, 3191, 461, 63, 513, 275, 661, 354, 297, 283, 505, 358, 339, 2763, 63, 4273, 275, 334, 4273, 14, 4131, 591, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 1763, 591, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 12545, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4131, 1763, 12545, 360, 354, 297, 283, 985, 659, 1993, 4766, 14, 4082, 591, 4131, 360, 396, 1873, 297, 283, 774, 1873, 1333, 339, 327, 2763, 63, 1733, 461, 63, 513, 275, 661, 354, 297, 283, 505, 358, 339, 1824, 275, 377, 11554, 2821, 339, 347, 664, 63, 513, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 2338, 12, 666, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 362, 63, 513, 2031, 589, 12, 1011, 958, 9, 398, 327, 1448, 999, 922, 63, 354, 370, 314, 1709, 267, 367, 1242, 315, 666, 26, 288, 1242, 459, 751, 63, 354, 418, 275, 1592, 14, 751, 14, 1623, 63, 368, 8, 355, 32136, 344, 356, 1242, 459, 751, 63, 344, 12074, 288, 776, 459, 354, 418, 398, 372, 2338, 12, 666, 339, 327, 1448, 999, 769, 402, 922, 3415, 370, 314, 4513, 272, 347, 485, 3871, 63, 751, 63, 4577, 8, 277, 12, 1824, 304, 267, 4390, 275, 1592, 14, 751, 14, 1623, 8, 955, 7782, 354, 16829, 267, 1824, 14, 751, 63, 344, 14, 4577, 275, 3842, 495, 8, 88, 8680, 344, 3815, 671, 459, 354, 1105, 367, 671, 315, 4390, 61, 267, 372, 1824, 339, 347, 1218, 63, 964, 8, 277, 304, 267, 1824, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 981, 63, 964, 342, 267, 372, 291, 423, 3871, 63, 751, 63, 4577, 8, 964, 9, 339, 347, 5283, 63, 964, 8, 277, 12, 1559, 304, 267, 1824, 275, 1613, 8, 52, 11554, 2768, 12, 291, 680, 3773, 63, 964, 8, 1113, 9, 267, 372, 291, 423, 3871, 63, 751, 63, 4577, 8, 964, 9, 339, 327, 31057, 922, 63, 344, 3659, 2544, 13369, 272, 347, 641, 63, 1238, 63, 1461, 8, 277, 12, 1824, 12, 1402, 304, 267, 922, 63, 344, 275, 1402, 14, 362, 360, 751, 63, 344, 358, 267, 1402, 459, 751, 63, 344, 418, 275, 922, 63, 344, 398, 372, 1402, 421, 199, 3, 16704, 6858, 199, 32, 571, 14, 4449, 7825, 199, 318, 1478, 837, 272, 372, 2650, 65, 4369, 9555, 2113, 26049, 12040, 562, 370, 664, 370, 9516, 28718, 65, 3524, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 327, 2790, 4628, 272, 4628, 275, 4628, 14, 4880, 8, 571, 12, 536, 534, 9846, 26, 11947, 20393, 446, 11947, 2846, 358, 339, 327, 2654, 6858, 272, 4628, 14, 525, 63, 1345, 8, 1899, 2768, 8, 697, 14, 751, 12, 283, 1899, 1333, 272, 4628, 14, 525, 63, 1345, 8, 52, 11554, 2768, 8, 697, 14, 23508, 12, 283, 52, 18588, 1333, 339, 327, 7707, 1145, 272, 1145, 14, 1065, 8, 1757, 29, 549, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
mayblue9/scikit-learn
sklearn/feature_extraction/tests/test_text.py
41
35602
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS from sklearn.cross_validation import train_test_split from sklearn.cross_validation import cross_val_score from sklearn.grid_search import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.svm import LinearSVC from sklearn.base import clone import numpy as np from nose import SkipTest from nose.tools import assert_equal from nose.tools import assert_false from nose.tools import assert_not_equal from nose.tools import assert_true from nose.tools import assert_almost_equal from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from numpy.testing import assert_raises from sklearn.utils.random import choice from sklearn.utils.testing import (assert_in, assert_less, assert_greater, assert_warns_message, assert_raise_message, clean_warning_registry) from collections import defaultdict, Mapping from functools import partial import pickle from io import StringIO JUNK_FOOD_DOCS = ( "the pizza pizza beer copyright", "the pizza burger beer copyright", "the the pizza beer beer copyright", "the burger beer beer copyright", "the coke burger coke copyright", "the coke burger burger", ) NOTJUNK_FOOD_DOCS = ( "the salad celeri copyright", "the salad salad sparkling water copyright", "the the celeri celeri copyright", "the tomato tomato salad water", "the tomato salad water copyright", ) ALL_FOOD_DOCS = JUNK_FOOD_DOCS + NOTJUNK_FOOD_DOCS def uppercase(s): return strip_accents_unicode(s).upper() def strip_eacute(s): return s.replace('\xe9', 'e') def split_tokenize(s): return s.split() def lazy_analyze(s): return ['the_ultimate_feature'] def test_strip_accents(): # check some classical latin accentuated symbols a = '\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb' expected = 'aaaaaaceeee' assert_equal(strip_accents_unicode(a), expected) a = '\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf5\xf6\xf9\xfa\xfb\xfc\xfd' expected = 'iiiinooooouuuuy' assert_equal(strip_accents_unicode(a), expected) # check some arabic a = '\u0625' # halef with a hamza below expected = '\u0627' # simple halef assert_equal(strip_accents_unicode(a), expected) # mix letters accentuated and not a = "this is \xe0 test" expected = 'this is a test' assert_equal(strip_accents_unicode(a), expected) def test_to_ascii(): # check some classical latin accentuated symbols a = '\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb' expected = 'aaaaaaceeee' assert_equal(strip_accents_ascii(a), expected) a = '\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf5\xf6\xf9\xfa\xfb\xfc\xfd' expected = 'iiiinooooouuuuy' assert_equal(strip_accents_ascii(a), expected) # check some arabic a = '\u0625' # halef with a hamza below expected = '' # halef has no direct ascii match assert_equal(strip_accents_ascii(a), expected) # mix letters accentuated and not a = "this is \xe0 test" expected = 'this is a test' assert_equal(strip_accents_ascii(a), expected) def test_word_analyzer_unigrams(): for Vectorizer in (CountVectorizer, HashingVectorizer): wa = Vectorizer(strip_accents='ascii').build_analyzer() text = ("J'ai mang\xe9 du kangourou ce midi, " "c'\xe9tait pas tr\xeas bon.") expected = ['ai', 'mange', 'du', 'kangourou', 'ce', 'midi', 'etait', 'pas', 'tres', 'bon'] assert_equal(wa(text), expected) text = "This is a test, really.\n\n I met Harry yesterday." expected = ['this', 'is', 'test', 'really', 'met', 'harry', 'yesterday'] assert_equal(wa(text), expected) wa = Vectorizer(input='file').build_analyzer() text = StringIO("This is a test with a file-like object!") expected = ['this', 'is', 'test', 'with', 'file', 'like', 'object'] assert_equal(wa(text), expected) # with custom preprocessor wa = Vectorizer(preprocessor=uppercase).build_analyzer() text = ("J'ai mang\xe9 du kangourou ce midi, " " c'\xe9tait pas tr\xeas bon.") expected = ['AI', 'MANGE', 'DU', 'KANGOUROU', 'CE', 'MIDI', 'ETAIT', 'PAS', 'TRES', 'BON'] assert_equal(wa(text), expected) # with custom tokenizer wa = Vectorizer(tokenizer=split_tokenize, strip_accents='ascii').build_analyzer() text = ("J'ai mang\xe9 du kangourou ce midi, " "c'\xe9tait pas tr\xeas bon.") expected = ["j'ai", 'mange', 'du', 'kangourou', 'ce', 'midi,', "c'etait", 'pas', 'tres', 'bon.'] assert_equal(wa(text), expected) def test_word_analyzer_unigrams_and_bigrams(): wa = CountVectorizer(analyzer="word", strip_accents='unicode', ngram_range=(1, 2)).build_analyzer() text = "J'ai mang\xe9 du kangourou ce midi, c'\xe9tait pas tr\xeas bon." expected = ['ai', 'mange', 'du', 'kangourou', 'ce', 'midi', 'etait', 'pas', 'tres', 'bon', 'ai mange', 'mange du', 'du kangourou', 'kangourou ce', 'ce midi', 'midi etait', 'etait pas', 'pas tres', 'tres bon'] assert_equal(wa(text), expected) def test_unicode_decode_error(): # decode_error default to strict, so this should fail # First, encode (as bytes) a unicode string. text = "J'ai mang\xe9 du kangourou ce midi, c'\xe9tait pas tr\xeas bon." text_bytes = text.encode('utf-8') # Then let the Analyzer try to decode it as ascii. It should fail, # because we have given it an incorrect encoding. wa = CountVectorizer(ngram_range=(1, 2), encoding='ascii').build_analyzer() assert_raises(UnicodeDecodeError, wa, text_bytes) ca = CountVectorizer(analyzer='char', ngram_range=(3, 6), encoding='ascii').build_analyzer() assert_raises(UnicodeDecodeError, ca, text_bytes) def test_char_ngram_analyzer(): cnga = CountVectorizer(analyzer='char', strip_accents='unicode', ngram_range=(3, 6)).build_analyzer() text = "J'ai mang\xe9 du kangourou ce midi, c'\xe9tait pas tr\xeas bon" expected = ["j'a", "'ai", 'ai ', 'i m', ' ma'] assert_equal(cnga(text)[:5], expected) expected = ['s tres', ' tres ', 'tres b', 'res bo', 'es bon'] assert_equal(cnga(text)[-5:], expected) text = "This \n\tis a test, really.\n\n I met Harry yesterday" expected = ['thi', 'his', 'is ', 's i', ' is'] assert_equal(cnga(text)[:5], expected) expected = [' yeste', 'yester', 'esterd', 'sterda', 'terday'] assert_equal(cnga(text)[-5:], expected) cnga = CountVectorizer(input='file', analyzer='char', ngram_range=(3, 6)).build_analyzer() text = StringIO("This is a test with a file-like object!") expected = ['thi', 'his', 'is ', 's i', ' is'] assert_equal(cnga(text)[:5], expected) def test_char_wb_ngram_analyzer(): cnga = CountVectorizer(analyzer='char_wb', strip_accents='unicode', ngram_range=(3, 6)).build_analyzer() text = "This \n\tis a test, really.\n\n I met Harry yesterday" expected = [' th', 'thi', 'his', 'is ', ' thi'] assert_equal(cnga(text)[:5], expected) expected = ['yester', 'esterd', 'sterda', 'terday', 'erday '] assert_equal(cnga(text)[-5:], expected) cnga = CountVectorizer(input='file', analyzer='char_wb', ngram_range=(3, 6)).build_analyzer() text = StringIO("A test with a file-like object!") expected = [' a ', ' te', 'tes', 'est', 'st ', ' tes'] assert_equal(cnga(text)[:6], expected) def test_countvectorizer_custom_vocabulary(): vocab = {"pizza": 0, "beer": 1} terms = set(vocab.keys()) # Try a few of the supported types. for typ in [dict, list, iter, partial(defaultdict, int)]: v = typ(vocab) vect = CountVectorizer(vocabulary=v) vect.fit(JUNK_FOOD_DOCS) if isinstance(v, Mapping): assert_equal(vect.vocabulary_, vocab) else: assert_equal(set(vect.vocabulary_), terms) X = vect.transform(JUNK_FOOD_DOCS) assert_equal(X.shape[1], len(terms)) def test_countvectorizer_custom_vocabulary_pipeline(): what_we_like = ["pizza", "beer"] pipe = Pipeline([ ('count', CountVectorizer(vocabulary=what_we_like)), ('tfidf', TfidfTransformer())]) X = pipe.fit_transform(ALL_FOOD_DOCS) assert_equal(set(pipe.named_steps['count'].vocabulary_), set(what_we_like)) assert_equal(X.shape[1], len(what_we_like)) def test_countvectorizer_custom_vocabulary_repeated_indeces(): vocab = {"pizza": 0, "beer": 0} try: CountVectorizer(vocabulary=vocab) except ValueError as e: assert_in("vocabulary contains repeated indices", str(e).lower()) def test_countvectorizer_custom_vocabulary_gap_index(): vocab = {"pizza": 1, "beer": 2} try: CountVectorizer(vocabulary=vocab) except ValueError as e: assert_in("doesn't contain index", str(e).lower()) def test_countvectorizer_stop_words(): cv = CountVectorizer() cv.set_params(stop_words='english') assert_equal(cv.get_stop_words(), ENGLISH_STOP_WORDS) cv.set_params(stop_words='_bad_str_stop_') assert_raises(ValueError, cv.get_stop_words) cv.set_params(stop_words='_bad_unicode_stop_') assert_raises(ValueError, cv.get_stop_words) stoplist = ['some', 'other', 'words'] cv.set_params(stop_words=stoplist) assert_equal(cv.get_stop_words(), set(stoplist)) def test_countvectorizer_empty_vocabulary(): try: vect = CountVectorizer(vocabulary=[]) vect.fit(["foo"]) assert False, "we shouldn't get here" except ValueError as e: assert_in("empty vocabulary", str(e).lower()) try: v = CountVectorizer(max_df=1.0, stop_words="english") # fit on stopwords only v.fit(["to be or not to be", "and me too", "and so do you"]) assert False, "we shouldn't get here" except ValueError as e: assert_in("empty vocabulary", str(e).lower()) def test_fit_countvectorizer_twice(): cv = CountVectorizer() X1 = cv.fit_transform(ALL_FOOD_DOCS[:5]) X2 = cv.fit_transform(ALL_FOOD_DOCS[5:]) assert_not_equal(X1.shape[1], X2.shape[1]) def test_tf_idf_smoothing(): X = [[1, 1, 1], [1, 1, 0], [1, 0, 0]] tr = TfidfTransformer(smooth_idf=True, norm='l2') tfidf = tr.fit_transform(X).toarray() assert_true((tfidf >= 0).all()) # check normalization assert_array_almost_equal((tfidf ** 2).sum(axis=1), [1., 1., 1.]) # this is robust to features with only zeros X = [[1, 1, 0], [1, 1, 0], [1, 0, 0]] tr = TfidfTransformer(smooth_idf=True, norm='l2') tfidf = tr.fit_transform(X).toarray() assert_true((tfidf >= 0).all()) def test_tfidf_no_smoothing(): X = [[1, 1, 1], [1, 1, 0], [1, 0, 0]] tr = TfidfTransformer(smooth_idf=False, norm='l2') tfidf = tr.fit_transform(X).toarray() assert_true((tfidf >= 0).all()) # check normalization assert_array_almost_equal((tfidf ** 2).sum(axis=1), [1., 1., 1.]) # the lack of smoothing make IDF fragile in the presence of feature with # only zeros X = [[1, 1, 0], [1, 1, 0], [1, 0, 0]] tr = TfidfTransformer(smooth_idf=False, norm='l2') clean_warning_registry() with warnings.catch_warnings(record=True) as w: 1. / np.array([0.]) numpy_provides_div0_warning = len(w) == 1 in_warning_message = 'divide by zero' tfidf = assert_warns_message(RuntimeWarning, in_warning_message, tr.fit_transform, X).toarray() if not numpy_provides_div0_warning: raise SkipTest("Numpy does not provide div 0 warnings.") def test_sublinear_tf(): X = [[1], [2], [3]] tr = TfidfTransformer(sublinear_tf=True, use_idf=False, norm=None) tfidf = tr.fit_transform(X).toarray() assert_equal(tfidf[0], 1) assert_greater(tfidf[1], tfidf[0]) assert_greater(tfidf[2], tfidf[1]) assert_less(tfidf[1], 2) assert_less(tfidf[2], 3) def test_vectorizer(): # raw documents as an iterator train_data = iter(ALL_FOOD_DOCS[:-1]) test_data = [ALL_FOOD_DOCS[-1]] n_train = len(ALL_FOOD_DOCS) - 1 # test without vocabulary v1 = CountVectorizer(max_df=0.5) counts_train = v1.fit_transform(train_data) if hasattr(counts_train, 'tocsr'): counts_train = counts_train.tocsr() assert_equal(counts_train[0, v1.vocabulary_["pizza"]], 2) # build a vectorizer v1 with the same vocabulary as the one fitted by v1 v2 = CountVectorizer(vocabulary=v1.vocabulary_) # compare that the two vectorizer give the same output on the test sample for v in (v1, v2): counts_test = v.transform(test_data) if hasattr(counts_test, 'tocsr'): counts_test = counts_test.tocsr() vocabulary = v.vocabulary_ assert_equal(counts_test[0, vocabulary["salad"]], 1) assert_equal(counts_test[0, vocabulary["tomato"]], 1) assert_equal(counts_test[0, vocabulary["water"]], 1) # stop word from the fixed list assert_false("the" in vocabulary) # stop word found automatically by the vectorizer DF thresholding # words that are high frequent across the complete corpus are likely # to be not informative (either real stop words of extraction # artifacts) assert_false("copyright" in vocabulary) # not present in the sample assert_equal(counts_test[0, vocabulary["coke"]], 0) assert_equal(counts_test[0, vocabulary["burger"]], 0) assert_equal(counts_test[0, vocabulary["beer"]], 0) assert_equal(counts_test[0, vocabulary["pizza"]], 0) # test tf-idf t1 = TfidfTransformer(norm='l1') tfidf = t1.fit(counts_train).transform(counts_train).toarray() assert_equal(len(t1.idf_), len(v1.vocabulary_)) assert_equal(tfidf.shape, (n_train, len(v1.vocabulary_))) # test tf-idf with new data tfidf_test = t1.transform(counts_test).toarray() assert_equal(tfidf_test.shape, (len(test_data), len(v1.vocabulary_))) # test tf alone t2 = TfidfTransformer(norm='l1', use_idf=False) tf = t2.fit(counts_train).transform(counts_train).toarray() assert_equal(t2.idf_, None) # test idf transform with unlearned idf vector t3 = TfidfTransformer(use_idf=True) assert_raises(ValueError, t3.transform, counts_train) # test idf transform with incompatible n_features X = [[1, 1, 5], [1, 1, 0]] t3.fit(X) X_incompt = [[1, 3], [1, 3]] assert_raises(ValueError, t3.transform, X_incompt) # L1-normalized term frequencies sum to one assert_array_almost_equal(np.sum(tf, axis=1), [1.0] * n_train) # test the direct tfidf vectorizer # (equivalent to term count vectorizer + tfidf transformer) train_data = iter(ALL_FOOD_DOCS[:-1]) tv = TfidfVectorizer(norm='l1') tv.max_df = v1.max_df tfidf2 = tv.fit_transform(train_data).toarray() assert_false(tv.fixed_vocabulary_) assert_array_almost_equal(tfidf, tfidf2) # test the direct tfidf vectorizer with new data tfidf_test2 = tv.transform(test_data).toarray() assert_array_almost_equal(tfidf_test, tfidf_test2) # test transform on unfitted vectorizer with empty vocabulary v3 = CountVectorizer(vocabulary=None) assert_raises(ValueError, v3.transform, train_data) # ascii preprocessor? v3.set_params(strip_accents='ascii', lowercase=False) assert_equal(v3.build_preprocessor(), strip_accents_ascii) # error on bad strip_accents param v3.set_params(strip_accents='_gabbledegook_', preprocessor=None) assert_raises(ValueError, v3.build_preprocessor) # error with bad analyzer type v3.set_params = '_invalid_analyzer_type_' assert_raises(ValueError, v3.build_analyzer) def test_tfidf_vectorizer_setters(): tv = TfidfVectorizer(norm='l2', use_idf=False, smooth_idf=False, sublinear_tf=False) tv.norm = 'l1' assert_equal(tv._tfidf.norm, 'l1') tv.use_idf = True assert_true(tv._tfidf.use_idf) tv.smooth_idf = True assert_true(tv._tfidf.smooth_idf) tv.sublinear_tf = True assert_true(tv._tfidf.sublinear_tf) def test_hashing_vectorizer(): v = HashingVectorizer() X = v.transform(ALL_FOOD_DOCS) token_nnz = X.nnz assert_equal(X.shape, (len(ALL_FOOD_DOCS), v.n_features)) assert_equal(X.dtype, v.dtype) # By default the hashed values receive a random sign and l2 normalization # makes the feature values bounded assert_true(np.min(X.data) > -1) assert_true(np.min(X.data) < 0) assert_true(np.max(X.data) > 0) assert_true(np.max(X.data) < 1) # Check that the rows are normalized for i in range(X.shape[0]): assert_almost_equal(np.linalg.norm(X[0].data, 2), 1.0) # Check vectorization with some non-default parameters v = HashingVectorizer(ngram_range=(1, 2), non_negative=True, norm='l1') X = v.transform(ALL_FOOD_DOCS) assert_equal(X.shape, (len(ALL_FOOD_DOCS), v.n_features)) assert_equal(X.dtype, v.dtype) # ngrams generate more non zeros ngrams_nnz = X.nnz assert_true(ngrams_nnz > token_nnz) assert_true(ngrams_nnz < 2 * token_nnz) # makes the feature values bounded assert_true(np.min(X.data) > 0) assert_true(np.max(X.data) < 1) # Check that the rows are normalized for i in range(X.shape[0]): assert_almost_equal(np.linalg.norm(X[0].data, 1), 1.0) def test_feature_names(): cv = CountVectorizer(max_df=0.5) # test for Value error on unfitted/empty vocabulary assert_raises(ValueError, cv.get_feature_names) X = cv.fit_transform(ALL_FOOD_DOCS) n_samples, n_features = X.shape assert_equal(len(cv.vocabulary_), n_features) feature_names = cv.get_feature_names() assert_equal(len(feature_names), n_features) assert_array_equal(['beer', 'burger', 'celeri', 'coke', 'pizza', 'salad', 'sparkling', 'tomato', 'water'], feature_names) for idx, name in enumerate(feature_names): assert_equal(idx, cv.vocabulary_.get(name)) def test_vectorizer_max_features(): vec_factories = ( CountVectorizer, TfidfVectorizer, ) expected_vocabulary = set(['burger', 'beer', 'salad', 'pizza']) expected_stop_words = set([u'celeri', u'tomato', u'copyright', u'coke', u'sparkling', u'water', u'the']) for vec_factory in vec_factories: # test bounded number of extracted features vectorizer = vec_factory(max_df=0.6, max_features=4) vectorizer.fit(ALL_FOOD_DOCS) assert_equal(set(vectorizer.vocabulary_), expected_vocabulary) assert_equal(vectorizer.stop_words_, expected_stop_words) def test_count_vectorizer_max_features(): # Regression test: max_features didn't work correctly in 0.14. cv_1 = CountVectorizer(max_features=1) cv_3 = CountVectorizer(max_features=3) cv_None = CountVectorizer(max_features=None) counts_1 = cv_1.fit_transform(JUNK_FOOD_DOCS).sum(axis=0) counts_3 = cv_3.fit_transform(JUNK_FOOD_DOCS).sum(axis=0) counts_None = cv_None.fit_transform(JUNK_FOOD_DOCS).sum(axis=0) features_1 = cv_1.get_feature_names() features_3 = cv_3.get_feature_names() features_None = cv_None.get_feature_names() # The most common feature is "the", with frequency 7. assert_equal(7, counts_1.max()) assert_equal(7, counts_3.max()) assert_equal(7, counts_None.max()) # The most common feature should be the same assert_equal("the", features_1[np.argmax(counts_1)]) assert_equal("the", features_3[np.argmax(counts_3)]) assert_equal("the", features_None[np.argmax(counts_None)]) def test_vectorizer_max_df(): test_data = ['abc', 'dea', 'eat'] vect = CountVectorizer(analyzer='char', max_df=1.0) vect.fit(test_data) assert_true('a' in vect.vocabulary_.keys()) assert_equal(len(vect.vocabulary_.keys()), 6) assert_equal(len(vect.stop_words_), 0) vect.max_df = 0.5 # 0.5 * 3 documents -> max_doc_count == 1.5 vect.fit(test_data) assert_true('a' not in vect.vocabulary_.keys()) # {ae} ignored assert_equal(len(vect.vocabulary_.keys()), 4) # {bcdt} remain assert_true('a' in vect.stop_words_) assert_equal(len(vect.stop_words_), 2) vect.max_df = 1 vect.fit(test_data) assert_true('a' not in vect.vocabulary_.keys()) # {ae} ignored assert_equal(len(vect.vocabulary_.keys()), 4) # {bcdt} remain assert_true('a' in vect.stop_words_) assert_equal(len(vect.stop_words_), 2) def test_vectorizer_min_df(): test_data = ['abc', 'dea', 'eat'] vect = CountVectorizer(analyzer='char', min_df=1) vect.fit(test_data) assert_true('a' in vect.vocabulary_.keys()) assert_equal(len(vect.vocabulary_.keys()), 6) assert_equal(len(vect.stop_words_), 0) vect.min_df = 2 vect.fit(test_data) assert_true('c' not in vect.vocabulary_.keys()) # {bcdt} ignored assert_equal(len(vect.vocabulary_.keys()), 2) # {ae} remain assert_true('c' in vect.stop_words_) assert_equal(len(vect.stop_words_), 4) vect.min_df = 0.8 # 0.8 * 3 documents -> min_doc_count == 2.4 vect.fit(test_data) assert_true('c' not in vect.vocabulary_.keys()) # {bcdet} ignored assert_equal(len(vect.vocabulary_.keys()), 1) # {a} remains assert_true('c' in vect.stop_words_) assert_equal(len(vect.stop_words_), 5) def test_count_binary_occurrences(): # by default multiple occurrences are counted as longs test_data = ['aaabc', 'abbde'] vect = CountVectorizer(analyzer='char', max_df=1.0) X = vect.fit_transform(test_data).toarray() assert_array_equal(['a', 'b', 'c', 'd', 'e'], vect.get_feature_names()) assert_array_equal([[3, 1, 1, 0, 0], [1, 2, 0, 1, 1]], X) # using boolean features, we can fetch the binary occurrence info # instead. vect = CountVectorizer(analyzer='char', max_df=1.0, binary=True) X = vect.fit_transform(test_data).toarray() assert_array_equal([[1, 1, 1, 0, 0], [1, 1, 0, 1, 1]], X) # check the ability to change the dtype vect = CountVectorizer(analyzer='char', max_df=1.0, binary=True, dtype=np.float32) X_sparse = vect.fit_transform(test_data) assert_equal(X_sparse.dtype, np.float32) def test_hashed_binary_occurrences(): # by default multiple occurrences are counted as longs test_data = ['aaabc', 'abbde'] vect = HashingVectorizer(analyzer='char', non_negative=True, norm=None) X = vect.transform(test_data) assert_equal(np.max(X[0:1].data), 3) assert_equal(np.max(X[1:2].data), 2) assert_equal(X.dtype, np.float64) # using boolean features, we can fetch the binary occurrence info # instead. vect = HashingVectorizer(analyzer='char', non_negative=True, binary=True, norm=None) X = vect.transform(test_data) assert_equal(np.max(X.data), 1) assert_equal(X.dtype, np.float64) # check the ability to change the dtype vect = HashingVectorizer(analyzer='char', non_negative=True, binary=True, norm=None, dtype=np.float64) X = vect.transform(test_data) assert_equal(X.dtype, np.float64) def test_vectorizer_inverse_transform(): # raw documents data = ALL_FOOD_DOCS for vectorizer in (TfidfVectorizer(), CountVectorizer()): transformed_data = vectorizer.fit_transform(data) inversed_data = vectorizer.inverse_transform(transformed_data) analyze = vectorizer.build_analyzer() for doc, inversed_terms in zip(data, inversed_data): terms = np.sort(np.unique(analyze(doc))) inversed_terms = np.sort(np.unique(inversed_terms)) assert_array_equal(terms, inversed_terms) # Test that inverse_transform also works with numpy arrays transformed_data = transformed_data.toarray() inversed_data2 = vectorizer.inverse_transform(transformed_data) for terms, terms2 in zip(inversed_data, inversed_data2): assert_array_equal(np.sort(terms), np.sort(terms2)) def test_count_vectorizer_pipeline_grid_selection(): # raw documents data = JUNK_FOOD_DOCS + NOTJUNK_FOOD_DOCS # label junk food as -1, the others as +1 target = [-1] * len(JUNK_FOOD_DOCS) + [1] * len(NOTJUNK_FOOD_DOCS) # split the dataset for model development and final evaluation train_data, test_data, target_train, target_test = train_test_split( data, target, test_size=.2, random_state=0) pipeline = Pipeline([('vect', CountVectorizer()), ('svc', LinearSVC())]) parameters = { 'vect__ngram_range': [(1, 1), (1, 2)], 'svc__loss': ('hinge', 'squared_hinge') } # find the best parameters for both the feature extraction and the # classifier grid_search = GridSearchCV(pipeline, parameters, n_jobs=1) # Check that the best model found by grid search is 100% correct on the # held out evaluation set. pred = grid_search.fit(train_data, target_train).predict(test_data) assert_array_equal(pred, target_test) # on this toy dataset bigram representation which is used in the last of # the grid_search is considered the best estimator since they all converge # to 100% accuracy models assert_equal(grid_search.best_score_, 1.0) best_vectorizer = grid_search.best_estimator_.named_steps['vect'] assert_equal(best_vectorizer.ngram_range, (1, 1)) def test_vectorizer_pipeline_grid_selection(): # raw documents data = JUNK_FOOD_DOCS + NOTJUNK_FOOD_DOCS # label junk food as -1, the others as +1 target = [-1] * len(JUNK_FOOD_DOCS) + [1] * len(NOTJUNK_FOOD_DOCS) # split the dataset for model development and final evaluation train_data, test_data, target_train, target_test = train_test_split( data, target, test_size=.1, random_state=0) pipeline = Pipeline([('vect', TfidfVectorizer()), ('svc', LinearSVC())]) parameters = { 'vect__ngram_range': [(1, 1), (1, 2)], 'vect__norm': ('l1', 'l2'), 'svc__loss': ('hinge', 'squared_hinge'), } # find the best parameters for both the feature extraction and the # classifier grid_search = GridSearchCV(pipeline, parameters, n_jobs=1) # Check that the best model found by grid search is 100% correct on the # held out evaluation set. pred = grid_search.fit(train_data, target_train).predict(test_data) assert_array_equal(pred, target_test) # on this toy dataset bigram representation which is used in the last of # the grid_search is considered the best estimator since they all converge # to 100% accuracy models assert_equal(grid_search.best_score_, 1.0) best_vectorizer = grid_search.best_estimator_.named_steps['vect'] assert_equal(best_vectorizer.ngram_range, (1, 1)) assert_equal(best_vectorizer.norm, 'l2') assert_false(best_vectorizer.fixed_vocabulary_) def test_vectorizer_pipeline_cross_validation(): # raw documents data = JUNK_FOOD_DOCS + NOTJUNK_FOOD_DOCS # label junk food as -1, the others as +1 target = [-1] * len(JUNK_FOOD_DOCS) + [1] * len(NOTJUNK_FOOD_DOCS) pipeline = Pipeline([('vect', TfidfVectorizer()), ('svc', LinearSVC())]) cv_scores = cross_val_score(pipeline, data, target, cv=3) assert_array_equal(cv_scores, [1., 1., 1.]) def test_vectorizer_unicode(): # tests that the count vectorizer works with cyrillic. document = ( "\xd0\x9c\xd0\xb0\xd1\x88\xd0\xb8\xd0\xbd\xd0\xbd\xd0\xbe\xd0" "\xb5 \xd0\xbe\xd0\xb1\xd1\x83\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb8\xd0" "\xb5 \xe2\x80\x94 \xd0\xbe\xd0\xb1\xd1\x88\xd0\xb8\xd1\x80\xd0\xbd" "\xd1\x8b\xd0\xb9 \xd0\xbf\xd0\xbe\xd0\xb4\xd1\x80\xd0\xb0\xd0\xb7" "\xd0\xb4\xd0\xb5\xd0\xbb \xd0\xb8\xd1\x81\xd0\xba\xd1\x83\xd1\x81" "\xd1\x81\xd1\x82\xd0\xb2\xd0\xb5\xd0\xbd\xd0\xbd\xd0\xbe\xd0\xb3" "\xd0\xbe \xd0\xb8\xd0\xbd\xd1\x82\xd0\xb5\xd0\xbb\xd0\xbb\xd0" "\xb5\xd0\xba\xd1\x82\xd0\xb0, \xd0\xb8\xd0\xb7\xd1\x83\xd1\x87" "\xd0\xb0\xd1\x8e\xd1\x89\xd0\xb8\xd0\xb9 \xd0\xbc\xd0\xb5\xd1\x82" "\xd0\xbe\xd0\xb4\xd1\x8b \xd0\xbf\xd0\xbe\xd1\x81\xd1\x82\xd1\x80" "\xd0\xbe\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x8f \xd0\xb0\xd0\xbb\xd0\xb3" "\xd0\xbe\xd1\x80\xd0\xb8\xd1\x82\xd0\xbc\xd0\xbe\xd0\xb2, \xd1\x81" "\xd0\xbf\xd0\xbe\xd1\x81\xd0\xbe\xd0\xb1\xd0\xbd\xd1\x8b\xd1\x85 " "\xd0\xbe\xd0\xb1\xd1\x83\xd1\x87\xd0\xb0\xd1\x82\xd1\x8c\xd1\x81\xd1" "\x8f.") vect = CountVectorizer() X_counted = vect.fit_transform([document]) assert_equal(X_counted.shape, (1, 15)) vect = HashingVectorizer(norm=None, non_negative=True) X_hashed = vect.transform([document]) assert_equal(X_hashed.shape, (1, 2 ** 20)) # No collisions on such a small dataset assert_equal(X_counted.nnz, X_hashed.nnz) # When norm is None and non_negative, the tokens are counted up to # collisions assert_array_equal(np.sort(X_counted.data), np.sort(X_hashed.data)) def test_tfidf_vectorizer_with_fixed_vocabulary(): # non regression smoke test for inheritance issues vocabulary = ['pizza', 'celeri'] vect = TfidfVectorizer(vocabulary=vocabulary) X_1 = vect.fit_transform(ALL_FOOD_DOCS) X_2 = vect.transform(ALL_FOOD_DOCS) assert_array_almost_equal(X_1.toarray(), X_2.toarray()) assert_true(vect.fixed_vocabulary_) def test_pickling_vectorizer(): instances = [ HashingVectorizer(), HashingVectorizer(norm='l1'), HashingVectorizer(binary=True), HashingVectorizer(ngram_range=(1, 2)), CountVectorizer(), CountVectorizer(preprocessor=strip_tags), CountVectorizer(analyzer=lazy_analyze), CountVectorizer(preprocessor=strip_tags).fit(JUNK_FOOD_DOCS), CountVectorizer(strip_accents=strip_eacute).fit(JUNK_FOOD_DOCS), TfidfVectorizer(), TfidfVectorizer(analyzer=lazy_analyze), TfidfVectorizer().fit(JUNK_FOOD_DOCS), ] for orig in instances: s = pickle.dumps(orig) copy = pickle.loads(s) assert_equal(type(copy), orig.__class__) assert_equal(copy.get_params(), orig.get_params()) assert_array_equal( copy.fit_transform(JUNK_FOOD_DOCS).toarray(), orig.fit_transform(JUNK_FOOD_DOCS).toarray()) def test_countvectorizer_vocab_sets_when_pickling(): # ensure that vocabulary of type set is coerced to a list to # preserve iteration ordering after deserialization rng = np.random.RandomState(0) vocab_words = np.array(['beer', 'burger', 'celeri', 'coke', 'pizza', 'salad', 'sparkling', 'tomato', 'water']) for x in range(0, 100): vocab_set = set(choice(vocab_words, size=5, replace=False, random_state=rng)) cv = CountVectorizer(vocabulary=vocab_set) unpickled_cv = pickle.loads(pickle.dumps(cv)) cv.fit(ALL_FOOD_DOCS) unpickled_cv.fit(ALL_FOOD_DOCS) assert_equal(cv.get_feature_names(), unpickled_cv.get_feature_names()) def test_countvectorizer_vocab_dicts_when_pickling(): rng = np.random.RandomState(0) vocab_words = np.array(['beer', 'burger', 'celeri', 'coke', 'pizza', 'salad', 'sparkling', 'tomato', 'water']) for x in range(0, 100): vocab_dict = dict() words = choice(vocab_words, size=5, replace=False, random_state=rng) for y in range(0, 5): vocab_dict[words[y]] = y cv = CountVectorizer(vocabulary=vocab_dict) unpickled_cv = pickle.loads(pickle.dumps(cv)) cv.fit(ALL_FOOD_DOCS) unpickled_cv.fit(ALL_FOOD_DOCS) assert_equal(cv.get_feature_names(), unpickled_cv.get_feature_names()) def test_stop_words_removal(): # Ensure that deleting the stop_words_ attribute doesn't affect transform fitted_vectorizers = ( TfidfVectorizer().fit(JUNK_FOOD_DOCS), CountVectorizer(preprocessor=strip_tags).fit(JUNK_FOOD_DOCS), CountVectorizer(strip_accents=strip_eacute).fit(JUNK_FOOD_DOCS) ) for vect in fitted_vectorizers: vect_transform = vect.transform(JUNK_FOOD_DOCS).toarray() vect.stop_words_ = None stop_None_transform = vect.transform(JUNK_FOOD_DOCS).toarray() delattr(vect, 'stop_words_') stop_del_transform = vect.transform(JUNK_FOOD_DOCS).toarray() assert_array_equal(stop_None_transform, vect_transform) assert_array_equal(stop_del_transform, vect_transform) def test_pickling_transformer(): X = CountVectorizer().fit_transform(JUNK_FOOD_DOCS) orig = TfidfTransformer().fit(X) s = pickle.dumps(orig) copy = pickle.loads(s) assert_equal(type(copy), orig.__class__) assert_array_equal( copy.fit_transform(X).toarray(), orig.fit_transform(X).toarray()) def test_non_unique_vocab(): vocab = ['a', 'b', 'c', 'a', 'a'] vect = CountVectorizer(vocabulary=vocab) assert_raises(ValueError, vect.fit, []) def test_hashingvectorizer_nan_in_docs(): # np.nan can appear when using pandas to load text fields from a csv file # with missing values. message = "np.nan is an invalid document, expected byte or unicode string." exception = ValueError def func(): hv = HashingVectorizer() hv.fit_transform(['hello world', np.nan, 'hello hello']) assert_raise_message(exception, message, func) def test_tfidfvectorizer_binary(): # Non-regression test: TfidfVectorizer used to ignore its "binary" param. v = TfidfVectorizer(binary=True, use_idf=False, norm=None) assert_true(v.binary) X = v.fit_transform(['hello world', 'hello hello']).toarray() assert_array_equal(X.ravel(), [1, 1, 1, 0]) X2 = v.transform(['hello world', 'hello hello']).toarray() assert_array_equal(X2.ravel(), [1, 1, 1, 0]) def test_tfidfvectorizer_export_idf(): vect = TfidfVectorizer(use_idf=True) vect.fit(JUNK_FOOD_DOCS) assert_array_almost_equal(vect.idf_, vect._tfidf.idf_) def test_vectorizer_vocab_clone(): vect_vocab = TfidfVectorizer(vocabulary=["the"]) vect_vocab_clone = clone(vect_vocab) vect_vocab.fit(ALL_FOOD_DOCS) vect_vocab_clone.fit(ALL_FOOD_DOCS) assert_equal(vect_vocab_clone.vocabulary_, vect_vocab.vocabulary_)
bsd-3-clause
[ 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 646, 3598, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 2969, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 18028, 83, 63, 2975, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 18028, 83, 63, 4371, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 16101, 316, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 14826, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 19761, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 26165, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 5070, 2226, 13898, 63, 11632, 63, 19984, 199, 199, 504, 6357, 14, 7925, 63, 6136, 492, 3560, 63, 396, 63, 1294, 199, 504, 6357, 14, 7925, 63, 6136, 492, 8059, 63, 637, 63, 3397, 199, 504, 6357, 14, 3825, 63, 1733, 492, 32570, 199, 504, 6357, 14, 7379, 492, 19090, 199, 504, 6357, 14, 16820, 492, 12489, 17675, 199, 199, 504, 6357, 14, 1095, 492, 7289, 199, 199, 646, 2680, 465, 980, 199, 504, 11354, 492, 18795, 199, 504, 11354, 14, 2537, 492, 702, 63, 1452, 199, 504, 11354, 14, 2537, 492, 702, 63, 3910, 199, 504, 11354, 14, 2537, 492, 702, 63, 1397, 63, 1452, 199, 504, 11354, 14, 2537, 492, 702, 63, 2052, 199, 504, 11354, 14, 2537, 492, 702, 63, 4398, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 4398, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 3536, 199, 504, 6357, 14, 1208, 14, 2355, 492, 7141, 199, 504, 6357, 14, 1208, 14, 4776, 492, 334, 479, 63, 262, 12, 702, 63, 2003, 12, 702, 63, 13154, 12, 3521, 702, 63, 19811, 63, 1188, 12, 702, 63, 3730, 63, 1188, 12, 3521, 3633, 63, 3764, 63, 5189, 9, 199, 199, 504, 5055, 492, 10018, 12, 12340, 199, 504, 9143, 492, 7417, 199, 646, 5927, 199, 504, 5890, 492, 5228, 421, 199, 42, 8019, 63, 13046, 36, 63, 30072, 275, 334, 272, 298, 1589, 299, 30937, 299, 30937, 506, 281, 4248, 401, 272, 298, 1589, 299, 30937, 330, 300, 836, 506, 281, 4248, 401, 272, 298, 1589, 314, 299, 30937, 506, 281, 506, 281, 4248, 401, 272, 298, 1589, 330, 300, 836, 506, 281, 506, 281, 4248, 401, 272, 298, 1589, 512, 415, 330, 300, 836, 512, 415, 4248, 401, 272, 298, 1589, 512, 415, 330, 300, 836, 330, 300, 836, 401, 199, 9, 199, 199, 4609, 42, 8019, 63, 13046, 36, 63, 30072, 275, 334, 272, 298, 1589, 18641, 350, 286, 8081, 322, 4248, 401, 272, 298, 1589, 18641, 350, 18641, 350, 15442, 2983, 22834, 4248, 401, 272, 298, 1589, 314, 286, 8081, 322, 286, 8081, 322, 4248, 401, 272, 298, 1589, 370, 569, 79, 370, 569, 79, 18641, 350, 22834, 401, 272, 298, 1589, 370, 569, 79, 18641, 350, 22834, 4248, 401, 199, 9, 199, 199, 1761, 63, 13046, 36, 63, 30072, 275, 1603, 8019, 63, 13046, 36, 63, 30072, 435, 2845, 42, 8019, 63, 13046, 36, 63, 30072, 421, 199, 318, 22681, 8, 83, 304, 272, 372, 6202, 63, 18028, 83, 63, 2975, 8, 83, 680, 4142, 342, 421, 199, 318, 6202, 63, 69, 14696, 8, 83, 304, 272, 372, 308, 14, 1814, 2258, 1845, 25, 297, 283, 69, 358, 421, 199, 318, 3715, 63, 15246, 8, 83, 304, 272, 372, 308, 14, 1294, 342, 421, 199, 318, 9617, 63, 21184, 8, 83, 304, 272, 372, 788, 1589, 63, 1141, 17684, 63, 4445, 418, 421, 199, 318, 511, 63, 1913, 63, 18028, 83, 837, 272, 327, 1104, 2005, 11534, 915, 16899, 1066, 2946, 23130, 6698, 272, 282, 275, 1557, 1845, 16, 60, 1845, 17, 60, 1845, 18, 60, 1845, 19, 60, 1845, 20, 60, 1845, 21, 60, 1845, 23, 60, 1845, 24, 60, 1845, 25, 60, 10656, 60, 10145, 7, 272, 1420, 275, 283, 6000, 2158, 301, 18777, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 282, 275, 1557, 9542, 60, 7887, 60, 11127, 60, 9532, 60, 1949, 17, 60, 1949, 18, 60, 1949, 19, 60, 1949, 20, 60, 1949, 21, 60, 1949, 22, 60, 1949, 25, 60, 10500, 60, 10272, 60, 10347, 60, 11208, 7, 272, 1420, 275, 283, 5908, 73, 262, 14685, 810, 17031, 29514, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 327, 1104, 2005, 282, 24176, 272, 282, 275, 1557, 85, 1690, 821, 7, 221, 327, 394, 1895, 70, 543, 282, 24868, 8076, 5084, 272, 1420, 275, 1557, 85, 1690, 1465, 7, 221, 327, 3486, 394, 1895, 70, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 327, 13667, 14435, 1066, 2946, 23130, 436, 440, 272, 282, 275, 298, 3749, 365, 971, 1845, 16, 511, 2, 272, 1420, 275, 283, 3749, 365, 282, 511, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 421, 199, 318, 511, 63, 475, 63, 4371, 837, 272, 327, 1104, 2005, 11534, 915, 16899, 1066, 2946, 23130, 6698, 272, 282, 275, 1557, 1845, 16, 60, 1845, 17, 60, 1845, 18, 60, 1845, 19, 60, 1845, 20, 60, 1845, 21, 60, 1845, 23, 60, 1845, 24, 60, 1845, 25, 60, 10656, 60, 10145, 7, 272, 1420, 275, 283, 6000, 2158, 301, 18777, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 4371, 8, 65, 395, 1420, 9, 339, 282, 275, 1557, 9542, 60, 7887, 60, 11127, 60, 9532, 60, 1949, 17, 60, 1949, 18, 60, 1949, 19, 60, 1949, 20, 60, 1949, 21, 60, 1949, 22, 60, 1949, 25, 60, 10500, 60, 10272, 60, 10347, 60, 11208, 7, 272, 1420, 275, 283, 5908, 73, 262, 14685, 810, 17031, 29514, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 4371, 8, 65, 395, 1420, 9, 339, 327, 1104, 2005, 282, 24176, 272, 282, 275, 1557, 85, 1690, 821, 7, 221, 327, 394, 1895, 70 ]
[ 636, 2443, 363, 492, 2649, 63, 5955, 199, 646, 3598, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 2969, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 18028, 83, 63, 2975, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 6202, 63, 18028, 83, 63, 4371, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 16101, 316, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 14826, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 19761, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 26165, 199, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 5070, 2226, 13898, 63, 11632, 63, 19984, 199, 199, 504, 6357, 14, 7925, 63, 6136, 492, 3560, 63, 396, 63, 1294, 199, 504, 6357, 14, 7925, 63, 6136, 492, 8059, 63, 637, 63, 3397, 199, 504, 6357, 14, 3825, 63, 1733, 492, 32570, 199, 504, 6357, 14, 7379, 492, 19090, 199, 504, 6357, 14, 16820, 492, 12489, 17675, 199, 199, 504, 6357, 14, 1095, 492, 7289, 199, 199, 646, 2680, 465, 980, 199, 504, 11354, 492, 18795, 199, 504, 11354, 14, 2537, 492, 702, 63, 1452, 199, 504, 11354, 14, 2537, 492, 702, 63, 3910, 199, 504, 11354, 14, 2537, 492, 702, 63, 1397, 63, 1452, 199, 504, 11354, 14, 2537, 492, 702, 63, 2052, 199, 504, 11354, 14, 2537, 492, 702, 63, 4398, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 4398, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 1452, 199, 504, 2680, 14, 4776, 492, 702, 63, 3536, 199, 504, 6357, 14, 1208, 14, 2355, 492, 7141, 199, 504, 6357, 14, 1208, 14, 4776, 492, 334, 479, 63, 262, 12, 702, 63, 2003, 12, 702, 63, 13154, 12, 3521, 702, 63, 19811, 63, 1188, 12, 702, 63, 3730, 63, 1188, 12, 3521, 3633, 63, 3764, 63, 5189, 9, 199, 199, 504, 5055, 492, 10018, 12, 12340, 199, 504, 9143, 492, 7417, 199, 646, 5927, 199, 504, 5890, 492, 5228, 421, 199, 42, 8019, 63, 13046, 36, 63, 30072, 275, 334, 272, 298, 1589, 299, 30937, 299, 30937, 506, 281, 4248, 401, 272, 298, 1589, 299, 30937, 330, 300, 836, 506, 281, 4248, 401, 272, 298, 1589, 314, 299, 30937, 506, 281, 506, 281, 4248, 401, 272, 298, 1589, 330, 300, 836, 506, 281, 506, 281, 4248, 401, 272, 298, 1589, 512, 415, 330, 300, 836, 512, 415, 4248, 401, 272, 298, 1589, 512, 415, 330, 300, 836, 330, 300, 836, 401, 199, 9, 199, 199, 4609, 42, 8019, 63, 13046, 36, 63, 30072, 275, 334, 272, 298, 1589, 18641, 350, 286, 8081, 322, 4248, 401, 272, 298, 1589, 18641, 350, 18641, 350, 15442, 2983, 22834, 4248, 401, 272, 298, 1589, 314, 286, 8081, 322, 286, 8081, 322, 4248, 401, 272, 298, 1589, 370, 569, 79, 370, 569, 79, 18641, 350, 22834, 401, 272, 298, 1589, 370, 569, 79, 18641, 350, 22834, 4248, 401, 199, 9, 199, 199, 1761, 63, 13046, 36, 63, 30072, 275, 1603, 8019, 63, 13046, 36, 63, 30072, 435, 2845, 42, 8019, 63, 13046, 36, 63, 30072, 421, 199, 318, 22681, 8, 83, 304, 272, 372, 6202, 63, 18028, 83, 63, 2975, 8, 83, 680, 4142, 342, 421, 199, 318, 6202, 63, 69, 14696, 8, 83, 304, 272, 372, 308, 14, 1814, 2258, 1845, 25, 297, 283, 69, 358, 421, 199, 318, 3715, 63, 15246, 8, 83, 304, 272, 372, 308, 14, 1294, 342, 421, 199, 318, 9617, 63, 21184, 8, 83, 304, 272, 372, 788, 1589, 63, 1141, 17684, 63, 4445, 418, 421, 199, 318, 511, 63, 1913, 63, 18028, 83, 837, 272, 327, 1104, 2005, 11534, 915, 16899, 1066, 2946, 23130, 6698, 272, 282, 275, 1557, 1845, 16, 60, 1845, 17, 60, 1845, 18, 60, 1845, 19, 60, 1845, 20, 60, 1845, 21, 60, 1845, 23, 60, 1845, 24, 60, 1845, 25, 60, 10656, 60, 10145, 7, 272, 1420, 275, 283, 6000, 2158, 301, 18777, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 282, 275, 1557, 9542, 60, 7887, 60, 11127, 60, 9532, 60, 1949, 17, 60, 1949, 18, 60, 1949, 19, 60, 1949, 20, 60, 1949, 21, 60, 1949, 22, 60, 1949, 25, 60, 10500, 60, 10272, 60, 10347, 60, 11208, 7, 272, 1420, 275, 283, 5908, 73, 262, 14685, 810, 17031, 29514, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 327, 1104, 2005, 282, 24176, 272, 282, 275, 1557, 85, 1690, 821, 7, 221, 327, 394, 1895, 70, 543, 282, 24868, 8076, 5084, 272, 1420, 275, 1557, 85, 1690, 1465, 7, 221, 327, 3486, 394, 1895, 70, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 339, 327, 13667, 14435, 1066, 2946, 23130, 436, 440, 272, 282, 275, 298, 3749, 365, 971, 1845, 16, 511, 2, 272, 1420, 275, 283, 3749, 365, 282, 511, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 2975, 8, 65, 395, 1420, 9, 421, 199, 318, 511, 63, 475, 63, 4371, 837, 272, 327, 1104, 2005, 11534, 915, 16899, 1066, 2946, 23130, 6698, 272, 282, 275, 1557, 1845, 16, 60, 1845, 17, 60, 1845, 18, 60, 1845, 19, 60, 1845, 20, 60, 1845, 21, 60, 1845, 23, 60, 1845, 24, 60, 1845, 25, 60, 10656, 60, 10145, 7, 272, 1420, 275, 283, 6000, 2158, 301, 18777, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 4371, 8, 65, 395, 1420, 9, 339, 282, 275, 1557, 9542, 60, 7887, 60, 11127, 60, 9532, 60, 1949, 17, 60, 1949, 18, 60, 1949, 19, 60, 1949, 20, 60, 1949, 21, 60, 1949, 22, 60, 1949, 25, 60, 10500, 60, 10272, 60, 10347, 60, 11208, 7, 272, 1420, 275, 283, 5908, 73, 262, 14685, 810, 17031, 29514, 7, 272, 702, 63, 1452, 8, 1913, 63, 18028, 83, 63, 4371, 8, 65, 395, 1420, 9, 339, 327, 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