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
Just-D/chromium-1
tools/resources/find_used_resources.py
24
2073
#!/usr/bin/env python # Copyright 2014 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. import argparse import re import sys USAGE = """find_used_resources.py [-h] [-i INPUT] [-o OUTPUT] Outputs the sorted list of resource ids that are part of unknown pragma warning in the given build log. This script is used to find the resources that are actually compiled in Chrome in order to only include the needed strings/images in Chrome PAK files. The script parses out the list of used resource ids. These resource ids show up in the build output after building Chrome with gyp variable enable_resource_whitelist_generation set to 1. This gyp flag causes the compiler to print out a UnknownPragma message every time a resource id is used. E.g.: foo.cc:22:0: warning: ignoring #pragma whitelisted_resource_12345 [-Wunknown-pragmas] On Windows, the message is simply a message via __pragma(message(...)). """ def GetResourceIdsInPragmaWarnings(input): """Returns sorted set of resource ids that are inside unknown pragma warnings for the given input. """ used_resources = set() unknown_pragma_warning_pattern = re.compile( 'whitelisted_resource_(?P<resource_id>[0-9]+)') for ln in input: match = unknown_pragma_warning_pattern.search(ln) if match: resource_id = int(match.group('resource_id')) used_resources.add(resource_id) return sorted(used_resources) def Main(): parser = argparse.ArgumentParser(usage=USAGE) parser.add_argument( '-i', '--input', type=argparse.FileType('r'), default=sys.stdin, help='The build log to read (default stdin)') parser.add_argument( '-o', '--output', type=argparse.FileType('w'), default=sys.stdout, help='The resource list path to write (default stdout)') args = parser.parse_args() used_resources = GetResourceIdsInPragmaWarnings(args.input) for resource_id in used_resources: args.output.write('%d\n' % resource_id) if __name__ == '__main__': Main()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 6927, 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, 646, 7534, 199, 646, 295, 199, 646, 984, 199, 199, 20274, 275, 408, 1623, 63, 2972, 63, 4435, 14, 647, 5243, 72, 61, 5243, 73, 21955, 61, 5243, 79, 18746, 61, 199, 199, 18669, 314, 3355, 769, 402, 2073, 2762, 626, 787, 1777, 402, 5809, 11942, 5721, 199, 262, 314, 1627, 1900, 943, 14, 199, 199, 2765, 2884, 365, 1202, 370, 2342, 314, 5944, 626, 787, 5965, 10311, 315, 16776, 199, 262, 1865, 370, 1454, 2387, 314, 4346, 3326, 15, 4782, 315, 16776, 510, 7872, 1584, 14, 710, 199, 1579, 19953, 734, 314, 769, 402, 1202, 2073, 2762, 14, 5723, 2073, 2762, 2498, 1536, 315, 199, 1589, 1900, 1072, 2410, 10015, 16776, 543, 4902, 1750, 199, 4296, 63, 1927, 63, 14189, 63, 15043, 663, 370, 413, 14, 961, 4902, 3305, 14486, 314, 6365, 199, 475, 870, 734, 282, 14831, 48, 9717, 1245, 4036, 900, 282, 2073, 1305, 365, 1202, 14, 662, 14, 71, 16781, 199, 1421, 14, 2055, 26, 1081, 26, 16, 26, 5721, 26, 17289, 327, 25852, 10424, 15023, 63, 1927, 63, 13261, 199, 1988, 55, 5187, 13, 80, 2527, 5892, 61, 199, 199, 3314, 5417, 12, 314, 1245, 365, 9329, 282, 1245, 4799, 636, 25852, 8, 1188, 29195, 4992, 199, 199, 624, 421, 199, 318, 2372, 4031, 11506, 607, 48, 9717, 15921, 8, 1210, 304, 523, 408, 3407, 3355, 663, 402, 2073, 2762, 626, 787, 6272, 5809, 11942, 3598, 1362, 367, 314, 1627, 1324, 14, 523, 408, 523, 1202, 63, 4435, 275, 663, 342, 523, 5809, 63, 25852, 63, 3764, 63, 3401, 275, 295, 14, 2014, 8, 489, 283, 7510, 15023, 63, 1927, 63, 2229, 48, 28, 1927, 63, 344, 9514, 16, 13, 25, 2807, 5942, 523, 367, 10359, 315, 1324, 26, 272, 1336, 275, 5809, 63, 25852, 63, 3764, 63, 3401, 14, 1733, 8, 6066, 9, 272, 340, 1336, 26, 489, 2073, 63, 344, 275, 1109, 8, 1431, 14, 923, 360, 1927, 63, 344, 1333, 489, 1202, 63, 4435, 14, 525, 8, 1927, 63, 344, 9, 523, 372, 3355, 8, 2972, 63, 4435, 9, 199, 199, 318, 11298, 837, 523, 1798, 275, 7534, 14, 10730, 8, 3807, 29, 20274, 9, 523, 1798, 14, 525, 63, 2094, 8, 489, 2475, 73, 297, 2850, 1210, 297, 730, 29, 18978, 14, 20683, 360, 82, 659, 849, 29, 1274, 14, 6626, 12, 489, 1720, 534, 1918, 1900, 943, 370, 1586, 334, 885, 9009, 5942, 523, 1798, 14, 525, 63, 2094, 8, 489, 2475, 79, 297, 2850, 1199, 297, 730, 29, 18978, 14, 20683, 360, 87, 659, 849, 29, 1274, 14, 2703, 12, 489, 1720, 534, 1918, 2073, 769, 931, 370, 2218, 334, 885, 3839, 5942, 523, 1249, 275, 1798, 14, 1122, 63, 589, 342, 8330, 1202, 63, 4435, 275, 2372, 4031, 11506, 607, 48, 9717, 15921, 8, 589, 14, 1210, 9, 523, 367, 2073, 63, 344, 315, 1202, 63, 4435, 26, 272, 1249, 14, 1199, 14, 952, 3508, 68, 60, 78, 7, 450, 2073, 63, 344, 9, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 11298, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 6927, 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, 646, 7534, 199, 646, 295, 199, 646, 984, 199, 199, 20274, 275, 408, 1623, 63, 2972, 63, 4435, 14, 647, 5243, 72, 61, 5243, 73, 21955, 61, 5243, 79, 18746, 61, 199, 199, 18669, 314, 3355, 769, 402, 2073, 2762, 626, 787, 1777, 402, 5809, 11942, 5721, 199, 262, 314, 1627, 1900, 943, 14, 199, 199, 2765, 2884, 365, 1202, 370, 2342, 314, 5944, 626, 787, 5965, 10311, 315, 16776, 199, 262, 1865, 370, 1454, 2387, 314, 4346, 3326, 15, 4782, 315, 16776, 510, 7872, 1584, 14, 710, 199, 1579, 19953, 734, 314, 769, 402, 1202, 2073, 2762, 14, 5723, 2073, 2762, 2498, 1536, 315, 199, 1589, 1900, 1072, 2410, 10015, 16776, 543, 4902, 1750, 199, 4296, 63, 1927, 63, 14189, 63, 15043, 663, 370, 413, 14, 961, 4902, 3305, 14486, 314, 6365, 199, 475, 870, 734, 282, 14831, 48, 9717, 1245, 4036, 900, 282, 2073, 1305, 365, 1202, 14, 662, 14, 71, 16781, 199, 1421, 14, 2055, 26, 1081, 26, 16, 26, 5721, 26, 17289, 327, 25852, 10424, 15023, 63, 1927, 63, 13261, 199, 1988, 55, 5187, 13, 80, 2527, 5892, 61, 199, 199, 3314, 5417, 12, 314, 1245, 365, 9329, 282, 1245, 4799, 636, 25852, 8, 1188, 29195, 4992, 199, 199, 624, 421, 199, 318, 2372, 4031, 11506, 607, 48, 9717, 15921, 8, 1210, 304, 523, 408, 3407, 3355, 663, 402, 2073, 2762, 626, 787, 6272, 5809, 11942, 3598, 1362, 367, 314, 1627, 1324, 14, 523, 408, 523, 1202, 63, 4435, 275, 663, 342, 523, 5809, 63, 25852, 63, 3764, 63, 3401, 275, 295, 14, 2014, 8, 489, 283, 7510, 15023, 63, 1927, 63, 2229, 48, 28, 1927, 63, 344, 9514, 16, 13, 25, 2807, 5942, 523, 367, 10359, 315, 1324, 26, 272, 1336, 275, 5809, 63, 25852, 63, 3764, 63, 3401, 14, 1733, 8, 6066, 9, 272, 340, 1336, 26, 489, 2073, 63, 344, 275, 1109, 8, 1431, 14, 923, 360, 1927, 63, 344, 1333, 489, 1202, 63, 4435, 14, 525, 8, 1927, 63, 344, 9, 523, 372, 3355, 8, 2972, 63, 4435, 9, 199, 199, 318, 11298, 837, 523, 1798, 275, 7534, 14, 10730, 8, 3807, 29, 20274, 9, 523, 1798, 14, 525, 63, 2094, 8, 489, 2475, 73, 297, 2850, 1210, 297, 730, 29, 18978, 14, 20683, 360, 82, 659, 849, 29, 1274, 14, 6626, 12, 489, 1720, 534, 1918, 1900, 943, 370, 1586, 334, 885, 9009, 5942, 523, 1798, 14, 525, 63, 2094, 8, 489, 2475, 79, 297, 2850, 1199, 297, 730, 29, 18978, 14, 20683, 360, 87, 659, 849, 29, 1274, 14, 2703, 12, 489, 1720, 534, 1918, 2073, 769, 931, 370, 2218, 334, 885, 3839, 5942, 523, 1249, 275, 1798, 14, 1122, 63, 589, 342, 8330, 1202, 63, 4435, 275, 2372, 4031, 11506, 607, 48, 9717, 15921, 8, 589, 14, 1210, 9, 523, 367, 2073, 63, 344, 315, 1202, 63, 4435, 26, 272, 1249, 14, 1199, 14, 952, 3508, 68, 60, 78, 7, 450, 2073, 63, 344, 9, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 11298, 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, 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,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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 ]
Eureka22/ASM_xf
PythonD/lib/python2.4/DocXMLRPCServer.py
12
11031
"""Self documenting XML-RPC Server. This module can be used to create XML-RPC servers that serve pydoc-style documentation in response to HTTP GET requests. This documentation is dynamically generated based on the functions and methods registered with the server. This module is built upon the pydoc and SimpleXMLRPCServer modules. """ import pydoc import inspect import types import re import sys from SimpleXMLRPCServer import (SimpleXMLRPCServer, SimpleXMLRPCRequestHandler, CGIXMLRPCRequestHandler, resolve_dotted_attribute) class ServerHTMLDoc(pydoc.HTMLDoc): """Class used to generate pydoc HTML document for a server""" def markup(self, text, escape=None, funcs={}, classes={}, methods={}): """Mark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.""" escape = escape or self.escape results = [] here = 0 # XXX Note that this regular expressions does not allow for the # hyperlinking of arbitrary strings being used as method # names. Only methods with names consisting of word characters # and '.'s are hyperlinked. pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|' r'RFC[- ]?(\d+)|' r'PEP[- ]?(\d+)|' r'(self\.)?((?:\w|\.)+))\b') while 1: match = pattern.search(text, here) if not match: break start, end = match.span() results.append(escape(text[here:start])) all, scheme, rfc, pep, selfdot, name = match.groups() if scheme: url = escape(all).replace('"', '&quot;') results.append('<a href="%s">%s</a>' % (url, url)) elif rfc: url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc) results.append('<a href="%s">%s</a>' % (url, escape(all))) elif pep: url = 'http://www.python.org/peps/pep-%04d.html' % int(pep) results.append('<a href="%s">%s</a>' % (url, escape(all))) elif text[end:end+1] == '(': results.append(self.namelink(name, methods, funcs, classes)) elif selfdot: results.append('self.<strong>%s</strong>' % name) else: results.append(self.namelink(name, classes)) here = end results.append(escape(text[here:])) return ''.join(results) def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" anchor = (cl and cl.__name__ or '') + '-' + name note = '' title = '<a name="%s"><strong>%s</strong></a>' % (anchor, name) if inspect.ismethod(object): args, varargs, varkw, defaults = inspect.getargspec(object.im_func) # exclude the argument bound to the instance, it will be # confusing to the non-Python user argspec = inspect.formatargspec ( args[1:], varargs, varkw, defaults, formatvalue=self.formatvalue ) elif inspect.isfunction(object): args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) else: argspec = '(...)' if isinstance(object, types.TupleType): argspec = object[0] or argspec docstring = object[1] or "" else: docstring = pydoc.getdoc(object) decl = title + argspec + (note and self.grey( '<font face="helvetica, arial">%s</font>' % note)) doc = self.markup( docstring, self.preformat, funcs, classes, methods) doc = doc and '<dd><tt>%s</tt></dd>' % doc return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc) def docserver(self, server_name, package_documentation, methods): """Produce HTML documentation for an XML-RPC server.""" fdict = {} for key, value in methods.items(): fdict[key] = '#-' + key fdict[value] = fdict[key] head = '<big><big><strong>%s</strong></big></big>' % server_name result = self.heading(head, '#ffffff', '#7799ee') doc = self.markup(package_documentation, self.preformat, fdict) doc = doc and '<tt>%s</tt>' % doc result = result + '<p>%s</p>\n' % doc contents = [] method_items = methods.items() method_items.sort() for key, value in method_items: contents.append(self.docroutine(value, key, funcs=fdict)) result = result + self.bigsection( 'Methods', '#ffffff', '#eeaa77', pydoc.join(contents)) return result class XMLRPCDocGenerator: """Generates documentation for an XML-RPC server. This class is designed as mix-in and should not be constructed directly. """ def __init__(self): # setup variables used for HTML documentation self.server_name = 'XML-RPC Server Documentation' self.server_documentation = \ "This server exports the following methods through the XML-RPC "\ "protocol." self.server_title = 'XML-RPC Server Documentation' def set_server_title(self, server_title): """Set the HTML title of the generated server documentation""" self.server_title = server_title def set_server_name(self, server_name): """Set the name of the generated HTML server documentation""" self.server_name = server_name def set_server_documentation(self, server_documentation): """Set the documentation string for the entire server.""" self.server_documentation = server_documentation def generate_html_documentation(self): """generate_html_documentation() => html documentation for the server Generates HTML documentation for the server using introspection for installed functions and instances that do not implement the _dispatch method. Alternatively, instances can choose to implement the _get_method_argstring(method_name) method to provide the argument string used in the documentation and the _methodHelp(method_name) method to provide the help text used in the documentation.""" methods = {} for method_name in self.system_listMethods(): if self.funcs.has_key(method_name): method = self.funcs[method_name] elif self.instance is not None: method_info = [None, None] # argspec, documentation if hasattr(self.instance, '_get_method_argstring'): method_info[0] = self.instance._get_method_argstring(method_name) if hasattr(self.instance, '_methodHelp'): method_info[1] = self.instance._methodHelp(method_name) method_info = tuple(method_info) if method_info != (None, None): method = method_info elif not hasattr(self.instance, '_dispatch'): try: method = resolve_dotted_attribute( self.instance, method_name ) except AttributeError: method = method_info else: method = method_info else: assert 0, "Could not find method in self.functions and no "\ "instance installed" methods[method_name] = method documenter = ServerHTMLDoc() documentation = documenter.docserver( self.server_name, self.server_documentation, methods ) return documenter.page(self.server_title, documentation) class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): """XML-RPC and documentation request handler class. Handles all HTTP POST requests and attempts to decode them as XML-RPC requests. Handles all HTTP GET requests and interprets them as requests for documentation. """ def do_GET(self): """Handles the HTTP GET request. Interpret all HTTP GET requests as requests for server documentation. """ response = self.server.generate_html_documentation() self.send_response(200) self.send_header("Content-type", "text/html") self.send_header("Content-length", str(len(response))) self.end_headers() self.wfile.write(response) # shut down the connection self.wfile.flush() self.connection.shutdown(1) class DocXMLRPCServer( SimpleXMLRPCServer, XMLRPCDocGenerator): """XML-RPC and HTML documentation server. Adds the ability to serve server documentation to the capabilities of SimpleXMLRPCServer. """ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler, logRequests=1): SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) XMLRPCDocGenerator.__init__(self) class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, XMLRPCDocGenerator): """Handler for XML-RPC data and documentation requests passed through CGI""" def handle_get(self): """Handles the HTTP GET request. Interpret all HTTP GET requests as requests for server documentation. """ response = self.generate_html_documentation() print 'Content-Type: text/html' print 'Content-Length: %d' % len(response) print sys.stdout.write(response) def __init__(self): CGIXMLRPCRequestHandler.__init__(self) XMLRPCDocGenerator.__init__(self) if __name__ == '__main__': def deg_to_rad(deg): """deg_to_rad(90) => 1.5707963267948966 Converts an angle in degrees to an angle in radians""" import math return deg * math.pi / 180 server = DocXMLRPCServer(("localhost", 8000)) server.set_server_title("Math Server") server.set_server_name("Math XML-RPC Server") server.set_server_documentation("""This server supports various mathematical functions. You can use it from Python as follows: >>> from xmlrpclib import ServerProxy >>> s = ServerProxy("http://localhost:8000") >>> s.deg_to_rad(90.0) 1.5707963267948966""") server.register_function(deg_to_rad) server.register_introspection_functions() server.serve_forever()
gpl-2.0
[ 624, 12887, 29904, 4692, 13, 8171, 7146, 14, 199, 199, 2765, 859, 883, 506, 1202, 370, 1218, 4692, 13, 8171, 8037, 626, 199, 4909, 29164, 13, 2487, 3794, 315, 1177, 370, 3101, 199, 2970, 4145, 14, 961, 3794, 365, 18774, 4046, 199, 6788, 641, 314, 3423, 436, 3102, 7264, 543, 314, 199, 1000, 14, 199, 199, 2765, 859, 365, 6137, 12188, 314, 29164, 436, 5870, 27026, 3120, 199, 3112, 14, 199, 624, 199, 199, 646, 29164, 199, 646, 6485, 199, 646, 2943, 199, 646, 295, 199, 646, 984, 199, 199, 504, 5870, 27026, 3120, 492, 334, 3184, 27026, 3120, 12, 288, 5870, 27026, 11149, 12, 288, 18657, 3867, 1698, 8171, 11149, 12, 288, 7512, 63, 19404, 63, 3215, 9, 199, 199, 533, 7146, 4943, 3768, 8, 25048, 14, 4943, 3768, 304, 272, 408, 2543, 1202, 370, 3550, 29164, 4163, 2213, 367, 282, 1654, 624, 339, 347, 9189, 8, 277, 12, 1318, 12, 4772, 29, 403, 12, 18805, 10324, 3992, 10324, 3102, 16420, 267, 408, 6470, 1536, 2005, 8971, 1318, 12, 1627, 282, 1067, 402, 6698, 370, 3648, 367, 14, 267, 7048, 1067, 2600, 9033, 909, 1561, 370, 12514, 1561, 1041, 267, 4772, 275, 4772, 503, 291, 14, 3765, 267, 2058, 275, 942, 267, 2348, 275, 378, 398, 327, 5787, 3390, 626, 642, 5578, 8455, 1630, 440, 2040, 367, 314, 267, 327, 10342, 1073, 316, 402, 9697, 3326, 3769, 1202, 465, 1083, 267, 327, 1561, 14, 5972, 3102, 543, 1561, 22581, 402, 4349, 4110, 267, 327, 436, 7815, 83, 787, 10342, 12751, 14, 267, 3851, 275, 295, 14, 2014, 8, 82, 1154, 66, 1332, 1014, 92, 8915, 304, 501, 60, 51, 11, 7023, 87, 15, 61, 5227, 1816, 519, 7, 14468, 1988, 1622, 31, 2961, 68, 8771, 5227, 1816, 519, 7, 25633, 1988, 1622, 31, 2961, 68, 8771, 5227, 1816, 519, 6774, 277, 20316, 17304, 3427, 87, 92, 4537, 6393, 25105, 66, 358, 267, 1830, 413, 26, 288, 1336, 275, 3851, 14, 1733, 8, 505, 12, 2348, 9, 288, 340, 440, 1336, 26, 2059, 288, 1343, 12, 1284, 275, 1336, 14, 3751, 342, 288, 2058, 14, 740, 8, 3765, 8, 505, 59, 1681, 26, 928, 2459, 953, 1006, 12, 5687, 12, 18158, 12, 22602, 12, 291, 3287, 12, 536, 275, 1336, 14, 2634, 342, 288, 340, 5687, 26, 355, 1166, 275, 4772, 8, 452, 680, 1814, 20630, 7673, 5184, 10784, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 1166, 430, 288, 916, 18158, 26, 355, 1166, 275, 283, 1014, 921, 1544, 14, 8973, 13, 7515, 14, 1308, 15, 8973, 15, 8973, 5, 68, 14, 2424, 7, 450, 1109, 8, 8973, 9, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 4772, 8, 452, 1724, 288, 916, 22602, 26, 355, 1166, 275, 283, 1014, 921, 1544, 14, 1548, 14, 1308, 15, 321, 1190, 15, 12636, 3295, 966, 68, 14, 1360, 7, 450, 1109, 8, 12636, 9, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 4772, 8, 452, 1724, 288, 916, 1318, 59, 500, 26, 500, 11, 17, 61, 508, 283, 6176, 355, 2058, 14, 740, 8, 277, 14, 354, 1073, 8, 354, 12, 3102, 12, 18805, 12, 3992, 430, 288, 916, 291, 3287, 26, 355, 2058, 14, 740, 360, 277, 21455, 9370, 6598, 83, 1108, 9370, 3524, 450, 536, 9, 288, 587, 26, 355, 2058, 14, 740, 8, 277, 14, 354, 1073, 8, 354, 12, 3992, 430, 288, 2348, 275, 1284, 267, 2058, 14, 740, 8, 3765, 8, 505, 59, 1681, 16720, 267, 372, 6522, 904, 8, 2604, 9, 339, 347, 1382, 17765, 8, 277, 12, 909, 12, 536, 29, 403, 12, 3413, 29, 403, 12, 673, 18805, 10324, 3992, 10324, 3102, 10324, 824, 29, 403, 304, 267, 408, 24391, 4163, 3794, 367, 282, 805, 503, 1083, 909, 1041, 398, 12514, 275, 334, 429, 436, 824, 855, 354, 363, 503, 4074, 435, 10791, 435, 536, 267, 5317, 275, 2125, 398, 2538, 275, 2650, 65, 536, 5961, 83, 8186, 9370, 6598, 83, 1108, 9370, 2957, 65, 3524, 450, 334, 11498, 12, 536, 9, 398, 340, 6485, 14, 374, 765, 8, 785, 304, 288, 1249, 12, 23377, 12, 27835, 12, 4243, 275, 6485, 14, 29836, 8, 785, 14, 1017, 63, 1532, 9, 288, 327, 5760, 314, 1423, 3914, 370, 314, 1256, 12, 652, 911, 506, 288, 327, 3743, 4941, 370, 314, 2222, 13, 4718, 922, 288, 26632, 275, 6485, 14, 908, 15644, 334, 490, 1249, 59, 17, 8429, 490, 23377, 12, 490, 27835, 12, 490, 4243, 12, 490, 1475, 585, 29, 277, 14, 908, 585, 355, 776, 267, 916, 6485, 14, 374, 1593, 8, 785, 304, 288, 1249, 12, 23377, 12, 27835, 12, 4243, 275, 6485, 14, 29836, 8, 785, 9, 288, 26632, 275, 6485, 14, 908, 15644, 8, 355, 1249, 12, 23377, 12, 27835, 12, 4243, 12, 1475, 585, 29, 277, 14, 908, 585, 9, 267, 587, 26, 288, 26632, 275, 8189, 1396, 3171, 398, 340, 1228, 8, 785, 12, 2943, 14, 7075, 804, 304, 288, 26632, 275, 909, 59, 16, 61, 503, 26632, 288, 9214, 275, 909, 59, 17, 61, 503, 3087, 267, 587, 26, 288, 9214, 275, 29164, 14, 362, 1301, 8, 785, 9, 398, 15021, 275, 2538, 435, 26632, 435, 334, 4610, 436, 291, 14, 16708, 8, 2049, 2650, 4246, 8870, 628, 72, 25911, 12, 282, 1383, 14423, 83, 1108, 4246, 3524, 450, 5317, 430, 398, 1382, 275, 291, 14, 10131, 8, 288, 9214, 12, 291, 14, 657, 908, 12, 18805, 12, 3992, 12, 3102, 9, 267, 1382, 275, 1382, 436, 2650, 617, 2535, 6215, 6598, 83, 1108, 6215, 2957, 617, 3524, 450, 1382, 267, 372, 2650, 5030, 2535, 3583, 6598, 83, 1108, 3583, 6598, 83, 1108, 5030, 3072, 78, 7, 450, 334, 9427, 12, 1382, 9, 339, 347, 1382, 1000, 8, 277, 12, 1654, 63, 354, 12, 2559, 63, 9970, 12, 3102, 304, 267, 408, 24391, 4163, 3794, 367, 376, 4692, 13, 8171, 1654, 1041, 398, 289, 807, 275, 1052, 267, 367, 790, 12, 574, 315, 3102, 14, 1744, 837, 288, 289, 807, 59, 498, 61, 275, 3943, 15668, 435, 790, 288, 289, 807 ]
[ 12887, 29904, 4692, 13, 8171, 7146, 14, 199, 199, 2765, 859, 883, 506, 1202, 370, 1218, 4692, 13, 8171, 8037, 626, 199, 4909, 29164, 13, 2487, 3794, 315, 1177, 370, 3101, 199, 2970, 4145, 14, 961, 3794, 365, 18774, 4046, 199, 6788, 641, 314, 3423, 436, 3102, 7264, 543, 314, 199, 1000, 14, 199, 199, 2765, 859, 365, 6137, 12188, 314, 29164, 436, 5870, 27026, 3120, 199, 3112, 14, 199, 624, 199, 199, 646, 29164, 199, 646, 6485, 199, 646, 2943, 199, 646, 295, 199, 646, 984, 199, 199, 504, 5870, 27026, 3120, 492, 334, 3184, 27026, 3120, 12, 288, 5870, 27026, 11149, 12, 288, 18657, 3867, 1698, 8171, 11149, 12, 288, 7512, 63, 19404, 63, 3215, 9, 199, 199, 533, 7146, 4943, 3768, 8, 25048, 14, 4943, 3768, 304, 272, 408, 2543, 1202, 370, 3550, 29164, 4163, 2213, 367, 282, 1654, 624, 339, 347, 9189, 8, 277, 12, 1318, 12, 4772, 29, 403, 12, 18805, 10324, 3992, 10324, 3102, 16420, 267, 408, 6470, 1536, 2005, 8971, 1318, 12, 1627, 282, 1067, 402, 6698, 370, 3648, 367, 14, 267, 7048, 1067, 2600, 9033, 909, 1561, 370, 12514, 1561, 1041, 267, 4772, 275, 4772, 503, 291, 14, 3765, 267, 2058, 275, 942, 267, 2348, 275, 378, 398, 327, 5787, 3390, 626, 642, 5578, 8455, 1630, 440, 2040, 367, 314, 267, 327, 10342, 1073, 316, 402, 9697, 3326, 3769, 1202, 465, 1083, 267, 327, 1561, 14, 5972, 3102, 543, 1561, 22581, 402, 4349, 4110, 267, 327, 436, 7815, 83, 787, 10342, 12751, 14, 267, 3851, 275, 295, 14, 2014, 8, 82, 1154, 66, 1332, 1014, 92, 8915, 304, 501, 60, 51, 11, 7023, 87, 15, 61, 5227, 1816, 519, 7, 14468, 1988, 1622, 31, 2961, 68, 8771, 5227, 1816, 519, 7, 25633, 1988, 1622, 31, 2961, 68, 8771, 5227, 1816, 519, 6774, 277, 20316, 17304, 3427, 87, 92, 4537, 6393, 25105, 66, 358, 267, 1830, 413, 26, 288, 1336, 275, 3851, 14, 1733, 8, 505, 12, 2348, 9, 288, 340, 440, 1336, 26, 2059, 288, 1343, 12, 1284, 275, 1336, 14, 3751, 342, 288, 2058, 14, 740, 8, 3765, 8, 505, 59, 1681, 26, 928, 2459, 953, 1006, 12, 5687, 12, 18158, 12, 22602, 12, 291, 3287, 12, 536, 275, 1336, 14, 2634, 342, 288, 340, 5687, 26, 355, 1166, 275, 4772, 8, 452, 680, 1814, 20630, 7673, 5184, 10784, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 1166, 430, 288, 916, 18158, 26, 355, 1166, 275, 283, 1014, 921, 1544, 14, 8973, 13, 7515, 14, 1308, 15, 8973, 15, 8973, 5, 68, 14, 2424, 7, 450, 1109, 8, 8973, 9, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 4772, 8, 452, 1724, 288, 916, 22602, 26, 355, 1166, 275, 283, 1014, 921, 1544, 14, 1548, 14, 1308, 15, 321, 1190, 15, 12636, 3295, 966, 68, 14, 1360, 7, 450, 1109, 8, 12636, 9, 355, 2058, 14, 740, 4827, 65, 4369, 5961, 83, 14423, 83, 1108, 65, 3524, 450, 334, 633, 12, 4772, 8, 452, 1724, 288, 916, 1318, 59, 500, 26, 500, 11, 17, 61, 508, 283, 6176, 355, 2058, 14, 740, 8, 277, 14, 354, 1073, 8, 354, 12, 3102, 12, 18805, 12, 3992, 430, 288, 916, 291, 3287, 26, 355, 2058, 14, 740, 360, 277, 21455, 9370, 6598, 83, 1108, 9370, 3524, 450, 536, 9, 288, 587, 26, 355, 2058, 14, 740, 8, 277, 14, 354, 1073, 8, 354, 12, 3992, 430, 288, 2348, 275, 1284, 267, 2058, 14, 740, 8, 3765, 8, 505, 59, 1681, 16720, 267, 372, 6522, 904, 8, 2604, 9, 339, 347, 1382, 17765, 8, 277, 12, 909, 12, 536, 29, 403, 12, 3413, 29, 403, 12, 673, 18805, 10324, 3992, 10324, 3102, 10324, 824, 29, 403, 304, 267, 408, 24391, 4163, 3794, 367, 282, 805, 503, 1083, 909, 1041, 398, 12514, 275, 334, 429, 436, 824, 855, 354, 363, 503, 4074, 435, 10791, 435, 536, 267, 5317, 275, 2125, 398, 2538, 275, 2650, 65, 536, 5961, 83, 8186, 9370, 6598, 83, 1108, 9370, 2957, 65, 3524, 450, 334, 11498, 12, 536, 9, 398, 340, 6485, 14, 374, 765, 8, 785, 304, 288, 1249, 12, 23377, 12, 27835, 12, 4243, 275, 6485, 14, 29836, 8, 785, 14, 1017, 63, 1532, 9, 288, 327, 5760, 314, 1423, 3914, 370, 314, 1256, 12, 652, 911, 506, 288, 327, 3743, 4941, 370, 314, 2222, 13, 4718, 922, 288, 26632, 275, 6485, 14, 908, 15644, 334, 490, 1249, 59, 17, 8429, 490, 23377, 12, 490, 27835, 12, 490, 4243, 12, 490, 1475, 585, 29, 277, 14, 908, 585, 355, 776, 267, 916, 6485, 14, 374, 1593, 8, 785, 304, 288, 1249, 12, 23377, 12, 27835, 12, 4243, 275, 6485, 14, 29836, 8, 785, 9, 288, 26632, 275, 6485, 14, 908, 15644, 8, 355, 1249, 12, 23377, 12, 27835, 12, 4243, 12, 1475, 585, 29, 277, 14, 908, 585, 9, 267, 587, 26, 288, 26632, 275, 8189, 1396, 3171, 398, 340, 1228, 8, 785, 12, 2943, 14, 7075, 804, 304, 288, 26632, 275, 909, 59, 16, 61, 503, 26632, 288, 9214, 275, 909, 59, 17, 61, 503, 3087, 267, 587, 26, 288, 9214, 275, 29164, 14, 362, 1301, 8, 785, 9, 398, 15021, 275, 2538, 435, 26632, 435, 334, 4610, 436, 291, 14, 16708, 8, 2049, 2650, 4246, 8870, 628, 72, 25911, 12, 282, 1383, 14423, 83, 1108, 4246, 3524, 450, 5317, 430, 398, 1382, 275, 291, 14, 10131, 8, 288, 9214, 12, 291, 14, 657, 908, 12, 18805, 12, 3992, 12, 3102, 9, 267, 1382, 275, 1382, 436, 2650, 617, 2535, 6215, 6598, 83, 1108, 6215, 2957, 617, 3524, 450, 1382, 267, 372, 2650, 5030, 2535, 3583, 6598, 83, 1108, 3583, 6598, 83, 1108, 5030, 3072, 78, 7, 450, 334, 9427, 12, 1382, 9, 339, 347, 1382, 1000, 8, 277, 12, 1654, 63, 354, 12, 2559, 63, 9970, 12, 3102, 304, 267, 408, 24391, 4163, 3794, 367, 376, 4692, 13, 8171, 1654, 1041, 398, 289, 807, 275, 1052, 267, 367, 790, 12, 574, 315, 3102, 14, 1744, 837, 288, 289, 807, 59, 498, 61, 275, 3943, 15668, 435, 790, 288, 289, 807, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
jvrsantacruz/XlsxWriter
xlsxwriter/test/comparison/test_chart_layout05.py
8
2042
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'chart_layout05.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + 'xlsx_files/' + filename self.ignore_files = [] self.ignore_elements = {} def test_create_file(self): """Test the creation of an XlsxWriter file with user defined layout.""" workbook = Workbook(self.got_filename) worksheet = workbook.add_worksheet() chart = workbook.add_chart({'type': 'area'}) chart.axis_ids = [43495808, 43497728] data = [ [1, 2, 3, 4, 5], [8, 7, 6, 8, 10], [3, 6, 9, 12, 15], ] worksheet.write_column('A1', data[0]) worksheet.write_column('B1', data[1]) worksheet.write_column('C1', data[2]) chart.add_series({ 'categories': '=Sheet1!$A$1:$A$5', 'values': '=Sheet1!$B$1:$B$5', }) chart.add_series({ 'categories': '=Sheet1!$A$1:$A$5', 'values': '=Sheet1!$C$1:$C$5', }) chart.set_x_axis({ 'name': 'XXX', 'name_layout': { 'x': 0.34620319335083105, 'y': 0.85090259550889469, } }) chart.set_y_axis({ 'name': 'YYY', 'name_layout': { 'x': 0.21388888888888888, 'y': 0.26349919801691457, } }) worksheet.insert_chart('E9', chart) workbook.close() self.assertExcelEqual()
bsd-2-clause
[ 11490, 199, 3, 199, 3, 6496, 367, 1323, 478, 88, 6261, 14, 199, 3, 199, 3, 1898, 334, 67, 395, 6171, 13, 7806, 12, 17815, 22895, 46, 455, 17956, 12, 1335, 5466, 17811, 17956, 32, 1850, 290, 14, 1308, 199, 3, 199, 199, 504, 2508, 28330, 63, 863, 285, 438, 63, 396, 492, 27832, 25834, 774, 199, 504, 2263, 30765, 492, 9361, 2706, 421, 199, 533, 1379, 16051, 56, 5296, 56, 5535, 8, 920, 6067, 25834, 774, 304, 272, 408, 272, 1379, 570, 2737, 701, 1323, 478, 88, 6261, 6169, 282, 570, 2737, 701, 27832, 14, 339, 408, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 988, 10746, 275, 488, 398, 1788, 275, 283, 9019, 63, 4209, 1717, 14, 19023, 88, 7, 398, 511, 63, 694, 275, 283, 19023, 88, 5491, 15, 396, 15, 8547, 4805, 267, 291, 14, 7808, 63, 1501, 275, 511, 63, 694, 435, 2513, 396, 8650, 435, 1788, 267, 291, 14, 1474, 63, 1501, 275, 511, 63, 694, 435, 283, 19023, 88, 63, 1725, 4805, 435, 1788, 398, 291, 14, 4247, 63, 1725, 275, 942, 267, 291, 14, 4247, 63, 5527, 275, 1052, 339, 347, 511, 63, 981, 63, 493, 8, 277, 304, 267, 408, 774, 314, 7143, 402, 376, 1323, 478, 88, 6261, 570, 543, 922, 3247, 7054, 1041, 398, 1736, 2706, 275, 9361, 2706, 8, 277, 14, 7808, 63, 1501, 9, 398, 21127, 275, 1736, 2706, 14, 525, 63, 29776, 342, 267, 10943, 275, 1736, 2706, 14, 525, 63, 9019, 3252, 466, 356, 283, 6789, 3071, 398, 10943, 14, 3127, 63, 1580, 275, 359, 26274, 2720, 11292, 12, 841, 11991, 1138, 1651, 61, 398, 666, 275, 359, 288, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 467, 288, 359, 24, 12, 1520, 12, 1227, 12, 1695, 12, 1616, 467, 288, 359, 19, 12, 1227, 12, 1749, 12, 3144, 12, 4114, 467, 267, 1622, 398, 21127, 14, 952, 63, 2301, 360, 33, 17, 297, 666, 59, 16, 566, 267, 21127, 14, 952, 63, 2301, 360, 34, 17, 297, 666, 59, 17, 566, 267, 21127, 14, 952, 63, 2301, 360, 35, 17, 297, 666, 59, 18, 566, 398, 10943, 14, 525, 63, 5602, 2561, 288, 283, 8906, 356, 26143, 16715, 17, 1, 4, 33, 4, 17, 26, 4, 33, 4, 21, 297, 288, 283, 1459, 356, 26143, 16715, 17, 1, 4, 34, 4, 17, 26, 4, 34, 4, 21, 297, 267, 3828, 398, 10943, 14, 525, 63, 5602, 2561, 288, 283, 8906, 356, 26143, 16715, 17, 1, 4, 33, 4, 17, 26, 4, 33, 4, 21, 297, 288, 283, 1459, 356, 26143, 16715, 17, 1, 4, 35, 4, 17, 26, 4, 35, 4, 21, 297, 267, 3828, 398, 10943, 14, 409, 63, 88, 63, 3127, 2561, 288, 283, 354, 356, 283, 13933, 297, 288, 283, 354, 63, 4209, 356, 469, 355, 283, 88, 356, 378, 14, 12583, 11341, 1167, 1153, 1400, 2658, 7320, 12, 355, 283, 89, 356, 378, 14, 21419, 2710, 11990, 16859, 1299, 2635, 1876, 12, 288, 789, 267, 3828, 398, 10943, 14, 409, 63, 89, 63, 3127, 2561, 288, 283, 354, 356, 283, 28443, 297, 288, 283, 354, 63, 4209, 356, 469, 355, 283, 88, 356, 378, 14, 14271, 32412, 14871, 1299, 12, 355, 283, 89, 356, 378, 14, 1479, 1082, 1020, 10905, 614, 1876, 1079, 1641, 12, 288, 789, 267, 3828, 398, 21127, 14, 3176, 63, 9019, 360, 37, 25, 297, 10943, 9, 398, 1736, 2706, 14, 1600, 342, 398, 291, 14, 479, 920, 6067, 591, 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 ]
[ 199, 3, 199, 3, 6496, 367, 1323, 478, 88, 6261, 14, 199, 3, 199, 3, 1898, 334, 67, 395, 6171, 13, 7806, 12, 17815, 22895, 46, 455, 17956, 12, 1335, 5466, 17811, 17956, 32, 1850, 290, 14, 1308, 199, 3, 199, 199, 504, 2508, 28330, 63, 863, 285, 438, 63, 396, 492, 27832, 25834, 774, 199, 504, 2263, 30765, 492, 9361, 2706, 421, 199, 533, 1379, 16051, 56, 5296, 56, 5535, 8, 920, 6067, 25834, 774, 304, 272, 408, 272, 1379, 570, 2737, 701, 1323, 478, 88, 6261, 6169, 282, 570, 2737, 701, 27832, 14, 339, 408, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 988, 10746, 275, 488, 398, 1788, 275, 283, 9019, 63, 4209, 1717, 14, 19023, 88, 7, 398, 511, 63, 694, 275, 283, 19023, 88, 5491, 15, 396, 15, 8547, 4805, 267, 291, 14, 7808, 63, 1501, 275, 511, 63, 694, 435, 2513, 396, 8650, 435, 1788, 267, 291, 14, 1474, 63, 1501, 275, 511, 63, 694, 435, 283, 19023, 88, 63, 1725, 4805, 435, 1788, 398, 291, 14, 4247, 63, 1725, 275, 942, 267, 291, 14, 4247, 63, 5527, 275, 1052, 339, 347, 511, 63, 981, 63, 493, 8, 277, 304, 267, 408, 774, 314, 7143, 402, 376, 1323, 478, 88, 6261, 570, 543, 922, 3247, 7054, 1041, 398, 1736, 2706, 275, 9361, 2706, 8, 277, 14, 7808, 63, 1501, 9, 398, 21127, 275, 1736, 2706, 14, 525, 63, 29776, 342, 267, 10943, 275, 1736, 2706, 14, 525, 63, 9019, 3252, 466, 356, 283, 6789, 3071, 398, 10943, 14, 3127, 63, 1580, 275, 359, 26274, 2720, 11292, 12, 841, 11991, 1138, 1651, 61, 398, 666, 275, 359, 288, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 467, 288, 359, 24, 12, 1520, 12, 1227, 12, 1695, 12, 1616, 467, 288, 359, 19, 12, 1227, 12, 1749, 12, 3144, 12, 4114, 467, 267, 1622, 398, 21127, 14, 952, 63, 2301, 360, 33, 17, 297, 666, 59, 16, 566, 267, 21127, 14, 952, 63, 2301, 360, 34, 17, 297, 666, 59, 17, 566, 267, 21127, 14, 952, 63, 2301, 360, 35, 17, 297, 666, 59, 18, 566, 398, 10943, 14, 525, 63, 5602, 2561, 288, 283, 8906, 356, 26143, 16715, 17, 1, 4, 33, 4, 17, 26, 4, 33, 4, 21, 297, 288, 283, 1459, 356, 26143, 16715, 17, 1, 4, 34, 4, 17, 26, 4, 34, 4, 21, 297, 267, 3828, 398, 10943, 14, 525, 63, 5602, 2561, 288, 283, 8906, 356, 26143, 16715, 17, 1, 4, 33, 4, 17, 26, 4, 33, 4, 21, 297, 288, 283, 1459, 356, 26143, 16715, 17, 1, 4, 35, 4, 17, 26, 4, 35, 4, 21, 297, 267, 3828, 398, 10943, 14, 409, 63, 88, 63, 3127, 2561, 288, 283, 354, 356, 283, 13933, 297, 288, 283, 354, 63, 4209, 356, 469, 355, 283, 88, 356, 378, 14, 12583, 11341, 1167, 1153, 1400, 2658, 7320, 12, 355, 283, 89, 356, 378, 14, 21419, 2710, 11990, 16859, 1299, 2635, 1876, 12, 288, 789, 267, 3828, 398, 10943, 14, 409, 63, 89, 63, 3127, 2561, 288, 283, 354, 356, 283, 28443, 297, 288, 283, 354, 63, 4209, 356, 469, 355, 283, 88, 356, 378, 14, 14271, 32412, 14871, 1299, 12, 355, 283, 89, 356, 378, 14, 1479, 1082, 1020, 10905, 614, 1876, 1079, 1641, 12, 288, 789, 267, 3828, 398, 21127, 14, 3176, 63, 9019, 360, 37, 25, 297, 10943, 9, 398, 1736, 2706, 14, 1600, 342, 398, 291, 14, 479, 920, 6067, 591, 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, 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, 0 ]
KerkhoffTechnologies/shinken
test/test_problem_impact.py
18
17614
#!/usr/bin/env python # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # # This file is part of Shinken. # # Shinken is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Shinken 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Shinken. If not, see <http://www.gnu.org/licenses/>. # # This file is used to test host- and service-downtimes. # from shinken_test import * class TestProblemImpact(ShinkenTest): def setUp(self): self.setup_with_file('etc/shinken_problem_impact.cfg') def test_problems_impacts(self): self.print_header() # retry_interval 2 # critical notification # run loop -> another notification # First initialize routers 0 and 1 now = time.time() # The problem_impact_state change should be enabled in the configuration self.assertEqual(True, self.conf.enable_problem_impacts_states_change) host_router_0 = self.sched.hosts.find_by_name("test_router_0") host_router_0.checks_in_progress = [] self.assertEqual(2, host_router_0.business_impact) host_router_1 = self.sched.hosts.find_by_name("test_router_1") host_router_1.checks_in_progress = [] self.assertEqual(2, host_router_1.business_impact) # Then initialize host under theses routers host_0 = self.sched.hosts.find_by_name("test_host_0") host_0.checks_in_progress = [] host_1 = self.sched.hosts.find_by_name("test_host_1") host_1.checks_in_progress = [] all_hosts = [host_router_0, host_router_1, host_0, host_1] all_routers = [host_router_0, host_router_1] all_servers = [host_0, host_1] #-------------------------------------------------------------- # initialize host states as UP #-------------------------------------------------------------- print "- 4 x UP -------------------------------------" self.scheduler_loop(1, [[host_router_0, 0, 'UP'], [host_router_1, 0, 'UP'], [host_0, 0, 'UP'], [host_1, 0, 'UP']], do_sleep=False) for h in all_hosts: self.assertEqual('UP', h.state) self.assertEqual('HARD', h.state_type) #-------------------------------------------------------------- # Now we add some problems to routers #-------------------------------------------------------------- print "- routers get DOWN /SOFT-------------------------------------" self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) # Max attempt is at 5, should be soft now for h in all_routers: self.assertEqual('DOWN', h.state) self.assertEqual('SOFT', h.state_type) print "- routers get DOWN /HARD-------------------------------------" # Now put 4 more checks so we get DOWN/HARD self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) # Max attempt is reach, should be HARD now for h in all_routers: self.assertEqual('DOWN', h.state) self.assertEqual('HARD', h.state_type) #-------------------------------------------------------------- # Routers get HARD/DOWN # should be problems now! #-------------------------------------------------------------- # Now check in the brok generation too host_router_0_brok = host_router_0.get_update_status_brok() host_router_0_brok.prepare() host_router_1_brok = host_router_1.get_update_status_brok() host_router_1_brok.prepare() # Should be problems and have sub servers as impacts for h in all_routers: self.assertEqual(True, h.is_problem) # Now routers are problems, they should have take the max # business_impact value ofthe impacts, so here 5 self.assertEqual(5, h.business_impact) for s in all_servers: self.assertIn(s, h.impacts) self.assertIn(s.get_dbg_name(), host_router_0_brok.data['impacts']['hosts']) self.assertIn(s.get_dbg_name(), host_router_1_brok.data['impacts']['hosts']) # Should have host notification, but it's not so simple: # our contact say: not under 5, and our hosts are 2. But # the impacts have huge business_impact, so the hosts gain such business_impact self.assert_any_log_match('HOST NOTIFICATION.*;') self.show_and_clear_logs() # Now impacts should really be .. impacts :) for s in all_servers: self.assertEqual(True, s.is_impact) self.assertEqual('UNREACHABLE', s.state) # And check the services are impacted too for svc in s.services: print "Service state", svc.state self.assertEqual('UNKNOWN', svc.state) self.assertIn(svc.get_dbg_name(), host_router_0_brok.data['impacts']['services']) self.assertIn(svc.get_dbg_name(), host_router_1_brok.data['impacts']['services']) brk_svc = svc.get_update_status_brok() brk_svc.prepare() self.assertEqual(['test_router_0', 'test_router_1'], brk_svc.data['source_problems']['hosts']) for h in all_routers: self.assertIn(h, s.source_problems) brk_hst = s.get_update_status_brok() brk_hst.prepare() self.assertIn(h.get_dbg_name(), brk_hst.data['source_problems']['hosts']) #-------------------------------------------------------------- # One router get UP now #-------------------------------------------------------------- print "- 1 X UP for a router ------------------------------" # Ok here the problem/impact propagation is Checked. Now what # if one router get back? :) self.scheduler_loop(1, [[host_router_0, 0, 'UP']], do_sleep=False) # should be UP/HARD now self.assertEqual('UP', host_router_0.state) self.assertEqual('HARD', host_router_0.state_type) # And should not be a problem any more! self.assertEqual(False, host_router_0.is_problem) self.assertEqual([], host_router_0.impacts) # And check if it's no more in sources problems of others servers for s in all_servers: # Still impacted by the other server self.assertEqual(True, s.is_impact) self.assertEqual([host_router_1], s.source_problems) #-------------------------------------------------------------- # The other router get UP :) #-------------------------------------------------------------- print "- 1 X UP for the last router ------------------------------" # What is the last router get back? :) self.scheduler_loop(1, [[host_router_1, 0, 'UP']], do_sleep=False) # should be UP/HARD now self.assertEqual('UP', host_router_1.state) self.assertEqual('HARD', host_router_1.state_type) # And should not be a problem any more! self.assertEqual(False, host_router_1.is_problem) self.assertEqual([], host_router_1.impacts) # And check if it's no more in sources problems of others servers for s in all_servers: # Still impacted by the other server self.assertEqual(False, s.is_impact) self.assertEqual('UP', s.state) self.assertEqual([], s.source_problems) # And our "business_impact" should have failed back to our # conf value, so 2 self.assertEqual(2, host_router_0.business_impact) self.assertEqual(2, host_router_1.business_impact) # It's done :) def test_problems_impacts_with_crit_mod(self): self.print_header() # retry_interval 2 # critical notification # run loop -> another notification # First initialize routers 0 and 1 now = time.time() # The problem_impact_state change should be enabled in the configuration self.assertEqual(True, self.conf.enable_problem_impacts_states_change) host_router_0 = self.sched.hosts.find_by_name("test_router_0") host_router_0.checks_in_progress = [] self.assertEqual(2, host_router_0.business_impact) host_router_1 = self.sched.hosts.find_by_name("test_router_1") host_router_1.checks_in_progress = [] self.assertEqual(2, host_router_1.business_impact) # Then initialize host under theses routers host_0 = self.sched.hosts.find_by_name("test_host_0") host_0.checks_in_progress = [] host_1 = self.sched.hosts.find_by_name("test_host_1") host_1.checks_in_progress = [] all_hosts = [host_router_0, host_router_1, host_0, host_1] all_routers = [host_router_0, host_router_1] all_servers = [host_0, host_1] # Our crit mod that will allow us to play with on the fly # business_impact modulation critmod = self.sched.conf.businessimpactmodulations.find_by_name('Raise') self.assertIsNot(critmod, None) # We lie here, from now we do not want criticities for h in all_hosts: for s in h.services: s.business_impact = 2 #-------------------------------------------------------------- # initialize host states as UP #-------------------------------------------------------------- print "- 4 x UP -------------------------------------" self.scheduler_loop(1, [[host_router_0, 0, 'UP'], [host_router_1, 0, 'UP'], [host_0, 0, 'UP'], [host_1, 0, 'UP']], do_sleep=False) for h in all_hosts: self.assertEqual('UP', h.state) self.assertEqual('HARD', h.state_type) #-------------------------------------------------------------- # Now we add some problems to routers #-------------------------------------------------------------- print "- routers get DOWN /SOFT-------------------------------------" self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) # Max attempt is at 5, should be soft now for h in all_routers: self.assertEqual('DOWN', h.state) self.assertEqual('SOFT', h.state_type) print "- routers get DOWN /HARD-------------------------------------" # Now put 4 more checks so we get DOWN/HARD self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) self.scheduler_loop(1, [[host_router_0, 2, 'DOWN'], [host_router_1, 2, 'DOWN']], do_sleep=False) # Max attempt is reach, should be HARD now for h in all_routers: self.assertEqual('DOWN', h.state) self.assertEqual('HARD', h.state_type) #-------------------------------------------------------------- # Routers get HARD/DOWN # should be problems now! #-------------------------------------------------------------- # Now check in the brok generation too host_router_0_brok = host_router_0.get_update_status_brok() host_router_0_brok.prepare() host_router_1_brok = host_router_1.get_update_status_brok() host_router_1_brok.prepare() # Should be problems and have sub servers as impacts for h in all_routers: self.assertEqual(True, h.is_problem) # Now routers are problems, they should have take the max # business_impact value ofthe impacts, so here 2 because we lower all critcity for our test self.assertEqual(2, h.business_impact) for s in all_servers: self.assertIn(s, h.impacts) self.assertIn(s.get_dbg_name(), host_router_0_brok.data['impacts']['hosts']) self.assertIn(s.get_dbg_name(), host_router_1_brok.data['impacts']['hosts']) # Should have host notification, but it's not so simple: # our contact say: not under 5, and our hosts are 2. And here # the business_impact was still low for our test self.assert_no_log_match('HOST NOTIFICATION.*;') self.show_and_clear_logs() # Now impacts should really be .. impacts :) for s in all_servers: self.assertEqual(True, s.is_impact) self.assertEqual('UNREACHABLE', s.state) # And check the services are impacted too for svc in s.services: print "Service state", svc.state self.assertEqual('UNKNOWN', svc.state) self.assertIn(svc.get_dbg_name(), host_router_0_brok.data['impacts']['services']) self.assertIn(svc.get_dbg_name(), host_router_1_brok.data['impacts']['services']) brk_svc = svc.get_update_status_brok() brk_svc.prepare() self.assertEqual(['test_router_0', 'test_router_1'], brk_svc.data['source_problems']['hosts']) for h in all_routers: self.assertIn(h, s.source_problems) brk_hst = s.get_update_status_brok() brk_hst.prepare() self.assertIn(h.get_dbg_name(), brk_hst.data['source_problems']['hosts']) for h in all_hosts: for s in h.services: s.update_business_impact_value() self.assertEqual(2, s.business_impact) # Now we play with modulation! # We put modulation period as None so it will be right all time :) critmod.modulation_period = None crit_srv = self.sched.services.find_srv_by_name_and_hostname("test_host_1", "test_ok_1") self.assertIn(critmod, crit_srv.business_impact_modulations) # Now we set the modulation period as always good, we check that the service # really update it's business_impact value self.sched.update_business_values() # So the service with the modulation should got it's business_impact raised self.assertEqual(5, crit_srv.business_impact) # And the routers too (problems) self.assertEqual(5, host_router_0.business_impact) self.assertEqual(5, host_router_1.business_impact) #-------------------------------------------------------------- # One router get UP now #-------------------------------------------------------------- print "- 1 X UP for a router ------------------------------" # Ok here the problem/impact propagation is Checked. Now what # if one router get back? :) self.scheduler_loop(1, [[host_router_0, 0, 'UP']], do_sleep=False) # should be UP/HARD now self.assertEqual('UP', host_router_0.state) self.assertEqual('HARD', host_router_0.state_type) # And should not be a problem any more! self.assertEqual(False, host_router_0.is_problem) self.assertEqual([], host_router_0.impacts) # And check if it's no more in sources problems of others servers for s in all_servers: # Still impacted by the other server self.assertEqual(True, s.is_impact) self.assertEqual([host_router_1], s.source_problems) #-------------------------------------------------------------- # The other router get UP :) #-------------------------------------------------------------- print "- 1 X UP for the last router ------------------------------" # What is the last router get back? :) self.scheduler_loop(1, [[host_router_1, 0, 'UP']], do_sleep=False) # should be UP/HARD now self.assertEqual('UP', host_router_1.state) self.assertEqual('HARD', host_router_1.state_type) # And should not be a problem any more! self.assertEqual(False, host_router_1.is_problem) self.assertEqual([], host_router_1.impacts) # And check if it's no more in sources problems of others servers for s in all_servers: # Still impacted by the other server self.assertEqual(False, s.is_impact) self.assertEqual('UP', s.state) self.assertEqual([], s.source_problems) # And our "business_impact" should have failed back to our # conf value, so 2 self.assertEqual(2, host_router_0.business_impact) self.assertEqual(2, host_router_1.business_impact) # It's done :) if __name__ == '__main__': unittest.main()
agpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 35, 9, 8937, 13, 7280, 26, 199, 3, 259, 598, 371, 397, 1603, 69, 290, 12, 302, 439, 285, 9405, 32, 6799, 14, 957, 199, 3, 259, 22261, 8726, 7964, 527, 332, 12, 22261, 8726, 14, 7833, 527, 332, 32, 388, 7873, 14, 271, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 5244, 30864, 14, 199, 3, 199, 3, 5244, 30864, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 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, 5244, 30864, 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, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 3180, 543, 5244, 30864, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 199, 3, 961, 570, 365, 1202, 370, 511, 1591, 13, 436, 2435, 13, 2110, 4508, 14, 199, 3, 199, 199, 504, 1033, 30864, 63, 396, 492, 627, 421, 199, 533, 1379, 16467, 8499, 2442, 8, 2662, 30864, 774, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 2758, 63, 1045, 63, 493, 360, 6839, 15, 609, 30864, 63, 6462, 63, 31822, 14, 4128, 358, 339, 347, 511, 63, 22959, 63, 3236, 22282, 8, 277, 304, 267, 291, 14, 1361, 63, 1291, 342, 267, 327, 7269, 63, 4284, 499, 267, 327, 19698, 6955, 267, 327, 1255, 4438, 1035, 4573, 6955, 398, 327, 7758, 8265, 24464, 378, 436, 413, 267, 3063, 275, 900, 14, 521, 342, 398, 327, 710, 5160, 63, 31822, 63, 929, 1570, 1077, 506, 5223, 315, 314, 2897, 267, 291, 14, 629, 8, 549, 12, 291, 14, 2190, 14, 4296, 63, 6462, 63, 3236, 22282, 63, 4981, 63, 1461, 9, 398, 1591, 63, 4995, 63, 16, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 4995, 63, 16, 531, 267, 1591, 63, 4995, 63, 16, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 291, 14, 629, 8, 18, 12, 1591, 63, 4995, 63, 16, 14, 23639, 63, 31822, 9, 267, 1591, 63, 4995, 63, 17, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 4995, 63, 17, 531, 267, 1591, 63, 4995, 63, 17, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 291, 14, 629, 8, 18, 12, 1591, 63, 4995, 63, 17, 14, 23639, 63, 31822, 9, 398, 327, 9442, 8265, 1591, 1334, 314, 874, 24464, 267, 1591, 63, 16, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 1102, 63, 16, 531, 267, 1591, 63, 16, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 1591, 63, 17, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 1102, 63, 17, 531, 267, 1591, 63, 17, 14, 8625, 63, 262, 63, 5734, 275, 942, 398, 1006, 63, 5146, 275, 359, 1102, 63, 4995, 63, 16, 12, 1591, 63, 4995, 63, 17, 12, 1591, 63, 16, 12, 1591, 63, 17, 61, 267, 1006, 63, 17292, 275, 359, 1102, 63, 4995, 63, 16, 12, 1591, 63, 4995, 63, 17, 61, 267, 1006, 63, 5871, 275, 359, 1102, 63, 16, 12, 1591, 63, 17, 61, 398, 27721, 10965, 267, 327, 8265, 1591, 6363, 465, 7215, 267, 27721, 10965, 267, 870, 3905, 841, 671, 7215, 11016, 9858, 2, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 4995, 63, 17, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 16, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 17, 12, 378, 12, 283, 2160, 2157, 886, 63, 4532, 29, 797, 9, 398, 367, 394, 315, 1006, 63, 5146, 26, 288, 291, 14, 629, 360, 2160, 297, 394, 14, 929, 9, 288, 291, 14, 629, 360, 30322, 297, 394, 14, 929, 63, 466, 9, 398, 27721, 10965, 267, 327, 7356, 781, 1050, 2005, 8826, 370, 24464, 267, 27721, 10965, 267, 870, 3905, 24464, 664, 10163, 1182, 26999, 1444, 9858, 2, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 327, 8228, 7427, 365, 737, 959, 12, 1077, 506, 11620, 3063, 267, 367, 394, 315, 1006, 63, 17292, 26, 288, 291, 14, 629, 360, 8819, 297, 394, 14, 929, 9, 288, 291, 14, 629, 360, 26999, 297, 394, 14, 929, 63, 466, 9, 398, 870, 3905, 24464, 664, 10163, 1182, 30322, 1444, 9858, 2, 267, 327, 7356, 5324, 841, 1655, 5920, 880, 781, 664, 10163, 15, 30322, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 35, 9, 8937, 13, 7280, 26, 199, 3, 259, 598, 371, 397, 1603, 69, 290, 12, 302, 439, 285, 9405, 32, 6799, 14, 957, 199, 3, 259, 22261, 8726, 7964, 527, 332, 12, 22261, 8726, 14, 7833, 527, 332, 32, 388, 7873, 14, 271, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 5244, 30864, 14, 199, 3, 199, 3, 5244, 30864, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 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, 5244, 30864, 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, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 3180, 543, 5244, 30864, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 199, 3, 961, 570, 365, 1202, 370, 511, 1591, 13, 436, 2435, 13, 2110, 4508, 14, 199, 3, 199, 199, 504, 1033, 30864, 63, 396, 492, 627, 421, 199, 533, 1379, 16467, 8499, 2442, 8, 2662, 30864, 774, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 2758, 63, 1045, 63, 493, 360, 6839, 15, 609, 30864, 63, 6462, 63, 31822, 14, 4128, 358, 339, 347, 511, 63, 22959, 63, 3236, 22282, 8, 277, 304, 267, 291, 14, 1361, 63, 1291, 342, 267, 327, 7269, 63, 4284, 499, 267, 327, 19698, 6955, 267, 327, 1255, 4438, 1035, 4573, 6955, 398, 327, 7758, 8265, 24464, 378, 436, 413, 267, 3063, 275, 900, 14, 521, 342, 398, 327, 710, 5160, 63, 31822, 63, 929, 1570, 1077, 506, 5223, 315, 314, 2897, 267, 291, 14, 629, 8, 549, 12, 291, 14, 2190, 14, 4296, 63, 6462, 63, 3236, 22282, 63, 4981, 63, 1461, 9, 398, 1591, 63, 4995, 63, 16, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 4995, 63, 16, 531, 267, 1591, 63, 4995, 63, 16, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 291, 14, 629, 8, 18, 12, 1591, 63, 4995, 63, 16, 14, 23639, 63, 31822, 9, 267, 1591, 63, 4995, 63, 17, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 4995, 63, 17, 531, 267, 1591, 63, 4995, 63, 17, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 291, 14, 629, 8, 18, 12, 1591, 63, 4995, 63, 17, 14, 23639, 63, 31822, 9, 398, 327, 9442, 8265, 1591, 1334, 314, 874, 24464, 267, 1591, 63, 16, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 1102, 63, 16, 531, 267, 1591, 63, 16, 14, 8625, 63, 262, 63, 5734, 275, 942, 267, 1591, 63, 17, 275, 291, 14, 10487, 14, 5146, 14, 1623, 63, 991, 63, 354, 480, 396, 63, 1102, 63, 17, 531, 267, 1591, 63, 17, 14, 8625, 63, 262, 63, 5734, 275, 942, 398, 1006, 63, 5146, 275, 359, 1102, 63, 4995, 63, 16, 12, 1591, 63, 4995, 63, 17, 12, 1591, 63, 16, 12, 1591, 63, 17, 61, 267, 1006, 63, 17292, 275, 359, 1102, 63, 4995, 63, 16, 12, 1591, 63, 4995, 63, 17, 61, 267, 1006, 63, 5871, 275, 359, 1102, 63, 16, 12, 1591, 63, 17, 61, 398, 27721, 10965, 267, 327, 8265, 1591, 6363, 465, 7215, 267, 27721, 10965, 267, 870, 3905, 841, 671, 7215, 11016, 9858, 2, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 4995, 63, 17, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 16, 12, 378, 12, 283, 2160, 995, 359, 1102, 63, 17, 12, 378, 12, 283, 2160, 2157, 886, 63, 4532, 29, 797, 9, 398, 367, 394, 315, 1006, 63, 5146, 26, 288, 291, 14, 629, 360, 2160, 297, 394, 14, 929, 9, 288, 291, 14, 629, 360, 30322, 297, 394, 14, 929, 63, 466, 9, 398, 27721, 10965, 267, 327, 7356, 781, 1050, 2005, 8826, 370, 24464, 267, 27721, 10965, 267, 870, 3905, 24464, 664, 10163, 1182, 26999, 1444, 9858, 2, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 327, 8228, 7427, 365, 737, 959, 12, 1077, 506, 11620, 3063, 267, 367, 394, 315, 1006, 63, 17292, 26, 288, 291, 14, 629, 360, 8819, 297, 394, 14, 929, 9, 288, 291, 14, 629, 360, 26999, 297, 394, 14, 929, 63, 466, 9, 398, 870, 3905, 24464, 664, 10163, 1182, 30322, 1444, 9858, 2, 267, 327, 7356, 5324, 841, 1655, 5920, 880, 781, 664, 10163, 15, 30322, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 29, 797, 9, 267, 291, 14, 8874, 63, 3813, 8, 17, 12, 3474, 1102, 63, 4995, 63, 16, 12, 499, 12, 283, 8819, 995, 359, 1102, 63, 4995, 63, 17, 12, 499, 12, 283, 8819, 2157, 886, 63, 4532, 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, 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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 ]
rdsathene/SchoolIdolAPI
api/migrations/0020_auto_20150217_1849.py
4
2998
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api', '0019_auto_20150216_0813'), ] operations = [ migrations.AddField( model_name='event', name='japanese_t1_points', field=models.PositiveIntegerField(null=True), preserve_default=True, ), migrations.AddField( model_name='event', name='japanese_t1_rank', field=models.PositiveIntegerField(null=True), preserve_default=True, ), migrations.AddField( model_name='event', name='japanese_t2_points', field=models.PositiveIntegerField(null=True), preserve_default=True, ), migrations.AddField( model_name='event', name='japanese_t2_rank', field=models.PositiveIntegerField(null=True), preserve_default=True, ), migrations.AddField( model_name='event', name='note', field=models.CharField(max_length=200, null=True, blank=True), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='accept_friend_requests', field=models.BooleanField(default=True, verbose_name='Accept friend requests'), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='best_girl', field=models.CharField(max_length=200, null=True, verbose_name='Best girl', blank=True), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='color', field=models.CharField(blank=True, max_length=6, null=True, verbose_name='Color', choices=[(b'Smile', 'Smile'), (b'Pure', 'Pure'), (b'Cool', 'Cool'), (b'All', 'All')]), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='description', field=models.TextField(help_text='Write whatever you want. You can add formatting and links using Markdown.', null=True, verbose_name='Description'), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='location', field=models.CharField(help_text='The city you live in.', max_length=200, null=True, verbose_name='Location', blank=True), preserve_default=True, ), migrations.AlterField( model_name='userpreferences', name='private', field=models.BooleanField(default=False, help_text='If your profile is private, people will only see your center.', verbose_name='Private Profile'), preserve_default=True, ), ]
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 12, 6180, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1246, 297, 283, 25018, 63, 2495, 63, 7806, 996, 975, 63, 2036, 969, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 17, 63, 3438, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 17, 63, 4648, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 18, 63, 3438, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 18, 63, 4648, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 4610, 297, 288, 901, 29, 992, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 5694, 63, 23472, 63, 6615, 297, 288, 901, 29, 992, 14, 5036, 8, 885, 29, 549, 12, 3376, 63, 354, 534, 8422, 32506, 4145, 659, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 7010, 63, 71, 723, 76, 297, 288, 901, 29, 992, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 19478, 486, 723, 76, 297, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 2326, 297, 288, 901, 29, 992, 14, 2183, 8, 2500, 29, 549, 12, 1390, 63, 1267, 29, 22, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 4117, 297, 3415, 17497, 66, 7, 16782, 441, 297, 283, 16782, 441, 659, 334, 66, 7, 28928, 297, 283, 28928, 659, 334, 66, 7, 967, 393, 297, 283, 967, 393, 659, 334, 66, 7, 2422, 297, 283, 2422, 22864, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 1802, 297, 288, 901, 29, 992, 14, 6254, 8, 3437, 63, 505, 534, 3534, 15685, 1265, 2934, 14, 2047, 883, 1050, 10803, 436, 6220, 1808, 24537, 3130, 2973, 29, 549, 12, 3376, 63, 354, 534, 5831, 659, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 1985, 297, 288, 901, 29, 992, 14, 2183, 8, 3437, 63, 505, 534, 1918, 14492, 1265, 12166, 315, 3130, 1390, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 6592, 297, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 4239, 297, 288, 901, 29, 992, 14, 5036, 8, 885, 29, 797, 12, 1720, 63, 505, 534, 3917, 2195, 4690, 365, 5726, 12, 13135, 911, 1454, 1937, 2195, 8126, 3130, 3376, 63, 354, 534, 12185, 14386, 659, 288, 11211, 63, 885, 29, 549, 12, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 12, 6180, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1246, 297, 283, 25018, 63, 2495, 63, 7806, 996, 975, 63, 2036, 969, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 17, 63, 3438, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 17, 63, 4648, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 18, 63, 3438, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 74, 30699, 63, 84, 18, 63, 4648, 297, 288, 901, 29, 992, 14, 8591, 8, 2307, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1430, 297, 288, 536, 534, 4610, 297, 288, 901, 29, 992, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 5694, 63, 23472, 63, 6615, 297, 288, 901, 29, 992, 14, 5036, 8, 885, 29, 549, 12, 3376, 63, 354, 534, 8422, 32506, 4145, 659, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 7010, 63, 71, 723, 76, 297, 288, 901, 29, 992, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 19478, 486, 723, 76, 297, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 2326, 297, 288, 901, 29, 992, 14, 2183, 8, 2500, 29, 549, 12, 1390, 63, 1267, 29, 22, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 4117, 297, 3415, 17497, 66, 7, 16782, 441, 297, 283, 16782, 441, 659, 334, 66, 7, 28928, 297, 283, 28928, 659, 334, 66, 7, 967, 393, 297, 283, 967, 393, 659, 334, 66, 7, 2422, 297, 283, 2422, 22864, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 1802, 297, 288, 901, 29, 992, 14, 6254, 8, 3437, 63, 505, 534, 3534, 15685, 1265, 2934, 14, 2047, 883, 1050, 10803, 436, 6220, 1808, 24537, 3130, 2973, 29, 549, 12, 3376, 63, 354, 534, 5831, 659, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 1985, 297, 288, 901, 29, 992, 14, 2183, 8, 3437, 63, 505, 534, 1918, 14492, 1265, 12166, 315, 3130, 1390, 63, 1267, 29, 1840, 12, 2973, 29, 549, 12, 3376, 63, 354, 534, 6592, 297, 4596, 29, 549, 395, 288, 11211, 63, 885, 29, 549, 12, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 751, 18063, 297, 288, 536, 534, 4239, 297, 288, 901, 29, 992, 14, 5036, 8, 885, 29, 797, 12, 1720, 63, 505, 534, 3917, 2195, 4690, 365, 5726, 12, 13135, 911, 1454, 1937, 2195, 8126, 3130, 3376, 63, 354, 534, 12185, 14386, 659, 288, 11211, 63, 885, 29, 549, 12, 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, 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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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 ]
latticelabs/Mitty
setup.py
1
2920
from setuptools import setup, find_packages __version__ = eval(open('mitty/version.py').read().split('=')[1]) setup( name='mitty', version=__version__, description='Simulator for genomic data', author='Seven Bridges Genomics', author_email='kaushik.ghose@sbgenomics.com', packages=find_packages(include=['mitty*']), include_package_data=True, entry_points={ # Register the built in plugins 'mitty.plugins.sfs': ['double_exp = mitty.plugins.site_frequency.double_exp'], 'mitty.plugins.variants': ['snp = mitty.plugins.variants.snp_plugin', 'delete = mitty.plugins.variants.delete_plugin', 'uniformdel = mitty.plugins.variants.uniform_deletions', 'uniformins = mitty.plugins.variants.uniform_insertions', 'insert = mitty.plugins.variants.insert_plugin', #'inversion = mitty.plugins.variants.inversion_plugin', #'low_entropy_insert = mitty.plugins.variants.low_entropy_insert_plugin' ], 'mitty.plugins.population': ['standard = mitty.plugins.population.standard', 'vn = mitty.plugins.population.vn'], 'mitty.plugins.reads': ['simple_sequential = mitty.plugins.reads.simple_sequential_plugin', 'simple_illumina = mitty.plugins.reads.simple_illumina_plugin'], # Command line scripts 'console_scripts': ['genomes = mitty.genomes:cli', 'reads = mitty.reads:cli', 'perfectbam = mitty.benchmarking.perfectbam:cli', 'badbams = mitty.benchmarking.badbams:cli', 'alindel = mitty.benchmarking.indel_alignment_accuracy:cli', 'benchsummary = mitty.benchmarking.benchmark_summary:cli', 'vcf2pop = mitty.lib.vcf2pop:cli', 'bam2tfq = mitty.benchmarking.convert_bam_to_truth_fastq:cli', 'alindel_plot = mitty.benchmarking.indel_alignment_accuracy_plot:cli', 'misplot = mitty.benchmarking.misalignment_plot:cli', 'acubam = mitty.benchmarking.bam_accuracy:cli', 'migratedb = mitty.util.db_migrate:cli', 'plot_gc_bias = mitty.util.plot_gc_bias:cli', 'splitta = mitty.util.splitta:cli', 'kmers = mitty.util.kmers:cli', 'pybwa = mitty.util.pybwa:cli'] }, install_requires=[ 'cython', 'setuptools>=11.0.0', 'numpy>=1.9.0', 'docopt>=0.6.2', 'click>=3.3', 'pysam>=0.8.1', 'h5py>=2.5.0', 'matplotlib>=1.3.0', 'scipy' ], )
gpl-2.0
[ 504, 9116, 492, 3272, 12, 2342, 63, 5154, 199, 199, 363, 1023, 363, 275, 3468, 8, 1490, 360, 1147, 369, 15, 1023, 14, 647, 1959, 739, 1252, 1294, 26800, 5832, 17, 566, 199, 2758, 8, 272, 536, 534, 1147, 369, 297, 272, 1015, 18971, 1023, 3108, 272, 1369, 534, 11397, 367, 3805, 676, 530, 666, 297, 272, 4132, 534, 1513, 1856, 699, 1677, 3389, 18870, 676, 2932, 297, 272, 4132, 63, 2123, 534, 7351, 2084, 3258, 14, 71, 526, 261, 32, 9264, 2268, 676, 2932, 14, 957, 297, 272, 6117, 29, 1623, 63, 5154, 8, 2613, 2968, 1147, 369, 10, 3815, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 2397, 63, 3438, 3126, 489, 327, 11828, 314, 6137, 315, 8963, 489, 283, 1147, 369, 14, 5265, 14, 83, 2319, 356, 788, 3157, 63, 1474, 275, 30714, 369, 14, 5265, 14, 2124, 63, 11132, 14, 3157, 63, 1474, 995, 489, 283, 1147, 369, 14, 5265, 14, 15680, 356, 788, 83, 1590, 275, 30714, 369, 14, 5265, 14, 15680, 14, 83, 1590, 63, 2718, 297, 639, 283, 1807, 275, 30714, 369, 14, 5265, 14, 15680, 14, 1807, 63, 2718, 297, 639, 283, 8830, 2264, 275, 30714, 369, 14, 5265, 14, 15680, 14, 8830, 63, 7346, 852, 297, 639, 283, 5411, 509, 29361, 275, 30714, 369, 14, 5265, 14, 15680, 14, 8830, 63, 262, 13049, 297, 639, 283, 3176, 275, 30714, 369, 14, 5265, 14, 15680, 14, 3176, 63, 2718, 297, 639, 17384, 262, 1023, 275, 30714, 369, 14, 5265, 14, 15680, 14, 262, 1023, 63, 2718, 297, 639, 17384, 674, 63, 10435, 63, 3176, 275, 30714, 369, 14, 5265, 14, 15680, 14, 674, 63, 10435, 63, 3176, 63, 2718, 7, 639, 2156, 489, 283, 1147, 369, 14, 5265, 14, 16003, 356, 788, 6807, 275, 30714, 369, 14, 5265, 14, 16003, 14, 6807, 297, 3521, 283, 6002, 275, 30714, 369, 14, 5265, 14, 16003, 14, 6002, 995, 489, 283, 1147, 369, 14, 5265, 14, 15656, 356, 788, 4129, 63, 16211, 275, 30714, 369, 14, 5265, 14, 15656, 14, 4129, 63, 16211, 63, 2718, 297, 2892, 283, 4129, 63, 778, 453, 13765, 275, 30714, 369, 14, 5265, 14, 15656, 14, 4129, 63, 778, 453, 13765, 63, 2718, 995, 489, 327, 5817, 1004, 10554, 489, 283, 6614, 63, 6429, 356, 788, 27776, 83, 275, 30714, 369, 14, 27776, 83, 26, 2764, 297, 2079, 283, 15656, 275, 30714, 369, 14, 15656, 26, 2764, 297, 2079, 283, 9452, 449, 21112, 275, 30714, 369, 14, 11861, 316, 14, 9452, 449, 21112, 26, 2764, 297, 2079, 283, 4087, 66, 19470, 275, 30714, 369, 14, 11861, 316, 14, 4087, 66, 19470, 26, 2764, 297, 2079, 283, 279, 262, 2264, 275, 30714, 369, 14, 11861, 316, 14, 262, 2264, 63, 13699, 63, 13374, 26, 2764, 297, 2079, 283, 16571, 4705, 275, 30714, 369, 14, 11861, 316, 14, 11861, 63, 4705, 26, 2764, 297, 2079, 283, 27288, 18, 1935, 275, 30714, 369, 14, 773, 14, 27288, 18, 1935, 26, 2764, 297, 2079, 283, 21112, 18, 3249, 81, 275, 30714, 369, 14, 11861, 316, 14, 3916, 63, 21112, 63, 475, 63, 17167, 63, 26423, 26, 2764, 297, 2079, 283, 279, 262, 2264, 63, 2798, 275, 30714, 369, 14, 11861, 316, 14, 262, 2264, 63, 13699, 63, 13374, 63, 2798, 26, 2764, 297, 2079, 283, 1292, 2798, 275, 30714, 369, 14, 11861, 316, 14, 1292, 13699, 63, 2798, 26, 2764, 297, 2079, 283, 645, 456, 455, 275, 30714, 369, 14, 11861, 316, 14, 21112, 63, 13374, 26, 2764, 297, 2079, 283, 8462, 697, 275, 30714, 369, 14, 1974, 14, 697, 63, 8462, 26, 2764, 297, 2079, 283, 2798, 63, 9493, 63, 8160, 275, 30714, 369, 14, 1974, 14, 2798, 63, 9493, 63, 8160, 26, 2764, 297, 2079, 283, 1294, 502, 275, 30714, 369, 14, 1974, 14, 1294, 502, 26, 2764, 297, 2079, 283, 75, 16465, 275, 30714, 369, 14, 1974, 14, 75, 16465, 26, 2764, 297, 2079, 283, 647, 66, 758, 275, 30714, 369, 14, 1974, 14, 647, 66, 758, 26, 2764, 418, 272, 1660, 272, 3907, 63, 6537, 1524, 489, 283, 20747, 297, 489, 283, 13623, 8119, 845, 14, 16, 14, 16, 297, 489, 283, 4714, 8119, 17, 14, 25, 14, 16, 297, 489, 283, 1117, 32626, 8119, 16, 14, 22, 14, 18, 297, 489, 283, 4891, 8119, 19, 14, 19, 297, 489, 283, 15983, 455, 8119, 16, 14, 24, 14, 17, 297, 489, 283, 72, 21, 647, 8119, 18, 14, 21, 14, 16, 297, 489, 283, 16440, 8119, 17, 14, 19, 14, 16, 297, 489, 283, 14248, 7, 272, 2156, 199, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 9116, 492, 3272, 12, 2342, 63, 5154, 199, 199, 363, 1023, 363, 275, 3468, 8, 1490, 360, 1147, 369, 15, 1023, 14, 647, 1959, 739, 1252, 1294, 26800, 5832, 17, 566, 199, 2758, 8, 272, 536, 534, 1147, 369, 297, 272, 1015, 18971, 1023, 3108, 272, 1369, 534, 11397, 367, 3805, 676, 530, 666, 297, 272, 4132, 534, 1513, 1856, 699, 1677, 3389, 18870, 676, 2932, 297, 272, 4132, 63, 2123, 534, 7351, 2084, 3258, 14, 71, 526, 261, 32, 9264, 2268, 676, 2932, 14, 957, 297, 272, 6117, 29, 1623, 63, 5154, 8, 2613, 2968, 1147, 369, 10, 3815, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 2397, 63, 3438, 3126, 489, 327, 11828, 314, 6137, 315, 8963, 489, 283, 1147, 369, 14, 5265, 14, 83, 2319, 356, 788, 3157, 63, 1474, 275, 30714, 369, 14, 5265, 14, 2124, 63, 11132, 14, 3157, 63, 1474, 995, 489, 283, 1147, 369, 14, 5265, 14, 15680, 356, 788, 83, 1590, 275, 30714, 369, 14, 5265, 14, 15680, 14, 83, 1590, 63, 2718, 297, 639, 283, 1807, 275, 30714, 369, 14, 5265, 14, 15680, 14, 1807, 63, 2718, 297, 639, 283, 8830, 2264, 275, 30714, 369, 14, 5265, 14, 15680, 14, 8830, 63, 7346, 852, 297, 639, 283, 5411, 509, 29361, 275, 30714, 369, 14, 5265, 14, 15680, 14, 8830, 63, 262, 13049, 297, 639, 283, 3176, 275, 30714, 369, 14, 5265, 14, 15680, 14, 3176, 63, 2718, 297, 639, 17384, 262, 1023, 275, 30714, 369, 14, 5265, 14, 15680, 14, 262, 1023, 63, 2718, 297, 639, 17384, 674, 63, 10435, 63, 3176, 275, 30714, 369, 14, 5265, 14, 15680, 14, 674, 63, 10435, 63, 3176, 63, 2718, 7, 639, 2156, 489, 283, 1147, 369, 14, 5265, 14, 16003, 356, 788, 6807, 275, 30714, 369, 14, 5265, 14, 16003, 14, 6807, 297, 3521, 283, 6002, 275, 30714, 369, 14, 5265, 14, 16003, 14, 6002, 995, 489, 283, 1147, 369, 14, 5265, 14, 15656, 356, 788, 4129, 63, 16211, 275, 30714, 369, 14, 5265, 14, 15656, 14, 4129, 63, 16211, 63, 2718, 297, 2892, 283, 4129, 63, 778, 453, 13765, 275, 30714, 369, 14, 5265, 14, 15656, 14, 4129, 63, 778, 453, 13765, 63, 2718, 995, 489, 327, 5817, 1004, 10554, 489, 283, 6614, 63, 6429, 356, 788, 27776, 83, 275, 30714, 369, 14, 27776, 83, 26, 2764, 297, 2079, 283, 15656, 275, 30714, 369, 14, 15656, 26, 2764, 297, 2079, 283, 9452, 449, 21112, 275, 30714, 369, 14, 11861, 316, 14, 9452, 449, 21112, 26, 2764, 297, 2079, 283, 4087, 66, 19470, 275, 30714, 369, 14, 11861, 316, 14, 4087, 66, 19470, 26, 2764, 297, 2079, 283, 279, 262, 2264, 275, 30714, 369, 14, 11861, 316, 14, 262, 2264, 63, 13699, 63, 13374, 26, 2764, 297, 2079, 283, 16571, 4705, 275, 30714, 369, 14, 11861, 316, 14, 11861, 63, 4705, 26, 2764, 297, 2079, 283, 27288, 18, 1935, 275, 30714, 369, 14, 773, 14, 27288, 18, 1935, 26, 2764, 297, 2079, 283, 21112, 18, 3249, 81, 275, 30714, 369, 14, 11861, 316, 14, 3916, 63, 21112, 63, 475, 63, 17167, 63, 26423, 26, 2764, 297, 2079, 283, 279, 262, 2264, 63, 2798, 275, 30714, 369, 14, 11861, 316, 14, 262, 2264, 63, 13699, 63, 13374, 63, 2798, 26, 2764, 297, 2079, 283, 1292, 2798, 275, 30714, 369, 14, 11861, 316, 14, 1292, 13699, 63, 2798, 26, 2764, 297, 2079, 283, 645, 456, 455, 275, 30714, 369, 14, 11861, 316, 14, 21112, 63, 13374, 26, 2764, 297, 2079, 283, 8462, 697, 275, 30714, 369, 14, 1974, 14, 697, 63, 8462, 26, 2764, 297, 2079, 283, 2798, 63, 9493, 63, 8160, 275, 30714, 369, 14, 1974, 14, 2798, 63, 9493, 63, 8160, 26, 2764, 297, 2079, 283, 1294, 502, 275, 30714, 369, 14, 1974, 14, 1294, 502, 26, 2764, 297, 2079, 283, 75, 16465, 275, 30714, 369, 14, 1974, 14, 75, 16465, 26, 2764, 297, 2079, 283, 647, 66, 758, 275, 30714, 369, 14, 1974, 14, 647, 66, 758, 26, 2764, 418, 272, 1660, 272, 3907, 63, 6537, 1524, 489, 283, 20747, 297, 489, 283, 13623, 8119, 845, 14, 16, 14, 16, 297, 489, 283, 4714, 8119, 17, 14, 25, 14, 16, 297, 489, 283, 1117, 32626, 8119, 16, 14, 22, 14, 18, 297, 489, 283, 4891, 8119, 19, 14, 19, 297, 489, 283, 15983, 455, 8119, 16, 14, 24, 14, 17, 297, 489, 283, 72, 21, 647, 8119, 18, 14, 21, 14, 16, 297, 489, 283, 16440, 8119, 17, 14, 19, 14, 16, 297, 489, 283, 14248, 7, 272, 2156, 199, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
tthtlc/volatility
contrib/plugins/pagecheck.py
55
1739
# Volatility # # This file is part of Volatility. # # Volatility 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. # # Volatility 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 Volatility. If not, see <http://www.gnu.org/licenses/>. # import volatility.commands as commands import volatility.utils as utils class PageCheck(commands.Command): """Reads the available pages and reports if any are inaccessible""" def render_text(self, outfd, data): """Displays any page errors""" found = False for page, vtop, size, pde, pte in data: found = True outfd.write("(V): 0x{0:08x} [PDE] 0x{3:08x} [PTE] 0x{4:08x} (P): 0x{1:08x} Size: 0x{2:08x}\n".format(page, vtop, size, pde, pte)) if not found: outfd.write("No page failures found!") def calculate(self): """Calculate returns the results of the available pages validity""" addr_space = utils.load_as(self._config) for page, size in addr_space.get_available_pages(): output = addr_space.read(page, size) if output == None: pde_value = addr_space.get_pde(page) pte_value = addr_space.get_pte(page, pde_value) yield page, addr_space.vtop(page), size, pde_value, pte_value
gpl-2.0
[ 3, 28367, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28367, 14, 199, 3, 199, 3, 28367, 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, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 28367, 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, 28367, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 646, 5236, 18783, 14, 4405, 465, 3718, 199, 646, 5236, 18783, 14, 1208, 465, 3778, 199, 199, 533, 10331, 1799, 8, 4405, 14, 3110, 304, 272, 408, 23614, 314, 2808, 6497, 436, 13924, 340, 1263, 787, 315, 24669, 624, 339, 347, 3795, 63, 505, 8, 277, 12, 734, 2592, 12, 666, 304, 267, 408, 2825, 20591, 1263, 2034, 2552, 624, 267, 1911, 275, 756, 267, 367, 2034, 12, 373, 2119, 12, 1568, 12, 299, 271, 12, 299, 266, 315, 666, 26, 288, 1911, 275, 715, 288, 734, 2592, 14, 952, 18353, 54, 304, 378, 88, 91, 16, 26, 2036, 88, 93, 359, 48, 1093, 61, 378, 88, 91, 19, 26, 2036, 88, 93, 359, 48, 3727, 61, 378, 88, 91, 20, 26, 2036, 88, 93, 334, 48, 304, 378, 88, 91, 17, 26, 2036, 88, 93, 14579, 26, 378, 88, 91, 18, 26, 2036, 88, 4988, 78, 1674, 908, 8, 1606, 12, 373, 2119, 12, 1568, 12, 299, 271, 12, 299, 266, 430, 267, 340, 440, 1911, 26, 288, 734, 2592, 14, 952, 480, 1944, 2034, 9081, 1911, 9124, 339, 347, 8671, 8, 277, 304, 267, 408, 14860, 2529, 314, 2058, 402, 314, 2808, 6497, 25667, 624, 267, 5552, 63, 2638, 275, 3778, 14, 912, 63, 305, 8, 277, 423, 888, 9, 267, 367, 2034, 12, 1568, 315, 5552, 63, 2638, 14, 362, 63, 4561, 63, 5856, 837, 288, 1072, 275, 5552, 63, 2638, 14, 739, 8, 1606, 12, 1568, 9, 288, 340, 1072, 508, 488, 26, 355, 299, 271, 63, 585, 275, 5552, 63, 2638, 14, 362, 63, 80, 271, 8, 1606, 9, 355, 299, 266, 63, 585, 275, 5552, 63, 2638, 14, 362, 63, 80, 266, 8, 1606, 12, 299, 271, 63, 585, 9, 355, 1995, 2034, 12, 5552, 63, 2638, 14, 86, 2119, 8, 1606, 395, 1568, 12, 299, 271, 63, 585, 12, 299, 266, 63, 585, 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 ]
[ 28367, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28367, 14, 199, 3, 199, 3, 28367, 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, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 28367, 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, 28367, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 646, 5236, 18783, 14, 4405, 465, 3718, 199, 646, 5236, 18783, 14, 1208, 465, 3778, 199, 199, 533, 10331, 1799, 8, 4405, 14, 3110, 304, 272, 408, 23614, 314, 2808, 6497, 436, 13924, 340, 1263, 787, 315, 24669, 624, 339, 347, 3795, 63, 505, 8, 277, 12, 734, 2592, 12, 666, 304, 267, 408, 2825, 20591, 1263, 2034, 2552, 624, 267, 1911, 275, 756, 267, 367, 2034, 12, 373, 2119, 12, 1568, 12, 299, 271, 12, 299, 266, 315, 666, 26, 288, 1911, 275, 715, 288, 734, 2592, 14, 952, 18353, 54, 304, 378, 88, 91, 16, 26, 2036, 88, 93, 359, 48, 1093, 61, 378, 88, 91, 19, 26, 2036, 88, 93, 359, 48, 3727, 61, 378, 88, 91, 20, 26, 2036, 88, 93, 334, 48, 304, 378, 88, 91, 17, 26, 2036, 88, 93, 14579, 26, 378, 88, 91, 18, 26, 2036, 88, 4988, 78, 1674, 908, 8, 1606, 12, 373, 2119, 12, 1568, 12, 299, 271, 12, 299, 266, 430, 267, 340, 440, 1911, 26, 288, 734, 2592, 14, 952, 480, 1944, 2034, 9081, 1911, 9124, 339, 347, 8671, 8, 277, 304, 267, 408, 14860, 2529, 314, 2058, 402, 314, 2808, 6497, 25667, 624, 267, 5552, 63, 2638, 275, 3778, 14, 912, 63, 305, 8, 277, 423, 888, 9, 267, 367, 2034, 12, 1568, 315, 5552, 63, 2638, 14, 362, 63, 4561, 63, 5856, 837, 288, 1072, 275, 5552, 63, 2638, 14, 739, 8, 1606, 12, 1568, 9, 288, 340, 1072, 508, 488, 26, 355, 299, 271, 63, 585, 275, 5552, 63, 2638, 14, 362, 63, 80, 271, 8, 1606, 9, 355, 299, 266, 63, 585, 275, 5552, 63, 2638, 14, 362, 63, 80, 266, 8, 1606, 12, 299, 271, 63, 585, 9, 355, 1995, 2034, 12, 5552, 63, 2638, 14, 86, 2119, 8, 1606, 395, 1568, 12, 299, 271, 63, 585, 12, 299, 266, 63, 585, 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, 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,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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, 0, 0 ]
coolbombom/CouchPotatoServer
libs/tornado/util.py
56
9238
"""Miscellaneous utility functions and classes. This module is used internally by Tornado. It is not necessarily expected that the functions and classes defined here will be useful to other applications, but they are documented here in case they are. The one public-facing part of this module is the `Configurable` class and its `~Configurable.configure` method, which becomes a part of the interface of its subclasses, including `.AsyncHTTPClient`, `.IOLoop`, and `.Resolver`. """ from __future__ import absolute_import, division, print_function, with_statement import inspect import sys import zlib class ObjectDict(dict): """Makes a dictionary behave like an object, with attribute-style access. """ def __getattr__(self, name): try: return self[name] except KeyError: raise AttributeError(name) def __setattr__(self, name, value): self[name] = value class GzipDecompressor(object): """Streaming gzip decompressor. The interface is like that of `zlib.decompressobj` (without the optional arguments, but it understands gzip headers and checksums. """ def __init__(self): # Magic parameter makes zlib module understand gzip header # http://stackoverflow.com/questions/1838699/how-can-i-decompress-a-gzip-stream-with-zlib # This works on cpython and pypy, but not jython. self.decompressobj = zlib.decompressobj(16 + zlib.MAX_WBITS) def decompress(self, value): """Decompress a chunk, returning newly-available data. Some data may be buffered for later processing; `flush` must be called when there is no more input data to ensure that all data was processed. """ return self.decompressobj.decompress(value) def flush(self): """Return any remaining buffered data not yet returned by decompress. Also checks for errors such as truncated input. No other methods may be called on this object after `flush`. """ return self.decompressobj.flush() def import_object(name): """Imports an object by name. import_object('x') is equivalent to 'import x'. import_object('x.y.z') is equivalent to 'from x.y import z'. >>> import tornado.escape >>> import_object('tornado.escape') is tornado.escape True >>> import_object('tornado.escape.utf8') is tornado.escape.utf8 True >>> import_object('tornado') is tornado True >>> import_object('tornado.missing_module') Traceback (most recent call last): ... ImportError: No module named missing_module """ if name.count('.') == 0: return __import__(name, None, None) parts = name.split('.') obj = __import__('.'.join(parts[:-1]), None, None, [parts[-1]], 0) try: return getattr(obj, parts[-1]) except AttributeError: raise ImportError("No module named %s" % parts[-1]) # Fake unicode literal support: Python 3.2 doesn't have the u'' marker for # literal strings, and alternative solutions like "from __future__ import # unicode_literals" have other problems (see PEP 414). u() can be applied # to ascii strings that include \u escapes (but they must not contain # literal non-ascii characters). if type('') is not type(b''): def u(s): return s bytes_type = bytes unicode_type = str basestring_type = str else: def u(s): return s.decode('unicode_escape') bytes_type = str unicode_type = unicode basestring_type = basestring if sys.version_info > (3,): exec(""" def raise_exc_info(exc_info): raise exc_info[1].with_traceback(exc_info[2]) def exec_in(code, glob, loc=None): if isinstance(code, str): code = compile(code, '<string>', 'exec', dont_inherit=True) exec(code, glob, loc) """) else: exec(""" def raise_exc_info(exc_info): raise exc_info[0], exc_info[1], exc_info[2] def exec_in(code, glob, loc=None): if isinstance(code, basestring): # exec(string) inherits the caller's future imports; compile # the string first to prevent that. code = compile(code, '<string>', 'exec', dont_inherit=True) exec code in glob, loc """) class Configurable(object): """Base class for configurable interfaces. A configurable interface is an (abstract) class whose constructor acts as a factory function for one of its implementation subclasses. The implementation subclass as well as optional keyword arguments to its initializer can be set globally at runtime with `configure`. By using the constructor as the factory method, the interface looks like a normal class, `isinstance` works as usual, etc. This pattern is most useful when the choice of implementation is likely to be a global decision (e.g. when `~select.epoll` is available, always use it instead of `~select.select`), or when a previously-monolithic class has been split into specialized subclasses. Configurable subclasses must define the class methods `configurable_base` and `configurable_default`, and use the instance method `initialize` instead of ``__init__``. """ __impl_class = None __impl_kwargs = None def __new__(cls, **kwargs): base = cls.configurable_base() args = {} if cls is base: impl = cls.configured_class() if base.__impl_kwargs: args.update(base.__impl_kwargs) else: impl = cls args.update(kwargs) instance = super(Configurable, cls).__new__(impl) # initialize vs __init__ chosen for compatiblity with AsyncHTTPClient # singleton magic. If we get rid of that we can switch to __init__ # here too. instance.initialize(**args) return instance @classmethod def configurable_base(cls): """Returns the base class of a configurable hierarchy. This will normally return the class in which it is defined. (which is *not* necessarily the same as the cls classmethod parameter). """ raise NotImplementedError() @classmethod def configurable_default(cls): """Returns the implementation class to be used if none is configured.""" raise NotImplementedError() def initialize(self): """Initialize a `Configurable` subclass instance. Configurable classes should use `initialize` instead of ``__init__``. """ @classmethod def configure(cls, impl, **kwargs): """Sets the class to use when the base class is instantiated. Keyword arguments will be saved and added to the arguments passed to the constructor. This can be used to set global defaults for some parameters. """ base = cls.configurable_base() if isinstance(impl, (unicode_type, bytes_type)): impl = import_object(impl) if impl is not None and not issubclass(impl, cls): raise ValueError("Invalid subclass of %s" % cls) base.__impl_class = impl base.__impl_kwargs = kwargs @classmethod def configured_class(cls): """Returns the currently configured class.""" base = cls.configurable_base() if cls.__impl_class is None: base.__impl_class = cls.configurable_default() return base.__impl_class @classmethod def _save_configuration(cls): base = cls.configurable_base() return (base.__impl_class, base.__impl_kwargs) @classmethod def _restore_configuration(cls, saved): base = cls.configurable_base() base.__impl_class = saved[0] base.__impl_kwargs = saved[1] class ArgReplacer(object): """Replaces one value in an ``args, kwargs`` pair. Inspects the function signature to find an argument by name whether it is passed by position or keyword. For use in decorators and similar wrappers. """ def __init__(self, func, name): self.name = name try: self.arg_pos = inspect.getargspec(func).args.index(self.name) except ValueError: # Not a positional parameter self.arg_pos = None def replace(self, new_value, args, kwargs): """Replace the named argument in ``args, kwargs`` with ``new_value``. Returns ``(old_value, args, kwargs)``. The returned ``args`` and ``kwargs`` objects may not be the same as the input objects, or the input objects may be mutated. If the named argument was not found, ``new_value`` will be added to ``kwargs`` and None will be returned as ``old_value``. """ if self.arg_pos is not None and len(args) > self.arg_pos: # The arg to replace is passed positionally old_value = args[self.arg_pos] args = list(args) # *args is normally a tuple args[self.arg_pos] = new_value else: # The arg to replace is either omitted or passed by keyword. old_value = kwargs.get(self.name) kwargs[self.name] = new_value return old_value, args, kwargs def doctests(): import doctest return doctest.DocTestSuite()
gpl-3.0
[ 624, 30248, 11420, 3423, 436, 3992, 14, 199, 199, 2765, 859, 365, 1202, 14448, 701, 377, 8622, 14, 221, 2779, 365, 440, 20513, 1420, 199, 9099, 314, 3423, 436, 3992, 3247, 2348, 911, 506, 2997, 370, 1163, 199, 15853, 12, 1325, 2985, 787, 22751, 2348, 315, 1930, 2985, 787, 14, 199, 199, 1918, 1373, 4575, 13, 32552, 1777, 402, 642, 859, 365, 314, 658, 2028, 15684, 64, 1021, 199, 460, 2399, 28157, 2028, 15684, 14, 6472, 64, 1083, 12, 1314, 15410, 282, 1777, 402, 314, 199, 3266, 402, 2399, 9180, 12, 5893, 19853, 12807, 27757, 3559, 19853, 23152, 3559, 199, 460, 19853, 12407, 2313, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 543, 63, 6242, 199, 199, 646, 6485, 199, 646, 984, 199, 646, 12472, 421, 199, 533, 6935, 2141, 8, 807, 304, 272, 408, 27142, 282, 2600, 24062, 2839, 376, 909, 12, 543, 2225, 13, 2487, 2879, 14, 272, 408, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 862, 26, 288, 372, 291, 59, 354, 61, 267, 871, 4067, 26, 288, 746, 4281, 8, 354, 9, 339, 347, 636, 10202, 721, 277, 12, 536, 12, 574, 304, 267, 291, 59, 354, 61, 275, 574, 421, 199, 533, 598, 3065, 872, 27879, 8, 785, 304, 272, 408, 22555, 11756, 24733, 269, 14, 339, 710, 3217, 365, 2839, 626, 402, 658, 15371, 14, 14954, 1113, 64, 334, 7395, 314, 272, 2716, 2368, 12, 1325, 652, 1334, 26580, 11756, 2323, 436, 9040, 83, 14, 272, 408, 272, 347, 636, 826, 721, 277, 304, 267, 327, 603, 6573, 2725, 7704, 12472, 859, 20647, 11756, 1406, 267, 327, 1455, 921, 23153, 14, 957, 15, 16069, 15, 1085, 8040, 1020, 15, 1917, 13, 2425, 13, 73, 13, 14954, 13, 65, 13, 12256, 13, 1745, 13, 1045, 13, 15371, 267, 327, 961, 5419, 641, 286, 1548, 436, 1134, 647, 12, 1325, 440, 1335, 11361, 14, 267, 291, 14, 14954, 1113, 275, 12472, 14, 14954, 1113, 8, 975, 435, 12472, 14, 4283, 63, 55, 14662, 9, 339, 347, 24733, 8, 277, 12, 574, 304, 267, 408, 872, 6447, 282, 3728, 12, 8152, 13903, 13, 4561, 666, 14, 398, 6601, 666, 1443, 506, 20224, 367, 2945, 6661, 27, 658, 4939, 64, 1471, 267, 506, 2797, 1380, 2337, 365, 949, 1655, 1324, 666, 370, 4868, 626, 267, 1006, 666, 1990, 7686, 14, 267, 408, 267, 372, 291, 14, 14954, 1113, 14, 14954, 8, 585, 9, 339, 347, 8976, 8, 277, 304, 267, 408, 1767, 1263, 7971, 20224, 666, 440, 5966, 2138, 701, 24733, 14, 398, 6121, 5920, 367, 2552, 4066, 465, 17661, 1324, 14, 267, 3091, 1163, 3102, 1443, 506, 2797, 641, 642, 909, 2410, 658, 4939, 2313, 267, 408, 267, 372, 291, 14, 14954, 1113, 14, 4939, 342, 421, 199, 318, 492, 63, 785, 8, 354, 304, 272, 408, 32447, 376, 909, 701, 536, 14, 339, 492, 63, 785, 360, 88, 358, 365, 7353, 370, 283, 646, 671, 1370, 272, 492, 63, 785, 360, 88, 14, 89, 14, 90, 358, 365, 7353, 370, 283, 504, 671, 14, 89, 492, 1315, 1370, 339, 1306, 492, 12148, 14, 3765, 272, 1306, 492, 63, 785, 360, 18443, 14, 3765, 358, 365, 12148, 14, 3765, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 14, 3765, 14, 1624, 24, 358, 365, 12148, 14, 3765, 14, 1624, 24, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 358, 365, 12148, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 14, 4752, 63, 578, 358, 272, 15273, 334, 2786, 8058, 1240, 2061, 304, 267, 2263, 272, 3545, 26, 3091, 859, 4310, 4124, 63, 578, 272, 408, 272, 340, 536, 14, 835, 7563, 508, 378, 26, 267, 372, 636, 646, 721, 354, 12, 488, 12, 488, 9, 339, 4184, 275, 536, 14, 1294, 7563, 272, 1559, 275, 636, 646, 363, 5175, 1370, 904, 8, 4181, 4439, 17, 2522, 488, 12, 488, 12, 359, 4181, 1988, 17, 2365, 378, 9, 272, 862, 26, 267, 372, 2519, 8, 1113, 12, 4184, 1988, 17, 566, 272, 871, 4281, 26, 267, 746, 3545, 480, 1944, 859, 4310, 450, 83, 2, 450, 4184, 1988, 17, 566, 421, 199, 3, 7777, 2649, 8785, 2291, 26, 221, 2018, 650, 14, 18, 3181, 1133, 1172, 314, 399, 891, 3608, 367, 199, 3, 8785, 3326, 12, 436, 13943, 24886, 2839, 298, 504, 636, 2443, 363, 492, 199, 3, 2649, 63, 5955, 2, 1172, 1163, 8826, 334, 3239, 13663, 841, 1079, 680, 221, 399, 342, 883, 506, 6781, 199, 3, 370, 13294, 3326, 626, 2387, 971, 85, 24644, 334, 7911, 2985, 1471, 440, 1395, 199, 3, 8785, 2222, 13, 4371, 4110, 680, 199, 692, 730, 8355, 365, 440, 730, 8, 66, 7, 735, 272, 347, 399, 8, 83, 304, 267, 372, 308, 272, 2783, 63, 466, 275, 2783, 272, 2649, 63, 466, 275, 620, 272, 7116, 63, 466, 275, 620, 199, 2836, 26, 272, 347, 399, 8, 83, 304, 267, 372, 308, 14, 2708, 360, 2975, 63, 3765, 358, 272, 2783, 63, 466, 275, 620, 272, 2649, 63, 466, 275, 2649, 272, 7116, 63, 466, 275, 7116, 421, 199, 692, 984, 14, 1023, 63, 815, 690, 334, 19, 16095, 272, 2146, 4852, 199, 318, 746, 63, 2804, 63, 815, 8, 2804, 63, 815, 304, 272, 746, 3178, 63, 815, 59, 17, 1055, 1045, 63, 6894, 8, 2804, 63, 815, 59, 18, 566, 199, 199, 318, 2146, 63, 262, 8, 600, 12, 5739, 12, 4355, 29, 403, 304, 272, 340, 1228, 8, 600, 12, 620, 304, 267, 1233, 275, 6555, 8, 600, 12, 2650, 875, 4206, 283, 1628, 297, 21542, 63, 6486, 29, 549, 9, 272, 2146, 8, 600, 12, 5739, 12, 4355, 9, 199, 6141, 199, 2836, 26, 272, 2146, 4852, 199, 318, 746, 63, 2804, 63, 815, 8, 2804, 63, 815, 304, 272, 746, 3178, 63, 815, 59, 16, 467, 3178, 63, 815, 59, 17, 467, 3178, 63, 815, 59, 18, 61, 199, 199, 318, 2146, 63, 262, 8, 600, 12, 5739, 12, 4355, 29, 403, 304, 272, 340, 1228, 8, 600, 12, 7116, 304, 267, 327, 2146, 8, 875, 9, 21592, 314, 8025, 1159, 6466, 8925, 27, 6555, 267, 327, 314, 1059, 1642, 370 ]
[ 30248, 11420, 3423, 436, 3992, 14, 199, 199, 2765, 859, 365, 1202, 14448, 701, 377, 8622, 14, 221, 2779, 365, 440, 20513, 1420, 199, 9099, 314, 3423, 436, 3992, 3247, 2348, 911, 506, 2997, 370, 1163, 199, 15853, 12, 1325, 2985, 787, 22751, 2348, 315, 1930, 2985, 787, 14, 199, 199, 1918, 1373, 4575, 13, 32552, 1777, 402, 642, 859, 365, 314, 658, 2028, 15684, 64, 1021, 199, 460, 2399, 28157, 2028, 15684, 14, 6472, 64, 1083, 12, 1314, 15410, 282, 1777, 402, 314, 199, 3266, 402, 2399, 9180, 12, 5893, 19853, 12807, 27757, 3559, 19853, 23152, 3559, 199, 460, 19853, 12407, 2313, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 543, 63, 6242, 199, 199, 646, 6485, 199, 646, 984, 199, 646, 12472, 421, 199, 533, 6935, 2141, 8, 807, 304, 272, 408, 27142, 282, 2600, 24062, 2839, 376, 909, 12, 543, 2225, 13, 2487, 2879, 14, 272, 408, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 862, 26, 288, 372, 291, 59, 354, 61, 267, 871, 4067, 26, 288, 746, 4281, 8, 354, 9, 339, 347, 636, 10202, 721, 277, 12, 536, 12, 574, 304, 267, 291, 59, 354, 61, 275, 574, 421, 199, 533, 598, 3065, 872, 27879, 8, 785, 304, 272, 408, 22555, 11756, 24733, 269, 14, 339, 710, 3217, 365, 2839, 626, 402, 658, 15371, 14, 14954, 1113, 64, 334, 7395, 314, 272, 2716, 2368, 12, 1325, 652, 1334, 26580, 11756, 2323, 436, 9040, 83, 14, 272, 408, 272, 347, 636, 826, 721, 277, 304, 267, 327, 603, 6573, 2725, 7704, 12472, 859, 20647, 11756, 1406, 267, 327, 1455, 921, 23153, 14, 957, 15, 16069, 15, 1085, 8040, 1020, 15, 1917, 13, 2425, 13, 73, 13, 14954, 13, 65, 13, 12256, 13, 1745, 13, 1045, 13, 15371, 267, 327, 961, 5419, 641, 286, 1548, 436, 1134, 647, 12, 1325, 440, 1335, 11361, 14, 267, 291, 14, 14954, 1113, 275, 12472, 14, 14954, 1113, 8, 975, 435, 12472, 14, 4283, 63, 55, 14662, 9, 339, 347, 24733, 8, 277, 12, 574, 304, 267, 408, 872, 6447, 282, 3728, 12, 8152, 13903, 13, 4561, 666, 14, 398, 6601, 666, 1443, 506, 20224, 367, 2945, 6661, 27, 658, 4939, 64, 1471, 267, 506, 2797, 1380, 2337, 365, 949, 1655, 1324, 666, 370, 4868, 626, 267, 1006, 666, 1990, 7686, 14, 267, 408, 267, 372, 291, 14, 14954, 1113, 14, 14954, 8, 585, 9, 339, 347, 8976, 8, 277, 304, 267, 408, 1767, 1263, 7971, 20224, 666, 440, 5966, 2138, 701, 24733, 14, 398, 6121, 5920, 367, 2552, 4066, 465, 17661, 1324, 14, 267, 3091, 1163, 3102, 1443, 506, 2797, 641, 642, 909, 2410, 658, 4939, 2313, 267, 408, 267, 372, 291, 14, 14954, 1113, 14, 4939, 342, 421, 199, 318, 492, 63, 785, 8, 354, 304, 272, 408, 32447, 376, 909, 701, 536, 14, 339, 492, 63, 785, 360, 88, 358, 365, 7353, 370, 283, 646, 671, 1370, 272, 492, 63, 785, 360, 88, 14, 89, 14, 90, 358, 365, 7353, 370, 283, 504, 671, 14, 89, 492, 1315, 1370, 339, 1306, 492, 12148, 14, 3765, 272, 1306, 492, 63, 785, 360, 18443, 14, 3765, 358, 365, 12148, 14, 3765, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 14, 3765, 14, 1624, 24, 358, 365, 12148, 14, 3765, 14, 1624, 24, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 358, 365, 12148, 272, 715, 272, 1306, 492, 63, 785, 360, 18443, 14, 4752, 63, 578, 358, 272, 15273, 334, 2786, 8058, 1240, 2061, 304, 267, 2263, 272, 3545, 26, 3091, 859, 4310, 4124, 63, 578, 272, 408, 272, 340, 536, 14, 835, 7563, 508, 378, 26, 267, 372, 636, 646, 721, 354, 12, 488, 12, 488, 9, 339, 4184, 275, 536, 14, 1294, 7563, 272, 1559, 275, 636, 646, 363, 5175, 1370, 904, 8, 4181, 4439, 17, 2522, 488, 12, 488, 12, 359, 4181, 1988, 17, 2365, 378, 9, 272, 862, 26, 267, 372, 2519, 8, 1113, 12, 4184, 1988, 17, 566, 272, 871, 4281, 26, 267, 746, 3545, 480, 1944, 859, 4310, 450, 83, 2, 450, 4184, 1988, 17, 566, 421, 199, 3, 7777, 2649, 8785, 2291, 26, 221, 2018, 650, 14, 18, 3181, 1133, 1172, 314, 399, 891, 3608, 367, 199, 3, 8785, 3326, 12, 436, 13943, 24886, 2839, 298, 504, 636, 2443, 363, 492, 199, 3, 2649, 63, 5955, 2, 1172, 1163, 8826, 334, 3239, 13663, 841, 1079, 680, 221, 399, 342, 883, 506, 6781, 199, 3, 370, 13294, 3326, 626, 2387, 971, 85, 24644, 334, 7911, 2985, 1471, 440, 1395, 199, 3, 8785, 2222, 13, 4371, 4110, 680, 199, 692, 730, 8355, 365, 440, 730, 8, 66, 7, 735, 272, 347, 399, 8, 83, 304, 267, 372, 308, 272, 2783, 63, 466, 275, 2783, 272, 2649, 63, 466, 275, 620, 272, 7116, 63, 466, 275, 620, 199, 2836, 26, 272, 347, 399, 8, 83, 304, 267, 372, 308, 14, 2708, 360, 2975, 63, 3765, 358, 272, 2783, 63, 466, 275, 620, 272, 2649, 63, 466, 275, 2649, 272, 7116, 63, 466, 275, 7116, 421, 199, 692, 984, 14, 1023, 63, 815, 690, 334, 19, 16095, 272, 2146, 4852, 199, 318, 746, 63, 2804, 63, 815, 8, 2804, 63, 815, 304, 272, 746, 3178, 63, 815, 59, 17, 1055, 1045, 63, 6894, 8, 2804, 63, 815, 59, 18, 566, 199, 199, 318, 2146, 63, 262, 8, 600, 12, 5739, 12, 4355, 29, 403, 304, 272, 340, 1228, 8, 600, 12, 620, 304, 267, 1233, 275, 6555, 8, 600, 12, 2650, 875, 4206, 283, 1628, 297, 21542, 63, 6486, 29, 549, 9, 272, 2146, 8, 600, 12, 5739, 12, 4355, 9, 199, 6141, 199, 2836, 26, 272, 2146, 4852, 199, 318, 746, 63, 2804, 63, 815, 8, 2804, 63, 815, 304, 272, 746, 3178, 63, 815, 59, 16, 467, 3178, 63, 815, 59, 17, 467, 3178, 63, 815, 59, 18, 61, 199, 199, 318, 2146, 63, 262, 8, 600, 12, 5739, 12, 4355, 29, 403, 304, 272, 340, 1228, 8, 600, 12, 7116, 304, 267, 327, 2146, 8, 875, 9, 21592, 314, 8025, 1159, 6466, 8925, 27, 6555, 267, 327, 314, 1059, 1642, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mlhenderson/narrative
src/biokbase/narrative/exception_util.py
2
1847
from requests.exceptions import HTTPError from biokbase.NarrativeJobService.Client import ServerError as NJSServerError from biokbase.userandjobstate.baseclient import ServerError as UJSServerError class NarrativeException(Exception): def __init__(self, code, message, name, source): self.code = code self.message = message self.name = name self.source = source def __str__(self): return self.message def transform_job_exception(e): """ Transforms a job exception from one of several forms into something more obvious and manageable. Assigns a standard HTTP error code, regardless of error (500 if nothing else). Returns a slightly modified exception that Types of exceptions: ServerError - thrown by the server, usually due to a 500 (ish) exception HTTPError - a more mundane HTTP exception """ if isinstance(e, NJSServerError): return NarrativeException(e.code, e.message, e.name, 'njs') elif isinstance(e, UJSServerError): return NarrativeException(e.code, e.message, e.name, 'ujs') elif isinstance(e, HTTPError): code = e.response.status_code if code == 404 or code == 502 or code == 503: # service not found msg = 'A KBase service is currently unavailable.' elif code == 504 or code == 598 or code == 599: # service timeout msg = 'There was a temporary network connection error.' elif code == 500: # internal error. dunno what to do. msg = 'An internal error occurred in the KBase service.' else: msg = 'An untracked error occurred.' return NarrativeException(e.response.status_code, msg, 'HTTPError', 'network') else: return NarrativeException(-1, str(e), 'Exception', 'unknown')
mit
[ 504, 4145, 14, 3924, 492, 15050, 199, 504, 12111, 745, 1095, 14, 46, 285, 30498, 6694, 3167, 14, 3041, 492, 7146, 547, 465, 653, 11378, 17692, 199, 504, 12111, 745, 1095, 14, 751, 460, 2423, 929, 14, 1095, 1258, 492, 7146, 547, 465, 738, 11378, 17692, 199, 199, 533, 653, 285, 30498, 1726, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1233, 12, 1245, 12, 536, 12, 1350, 304, 267, 291, 14, 600, 275, 1233, 267, 291, 14, 1188, 275, 1245, 267, 291, 14, 354, 275, 536, 267, 291, 14, 1365, 275, 1350, 339, 347, 636, 495, 721, 277, 304, 267, 372, 291, 14, 1188, 199, 199, 318, 5793, 63, 2423, 63, 1971, 8, 69, 304, 272, 408, 272, 6266, 3351, 282, 3906, 1919, 687, 1373, 402, 9978, 4513, 1901, 272, 6020, 1655, 25259, 436, 9635, 461, 14, 339, 3709, 20440, 282, 4465, 3101, 1125, 1233, 12, 15270, 402, 1125, 334, 5783, 340, 6548, 587, 680, 339, 1803, 282, 18023, 6042, 1919, 626, 339, 18851, 402, 4967, 26, 272, 7146, 547, 446, 14031, 701, 314, 1654, 12, 9987, 7037, 370, 282, 6891, 334, 2453, 9, 1919, 272, 15050, 446, 282, 1655, 333, 725, 5865, 3101, 1919, 272, 408, 272, 340, 1228, 8, 69, 12, 653, 11378, 17692, 304, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 600, 12, 325, 14, 1188, 12, 325, 14, 354, 12, 283, 78, 3596, 358, 272, 916, 1228, 8, 69, 12, 738, 11378, 17692, 304, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 600, 12, 325, 14, 1188, 12, 325, 14, 354, 12, 283, 85, 3596, 358, 272, 916, 1228, 8, 69, 12, 15050, 304, 267, 1233, 275, 325, 14, 1310, 14, 1205, 63, 600, 267, 340, 1233, 508, 7901, 503, 1233, 508, 959, 996, 503, 1233, 508, 24046, 26, 288, 327, 2435, 440, 1911, 288, 1499, 275, 283, 33, 1804, 1563, 2435, 365, 5544, 18735, 3530, 267, 916, 1233, 508, 959, 966, 503, 1233, 508, 959, 2905, 503, 1233, 508, 959, 1020, 26, 288, 327, 2435, 2653, 288, 1499, 275, 283, 10924, 1990, 282, 7937, 2784, 1950, 1125, 3530, 267, 916, 1233, 508, 6891, 26, 288, 327, 5007, 1125, 14, 366, 324, 889, 4052, 370, 886, 14, 288, 1499, 275, 283, 2493, 5007, 1125, 8920, 315, 314, 1804, 1563, 2435, 3530, 267, 587, 26, 288, 1499, 275, 283, 2493, 625, 22586, 1125, 8920, 3530, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 1310, 14, 1205, 63, 600, 12, 1499, 12, 283, 12815, 297, 283, 1200, 358, 272, 587, 26, 267, 372, 653, 285, 30498, 1726, 2801, 17, 12, 620, 8, 69, 395, 283, 1726, 297, 283, 5187, 358, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 4145, 14, 3924, 492, 15050, 199, 504, 12111, 745, 1095, 14, 46, 285, 30498, 6694, 3167, 14, 3041, 492, 7146, 547, 465, 653, 11378, 17692, 199, 504, 12111, 745, 1095, 14, 751, 460, 2423, 929, 14, 1095, 1258, 492, 7146, 547, 465, 738, 11378, 17692, 199, 199, 533, 653, 285, 30498, 1726, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1233, 12, 1245, 12, 536, 12, 1350, 304, 267, 291, 14, 600, 275, 1233, 267, 291, 14, 1188, 275, 1245, 267, 291, 14, 354, 275, 536, 267, 291, 14, 1365, 275, 1350, 339, 347, 636, 495, 721, 277, 304, 267, 372, 291, 14, 1188, 199, 199, 318, 5793, 63, 2423, 63, 1971, 8, 69, 304, 272, 408, 272, 6266, 3351, 282, 3906, 1919, 687, 1373, 402, 9978, 4513, 1901, 272, 6020, 1655, 25259, 436, 9635, 461, 14, 339, 3709, 20440, 282, 4465, 3101, 1125, 1233, 12, 15270, 402, 1125, 334, 5783, 340, 6548, 587, 680, 339, 1803, 282, 18023, 6042, 1919, 626, 339, 18851, 402, 4967, 26, 272, 7146, 547, 446, 14031, 701, 314, 1654, 12, 9987, 7037, 370, 282, 6891, 334, 2453, 9, 1919, 272, 15050, 446, 282, 1655, 333, 725, 5865, 3101, 1919, 272, 408, 272, 340, 1228, 8, 69, 12, 653, 11378, 17692, 304, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 600, 12, 325, 14, 1188, 12, 325, 14, 354, 12, 283, 78, 3596, 358, 272, 916, 1228, 8, 69, 12, 738, 11378, 17692, 304, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 600, 12, 325, 14, 1188, 12, 325, 14, 354, 12, 283, 85, 3596, 358, 272, 916, 1228, 8, 69, 12, 15050, 304, 267, 1233, 275, 325, 14, 1310, 14, 1205, 63, 600, 267, 340, 1233, 508, 7901, 503, 1233, 508, 959, 996, 503, 1233, 508, 24046, 26, 288, 327, 2435, 440, 1911, 288, 1499, 275, 283, 33, 1804, 1563, 2435, 365, 5544, 18735, 3530, 267, 916, 1233, 508, 959, 966, 503, 1233, 508, 959, 2905, 503, 1233, 508, 959, 1020, 26, 288, 327, 2435, 2653, 288, 1499, 275, 283, 10924, 1990, 282, 7937, 2784, 1950, 1125, 3530, 267, 916, 1233, 508, 6891, 26, 288, 327, 5007, 1125, 14, 366, 324, 889, 4052, 370, 886, 14, 288, 1499, 275, 283, 2493, 5007, 1125, 8920, 315, 314, 1804, 1563, 2435, 3530, 267, 587, 26, 288, 1499, 275, 283, 2493, 625, 22586, 1125, 8920, 3530, 267, 372, 653, 285, 30498, 1726, 8, 69, 14, 1310, 14, 1205, 63, 600, 12, 1499, 12, 283, 12815, 297, 283, 1200, 358, 272, 587, 26, 267, 372, 653, 285, 30498, 1726, 2801, 17, 12, 620, 8, 69, 395, 283, 1726, 297, 283, 5187, 358, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
biezhihua/FrescoStudy
run_comparison.py
53
10328
#!/usr/bin/env python # This file provided by Facebook is for non-commercial testing and evaluation # purposes only. Facebook reserves all rights not expressly granted. # # 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 # FACEBOOK 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. """ This script builds and runs the comparison app, switching from one library to the next, taking measurements as it goes, and outputs the results neatly. Due to a bug, you must specify the CPU when running the script. Use -c armeabi-v7a for most phones. Use -c armeabi for ARM v5-6 phones, or -c arm64 for 64-bit ARM devices. Some emulators and tablets will need -c x86. To select a subset of the libraries, use the -s option with a space-separated list. Available options are fresco, fresco-okhttp, glide, volley, drawee-volley, uil, and picasso. To see the comparison for only network or local images, use -d network or -d local. Note that Volley does not support local images, and fresco and fresco-okhttp are identical for local images. Results will vary based on the the device, the network conditions and the mix of images available. Example: to run a local-only comparison of fresco and picasso on an ARM v7 device: ./run_comparison.py -s fresco picasso -d local -c armeabi-v7a """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import glob import os import re import tempfile from collections import namedtuple from subprocess import check_call, PIPE, Popen """ List of tested libraries """ TESTS = ( 'fresco', 'fresco-okhttp', 'glide', 'picasso', 'uil', 'volley', 'drawee-volley' ) TEST_SOURCES = ( 'network', 'local' ) ABIS = ( 'arm64-v8a', 'armeabi', 'armeabi-v7a', 'x86', 'x86_64' ) """ Appends test class name to method name """ TEST_PATTERN = 'test{}{}' """ Named tuple containing relevant numbers reported by a test """ Stats = namedtuple('Stats', [ 'success_wait_times', 'failure_wait_times', 'cancellation_wait_times', 'java_heap_sizes', 'native_heap_sizes', 'skipped_frames']) def parse_args(): parser = argparse.ArgumentParser( description='Runs comparison test and processes results') parser.add_argument('-s', '--scenarios', choices=TESTS, nargs='+') parser.add_argument('-d', '--sources', choices=TEST_SOURCES, nargs='+') parser.add_argument('-c', '--cpu', choices=ABIS, required=True) return parser.parse_args() def start_subprocess(command, **kwargs): """ Starts subprocess after printing command to stdout. """ return Popen(command.split(), **kwargs) def run_command(command): """ Runs given command and waits for it to terminate. Prints the command to stdout and redirects its output to /dev/null. """ with open('/dev/null', 'w') as devnull: check_call(command.split(), stdout=devnull, stderr=devnull) def gradle(*tasks): """ Runs given gradle tasks """ if tasks: run_command('./gradlew {}'.format(" ".join(tasks))) def adb(command): """ Runs adb command - arguments are given as single string""" run_command('adb {}'.format(command)) def install_apks(abi): """ Installs comparison app and test apks """ print("Installing comparison app...") gradle(':samples:comparison:assembleDebug', ':samples:comparison:assembleDebugAndroidTest') adb('uninstall com.facebook.samples.comparison') adb('uninstall com.facebook.samples.comparison.test') cmd = ('install -r samples/comparison/build/outputs/apk/comparison-' '{}-debug.apk'.format(abi)) adb(cmd) adb('install -r samples/comparison/build/outputs/apk/' 'comparison-debug-androidTest-unaligned.apk') class ComparisonTest: """ Comparison test case """ def __init__( self, method_name, class_name='com.facebook.samples.comparison.test.ScrollTest', test_package='com.facebook.samples.comparison.test', test_runner='android.test.InstrumentationTestRunner'): self.method_name = method_name self.class_name = class_name self.test_package = test_package self.test_runner = test_runner def __call__(self): """ Executes test case and captures logcat output """ adb('logcat -c') with tempfile.TemporaryFile() as logcat_file: logcat_reader = start_subprocess( 'adb logcat', stdout=logcat_file) adb('shell am instrument -w -e class {}#{} {}/{}'.format( self.class_name, self.method_name, self.test_package, self.test_runner)) logcat_reader.terminate() logcat_reader.wait() logcat_file.seek(0) self.logcat = logcat_file.readlines() def get_float_from_logs(regex, logs): pattern = re.compile(regex) return [float(match.group(1)) for match in map(pattern.search, logs) if match] def get_int_from_logs(regex, logs): pattern = re.compile(regex) return [int(match.group(1)) for match in map(pattern.search, logs) if match] def get_stats(logs): pattern = re.compile("""]: loaded after (\d+) ms""") success_wait_times = [ int(match.group(1)) for match in map(pattern.search, logs) if match] pattern = re.compile("""]: failed after (\d+) ms""") failure_wait_times = [ int(match.group(1)) for match in map(pattern.search, logs) if match] pattern = re.compile("""]: cancelled after (\d+) ms""") cancellation_wait_times = [ int(match.group(1)) for match in map(pattern.search, logs) if match] pattern = re.compile("""\s+(\d+.\d+) MB Java""") java_heap_sizes = [ float(match.group(1)) for match in map(pattern.search, logs) if match] pattern = re.compile("""\s+(\d+.\d+) MB native""") native_heap_sizes = [ float(match.group(1)) for match in map(pattern.search, logs) if match] pattern = re.compile("""Skipped (\d+) frames! The application may be""") skipped_frames = [ int(match.group(1)) for match in map(pattern.search, logs) if match] return Stats( success_wait_times, failure_wait_times, cancellation_wait_times, java_heap_sizes, native_heap_sizes, skipped_frames) def print_stats(stats): successes = len(stats.success_wait_times) cancellations = len(stats.cancellation_wait_times) failures = len(stats.failure_wait_times) total_count = successes + cancellations + failures if total_count == 0: print("Unable to read logs.") return total_wait_time = ( sum(stats.success_wait_times) + sum(stats.cancellation_wait_times) + sum(stats.failure_wait_times)) avg_wait_time = float(total_wait_time) / total_count max_java_heap = max(stats.java_heap_sizes) max_native_heap = max(stats.native_heap_sizes) total_skipped_frames = sum(stats.skipped_frames) print("Average wait time = {0:.1f}".format(avg_wait_time)) print("Successful requests = {}".format(successes)) print("Failures = {}".format(failures)) print("Cancellations = {}".format(cancellations)) print("Max java heap = {0:.1f}".format(max_java_heap)) print("Max native heap = {0:.1f}".format(max_native_heap)) print("Total skipped frames = {}".format(total_skipped_frames)) def get_test_name(option_name, source_name): return TEST_PATTERN.format( ''.join(word.capitalize() for word in option_name.split('-')), source_name.capitalize()) def valid_scenario(scenario_name, source_name): return source_name != 'local' or (scenario_name != 'volley' and scenario_name != 'drawee-volley') def list_producers(): sdir = os.path.dirname(os.path.abspath(__file__)) producer_path = '%s/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/*Producer.java' % sdir files = glob.glob(producer_path) return [f.split('.')[0].split('/')[-1] for f in files] def print_fresco_perf_line(margin, name, times): length = len(times) if length == 0: return print("%s: %d requests, avg %d" % (name.rjust(margin), length, float(sum(times)) / length)) def print_fresco_perf(logs): producers = list_producers() margin = max([len(p) for p in producers]) requests = get_int_from_logs(""".*RequestLoggingListener.*onRequestSuccess.*elapsedTime:\s(\d+).*""", logs) print_fresco_perf_line(margin, 'Total', requests) for producer in producers: queue = get_int_from_logs(".*onProducerFinishWithSuccess.*producer:\s%s.*queueTime=(\d+).*" % producer, logs) print_fresco_perf_line(margin, '%s queue' % producer, queue) times = get_int_from_logs(".*onProducerFinishWithSuccess.*producer:\s%s.*elapsedTime:\s(\d+).*" % producer, logs) print_fresco_perf_line(margin, producer, times) def main(): args = parse_args() scenarios = [] sources = [] if args.scenarios: scenarios = args.scenarios else: scenarios = TESTS if args.sources: sources = args.sources else: sources = TEST_SOURCES install_apks(args.cpu) for source_name in sources: for scenario_name in scenarios: if valid_scenario(scenario_name, source_name): print() print('Testing {} {}'.format(scenario_name, source_name)) print(get_test_name(scenario_name, source_name)) test = ComparisonTest(get_test_name(scenario_name, source_name)) test() stats = get_stats(test.logcat) print_stats(stats) if scenario_name[:6] == 'fresco': print() print_fresco_perf(test.logcat) if __name__ == "__main__": main()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 961, 570, 2741, 701, 27107, 365, 367, 2222, 13, 957, 23012, 5343, 436, 11735, 199, 3, 12901, 1454, 14, 221, 27107, 295, 20603, 1006, 4481, 440, 4056, 590, 10009, 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, 199, 3, 481, 4121, 21155, 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, 4141, 14, 199, 199, 624, 199, 2765, 2884, 14723, 436, 7858, 314, 9132, 1145, 12, 31620, 687, 1373, 3555, 370, 314, 2163, 12, 199, 502, 17443, 32619, 465, 652, 13538, 12, 436, 4704, 314, 2058, 1279, 292, 590, 14, 199, 199, 36, 310, 370, 282, 6519, 12, 1265, 1471, 4165, 314, 11952, 1380, 3879, 314, 2884, 14, 199, 6119, 446, 67, 601, 278, 14677, 13, 86, 23, 65, 367, 4750, 3945, 4548, 14, 3645, 446, 67, 601, 278, 14677, 367, 27155, 373, 21, 13, 22, 3945, 4548, 12, 503, 199, 13, 67, 30701, 772, 367, 5049, 13, 2075, 27155, 7256, 14, 6601, 17423, 2750, 436, 1817, 1086, 911, 1929, 446, 67, 671, 1184, 14, 199, 199, 1378, 3504, 282, 10026, 402, 314, 8363, 12, 675, 314, 446, 83, 945, 543, 282, 199, 2638, 13, 12794, 769, 14, 23840, 1511, 787, 289, 470, 331, 12, 289, 470, 331, 13, 745, 1014, 12, 199, 71, 8409, 12, 5236, 15515, 12, 5954, 1024, 13, 5650, 15515, 12, 399, 382, 12, 436, 26559, 15923, 14, 199, 199, 1378, 1937, 314, 9132, 367, 1454, 2784, 503, 2257, 5935, 12, 675, 446, 68, 2784, 503, 446, 68, 2257, 14, 199, 199, 7443, 626, 16171, 15515, 1630, 440, 2291, 2257, 5935, 12, 436, 289, 470, 331, 436, 289, 470, 331, 13, 745, 1014, 199, 1530, 13130, 367, 2257, 5935, 14, 199, 199, 6579, 911, 17083, 4079, 641, 314, 314, 2243, 12, 314, 2784, 3704, 436, 314, 13667, 402, 5935, 2808, 14, 199, 199, 9846, 26, 370, 1255, 282, 2257, 13, 2118, 9132, 402, 289, 470, 331, 436, 26559, 15923, 641, 376, 27155, 373, 23, 2243, 26, 199, 13186, 1065, 63, 8547, 14, 647, 446, 83, 289, 470, 331, 26559, 15923, 446, 68, 2257, 446, 67, 601, 278, 14677, 13, 86, 23, 65, 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, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 7534, 199, 646, 5739, 199, 646, 747, 199, 646, 295, 199, 646, 5549, 199, 199, 504, 5055, 492, 12863, 199, 504, 3873, 492, 1104, 63, 1250, 12, 22773, 12, 13995, 199, 199, 624, 3820, 402, 12470, 8363, 408, 199, 7569, 275, 334, 272, 283, 70, 470, 331, 297, 272, 283, 70, 470, 331, 13, 745, 1014, 297, 272, 283, 71, 8409, 297, 272, 283, 12475, 15923, 297, 272, 283, 85, 382, 297, 272, 283, 5650, 15515, 297, 272, 283, 5485, 1024, 13, 5650, 15515, 7, 199, 9, 199, 199, 2864, 63, 25744, 275, 334, 272, 283, 1200, 297, 272, 283, 1832, 7, 199, 9, 199, 199, 1217, 1311, 275, 334, 272, 283, 5362, 772, 13, 86, 24, 65, 297, 272, 283, 285, 278, 14677, 297, 272, 283, 285, 278, 14677, 13, 86, 23, 65, 297, 272, 283, 88, 1184, 297, 272, 283, 88, 1184, 63, 772, 7, 199, 9, 421, 199, 624, 4693, 3198, 511, 1021, 536, 370, 1083, 536, 408, 199, 2864, 63, 10764, 275, 283, 396, 2440, 2440, 7, 199, 199, 624, 16198, 2008, 3035, 12082, 5579, 14581, 701, 282, 511, 408, 199, 8257, 275, 12863, 360, 8257, 297, 359, 272, 283, 3742, 63, 2573, 63, 4508, 297, 272, 283, 5328, 63, 2573, 63, 4508, 297, 272, 283, 6406, 2212, 63, 2573, 63, 4508, 297, 272, 283, 6138, 63, 12492, 63, 7723, 297, 272, 283, 6106, 63, 12492, 63, 7723, 297, 272, 283, 11962, 63, 8444, 1105, 421, 199, 318, 2198, 63, 589, 837, 272, 1798, 275, 7534, 14, 10730, 8, 267, 1369, 534, 16291, 9132, 511, 436, 10358, 2058, 358, 272, 1798, 14, 525, 63, 2094, 3654, 83, 297, 2850, 32225, 297, 3415, 29, 7569, 12, 9237, 534, 13854, 272, 1798, 14, 525, 63, 2094, 3654, 68, 297, 2850, 4553, 297, 3415, 29, 2864, 63, 25744, 12, 9237, 534, 13854, 272, 1798, 14, 525, 63, 2094, 3654, 67, 297, 2850, 3541, 297, 3415, 29, 1217, 1311, 12, 1415, 29, 549, 9, 272, 372, 1798, 14, 1122, 63, 589, 342, 421, 199, 318, 1343, 63, 5781, 8, 1531, 12, 1011, 958, 304, 272, 408, 7707, 83, 3873, 2410, 16116, 1414, 370, 3839, 14, 408, 272, 372, 13995, 8, 1531, 14, 1294, 1062, 1011, 958, 9, 421, 199, 318, 1255, 63, 1531, 8, 1531, 304, 272, 408, 23773, 1627, 1414, 436, 14442, 1405, 367, 652, 370, 15095, 14, 267, 9101, 83, 314, 1414, 370, 3839, 436, 17784, 2399, 1072, 370, 1182, 2374, 15, 2307, 14, 408, 272, 543, 1551, 2336, 2374, 15, 2307, 297, 283, 87, 358, 465, 4866, 2307, 26, 267, 1104, 63, 1250, 8, 1531, 14, 1294, 1062, 3839, 29, 19778, 12, 4635, 29, 19778, 9, 421, 199, 318, 1999, 3011, 2031, 5054, 304, 272, 408, 23773, 1627, 1999, 3011, 6527, 408, 272, 340, 6527, 26, 267, 1255, 63, 1531, 17371, 926, 3011, 87, 9499, 908, 480, 3680, 904, 8, 5054, 1724, 421, 199, 318, 28173, 8, 1531, 304, 272, 408, 23773, 28173, 1414, 446, 2368, 787, 1627, 465, 2849, 1059, 624, 272, 1255, 63, 1531, 360, 13741, 9499, 908, 8, 1531, 430, 421, 199, 318, 3907, 63, 439, 6080, 8, 14677, 304, 272, 408, 13276, 83, 9132, 1145, 436, 511, 282, 27323, 408, 272, 870, 480, 31376, 9132, 1145, 12594, 272, 1999, 3011, 6176, 3356, 26, 8547, 26, 21263, 7084, 297, 1779, 7596, 3356, 26, 8547 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 961, 570, 2741, 701, 27107, 365, 367, 2222, 13, 957, 23012, 5343, 436, 11735, 199, 3, 12901, 1454, 14, 221, 27107, 295, 20603, 1006, 4481, 440, 4056, 590, 10009, 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, 199, 3, 481, 4121, 21155, 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, 4141, 14, 199, 199, 624, 199, 2765, 2884, 14723, 436, 7858, 314, 9132, 1145, 12, 31620, 687, 1373, 3555, 370, 314, 2163, 12, 199, 502, 17443, 32619, 465, 652, 13538, 12, 436, 4704, 314, 2058, 1279, 292, 590, 14, 199, 199, 36, 310, 370, 282, 6519, 12, 1265, 1471, 4165, 314, 11952, 1380, 3879, 314, 2884, 14, 199, 6119, 446, 67, 601, 278, 14677, 13, 86, 23, 65, 367, 4750, 3945, 4548, 14, 3645, 446, 67, 601, 278, 14677, 367, 27155, 373, 21, 13, 22, 3945, 4548, 12, 503, 199, 13, 67, 30701, 772, 367, 5049, 13, 2075, 27155, 7256, 14, 6601, 17423, 2750, 436, 1817, 1086, 911, 1929, 446, 67, 671, 1184, 14, 199, 199, 1378, 3504, 282, 10026, 402, 314, 8363, 12, 675, 314, 446, 83, 945, 543, 282, 199, 2638, 13, 12794, 769, 14, 23840, 1511, 787, 289, 470, 331, 12, 289, 470, 331, 13, 745, 1014, 12, 199, 71, 8409, 12, 5236, 15515, 12, 5954, 1024, 13, 5650, 15515, 12, 399, 382, 12, 436, 26559, 15923, 14, 199, 199, 1378, 1937, 314, 9132, 367, 1454, 2784, 503, 2257, 5935, 12, 675, 446, 68, 2784, 503, 446, 68, 2257, 14, 199, 199, 7443, 626, 16171, 15515, 1630, 440, 2291, 2257, 5935, 12, 436, 289, 470, 331, 436, 289, 470, 331, 13, 745, 1014, 199, 1530, 13130, 367, 2257, 5935, 14, 199, 199, 6579, 911, 17083, 4079, 641, 314, 314, 2243, 12, 314, 2784, 3704, 436, 314, 13667, 402, 5935, 2808, 14, 199, 199, 9846, 26, 370, 1255, 282, 2257, 13, 2118, 9132, 402, 289, 470, 331, 436, 26559, 15923, 641, 376, 27155, 373, 23, 2243, 26, 199, 13186, 1065, 63, 8547, 14, 647, 446, 83, 289, 470, 331, 26559, 15923, 446, 68, 2257, 446, 67, 601, 278, 14677, 13, 86, 23, 65, 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, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 7534, 199, 646, 5739, 199, 646, 747, 199, 646, 295, 199, 646, 5549, 199, 199, 504, 5055, 492, 12863, 199, 504, 3873, 492, 1104, 63, 1250, 12, 22773, 12, 13995, 199, 199, 624, 3820, 402, 12470, 8363, 408, 199, 7569, 275, 334, 272, 283, 70, 470, 331, 297, 272, 283, 70, 470, 331, 13, 745, 1014, 297, 272, 283, 71, 8409, 297, 272, 283, 12475, 15923, 297, 272, 283, 85, 382, 297, 272, 283, 5650, 15515, 297, 272, 283, 5485, 1024, 13, 5650, 15515, 7, 199, 9, 199, 199, 2864, 63, 25744, 275, 334, 272, 283, 1200, 297, 272, 283, 1832, 7, 199, 9, 199, 199, 1217, 1311, 275, 334, 272, 283, 5362, 772, 13, 86, 24, 65, 297, 272, 283, 285, 278, 14677, 297, 272, 283, 285, 278, 14677, 13, 86, 23, 65, 297, 272, 283, 88, 1184, 297, 272, 283, 88, 1184, 63, 772, 7, 199, 9, 421, 199, 624, 4693, 3198, 511, 1021, 536, 370, 1083, 536, 408, 199, 2864, 63, 10764, 275, 283, 396, 2440, 2440, 7, 199, 199, 624, 16198, 2008, 3035, 12082, 5579, 14581, 701, 282, 511, 408, 199, 8257, 275, 12863, 360, 8257, 297, 359, 272, 283, 3742, 63, 2573, 63, 4508, 297, 272, 283, 5328, 63, 2573, 63, 4508, 297, 272, 283, 6406, 2212, 63, 2573, 63, 4508, 297, 272, 283, 6138, 63, 12492, 63, 7723, 297, 272, 283, 6106, 63, 12492, 63, 7723, 297, 272, 283, 11962, 63, 8444, 1105, 421, 199, 318, 2198, 63, 589, 837, 272, 1798, 275, 7534, 14, 10730, 8, 267, 1369, 534, 16291, 9132, 511, 436, 10358, 2058, 358, 272, 1798, 14, 525, 63, 2094, 3654, 83, 297, 2850, 32225, 297, 3415, 29, 7569, 12, 9237, 534, 13854, 272, 1798, 14, 525, 63, 2094, 3654, 68, 297, 2850, 4553, 297, 3415, 29, 2864, 63, 25744, 12, 9237, 534, 13854, 272, 1798, 14, 525, 63, 2094, 3654, 67, 297, 2850, 3541, 297, 3415, 29, 1217, 1311, 12, 1415, 29, 549, 9, 272, 372, 1798, 14, 1122, 63, 589, 342, 421, 199, 318, 1343, 63, 5781, 8, 1531, 12, 1011, 958, 304, 272, 408, 7707, 83, 3873, 2410, 16116, 1414, 370, 3839, 14, 408, 272, 372, 13995, 8, 1531, 14, 1294, 1062, 1011, 958, 9, 421, 199, 318, 1255, 63, 1531, 8, 1531, 304, 272, 408, 23773, 1627, 1414, 436, 14442, 1405, 367, 652, 370, 15095, 14, 267, 9101, 83, 314, 1414, 370, 3839, 436, 17784, 2399, 1072, 370, 1182, 2374, 15, 2307, 14, 408, 272, 543, 1551, 2336, 2374, 15, 2307, 297, 283, 87, 358, 465, 4866, 2307, 26, 267, 1104, 63, 1250, 8, 1531, 14, 1294, 1062, 3839, 29, 19778, 12, 4635, 29, 19778, 9, 421, 199, 318, 1999, 3011, 2031, 5054, 304, 272, 408, 23773, 1627, 1999, 3011, 6527, 408, 272, 340, 6527, 26, 267, 1255, 63, 1531, 17371, 926, 3011, 87, 9499, 908, 480, 3680, 904, 8, 5054, 1724, 421, 199, 318, 28173, 8, 1531, 304, 272, 408, 23773, 28173, 1414, 446, 2368, 787, 1627, 465, 2849, 1059, 624, 272, 1255, 63, 1531, 360, 13741, 9499, 908, 8, 1531, 430, 421, 199, 318, 3907, 63, 439, 6080, 8, 14677, 304, 272, 408, 13276, 83, 9132, 1145, 436, 511, 282, 27323, 408, 272, 870, 480, 31376, 9132, 1145, 12594, 272, 1999, 3011, 6176, 3356, 26, 8547, 26, 21263, 7084, 297, 1779, 7596, 3356, 26, 8547, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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from datetime import datetime from flask.ext.login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from . import db, login_manager def create_only_slug(form): if form.slug.data == "": slug = str(datetime.now())[0:10] + "-" + str(uuid.uuid4())[0:4] else: slug = form.slug.data return slug # 用户数据模型 class User(UserMixin, db.Document): """ admin test count User(username="admin", password="admin", email="admin@admin.com", url="admin.admin",screenName="admin", group="administrator").save() """ username = db.StringField(max_length=25, required=True, unique=True) password = db.StringField() password_hash = db.StringField(max_length=128, required=True) email = db.EmailField(required=True, unique=True, default="") url = db.StringField(max_length=30, default="") screenName = db.StringField(max_length=25, default="") group = db.StringField(default='subscriber', choices=["administrator", "editor", "subscriber"]) meta = { 'indexes': [ 'username', 'email' ] } def clean(self): self.password_hash = generate_password_hash(self.password) self.password = None def verify_password(self, password): return check_password_hash(self.password_hash, password) def set_and_save(self, form): self.username = form.username.data self.email = form.email.data self.password = form.password.data self.url = form.url.data self.screenName = form.screenName.data self.group = form.group.data self.save() @login_manager.user_loader def user_load(user_id): return User.objects(id=user_id).first() # 评论数据模型 class Comment(db.EmbeddedDocument): """ comment1 = Comment(author_name="lleohao", content="good post") """ author_name = db.StringField(required=True) author_email = db.StringField() author_url = db.StringField() created = db.DateTimeField(default=datetime.now, required=True) content = db.StringField(required=True) # 分类数据模型 class Category(db.Document): """ Category(name="默认分类", slug="normal", description="这是系统默认的分类") Category(name="Python", slug="python", description="").save() """ name = db.StringField(required=True, unique=True) slug = db.StringField(required=True, unique=True) description = db.StringField() meta = { 'indexes': [ 'name', '$name', '#name' ] } def set_val(self, form): self.name = form.name.data self.slug = form.slug.data self.description = form.description.data # 内容数据模型 class Content(db.DynamicDocument): """ post = Content(title="test post", slug="test", status=True, type="post") """ created = db.DateTimeField(default=datetime.now, required=True) title = db.StringField(max_length=255, required=True) slug = db.StringField(max_length=255, required=True, unique=True) category = db.ReferenceField(Category) tags = db.ListField(db.StringField()) md_text = db.StringField() html_text = db.StringField() description = db.StringField() author = db.StringField() status = db.BooleanField(default=False) type = db.StringField(choices=["post", "page"]) comments = db.ListField(db.EmbeddedDocumentField(Comment)) meta = { 'indexes': [ 'status', 'category', 'type' ], 'ordering': [ '-created' ] } def set_val(self, form, author, html_text, type): self.created = datetime.now() self.title = form.title.data self.slug = create_only_slug(form) self.md_text = form.content.data self.html_text = html_text self.author = author if type == 'post': if form.tags.data is not "": self.tags = form.tags.data.split(",") else: self.tags = [] self.category = Category.objects(slug=form.category.data).first() else: self.tags = None self.category = None def clean(self): op = Options.objects().first() self.description = op.title + " - " + op.description + " - " + self.md_text[0:150] # 网站设置属性数据模型 class Options(db.Document): url = db.StringField(required=True) title = db.StringField(required=True) keyword = db.StringField() description = db.StringField() duoshuo_name = db.StringField(default="") # 做为自增长 id 用 # 暂不需要 comment_index = db.IntField(default=0, required=True) content_index = db.IntField(default=0) def set_and_save(self, form): self.url = form.url.data self.title = form.title.data self.keyword = form.keyword.data self.description = form.description.data self.duoshuo_name = form.duoshuo_name.data self.save()
apache-2.0
[ 3, 2803, 26, 2774, 13, 24, 199, 646, 5377, 199, 504, 2197, 492, 2197, 199, 199, 504, 7209, 14, 832, 14, 2886, 492, 2876, 4256, 199, 504, 10380, 14, 4416, 492, 3550, 63, 2060, 63, 2227, 12, 1104, 63, 2060, 63, 2227, 199, 199, 504, 1275, 492, 1592, 12, 4676, 63, 2609, 421, 199, 318, 1218, 63, 2118, 63, 5464, 8, 964, 304, 272, 340, 1824, 14, 5464, 14, 576, 508, 10812, 267, 8889, 275, 620, 8, 2083, 14, 2131, 18756, 16, 26, 709, 61, 435, 17155, 435, 620, 8, 2580, 14, 2580, 20, 18756, 16, 26, 20, 61, 272, 587, 26, 267, 8889, 275, 1824, 14, 5464, 14, 576, 272, 372, 8889, 421, 199, 3, 221, 22445, 22730, 29887, 162, 9809, 199, 533, 2876, 8, 1899, 4256, 12, 1592, 14, 5564, 304, 272, 408, 272, 4628, 511, 2338, 272, 2876, 8, 2473, 628, 2113, 401, 2505, 628, 2113, 401, 3031, 628, 2113, 32, 2113, 14, 957, 401, 1166, 628, 2113, 14, 2113, 401, 5410, 985, 628, 2113, 401, 1572, 628, 2113, 14710, 3471, 2117, 342, 272, 408, 272, 3434, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 821, 12, 1415, 29, 549, 12, 3747, 29, 549, 9, 272, 2505, 275, 1592, 14, 14912, 342, 272, 2505, 63, 2227, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 3933, 12, 1415, 29, 549, 9, 272, 3031, 275, 1592, 14, 16577, 8, 2427, 29, 549, 12, 3747, 29, 549, 12, 849, 18413, 272, 1166, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 1216, 12, 849, 18413, 272, 6426, 985, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 821, 12, 849, 18413, 272, 1572, 275, 1592, 14, 14912, 8, 885, 534, 17256, 297, 3415, 6270, 2113, 14710, 401, 298, 7515, 401, 298, 17256, 3135, 339, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 2473, 297, 288, 283, 2123, 7, 267, 1622, 272, 789, 339, 347, 3633, 8, 277, 304, 267, 291, 14, 2060, 63, 2227, 275, 3550, 63, 2060, 63, 2227, 8, 277, 14, 2060, 9, 267, 291, 14, 2060, 275, 488, 339, 347, 4911, 63, 2060, 8, 277, 12, 2505, 304, 267, 372, 1104, 63, 2060, 63, 2227, 8, 277, 14, 2060, 63, 2227, 12, 2505, 9, 339, 347, 663, 63, 460, 63, 2117, 8, 277, 12, 1824, 304, 267, 291, 14, 2473, 275, 1824, 14, 2473, 14, 576, 267, 291, 14, 2123, 275, 1824, 14, 2123, 14, 576, 267, 291, 14, 2060, 275, 1824, 14, 2060, 14, 576, 267, 291, 14, 633, 275, 1824, 14, 633, 14, 576, 267, 291, 14, 5410, 985, 275, 1824, 14, 5410, 985, 14, 576, 267, 291, 14, 923, 275, 1824, 14, 923, 14, 576, 267, 291, 14, 2117, 342, 421, 199, 32, 2886, 63, 2609, 14, 751, 63, 3422, 199, 318, 922, 63, 912, 8, 751, 63, 344, 304, 272, 372, 2876, 14, 1462, 8, 344, 29, 751, 63, 344, 680, 2246, 342, 421, 199, 3, 221, 8400, 227, 14082, 119, 22730, 29887, 162, 9809, 199, 533, 6819, 8, 697, 14, 27395, 5564, 304, 272, 408, 272, 3721, 17, 275, 6819, 8, 2502, 63, 354, 628, 76, 274, 79, 2411, 79, 401, 1564, 628, 8302, 2963, 531, 272, 408, 272, 4132, 63, 354, 275, 1592, 14, 14912, 8, 2427, 29, 549, 9, 272, 4132, 63, 2123, 275, 1592, 14, 14912, 342, 272, 4132, 63, 633, 275, 1592, 14, 14912, 342, 272, 2737, 275, 1592, 14, 4626, 8, 885, 29, 2083, 14, 2131, 12, 1415, 29, 549, 9, 272, 1564, 275, 1592, 14, 14912, 8, 2427, 29, 549, 9, 421, 199, 3, 7094, 231, 229, 9474, 120, 22730, 29887, 162, 9809, 199, 533, 13573, 8, 697, 14, 5564, 304, 272, 408, 272, 13573, 8, 354, 628, 28931, 247, 14082, 98, 21514, 9474, 120, 401, 8889, 628, 3302, 401, 1369, 628, 13201, 248, 9729, 27842, 120, 9360, 254, 28931, 247, 14082, 98, 8106, 21514, 9474, 120, 531, 272, 13573, 8, 354, 628, 4718, 401, 8889, 628, 1548, 401, 1369, 9287, 680, 2117, 342, 272, 408, 272, 536, 275, 1592, 14, 14912, 8, 2427, 29, 549, 12, 3747, 29, 549, 9, 272, 8889, 275, 1592, 14, 14912, 8, 2427, 29, 549, 12, 3747, 29, 549, 9, 272, 1369, 275, 1592, 14, 14912, 342, 339, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 354, 297, 288, 4505, 354, 297, 288, 3943, 354, 7, 267, 1622, 272, 789, 339, 347, 663, 63, 637, 8, 277, 12, 1824, 304, 267, 291, 14, 354, 275, 1824, 14, 354, 14, 576, 267, 291, 14, 5464, 275, 1824, 14, 5464, 14, 576, 267, 291, 14, 1802, 275, 1824, 14, 1802, 14, 576, 421, 199, 3, 7094, 229, 228, 10270, 118, 22730, 29887, 162, 9809, 199, 533, 6646, 8, 697, 14, 14451, 5564, 304, 272, 408, 272, 2963, 275, 6646, 8, 1213, 628, 396, 2963, 401, 8889, 628, 396, 401, 2004, 29, 549, 12, 730, 628, 1932, 531, 272, 408, 272, 2737, 275, 1592, 14, 4626, 8, 885, 29, 2083, 14, 2131, 12, 1415, 29, 549, 9, 272, 2538, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 2299, 12, 1415, 29, 549, 9, 272, 8889, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 2299, 12, 1415, 29, 549, 12, 3747, 29, 549, 9, 272, 4637, 275, 1592, 14, 5083, 792, 8, 7841, 9, 272, 3762, 275, 1592, 14, 1296, 792, 8, 697, 14, 14912, 1012, 272, 6128, 63, 505, 275, 1592, 14, 14912, 342, 272, 3517, 63, 505, 275, 1592, 14, 14912, 342, 272, 1369, 275, 1592, 14, 14912, 342, 272, 4132, 275, 1592, 14, 14912, 342, 272, 2004, 275, 1592, 14, 5036, 8, 885, 29, 797, 9, 272, 730, 275, 1592, 14, 14912, 8, 4577, 6270, 1932, 401, 298, 1606, 3135, 272, 6786, 275, 1592, 14, 1296, 792, 8, 697, 14, 27395, 5564, 792, 8, 7488, 430, 272, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 1205, 297, 288, 283, 3710, 297, 288, 283, 466, 7, 267, 2156, 267, 283, 7128, 356, 359, 288, 2475, 3966, 7, 267, 1622, 272, 789, 339, 347, 663, 63, 637, 8, 277, 12, 1824, 12, 4132, 12, 3517, 63, 505, 12, 730, 304, 267, 291, 14, 3966, 275, 2197, 14 ]
[ 2803, 26, 2774, 13, 24, 199, 646, 5377, 199, 504, 2197, 492, 2197, 199, 199, 504, 7209, 14, 832, 14, 2886, 492, 2876, 4256, 199, 504, 10380, 14, 4416, 492, 3550, 63, 2060, 63, 2227, 12, 1104, 63, 2060, 63, 2227, 199, 199, 504, 1275, 492, 1592, 12, 4676, 63, 2609, 421, 199, 318, 1218, 63, 2118, 63, 5464, 8, 964, 304, 272, 340, 1824, 14, 5464, 14, 576, 508, 10812, 267, 8889, 275, 620, 8, 2083, 14, 2131, 18756, 16, 26, 709, 61, 435, 17155, 435, 620, 8, 2580, 14, 2580, 20, 18756, 16, 26, 20, 61, 272, 587, 26, 267, 8889, 275, 1824, 14, 5464, 14, 576, 272, 372, 8889, 421, 199, 3, 221, 22445, 22730, 29887, 162, 9809, 199, 533, 2876, 8, 1899, 4256, 12, 1592, 14, 5564, 304, 272, 408, 272, 4628, 511, 2338, 272, 2876, 8, 2473, 628, 2113, 401, 2505, 628, 2113, 401, 3031, 628, 2113, 32, 2113, 14, 957, 401, 1166, 628, 2113, 14, 2113, 401, 5410, 985, 628, 2113, 401, 1572, 628, 2113, 14710, 3471, 2117, 342, 272, 408, 272, 3434, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 821, 12, 1415, 29, 549, 12, 3747, 29, 549, 9, 272, 2505, 275, 1592, 14, 14912, 342, 272, 2505, 63, 2227, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 3933, 12, 1415, 29, 549, 9, 272, 3031, 275, 1592, 14, 16577, 8, 2427, 29, 549, 12, 3747, 29, 549, 12, 849, 18413, 272, 1166, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 1216, 12, 849, 18413, 272, 6426, 985, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 821, 12, 849, 18413, 272, 1572, 275, 1592, 14, 14912, 8, 885, 534, 17256, 297, 3415, 6270, 2113, 14710, 401, 298, 7515, 401, 298, 17256, 3135, 339, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 2473, 297, 288, 283, 2123, 7, 267, 1622, 272, 789, 339, 347, 3633, 8, 277, 304, 267, 291, 14, 2060, 63, 2227, 275, 3550, 63, 2060, 63, 2227, 8, 277, 14, 2060, 9, 267, 291, 14, 2060, 275, 488, 339, 347, 4911, 63, 2060, 8, 277, 12, 2505, 304, 267, 372, 1104, 63, 2060, 63, 2227, 8, 277, 14, 2060, 63, 2227, 12, 2505, 9, 339, 347, 663, 63, 460, 63, 2117, 8, 277, 12, 1824, 304, 267, 291, 14, 2473, 275, 1824, 14, 2473, 14, 576, 267, 291, 14, 2123, 275, 1824, 14, 2123, 14, 576, 267, 291, 14, 2060, 275, 1824, 14, 2060, 14, 576, 267, 291, 14, 633, 275, 1824, 14, 633, 14, 576, 267, 291, 14, 5410, 985, 275, 1824, 14, 5410, 985, 14, 576, 267, 291, 14, 923, 275, 1824, 14, 923, 14, 576, 267, 291, 14, 2117, 342, 421, 199, 32, 2886, 63, 2609, 14, 751, 63, 3422, 199, 318, 922, 63, 912, 8, 751, 63, 344, 304, 272, 372, 2876, 14, 1462, 8, 344, 29, 751, 63, 344, 680, 2246, 342, 421, 199, 3, 221, 8400, 227, 14082, 119, 22730, 29887, 162, 9809, 199, 533, 6819, 8, 697, 14, 27395, 5564, 304, 272, 408, 272, 3721, 17, 275, 6819, 8, 2502, 63, 354, 628, 76, 274, 79, 2411, 79, 401, 1564, 628, 8302, 2963, 531, 272, 408, 272, 4132, 63, 354, 275, 1592, 14, 14912, 8, 2427, 29, 549, 9, 272, 4132, 63, 2123, 275, 1592, 14, 14912, 342, 272, 4132, 63, 633, 275, 1592, 14, 14912, 342, 272, 2737, 275, 1592, 14, 4626, 8, 885, 29, 2083, 14, 2131, 12, 1415, 29, 549, 9, 272, 1564, 275, 1592, 14, 14912, 8, 2427, 29, 549, 9, 421, 199, 3, 7094, 231, 229, 9474, 120, 22730, 29887, 162, 9809, 199, 533, 13573, 8, 697, 14, 5564, 304, 272, 408, 272, 13573, 8, 354, 628, 28931, 247, 14082, 98, 21514, 9474, 120, 401, 8889, 628, 3302, 401, 1369, 628, 13201, 248, 9729, 27842, 120, 9360, 254, 28931, 247, 14082, 98, 8106, 21514, 9474, 120, 531, 272, 13573, 8, 354, 628, 4718, 401, 8889, 628, 1548, 401, 1369, 9287, 680, 2117, 342, 272, 408, 272, 536, 275, 1592, 14, 14912, 8, 2427, 29, 549, 12, 3747, 29, 549, 9, 272, 8889, 275, 1592, 14, 14912, 8, 2427, 29, 549, 12, 3747, 29, 549, 9, 272, 1369, 275, 1592, 14, 14912, 342, 339, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 354, 297, 288, 4505, 354, 297, 288, 3943, 354, 7, 267, 1622, 272, 789, 339, 347, 663, 63, 637, 8, 277, 12, 1824, 304, 267, 291, 14, 354, 275, 1824, 14, 354, 14, 576, 267, 291, 14, 5464, 275, 1824, 14, 5464, 14, 576, 267, 291, 14, 1802, 275, 1824, 14, 1802, 14, 576, 421, 199, 3, 7094, 229, 228, 10270, 118, 22730, 29887, 162, 9809, 199, 533, 6646, 8, 697, 14, 14451, 5564, 304, 272, 408, 272, 2963, 275, 6646, 8, 1213, 628, 396, 2963, 401, 8889, 628, 396, 401, 2004, 29, 549, 12, 730, 628, 1932, 531, 272, 408, 272, 2737, 275, 1592, 14, 4626, 8, 885, 29, 2083, 14, 2131, 12, 1415, 29, 549, 9, 272, 2538, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 2299, 12, 1415, 29, 549, 9, 272, 8889, 275, 1592, 14, 14912, 8, 988, 63, 1267, 29, 2299, 12, 1415, 29, 549, 12, 3747, 29, 549, 9, 272, 4637, 275, 1592, 14, 5083, 792, 8, 7841, 9, 272, 3762, 275, 1592, 14, 1296, 792, 8, 697, 14, 14912, 1012, 272, 6128, 63, 505, 275, 1592, 14, 14912, 342, 272, 3517, 63, 505, 275, 1592, 14, 14912, 342, 272, 1369, 275, 1592, 14, 14912, 342, 272, 4132, 275, 1592, 14, 14912, 342, 272, 2004, 275, 1592, 14, 5036, 8, 885, 29, 797, 9, 272, 730, 275, 1592, 14, 14912, 8, 4577, 6270, 1932, 401, 298, 1606, 3135, 272, 6786, 275, 1592, 14, 1296, 792, 8, 697, 14, 27395, 5564, 792, 8, 7488, 430, 272, 3404, 275, 469, 267, 283, 10116, 356, 359, 288, 283, 1205, 297, 288,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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 ]
fsinfuhh/Bitpoll
bitpoll/settings.py
1
9609
""" Django settings for bitpoll project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) from django.contrib import messages BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/var/www/example.com/media/" MEDIA_ROOT = os.path.join(ROOT_DIR, '_media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://example.com/media/", "http://media.example.com/" MEDIA_URL = '/media/' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/var/www/example.com/static/" STATIC_ROOT = os.path.join(ROOT_DIR, '_static') # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' ALLOWED_HOSTS = [] TEMPLATE_ALLOWABLE_SETTINGS_VALUES = [ 'ALLOW_CUSTOM_SLUGS', 'SITE_NAME', 'DEBUG', 'DEFAULT_RANDOM_SLUG', 'BASE_URL', 'HOME_URL', 'HOME_URL_NAME', 'IMPRINT_TEXT', 'IMPRINT_URL', 'TIME_ZONE', 'REGISTER_ENABLED', 'MAIL_SIGNATURE', 'GROUP_MANAGEMENT', 'PUBLIC_POLLS', 'CALENDAR_ENABLED', ] LOGIN_REDIRECT_URL = "/" LOGIN_URL = '/login/' SITE_NAME = 'Bitpoll' BASE_URL = 'https://bitpoll.mafiasi.de' # Application definition INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django-simple-csp', 'django_markdown', 'widget_tweaks', 'pipeline', 'bitpoll.poll', 'bitpoll.base', 'bitpoll.invitations', 'bitpoll.registration', 'bitpoll.groups', 'bitpoll.caldav', 'django.contrib.admin', 'friendlytagloader', 'encrypted_model_fields', 'django_token_bucket', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django-simple-csp.middleware.csp.CSPMiddleware', ] STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'pipeline.finders.PipelineFinder', ] STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' PIPELINE = { 'STYLESHEETS': { 'base': { 'source_filenames': ( 'css/font-awesome.css', 'scss/main.scss', 'scss/poll.scss' ), 'output_filename': 'css/base.css', }, 'base_print': { 'source_filenames': ( 'css/print.css', ), 'output_filename': 'css/base_print.css', 'extra_context': { 'media': 'print', }, }, 'base_screen': { 'source_filenames': ( 'css/bootstrap.css', 'css/bootstrap-theme.css', # 'css/jquery-range.css', # this belongs to commented out JS class 'scss/form.scss', 'scss/action.scss', 'scss/slider.scss', 'scss/timeinput.scss', 'css/jquery.datetimepicker.css', ), 'output_filename': 'css/base_screen.css', 'extra_context': { 'media': 'screen,projection', }, }, 'poll_edit': { 'source_filenames': ( 'scss/calendar.scss', 'scss/iconpreview.scss', ), 'output_filename': 'css/poll_edit.css', 'extra_context': { 'media': 'screen,projection', }, }, }, 'JAVASCRIPT': { 'base': { 'source_filenames': ( 'js/lib/jquery-3.2.1.js', 'js/lib/bootstrap.js', ), 'output_filename': 'js/base.js', }, 'create_poll': { 'source_filenames': ( 'js/create.js', 'js/slug.js', ), 'output_filename': 'js/index.js', }, 'poll_edit': { 'source_filenames': ( 'js/poll_edit_universal_choices.js', 'js/poll_edit_choices.js', ), 'output_filename': 'js/poll_edit.js', }, 'base_late': { 'source_filenames': ( #'js/lib/jquery-range.min.js', # TODO: is this needet for the numeric polls? 'js/lib/moment-with-locales.min.js', 'js/lib/mousetrap.min.js', 'js/main.js', 'js/util.js', 'js/custom-select.jquery.js', 'js/common.js', 'js/slider.js', 'js/vote.js', 'js/lib/jquery.datetimepicker.full.min.js', ), 'output_filename': 'js/base_late.js', }, }, 'COMPILERS': ( 'libsasscompiler.LibSassCompiler', ), 'CSS_COMPRESSOR': 'pipeline.compressors.NoopCompressor', # TODO 'JS_COMPRESSOR': 'pipeline.compressors.NoopCompressor', # TODO } PIPELINE_ENABLED = False # todo uglfyer mal ansehen ROOT_URLCONF = 'bitpoll.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')] , 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'bitpoll.wsgi.application' # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'TIMEOUT': 60 * 30, 'OPTIONS': { 'MAX_ENTRIES': 1000 } } } # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # User Model AUTH_USER_MODEL = 'base.BitpollUser' CSRF_COOKIE_HTTPONLY = True DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000 # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ LANGUAGE_CODE = 'de-de' TIME_ZONE = 'Europe/Berlin' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ STATIC_PRECOMPILER_ROOT = STATIC_ROOT SASS_PRECISION = 8 ALLOW_CUSTOM_SLUGS = True DEFAULT_RANDOM_SLUG = 'true' # this value is an JS true/false MESSAGE_TAGS = { messages.DEBUG: 'debug', messages.INFO: 'info', messages.SUCCESS: 'success', messages.WARNING: 'warning', messages.ERROR: 'danger', } # Url to the Base Homepage and Text on the Link, leave empty to not use this option HOME_URL = "https://example.com" HOME_URL_NAME = "Dashboard" # Test mail functionality by printing mails to console: # EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # if the imprint URL is not empty use it as an link to the imprint, else use IMPRINT_TEXT IMPRINT_URL = "" IMPRINT_TEXT = """ <h1>Impressum</h1> <p>Text goes here</p> """ LOCALE_PATHS = (os.path.join(ROOT_DIR, 'locale'), ) LANGUAGES = ( ('de', 'Deutsch'), ('en', 'English'), #('fr', 'Français'), ) REGISTER_ENABLED = True GROUP_MANAGEMENT = REGISTER_ENABLED CSP_REPORT_ONLY = True CSP_REPORT_URL = "" MAIL_SIGNATURE = "Bitpoll Team" TEAM_EMAIL = "mail@example.com" PUBLIC_POLLS = True CALENDAR_ENABLED = True CALENDAR_MAX_TOKENS = 2 CALENDAR_FILL_RATE = 500 # The root dir bitpoll appears to be in from the web, as configured in the webserver URL_PREFIX = '' ANTI_SPAM_CHALLENGE_TTL = 60 * 60 * 24 * 7 # Defaults to 7 days from .settings_local import * INSTALLED_APPS += INSTALLED_APPS_LOCAL PIPELINE.update(PIPELINE_LOCAL)
gpl-3.0
[ 624, 199, 9323, 2202, 367, 4546, 6843, 2199, 14, 199, 199, 12706, 701, 283, 1176, 13, 2113, 1343, 1715, 7, 1808, 5634, 413, 14, 25, 14, 199, 199, 1858, 1655, 2556, 641, 642, 570, 12, 1937, 199, 2859, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 11299, 15, 1751, 15, 199, 199, 1858, 314, 2615, 769, 402, 2202, 436, 3932, 1338, 12, 1937, 199, 2859, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 1121, 15, 1751, 15, 199, 624, 199, 199, 646, 747, 199, 199, 3, 6516, 3792, 6272, 314, 2199, 2839, 642, 26, 747, 14, 515, 14, 904, 8, 5825, 63, 3022, 12, 19172, 199, 504, 1639, 14, 2828, 492, 3788, 199, 199, 5825, 63, 3022, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 3460, 493, 29658, 199, 5441, 63, 3022, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 11541, 1333, 199, 199, 3, 27534, 13, 928, 16367, 2202, 446, 625, 83, 10020, 367, 9920, 199, 3, 1666, 4178, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 21232, 15, 13605, 15, 1074, 513, 15, 199, 199, 3, 24964, 10036, 931, 370, 314, 2082, 626, 911, 10266, 922, 13, 19044, 1584, 14, 199, 3, 5679, 26, 3286, 1391, 15, 1544, 15, 2694, 14, 957, 15, 4603, 6687, 199, 13669, 63, 5441, 275, 747, 14, 515, 14, 904, 8, 5441, 63, 3022, 12, 2513, 4603, 358, 199, 199, 3, 2851, 626, 10022, 314, 5898, 19733, 687, 31460, 63, 5441, 14, 4155, 3238, 370, 675, 282, 199, 3, 8520, 14457, 14, 199, 3, 6058, 26, 298, 1014, 921, 2694, 14, 957, 15, 4603, 10665, 298, 1014, 921, 4603, 14, 2694, 14, 957, 6687, 199, 13669, 63, 2632, 275, 1994, 4603, 4805, 199, 199, 3, 24964, 931, 370, 314, 2082, 2955, 1584, 1077, 506, 13736, 370, 14, 199, 3, 7529, 1133, 5324, 7003, 315, 642, 2082, 28225, 27, 3877, 2195, 2955, 1584, 199, 3, 315, 8686, 7, 298, 1986, 6687, 24799, 436, 315, 27815, 9472, 63, 14455, 14, 199, 3, 5679, 26, 3286, 1391, 15, 1544, 15, 2694, 14, 957, 15, 1986, 6687, 199, 10449, 63, 5441, 275, 747, 14, 515, 14, 904, 8, 5441, 63, 3022, 12, 2513, 1986, 358, 199, 199, 3, 2851, 2403, 367, 2955, 1584, 14, 199, 3, 5679, 26, 298, 1014, 921, 2694, 14, 957, 15, 1986, 10665, 298, 1014, 921, 1986, 14, 2694, 14, 957, 6687, 199, 10449, 63, 2632, 275, 1994, 1986, 4805, 199, 199, 17350, 63, 23775, 275, 942, 199, 199, 7433, 63, 12231, 2617, 63, 13931, 63, 15514, 275, 359, 272, 283, 12231, 63, 20519, 63, 4929, 53, 8021, 297, 272, 283, 7917, 63, 2339, 297, 272, 283, 5287, 297, 272, 283, 3472, 63, 27644, 10462, 63, 4929, 10134, 297, 272, 283, 5825, 63, 2632, 297, 272, 283, 9524, 63, 2632, 297, 272, 283, 9524, 63, 2632, 63, 2339, 297, 272, 283, 1469, 21754, 63, 3876, 297, 272, 283, 1469, 21754, 63, 2632, 297, 272, 283, 4961, 63, 15353, 297, 272, 283, 23986, 63, 15704, 297, 272, 283, 8175, 63, 26588, 297, 272, 283, 7823, 63, 20600, 9591, 297, 272, 283, 19476, 63, 16428, 51, 297, 272, 283, 13329, 3902, 689, 63, 15704, 297, 199, 61, 199, 199, 17208, 63, 19747, 63, 2632, 275, 10609, 199, 17208, 63, 2632, 275, 1994, 2886, 4805, 199, 199, 7917, 63, 2339, 275, 283, 4734, 6843, 7, 199, 5825, 63, 2632, 275, 283, 2859, 921, 2075, 6843, 14, 391, 329, 24950, 14, 271, 7, 199, 199, 3, 13515, 5492, 199, 199, 15942, 63, 14219, 275, 359, 272, 283, 1176, 14, 2828, 14, 1178, 297, 272, 283, 1176, 14, 2828, 14, 10778, 297, 272, 283, 1176, 14, 2828, 14, 11676, 297, 272, 283, 1176, 14, 2828, 14, 3431, 297, 272, 283, 1176, 14, 2828, 14, 18373, 297, 272, 283, 1176, 14, 2828, 14, 14864, 794, 297, 272, 283, 1176, 13, 4129, 13, 30608, 297, 272, 283, 1176, 63, 15653, 297, 272, 283, 3440, 63, 84, 10350, 83, 297, 272, 283, 7379, 297, 272, 283, 2075, 6843, 14, 6843, 297, 272, 283, 2075, 6843, 14, 1095, 297, 272, 283, 2075, 6843, 14, 5350, 390, 1298, 297, 272, 283, 2075, 6843, 14, 8054, 297, 272, 283, 2075, 6843, 14, 2634, 297, 272, 283, 2075, 6843, 14, 915, 31496, 297, 272, 283, 1176, 14, 2828, 14, 2113, 297, 272, 283, 17317, 1450, 3422, 297, 272, 283, 15078, 63, 1238, 63, 955, 297, 272, 283, 1176, 63, 1418, 63, 4623, 297, 199, 61, 199, 199, 19987, 275, 359, 272, 283, 1176, 14, 5754, 14, 4416, 14, 7676, 6608, 297, 272, 283, 1176, 14, 2828, 14, 11676, 14, 5754, 14, 4434, 6608, 297, 272, 283, 1176, 14, 5754, 14, 2330, 14, 7844, 6608, 297, 272, 283, 1176, 14, 5754, 14, 10088, 14, 13912, 25322, 297, 272, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 297, 272, 283, 1176, 14, 2828, 14, 3431, 14, 5754, 14, 2209, 6608, 297, 272, 283, 1176, 14, 5754, 14, 4891, 19193, 316, 14, 56, 3160, 4558, 6608, 297, 272, 283, 1176, 14, 5754, 14, 5508, 14, 20342, 6608, 297, 272, 283, 1176, 13, 4129, 13, 30608, 14, 5754, 14, 30608, 14, 30635, 6608, 297, 199, 61, 199, 199, 10449, 9472, 63, 27087, 3960, 275, 359, 272, 283, 1176, 14, 2828, 14, 18373, 14, 26677, 14, 17521, 11791, 297, 272, 283, 1176, 14, 2828, 14, 18373, 14, 26677, 14, 2640, 13752, 11791, 297, 272, 283, 7379, 14, 26677, 14, 17562, 11791, 297, 199, 61, 199, 199, 10449, 9472, 63, 17467, 275, 283, 7379, 14, 3494, 14, 17562, 16138, 6408, 7, 199, 199, 6089, 6174, 275, 469, 272, 283, 12307, 11344, 1645, 30416, 356, 469, 267, 283, 1095, 356, 469, 288, 283, 1365, 63, 10309, 356, 334, 355, 283, 3919, 15, 4246, 13, 10084, 22666, 14, 3919, 297, 355, 283, 551, 385, 15, 973, 14, 551, 385, 297, 355, 283, 551, 385, 15, 6843, 14, 551, 385, 7, 288, 2318, 288, 283, 1199, 63, 1501, 356, 283, 3919, 15, 1095, 14, 3919, 297, 267 ]
[ 199, 9323, 2202, 367, 4546, 6843, 2199, 14, 199, 199, 12706, 701, 283, 1176, 13, 2113, 1343, 1715, 7, 1808, 5634, 413, 14, 25, 14, 199, 199, 1858, 1655, 2556, 641, 642, 570, 12, 1937, 199, 2859, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 11299, 15, 1751, 15, 199, 199, 1858, 314, 2615, 769, 402, 2202, 436, 3932, 1338, 12, 1937, 199, 2859, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 1121, 15, 1751, 15, 199, 624, 199, 199, 646, 747, 199, 199, 3, 6516, 3792, 6272, 314, 2199, 2839, 642, 26, 747, 14, 515, 14, 904, 8, 5825, 63, 3022, 12, 19172, 199, 504, 1639, 14, 2828, 492, 3788, 199, 199, 5825, 63, 3022, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 3460, 493, 29658, 199, 5441, 63, 3022, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 11541, 1333, 199, 199, 3, 27534, 13, 928, 16367, 2202, 446, 625, 83, 10020, 367, 9920, 199, 3, 1666, 4178, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 17, 14, 25, 15, 21232, 15, 13605, 15, 1074, 513, 15, 199, 199, 3, 24964, 10036, 931, 370, 314, 2082, 626, 911, 10266, 922, 13, 19044, 1584, 14, 199, 3, 5679, 26, 3286, 1391, 15, 1544, 15, 2694, 14, 957, 15, 4603, 6687, 199, 13669, 63, 5441, 275, 747, 14, 515, 14, 904, 8, 5441, 63, 3022, 12, 2513, 4603, 358, 199, 199, 3, 2851, 626, 10022, 314, 5898, 19733, 687, 31460, 63, 5441, 14, 4155, 3238, 370, 675, 282, 199, 3, 8520, 14457, 14, 199, 3, 6058, 26, 298, 1014, 921, 2694, 14, 957, 15, 4603, 10665, 298, 1014, 921, 4603, 14, 2694, 14, 957, 6687, 199, 13669, 63, 2632, 275, 1994, 4603, 4805, 199, 199, 3, 24964, 931, 370, 314, 2082, 2955, 1584, 1077, 506, 13736, 370, 14, 199, 3, 7529, 1133, 5324, 7003, 315, 642, 2082, 28225, 27, 3877, 2195, 2955, 1584, 199, 3, 315, 8686, 7, 298, 1986, 6687, 24799, 436, 315, 27815, 9472, 63, 14455, 14, 199, 3, 5679, 26, 3286, 1391, 15, 1544, 15, 2694, 14, 957, 15, 1986, 6687, 199, 10449, 63, 5441, 275, 747, 14, 515, 14, 904, 8, 5441, 63, 3022, 12, 2513, 1986, 358, 199, 199, 3, 2851, 2403, 367, 2955, 1584, 14, 199, 3, 5679, 26, 298, 1014, 921, 2694, 14, 957, 15, 1986, 10665, 298, 1014, 921, 1986, 14, 2694, 14, 957, 6687, 199, 10449, 63, 2632, 275, 1994, 1986, 4805, 199, 199, 17350, 63, 23775, 275, 942, 199, 199, 7433, 63, 12231, 2617, 63, 13931, 63, 15514, 275, 359, 272, 283, 12231, 63, 20519, 63, 4929, 53, 8021, 297, 272, 283, 7917, 63, 2339, 297, 272, 283, 5287, 297, 272, 283, 3472, 63, 27644, 10462, 63, 4929, 10134, 297, 272, 283, 5825, 63, 2632, 297, 272, 283, 9524, 63, 2632, 297, 272, 283, 9524, 63, 2632, 63, 2339, 297, 272, 283, 1469, 21754, 63, 3876, 297, 272, 283, 1469, 21754, 63, 2632, 297, 272, 283, 4961, 63, 15353, 297, 272, 283, 23986, 63, 15704, 297, 272, 283, 8175, 63, 26588, 297, 272, 283, 7823, 63, 20600, 9591, 297, 272, 283, 19476, 63, 16428, 51, 297, 272, 283, 13329, 3902, 689, 63, 15704, 297, 199, 61, 199, 199, 17208, 63, 19747, 63, 2632, 275, 10609, 199, 17208, 63, 2632, 275, 1994, 2886, 4805, 199, 199, 7917, 63, 2339, 275, 283, 4734, 6843, 7, 199, 5825, 63, 2632, 275, 283, 2859, 921, 2075, 6843, 14, 391, 329, 24950, 14, 271, 7, 199, 199, 3, 13515, 5492, 199, 199, 15942, 63, 14219, 275, 359, 272, 283, 1176, 14, 2828, 14, 1178, 297, 272, 283, 1176, 14, 2828, 14, 10778, 297, 272, 283, 1176, 14, 2828, 14, 11676, 297, 272, 283, 1176, 14, 2828, 14, 3431, 297, 272, 283, 1176, 14, 2828, 14, 18373, 297, 272, 283, 1176, 14, 2828, 14, 14864, 794, 297, 272, 283, 1176, 13, 4129, 13, 30608, 297, 272, 283, 1176, 63, 15653, 297, 272, 283, 3440, 63, 84, 10350, 83, 297, 272, 283, 7379, 297, 272, 283, 2075, 6843, 14, 6843, 297, 272, 283, 2075, 6843, 14, 1095, 297, 272, 283, 2075, 6843, 14, 5350, 390, 1298, 297, 272, 283, 2075, 6843, 14, 8054, 297, 272, 283, 2075, 6843, 14, 2634, 297, 272, 283, 2075, 6843, 14, 915, 31496, 297, 272, 283, 1176, 14, 2828, 14, 2113, 297, 272, 283, 17317, 1450, 3422, 297, 272, 283, 15078, 63, 1238, 63, 955, 297, 272, 283, 1176, 63, 1418, 63, 4623, 297, 199, 61, 199, 199, 19987, 275, 359, 272, 283, 1176, 14, 5754, 14, 4416, 14, 7676, 6608, 297, 272, 283, 1176, 14, 2828, 14, 11676, 14, 5754, 14, 4434, 6608, 297, 272, 283, 1176, 14, 5754, 14, 2330, 14, 7844, 6608, 297, 272, 283, 1176, 14, 5754, 14, 10088, 14, 13912, 25322, 297, 272, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 297, 272, 283, 1176, 14, 2828, 14, 3431, 14, 5754, 14, 2209, 6608, 297, 272, 283, 1176, 14, 5754, 14, 4891, 19193, 316, 14, 56, 3160, 4558, 6608, 297, 272, 283, 1176, 14, 5754, 14, 5508, 14, 20342, 6608, 297, 272, 283, 1176, 13, 4129, 13, 30608, 14, 5754, 14, 30608, 14, 30635, 6608, 297, 199, 61, 199, 199, 10449, 9472, 63, 27087, 3960, 275, 359, 272, 283, 1176, 14, 2828, 14, 18373, 14, 26677, 14, 17521, 11791, 297, 272, 283, 1176, 14, 2828, 14, 18373, 14, 26677, 14, 2640, 13752, 11791, 297, 272, 283, 7379, 14, 26677, 14, 17562, 11791, 297, 199, 61, 199, 199, 10449, 9472, 63, 17467, 275, 283, 7379, 14, 3494, 14, 17562, 16138, 6408, 7, 199, 199, 6089, 6174, 275, 469, 272, 283, 12307, 11344, 1645, 30416, 356, 469, 267, 283, 1095, 356, 469, 288, 283, 1365, 63, 10309, 356, 334, 355, 283, 3919, 15, 4246, 13, 10084, 22666, 14, 3919, 297, 355, 283, 551, 385, 15, 973, 14, 551, 385, 297, 355, 283, 551, 385, 15, 6843, 14, 551, 385, 7, 288, 2318, 288, 283, 1199, 63, 1501, 356, 283, 3919, 15, 1095, 14, 3919, 297, 267, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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( 'mya', # 0x00 'myag', # 0x01 'myagg', # 0x02 'myags', # 0x03 'myan', # 0x04 'myanj', # 0x05 'myanh', # 0x06 'myad', # 0x07 'myal', # 0x08 'myalg', # 0x09 'myalm', # 0x0a 'myalb', # 0x0b 'myals', # 0x0c 'myalt', # 0x0d 'myalp', # 0x0e 'myalh', # 0x0f 'myam', # 0x10 'myab', # 0x11 'myabs', # 0x12 'myas', # 0x13 'myass', # 0x14 'myang', # 0x15 'myaj', # 0x16 'myac', # 0x17 'myak', # 0x18 'myat', # 0x19 'myap', # 0x1a 'myah', # 0x1b 'myae', # 0x1c 'myaeg', # 0x1d 'myaegg', # 0x1e 'myaegs', # 0x1f 'myaen', # 0x20 'myaenj', # 0x21 'myaenh', # 0x22 'myaed', # 0x23 'myael', # 0x24 'myaelg', # 0x25 'myaelm', # 0x26 'myaelb', # 0x27 'myaels', # 0x28 'myaelt', # 0x29 'myaelp', # 0x2a 'myaelh', # 0x2b 'myaem', # 0x2c 'myaeb', # 0x2d 'myaebs', # 0x2e 'myaes', # 0x2f 'myaess', # 0x30 'myaeng', # 0x31 'myaej', # 0x32 'myaec', # 0x33 'myaek', # 0x34 'myaet', # 0x35 'myaep', # 0x36 'myaeh', # 0x37 'meo', # 0x38 'meog', # 0x39 'meogg', # 0x3a 'meogs', # 0x3b 'meon', # 0x3c 'meonj', # 0x3d 'meonh', # 0x3e 'meod', # 0x3f 'meol', # 0x40 'meolg', # 0x41 'meolm', # 0x42 'meolb', # 0x43 'meols', # 0x44 'meolt', # 0x45 'meolp', # 0x46 'meolh', # 0x47 'meom', # 0x48 'meob', # 0x49 'meobs', # 0x4a 'meos', # 0x4b 'meoss', # 0x4c 'meong', # 0x4d 'meoj', # 0x4e 'meoc', # 0x4f 'meok', # 0x50 'meot', # 0x51 'meop', # 0x52 'meoh', # 0x53 'me', # 0x54 'meg', # 0x55 'megg', # 0x56 'megs', # 0x57 'men', # 0x58 'menj', # 0x59 'menh', # 0x5a 'med', # 0x5b 'mel', # 0x5c 'melg', # 0x5d 'melm', # 0x5e 'melb', # 0x5f 'mels', # 0x60 'melt', # 0x61 'melp', # 0x62 'melh', # 0x63 'mem', # 0x64 'meb', # 0x65 'mebs', # 0x66 'mes', # 0x67 'mess', # 0x68 'meng', # 0x69 'mej', # 0x6a 'mec', # 0x6b 'mek', # 0x6c 'met', # 0x6d 'mep', # 0x6e 'meh', # 0x6f 'myeo', # 0x70 'myeog', # 0x71 'myeogg', # 0x72 'myeogs', # 0x73 'myeon', # 0x74 'myeonj', # 0x75 'myeonh', # 0x76 'myeod', # 0x77 'myeol', # 0x78 'myeolg', # 0x79 'myeolm', # 0x7a 'myeolb', # 0x7b 'myeols', # 0x7c 'myeolt', # 0x7d 'myeolp', # 0x7e 'myeolh', # 0x7f 'myeom', # 0x80 'myeob', # 0x81 'myeobs', # 0x82 'myeos', # 0x83 'myeoss', # 0x84 'myeong', # 0x85 'myeoj', # 0x86 'myeoc', # 0x87 'myeok', # 0x88 'myeot', # 0x89 'myeop', # 0x8a 'myeoh', # 0x8b 'mye', # 0x8c 'myeg', # 0x8d 'myegg', # 0x8e 'myegs', # 0x8f 'myen', # 0x90 'myenj', # 0x91 'myenh', # 0x92 'myed', # 0x93 'myel', # 0x94 'myelg', # 0x95 'myelm', # 0x96 'myelb', # 0x97 'myels', # 0x98 'myelt', # 0x99 'myelp', # 0x9a 'myelh', # 0x9b 'myem', # 0x9c 'myeb', # 0x9d 'myebs', # 0x9e 'myes', # 0x9f 'myess', # 0xa0 'myeng', # 0xa1 'myej', # 0xa2 'myec', # 0xa3 'myek', # 0xa4 'myet', # 0xa5 'myep', # 0xa6 'myeh', # 0xa7 'mo', # 0xa8 'mog', # 0xa9 'mogg', # 0xaa 'mogs', # 0xab 'mon', # 0xac 'monj', # 0xad 'monh', # 0xae 'mod', # 0xaf 'mol', # 0xb0 'molg', # 0xb1 'molm', # 0xb2 'molb', # 0xb3 'mols', # 0xb4 'molt', # 0xb5 'molp', # 0xb6 'molh', # 0xb7 'mom', # 0xb8 'mob', # 0xb9 'mobs', # 0xba 'mos', # 0xbb 'moss', # 0xbc 'mong', # 0xbd 'moj', # 0xbe 'moc', # 0xbf 'mok', # 0xc0 'mot', # 0xc1 'mop', # 0xc2 'moh', # 0xc3 'mwa', # 0xc4 'mwag', # 0xc5 'mwagg', # 0xc6 'mwags', # 0xc7 'mwan', # 0xc8 'mwanj', # 0xc9 'mwanh', # 0xca 'mwad', # 0xcb 'mwal', # 0xcc 'mwalg', # 0xcd 'mwalm', # 0xce 'mwalb', # 0xcf 'mwals', # 0xd0 'mwalt', # 0xd1 'mwalp', # 0xd2 'mwalh', # 0xd3 'mwam', # 0xd4 'mwab', # 0xd5 'mwabs', # 0xd6 'mwas', # 0xd7 'mwass', # 0xd8 'mwang', # 0xd9 'mwaj', # 0xda 'mwac', # 0xdb 'mwak', # 0xdc 'mwat', # 0xdd 'mwap', # 0xde 'mwah', # 0xdf 'mwae', # 0xe0 'mwaeg', # 0xe1 'mwaegg', # 0xe2 'mwaegs', # 0xe3 'mwaen', # 0xe4 'mwaenj', # 0xe5 'mwaenh', # 0xe6 'mwaed', # 0xe7 'mwael', # 0xe8 'mwaelg', # 0xe9 'mwaelm', # 0xea 'mwaelb', # 0xeb 'mwaels', # 0xec 'mwaelt', # 0xed 'mwaelp', # 0xee 'mwaelh', # 0xef 'mwaem', # 0xf0 'mwaeb', # 0xf1 'mwaebs', # 0xf2 'mwaes', # 0xf3 'mwaess', # 0xf4 'mwaeng', # 0xf5 'mwaej', # 0xf6 'mwaec', # 0xf7 'mwaek', # 0xf8 'mwaet', # 0xf9 'mwaep', # 0xfa 'mwaeh', # 0xfb 'moe', # 0xfc 'moeg', # 0xfd 'moegg', # 0xfe 'moegs', # 0xff )
gpl-3.0
[ 576, 275, 334, 199, 6704, 11552, 297, 259, 327, 378, 88, 383, 199, 6704, 89, 643, 297, 259, 327, 378, 88, 614, 199, 6704, 89, 13452, 297, 259, 327, 378, 88, 996, 199, 6704, 89, 7391, 297, 259, 327, 378, 88, 1644, 199, 6704, 89, 290, 297, 259, 327, 378, 88, 966, 199, 6704, 89, 290, 74, 297, 259, 327, 378, 88, 1717, 199, 6704, 89, 290, 72, 297, 259, 327, 378, 88, 1690, 199, 6704, 89, 350, 297, 259, 327, 378, 88, 1780, 199, 6704, 31876, 297, 259, 327, 378, 88, 2036, 199, 6704, 89, 6731, 297, 259, 327, 378, 88, 1643, 199, 6704, 31876, 77, 297, 259, 327, 378, 88, 16, 65, 199, 6704, 31876, 66, 297, 259, 327, 378, 88, 16, 66, 199, 6704, 89, 2551, 297, 259, 327, 378, 88, 16, 67, 199, 6704, 89, 4478, 297, 259, 327, 378, 88, 16, 68, 199, 6704, 31876, 80, 297, 259, 327, 378, 88, 16, 69, 199, 6704, 31876, 72, 297, 259, 327, 378, 88, 16, 70, 199, 6704, 89, 455, 297, 259, 327, 378, 88, 709, 199, 6704, 89, 371, 297, 259, 327, 378, 88, 845, 199, 6704, 89, 2101, 297, 259, 327, 378, 88, 713, 199, 6704, 89, 305, 297, 259, 327, 378, 88, 969, 199, 6704, 89, 405, 297, 259, 327, 378, 88, 1079, 199, 6704, 11912, 297, 259, 327, 378, 88, 1046, 199, 6704, 89, 9091, 297, 259, 327, 378, 88, 975, 199, 6704, 89, 645, 297, 259, 327, 378, 88, 1196, 199, 6704, 89, 1151, 297, 259, 327, 378, 88, 1085, 199, 6704, 89, 292, 297, 259, 327, 378, 88, 1167, 199, 6704, 89, 439, 297, 259, 327, 378, 88, 17, 65, 199, 6704, 89, 11326, 297, 259, 327, 378, 88, 17, 66, 199, 6704, 89, 3624, 297, 259, 327, 378, 88, 17, 67, 199, 6704, 89, 3624, 71, 297, 259, 327, 378, 88, 17, 68, 199, 6704, 89, 3624, 2721, 297, 259, 327, 378, 88, 17, 69, 199, 6704, 89, 3624, 458, 297, 259, 327, 378, 88, 17, 70, 199, 6704, 11552, 287, 297, 259, 327, 378, 88, 1165, 199, 6704, 11552, 287, 74, 297, 259, 327, 378, 88, 2025, 199, 6704, 11552, 287, 72, 297, 259, 327, 378, 88, 1081, 199, 6704, 11552, 379, 297, 259, 327, 378, 88, 1789, 199, 6704, 89, 10643, 297, 259, 327, 378, 88, 1194, 199, 6704, 89, 10643, 71, 297, 259, 327, 378, 88, 821, 199, 6704, 89, 10643, 77, 297, 259, 327, 378, 88, 1479, 199, 6704, 89, 10643, 66, 297, 259, 327, 378, 88, 1465, 199, 6704, 89, 10643, 83, 297, 259, 327, 378, 88, 1651, 199, 6704, 89, 10643, 84, 297, 259, 327, 378, 88, 1398, 199, 6704, 11552, 1357, 297, 259, 327, 378, 88, 18, 65, 199, 6704, 89, 10643, 72, 297, 259, 327, 378, 88, 18, 66, 199, 6704, 89, 3624, 77, 297, 259, 327, 378, 88, 18, 67, 199, 6704, 11552, 2871, 297, 259, 327, 378, 88, 18, 68, 199, 6704, 89, 3624, 1533, 297, 259, 327, 378, 88, 18, 69, 199, 6704, 11552, 397, 297, 259, 327, 378, 88, 18, 70, 199, 6704, 89, 3624, 385, 297, 259, 327, 378, 88, 1216, 199, 6704, 11552, 7420, 297, 259, 327, 378, 88, 2192, 199, 6704, 89, 3624, 74, 297, 259, 327, 378, 88, 708, 199, 6704, 11552, 825, 297, 259, 327, 378, 88, 1153, 199, 6704, 89, 3624, 75, 297, 259, 327, 378, 88, 1082, 199, 6704, 11552, 386, 297, 259, 327, 378, 88, 1276, 199, 6704, 11552, 1545, 297, 259, 327, 378, 88, 1344, 199, 6704, 89, 3624, 72, 297, 259, 327, 378, 88, 1401, 199, 6704, 20805, 297, 259, 327, 378, 88, 1703, 199, 6704, 69, 974, 297, 259, 327, 378, 88, 1355, 199, 6704, 69, 24798, 297, 259, 327, 378, 88, 19, 65, 199, 6704, 20805, 458, 297, 259, 327, 378, 88, 19, 66, 199, 6704, 69, 265, 297, 259, 327, 378, 88, 19, 67, 199, 6704, 69, 265, 74, 297, 259, 327, 378, 88, 19, 68, 199, 6704, 69, 265, 72, 297, 259, 327, 378, 88, 19, 69, 199, 6704, 69, 364, 297, 259, 327, 378, 88, 19, 70, 199, 6704, 20470, 297, 259, 327, 378, 88, 2167, 199, 6704, 20470, 71, 297, 259, 327, 378, 88, 2953, 199, 6704, 20470, 77, 297, 259, 327, 378, 88, 2260, 199, 6704, 20470, 66, 297, 259, 327, 378, 88, 2824, 199, 6704, 69, 1446, 297, 259, 327, 378, 88, 1602, 199, 6704, 20470, 84, 297, 259, 327, 378, 88, 2322, 199, 6704, 20470, 80, 297, 259, 327, 378, 88, 2466, 199, 6704, 20470, 72, 297, 259, 327, 378, 88, 2417, 199, 6704, 69, 676, 297, 259, 327, 378, 88, 2006, 199, 6704, 69, 2873, 297, 259, 327, 378, 88, 1887, 199, 6704, 69, 11226, 297, 259, 327, 378, 88, 20, 65, 199, 6704, 24909, 297, 259, 327, 378, 88, 20, 66, 199, 6704, 20805, 385, 297, 259, 327, 378, 88, 20, 67, 199, 6704, 69, 951, 297, 259, 327, 378, 88, 20, 68, 199, 6704, 20805, 74, 297, 259, 327, 378, 88, 20, 69, 199, 6704, 69, 679, 297, 259, 327, 378, 88, 20, 70, 199, 6704, 69, 745, 297, 259, 327, 378, 88, 1400, 199, 6704, 69, 357, 297, 259, 327, 378, 88, 2869, 199, 6704, 69, 411, 297, 259, 327, 378, 88, 2528, 199, 6704, 69, 19194, 297, 259, 327, 378, 88, 2481, 199, 6704, 69, 297, 259, 327, 378, 88, 1477, 199, 6704, 5902, 297, 259, 327, 378, 88, 1229, 199, 6704, 5799, 297, 259, 327, 378, 88, 1367, 199, 6704, 69, 458, 297, 259, 327, 378, 88, 1641, 199, 6704, 287, 297, 259, 327, 378, 88, 2010, 199, 6704, 287, 74, 297, 259, 327, 378, 88, 1427, 199, 6704, 287, 72, 297, 259, 327, 378, 88, 21, 65, 199, 6704, 379, 297, 259, 327, 378, 88, 21, 66, 199, 6704, 352, 297, 259, 327, 378, 88, 21, 67, 199, 6704, 352, 71, 297, 259, 327, 378, 88, 21, 68, 199, 6704, 21226, 297, 259, 327, 378, 88, 21, 69, 199, 6704, 17778, 297, 259, 327, 378, 88, 21, 70, 199, 6704, 18099, 297, 259, 327, 378, 88, 2259, 199, 6704, 15330, 297, 259, 327, 378, 88, 2976 ]
[ 275, 334, 199, 6704, 11552, 297, 259, 327, 378, 88, 383, 199, 6704, 89, 643, 297, 259, 327, 378, 88, 614, 199, 6704, 89, 13452, 297, 259, 327, 378, 88, 996, 199, 6704, 89, 7391, 297, 259, 327, 378, 88, 1644, 199, 6704, 89, 290, 297, 259, 327, 378, 88, 966, 199, 6704, 89, 290, 74, 297, 259, 327, 378, 88, 1717, 199, 6704, 89, 290, 72, 297, 259, 327, 378, 88, 1690, 199, 6704, 89, 350, 297, 259, 327, 378, 88, 1780, 199, 6704, 31876, 297, 259, 327, 378, 88, 2036, 199, 6704, 89, 6731, 297, 259, 327, 378, 88, 1643, 199, 6704, 31876, 77, 297, 259, 327, 378, 88, 16, 65, 199, 6704, 31876, 66, 297, 259, 327, 378, 88, 16, 66, 199, 6704, 89, 2551, 297, 259, 327, 378, 88, 16, 67, 199, 6704, 89, 4478, 297, 259, 327, 378, 88, 16, 68, 199, 6704, 31876, 80, 297, 259, 327, 378, 88, 16, 69, 199, 6704, 31876, 72, 297, 259, 327, 378, 88, 16, 70, 199, 6704, 89, 455, 297, 259, 327, 378, 88, 709, 199, 6704, 89, 371, 297, 259, 327, 378, 88, 845, 199, 6704, 89, 2101, 297, 259, 327, 378, 88, 713, 199, 6704, 89, 305, 297, 259, 327, 378, 88, 969, 199, 6704, 89, 405, 297, 259, 327, 378, 88, 1079, 199, 6704, 11912, 297, 259, 327, 378, 88, 1046, 199, 6704, 89, 9091, 297, 259, 327, 378, 88, 975, 199, 6704, 89, 645, 297, 259, 327, 378, 88, 1196, 199, 6704, 89, 1151, 297, 259, 327, 378, 88, 1085, 199, 6704, 89, 292, 297, 259, 327, 378, 88, 1167, 199, 6704, 89, 439, 297, 259, 327, 378, 88, 17, 65, 199, 6704, 89, 11326, 297, 259, 327, 378, 88, 17, 66, 199, 6704, 89, 3624, 297, 259, 327, 378, 88, 17, 67, 199, 6704, 89, 3624, 71, 297, 259, 327, 378, 88, 17, 68, 199, 6704, 89, 3624, 2721, 297, 259, 327, 378, 88, 17, 69, 199, 6704, 89, 3624, 458, 297, 259, 327, 378, 88, 17, 70, 199, 6704, 11552, 287, 297, 259, 327, 378, 88, 1165, 199, 6704, 11552, 287, 74, 297, 259, 327, 378, 88, 2025, 199, 6704, 11552, 287, 72, 297, 259, 327, 378, 88, 1081, 199, 6704, 11552, 379, 297, 259, 327, 378, 88, 1789, 199, 6704, 89, 10643, 297, 259, 327, 378, 88, 1194, 199, 6704, 89, 10643, 71, 297, 259, 327, 378, 88, 821, 199, 6704, 89, 10643, 77, 297, 259, 327, 378, 88, 1479, 199, 6704, 89, 10643, 66, 297, 259, 327, 378, 88, 1465, 199, 6704, 89, 10643, 83, 297, 259, 327, 378, 88, 1651, 199, 6704, 89, 10643, 84, 297, 259, 327, 378, 88, 1398, 199, 6704, 11552, 1357, 297, 259, 327, 378, 88, 18, 65, 199, 6704, 89, 10643, 72, 297, 259, 327, 378, 88, 18, 66, 199, 6704, 89, 3624, 77, 297, 259, 327, 378, 88, 18, 67, 199, 6704, 11552, 2871, 297, 259, 327, 378, 88, 18, 68, 199, 6704, 89, 3624, 1533, 297, 259, 327, 378, 88, 18, 69, 199, 6704, 11552, 397, 297, 259, 327, 378, 88, 18, 70, 199, 6704, 89, 3624, 385, 297, 259, 327, 378, 88, 1216, 199, 6704, 11552, 7420, 297, 259, 327, 378, 88, 2192, 199, 6704, 89, 3624, 74, 297, 259, 327, 378, 88, 708, 199, 6704, 11552, 825, 297, 259, 327, 378, 88, 1153, 199, 6704, 89, 3624, 75, 297, 259, 327, 378, 88, 1082, 199, 6704, 11552, 386, 297, 259, 327, 378, 88, 1276, 199, 6704, 11552, 1545, 297, 259, 327, 378, 88, 1344, 199, 6704, 89, 3624, 72, 297, 259, 327, 378, 88, 1401, 199, 6704, 20805, 297, 259, 327, 378, 88, 1703, 199, 6704, 69, 974, 297, 259, 327, 378, 88, 1355, 199, 6704, 69, 24798, 297, 259, 327, 378, 88, 19, 65, 199, 6704, 20805, 458, 297, 259, 327, 378, 88, 19, 66, 199, 6704, 69, 265, 297, 259, 327, 378, 88, 19, 67, 199, 6704, 69, 265, 74, 297, 259, 327, 378, 88, 19, 68, 199, 6704, 69, 265, 72, 297, 259, 327, 378, 88, 19, 69, 199, 6704, 69, 364, 297, 259, 327, 378, 88, 19, 70, 199, 6704, 20470, 297, 259, 327, 378, 88, 2167, 199, 6704, 20470, 71, 297, 259, 327, 378, 88, 2953, 199, 6704, 20470, 77, 297, 259, 327, 378, 88, 2260, 199, 6704, 20470, 66, 297, 259, 327, 378, 88, 2824, 199, 6704, 69, 1446, 297, 259, 327, 378, 88, 1602, 199, 6704, 20470, 84, 297, 259, 327, 378, 88, 2322, 199, 6704, 20470, 80, 297, 259, 327, 378, 88, 2466, 199, 6704, 20470, 72, 297, 259, 327, 378, 88, 2417, 199, 6704, 69, 676, 297, 259, 327, 378, 88, 2006, 199, 6704, 69, 2873, 297, 259, 327, 378, 88, 1887, 199, 6704, 69, 11226, 297, 259, 327, 378, 88, 20, 65, 199, 6704, 24909, 297, 259, 327, 378, 88, 20, 66, 199, 6704, 20805, 385, 297, 259, 327, 378, 88, 20, 67, 199, 6704, 69, 951, 297, 259, 327, 378, 88, 20, 68, 199, 6704, 20805, 74, 297, 259, 327, 378, 88, 20, 69, 199, 6704, 69, 679, 297, 259, 327, 378, 88, 20, 70, 199, 6704, 69, 745, 297, 259, 327, 378, 88, 1400, 199, 6704, 69, 357, 297, 259, 327, 378, 88, 2869, 199, 6704, 69, 411, 297, 259, 327, 378, 88, 2528, 199, 6704, 69, 19194, 297, 259, 327, 378, 88, 2481, 199, 6704, 69, 297, 259, 327, 378, 88, 1477, 199, 6704, 5902, 297, 259, 327, 378, 88, 1229, 199, 6704, 5799, 297, 259, 327, 378, 88, 1367, 199, 6704, 69, 458, 297, 259, 327, 378, 88, 1641, 199, 6704, 287, 297, 259, 327, 378, 88, 2010, 199, 6704, 287, 74, 297, 259, 327, 378, 88, 1427, 199, 6704, 287, 72, 297, 259, 327, 378, 88, 21, 65, 199, 6704, 379, 297, 259, 327, 378, 88, 21, 66, 199, 6704, 352, 297, 259, 327, 378, 88, 21, 67, 199, 6704, 352, 71, 297, 259, 327, 378, 88, 21, 68, 199, 6704, 21226, 297, 259, 327, 378, 88, 21, 69, 199, 6704, 17778, 297, 259, 327, 378, 88, 21, 70, 199, 6704, 18099, 297, 259, 327, 378, 88, 2259, 199, 6704, 15330, 297, 259, 327, 378, 88, 2976, 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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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 ]
eayunstack/horizon
openstack_dashboard/dashboards/project/databases/urls.py
36
1237
# Copyright 2013 Rackspace Hosting # # 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 django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.project.databases import views INSTANCES = r'^(?P<instance_id>[^/]+)/%s$' urlpatterns = patterns( '', url(r'^$', views.IndexView.as_view(), name='index'), url(r'^launch$', views.LaunchInstanceView.as_view(), name='launch'), url(INSTANCES % '', views.DetailView.as_view(), name='detail'), url(INSTANCES % 'resize_volume', views.ResizeVolumeView.as_view(), name='resize_volume'), url(INSTANCES % 'resize_instance', views.ResizeInstanceView.as_view(), name='resize_instance') )
apache-2.0
[ 3, 1898, 6171, 32679, 10891, 316, 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, 504, 1639, 14, 2190, 14, 3603, 492, 7970, 199, 504, 1639, 14, 2190, 14, 3603, 492, 1166, 199, 199, 504, 13869, 63, 9743, 14, 30424, 14, 1715, 14, 17439, 492, 6858, 421, 199, 7834, 879, 16734, 275, 519, 24550, 48, 28, 842, 63, 344, 26906, 2447, 5, 83, 12913, 421, 199, 20050, 275, 7970, 8, 272, 3260, 272, 1166, 8, 82, 4289, 4268, 6858, 14, 2681, 2768, 14, 305, 63, 1345, 1062, 536, 534, 1080, 659, 272, 1166, 8, 82, 4289, 9850, 4268, 6858, 14, 18543, 3244, 2768, 14, 305, 63, 1345, 1062, 536, 534, 9850, 659, 272, 1166, 8, 7834, 879, 16734, 450, 3260, 6858, 14, 28539, 14, 305, 63, 1345, 1062, 536, 534, 5506, 659, 272, 1166, 8, 7834, 879, 16734, 450, 283, 8709, 63, 2405, 297, 6858, 14, 24559, 6464, 2768, 14, 305, 63, 1345, 1062, 267, 536, 534, 8709, 63, 2405, 659, 272, 1166, 8, 7834, 879, 16734, 450, 283, 8709, 63, 842, 297, 6858, 14, 24559, 3244, 2768, 14, 305, 63, 1345, 1062, 267, 536, 534, 8709, 63, 842, 358, 199, 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 ]
[ 1898, 6171, 32679, 10891, 316, 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, 504, 1639, 14, 2190, 14, 3603, 492, 7970, 199, 504, 1639, 14, 2190, 14, 3603, 492, 1166, 199, 199, 504, 13869, 63, 9743, 14, 30424, 14, 1715, 14, 17439, 492, 6858, 421, 199, 7834, 879, 16734, 275, 519, 24550, 48, 28, 842, 63, 344, 26906, 2447, 5, 83, 12913, 421, 199, 20050, 275, 7970, 8, 272, 3260, 272, 1166, 8, 82, 4289, 4268, 6858, 14, 2681, 2768, 14, 305, 63, 1345, 1062, 536, 534, 1080, 659, 272, 1166, 8, 82, 4289, 9850, 4268, 6858, 14, 18543, 3244, 2768, 14, 305, 63, 1345, 1062, 536, 534, 9850, 659, 272, 1166, 8, 7834, 879, 16734, 450, 3260, 6858, 14, 28539, 14, 305, 63, 1345, 1062, 536, 534, 5506, 659, 272, 1166, 8, 7834, 879, 16734, 450, 283, 8709, 63, 2405, 297, 6858, 14, 24559, 6464, 2768, 14, 305, 63, 1345, 1062, 267, 536, 534, 8709, 63, 2405, 659, 272, 1166, 8, 7834, 879, 16734, 450, 283, 8709, 63, 842, 297, 6858, 14, 24559, 3244, 2768, 14, 305, 63, 1345, 1062, 267, 536, 534, 8709, 63, 842, 358, 199, 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, 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, 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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 ]
chengjf/database-interface-doc-management
flask-demo/flask/Lib/encodings/iso2022_jp_1.py
816
1061
# # iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1 # # Written by Hye-Shik Chang <perky@FreeBSD.org> # import _codecs_iso2022, codecs import _multibytecodec as mbc codec = _codecs_iso2022.getcodec('iso2022_jp_1') class Codec(codecs.Codec): encode = codec.encode decode = codec.decode class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): codec = codec class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec = codec class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): codec = codec class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): codec = codec def getregentry(): return codecs.CodecInfo( name='iso2022_jp_1', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, )
apache-2.0
[ 3, 199, 3, 11601, 13859, 63, 11538, 63, 17, 14, 647, 26, 2018, 6140, 13732, 367, 9055, 13859, 63, 15819, 63, 17, 199, 3, 199, 3, 27694, 701, 869, 8048, 13, 2662, 3258, 2799, 621, 665, 529, 10562, 32, 10146, 15400, 14, 1308, 30, 199, 3, 199, 199, 646, 485, 8933, 63, 4595, 13859, 12, 6010, 199, 646, 485, 3029, 4414, 9276, 465, 333, 3776, 199, 199, 9276, 275, 485, 8933, 63, 4595, 13859, 14, 362, 9276, 360, 4595, 13859, 63, 11538, 63, 17, 358, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 272, 3752, 275, 9076, 14, 2143, 272, 4849, 275, 9076, 14, 2708, 199, 199, 533, 24350, 8, 887, 67, 14, 3947, 4414, 17016, 12, 586, 6010, 14, 17016, 304, 272, 9076, 275, 9076, 199, 199, 533, 24385, 8, 887, 67, 14, 3947, 4414, 16703, 12, 586, 6010, 14, 16703, 304, 272, 9076, 275, 9076, 199, 199, 533, 22970, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16132, 12, 6010, 14, 16132, 304, 272, 9076, 275, 9076, 199, 199, 533, 24163, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16551, 12, 6010, 14, 16551, 304, 272, 9076, 275, 9076, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 4595, 13859, 63, 11538, 63, 17, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 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, 32768, 32768, 32768, 32768, 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, 11601, 13859, 63, 11538, 63, 17, 14, 647, 26, 2018, 6140, 13732, 367, 9055, 13859, 63, 15819, 63, 17, 199, 3, 199, 3, 27694, 701, 869, 8048, 13, 2662, 3258, 2799, 621, 665, 529, 10562, 32, 10146, 15400, 14, 1308, 30, 199, 3, 199, 199, 646, 485, 8933, 63, 4595, 13859, 12, 6010, 199, 646, 485, 3029, 4414, 9276, 465, 333, 3776, 199, 199, 9276, 275, 485, 8933, 63, 4595, 13859, 14, 362, 9276, 360, 4595, 13859, 63, 11538, 63, 17, 358, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 272, 3752, 275, 9076, 14, 2143, 272, 4849, 275, 9076, 14, 2708, 199, 199, 533, 24350, 8, 887, 67, 14, 3947, 4414, 17016, 12, 586, 6010, 14, 17016, 304, 272, 9076, 275, 9076, 199, 199, 533, 24385, 8, 887, 67, 14, 3947, 4414, 16703, 12, 586, 6010, 14, 16703, 304, 272, 9076, 275, 9076, 199, 199, 533, 22970, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16132, 12, 6010, 14, 16132, 304, 272, 9076, 275, 9076, 199, 199, 533, 24163, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16551, 12, 6010, 14, 16551, 304, 272, 9076, 275, 9076, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 4595, 13859, 63, 11538, 63, 17, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 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, 32768, 32768, 32768, 32768, 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,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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 ]
liorvh/raspberry_pwn
src/pentest/sqlmap/lib/core/testing.py
7
10693
#!/usr/bin/env python """ Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import codecs import doctest import os import re import shutil import sys import tempfile import time import traceback from extra.beep.beep import beep from lib.controller.controller import start from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout from lib.core.common import getUnicode from lib.core.common import randomStr from lib.core.common import readXmlFile from lib.core.data import conf from lib.core.data import logger from lib.core.data import paths from lib.core.exception import SqlmapBaseException from lib.core.exception import SqlmapNotVulnerableException from lib.core.log import LOGGER_HANDLER from lib.core.option import init from lib.core.option import initOptions from lib.core.option import setVerbosity from lib.core.optiondict import optDict from lib.core.settings import UNICODE_ENCODING from lib.parse.cmdline import cmdLineParser class Failures(object): failedItems = None failedParseOn = None failedTraceBack = None def smokeTest(): """ Runs the basic smoke testing of a program """ retVal = True count, length = 0, 0 for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): if any(_ in root for _ in ("thirdparty", "extra")): continue for ifile in files: length += 1 for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): if any(_ in root for _ in ("thirdparty", "extra")): continue for ifile in files: if os.path.splitext(ifile)[1].lower() == ".py" and ifile != "__init__.py": path = os.path.join(root, os.path.splitext(ifile)[0]) path = path.replace(paths.SQLMAP_ROOT_PATH, '.') path = path.replace(os.sep, '.').lstrip('.') try: __import__(path) module = sys.modules[path] except Exception, msg: retVal = False dataToStdout("\r") errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, ifile), msg) logger.error(errMsg) else: # Run doc tests # Reference: http://docs.python.org/library/doctest.html (failure_count, test_count) = doctest.testmod(module) if failure_count > 0: retVal = False count += 1 status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) clearConsoleLine() if retVal: logger.info("smoke test final result: PASSED") else: logger.error("smoke test final result: FAILED") return retVal def adjustValueType(tagName, value): for family in optDict.keys(): for name, type_ in optDict[family].items(): if type(type_) == tuple: type_ = type_[0] if tagName == name: if type_ == "boolean": value = (value == "True") elif type_ == "integer": value = int(value) elif type_ == "float": value = float(value) break return value def liveTest(): """ Runs the test of a program against the live testing environment """ retVal = True count = 0 global_ = {} vars_ = {} livetests = readXmlFile(paths.LIVE_TESTS_XML) length = len(livetests.getElementsByTagName("case")) element = livetests.getElementsByTagName("global") if element: for item in element: for child in item.childNodes: if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"): global_[child.tagName] = adjustValueType(child.tagName, child.getAttribute("value")) element = livetests.getElementsByTagName("vars") if element: for item in element: for child in item.childNodes: if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"): var = child.getAttribute("value") vars_[child.tagName] = randomStr(6) if var == "random" else var for case in livetests.getElementsByTagName("case"): parse_from_console_output = False count += 1 name = None parse = [] switches = dict(global_) value = "" vulnerable = True result = None if case.hasAttribute("name"): name = case.getAttribute("name") if conf.runCase and ((conf.runCase.isdigit() and conf.runCase != count) or not re.search(conf.runCase, name, re.DOTALL)): continue if case.getElementsByTagName("switches"): for child in case.getElementsByTagName("switches")[0].childNodes: if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"): value = replaceVars(child.getAttribute("value"), vars_) switches[child.tagName] = adjustValueType(child.tagName, value) if case.getElementsByTagName("parse"): for item in case.getElementsByTagName("parse")[0].getElementsByTagName("item"): if item.hasAttribute("value"): value = replaceVars(item.getAttribute("value"), vars_) if item.hasAttribute("console_output"): parse_from_console_output = bool(item.getAttribute("console_output")) parse.append((value, parse_from_console_output)) conf.verbose = global_.get("verbose", 1) setVerbosity() msg = "running live test case: %s (%d/%d)" % (name, count, length) logger.info(msg) initCase(switches, count) test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING) test_case_fd.write("%s\n" % name) try: result = runCase(parse) except SqlmapNotVulnerableException: vulnerable = False finally: conf.verbose = global_.get("verbose", 1) setVerbosity() if result is True: logger.info("test passed") cleanCase() else: errMsg = "test failed" if Failures.failedItems: errMsg += " at parsing items: %s" % ", ".join(i for i in Failures.failedItems) errMsg += " - scan folder: %s" % paths.SQLMAP_OUTPUT_PATH errMsg += " - traceback: %s" % bool(Failures.failedTraceBack) if not vulnerable: errMsg += " - SQL injection not detected" logger.error(errMsg) test_case_fd.write("%s\n" % errMsg) if Failures.failedParseOn: console_output_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "console_output"), "wb", UNICODE_ENCODING) console_output_fd.write(Failures.failedParseOn) console_output_fd.close() if Failures.failedTraceBack: traceback_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "traceback"), "wb", UNICODE_ENCODING) traceback_fd.write(Failures.failedTraceBack) traceback_fd.close() beep() if conf.stopFail is True: return retVal test_case_fd.close() retVal &= bool(result) dataToStdout("\n") if retVal: logger.info("live test final result: PASSED") else: logger.error("live test final result: FAILED") return retVal def initCase(switches, count): Failures.failedItems = [] Failures.failedParseOn = None Failures.failedTraceBack = None paths.SQLMAP_OUTPUT_PATH = tempfile.mkdtemp(prefix="sqlmaptest-%d-" % count) paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") logger.debug("using output directory '%s' for this test case" % paths.SQLMAP_OUTPUT_PATH) LOGGER_HANDLER.stream = sys.stdout = tempfile.SpooledTemporaryFile(max_size=0, mode="w+b", prefix="sqlmapstdout-") cmdLineOptions = cmdLineParser() if switches: for key, value in switches.items(): if key in cmdLineOptions.__dict__: cmdLineOptions.__dict__[key] = value initOptions(cmdLineOptions, True) init() def cleanCase(): shutil.rmtree(paths.SQLMAP_OUTPUT_PATH, True) def runCase(parse): retVal = True handled_exception = None unhandled_exception = None result = False console = "" try: result = start() except KeyboardInterrupt: pass except SqlmapBaseException, e: handled_exception = e except Exception, e: unhandled_exception = e finally: sys.stdout.seek(0) console = sys.stdout.read() LOGGER_HANDLER.stream = sys.stdout = sys.__stdout__ if unhandled_exception: Failures.failedTraceBack = "unhandled exception: %s" % str(traceback.format_exc()) retVal = None elif handled_exception: Failures.failedTraceBack = "handled exception: %s" % str(traceback.format_exc()) retVal = None elif result is False: # this means no SQL injection has been detected - if None, ignore retVal = False console = getUnicode(console, encoding=sys.stdin.encoding) if parse and retVal: with codecs.open(conf.dumper.getOutputFile(), "rb", UNICODE_ENCODING) as f: content = f.read() for item, parse_from_console_output in parse: parse_on = console if parse_from_console_output else content if item.startswith("r'") and item.endswith("'"): if not re.search(item[2:-1], parse_on, re.DOTALL): retVal = None Failures.failedItems.append(item) elif item not in parse_on: retVal = None Failures.failedItems.append(item) if Failures.failedItems: Failures.failedParseOn = console elif retVal is False: Failures.failedParseOn = console return retVal def replaceVars(item, vars_): retVal = item if item and vars_: for var in re.findall("\$\{([^}]+)\}", item): if var in vars_: retVal = retVal.replace("${%s}" % var, vars_[var]) return retVal
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 624, 199, 7384, 334, 67, 9, 8315, 13, 7280, 3875, 1130, 19782, 334, 1014, 921, 3009, 1130, 14, 1308, 24793, 199, 9295, 314, 570, 283, 1301, 15, 16188, 1206, 7, 367, 16743, 4983, 199, 624, 199, 199, 646, 6010, 199, 646, 8868, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 984, 199, 646, 5549, 199, 646, 900, 199, 646, 5190, 199, 199, 504, 2402, 14, 66, 7840, 14, 66, 7840, 492, 506, 1545, 199, 504, 1973, 14, 5538, 14, 5538, 492, 1343, 199, 504, 1973, 14, 1018, 14, 2330, 492, 5436, 9270, 3049, 199, 504, 1973, 14, 1018, 14, 2330, 492, 666, 1378, 26080, 199, 504, 1973, 14, 1018, 14, 2330, 492, 664, 7087, 199, 504, 1973, 14, 1018, 14, 2330, 492, 2196, 2848, 199, 504, 1973, 14, 1018, 14, 2330, 492, 1586, 8672, 1173, 199, 504, 1973, 14, 1018, 14, 576, 492, 3743, 199, 504, 1973, 14, 1018, 14, 576, 492, 2512, 199, 504, 1973, 14, 1018, 14, 576, 492, 3792, 199, 504, 1973, 14, 1018, 14, 1971, 492, 428, 1710, 1130, 29900, 199, 504, 1973, 14, 1018, 14, 1971, 492, 428, 1710, 1130, 1763, 54, 21406, 461, 1726, 199, 504, 1973, 14, 1018, 14, 793, 492, 20184, 63, 30872, 199, 504, 1973, 14, 1018, 14, 1422, 492, 4205, 199, 504, 1973, 14, 1018, 14, 1422, 492, 4205, 4558, 199, 504, 1973, 14, 1018, 14, 1422, 492, 663, 3673, 5947, 199, 504, 1973, 14, 1018, 14, 1422, 807, 492, 2450, 2141, 199, 504, 1973, 14, 1018, 14, 1751, 492, 6778, 948, 9125, 63, 16314, 199, 504, 1973, 14, 1122, 14, 15612, 492, 2088, 3049, 2842, 199, 199, 533, 12176, 1482, 8, 785, 304, 272, 3405, 7412, 275, 488, 272, 3405, 4003, 3314, 275, 488, 272, 3405, 3921, 4540, 275, 488, 199, 199, 318, 308, 17767, 774, 837, 272, 408, 272, 23773, 314, 5678, 308, 17767, 5343, 402, 282, 2240, 272, 408, 339, 15011, 275, 715, 272, 2338, 12, 2582, 275, 378, 12, 378, 339, 367, 1738, 12, 5501, 1584, 315, 747, 14, 7757, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 304, 267, 340, 1263, 1547, 315, 1738, 367, 485, 315, 1689, 11470, 7522, 401, 298, 2911, 14150, 288, 1980, 398, 367, 284, 493, 315, 1584, 26, 288, 2582, 847, 413, 339, 367, 1738, 12, 5501, 1584, 315, 747, 14, 7757, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 304, 267, 340, 1263, 1547, 315, 1738, 367, 485, 315, 1689, 11470, 7522, 401, 298, 2911, 14150, 288, 1980, 398, 367, 284, 493, 315, 1584, 26, 288, 340, 747, 14, 515, 14, 7973, 8, 73, 493, 2788, 17, 1055, 2325, 342, 508, 3680, 647, 2, 436, 284, 493, 1137, 4396, 826, 4343, 647, 582, 355, 931, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 747, 14, 515, 14, 7973, 8, 73, 493, 2788, 16, 566, 355, 931, 275, 931, 14, 1814, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 12, 20093, 355, 931, 275, 931, 14, 1814, 8, 736, 14, 4127, 12, 1987, 1959, 10124, 7563, 355, 862, 26, 490, 636, 646, 721, 515, 9, 490, 859, 275, 984, 14, 3112, 59, 515, 61, 355, 871, 2186, 12, 1499, 26, 490, 15011, 275, 756, 490, 666, 1378, 26080, 4582, 82, 531, 490, 2329, 6173, 275, 298, 30697, 511, 3405, 737, 16306, 859, 1543, 83, 7, 4366, 83, 17211, 78, 5, 83, 2, 450, 334, 515, 12, 747, 14, 515, 14, 904, 8, 1231, 12, 284, 493, 395, 1499, 9, 490, 2512, 14, 705, 8, 1508, 6173, 9, 355, 587, 26, 490, 327, 3378, 1382, 2295, 490, 327, 10944, 26, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 11390, 14, 1360, 490, 334, 5328, 63, 835, 12, 511, 63, 835, 9, 275, 8868, 14, 29446, 8, 578, 9, 490, 340, 5988, 63, 835, 690, 378, 26, 717, 15011, 275, 756, 953, 2338, 847, 413, 288, 2004, 275, 1543, 68, 3149, 68, 4366, 68, 8530, 9, 283, 450, 334, 835, 12, 2582, 12, 6168, 8, 1960, 14, 16, 627, 2338, 1182, 2582, 430, 288, 666, 1378, 26080, 4582, 82, 9722, 83, 61, 359, 4531, 61, 4890, 26, 450, 83, 2, 450, 334, 521, 14, 6205, 3647, 56, 1288, 2004, 430, 339, 5436, 9270, 3049, 342, 272, 340, 15011, 26, 267, 2512, 14, 815, 480, 30697, 511, 4242, 754, 26, 510, 32032, 531, 272, 587, 26, 267, 2512, 14, 705, 480, 30697, 511, 4242, 754, 26, 26892, 531, 339, 372, 15011, 199, 199, 318, 11311, 1110, 804, 8, 20183, 12, 574, 304, 272, 367, 9614, 315, 2450, 2141, 14, 1612, 837, 267, 367, 536, 12, 730, 63, 315, 2450, 2141, 59, 6606, 1055, 1744, 837, 288, 340, 730, 8, 466, 4602, 508, 2008, 26, 355, 730, 63, 275, 730, 9925, 16, 61, 288, 340, 1947, 985, 508, 536, 26, 355, 340, 730, 63, 508, 298, 4871, 582, 490, 574, 275, 334, 585, 508, 298, 549, 531, 355, 916, 730, 63, 508, 298, 4115, 582, 490, 574, 275, 1109, 8, 585, 9, 355, 916, 730, 63, 508, 298, 1609, 582, 490, 574, 275, 2069, 8, 585, 9, 355, 2059, 272, 372, 574, 199, 199, 318, 12166, 774, 837, 272, 408, 272, 23773, 314, 511, 402, 282, 2240, 6169, 314, 12166, 5343, 3734, 272, 408, 339, 15011, 275, 715, 272, 2338, 275, 378, 272, 2288, 63, 275, 1052, 272, 6802, 63, 275, 1052, 339, 12166, 2219, 275, 1586, 8672, 1173, 8, 3771, 14, 31541, 63, 7569, 63, 4317, 9, 272, 2582, 275, 822, 8, 6442, 2219, 14, 15045, 480, 2546, 2237, 339, 1819, 275, 12166, 2219, 14, 15045, 480, 2966, 531, 272, 340, 1819, 26, 267, 367, 1242, 315, 1819, 26, 288, 367, 1982, 315, 1242, 14, 10626, 26, 355, 340, 1982, 14, 12412, 508, 1982, 14, 12535, 63, 8063, 436, 1982, 14, 1989, 1646, 480, 585, 2349, 490, 2288, 9925, 1739, 14, 20183, 61, 275, 11311, 1110, 804, 8, 1739, 14, 20183, 12, 1982, 14, 12956, 480, 585, 2237, 339, 1819, 275, 12166, 2219, 14, 15045, 480, 2936, 531, 272, 340, 1819, 26, 267, 367, 1242, 315, 1819, 26, 288, 367, 1982, 315, 1242, 14, 10626, 26, 355, 340, 1982 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 624, 199, 7384, 334, 67, 9, 8315, 13, 7280, 3875, 1130, 19782, 334, 1014, 921, 3009, 1130, 14, 1308, 24793, 199, 9295, 314, 570, 283, 1301, 15, 16188, 1206, 7, 367, 16743, 4983, 199, 624, 199, 199, 646, 6010, 199, 646, 8868, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 984, 199, 646, 5549, 199, 646, 900, 199, 646, 5190, 199, 199, 504, 2402, 14, 66, 7840, 14, 66, 7840, 492, 506, 1545, 199, 504, 1973, 14, 5538, 14, 5538, 492, 1343, 199, 504, 1973, 14, 1018, 14, 2330, 492, 5436, 9270, 3049, 199, 504, 1973, 14, 1018, 14, 2330, 492, 666, 1378, 26080, 199, 504, 1973, 14, 1018, 14, 2330, 492, 664, 7087, 199, 504, 1973, 14, 1018, 14, 2330, 492, 2196, 2848, 199, 504, 1973, 14, 1018, 14, 2330, 492, 1586, 8672, 1173, 199, 504, 1973, 14, 1018, 14, 576, 492, 3743, 199, 504, 1973, 14, 1018, 14, 576, 492, 2512, 199, 504, 1973, 14, 1018, 14, 576, 492, 3792, 199, 504, 1973, 14, 1018, 14, 1971, 492, 428, 1710, 1130, 29900, 199, 504, 1973, 14, 1018, 14, 1971, 492, 428, 1710, 1130, 1763, 54, 21406, 461, 1726, 199, 504, 1973, 14, 1018, 14, 793, 492, 20184, 63, 30872, 199, 504, 1973, 14, 1018, 14, 1422, 492, 4205, 199, 504, 1973, 14, 1018, 14, 1422, 492, 4205, 4558, 199, 504, 1973, 14, 1018, 14, 1422, 492, 663, 3673, 5947, 199, 504, 1973, 14, 1018, 14, 1422, 807, 492, 2450, 2141, 199, 504, 1973, 14, 1018, 14, 1751, 492, 6778, 948, 9125, 63, 16314, 199, 504, 1973, 14, 1122, 14, 15612, 492, 2088, 3049, 2842, 199, 199, 533, 12176, 1482, 8, 785, 304, 272, 3405, 7412, 275, 488, 272, 3405, 4003, 3314, 275, 488, 272, 3405, 3921, 4540, 275, 488, 199, 199, 318, 308, 17767, 774, 837, 272, 408, 272, 23773, 314, 5678, 308, 17767, 5343, 402, 282, 2240, 272, 408, 339, 15011, 275, 715, 272, 2338, 12, 2582, 275, 378, 12, 378, 339, 367, 1738, 12, 5501, 1584, 315, 747, 14, 7757, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 304, 267, 340, 1263, 1547, 315, 1738, 367, 485, 315, 1689, 11470, 7522, 401, 298, 2911, 14150, 288, 1980, 398, 367, 284, 493, 315, 1584, 26, 288, 2582, 847, 413, 339, 367, 1738, 12, 5501, 1584, 315, 747, 14, 7757, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 304, 267, 340, 1263, 1547, 315, 1738, 367, 485, 315, 1689, 11470, 7522, 401, 298, 2911, 14150, 288, 1980, 398, 367, 284, 493, 315, 1584, 26, 288, 340, 747, 14, 515, 14, 7973, 8, 73, 493, 2788, 17, 1055, 2325, 342, 508, 3680, 647, 2, 436, 284, 493, 1137, 4396, 826, 4343, 647, 582, 355, 931, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 747, 14, 515, 14, 7973, 8, 73, 493, 2788, 16, 566, 355, 931, 275, 931, 14, 1814, 8, 3771, 14, 4657, 5443, 63, 5441, 63, 3243, 12, 20093, 355, 931, 275, 931, 14, 1814, 8, 736, 14, 4127, 12, 1987, 1959, 10124, 7563, 355, 862, 26, 490, 636, 646, 721, 515, 9, 490, 859, 275, 984, 14, 3112, 59, 515, 61, 355, 871, 2186, 12, 1499, 26, 490, 15011, 275, 756, 490, 666, 1378, 26080, 4582, 82, 531, 490, 2329, 6173, 275, 298, 30697, 511, 3405, 737, 16306, 859, 1543, 83, 7, 4366, 83, 17211, 78, 5, 83, 2, 450, 334, 515, 12, 747, 14, 515, 14, 904, 8, 1231, 12, 284, 493, 395, 1499, 9, 490, 2512, 14, 705, 8, 1508, 6173, 9, 355, 587, 26, 490, 327, 3378, 1382, 2295, 490, 327, 10944, 26, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 11390, 14, 1360, 490, 334, 5328, 63, 835, 12, 511, 63, 835, 9, 275, 8868, 14, 29446, 8, 578, 9, 490, 340, 5988, 63, 835, 690, 378, 26, 717, 15011, 275, 756, 953, 2338, 847, 413, 288, 2004, 275, 1543, 68, 3149, 68, 4366, 68, 8530, 9, 283, 450, 334, 835, 12, 2582, 12, 6168, 8, 1960, 14, 16, 627, 2338, 1182, 2582, 430, 288, 666, 1378, 26080, 4582, 82, 9722, 83, 61, 359, 4531, 61, 4890, 26, 450, 83, 2, 450, 334, 521, 14, 6205, 3647, 56, 1288, 2004, 430, 339, 5436, 9270, 3049, 342, 272, 340, 15011, 26, 267, 2512, 14, 815, 480, 30697, 511, 4242, 754, 26, 510, 32032, 531, 272, 587, 26, 267, 2512, 14, 705, 480, 30697, 511, 4242, 754, 26, 26892, 531, 339, 372, 15011, 199, 199, 318, 11311, 1110, 804, 8, 20183, 12, 574, 304, 272, 367, 9614, 315, 2450, 2141, 14, 1612, 837, 267, 367, 536, 12, 730, 63, 315, 2450, 2141, 59, 6606, 1055, 1744, 837, 288, 340, 730, 8, 466, 4602, 508, 2008, 26, 355, 730, 63, 275, 730, 9925, 16, 61, 288, 340, 1947, 985, 508, 536, 26, 355, 340, 730, 63, 508, 298, 4871, 582, 490, 574, 275, 334, 585, 508, 298, 549, 531, 355, 916, 730, 63, 508, 298, 4115, 582, 490, 574, 275, 1109, 8, 585, 9, 355, 916, 730, 63, 508, 298, 1609, 582, 490, 574, 275, 2069, 8, 585, 9, 355, 2059, 272, 372, 574, 199, 199, 318, 12166, 774, 837, 272, 408, 272, 23773, 314, 511, 402, 282, 2240, 6169, 314, 12166, 5343, 3734, 272, 408, 339, 15011, 275, 715, 272, 2338, 275, 378, 272, 2288, 63, 275, 1052, 272, 6802, 63, 275, 1052, 339, 12166, 2219, 275, 1586, 8672, 1173, 8, 3771, 14, 31541, 63, 7569, 63, 4317, 9, 272, 2582, 275, 822, 8, 6442, 2219, 14, 15045, 480, 2546, 2237, 339, 1819, 275, 12166, 2219, 14, 15045, 480, 2966, 531, 272, 340, 1819, 26, 267, 367, 1242, 315, 1819, 26, 288, 367, 1982, 315, 1242, 14, 10626, 26, 355, 340, 1982, 14, 12412, 508, 1982, 14, 12535, 63, 8063, 436, 1982, 14, 1989, 1646, 480, 585, 2349, 490, 2288, 9925, 1739, 14, 20183, 61, 275, 11311, 1110, 804, 8, 1739, 14, 20183, 12, 1982, 14, 12956, 480, 585, 2237, 339, 1819, 275, 12166, 2219, 14, 15045, 480, 2936, 531, 272, 340, 1819, 26, 267, 367, 1242, 315, 1819, 26, 288, 367, 1982, 315, 1242, 14, 10626, 26, 355, 340, 1982, 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,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SelectProviderRegistry classes Run with: ctest -V -R PyQgsSourceSelectProvider .. note:: 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. """ import os import tempfile from qgis.gui import (QgsGui, QgsSourceSelectProvider, QgsSourceSelectProviderRegistry, QgsAbstractDataSourceWidget) from qgis.testing import start_app, unittest from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtWidgets import QWidget __author__ = 'Alessandro Pasotti' __date__ = '01/09/2017' __copyright__ = 'Copyright 2017, The QGIS Project' # This will get replaced with a git SHA1 when you do a git archive __revision__ = '$Format:%H$' start_app() class ConcreteDataSourceWidget(QgsAbstractDataSourceWidget): pass class ConcreteSourceSelectProvider(QgsSourceSelectProvider): def providerKey(self): return "MyTestProviderKey" def text(self): return "MyTestProviderText" def icon(self): return QIcon() def createDataSourceWidget(self): return ConcreteDataSourceWidget() def ordering(self): return 1 class ConcreteSourceSelectProvider2(QgsSourceSelectProvider): def providerKey(self): return "MyTestProviderKey2" def text(self): return "MyTestProviderText2" def name(self): return "MyName" def toolTip(self): return "MyToolTip" def icon(self): return QIcon() def createDataSourceWidget(self): return ConcreteDataSourceWidget() def ordering(self): return 2 class TestQgsSourceSelectProvider(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def testConcreteClass(self): provider = ConcreteSourceSelectProvider() self.assertTrue(isinstance(provider, ConcreteSourceSelectProvider)) widget = provider.createDataSourceWidget() self.assertTrue(isinstance(widget, ConcreteDataSourceWidget)) self.assertEqual(provider.providerKey(), "MyTestProviderKey") self.assertEqual(provider.name(), "MyTestProviderKey") self.assertEqual(provider.text(), "MyTestProviderText") self.assertEqual(provider.toolTip(), "") self.assertEqual(provider.ordering(), 1) self.assertTrue(isinstance(provider.icon(), QIcon)) # test toolTip provider = ConcreteSourceSelectProvider2() self.assertEqual(provider.toolTip(), "MyToolTip") def _testRegistry(self, registry): registry.addProvider(ConcreteSourceSelectProvider()) registry.addProvider(ConcreteSourceSelectProvider2()) # Check order self.assertEqual(['MyTestProviderKey', 'MyName'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')]) registry = QgsSourceSelectProviderRegistry() registry.addProvider(ConcreteSourceSelectProvider()) registry.addProvider(ConcreteSourceSelectProvider2()) # Check order self.assertEqual(['MyTestProviderKey', 'MyName'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')]) # Get provider by name self.assertTrue(registry.providerByName('MyTestProviderKey')) self.assertTrue(registry.providerByName('MyName')) # Get not existent by name self.assertFalse(registry.providerByName('Oh This Is Missing!')) # Get providers by data provider key self.assertGreater(len(registry.providersByKey('MyTestProviderKey')), 0) self.assertGreater(len(registry.providersByKey('MyTestProviderKey2')), 0) # Get not existent by key self.assertEqual(len(registry.providersByKey('Oh This Is Missing!')), 0) def testRemoveProvider(self): registry = QgsSourceSelectProviderRegistry() registry.addProvider(ConcreteSourceSelectProvider()) registry.addProvider(ConcreteSourceSelectProvider2()) self.assertEqual(['MyTestProviderKey', 'MyName'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')]) self.assertTrue(registry.removeProvider(registry.providerByName('MyName'))) self.assertEqual(['MyTestProviderKey'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')]) self.assertTrue(registry.removeProvider(registry.providerByName('MyTestProviderKey'))) self.assertEqual([], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')]) def testRegistry(self): registry = QgsSourceSelectProviderRegistry() self._testRegistry(registry) def testRegistrySingleton(self): registry = QgsGui.sourceSelectProviderRegistry() self._testRegistry(registry) # Check that at least OGR and GDAL are here self.assertTrue(registry.providersByKey('ogr')) self.assertTrue(registry.providersByKey('gdal')) if __name__ == '__main__': unittest.main()
gpl-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 774, 314, 4888, 2980, 5446, 6663, 221, 199, 460, 4888, 2980, 5446, 6663, 10899, 3992, 199, 199, 2540, 543, 26, 286, 396, 446, 54, 446, 50, 1611, 7350, 2980, 5446, 6663, 199, 199, 703, 5317, 447, 961, 2240, 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, 701, 199, 1589, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 624, 199, 199, 646, 747, 199, 646, 5549, 199, 504, 15640, 14, 5885, 492, 334, 7350, 4324, 12, 4888, 2980, 5446, 6663, 12, 4888, 2980, 5446, 6663, 10899, 12, 4888, 8458, 16693, 3339, 9, 199, 504, 15640, 14, 4776, 492, 1343, 63, 571, 12, 2882, 199, 504, 15640, 14, 24107, 14, 10604, 492, 1413, 8954, 199, 504, 15640, 14, 24107, 14, 29081, 492, 1413, 3339, 199, 199, 363, 2502, 363, 275, 283, 33, 2003, 460, 293, 510, 305, 357, 280, 7, 199, 363, 602, 363, 275, 283, 614, 15, 1643, 15, 10680, 7, 199, 363, 7307, 363, 275, 283, 7384, 9708, 12, 710, 27024, 7290, 7, 199, 3, 961, 911, 664, 8717, 543, 282, 6135, 12002, 17, 1380, 1265, 886, 282, 6135, 6359, 199, 363, 5792, 363, 275, 4505, 3484, 2689, 40, 12913, 421, 199, 928, 63, 571, 342, 421, 199, 533, 1448, 7564, 16693, 3339, 8, 7350, 8458, 16693, 3339, 304, 272, 986, 421, 199, 533, 1448, 7564, 2980, 5446, 6663, 8, 7350, 2980, 5446, 6663, 304, 339, 347, 5022, 1197, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1197, 2, 339, 347, 1318, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1872, 2, 339, 347, 7016, 8, 277, 304, 267, 372, 1413, 8954, 342, 339, 347, 1218, 16693, 3339, 8, 277, 304, 267, 372, 1448, 7564, 16693, 3339, 342, 339, 347, 7794, 8, 277, 304, 267, 372, 413, 421, 199, 533, 1448, 7564, 2980, 5446, 6663, 18, 8, 7350, 2980, 5446, 6663, 304, 339, 347, 5022, 1197, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1197, 18, 2, 339, 347, 1318, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1872, 18, 2, 339, 347, 536, 8, 277, 304, 267, 372, 298, 5713, 985, 2, 339, 347, 4744, 15915, 8, 277, 304, 267, 372, 298, 5713, 21784, 2, 339, 347, 7016, 8, 277, 304, 267, 372, 1413, 8954, 342, 339, 347, 1218, 16693, 3339, 8, 277, 304, 267, 372, 1448, 7564, 16693, 3339, 342, 339, 347, 7794, 8, 277, 304, 267, 372, 499, 421, 199, 533, 1379, 7350, 2980, 5446, 6663, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 986, 339, 347, 6766, 8, 277, 304, 267, 986, 339, 347, 511, 714, 7564, 2543, 8, 277, 304, 398, 5022, 275, 1448, 7564, 2980, 5446, 6663, 342, 267, 291, 14, 1815, 8, 6074, 8, 3780, 12, 1448, 7564, 2980, 5446, 6663, 430, 267, 3938, 275, 5022, 14, 981, 16693, 3339, 342, 267, 291, 14, 1815, 8, 6074, 8, 3440, 12, 1448, 7564, 16693, 3339, 430, 267, 291, 14, 629, 8, 3780, 14, 3780, 1197, 1062, 298, 5713, 774, 6663, 1197, 531, 267, 291, 14, 629, 8, 3780, 14, 354, 1062, 298, 5713, 774, 6663, 1197, 531, 267, 291, 14, 629, 8, 3780, 14, 505, 1062, 298, 5713, 774, 6663, 1872, 531, 267, 291, 14, 629, 8, 3780, 14, 3557, 15915, 1062, 6899, 267, 291, 14, 629, 8, 3780, 14, 7128, 1062, 413, 9, 267, 291, 14, 1815, 8, 6074, 8, 3780, 14, 4677, 1062, 1413, 8954, 430, 398, 327, 511, 4744, 15915, 267, 5022, 275, 1448, 7564, 2980, 5446, 6663, 18, 342, 267, 291, 14, 629, 8, 3780, 14, 3557, 15915, 1062, 298, 5713, 21784, 531, 339, 347, 485, 396, 10899, 8, 277, 12, 7086, 304, 398, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 398, 327, 2670, 1865, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 7086, 275, 4888, 2980, 5446, 6663, 10899, 342, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 398, 327, 2670, 1865, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 327, 2372, 5022, 701, 536, 267, 291, 14, 1815, 8, 5189, 14, 3780, 11190, 360, 5713, 774, 6663, 1197, 1333, 267, 291, 14, 1815, 8, 5189, 14, 3780, 11190, 360, 5713, 985, 1333, 398, 327, 2372, 440, 444, 13298, 701, 536, 267, 291, 14, 3334, 8, 5189, 14, 3780, 11190, 360, 47, 72, 961, 6596, 15626, 1, 1333, 398, 327, 2372, 18032, 701, 666, 5022, 790, 267, 291, 14, 15070, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 5713, 774, 6663, 1197, 3855, 378, 9, 267, 291, 14, 15070, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 5713, 774, 6663, 1197, 18, 3855, 378, 9, 398, 327, 2372, 440, 444, 13298, 701, 790, 267, 291, 14, 629, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 47, 72, 961, 6596, 15626, 1, 3855, 378, 9, 339, 347, 511, 5587, 6663, 8, 277, 304, 267, 7086, 275, 4888, 2980, 5446, 6663, 10899, 342, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 291, 14, 1815, 8, 5189, 14, 2168, 6663, 8, 5189, 14, 3780, 11190, 360, 5713 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 774, 314, 4888, 2980, 5446, 6663, 221, 199, 460, 4888, 2980, 5446, 6663, 10899, 3992, 199, 199, 2540, 543, 26, 286, 396, 446, 54, 446, 50, 1611, 7350, 2980, 5446, 6663, 199, 199, 703, 5317, 447, 961, 2240, 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, 701, 199, 1589, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 624, 199, 199, 646, 747, 199, 646, 5549, 199, 504, 15640, 14, 5885, 492, 334, 7350, 4324, 12, 4888, 2980, 5446, 6663, 12, 4888, 2980, 5446, 6663, 10899, 12, 4888, 8458, 16693, 3339, 9, 199, 504, 15640, 14, 4776, 492, 1343, 63, 571, 12, 2882, 199, 504, 15640, 14, 24107, 14, 10604, 492, 1413, 8954, 199, 504, 15640, 14, 24107, 14, 29081, 492, 1413, 3339, 199, 199, 363, 2502, 363, 275, 283, 33, 2003, 460, 293, 510, 305, 357, 280, 7, 199, 363, 602, 363, 275, 283, 614, 15, 1643, 15, 10680, 7, 199, 363, 7307, 363, 275, 283, 7384, 9708, 12, 710, 27024, 7290, 7, 199, 3, 961, 911, 664, 8717, 543, 282, 6135, 12002, 17, 1380, 1265, 886, 282, 6135, 6359, 199, 363, 5792, 363, 275, 4505, 3484, 2689, 40, 12913, 421, 199, 928, 63, 571, 342, 421, 199, 533, 1448, 7564, 16693, 3339, 8, 7350, 8458, 16693, 3339, 304, 272, 986, 421, 199, 533, 1448, 7564, 2980, 5446, 6663, 8, 7350, 2980, 5446, 6663, 304, 339, 347, 5022, 1197, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1197, 2, 339, 347, 1318, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1872, 2, 339, 347, 7016, 8, 277, 304, 267, 372, 1413, 8954, 342, 339, 347, 1218, 16693, 3339, 8, 277, 304, 267, 372, 1448, 7564, 16693, 3339, 342, 339, 347, 7794, 8, 277, 304, 267, 372, 413, 421, 199, 533, 1448, 7564, 2980, 5446, 6663, 18, 8, 7350, 2980, 5446, 6663, 304, 339, 347, 5022, 1197, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1197, 18, 2, 339, 347, 1318, 8, 277, 304, 267, 372, 298, 5713, 774, 6663, 1872, 18, 2, 339, 347, 536, 8, 277, 304, 267, 372, 298, 5713, 985, 2, 339, 347, 4744, 15915, 8, 277, 304, 267, 372, 298, 5713, 21784, 2, 339, 347, 7016, 8, 277, 304, 267, 372, 1413, 8954, 342, 339, 347, 1218, 16693, 3339, 8, 277, 304, 267, 372, 1448, 7564, 16693, 3339, 342, 339, 347, 7794, 8, 277, 304, 267, 372, 499, 421, 199, 533, 1379, 7350, 2980, 5446, 6663, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 986, 339, 347, 6766, 8, 277, 304, 267, 986, 339, 347, 511, 714, 7564, 2543, 8, 277, 304, 398, 5022, 275, 1448, 7564, 2980, 5446, 6663, 342, 267, 291, 14, 1815, 8, 6074, 8, 3780, 12, 1448, 7564, 2980, 5446, 6663, 430, 267, 3938, 275, 5022, 14, 981, 16693, 3339, 342, 267, 291, 14, 1815, 8, 6074, 8, 3440, 12, 1448, 7564, 16693, 3339, 430, 267, 291, 14, 629, 8, 3780, 14, 3780, 1197, 1062, 298, 5713, 774, 6663, 1197, 531, 267, 291, 14, 629, 8, 3780, 14, 354, 1062, 298, 5713, 774, 6663, 1197, 531, 267, 291, 14, 629, 8, 3780, 14, 505, 1062, 298, 5713, 774, 6663, 1872, 531, 267, 291, 14, 629, 8, 3780, 14, 3557, 15915, 1062, 6899, 267, 291, 14, 629, 8, 3780, 14, 7128, 1062, 413, 9, 267, 291, 14, 1815, 8, 6074, 8, 3780, 14, 4677, 1062, 1413, 8954, 430, 398, 327, 511, 4744, 15915, 267, 5022, 275, 1448, 7564, 2980, 5446, 6663, 18, 342, 267, 291, 14, 629, 8, 3780, 14, 3557, 15915, 1062, 298, 5713, 21784, 531, 339, 347, 485, 396, 10899, 8, 277, 12, 7086, 304, 398, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 398, 327, 2670, 1865, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 7086, 275, 4888, 2980, 5446, 6663, 10899, 342, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 398, 327, 2670, 1865, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 327, 2372, 5022, 701, 536, 267, 291, 14, 1815, 8, 5189, 14, 3780, 11190, 360, 5713, 774, 6663, 1197, 1333, 267, 291, 14, 1815, 8, 5189, 14, 3780, 11190, 360, 5713, 985, 1333, 398, 327, 2372, 440, 444, 13298, 701, 536, 267, 291, 14, 3334, 8, 5189, 14, 3780, 11190, 360, 47, 72, 961, 6596, 15626, 1, 1333, 398, 327, 2372, 18032, 701, 666, 5022, 790, 267, 291, 14, 15070, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 5713, 774, 6663, 1197, 3855, 378, 9, 267, 291, 14, 15070, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 5713, 774, 6663, 1197, 18, 3855, 378, 9, 398, 327, 2372, 440, 444, 13298, 701, 790, 267, 291, 14, 629, 8, 552, 8, 5189, 14, 9710, 2175, 1197, 360, 47, 72, 961, 6596, 15626, 1, 3855, 378, 9, 339, 347, 511, 5587, 6663, 8, 277, 304, 267, 7086, 275, 4888, 2980, 5446, 6663, 10899, 342, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 1012, 267, 7086, 14, 525, 6663, 8, 714, 7564, 2980, 5446, 6663, 18, 1012, 267, 291, 14, 629, 2941, 5713, 774, 6663, 1197, 297, 283, 5713, 985, 995, 359, 80, 14, 354, 342, 367, 299, 315, 7086, 14, 9710, 342, 340, 299, 14, 3780, 1197, 1252, 2460, 360, 5713, 774, 6663, 1197, 2023, 398, 291, 14, 1815, 8, 5189, 14, 2168, 6663, 8, 5189, 14, 3780, 11190, 360, 5713, 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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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 ]
razvanphp/arangodb
3rdParty/V8-3.31.74.1/third_party/python_26/Lib/encodings/cp875.py
593
13110
""" Python Character Mapping Codec cp875 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP875.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_table)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0] class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name='cp875', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ### Decoding Table decoding_table = ( u'\x00' # 0x00 -> NULL u'\x01' # 0x01 -> START OF HEADING u'\x02' # 0x02 -> START OF TEXT u'\x03' # 0x03 -> END OF TEXT u'\x9c' # 0x04 -> CONTROL u'\t' # 0x05 -> HORIZONTAL TABULATION u'\x86' # 0x06 -> CONTROL u'\x7f' # 0x07 -> DELETE u'\x97' # 0x08 -> CONTROL u'\x8d' # 0x09 -> CONTROL u'\x8e' # 0x0A -> CONTROL u'\x0b' # 0x0B -> VERTICAL TABULATION u'\x0c' # 0x0C -> FORM FEED u'\r' # 0x0D -> CARRIAGE RETURN u'\x0e' # 0x0E -> SHIFT OUT u'\x0f' # 0x0F -> SHIFT IN u'\x10' # 0x10 -> DATA LINK ESCAPE u'\x11' # 0x11 -> DEVICE CONTROL ONE u'\x12' # 0x12 -> DEVICE CONTROL TWO u'\x13' # 0x13 -> DEVICE CONTROL THREE u'\x9d' # 0x14 -> CONTROL u'\x85' # 0x15 -> CONTROL u'\x08' # 0x16 -> BACKSPACE u'\x87' # 0x17 -> CONTROL u'\x18' # 0x18 -> CANCEL u'\x19' # 0x19 -> END OF MEDIUM u'\x92' # 0x1A -> CONTROL u'\x8f' # 0x1B -> CONTROL u'\x1c' # 0x1C -> FILE SEPARATOR u'\x1d' # 0x1D -> GROUP SEPARATOR u'\x1e' # 0x1E -> RECORD SEPARATOR u'\x1f' # 0x1F -> UNIT SEPARATOR u'\x80' # 0x20 -> CONTROL u'\x81' # 0x21 -> CONTROL u'\x82' # 0x22 -> CONTROL u'\x83' # 0x23 -> CONTROL u'\x84' # 0x24 -> CONTROL u'\n' # 0x25 -> LINE FEED u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK u'\x1b' # 0x27 -> ESCAPE u'\x88' # 0x28 -> CONTROL u'\x89' # 0x29 -> CONTROL u'\x8a' # 0x2A -> CONTROL u'\x8b' # 0x2B -> CONTROL u'\x8c' # 0x2C -> CONTROL u'\x05' # 0x2D -> ENQUIRY u'\x06' # 0x2E -> ACKNOWLEDGE u'\x07' # 0x2F -> BELL u'\x90' # 0x30 -> CONTROL u'\x91' # 0x31 -> CONTROL u'\x16' # 0x32 -> SYNCHRONOUS IDLE u'\x93' # 0x33 -> CONTROL u'\x94' # 0x34 -> CONTROL u'\x95' # 0x35 -> CONTROL u'\x96' # 0x36 -> CONTROL u'\x04' # 0x37 -> END OF TRANSMISSION u'\x98' # 0x38 -> CONTROL u'\x99' # 0x39 -> CONTROL u'\x9a' # 0x3A -> CONTROL u'\x9b' # 0x3B -> CONTROL u'\x14' # 0x3C -> DEVICE CONTROL FOUR u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE u'\x9e' # 0x3E -> CONTROL u'\x1a' # 0x3F -> SUBSTITUTE u' ' # 0x40 -> SPACE u'\u0391' # 0x41 -> GREEK CAPITAL LETTER ALPHA u'\u0392' # 0x42 -> GREEK CAPITAL LETTER BETA u'\u0393' # 0x43 -> GREEK CAPITAL LETTER GAMMA u'\u0394' # 0x44 -> GREEK CAPITAL LETTER DELTA u'\u0395' # 0x45 -> GREEK CAPITAL LETTER EPSILON u'\u0396' # 0x46 -> GREEK CAPITAL LETTER ZETA u'\u0397' # 0x47 -> GREEK CAPITAL LETTER ETA u'\u0398' # 0x48 -> GREEK CAPITAL LETTER THETA u'\u0399' # 0x49 -> GREEK CAPITAL LETTER IOTA u'[' # 0x4A -> LEFT SQUARE BRACKET u'.' # 0x4B -> FULL STOP u'<' # 0x4C -> LESS-THAN SIGN u'(' # 0x4D -> LEFT PARENTHESIS u'+' # 0x4E -> PLUS SIGN u'!' # 0x4F -> EXCLAMATION MARK u'&' # 0x50 -> AMPERSAND u'\u039a' # 0x51 -> GREEK CAPITAL LETTER KAPPA u'\u039b' # 0x52 -> GREEK CAPITAL LETTER LAMDA u'\u039c' # 0x53 -> GREEK CAPITAL LETTER MU u'\u039d' # 0x54 -> GREEK CAPITAL LETTER NU u'\u039e' # 0x55 -> GREEK CAPITAL LETTER XI u'\u039f' # 0x56 -> GREEK CAPITAL LETTER OMICRON u'\u03a0' # 0x57 -> GREEK CAPITAL LETTER PI u'\u03a1' # 0x58 -> GREEK CAPITAL LETTER RHO u'\u03a3' # 0x59 -> GREEK CAPITAL LETTER SIGMA u']' # 0x5A -> RIGHT SQUARE BRACKET u'$' # 0x5B -> DOLLAR SIGN u'*' # 0x5C -> ASTERISK u')' # 0x5D -> RIGHT PARENTHESIS u';' # 0x5E -> SEMICOLON u'^' # 0x5F -> CIRCUMFLEX ACCENT u'-' # 0x60 -> HYPHEN-MINUS u'/' # 0x61 -> SOLIDUS u'\u03a4' # 0x62 -> GREEK CAPITAL LETTER TAU u'\u03a5' # 0x63 -> GREEK CAPITAL LETTER UPSILON u'\u03a6' # 0x64 -> GREEK CAPITAL LETTER PHI u'\u03a7' # 0x65 -> GREEK CAPITAL LETTER CHI u'\u03a8' # 0x66 -> GREEK CAPITAL LETTER PSI u'\u03a9' # 0x67 -> GREEK CAPITAL LETTER OMEGA u'\u03aa' # 0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA u'\u03ab' # 0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA u'|' # 0x6A -> VERTICAL LINE u',' # 0x6B -> COMMA u'%' # 0x6C -> PERCENT SIGN u'_' # 0x6D -> LOW LINE u'>' # 0x6E -> GREATER-THAN SIGN u'?' # 0x6F -> QUESTION MARK u'\xa8' # 0x70 -> DIAERESIS u'\u0386' # 0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS u'\u0388' # 0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS u'\u0389' # 0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS u'\xa0' # 0x74 -> NO-BREAK SPACE u'\u038a' # 0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS u'\u038c' # 0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS u'\u038e' # 0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS u'\u038f' # 0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS u'`' # 0x79 -> GRAVE ACCENT u':' # 0x7A -> COLON u'#' # 0x7B -> NUMBER SIGN u'@' # 0x7C -> COMMERCIAL AT u"'" # 0x7D -> APOSTROPHE u'=' # 0x7E -> EQUALS SIGN u'"' # 0x7F -> QUOTATION MARK u'\u0385' # 0x80 -> GREEK DIALYTIKA TONOS u'a' # 0x81 -> LATIN SMALL LETTER A u'b' # 0x82 -> LATIN SMALL LETTER B u'c' # 0x83 -> LATIN SMALL LETTER C u'd' # 0x84 -> LATIN SMALL LETTER D u'e' # 0x85 -> LATIN SMALL LETTER E u'f' # 0x86 -> LATIN SMALL LETTER F u'g' # 0x87 -> LATIN SMALL LETTER G u'h' # 0x88 -> LATIN SMALL LETTER H u'i' # 0x89 -> LATIN SMALL LETTER I u'\u03b1' # 0x8A -> GREEK SMALL LETTER ALPHA u'\u03b2' # 0x8B -> GREEK SMALL LETTER BETA u'\u03b3' # 0x8C -> GREEK SMALL LETTER GAMMA u'\u03b4' # 0x8D -> GREEK SMALL LETTER DELTA u'\u03b5' # 0x8E -> GREEK SMALL LETTER EPSILON u'\u03b6' # 0x8F -> GREEK SMALL LETTER ZETA u'\xb0' # 0x90 -> DEGREE SIGN u'j' # 0x91 -> LATIN SMALL LETTER J u'k' # 0x92 -> LATIN SMALL LETTER K u'l' # 0x93 -> LATIN SMALL LETTER L u'm' # 0x94 -> LATIN SMALL LETTER M u'n' # 0x95 -> LATIN SMALL LETTER N u'o' # 0x96 -> LATIN SMALL LETTER O u'p' # 0x97 -> LATIN SMALL LETTER P u'q' # 0x98 -> LATIN SMALL LETTER Q u'r' # 0x99 -> LATIN SMALL LETTER R u'\u03b7' # 0x9A -> GREEK SMALL LETTER ETA u'\u03b8' # 0x9B -> GREEK SMALL LETTER THETA u'\u03b9' # 0x9C -> GREEK SMALL LETTER IOTA u'\u03ba' # 0x9D -> GREEK SMALL LETTER KAPPA u'\u03bb' # 0x9E -> GREEK SMALL LETTER LAMDA u'\u03bc' # 0x9F -> GREEK SMALL LETTER MU u'\xb4' # 0xA0 -> ACUTE ACCENT u'~' # 0xA1 -> TILDE u's' # 0xA2 -> LATIN SMALL LETTER S u't' # 0xA3 -> LATIN SMALL LETTER T u'u' # 0xA4 -> LATIN SMALL LETTER U u'v' # 0xA5 -> LATIN SMALL LETTER V u'w' # 0xA6 -> LATIN SMALL LETTER W u'x' # 0xA7 -> LATIN SMALL LETTER X u'y' # 0xA8 -> LATIN SMALL LETTER Y u'z' # 0xA9 -> LATIN SMALL LETTER Z u'\u03bd' # 0xAA -> GREEK SMALL LETTER NU u'\u03be' # 0xAB -> GREEK SMALL LETTER XI u'\u03bf' # 0xAC -> GREEK SMALL LETTER OMICRON u'\u03c0' # 0xAD -> GREEK SMALL LETTER PI u'\u03c1' # 0xAE -> GREEK SMALL LETTER RHO u'\u03c3' # 0xAF -> GREEK SMALL LETTER SIGMA u'\xa3' # 0xB0 -> POUND SIGN u'\u03ac' # 0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS u'\u03ad' # 0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS u'\u03ae' # 0xB3 -> GREEK SMALL LETTER ETA WITH TONOS u'\u03ca' # 0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA u'\u03af' # 0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS u'\u03cc' # 0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS u'\u03cd' # 0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS u'\u03cb' # 0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA u'\u03ce' # 0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS u'\u03c2' # 0xBA -> GREEK SMALL LETTER FINAL SIGMA u'\u03c4' # 0xBB -> GREEK SMALL LETTER TAU u'\u03c5' # 0xBC -> GREEK SMALL LETTER UPSILON u'\u03c6' # 0xBD -> GREEK SMALL LETTER PHI u'\u03c7' # 0xBE -> GREEK SMALL LETTER CHI u'\u03c8' # 0xBF -> GREEK SMALL LETTER PSI u'{' # 0xC0 -> LEFT CURLY BRACKET u'A' # 0xC1 -> LATIN CAPITAL LETTER A u'B' # 0xC2 -> LATIN CAPITAL LETTER B u'C' # 0xC3 -> LATIN CAPITAL LETTER C u'D' # 0xC4 -> LATIN CAPITAL LETTER D u'E' # 0xC5 -> LATIN CAPITAL LETTER E u'F' # 0xC6 -> LATIN CAPITAL LETTER F u'G' # 0xC7 -> LATIN CAPITAL LETTER G u'H' # 0xC8 -> LATIN CAPITAL LETTER H u'I' # 0xC9 -> LATIN CAPITAL LETTER I u'\xad' # 0xCA -> SOFT HYPHEN u'\u03c9' # 0xCB -> GREEK SMALL LETTER OMEGA u'\u0390' # 0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS u'\u03b0' # 0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS u'\u2018' # 0xCE -> LEFT SINGLE QUOTATION MARK u'\u2015' # 0xCF -> HORIZONTAL BAR u'}' # 0xD0 -> RIGHT CURLY BRACKET u'J' # 0xD1 -> LATIN CAPITAL LETTER J u'K' # 0xD2 -> LATIN CAPITAL LETTER K u'L' # 0xD3 -> LATIN CAPITAL LETTER L u'M' # 0xD4 -> LATIN CAPITAL LETTER M u'N' # 0xD5 -> LATIN CAPITAL LETTER N u'O' # 0xD6 -> LATIN CAPITAL LETTER O u'P' # 0xD7 -> LATIN CAPITAL LETTER P u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q u'R' # 0xD9 -> LATIN CAPITAL LETTER R u'\xb1' # 0xDA -> PLUS-MINUS SIGN u'\xbd' # 0xDB -> VULGAR FRACTION ONE HALF u'\x1a' # 0xDC -> SUBSTITUTE u'\u0387' # 0xDD -> GREEK ANO TELEIA u'\u2019' # 0xDE -> RIGHT SINGLE QUOTATION MARK u'\xa6' # 0xDF -> BROKEN BAR u'\\' # 0xE0 -> REVERSE SOLIDUS u'\x1a' # 0xE1 -> SUBSTITUTE u'S' # 0xE2 -> LATIN CAPITAL LETTER S u'T' # 0xE3 -> LATIN CAPITAL LETTER T u'U' # 0xE4 -> LATIN CAPITAL LETTER U u'V' # 0xE5 -> LATIN CAPITAL LETTER V u'W' # 0xE6 -> LATIN CAPITAL LETTER W u'X' # 0xE7 -> LATIN CAPITAL LETTER X u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z u'\xb2' # 0xEA -> SUPERSCRIPT TWO u'\xa7' # 0xEB -> SECTION SIGN u'\x1a' # 0xEC -> SUBSTITUTE u'\x1a' # 0xED -> SUBSTITUTE u'\xab' # 0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK u'\xac' # 0xEF -> NOT SIGN u'0' # 0xF0 -> DIGIT ZERO u'1' # 0xF1 -> DIGIT ONE u'2' # 0xF2 -> DIGIT TWO u'3' # 0xF3 -> DIGIT THREE u'4' # 0xF4 -> DIGIT FOUR u'5' # 0xF5 -> DIGIT FIVE u'6' # 0xF6 -> DIGIT SIX u'7' # 0xF7 -> DIGIT SEVEN u'8' # 0xF8 -> DIGIT EIGHT u'9' # 0xF9 -> DIGIT NINE u'\xb3' # 0xFA -> SUPERSCRIPT THREE u'\xa9' # 0xFB -> COPYRIGHT SIGN u'\x1a' # 0xFC -> SUBSTITUTE u'\x1a' # 0xFD -> SUBSTITUTE u'\xbb' # 0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK u'\x9f' # 0xFF -> CONTROL ) ### Encoding table encoding_table=codecs.charmap_build(decoding_table)
apache-2.0
[ 624, 2018, 17660, 12340, 13732, 7667, 13357, 4046, 687, 283, 32362, 15, 27839, 4149, 15, 17233, 51, 2161, 15, 37, 6265, 36, 948, 15, 2890, 13357, 14, 17715, 7, 543, 486, 2143, 67, 14, 647, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1224, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1224, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 1850, 13357, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 776, 421, 199, 5680, 27368, 6957, 199, 199, 12796, 63, 1224, 275, 334, 272, 399, 1154, 88, 383, 7, 258, 327, 221, 378, 88, 383, 1035, 5962, 272, 399, 1154, 88, 614, 7, 258, 327, 221, 378, 88, 614, 1035, 13910, 1634, 32674, 272, 399, 1154, 88, 996, 7, 258, 327, 221, 378, 88, 996, 1035, 13910, 1634, 11951, 272, 399, 1154, 88, 1644, 7, 258, 327, 221, 378, 88, 1644, 1035, 7729, 1634, 11951, 272, 399, 1154, 88, 25, 67, 7, 258, 327, 221, 378, 88, 966, 1035, 8098, 272, 399, 1154, 84, 7, 755, 327, 221, 378, 88, 1717, 1035, 8724, 22450, 272, 399, 1154, 88, 1184, 7, 258, 327, 221, 378, 88, 1690, 1035, 8098, 272, 399, 1154, 88, 23, 70, 7, 258, 327, 221, 378, 88, 1780, 1035, 15137, 272, 399, 1154, 88, 2576, 7, 258, 327, 221, 378, 88, 2036, 1035, 8098, 272, 399, 1154, 88, 24, 68, 7, 258, 327, 221, 378, 88, 1643, 1035, 8098, 272, 399, 1154, 88, 24, 69, 7, 258, 327, 221, 378, 88, 16, 33, 1035, 8098, 272, 399, 1154, 88, 16, 66, 7, 258, 327, 221, 378, 88, 16, 34, 1035, 8267, 22450, 272, 399, 1154, 88, 16, 67, 7, 258, 327, 221, 378, 88, 16, 35, 1035, 11295, 21567, 272, 399, 1154, 82, 7, 755, 327, 221, 378, 88, 16, 36, 1035, 445, 32622, 24646, 272, 399, 1154, 88, 16, 69, 7, 258, 327, 221, 378, 88, 16, 37, 1035, 20754, 5738, 272, 399, 1154, 88, 16, 70, 7, 258, 327, 221, 378, 88, 16, 38, 1035, 20754, 1621, 272, 399, 1154, 88, 709, 7, 258, 327, 221, 378, 88, 709, 1035, 7126, 19774, 17682, 272, 399, 1154, 88, 845, 7, 258, 327, 221, 378, 88, 845, 1035, 11643, 8098, 13051, 272, 399, 1154, 88, 713, 7, 258, 327, 221, 378, 88, 713, 1035, 11643, 8098, 16562, 272, 399, 1154, 88, 969, 7, 258, 327, 221, 378, 88, 969, 1035, 11643, 8098, 16296, 272, 399, 1154, 88, 25, 68, 7, 258, 327, 221, 378, 88, 1079, 1035, 8098, 272, 399, 1154, 88, 2426, 7, 258, 327, 221, 378, 88, 1046, 1035, 8098, 272, 399, 1154, 88, 2036, 7, 258, 327, 221, 378, 88, 975, 1035, 22658, 11658, 272, 399, 1154, 88, 1555, 7, 258, 327, 221, 378, 88, 1196, 1035, 8098, 272, 399, 1154, 88, 1085, 7, 258, 327, 221, 378, 88, 1085, 1035, 27385, 272, 399, 1154, 88, 1167, 7, 258, 327, 221, 378, 88, 1167, 1035, 7729, 1634, 22650, 272, 399, 1154, 88, 2942, 7, 258, 327, 221, 378, 88, 17, 33, 1035, 8098, 272, 399, 1154, 88, 24, 70, 7, 258, 327, 221, 378, 88, 17, 34, 1035, 8098, 272, 399, 1154, 88, 17, 67, 7, 258, 327, 221, 378, 88, 17, 35, 1035, 13024, 14782, 272, 399, 1154, 88, 17, 68, 7, 258, 327, 221, 378, 88, 17, 36, 1035, 15443, 14782, 272, 399, 1154, 88, 17, 69, 7, 258, 327, 221, 378, 88, 17, 37, 1035, 24973, 14782, 272, 399, 1154, 88, 17, 70, 7, 258, 327, 221, 378, 88, 17, 38, 1035, 25836, 14782, 272, 399, 1154, 88, 1257, 7, 258, 327, 221, 378, 88, 1165, 1035, 8098, 272, 399, 1154, 88, 2835, 7, 258, 327, 221, 378, 88, 2025, 1035, 8098, 272, 399, 1154, 88, 2564, 7, 258, 327, 221, 378, 88, 1081, 1035, 8098, 272, 399, 1154, 88, 2658, 7, 258, 327, 221, 378, 88, 1789, 1035, 8098, 272, 399, 1154, 88, 1349, 7, 258, 327, 221, 378, 88, 1194, 1035, 8098, 272, 399, 1154, 78, 7, 755, 327, 221, 378, 88, 821, 1035, 13587, 21567, 272, 399, 1154, 88, 1196, 7, 258, 327, 221, 378, 88, 1479, 1035, 7729, 1634, 22499, 8068, 272, 399, 1154, 88, 17, 66, 7, 258, 327, 221, 378, 88, 1465, 1035, 17682, 272, 399, 1154, 88, 1299, 7, 258, 327, 221, 378, 88, 1651, 1035, 8098, 272, 399, 1154, 88, 1407, 7, 258, 327, 221, 378, 88, 1398, 1035, 8098, 272, 399, 1154, 88, 24, 65, 7, 258, 327, 221, 378, 88, 18, 33, 1035, 8098, 272, 399, 1154, 88, 24, 66, 7, 258, 327, 221, 378, 88, 18, 34, 1035, 8098, 272, 399, 1154, 88, 24, 67, 7, 258, 327, 221, 378, 88, 18, 35, 1035, 8098, 272, 399, 1154, 88, 1717, 7, 258, 327, 221, 378, 88, 18, 36, 1035, 5070, 31115, 57, 272, 399, 1154, 88, 1690, 7, 258, 327, 221, 378, 88, 18, 37, 1035, 22549, 272, 399, 1154, 88, 1780, 7, 258 ]
[ 2018, 17660, 12340, 13732, 7667, 13357, 4046, 687, 283, 32362, 15, 27839, 4149, 15, 17233, 51, 2161, 15, 37, 6265, 36, 948, 15, 2890, 13357, 14, 17715, 7, 543, 486, 2143, 67, 14, 647, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1224, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1224, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 1850, 13357, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 776, 421, 199, 5680, 27368, 6957, 199, 199, 12796, 63, 1224, 275, 334, 272, 399, 1154, 88, 383, 7, 258, 327, 221, 378, 88, 383, 1035, 5962, 272, 399, 1154, 88, 614, 7, 258, 327, 221, 378, 88, 614, 1035, 13910, 1634, 32674, 272, 399, 1154, 88, 996, 7, 258, 327, 221, 378, 88, 996, 1035, 13910, 1634, 11951, 272, 399, 1154, 88, 1644, 7, 258, 327, 221, 378, 88, 1644, 1035, 7729, 1634, 11951, 272, 399, 1154, 88, 25, 67, 7, 258, 327, 221, 378, 88, 966, 1035, 8098, 272, 399, 1154, 84, 7, 755, 327, 221, 378, 88, 1717, 1035, 8724, 22450, 272, 399, 1154, 88, 1184, 7, 258, 327, 221, 378, 88, 1690, 1035, 8098, 272, 399, 1154, 88, 23, 70, 7, 258, 327, 221, 378, 88, 1780, 1035, 15137, 272, 399, 1154, 88, 2576, 7, 258, 327, 221, 378, 88, 2036, 1035, 8098, 272, 399, 1154, 88, 24, 68, 7, 258, 327, 221, 378, 88, 1643, 1035, 8098, 272, 399, 1154, 88, 24, 69, 7, 258, 327, 221, 378, 88, 16, 33, 1035, 8098, 272, 399, 1154, 88, 16, 66, 7, 258, 327, 221, 378, 88, 16, 34, 1035, 8267, 22450, 272, 399, 1154, 88, 16, 67, 7, 258, 327, 221, 378, 88, 16, 35, 1035, 11295, 21567, 272, 399, 1154, 82, 7, 755, 327, 221, 378, 88, 16, 36, 1035, 445, 32622, 24646, 272, 399, 1154, 88, 16, 69, 7, 258, 327, 221, 378, 88, 16, 37, 1035, 20754, 5738, 272, 399, 1154, 88, 16, 70, 7, 258, 327, 221, 378, 88, 16, 38, 1035, 20754, 1621, 272, 399, 1154, 88, 709, 7, 258, 327, 221, 378, 88, 709, 1035, 7126, 19774, 17682, 272, 399, 1154, 88, 845, 7, 258, 327, 221, 378, 88, 845, 1035, 11643, 8098, 13051, 272, 399, 1154, 88, 713, 7, 258, 327, 221, 378, 88, 713, 1035, 11643, 8098, 16562, 272, 399, 1154, 88, 969, 7, 258, 327, 221, 378, 88, 969, 1035, 11643, 8098, 16296, 272, 399, 1154, 88, 25, 68, 7, 258, 327, 221, 378, 88, 1079, 1035, 8098, 272, 399, 1154, 88, 2426, 7, 258, 327, 221, 378, 88, 1046, 1035, 8098, 272, 399, 1154, 88, 2036, 7, 258, 327, 221, 378, 88, 975, 1035, 22658, 11658, 272, 399, 1154, 88, 1555, 7, 258, 327, 221, 378, 88, 1196, 1035, 8098, 272, 399, 1154, 88, 1085, 7, 258, 327, 221, 378, 88, 1085, 1035, 27385, 272, 399, 1154, 88, 1167, 7, 258, 327, 221, 378, 88, 1167, 1035, 7729, 1634, 22650, 272, 399, 1154, 88, 2942, 7, 258, 327, 221, 378, 88, 17, 33, 1035, 8098, 272, 399, 1154, 88, 24, 70, 7, 258, 327, 221, 378, 88, 17, 34, 1035, 8098, 272, 399, 1154, 88, 17, 67, 7, 258, 327, 221, 378, 88, 17, 35, 1035, 13024, 14782, 272, 399, 1154, 88, 17, 68, 7, 258, 327, 221, 378, 88, 17, 36, 1035, 15443, 14782, 272, 399, 1154, 88, 17, 69, 7, 258, 327, 221, 378, 88, 17, 37, 1035, 24973, 14782, 272, 399, 1154, 88, 17, 70, 7, 258, 327, 221, 378, 88, 17, 38, 1035, 25836, 14782, 272, 399, 1154, 88, 1257, 7, 258, 327, 221, 378, 88, 1165, 1035, 8098, 272, 399, 1154, 88, 2835, 7, 258, 327, 221, 378, 88, 2025, 1035, 8098, 272, 399, 1154, 88, 2564, 7, 258, 327, 221, 378, 88, 1081, 1035, 8098, 272, 399, 1154, 88, 2658, 7, 258, 327, 221, 378, 88, 1789, 1035, 8098, 272, 399, 1154, 88, 1349, 7, 258, 327, 221, 378, 88, 1194, 1035, 8098, 272, 399, 1154, 78, 7, 755, 327, 221, 378, 88, 821, 1035, 13587, 21567, 272, 399, 1154, 88, 1196, 7, 258, 327, 221, 378, 88, 1479, 1035, 7729, 1634, 22499, 8068, 272, 399, 1154, 88, 17, 66, 7, 258, 327, 221, 378, 88, 1465, 1035, 17682, 272, 399, 1154, 88, 1299, 7, 258, 327, 221, 378, 88, 1651, 1035, 8098, 272, 399, 1154, 88, 1407, 7, 258, 327, 221, 378, 88, 1398, 1035, 8098, 272, 399, 1154, 88, 24, 65, 7, 258, 327, 221, 378, 88, 18, 33, 1035, 8098, 272, 399, 1154, 88, 24, 66, 7, 258, 327, 221, 378, 88, 18, 34, 1035, 8098, 272, 399, 1154, 88, 24, 67, 7, 258, 327, 221, 378, 88, 18, 35, 1035, 8098, 272, 399, 1154, 88, 1717, 7, 258, 327, 221, 378, 88, 18, 36, 1035, 5070, 31115, 57, 272, 399, 1154, 88, 1690, 7, 258, 327, 221, 378, 88, 18, 37, 1035, 22549, 272, 399, 1154, 88, 1780, 7, 258, 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,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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 ]
atlashealth/ansible-modules-core
system/setup.py
64
5222
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, 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/>. DOCUMENTATION = ''' --- module: setup version_added: historical short_description: Gathers facts about remote hosts options: filter: version_added: "1.1" description: - if supplied, only return facts that match this shell-style (fnmatch) wildcard. required: false default: '*' fact_path: version_added: "1.3" description: - path used for local ansible facts (*.fact) - files in this dir will be run (if executable) and their results be added to ansible_local facts if a file is not executable it is read. File/results format can be json or ini-format required: false default: '/etc/ansible/facts.d' description: - This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks. It can also be executed directly by C(/usr/bin/ansible) to check what variables are available to a host. Ansible provides many I(facts) about the system, automatically. notes: - More ansible facts will be added with successive releases. If I(facter) or I(ohai) are installed, variables from these programs will also be snapshotted into the JSON file for usage in templating. These variables are prefixed with C(facter_) and C(ohai_) so it's easy to tell their source. All variables are bubbled up to the caller. Using the ansible facts and choosing to not install I(facter) and I(ohai) means you can avoid Ruby-dependencies on your remote systems. (See also M(facter) and M(ohai).) - The filter option filters only the first level subkey below ansible_facts. - If the target host is Windows, you will not currently have the ability to use C(fact_path) or C(filter) as this is provided by a simpler implementation of the module. Different facts are returned for Windows hosts. author: Michael DeHaan ''' EXAMPLES = """ # Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts). ansible all -m setup --tree /tmp/facts # Display only facts regarding memory found by ansible on all hosts and output them. ansible all -m setup -a 'filter=ansible_*_mb' # Display only facts returned by facter. ansible all -m setup -a 'filter=facter_*' # Display only facts about certain interfaces. ansible all -m setup -a 'filter=ansible_eth[0-2]' """ def run_setup(module): setup_options = dict(module_setup=True) facts = ansible_facts(module) for (k, v) in facts.items(): setup_options["ansible_%s" % k.replace('-', '_')] = v # Look for the path to the facter and ohai binary and set # the variable to that path. facter_path = module.get_bin_path('facter') ohai_path = module.get_bin_path('ohai') # if facter is installed, and we can use --json because # ruby-json is ALSO installed, include facter data in the JSON if facter_path is not None: rc, out, err = module.run_command(facter_path + " --puppet --json") facter = True try: facter_ds = json.loads(out) except: facter = False if facter: for (k,v) in facter_ds.items(): setup_options["facter_%s" % k] = v # ditto for ohai if ohai_path is not None: rc, out, err = module.run_command(ohai_path) ohai = True try: ohai_ds = json.loads(out) except: ohai = False if ohai: for (k,v) in ohai_ds.items(): k2 = "ohai_%s" % k.replace('-', '_') setup_options[k2] = v setup_result = { 'ansible_facts': {} } for (k,v) in setup_options.items(): if module.params['filter'] == '*' or fnmatch.fnmatch(k, module.params['filter']): setup_result['ansible_facts'][k] = v # hack to keep --verbose from showing all the setup module results setup_result['verbose_override'] = True return setup_result def main(): global module module = AnsibleModule( argument_spec = dict( filter=dict(default="*", required=False), fact_path=dict(default='/etc/ansible/facts.d', required=False), ), supports_check_mode = True, ) data = run_setup(module) module.exit_json(**data) # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.facts import * main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 334, 67, 9, 6029, 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, 8948, 275, 1449, 199, 2595, 199, 578, 26, 3272, 199, 1023, 63, 3270, 26, 32530, 199, 3612, 63, 1802, 26, 19634, 83, 9036, 3595, 3982, 7057, 199, 1419, 26, 272, 2457, 26, 267, 1015, 63, 3270, 26, 298, 17, 14, 17, 2, 267, 1369, 26, 288, 446, 340, 6841, 12, 1454, 372, 9036, 626, 1336, 642, 5218, 13, 2487, 334, 15359, 9, 16792, 14, 267, 1415, 26, 3055, 267, 849, 26, 13626, 272, 10572, 63, 515, 26, 267, 1015, 63, 3270, 26, 298, 17, 14, 19, 2, 267, 1369, 26, 288, 446, 931, 1202, 367, 2257, 3242, 9036, 334, 4856, 7783, 9, 446, 1584, 315, 642, 2935, 1598, 911, 506, 1255, 334, 692, 7286, 9, 436, 3932, 2058, 506, 3483, 370, 3242, 63, 1832, 9036, 1598, 340, 282, 570, 365, 440, 7286, 652, 365, 1586, 14, 1598, 3814, 15, 2604, 1475, 883, 506, 2022, 503, 20364, 13, 908, 267, 1415, 26, 3055, 267, 849, 26, 1994, 6839, 15, 4853, 15, 5047, 14, 68, 7, 199, 1802, 26, 1362, 446, 961, 859, 365, 5847, 2797, 701, 5232, 8858, 370, 13082, 2997, 2126, 2860, 3595, 3982, 7057, 626, 883, 506, 1202, 315, 5232, 8858, 14, 2779, 883, 2597, 506, 2126, 7934, 5370, 701, 445, 29478, 2647, 15, 1393, 15, 4853, 9, 370, 1104, 4052, 2860, 787, 2126, 2808, 370, 282, 1591, 14, 2622, 6571, 5002, 473, 8, 5047, 9, 3595, 314, 2656, 12, 2126, 5847, 14, 199, 5983, 26, 272, 446, 16917, 3242, 9036, 911, 506, 3483, 543, 27028, 3398, 19015, 14, 982, 473, 8, 70, 6747, 9, 503, 489, 473, 8, 79, 17945, 9, 787, 4903, 12, 2860, 687, 3520, 18572, 911, 2597, 506, 5740, 471, 489, 1901, 314, 4840, 570, 367, 4503, 315, 2388, 24615, 14, 5723, 2860, 787, 18239, 489, 543, 445, 8, 70, 6747, 4602, 436, 445, 8, 79, 17945, 4602, 880, 652, 1159, 8837, 370, 11480, 3932, 1350, 14, 2900, 2860, 787, 489, 330, 21749, 68, 1536, 370, 314, 8025, 14, 11719, 314, 3242, 9036, 436, 2468, 26056, 370, 440, 489, 3907, 473, 8, 70, 6747, 9, 436, 473, 8, 79, 17945, 9, 4910, 1265, 883, 5126, 820, 10972, 13, 5714, 641, 2195, 489, 3982, 10460, 14, 334, 9295, 2597, 603, 8, 70, 6747, 9, 436, 603, 8, 79, 17945, 680, 9, 272, 446, 710, 2457, 945, 4766, 1454, 314, 1642, 2166, 1007, 498, 5084, 3242, 63, 5047, 14, 272, 446, 982, 314, 1347, 1591, 365, 5417, 12, 1265, 911, 440, 5544, 1172, 314, 21255, 370, 675, 489, 445, 8, 7783, 63, 515, 9, 503, 445, 8, 1541, 9, 465, 642, 365, 2741, 701, 282, 28293, 4514, 402, 314, 859, 14, 489, 18029, 640, 9036, 787, 2138, 367, 5417, 7057, 14, 199, 2502, 26, 16922, 22453, 199, 2344, 199, 199, 8918, 275, 408, 199, 3, 12175, 9036, 687, 1006, 7057, 436, 3877, 3062, 15235, 701, 473, 8, 4269, 9, 737, 445, 29478, 2791, 15, 5047, 680, 199, 4853, 1006, 446, 77, 3272, 1553, 2350, 1182, 2791, 15, 5047, 199, 199, 3, 12175, 1454, 9036, 12602, 4402, 1911, 701, 3242, 641, 1006, 7057, 436, 1072, 3062, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 4853, 15192, 63, 887, 7, 199, 199, 3, 12175, 1454, 9036, 2138, 701, 289, 6747, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 70, 6747, 63, 10223, 199, 199, 3, 12175, 1454, 9036, 3595, 9842, 8386, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 4853, 63, 12391, 59, 16, 13, 18, 6616, 199, 624, 421, 199, 318, 1255, 63, 2758, 8, 578, 304, 339, 3272, 63, 1419, 275, 1211, 8, 578, 63, 2758, 29, 549, 9, 272, 9036, 275, 3242, 63, 5047, 8, 578, 9, 339, 367, 334, 75, 12, 373, 9, 315, 9036, 14, 1744, 837, 267, 3272, 63, 1419, 905, 4853, 4970, 83, 2, 450, 1022, 14, 1814, 13858, 2513, 5440, 275, 373, 339, 327, 12077, 367, 314, 931, 370, 314, 289, 6747, 436, 312, 17945, 3366, 436, 663, 272, 327, 314, 1750, 370, 626, 931, 14, 272, 289, 6747, 63, 515, 275, 859, 14, 362, 63, 1393, 63, 515, 360, 70, 6747, 358, 272, 312, 17945, 63, 515, 275, 859, 14, 362, 63, 1393, 63, 515, 360, 79, 17945, 358, 339, 327, 340, 289, 6747, 365, 4903, 12, 436, 781, 883, 675, 1553, 1001, 2952, 272, 327, 31855, 13, 1001, 365, 12112, 4118, 4903, 12, 2387, 289, 6747, 666, 315, 314, 4840, 272, 340, 289, 6747, 63, 515, 365, 440, 488, 26, 267, 4819, 12, 734, 12, 2329, 275, 859, 14, 1065, 63, 1531, 8, 70, 6747, 63, 515, 435, 298, 1553, 25423, 1553, 1001, 531, 267, 289, 6747, 275, 715, 267, 862, 26, 288, 289, 6747, 63, 795, 275, 2022, 14, 3640, 8, 548, 9, 267, 871, 26, 288, 289, 6747, 275, 756, 267, 340, 289, 6747, 26, 288, 367, 334, 75, 12, 86, 9, 315, 289, 6747, 63, 795, 14, 1744, 837, 355, 3272, 63, 1419, 905, 70, 6747, 4970, 83, 2, 450, 1022, 61, 275, 373 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 334, 67, 9, 6029, 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, 8948, 275, 1449, 199, 2595, 199, 578, 26, 3272, 199, 1023, 63, 3270, 26, 32530, 199, 3612, 63, 1802, 26, 19634, 83, 9036, 3595, 3982, 7057, 199, 1419, 26, 272, 2457, 26, 267, 1015, 63, 3270, 26, 298, 17, 14, 17, 2, 267, 1369, 26, 288, 446, 340, 6841, 12, 1454, 372, 9036, 626, 1336, 642, 5218, 13, 2487, 334, 15359, 9, 16792, 14, 267, 1415, 26, 3055, 267, 849, 26, 13626, 272, 10572, 63, 515, 26, 267, 1015, 63, 3270, 26, 298, 17, 14, 19, 2, 267, 1369, 26, 288, 446, 931, 1202, 367, 2257, 3242, 9036, 334, 4856, 7783, 9, 446, 1584, 315, 642, 2935, 1598, 911, 506, 1255, 334, 692, 7286, 9, 436, 3932, 2058, 506, 3483, 370, 3242, 63, 1832, 9036, 1598, 340, 282, 570, 365, 440, 7286, 652, 365, 1586, 14, 1598, 3814, 15, 2604, 1475, 883, 506, 2022, 503, 20364, 13, 908, 267, 1415, 26, 3055, 267, 849, 26, 1994, 6839, 15, 4853, 15, 5047, 14, 68, 7, 199, 1802, 26, 1362, 446, 961, 859, 365, 5847, 2797, 701, 5232, 8858, 370, 13082, 2997, 2126, 2860, 3595, 3982, 7057, 626, 883, 506, 1202, 315, 5232, 8858, 14, 2779, 883, 2597, 506, 2126, 7934, 5370, 701, 445, 29478, 2647, 15, 1393, 15, 4853, 9, 370, 1104, 4052, 2860, 787, 2126, 2808, 370, 282, 1591, 14, 2622, 6571, 5002, 473, 8, 5047, 9, 3595, 314, 2656, 12, 2126, 5847, 14, 199, 5983, 26, 272, 446, 16917, 3242, 9036, 911, 506, 3483, 543, 27028, 3398, 19015, 14, 982, 473, 8, 70, 6747, 9, 503, 489, 473, 8, 79, 17945, 9, 787, 4903, 12, 2860, 687, 3520, 18572, 911, 2597, 506, 5740, 471, 489, 1901, 314, 4840, 570, 367, 4503, 315, 2388, 24615, 14, 5723, 2860, 787, 18239, 489, 543, 445, 8, 70, 6747, 4602, 436, 445, 8, 79, 17945, 4602, 880, 652, 1159, 8837, 370, 11480, 3932, 1350, 14, 2900, 2860, 787, 489, 330, 21749, 68, 1536, 370, 314, 8025, 14, 11719, 314, 3242, 9036, 436, 2468, 26056, 370, 440, 489, 3907, 473, 8, 70, 6747, 9, 436, 473, 8, 79, 17945, 9, 4910, 1265, 883, 5126, 820, 10972, 13, 5714, 641, 2195, 489, 3982, 10460, 14, 334, 9295, 2597, 603, 8, 70, 6747, 9, 436, 603, 8, 79, 17945, 680, 9, 272, 446, 710, 2457, 945, 4766, 1454, 314, 1642, 2166, 1007, 498, 5084, 3242, 63, 5047, 14, 272, 446, 982, 314, 1347, 1591, 365, 5417, 12, 1265, 911, 440, 5544, 1172, 314, 21255, 370, 675, 489, 445, 8, 7783, 63, 515, 9, 503, 445, 8, 1541, 9, 465, 642, 365, 2741, 701, 282, 28293, 4514, 402, 314, 859, 14, 489, 18029, 640, 9036, 787, 2138, 367, 5417, 7057, 14, 199, 2502, 26, 16922, 22453, 199, 2344, 199, 199, 8918, 275, 408, 199, 3, 12175, 9036, 687, 1006, 7057, 436, 3877, 3062, 15235, 701, 473, 8, 4269, 9, 737, 445, 29478, 2791, 15, 5047, 680, 199, 4853, 1006, 446, 77, 3272, 1553, 2350, 1182, 2791, 15, 5047, 199, 199, 3, 12175, 1454, 9036, 12602, 4402, 1911, 701, 3242, 641, 1006, 7057, 436, 1072, 3062, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 4853, 15192, 63, 887, 7, 199, 199, 3, 12175, 1454, 9036, 2138, 701, 289, 6747, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 70, 6747, 63, 10223, 199, 199, 3, 12175, 1454, 9036, 3595, 9842, 8386, 14, 199, 4853, 1006, 446, 77, 3272, 446, 65, 283, 1541, 29, 4853, 63, 12391, 59, 16, 13, 18, 6616, 199, 624, 421, 199, 318, 1255, 63, 2758, 8, 578, 304, 339, 3272, 63, 1419, 275, 1211, 8, 578, 63, 2758, 29, 549, 9, 272, 9036, 275, 3242, 63, 5047, 8, 578, 9, 339, 367, 334, 75, 12, 373, 9, 315, 9036, 14, 1744, 837, 267, 3272, 63, 1419, 905, 4853, 4970, 83, 2, 450, 1022, 14, 1814, 13858, 2513, 5440, 275, 373, 339, 327, 12077, 367, 314, 931, 370, 314, 289, 6747, 436, 312, 17945, 3366, 436, 663, 272, 327, 314, 1750, 370, 626, 931, 14, 272, 289, 6747, 63, 515, 275, 859, 14, 362, 63, 1393, 63, 515, 360, 70, 6747, 358, 272, 312, 17945, 63, 515, 275, 859, 14, 362, 63, 1393, 63, 515, 360, 79, 17945, 358, 339, 327, 340, 289, 6747, 365, 4903, 12, 436, 781, 883, 675, 1553, 1001, 2952, 272, 327, 31855, 13, 1001, 365, 12112, 4118, 4903, 12, 2387, 289, 6747, 666, 315, 314, 4840, 272, 340, 289, 6747, 63, 515, 365, 440, 488, 26, 267, 4819, 12, 734, 12, 2329, 275, 859, 14, 1065, 63, 1531, 8, 70, 6747, 63, 515, 435, 298, 1553, 25423, 1553, 1001, 531, 267, 289, 6747, 275, 715, 267, 862, 26, 288, 289, 6747, 63, 795, 275, 2022, 14, 3640, 8, 548, 9, 267, 871, 26, 288, 289, 6747,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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 ]
newvem/django-registration
registration/backends/default/urls.py
44
2442
""" URLconf for registration and activation, using django-registration's default backend. If the default behavior of these views is acceptable to you, simply use a line like this in your root URLconf to set up the default URLs for registration:: (r'^accounts/', include('registration.backends.default.urls')), This will also automatically set up the views in ``django.contrib.auth`` at sensible default locations. If you'd like to customize the behavior (e.g., by passing extra arguments to the various views) or split up the URLs, feel free to set up your own URL patterns for these views instead. """ from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from registration.views import activate from registration.views import register urlpatterns = patterns('', url(r'^activate/complete/$', direct_to_template, {'template': 'registration/activation_complete.html'}, name='registration_activation_complete'), # Activation keys get matched by \w+ instead of the more specific # [a-fA-F0-9]{40} because a bad activation key should still get to the view; # that way it can return a sensible "invalid key" message instead of a # confusing 404. url(r'^activate/(?P<activation_key>\w+)/$', activate, {'backend': 'registration.backends.default.DefaultBackend'}, name='registration_activate'), url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend'}, name='registration_register'), url(r'^register/complete/$', direct_to_template, {'template': 'registration/registration_complete.html'}, name='registration_complete'), url(r'^register/closed/$', direct_to_template, {'template': 'registration/registration_closed.html'}, name='registration_disallowed'), (r'', include('registration.auth_urls')), )
bsd-3-clause
[ 624, 199, 2632, 2190, 367, 10991, 436, 10361, 12, 1808, 1639, 13, 8054, 1159, 199, 885, 4865, 14, 199, 199, 3917, 314, 849, 5953, 402, 3520, 6858, 365, 14712, 370, 1265, 12, 9329, 199, 1180, 282, 1004, 2839, 642, 315, 2195, 1738, 2851, 2190, 370, 663, 1536, 314, 849, 10867, 199, 509, 10991, 447, 339, 334, 82, 4289, 8370, 3678, 2387, 360, 8054, 14, 7765, 14, 885, 14, 3603, 3855, 199, 199, 2765, 911, 2597, 5847, 663, 1536, 314, 6858, 315, 199, 1040, 1176, 14, 2828, 14, 1178, 1040, 737, 27962, 849, 9918, 14, 199, 199, 3917, 1265, 5121, 2839, 370, 17551, 314, 5953, 334, 69, 14, 71, 2020, 701, 9476, 2402, 199, 4958, 370, 314, 7750, 6858, 9, 503, 3715, 1536, 314, 10867, 12, 23109, 2867, 370, 663, 199, 384, 2195, 5705, 2851, 7970, 367, 3520, 6858, 3140, 14, 199, 199, 624, 421, 199, 504, 1639, 14, 2190, 14, 3603, 14, 4322, 492, 627, 199, 504, 1639, 14, 4196, 14, 6767, 14, 4129, 492, 4125, 63, 475, 63, 1160, 199, 199, 504, 10991, 14, 4196, 492, 15422, 199, 504, 10991, 14, 4196, 492, 2274, 421, 199, 20050, 275, 7970, 8594, 2432, 1166, 8, 82, 4289, 8222, 15, 4883, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 12312, 63, 4883, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 12312, 63, 4883, 659, 2432, 327, 29441, 2883, 664, 7838, 701, 971, 87, 11, 3140, 402, 314, 1655, 2488, 2432, 327, 359, 65, 13, 13753, 13, 38, 16, 13, 25, 8194, 2167, 93, 2952, 282, 4875, 10361, 790, 1077, 5139, 664, 370, 314, 2455, 27, 2432, 327, 626, 4340, 652, 883, 372, 282, 27962, 298, 3197, 790, 2, 1245, 3140, 402, 282, 2432, 327, 3743, 4941, 7901, 14, 2432, 1166, 8, 82, 4289, 8222, 9448, 48, 28, 12312, 63, 498, 3072, 87, 18830, 4268, 2574, 15422, 12, 2574, 791, 4620, 356, 283, 8054, 14, 7765, 14, 885, 14, 2698, 8447, 2267, 2574, 536, 534, 8054, 63, 8222, 659, 2432, 1166, 8, 82, 4289, 2683, 10884, 2574, 2274, 12, 2574, 791, 4620, 356, 283, 8054, 14, 7765, 14, 885, 14, 2698, 8447, 2267, 2574, 536, 534, 8054, 63, 2683, 659, 2432, 1166, 8, 82, 4289, 2683, 15, 4883, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 8054, 63, 4883, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 4883, 659, 2432, 1166, 8, 82, 4289, 2683, 15, 5938, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 8054, 63, 5938, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 2297, 6541, 659, 2432, 334, 82, 6448, 2387, 360, 8054, 14, 1178, 63, 3603, 3855, 2432, 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 ]
[ 199, 2632, 2190, 367, 10991, 436, 10361, 12, 1808, 1639, 13, 8054, 1159, 199, 885, 4865, 14, 199, 199, 3917, 314, 849, 5953, 402, 3520, 6858, 365, 14712, 370, 1265, 12, 9329, 199, 1180, 282, 1004, 2839, 642, 315, 2195, 1738, 2851, 2190, 370, 663, 1536, 314, 849, 10867, 199, 509, 10991, 447, 339, 334, 82, 4289, 8370, 3678, 2387, 360, 8054, 14, 7765, 14, 885, 14, 3603, 3855, 199, 199, 2765, 911, 2597, 5847, 663, 1536, 314, 6858, 315, 199, 1040, 1176, 14, 2828, 14, 1178, 1040, 737, 27962, 849, 9918, 14, 199, 199, 3917, 1265, 5121, 2839, 370, 17551, 314, 5953, 334, 69, 14, 71, 2020, 701, 9476, 2402, 199, 4958, 370, 314, 7750, 6858, 9, 503, 3715, 1536, 314, 10867, 12, 23109, 2867, 370, 663, 199, 384, 2195, 5705, 2851, 7970, 367, 3520, 6858, 3140, 14, 199, 199, 624, 421, 199, 504, 1639, 14, 2190, 14, 3603, 14, 4322, 492, 627, 199, 504, 1639, 14, 4196, 14, 6767, 14, 4129, 492, 4125, 63, 475, 63, 1160, 199, 199, 504, 10991, 14, 4196, 492, 15422, 199, 504, 10991, 14, 4196, 492, 2274, 421, 199, 20050, 275, 7970, 8594, 2432, 1166, 8, 82, 4289, 8222, 15, 4883, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 12312, 63, 4883, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 12312, 63, 4883, 659, 2432, 327, 29441, 2883, 664, 7838, 701, 971, 87, 11, 3140, 402, 314, 1655, 2488, 2432, 327, 359, 65, 13, 13753, 13, 38, 16, 13, 25, 8194, 2167, 93, 2952, 282, 4875, 10361, 790, 1077, 5139, 664, 370, 314, 2455, 27, 2432, 327, 626, 4340, 652, 883, 372, 282, 27962, 298, 3197, 790, 2, 1245, 3140, 402, 282, 2432, 327, 3743, 4941, 7901, 14, 2432, 1166, 8, 82, 4289, 8222, 9448, 48, 28, 12312, 63, 498, 3072, 87, 18830, 4268, 2574, 15422, 12, 2574, 791, 4620, 356, 283, 8054, 14, 7765, 14, 885, 14, 2698, 8447, 2267, 2574, 536, 534, 8054, 63, 8222, 659, 2432, 1166, 8, 82, 4289, 2683, 10884, 2574, 2274, 12, 2574, 791, 4620, 356, 283, 8054, 14, 7765, 14, 885, 14, 2698, 8447, 2267, 2574, 536, 534, 8054, 63, 2683, 659, 2432, 1166, 8, 82, 4289, 2683, 15, 4883, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 8054, 63, 4883, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 4883, 659, 2432, 1166, 8, 82, 4289, 2683, 15, 5938, 10884, 2574, 4125, 63, 475, 63, 1160, 12, 2574, 791, 1160, 356, 283, 8054, 15, 8054, 63, 5938, 14, 1360, 2267, 2574, 536, 534, 8054, 63, 2297, 6541, 659, 2432, 334, 82, 6448, 2387, 360, 8054, 14, 1178, 63, 3603, 3855, 2432, 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, 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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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 ]
bosstb/HaberPush
youtube_dl/extractor/einthusan.py
34
3416
# coding: utf-8 from __future__ import unicode_literals import base64 import json from .common import InfoExtractor from ..compat import ( compat_urlparse, compat_str, ) from ..utils import ( extract_attributes, ExtractorError, get_elements_by_class, urlencode_postdata, ) class EinthusanIE(InfoExtractor): _VALID_URL = r'https?://einthusan\.tv/movie/watch/(?P<id>[^/?#&]+)' _TESTS = [{ 'url': 'https://einthusan.tv/movie/watch/9097/', 'md5': 'ff0f7f2065031b8a2cf13a933731c035', 'info_dict': { 'id': '9097', 'ext': 'mp4', 'title': 'Ae Dil Hai Mushkil', 'description': 'md5:33ef934c82a671a94652a9b4e54d931b', 'thumbnail': r're:^https?://.*\.jpg$', } }, { 'url': 'https://einthusan.tv/movie/watch/51MZ/?lang=hindi', 'only_matching': True, }] # reversed from jsoncrypto.prototype.decrypt() in einthusan-PGMovieWatcher.js def _decrypt(self, encrypted_data, video_id): return self._parse_json(base64.b64decode(( encrypted_data[:10] + encrypted_data[-1] + encrypted_data[12:-1] ).encode('ascii')).decode('utf-8'), video_id) def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title = self._html_search_regex(r'<h3>([^<]+)</h3>', webpage, 'title') player_params = extract_attributes(self._search_regex( r'(<section[^>]+id="UIVideoPlayer"[^>]+>)', webpage, 'player parameters')) page_id = self._html_search_regex( '<html[^>]+data-pageid="([^"]+)"', webpage, 'page ID') video_data = self._download_json( 'https://einthusan.tv/ajax/movie/watch/%s/' % video_id, video_id, data=urlencode_postdata({ 'xEvent': 'UIVideoPlayer.PingOutcome', 'xJson': json.dumps({ 'EJOutcomes': player_params['data-ejpingables'], 'NativeHLS': False }), 'arcVersion': 3, 'appVersion': 59, 'gorilla.csrf.Token': page_id, }))['Data'] if isinstance(video_data, compat_str) and video_data.startswith('/ratelimited/'): raise ExtractorError( 'Download rate reached. Please try again later.', expected=True) ej_links = self._decrypt(video_data['EJLinks'], video_id) formats = [] m3u8_url = ej_links.get('HLSLink') if m3u8_url: formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native')) mp4_url = ej_links.get('MP4Link') if mp4_url: formats.append({ 'url': mp4_url, }) self._sort_formats(formats) description = get_elements_by_class('synopsis', webpage)[0] thumbnail = self._html_search_regex( r'''<img[^>]+src=(["'])(?P<url>(?!\1).+?/moviecovers/(?!\1).+?)\1''', webpage, 'thumbnail url', fatal=False, group='url') if thumbnail is not None: thumbnail = compat_urlparse.urljoin(url, thumbnail) return { 'id': video_id, 'title': title, 'formats': formats, 'thumbnail': thumbnail, 'description': description, }
mit
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 1300, 772, 199, 646, 2022, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 5819, 492, 334, 272, 8434, 63, 10290, 12, 272, 8434, 63, 495, 12, 199, 9, 199, 504, 2508, 1208, 492, 334, 272, 5536, 63, 2987, 12, 272, 19783, 12, 272, 664, 63, 5527, 63, 991, 63, 533, 12, 272, 16511, 63, 1932, 576, 12, 199, 9, 421, 199, 533, 662, 262, 273, 527, 290, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 14144, 69, 262, 273, 527, 290, 4537, 6993, 15, 10888, 15, 6821, 9448, 48, 28, 344, 13489, 10197, 3, 6, 29716, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 10888, 15, 6821, 15, 25, 17790, 3678, 267, 283, 1064, 21, 356, 283, 556, 16, 70, 23, 70, 11089, 1400, 2192, 66, 24, 65, 18, 2177, 969, 65, 25, 11062, 2192, 67, 21088, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 25, 17790, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 33, 69, 577, 382, 869, 5789, 603, 2084, 75, 382, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 1153, 2829, 30391, 67, 2564, 65, 23772, 65, 2635, 25415, 65, 25, 66, 20, 69, 1477, 68, 25, 2192, 66, 297, 288, 283, 8311, 356, 519, 3984, 23497, 2859, 32569, 8476, 4268, 267, 789, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 10888, 15, 6821, 15, 2869, 45, 58, 10197, 4159, 29, 72, 3558, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 14877, 339, 327, 10822, 687, 2022, 10316, 14, 16141, 14, 15682, 342, 315, 325, 262, 273, 527, 290, 13, 11115, 19088, 13978, 281, 14, 3596, 272, 347, 485, 15682, 8, 277, 12, 14862, 63, 576, 12, 3991, 63, 344, 304, 267, 372, 291, 423, 1122, 63, 1001, 8, 1095, 772, 14, 66, 772, 2708, 1332, 288, 14862, 63, 576, 1491, 709, 61, 435, 14862, 63, 576, 1988, 17, 61, 435, 14862, 63, 576, 59, 713, 6809, 17, 61, 267, 7092, 2143, 360, 4371, 11103, 2708, 360, 1624, 13, 24, 659, 3991, 63, 344, 9, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 398, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 3991, 63, 344, 9, 398, 2538, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 7601, 72, 19, 30, 31204, 11896, 1108, 72, 19, 4206, 9248, 12, 283, 1213, 358, 398, 7748, 63, 1162, 275, 5536, 63, 2987, 8, 277, 423, 1733, 63, 3821, 8, 288, 519, 6774, 28, 2792, 25524, 344, 628, 6379, 9166, 10921, 2, 25524, 30, 3196, 9248, 12, 283, 6147, 2633, 1333, 398, 2034, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 288, 2650, 1360, 25524, 576, 13, 1606, 344, 32391, 297, 9248, 12, 283, 1606, 2870, 358, 267, 3991, 63, 576, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 12774, 15, 10888, 15, 6821, 3149, 83, 4805, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 288, 666, 29, 10738, 63, 1932, 576, 2561, 355, 283, 88, 2390, 356, 283, 6379, 9166, 10921, 14, 22638, 2204, 4352, 297, 355, 283, 88, 9653, 356, 2022, 14, 4180, 2561, 490, 283, 37, 42, 2204, 31430, 356, 7748, 63, 1162, 459, 576, 13, 69, 74, 4073, 5921, 995, 490, 283, 19675, 40, 5296, 356, 756, 355, 9998, 355, 283, 9912, 3353, 356, 650, 12, 355, 283, 571, 3353, 356, 8155, 12, 355, 283, 2904, 6165, 14, 10088, 14, 3264, 356, 2034, 63, 344, 12, 288, 23451, 459, 1451, 418, 398, 340, 1228, 8, 3722, 63, 576, 12, 8434, 63, 495, 9, 436, 3991, 63, 576, 14, 2460, 2336, 1866, 14136, 26985, 288, 746, 19783, 8, 355, 283, 11950, 6634, 13075, 14, 7754, 862, 4020, 2945, 3130, 1420, 29, 549, 9, 398, 325, 74, 63, 4614, 275, 291, 423, 15682, 8, 3722, 63, 576, 459, 37, 42, 16974, 995, 3991, 63, 344, 9, 398, 6752, 275, 942, 398, 333, 19, 85, 24, 63, 633, 275, 325, 74, 63, 4614, 14, 362, 360, 40, 5296, 3834, 358, 267, 340, 333, 19, 85, 24, 63, 633, 26, 288, 6752, 14, 2880, 8, 277, 423, 5005, 63, 77, 19, 85, 24, 63, 6321, 8, 355, 333, 19, 85, 24, 63, 633, 12, 3991, 63, 344, 12, 1599, 534, 311, 20, 297, 2397, 63, 3922, 534, 77, 19, 85, 24, 63, 6106, 1333, 398, 6118, 20, 63, 633, 275, 325, 74, 63, 4614, 14, 362, 360, 1658, 20, 3834, 358, 267, 340, 6118, 20, 63, 633, 26, 288, 6752, 14, 740, 2561, 355, 283, 633, 356, 6118, 20, 63, 633, 12, 288, 3828, 398, 291, 423, 3191, 63, 6321, 8, 6321, 9, 398, 1369, 275, 664, 63, 5527, 63, 991, 63, 533, 360, 9466, 27573, 297, 9248, 2788, 16, 61, 267, 10062, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 288, 519, 2344, 28, 4060, 25524, 2164, 29, 5234, 1105, 2229, 48, 28, 633, 30, 2229, 12525, 17, 680, 23778, 15, 10888, 5899, 83, 9448, 12525, 17, 680, 23778, 2862, 17, 18108, 288, 9248, 12, 283, 8311, 1166, 297, 14294, 29, 797, 12, 1572, 534, 633, 358, 267, 340, 10062, 365, 440, 488, 26, 288, 10062, 275, 8434, 63, 10290, 14, 17755, 8, 633, 12, 10062, 9, 398, 372, 469, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 1213, 356, 2538, 12, 288, 283, 6321, 356, 6752, 12, 288, 283, 8311, 356, 10062, 12, 288, 283, 1802, 356, 1369, 12, 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 ]
[ 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 1300, 772, 199, 646, 2022, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 5819, 492, 334, 272, 8434, 63, 10290, 12, 272, 8434, 63, 495, 12, 199, 9, 199, 504, 2508, 1208, 492, 334, 272, 5536, 63, 2987, 12, 272, 19783, 12, 272, 664, 63, 5527, 63, 991, 63, 533, 12, 272, 16511, 63, 1932, 576, 12, 199, 9, 421, 199, 533, 662, 262, 273, 527, 290, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 14144, 69, 262, 273, 527, 290, 4537, 6993, 15, 10888, 15, 6821, 9448, 48, 28, 344, 13489, 10197, 3, 6, 29716, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 10888, 15, 6821, 15, 25, 17790, 3678, 267, 283, 1064, 21, 356, 283, 556, 16, 70, 23, 70, 11089, 1400, 2192, 66, 24, 65, 18, 2177, 969, 65, 25, 11062, 2192, 67, 21088, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 25, 17790, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 33, 69, 577, 382, 869, 5789, 603, 2084, 75, 382, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 1153, 2829, 30391, 67, 2564, 65, 23772, 65, 2635, 25415, 65, 25, 66, 20, 69, 1477, 68, 25, 2192, 66, 297, 288, 283, 8311, 356, 519, 3984, 23497, 2859, 32569, 8476, 4268, 267, 789, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 10888, 15, 6821, 15, 2869, 45, 58, 10197, 4159, 29, 72, 3558, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 14877, 339, 327, 10822, 687, 2022, 10316, 14, 16141, 14, 15682, 342, 315, 325, 262, 273, 527, 290, 13, 11115, 19088, 13978, 281, 14, 3596, 272, 347, 485, 15682, 8, 277, 12, 14862, 63, 576, 12, 3991, 63, 344, 304, 267, 372, 291, 423, 1122, 63, 1001, 8, 1095, 772, 14, 66, 772, 2708, 1332, 288, 14862, 63, 576, 1491, 709, 61, 435, 14862, 63, 576, 1988, 17, 61, 435, 14862, 63, 576, 59, 713, 6809, 17, 61, 267, 7092, 2143, 360, 4371, 11103, 2708, 360, 1624, 13, 24, 659, 3991, 63, 344, 9, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 398, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 3991, 63, 344, 9, 398, 2538, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 7601, 72, 19, 30, 31204, 11896, 1108, 72, 19, 4206, 9248, 12, 283, 1213, 358, 398, 7748, 63, 1162, 275, 5536, 63, 2987, 8, 277, 423, 1733, 63, 3821, 8, 288, 519, 6774, 28, 2792, 25524, 344, 628, 6379, 9166, 10921, 2, 25524, 30, 3196, 9248, 12, 283, 6147, 2633, 1333, 398, 2034, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 288, 2650, 1360, 25524, 576, 13, 1606, 344, 32391, 297, 9248, 12, 283, 1606, 2870, 358, 267, 3991, 63, 576, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 2859, 921, 69, 262, 273, 527, 290, 14, 6993, 15, 12774, 15, 10888, 15, 6821, 3149, 83, 4805, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 288, 666, 29, 10738, 63, 1932, 576, 2561, 355, 283, 88, 2390, 356, 283, 6379, 9166, 10921, 14, 22638, 2204, 4352, 297, 355, 283, 88, 9653, 356, 2022, 14, 4180, 2561, 490, 283, 37, 42, 2204, 31430, 356, 7748, 63, 1162, 459, 576, 13, 69, 74, 4073, 5921, 995, 490, 283, 19675, 40, 5296, 356, 756, 355, 9998, 355, 283, 9912, 3353, 356, 650, 12, 355, 283, 571, 3353, 356, 8155, 12, 355, 283, 2904, 6165, 14, 10088, 14, 3264, 356, 2034, 63, 344, 12, 288, 23451, 459, 1451, 418, 398, 340, 1228, 8, 3722, 63, 576, 12, 8434, 63, 495, 9, 436, 3991, 63, 576, 14, 2460, 2336, 1866, 14136, 26985, 288, 746, 19783, 8, 355, 283, 11950, 6634, 13075, 14, 7754, 862, 4020, 2945, 3130, 1420, 29, 549, 9, 398, 325, 74, 63, 4614, 275, 291, 423, 15682, 8, 3722, 63, 576, 459, 37, 42, 16974, 995, 3991, 63, 344, 9, 398, 6752, 275, 942, 398, 333, 19, 85, 24, 63, 633, 275, 325, 74, 63, 4614, 14, 362, 360, 40, 5296, 3834, 358, 267, 340, 333, 19, 85, 24, 63, 633, 26, 288, 6752, 14, 2880, 8, 277, 423, 5005, 63, 77, 19, 85, 24, 63, 6321, 8, 355, 333, 19, 85, 24, 63, 633, 12, 3991, 63, 344, 12, 1599, 534, 311, 20, 297, 2397, 63, 3922, 534, 77, 19, 85, 24, 63, 6106, 1333, 398, 6118, 20, 63, 633, 275, 325, 74, 63, 4614, 14, 362, 360, 1658, 20, 3834, 358, 267, 340, 6118, 20, 63, 633, 26, 288, 6752, 14, 740, 2561, 355, 283, 633, 356, 6118, 20, 63, 633, 12, 288, 3828, 398, 291, 423, 3191, 63, 6321, 8, 6321, 9, 398, 1369, 275, 664, 63, 5527, 63, 991, 63, 533, 360, 9466, 27573, 297, 9248, 2788, 16, 61, 267, 10062, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 288, 519, 2344, 28, 4060, 25524, 2164, 29, 5234, 1105, 2229, 48, 28, 633, 30, 2229, 12525, 17, 680, 23778, 15, 10888, 5899, 83, 9448, 12525, 17, 680, 23778, 2862, 17, 18108, 288, 9248, 12, 283, 8311, 1166, 297, 14294, 29, 797, 12, 1572, 534, 633, 358, 267, 340, 10062, 365, 440, 488, 26, 288, 10062, 275, 8434, 63, 10290, 14, 17755, 8, 633, 12, 10062, 9, 398, 372, 469, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 1213, 356, 2538, 12, 288, 283, 6321, 356, 6752, 12, 288, 283, 8311, 356, 10062, 12, 288, 283, 1802, 356, 1369, 12, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
louyihua/edx-platform
cms/djangoapps/contentstore/views/tests/test_item.py
4
114324
"""Tests for items views.""" import json from datetime import datetime, timedelta import ddt from mock import patch, Mock, PropertyMock from pytz import UTC from pyquery import PyQuery from webob import Response from django.http import Http404 from django.test import TestCase from django.test.client import RequestFactory from django.core.urlresolvers import reverse from contentstore.utils import reverse_usage_url, reverse_course_url from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from contentstore.views.component import ( component_handler, get_component_templates ) from contentstore.views.item import ( create_xblock_info, ALWAYS, VisibilityState, _xblock_type_and_display_name, add_container_page_publishing_info ) from contentstore.tests.utils import CourseTestCase from student.tests.factories import UserFactory from xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag from xmodule.capa_module import CapaDescriptor from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE from xmodule.modulestore.tests.factories import ItemFactory, LibraryFactory, check_mongo_calls, CourseFactory from xmodule.x_module import STUDIO_VIEW, STUDENT_VIEW from xmodule.course_module import DEFAULT_START_DATE from xblock.core import XBlockAside from xblock.fields import Scope, String, ScopeIds from xblock.fragment import Fragment from xblock.runtime import DictKeyValueStore, KvsFieldData from xblock.test.tools import TestRuntime from xblock.exceptions import NoSuchHandlerError from xblock_django.user_service import DjangoXBlockUserService from opaque_keys.edx.keys import UsageKey, CourseKey from opaque_keys.edx.locations import Location from xmodule.partitions.partitions import Group, UserPartition class AsideTest(XBlockAside): """ Test xblock aside class """ FRAG_CONTENT = u"<p>Aside Foo rendered</p>" field11 = String(default="aside1_default_value1", scope=Scope.content) field12 = String(default="aside1_default_value2", scope=Scope.settings) field13 = String(default="aside1_default_value3", scope=Scope.parent) @XBlockAside.aside_for('student_view') def student_view_aside(self, block, context): # pylint: disable=unused-argument """Add to the student view""" return Fragment(self.FRAG_CONTENT) class ItemTest(CourseTestCase): """ Base test class for create, save, and delete """ def setUp(self): super(ItemTest, self).setUp() self.course_key = self.course.id self.usage_key = self.course.location def get_item_from_modulestore(self, usage_key, verify_is_draft=False): """ Get the item referenced by the UsageKey from the modulestore """ item = self.store.get_item(usage_key) if verify_is_draft: self.assertTrue(getattr(item, 'is_draft', False)) return item def response_usage_key(self, response): """ Get the UsageKey from the response payload and verify that the status_code was 200. :param response: """ parsed = json.loads(response.content) self.assertEqual(response.status_code, 200) key = UsageKey.from_string(parsed['locator']) if key.course_key.run is None: key = key.map_into_course(CourseKey.from_string(parsed['courseKey'])) return key def create_xblock(self, parent_usage_key=None, display_name=None, category=None, boilerplate=None): data = { 'parent_locator': unicode(self.usage_key) if parent_usage_key is None else unicode(parent_usage_key), 'category': category } if display_name is not None: data['display_name'] = display_name if boilerplate is not None: data['boilerplate'] = boilerplate return self.client.ajax_post(reverse('contentstore.views.xblock_handler'), json.dumps(data)) def _create_vertical(self, parent_usage_key=None): """ Creates a vertical, returning its UsageKey. """ resp = self.create_xblock(category='vertical', parent_usage_key=parent_usage_key) self.assertEqual(resp.status_code, 200) return self.response_usage_key(resp) @ddt.ddt class GetItemTest(ItemTest): """Tests for '/xblock' GET url.""" def _get_preview(self, usage_key, data=None): """ Makes a request to xblock preview handler """ preview_url = reverse_usage_url("xblock_view_handler", usage_key, {'view_name': 'container_preview'}) data = data if data else {} resp = self.client.get(preview_url, data, HTTP_ACCEPT='application/json') return resp def _get_container_preview(self, usage_key, data=None): """ Returns the HTML and resources required for the xblock at the specified UsageKey """ resp = self._get_preview(usage_key, data) self.assertEqual(resp.status_code, 200) resp_content = json.loads(resp.content) html = resp_content['html'] self.assertTrue(html) resources = resp_content['resources'] self.assertIsNotNone(resources) return html, resources def _get_container_preview_with_error(self, usage_key, expected_code, data=None, content_contains=None): """ Make request and asserts on response code and response contents """ resp = self._get_preview(usage_key, data) self.assertEqual(resp.status_code, expected_code) if content_contains: self.assertIn(content_contains, resp.content) return resp @ddt.data( (1, 17, 15, 16, 12), (2, 17, 15, 16, 12), (3, 17, 15, 16, 12), ) @ddt.unpack def test_get_query_count(self, branching_factor, chapter_queries, section_queries, unit_queries, problem_queries): self.populate_course(branching_factor) # Retrieve it with check_mongo_calls(chapter_queries): self.client.get(reverse_usage_url('xblock_handler', self.populated_usage_keys['chapter'][-1])) with check_mongo_calls(section_queries): self.client.get(reverse_usage_url('xblock_handler', self.populated_usage_keys['sequential'][-1])) with check_mongo_calls(unit_queries): self.client.get(reverse_usage_url('xblock_handler', self.populated_usage_keys['vertical'][-1])) with check_mongo_calls(problem_queries): self.client.get(reverse_usage_url('xblock_handler', self.populated_usage_keys['problem'][-1])) @ddt.data( (1, 30), (2, 32), (3, 34), ) @ddt.unpack def test_container_get_query_count(self, branching_factor, unit_queries,): self.populate_course(branching_factor) with check_mongo_calls(unit_queries): self.client.get(reverse_usage_url('xblock_container_handler', self.populated_usage_keys['vertical'][-1])) def test_get_vertical(self): # Add a vertical resp = self.create_xblock(category='vertical') usage_key = self.response_usage_key(resp) # Retrieve it resp = self.client.get(reverse_usage_url('xblock_handler', usage_key)) self.assertEqual(resp.status_code, 200) def test_get_empty_container_fragment(self): root_usage_key = self._create_vertical() html, __ = self._get_container_preview(root_usage_key) # XBlock messages are added by the Studio wrapper. self.assertIn('wrapper-xblock-message', html) # Make sure that "wrapper-xblock" does not appear by itself (without -message at end). self.assertNotRegexpMatches(html, r'wrapper-xblock[^-]+') # Verify that the header and article tags are still added self.assertIn('<header class="xblock-header xblock-header-vertical">', html) self.assertIn('<article class="xblock-render">', html) def test_get_container_fragment(self): root_usage_key = self._create_vertical() # Add a problem beneath a child vertical child_vertical_usage_key = self._create_vertical(parent_usage_key=root_usage_key) resp = self.create_xblock(parent_usage_key=child_vertical_usage_key, category='problem', boilerplate='multiplechoice.yaml') self.assertEqual(resp.status_code, 200) # Get the preview HTML html, __ = self._get_container_preview(root_usage_key) # Verify that the Studio nesting wrapper has been added self.assertIn('level-nesting', html) self.assertIn('<header class="xblock-header xblock-header-vertical">', html) self.assertIn('<article class="xblock-render">', html) # Verify that the Studio element wrapper has been added self.assertIn('level-element', html) def test_get_container_nested_container_fragment(self): """ Test the case of the container page containing a link to another container page. """ # Add a wrapper with child beneath a child vertical root_usage_key = self._create_vertical() resp = self.create_xblock(parent_usage_key=root_usage_key, category="wrapper") self.assertEqual(resp.status_code, 200) wrapper_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=wrapper_usage_key, category='problem', boilerplate='multiplechoice.yaml') self.assertEqual(resp.status_code, 200) # Get the preview HTML and verify the View -> link is present. html, __ = self._get_container_preview(root_usage_key) self.assertIn('wrapper-xblock', html) self.assertRegexpMatches( html, # The instance of the wrapper class will have an auto-generated ID. Allow any # characters after wrapper. r'"/container/{}" class="action-button">\s*<span class="action-button-text">View</span>'.format( wrapper_usage_key ) ) def test_split_test(self): """ Test that a split_test module renders all of its children in Studio. """ root_usage_key = self._create_vertical() resp = self.create_xblock(category='split_test', parent_usage_key=root_usage_key) split_test_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='html', boilerplate='announcement.yaml') self.assertEqual(resp.status_code, 200) resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='html', boilerplate='zooming_image.yaml') self.assertEqual(resp.status_code, 200) html, __ = self._get_container_preview(split_test_usage_key) self.assertIn('Announcement', html) self.assertIn('Zooming', html) def test_split_test_edited(self): """ Test that rename of a group changes display name of child vertical. """ self.course.user_partitions = [UserPartition( 0, 'first_partition', 'First Partition', [Group("0", 'alpha'), Group("1", 'beta')] )] self.store.update_item(self.course, self.user.id) root_usage_key = self._create_vertical() resp = self.create_xblock(category='split_test', parent_usage_key=root_usage_key) split_test_usage_key = self.response_usage_key(resp) self.client.ajax_post( reverse_usage_url("xblock_handler", split_test_usage_key), data={'metadata': {'user_partition_id': str(0)}} ) html, __ = self._get_container_preview(split_test_usage_key) self.assertIn('alpha', html) self.assertIn('beta', html) # Rename groups in group configuration GROUP_CONFIGURATION_JSON = { u'id': 0, u'name': u'first_partition', u'scheme': u'random', u'description': u'First Partition', u'version': UserPartition.VERSION, u'groups': [ {u'id': 0, u'name': u'New_NAME_A', u'version': 1}, {u'id': 1, u'name': u'New_NAME_B', u'version': 1}, ], } response = self.client.put( reverse_course_url('group_configurations_detail_handler', self.course.id, kwargs={'group_configuration_id': 0}), data=json.dumps(GROUP_CONFIGURATION_JSON), content_type="application/json", HTTP_ACCEPT="application/json", HTTP_X_REQUESTED_WITH="XMLHttpRequest", ) self.assertEqual(response.status_code, 201) html, __ = self._get_container_preview(split_test_usage_key) self.assertNotIn('alpha', html) self.assertNotIn('beta', html) self.assertIn('New_NAME_A', html) self.assertIn('New_NAME_B', html) def test_valid_paging(self): """ Tests that valid paging is passed along to underlying block """ with patch('contentstore.views.item.get_preview_fragment') as patched_get_preview_fragment: retval = Mock() type(retval).content = PropertyMock(return_value="Some content") type(retval).resources = PropertyMock(return_value=[]) patched_get_preview_fragment.return_value = retval root_usage_key = self._create_vertical() _, _ = self._get_container_preview( root_usage_key, {'enable_paging': 'true', 'page_number': 0, 'page_size': 2} ) call_args = patched_get_preview_fragment.call_args[0] _, _, context = call_args self.assertIn('paging', context) self.assertEqual({'page_number': 0, 'page_size': 2}, context['paging']) @ddt.data([1, 'invalid'], ['invalid', 2]) @ddt.unpack def test_invalid_paging(self, page_number, page_size): """ Tests that valid paging is passed along to underlying block """ root_usage_key = self._create_vertical() self._get_container_preview_with_error( root_usage_key, 400, data={'enable_paging': 'true', 'page_number': page_number, 'page_size': page_size}, content_contains="Couldn't parse paging parameters" ) def test_get_user_partitions_and_groups(self): self.course.user_partitions = [ UserPartition( id=0, name="Verification user partition", scheme=UserPartition.get_scheme("verification"), description="Verification user partition", groups=[ Group(id=0, name="Group A"), Group(id=1, name="Group B"), ], ), ] self.store.update_item(self.course, self.user.id) # Create an item and retrieve it resp = self.create_xblock(category='vertical') usage_key = self.response_usage_key(resp) resp = self.client.get(reverse_usage_url('xblock_handler', usage_key)) self.assertEqual(resp.status_code, 200) # Check that the partition and group information was returned result = json.loads(resp.content) self.assertEqual(result["user_partitions"], [ { "id": 0, "name": "Verification user partition", "scheme": "verification", "groups": [ { "id": 0, "name": "Group A", "selected": False, "deleted": False, }, { "id": 1, "name": "Group B", "selected": False, "deleted": False, }, ] } ]) self.assertEqual(result["group_access"], {}) @ddt.ddt class DeleteItem(ItemTest): """Tests for '/xblock' DELETE url.""" @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) def test_delete_static_page(self, store): course = CourseFactory.create(default_store=store) # Add static tab resp = self.create_xblock(category='static_tab', parent_usage_key=course.location) usage_key = self.response_usage_key(resp) # Now delete it. There was a bug that the delete was failing (static tabs do not exist in draft modulestore). resp = self.client.delete(reverse_usage_url('xblock_handler', usage_key)) self.assertEqual(resp.status_code, 204) class TestCreateItem(ItemTest): """ Test the create_item handler thoroughly """ def test_create_nicely(self): """ Try the straightforward use cases """ # create a chapter display_name = 'Nicely created' resp = self.create_xblock(display_name=display_name, category='chapter') # get the new item and check its category and display_name chap_usage_key = self.response_usage_key(resp) new_obj = self.get_item_from_modulestore(chap_usage_key) self.assertEqual(new_obj.scope_ids.block_type, 'chapter') self.assertEqual(new_obj.display_name, display_name) self.assertEqual(new_obj.location.org, self.course.location.org) self.assertEqual(new_obj.location.course, self.course.location.course) # get the course and ensure it now points to this one course = self.get_item_from_modulestore(self.usage_key) self.assertIn(chap_usage_key, course.children) # use default display name resp = self.create_xblock(parent_usage_key=chap_usage_key, category='vertical') vert_usage_key = self.response_usage_key(resp) # create problem w/ boilerplate template_id = 'multiplechoice.yaml' resp = self.create_xblock( parent_usage_key=vert_usage_key, category='problem', boilerplate=template_id ) prob_usage_key = self.response_usage_key(resp) problem = self.get_item_from_modulestore(prob_usage_key, verify_is_draft=True) # check against the template template = CapaDescriptor.get_template(template_id) self.assertEqual(problem.data, template['data']) self.assertEqual(problem.display_name, template['metadata']['display_name']) self.assertEqual(problem.markdown, template['metadata']['markdown']) def test_create_item_negative(self): """ Negative tests for create_item """ # non-existent boilerplate: creates a default resp = self.create_xblock(category='problem', boilerplate='nosuchboilerplate.yaml') self.assertEqual(resp.status_code, 200) def test_create_with_future_date(self): self.assertEqual(self.course.start, datetime(2030, 1, 1, tzinfo=UTC)) resp = self.create_xblock(category='chapter') usage_key = self.response_usage_key(resp) obj = self.get_item_from_modulestore(usage_key) self.assertEqual(obj.start, datetime(2030, 1, 1, tzinfo=UTC)) def test_static_tabs_initialization(self): """ Test that static tab display names are not being initialized as None. """ # Add a new static tab with no explicit name resp = self.create_xblock(category='static_tab') usage_key = self.response_usage_key(resp) # Check that its name is not None new_tab = self.get_item_from_modulestore(usage_key) self.assertEquals(new_tab.display_name, 'Empty') class DuplicateHelper(object): """ Helper mixin class for TestDuplicateItem and TestDuplicateItemWithAsides """ def _duplicate_and_verify(self, source_usage_key, parent_usage_key, check_asides=False): """ Duplicates the source, parenting to supplied parent. Then does equality check. """ usage_key = self._duplicate_item(parent_usage_key, source_usage_key) # pylint: disable=no-member self.assertTrue( self._check_equality(source_usage_key, usage_key, parent_usage_key, check_asides=check_asides), "Duplicated item differs from original" ) def _check_equality(self, source_usage_key, duplicate_usage_key, parent_usage_key=None, check_asides=False): """ Gets source and duplicated items from the modulestore using supplied usage keys. Then verifies that they represent equivalent items (modulo parents and other known things that may differ). """ # pylint: disable=no-member original_item = self.get_item_from_modulestore(source_usage_key) duplicated_item = self.get_item_from_modulestore(duplicate_usage_key) if check_asides: original_asides = original_item.runtime.get_asides(original_item) duplicated_asides = duplicated_item.runtime.get_asides(duplicated_item) self.assertEqual(len(original_asides), 1) self.assertEqual(len(duplicated_asides), 1) self.assertEqual(original_asides[0].field11, duplicated_asides[0].field11) self.assertEqual(original_asides[0].field12, duplicated_asides[0].field12) self.assertNotEqual(original_asides[0].field13, duplicated_asides[0].field13) self.assertEqual(duplicated_asides[0].field13, 'aside1_default_value3') self.assertNotEqual( unicode(original_item.location), unicode(duplicated_item.location), "Location of duplicate should be different from original" ) # Parent will only be equal for root of duplicated structure, in the case # where an item is duplicated in-place. if parent_usage_key and unicode(original_item.parent) == unicode(parent_usage_key): self.assertEqual( unicode(parent_usage_key), unicode(duplicated_item.parent), "Parent of duplicate should equal parent of source for root xblock when duplicated in-place" ) else: self.assertNotEqual( unicode(original_item.parent), unicode(duplicated_item.parent), "Parent duplicate should be different from source" ) # Set the location, display name, and parent to be the same so we can make sure the rest of the # duplicate is equal. duplicated_item.location = original_item.location duplicated_item.display_name = original_item.display_name duplicated_item.parent = original_item.parent # Children will also be duplicated, so for the purposes of testing equality, we will set # the children to the original after recursively checking the children. if original_item.has_children: self.assertEqual( len(original_item.children), len(duplicated_item.children), "Duplicated item differs in number of children" ) for i in xrange(len(original_item.children)): if not self._check_equality(original_item.children[i], duplicated_item.children[i]): return False duplicated_item.children = original_item.children return original_item == duplicated_item def _duplicate_item(self, parent_usage_key, source_usage_key, display_name=None): """ Duplicates the source. """ # pylint: disable=no-member data = { 'parent_locator': unicode(parent_usage_key), 'duplicate_source_locator': unicode(source_usage_key) } if display_name is not None: data['display_name'] = display_name resp = self.client.ajax_post(reverse('contentstore.views.xblock_handler'), json.dumps(data)) return self.response_usage_key(resp) class TestDuplicateItem(ItemTest, DuplicateHelper): """ Test the duplicate method. """ def setUp(self): """ Creates the test course structure and a few components to 'duplicate'. """ super(TestDuplicateItem, self).setUp() # Create a parent chapter (for testing children of children). resp = self.create_xblock(parent_usage_key=self.usage_key, category='chapter') self.chapter_usage_key = self.response_usage_key(resp) # create a sequential containing a problem and an html component resp = self.create_xblock(parent_usage_key=self.chapter_usage_key, category='sequential') self.seq_usage_key = self.response_usage_key(resp) # create problem and an html component resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='problem', boilerplate='multiplechoice.yaml') self.problem_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='html') self.html_usage_key = self.response_usage_key(resp) # Create a second sequential just (testing children of children) self.create_xblock(parent_usage_key=self.chapter_usage_key, category='sequential2') def test_duplicate_equality(self): """ Tests that a duplicated xblock is identical to the original, except for location and display name. """ self._duplicate_and_verify(self.problem_usage_key, self.seq_usage_key) self._duplicate_and_verify(self.html_usage_key, self.seq_usage_key) self._duplicate_and_verify(self.seq_usage_key, self.chapter_usage_key) self._duplicate_and_verify(self.chapter_usage_key, self.usage_key) def test_ordering(self): """ Tests the a duplicated xblock appears immediately after its source (if duplicate and source share the same parent), else at the end of the children of the parent. """ def verify_order(source_usage_key, parent_usage_key, source_position=None): usage_key = self._duplicate_item(parent_usage_key, source_usage_key) parent = self.get_item_from_modulestore(parent_usage_key) children = parent.children if source_position is None: self.assertNotIn(source_usage_key, children, 'source item not expected in children array') self.assertEqual( children[len(children) - 1], usage_key, "duplicated item not at end" ) else: self.assertEqual( children[source_position], source_usage_key, "source item at wrong position" ) self.assertEqual( children[source_position + 1], usage_key, "duplicated item not ordered after source item" ) verify_order(self.problem_usage_key, self.seq_usage_key, 0) # 2 because duplicate of problem should be located before. verify_order(self.html_usage_key, self.seq_usage_key, 2) verify_order(self.seq_usage_key, self.chapter_usage_key, 0) # Test duplicating something into a location that is not the parent of the original item. # Duplicated item should appear at the end. verify_order(self.html_usage_key, self.usage_key) def test_display_name(self): """ Tests the expected display name for the duplicated xblock. """ def verify_name(source_usage_key, parent_usage_key, expected_name, display_name=None): usage_key = self._duplicate_item(parent_usage_key, source_usage_key, display_name) duplicated_item = self.get_item_from_modulestore(usage_key) self.assertEqual(duplicated_item.display_name, expected_name) return usage_key # Display name comes from template. dupe_usage_key = verify_name(self.problem_usage_key, self.seq_usage_key, "Duplicate of 'Multiple Choice'") # Test dupe of dupe. verify_name(dupe_usage_key, self.seq_usage_key, "Duplicate of 'Duplicate of 'Multiple Choice''") # Uses default display_name of 'Text' from HTML component. verify_name(self.html_usage_key, self.seq_usage_key, "Duplicate of 'Text'") # The sequence does not have a display_name set, so category is shown. verify_name(self.seq_usage_key, self.chapter_usage_key, "Duplicate of sequential") # Now send a custom display name for the duplicate. verify_name(self.seq_usage_key, self.chapter_usage_key, "customized name", display_name="customized name") class TestDuplicateItemWithAsides(ItemTest, DuplicateHelper): """ Test the duplicate method for blocks with asides. """ MODULESTORE = TEST_DATA_SPLIT_MODULESTORE def setUp(self): """ Creates the test course structure and a few components to 'duplicate'. """ super(TestDuplicateItemWithAsides, self).setUp() # Create a parent chapter resp = self.create_xblock(parent_usage_key=self.usage_key, category='chapter') self.chapter_usage_key = self.response_usage_key(resp) # create a sequential containing a problem and an html component resp = self.create_xblock(parent_usage_key=self.chapter_usage_key, category='sequential') self.seq_usage_key = self.response_usage_key(resp) # create problem and an html component resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='problem', boilerplate='multiplechoice.yaml') self.problem_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='html') self.html_usage_key = self.response_usage_key(resp) @XBlockAside.register_temp_plugin(AsideTest, 'test_aside') @patch('xmodule.modulestore.split_mongo.caching_descriptor_system.CachingDescriptorSystem.applicable_aside_types', lambda self, block: ['test_aside']) def test_duplicate_equality_with_asides(self): """ Tests that a duplicated xblock aside is identical to the original """ def create_aside(usage_key, block_type): """ Helper function to create aside """ item = self.get_item_from_modulestore(usage_key) key_store = DictKeyValueStore() field_data = KvsFieldData(key_store) runtime = TestRuntime(services={'field-data': field_data}) # pylint: disable=abstract-class-instantiated def_id = runtime.id_generator.create_definition(block_type) usage_id = runtime.id_generator.create_usage(def_id) aside = AsideTest(scope_ids=ScopeIds('user', block_type, def_id, usage_id), runtime=runtime) aside.field11 = '%s_new_value11' % block_type aside.field12 = '%s_new_value12' % block_type aside.field13 = '%s_new_value13' % block_type self.store.update_item(item, self.user.id, asides=[aside]) create_aside(self.html_usage_key, 'html') create_aside(self.problem_usage_key, 'problem') create_aside(self.seq_usage_key, 'seq') create_aside(self.chapter_usage_key, 'chapter') self._duplicate_and_verify(self.problem_usage_key, self.seq_usage_key, check_asides=True) self._duplicate_and_verify(self.html_usage_key, self.seq_usage_key, check_asides=True) self._duplicate_and_verify(self.seq_usage_key, self.chapter_usage_key, check_asides=True) class TestEditItemSetup(ItemTest): """ Setup for xblock update tests. """ def setUp(self): """ Creates the test course structure and a couple problems to 'edit'. """ super(TestEditItemSetup, self).setUp() # create a chapter display_name = 'chapter created' resp = self.create_xblock(display_name=display_name, category='chapter') chap_usage_key = self.response_usage_key(resp) # create 2 sequentials resp = self.create_xblock(parent_usage_key=chap_usage_key, category='sequential') self.seq_usage_key = self.response_usage_key(resp) self.seq_update_url = reverse_usage_url("xblock_handler", self.seq_usage_key) resp = self.create_xblock(parent_usage_key=chap_usage_key, category='sequential') self.seq2_usage_key = self.response_usage_key(resp) self.seq2_update_url = reverse_usage_url("xblock_handler", self.seq2_usage_key) # create problem w/ boilerplate template_id = 'multiplechoice.yaml' resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='problem', boilerplate=template_id) self.problem_usage_key = self.response_usage_key(resp) self.problem_update_url = reverse_usage_url("xblock_handler", self.problem_usage_key) self.course_update_url = reverse_usage_url("xblock_handler", self.usage_key) class TestEditItem(TestEditItemSetup): """ Test xblock update. """ def test_delete_field(self): """ Sending null in for a field 'deletes' it """ self.client.ajax_post( self.problem_update_url, data={'metadata': {'rerandomize': 'onreset'}} ) problem = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertEqual(problem.rerandomize, 'onreset') self.client.ajax_post( self.problem_update_url, data={'metadata': {'rerandomize': None}} ) problem = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertEqual(problem.rerandomize, 'never') def test_null_field(self): """ Sending null in for a field 'deletes' it """ problem = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertIsNotNone(problem.markdown) self.client.ajax_post( self.problem_update_url, data={'nullout': ['markdown']} ) problem = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertIsNone(problem.markdown) def test_date_fields(self): """ Test setting due & start dates on sequential """ sequential = self.get_item_from_modulestore(self.seq_usage_key) self.assertIsNone(sequential.due) self.client.ajax_post( self.seq_update_url, data={'metadata': {'due': '2010-11-22T04:00Z'}} ) sequential = self.get_item_from_modulestore(self.seq_usage_key) self.assertEqual(sequential.due, datetime(2010, 11, 22, 4, 0, tzinfo=UTC)) self.client.ajax_post( self.seq_update_url, data={'metadata': {'start': '2010-09-12T14:00Z'}} ) sequential = self.get_item_from_modulestore(self.seq_usage_key) self.assertEqual(sequential.due, datetime(2010, 11, 22, 4, 0, tzinfo=UTC)) self.assertEqual(sequential.start, datetime(2010, 9, 12, 14, 0, tzinfo=UTC)) def test_update_generic_fields(self): new_display_name = 'New Display Name' new_max_attempts = 2 self.client.ajax_post( self.problem_update_url, data={ 'fields': { 'display_name': new_display_name, 'max_attempts': new_max_attempts, } } ) problem = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertEqual(problem.display_name, new_display_name) self.assertEqual(problem.max_attempts, new_max_attempts) def test_delete_child(self): """ Test deleting a child. """ # Create 2 children of main course. resp_1 = self.create_xblock(display_name='child 1', category='chapter') resp_2 = self.create_xblock(display_name='child 2', category='chapter') chapter1_usage_key = self.response_usage_key(resp_1) chapter2_usage_key = self.response_usage_key(resp_2) course = self.get_item_from_modulestore(self.usage_key) self.assertIn(chapter1_usage_key, course.children) self.assertIn(chapter2_usage_key, course.children) # Remove one child from the course. resp = self.client.delete(reverse_usage_url("xblock_handler", chapter1_usage_key)) self.assertEqual(resp.status_code, 204) # Verify that the child is removed. course = self.get_item_from_modulestore(self.usage_key) self.assertNotIn(chapter1_usage_key, course.children) self.assertIn(chapter2_usage_key, course.children) def test_reorder_children(self): """ Test reordering children that can be in the draft store. """ # Create 2 child units and re-order them. There was a bug about @draft getting added # to the IDs. unit_1_resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='vertical') unit_2_resp = self.create_xblock(parent_usage_key=self.seq_usage_key, category='vertical') unit1_usage_key = self.response_usage_key(unit_1_resp) unit2_usage_key = self.response_usage_key(unit_2_resp) # The sequential already has a child defined in the setUp (a problem). # Children must be on the sequential to reproduce the original bug, # as it is important that the parent (sequential) NOT be in the draft store. children = self.get_item_from_modulestore(self.seq_usage_key).children self.assertEqual(unit1_usage_key, children[1]) self.assertEqual(unit2_usage_key, children[2]) resp = self.client.ajax_post( self.seq_update_url, data={'children': [unicode(self.problem_usage_key), unicode(unit2_usage_key), unicode(unit1_usage_key)]} ) self.assertEqual(resp.status_code, 200) children = self.get_item_from_modulestore(self.seq_usage_key).children self.assertEqual(self.problem_usage_key, children[0]) self.assertEqual(unit1_usage_key, children[2]) self.assertEqual(unit2_usage_key, children[1]) def test_move_parented_child(self): """ Test moving a child from one Section to another """ unit_1_key = self.response_usage_key( self.create_xblock(parent_usage_key=self.seq_usage_key, category='vertical', display_name='unit 1') ) unit_2_key = self.response_usage_key( self.create_xblock(parent_usage_key=self.seq2_usage_key, category='vertical', display_name='unit 2') ) # move unit 1 from sequential1 to sequential2 resp = self.client.ajax_post( self.seq2_update_url, data={'children': [unicode(unit_1_key), unicode(unit_2_key)]} ) self.assertEqual(resp.status_code, 200) # verify children self.assertListEqual( self.get_item_from_modulestore(self.seq2_usage_key).children, [unit_1_key, unit_2_key], ) self.assertListEqual( self.get_item_from_modulestore(self.seq_usage_key).children, [self.problem_usage_key], # problem child created in setUp ) def test_move_orphaned_child_error(self): """ Test moving an orphan returns an error """ unit_1_key = self.store.create_item(self.user.id, self.course_key, 'vertical', 'unit1').location # adding orphaned unit 1 should return an error resp = self.client.ajax_post( self.seq2_update_url, data={'children': [unicode(unit_1_key)]} ) self.assertEqual(resp.status_code, 400) self.assertIn("Invalid data, possibly caused by concurrent authors", resp.content) # verify children self.assertListEqual( self.get_item_from_modulestore(self.seq2_usage_key).children, [] ) def test_move_child_creates_orphan_error(self): """ Test creating an orphan returns an error """ unit_1_key = self.response_usage_key( self.create_xblock(parent_usage_key=self.seq2_usage_key, category='vertical', display_name='unit 1') ) unit_2_key = self.response_usage_key( self.create_xblock(parent_usage_key=self.seq2_usage_key, category='vertical', display_name='unit 2') ) # remove unit 2 should return an error resp = self.client.ajax_post( self.seq2_update_url, data={'children': [unicode(unit_1_key)]} ) self.assertEqual(resp.status_code, 400) self.assertIn("Invalid data, possibly caused by concurrent authors", resp.content) # verify children self.assertListEqual( self.get_item_from_modulestore(self.seq2_usage_key).children, [unit_1_key, unit_2_key] ) def _is_location_published(self, location): """ Returns whether or not the item with given location has a published version. """ return modulestore().has_item(location, revision=ModuleStoreEnum.RevisionOption.published_only) def _verify_published_with_no_draft(self, location): """ Verifies the item with given location has a published version and no draft (unpublished changes). """ self.assertTrue(self._is_location_published(location)) self.assertFalse(modulestore().has_changes(modulestore().get_item(location))) def _verify_published_with_draft(self, location): """ Verifies the item with given location has a published version and also a draft version (unpublished changes). """ self.assertTrue(self._is_location_published(location)) self.assertTrue(modulestore().has_changes(modulestore().get_item(location))) def test_make_public(self): """ Test making a private problem public (publishing it). """ # When the problem is first created, it is only in draft (because of its category). self.assertFalse(self._is_location_published(self.problem_usage_key)) self.client.ajax_post( self.problem_update_url, data={'publish': 'make_public'} ) self._verify_published_with_no_draft(self.problem_usage_key) def test_make_draft(self): """ Test creating a draft version of a public problem. """ self._make_draft_content_different_from_published() def test_revert_to_published(self): """ Test reverting draft content to published """ self._make_draft_content_different_from_published() self.client.ajax_post( self.problem_update_url, data={'publish': 'discard_changes'} ) self._verify_published_with_no_draft(self.problem_usage_key) published = modulestore().get_item(self.problem_usage_key, revision=ModuleStoreEnum.RevisionOption.published_only) self.assertIsNone(published.due) def test_republish(self): """ Test republishing an item. """ new_display_name = 'New Display Name' # When the problem is first created, it is only in draft (because of its category). self.assertFalse(self._is_location_published(self.problem_usage_key)) # Republishing when only in draft will update the draft but not cause a public item to be created. self.client.ajax_post( self.problem_update_url, data={ 'publish': 'republish', 'metadata': { 'display_name': new_display_name } } ) self.assertFalse(self._is_location_published(self.problem_usage_key)) draft = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertEqual(draft.display_name, new_display_name) # Publish the item self.client.ajax_post( self.problem_update_url, data={'publish': 'make_public'} ) # Now republishing should update the published version new_display_name_2 = 'New Display Name 2' self.client.ajax_post( self.problem_update_url, data={ 'publish': 'republish', 'metadata': { 'display_name': new_display_name_2 } } ) self._verify_published_with_no_draft(self.problem_usage_key) published = modulestore().get_item( self.problem_usage_key, revision=ModuleStoreEnum.RevisionOption.published_only ) self.assertEqual(published.display_name, new_display_name_2) def test_direct_only_categories_not_republished(self): """Verify that republish is ignored for items in DIRECT_ONLY_CATEGORIES""" # Create a vertical child with published and unpublished versions. # If the parent sequential is not re-published, then the child problem should also not be re-published. resp = self.create_xblock(parent_usage_key=self.seq_usage_key, display_name='vertical', category='vertical') vertical_usage_key = self.response_usage_key(resp) vertical_update_url = reverse_usage_url('xblock_handler', vertical_usage_key) self.client.ajax_post(vertical_update_url, data={'publish': 'make_public'}) self.client.ajax_post(vertical_update_url, data={'metadata': {'display_name': 'New Display Name'}}) self._verify_published_with_draft(self.seq_usage_key) self.client.ajax_post(self.seq_update_url, data={'publish': 'republish'}) self._verify_published_with_draft(self.seq_usage_key) def _make_draft_content_different_from_published(self): """ Helper method to create different draft and published versions of a problem. """ # Make problem public. self.client.ajax_post( self.problem_update_url, data={'publish': 'make_public'} ) self._verify_published_with_no_draft(self.problem_usage_key) published = modulestore().get_item(self.problem_usage_key, revision=ModuleStoreEnum.RevisionOption.published_only) # Update the draft version and check that published is different. self.client.ajax_post( self.problem_update_url, data={'metadata': {'due': '2077-10-10T04:00Z'}} ) updated_draft = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertEqual(updated_draft.due, datetime(2077, 10, 10, 4, 0, tzinfo=UTC)) self.assertIsNone(published.due) # Fetch the published version again to make sure the due date is still unset. published = modulestore().get_item(published.location, revision=ModuleStoreEnum.RevisionOption.published_only) self.assertIsNone(published.due) def test_make_public_with_update(self): """ Update a problem and make it public at the same time. """ self.client.ajax_post( self.problem_update_url, data={ 'metadata': {'due': '2077-10-10T04:00Z'}, 'publish': 'make_public' } ) published = self.get_item_from_modulestore(self.problem_usage_key) self.assertEqual(published.due, datetime(2077, 10, 10, 4, 0, tzinfo=UTC)) def test_published_and_draft_contents_with_update(self): """ Create a draft and publish it then modify the draft and check that published content is not modified """ # Make problem public. self.client.ajax_post( self.problem_update_url, data={'publish': 'make_public'} ) self._verify_published_with_no_draft(self.problem_usage_key) published = modulestore().get_item(self.problem_usage_key, revision=ModuleStoreEnum.RevisionOption.published_only) # Now make a draft self.client.ajax_post( self.problem_update_url, data={ 'id': unicode(self.problem_usage_key), 'metadata': {}, 'data': "<p>Problem content draft.</p>" } ) # Both published and draft content should be different draft = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertNotEqual(draft.data, published.data) # Get problem by 'xblock_handler' view_url = reverse_usage_url("xblock_view_handler", self.problem_usage_key, {"view_name": STUDENT_VIEW}) resp = self.client.get(view_url, HTTP_ACCEPT='application/json') self.assertEqual(resp.status_code, 200) # Activate the editing view view_url = reverse_usage_url("xblock_view_handler", self.problem_usage_key, {"view_name": STUDIO_VIEW}) resp = self.client.get(view_url, HTTP_ACCEPT='application/json') self.assertEqual(resp.status_code, 200) # Both published and draft content should still be different draft = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True) self.assertNotEqual(draft.data, published.data) # Fetch the published version again to make sure the data is correct. published = modulestore().get_item(published.location, revision=ModuleStoreEnum.RevisionOption.published_only) self.assertNotEqual(draft.data, published.data) def test_publish_states_of_nested_xblocks(self): """ Test publishing of a unit page containing a nested xblock """ resp = self.create_xblock(parent_usage_key=self.seq_usage_key, display_name='Test Unit', category='vertical') unit_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=unit_usage_key, category='wrapper') wrapper_usage_key = self.response_usage_key(resp) resp = self.create_xblock(parent_usage_key=wrapper_usage_key, category='html') html_usage_key = self.response_usage_key(resp) # The unit and its children should be private initially unit_update_url = reverse_usage_url('xblock_handler', unit_usage_key) self.assertFalse(self._is_location_published(unit_usage_key)) self.assertFalse(self._is_location_published(html_usage_key)) # Make the unit public and verify that the problem is also made public resp = self.client.ajax_post( unit_update_url, data={'publish': 'make_public'} ) self.assertEqual(resp.status_code, 200) self._verify_published_with_no_draft(unit_usage_key) self._verify_published_with_no_draft(html_usage_key) # Make a draft for the unit and verify that the problem also has a draft resp = self.client.ajax_post( unit_update_url, data={ 'id': unicode(unit_usage_key), 'metadata': {}, } ) self.assertEqual(resp.status_code, 200) self._verify_published_with_draft(unit_usage_key) self._verify_published_with_draft(html_usage_key) def test_field_value_errors(self): """ Test that if the user's input causes a ValueError on an XBlock field, we provide a friendly error message back to the user. """ response = self.create_xblock(parent_usage_key=self.seq_usage_key, category='video') video_usage_key = self.response_usage_key(response) update_url = reverse_usage_url('xblock_handler', video_usage_key) response = self.client.ajax_post( update_url, data={ 'id': unicode(video_usage_key), 'metadata': { 'saved_video_position': "Not a valid relative time", }, } ) self.assertEqual(response.status_code, 400) parsed = json.loads(response.content) self.assertIn("error", parsed) self.assertIn("Incorrect RelativeTime value", parsed["error"]) # See xmodule/fields.py class TestEditItemSplitMongo(TestEditItemSetup): """ Tests for EditItem running on top of the SplitMongoModuleStore. """ MODULESTORE = TEST_DATA_SPLIT_MODULESTORE def test_editing_view_wrappers(self): """ Verify that the editing view only generates a single wrapper, no matter how many times it's loaded Exposes: PLAT-417 """ view_url = reverse_usage_url("xblock_view_handler", self.problem_usage_key, {"view_name": STUDIO_VIEW}) for __ in xrange(3): resp = self.client.get(view_url, HTTP_ACCEPT='application/json') self.assertEqual(resp.status_code, 200) content = json.loads(resp.content) self.assertEqual(len(PyQuery(content['html'])('.xblock-{}'.format(STUDIO_VIEW))), 1) class TestEditSplitModule(ItemTest): """ Tests around editing instances of the split_test module. """ def setUp(self): super(TestEditSplitModule, self).setUp() self.user = UserFactory() self.course.user_partitions = [ UserPartition( 0, 'first_partition', 'First Partition', [Group("0", 'alpha'), Group("1", 'beta')] ), UserPartition( 1, 'second_partition', 'Second Partition', [Group("0", 'Group 0'), Group("1", 'Group 1'), Group("2", 'Group 2')] ) ] self.store.update_item(self.course, self.user.id) root_usage_key = self._create_vertical() resp = self.create_xblock(category='split_test', parent_usage_key=root_usage_key) self.split_test_usage_key = self.response_usage_key(resp) self.split_test_update_url = reverse_usage_url("xblock_handler", self.split_test_usage_key) self.request_factory = RequestFactory() self.request = self.request_factory.get('/dummy-url') self.request.user = self.user def _update_partition_id(self, partition_id): """ Helper method that sets the user_partition_id to the supplied value. The updated split_test instance is returned. """ self.client.ajax_post( self.split_test_update_url, # Even though user_partition_id is Scope.content, it will get saved by the Studio editor as # metadata. The code in item.py will update the field correctly, even though it is not the # expected scope. data={'metadata': {'user_partition_id': str(partition_id)}} ) # Verify the partition_id was saved. split_test = self.get_item_from_modulestore(self.split_test_usage_key, verify_is_draft=True) self.assertEqual(partition_id, split_test.user_partition_id) return split_test def _assert_children(self, expected_number): """ Verifies the number of children of the split_test instance. """ split_test = self.get_item_from_modulestore(self.split_test_usage_key, True) self.assertEqual(expected_number, len(split_test.children)) return split_test def test_create_groups(self): """ Test that verticals are created for the configuration groups when a spit test module is edited. """ split_test = self.get_item_from_modulestore(self.split_test_usage_key, verify_is_draft=True) # Initially, no user_partition_id is set, and the split_test has no children. self.assertEqual(-1, split_test.user_partition_id) self.assertEqual(0, len(split_test.children)) # Set the user_partition_id to 0. split_test = self._update_partition_id(0) # Verify that child verticals have been set to match the groups self.assertEqual(2, len(split_test.children)) vertical_0 = self.get_item_from_modulestore(split_test.children[0], verify_is_draft=True) vertical_1 = self.get_item_from_modulestore(split_test.children[1], verify_is_draft=True) self.assertEqual("vertical", vertical_0.category) self.assertEqual("vertical", vertical_1.category) self.assertEqual("Group ID 0", vertical_0.display_name) self.assertEqual("Group ID 1", vertical_1.display_name) # Verify that the group_id_to_child mapping is correct. self.assertEqual(2, len(split_test.group_id_to_child)) self.assertEqual(vertical_0.location, split_test.group_id_to_child['0']) self.assertEqual(vertical_1.location, split_test.group_id_to_child['1']) def test_change_user_partition_id(self): """ Test what happens when the user_partition_id is changed to a different groups group configuration. """ # Set to first group configuration. split_test = self._update_partition_id(0) self.assertEqual(2, len(split_test.children)) initial_vertical_0_location = split_test.children[0] initial_vertical_1_location = split_test.children[1] # Set to second group configuration split_test = self._update_partition_id(1) # We don't remove existing children. self.assertEqual(5, len(split_test.children)) self.assertEqual(initial_vertical_0_location, split_test.children[0]) self.assertEqual(initial_vertical_1_location, split_test.children[1]) vertical_0 = self.get_item_from_modulestore(split_test.children[2], verify_is_draft=True) vertical_1 = self.get_item_from_modulestore(split_test.children[3], verify_is_draft=True) vertical_2 = self.get_item_from_modulestore(split_test.children[4], verify_is_draft=True) # Verify that the group_id_to child mapping is correct. self.assertEqual(3, len(split_test.group_id_to_child)) self.assertEqual(vertical_0.location, split_test.group_id_to_child['0']) self.assertEqual(vertical_1.location, split_test.group_id_to_child['1']) self.assertEqual(vertical_2.location, split_test.group_id_to_child['2']) self.assertNotEqual(initial_vertical_0_location, vertical_0.location) self.assertNotEqual(initial_vertical_1_location, vertical_1.location) def test_change_same_user_partition_id(self): """ Test that nothing happens when the user_partition_id is set to the same value twice. """ # Set to first group configuration. split_test = self._update_partition_id(0) self.assertEqual(2, len(split_test.children)) initial_group_id_to_child = split_test.group_id_to_child # Set again to first group configuration. split_test = self._update_partition_id(0) self.assertEqual(2, len(split_test.children)) self.assertEqual(initial_group_id_to_child, split_test.group_id_to_child) def test_change_non_existent_user_partition_id(self): """ Test that nothing happens when the user_partition_id is set to a value that doesn't exist. The user_partition_id will be updated, but children and group_id_to_child map will not change. """ # Set to first group configuration. split_test = self._update_partition_id(0) self.assertEqual(2, len(split_test.children)) initial_group_id_to_child = split_test.group_id_to_child # Set to an group configuration that doesn't exist. split_test = self._update_partition_id(-50) self.assertEqual(2, len(split_test.children)) self.assertEqual(initial_group_id_to_child, split_test.group_id_to_child) def test_add_groups(self): """ Test the "fix up behavior" when groups are missing (after a group is added to a group configuration). This test actually belongs over in common, but it relies on a mutable modulestore. TODO: move tests that can go over to common after the mixed modulestore work is done. # pylint: disable=fixme """ # Set to first group configuration. split_test = self._update_partition_id(0) # Add a group to the first group configuration. split_test.user_partitions = [ UserPartition( 0, 'first_partition', 'First Partition', [Group("0", 'alpha'), Group("1", 'beta'), Group("2", 'pie')] ) ] self.store.update_item(split_test, self.user.id) # group_id_to_child and children have not changed yet. split_test = self._assert_children(2) group_id_to_child = split_test.group_id_to_child.copy() self.assertEqual(2, len(group_id_to_child)) # Test environment and Studio use different module systems # (CachingDescriptorSystem is used in tests, PreviewModuleSystem in Studio). # CachingDescriptorSystem doesn't have user service, that's needed for # SplitTestModule. So, in this line of code we add this service manually. split_test.runtime._services['user'] = DjangoXBlockUserService(self.user) # pylint: disable=protected-access # Call add_missing_groups method to add the missing group. split_test.add_missing_groups(self.request) split_test = self._assert_children(3) self.assertNotEqual(group_id_to_child, split_test.group_id_to_child) group_id_to_child = split_test.group_id_to_child self.assertEqual(split_test.children[2], group_id_to_child["2"]) # Call add_missing_groups again -- it should be a no-op. split_test.add_missing_groups(self.request) split_test = self._assert_children(3) self.assertEqual(group_id_to_child, split_test.group_id_to_child) @ddt.ddt class TestComponentHandler(TestCase): def setUp(self): super(TestComponentHandler, self).setUp() self.request_factory = RequestFactory() patcher = patch('contentstore.views.component.modulestore') self.modulestore = patcher.start() self.addCleanup(patcher.stop) # component_handler calls modulestore.get_item to get the descriptor of the requested xBlock. # Here, we mock the return value of modulestore.get_item so it can be used to mock the handler # of the xBlock descriptor. self.descriptor = self.modulestore.return_value.get_item.return_value self.usage_key_string = unicode( Location('dummy_org', 'dummy_course', 'dummy_run', 'dummy_category', 'dummy_name') ) self.user = UserFactory() self.request = self.request_factory.get('/dummy-url') self.request.user = self.user def test_invalid_handler(self): self.descriptor.handle.side_effect = NoSuchHandlerError with self.assertRaises(Http404): component_handler(self.request, self.usage_key_string, 'invalid_handler') @ddt.data('GET', 'POST', 'PUT', 'DELETE') def test_request_method(self, method): def check_handler(handler, request, suffix): self.assertEquals(request.method, method) return Response() self.descriptor.handle = check_handler # Have to use the right method to create the request to get the HTTP method that we want req_factory_method = getattr(self.request_factory, method.lower()) request = req_factory_method('/dummy-url') request.user = self.user component_handler(request, self.usage_key_string, 'dummy_handler') @ddt.data(200, 404, 500) def test_response_code(self, status_code): def create_response(handler, request, suffix): return Response(status_code=status_code) self.descriptor.handle = create_response self.assertEquals(component_handler(self.request, self.usage_key_string, 'dummy_handler').status_code, status_code) class TestComponentTemplates(CourseTestCase): """ Unit tests for the generation of the component templates for a course. """ def setUp(self): super(TestComponentTemplates, self).setUp() # Advanced Module support levels. XBlockStudioConfiguration.objects.create(name='poll', enabled=True, support_level="fs") XBlockStudioConfiguration.objects.create(name='survey', enabled=True, support_level="ps") XBlockStudioConfiguration.objects.create(name='annotatable', enabled=True, support_level="us") # Basic component support levels. XBlockStudioConfiguration.objects.create(name='html', enabled=True, support_level="fs") XBlockStudioConfiguration.objects.create(name='discussion', enabled=True, support_level="ps") XBlockStudioConfiguration.objects.create(name='problem', enabled=True, support_level="us") XBlockStudioConfiguration.objects.create(name='video', enabled=True, support_level="us") # XBlock masquerading as a problem XBlockStudioConfiguration.objects.create(name='openassessment', enabled=True, support_level="us") self.templates = get_component_templates(self.course) def get_templates_of_type(self, template_type): """ Returns the templates for the specified type, or None if none is found. """ template_dict = next((template for template in self.templates if template.get('type') == template_type), None) return template_dict.get('templates') if template_dict else None def get_template(self, templates, display_name): """ Returns the template which has the specified display name. """ return next((template for template in templates if template.get('display_name') == display_name), None) def test_basic_components(self): """ Test the handling of the basic component templates. """ self._verify_basic_component("discussion", "Discussion") self._verify_basic_component("video", "Video") self.assertGreater(self.get_templates_of_type('html'), 0) self.assertGreater(self.get_templates_of_type('problem'), 0) self.assertIsNone(self.get_templates_of_type('advanced')) # Now fully disable video through XBlockConfiguration XBlockConfiguration.objects.create(name='video', enabled=False) self.templates = get_component_templates(self.course) self.assertIsNone(self.get_templates_of_type('video')) def test_basic_components_support_levels(self): """ Test that support levels can be set on basic component templates. """ XBlockStudioConfigurationFlag.objects.create(enabled=True) self.templates = get_component_templates(self.course) self._verify_basic_component("discussion", "Discussion", "ps") self.assertEqual([], self.get_templates_of_type("video")) self.assertEqual([], self.get_templates_of_type("problem")) self.course.allow_unsupported_xblocks = True self.templates = get_component_templates(self.course) self._verify_basic_component("video", "Video", "us") problem_templates = self.get_templates_of_type('problem') problem_no_boilerplate = self.get_template(problem_templates, u'Blank Advanced Problem') self.assertIsNotNone(problem_no_boilerplate) self.assertEqual('us', problem_no_boilerplate['support_level']) # Now fully disable video through XBlockConfiguration XBlockConfiguration.objects.create(name='video', enabled=False) self.templates = get_component_templates(self.course) self.assertIsNone(self.get_templates_of_type('video')) def test_advanced_components(self): """ Test the handling of advanced component templates. """ self.course.advanced_modules.append('word_cloud') self.templates = get_component_templates(self.course) advanced_templates = self.get_templates_of_type('advanced') self.assertEqual(len(advanced_templates), 1) world_cloud_template = advanced_templates[0] self.assertEqual(world_cloud_template.get('category'), 'word_cloud') self.assertEqual(world_cloud_template.get('display_name'), u'Word cloud') self.assertIsNone(world_cloud_template.get('boilerplate_name', None)) # Verify that non-advanced components are not added twice self.course.advanced_modules.append('video') self.course.advanced_modules.append('openassessment') self.templates = get_component_templates(self.course) advanced_templates = self.get_templates_of_type('advanced') self.assertEqual(len(advanced_templates), 1) only_template = advanced_templates[0] self.assertNotEqual(only_template.get('category'), 'video') self.assertNotEqual(only_template.get('category'), 'openassessment') # Now fully disable word_cloud through XBlockConfiguration XBlockConfiguration.objects.create(name='word_cloud', enabled=False) self.templates = get_component_templates(self.course) self.assertIsNone(self.get_templates_of_type('advanced')) def test_advanced_problems(self): """ Test the handling of advanced problem templates. """ problem_templates = self.get_templates_of_type('problem') circuit_template = self.get_template(problem_templates, u'Circuit Schematic Builder') self.assertIsNotNone(circuit_template) self.assertEqual(circuit_template.get('category'), 'problem') self.assertEqual(circuit_template.get('boilerplate_name'), 'circuitschematic.yaml') def test_deprecated_no_advance_component_button(self): """ Test that there will be no `Advanced` button on unit page if xblocks have disabled Studio support given that they are the only modules in `Advanced Module List` """ # Update poll and survey to have "enabled=False". XBlockStudioConfiguration.objects.create(name='poll', enabled=False, support_level="fs") XBlockStudioConfiguration.objects.create(name='survey', enabled=False, support_level="fs") XBlockStudioConfigurationFlag.objects.create(enabled=True) self.course.advanced_modules.extend(['poll', 'survey']) templates = get_component_templates(self.course) button_names = [template['display_name'] for template in templates] self.assertNotIn('Advanced', button_names) def test_cannot_create_deprecated_problems(self): """ Test that xblocks that have Studio support disabled do not show on the "new component" menu. """ # Update poll to have "enabled=False". XBlockStudioConfiguration.objects.create(name='poll', enabled=False, support_level="fs") XBlockStudioConfigurationFlag.objects.create(enabled=True) self.course.advanced_modules.extend(['annotatable', 'poll', 'survey']) # Annotatable doesn't show up because it is unsupported (in test setUp). self._verify_advanced_xblocks(['Survey'], ['ps']) # Now enable unsupported components. self.course.allow_unsupported_xblocks = True self._verify_advanced_xblocks(['Annotation', 'Survey'], ['us', 'ps']) # Now disable Annotatable completely through XBlockConfiguration XBlockConfiguration.objects.create(name='annotatable', enabled=False) self._verify_advanced_xblocks(['Survey'], ['ps']) def test_create_support_level_flag_off(self): """ Test that we can create any advanced xblock (that isn't completely disabled through XBlockConfiguration) if XBlockStudioConfigurationFlag is False. """ XBlockStudioConfigurationFlag.objects.create(enabled=False) self.course.advanced_modules.extend(['annotatable', 'survey']) self._verify_advanced_xblocks(['Annotation', 'Survey'], [True, True]) def test_xblock_masquerading_as_problem(self): """ Test the integration of xblocks masquerading as problems. """ def get_openassessment(): """ Helper method to return the openassessment template from problem list """ self.templates = get_component_templates(self.course) problem_templates = self.get_templates_of_type('problem') return self.get_template(problem_templates, u'Peer Assessment') def verify_openassessment_present(support_level): """ Helper method to verify that openassessment template is present """ openassessment = get_openassessment() self.assertIsNotNone(openassessment) self.assertEqual(openassessment.get('category'), 'openassessment') self.assertEqual(openassessment.get('support_level'), support_level) verify_openassessment_present(True) # Now enable XBlockStudioConfigurationFlag. The openassessment block is marked # unsupported, so will no longer show up. XBlockStudioConfigurationFlag.objects.create(enabled=True) self.assertIsNone(get_openassessment()) # Now allow unsupported components. self.course.allow_unsupported_xblocks = True verify_openassessment_present('us') # Now disable openassessment completely through XBlockConfiguration XBlockConfiguration.objects.create(name='openassessment', enabled=False) self.assertIsNone(get_openassessment()) def _verify_advanced_xblocks(self, expected_xblocks, expected_support_levels): """ Verify the names of the advanced xblocks showing in the "new component" menu. """ templates = get_component_templates(self.course) button_names = [template['display_name'] for template in templates] self.assertIn('Advanced', button_names) self.assertEqual(len(templates[0]['templates']), len(expected_xblocks)) template_display_names = [template['display_name'] for template in templates[0]['templates']] self.assertEqual(template_display_names, expected_xblocks) template_support_levels = [template['support_level'] for template in templates[0]['templates']] self.assertEqual(template_support_levels, expected_support_levels) def _verify_basic_component(self, component_type, display_name, support_level=True): """ Verify the display name and support level of basic components (that have no boilerplates). """ templates = self.get_templates_of_type(component_type) self.assertEqual(1, len(templates)) self.assertEqual(display_name, templates[0]['display_name']) self.assertEqual(support_level, templates[0]['support_level']) @ddt.ddt class TestXBlockInfo(ItemTest): """ Unit tests for XBlock's outline handling. """ def setUp(self): super(TestXBlockInfo, self).setUp() user_id = self.user.id self.chapter = ItemFactory.create( parent_location=self.course.location, category='chapter', display_name="Week 1", user_id=user_id ) self.sequential = ItemFactory.create( parent_location=self.chapter.location, category='sequential', display_name="Lesson 1", user_id=user_id ) self.vertical = ItemFactory.create( parent_location=self.sequential.location, category='vertical', display_name='Unit 1', user_id=user_id ) self.video = ItemFactory.create( parent_location=self.vertical.location, category='video', display_name='My Video', user_id=user_id ) def test_json_responses(self): outline_url = reverse_usage_url('xblock_outline_handler', self.usage_key) resp = self.client.get(outline_url, HTTP_ACCEPT='application/json') json_response = json.loads(resp.content) self.validate_course_xblock_info(json_response, course_outline=True) @ddt.data( (ModuleStoreEnum.Type.split, 4, 4), (ModuleStoreEnum.Type.mongo, 5, 7), ) @ddt.unpack def test_xblock_outline_handler_mongo_calls(self, store_type, chapter_queries, chapter_queries_1): with self.store.default_store(store_type): course = CourseFactory.create() chapter = ItemFactory.create( parent_location=course.location, category='chapter', display_name='Week 1' ) outline_url = reverse_usage_url('xblock_outline_handler', chapter.location) with check_mongo_calls(chapter_queries): self.client.get(outline_url, HTTP_ACCEPT='application/json') sequential = ItemFactory.create( parent_location=chapter.location, category='sequential', display_name='Sequential 1' ) ItemFactory.create( parent_location=sequential.location, category='vertical', display_name='Vertical 1' ) # calls should be same after adding two new children for split only. with check_mongo_calls(chapter_queries_1): self.client.get(outline_url, HTTP_ACCEPT='application/json') def test_entrance_exam_chapter_xblock_info(self): chapter = ItemFactory.create( parent_location=self.course.location, category='chapter', display_name="Entrance Exam", user_id=self.user.id, is_entrance_exam=True ) chapter = modulestore().get_item(chapter.location) xblock_info = create_xblock_info( chapter, include_child_info=True, include_children_predicate=ALWAYS, ) # entrance exam chapter should not be deletable, draggable and childAddable. actions = xblock_info['actions'] self.assertEqual(actions['deletable'], False) self.assertEqual(actions['draggable'], False) self.assertEqual(actions['childAddable'], False) self.assertEqual(xblock_info['display_name'], 'Entrance Exam') self.assertIsNone(xblock_info.get('is_header_visible', None)) def test_none_entrance_exam_chapter_xblock_info(self): chapter = ItemFactory.create( parent_location=self.course.location, category='chapter', display_name="Test Chapter", user_id=self.user.id ) chapter = modulestore().get_item(chapter.location) xblock_info = create_xblock_info( chapter, include_child_info=True, include_children_predicate=ALWAYS, ) # chapter should be deletable, draggable and childAddable if not an entrance exam. actions = xblock_info['actions'] self.assertEqual(actions['deletable'], True) self.assertEqual(actions['draggable'], True) self.assertEqual(actions['childAddable'], True) # chapter xblock info should not contains the key of 'is_header_visible'. self.assertIsNone(xblock_info.get('is_header_visible', None)) def test_entrance_exam_sequential_xblock_info(self): chapter = ItemFactory.create( parent_location=self.course.location, category='chapter', display_name="Entrance Exam", user_id=self.user.id, is_entrance_exam=True, in_entrance_exam=True ) subsection = ItemFactory.create( parent_location=chapter.location, category='sequential', display_name="Subsection - Entrance Exam", user_id=self.user.id, in_entrance_exam=True ) subsection = modulestore().get_item(subsection.location) xblock_info = create_xblock_info( subsection, include_child_info=True, include_children_predicate=ALWAYS ) # in case of entrance exam subsection, header should be hidden. self.assertEqual(xblock_info['is_header_visible'], False) self.assertEqual(xblock_info['display_name'], 'Subsection - Entrance Exam') def test_none_entrance_exam_sequential_xblock_info(self): subsection = ItemFactory.create( parent_location=self.chapter.location, category='sequential', display_name="Subsection - Exam", user_id=self.user.id ) subsection = modulestore().get_item(subsection.location) xblock_info = create_xblock_info( subsection, include_child_info=True, include_children_predicate=ALWAYS, parent_xblock=self.chapter ) # sequential xblock info should not contains the key of 'is_header_visible'. self.assertIsNone(xblock_info.get('is_header_visible', None)) def test_chapter_xblock_info(self): chapter = modulestore().get_item(self.chapter.location) xblock_info = create_xblock_info( chapter, include_child_info=True, include_children_predicate=ALWAYS, ) self.validate_chapter_xblock_info(xblock_info) def test_sequential_xblock_info(self): sequential = modulestore().get_item(self.sequential.location) xblock_info = create_xblock_info( sequential, include_child_info=True, include_children_predicate=ALWAYS, ) self.validate_sequential_xblock_info(xblock_info) def test_vertical_xblock_info(self): vertical = modulestore().get_item(self.vertical.location) xblock_info = create_xblock_info( vertical, include_child_info=True, include_children_predicate=ALWAYS, include_ancestor_info=True, user=self.user ) add_container_page_publishing_info(vertical, xblock_info) self.validate_vertical_xblock_info(xblock_info) def test_component_xblock_info(self): video = modulestore().get_item(self.video.location) xblock_info = create_xblock_info( video, include_child_info=True, include_children_predicate=ALWAYS ) self.validate_component_xblock_info(xblock_info) @ddt.data(ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.mongo) def test_validate_start_date(self, store_type): """ Validate if start-date year is less than 1900 reset the date to DEFAULT_START_DATE. """ with self.store.default_store(store_type): course = CourseFactory.create() chapter = ItemFactory.create( parent_location=course.location, category='chapter', display_name='Week 1' ) chapter.start = datetime(year=1899, month=1, day=1, tzinfo=UTC) xblock_info = create_xblock_info( chapter, include_child_info=True, include_children_predicate=ALWAYS, include_ancestor_info=True, user=self.user ) self.assertEqual(xblock_info['start'], DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ')) def validate_course_xblock_info(self, xblock_info, has_child_info=True, course_outline=False): """ Validate that the xblock info is correct for the test course. """ self.assertEqual(xblock_info['category'], 'course') self.assertEqual(xblock_info['id'], unicode(self.course.location)) self.assertEqual(xblock_info['display_name'], self.course.display_name) self.assertTrue(xblock_info['published']) # Finally, validate the entire response for consistency self.validate_xblock_info_consistency(xblock_info, has_child_info=has_child_info, course_outline=course_outline) def validate_chapter_xblock_info(self, xblock_info, has_child_info=True): """ Validate that the xblock info is correct for the test chapter. """ self.assertEqual(xblock_info['category'], 'chapter') self.assertEqual(xblock_info['id'], unicode(self.chapter.location)) self.assertEqual(xblock_info['display_name'], 'Week 1') self.assertTrue(xblock_info['published']) self.assertIsNone(xblock_info.get('edited_by', None)) self.assertEqual(xblock_info['course_graders'], ['Homework', 'Lab', 'Midterm Exam', 'Final Exam']) self.assertEqual(xblock_info['start'], '2030-01-01T00:00:00Z') self.assertEqual(xblock_info['graded'], False) self.assertEqual(xblock_info['due'], None) self.assertEqual(xblock_info['format'], None) # Finally, validate the entire response for consistency self.validate_xblock_info_consistency(xblock_info, has_child_info=has_child_info) def validate_sequential_xblock_info(self, xblock_info, has_child_info=True): """ Validate that the xblock info is correct for the test sequential. """ self.assertEqual(xblock_info['category'], 'sequential') self.assertEqual(xblock_info['id'], unicode(self.sequential.location)) self.assertEqual(xblock_info['display_name'], 'Lesson 1') self.assertTrue(xblock_info['published']) self.assertIsNone(xblock_info.get('edited_by', None)) # Finally, validate the entire response for consistency self.validate_xblock_info_consistency(xblock_info, has_child_info=has_child_info) def validate_vertical_xblock_info(self, xblock_info): """ Validate that the xblock info is correct for the test vertical. """ self.assertEqual(xblock_info['category'], 'vertical') self.assertEqual(xblock_info['id'], unicode(self.vertical.location)) self.assertEqual(xblock_info['display_name'], 'Unit 1') self.assertTrue(xblock_info['published']) self.assertEqual(xblock_info['edited_by'], 'testuser') # Validate that the correct ancestor info has been included ancestor_info = xblock_info.get('ancestor_info', None) self.assertIsNotNone(ancestor_info) ancestors = ancestor_info['ancestors'] self.assertEqual(len(ancestors), 3) self.validate_sequential_xblock_info(ancestors[0], has_child_info=True) self.validate_chapter_xblock_info(ancestors[1], has_child_info=False) self.validate_course_xblock_info(ancestors[2], has_child_info=False) # Finally, validate the entire response for consistency self.validate_xblock_info_consistency(xblock_info, has_child_info=True, has_ancestor_info=True) def validate_component_xblock_info(self, xblock_info): """ Validate that the xblock info is correct for the test component. """ self.assertEqual(xblock_info['category'], 'video') self.assertEqual(xblock_info['id'], unicode(self.video.location)) self.assertEqual(xblock_info['display_name'], 'My Video') self.assertTrue(xblock_info['published']) self.assertIsNone(xblock_info.get('edited_by', None)) # Finally, validate the entire response for consistency self.validate_xblock_info_consistency(xblock_info) def validate_xblock_info_consistency(self, xblock_info, has_ancestor_info=False, has_child_info=False, course_outline=False): """ Validate that the xblock info is internally consistent. """ self.assertIsNotNone(xblock_info['display_name']) self.assertIsNotNone(xblock_info['id']) self.assertIsNotNone(xblock_info['category']) self.assertTrue(xblock_info['published']) if has_ancestor_info: self.assertIsNotNone(xblock_info.get('ancestor_info', None)) ancestors = xblock_info['ancestor_info']['ancestors'] for ancestor in xblock_info['ancestor_info']['ancestors']: self.validate_xblock_info_consistency( ancestor, has_child_info=(ancestor == ancestors[0]), # Only the direct ancestor includes children course_outline=course_outline ) else: self.assertIsNone(xblock_info.get('ancestor_info', None)) if has_child_info: self.assertIsNotNone(xblock_info.get('child_info', None)) if xblock_info['child_info'].get('children', None): for child_response in xblock_info['child_info']['children']: self.validate_xblock_info_consistency( child_response, has_child_info=(not child_response.get('child_info', None) is None), course_outline=course_outline ) else: self.assertIsNone(xblock_info.get('child_info', None)) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True}) def test_proctored_exam_xblock_info(self): self.course.enable_proctored_exams = True self.course.save() self.store.update_item(self.course, self.user.id) course = modulestore().get_item(self.course.location) xblock_info = create_xblock_info( course, include_child_info=True, include_children_predicate=ALWAYS, ) # exam proctoring should be enabled and time limited. self.assertEqual(xblock_info['enable_proctored_exams'], True) sequential = ItemFactory.create( parent_location=self.chapter.location, category='sequential', display_name="Test Lesson 1", user_id=self.user.id, is_proctored_exam=True, is_time_limited=True, default_time_limit_minutes=100 ) sequential = modulestore().get_item(sequential.location) xblock_info = create_xblock_info( sequential, include_child_info=True, include_children_predicate=ALWAYS, ) # exam proctoring should be enabled and time limited. self.assertEqual(xblock_info['is_proctored_exam'], True) self.assertEqual(xblock_info['is_time_limited'], True) self.assertEqual(xblock_info['default_time_limit_minutes'], 100) class TestLibraryXBlockInfo(ModuleStoreTestCase): """ Unit tests for XBlock Info for XBlocks in a content library """ def setUp(self): super(TestLibraryXBlockInfo, self).setUp() user_id = self.user.id self.library = LibraryFactory.create() self.top_level_html = ItemFactory.create( parent_location=self.library.location, category='html', user_id=user_id, publish_item=False ) self.vertical = ItemFactory.create( parent_location=self.library.location, category='vertical', user_id=user_id, publish_item=False ) self.child_html = ItemFactory.create( parent_location=self.vertical.location, category='html', display_name='Test HTML Child Block', user_id=user_id, publish_item=False ) def test_lib_xblock_info(self): html_block = modulestore().get_item(self.top_level_html.location) xblock_info = create_xblock_info(html_block) self.validate_component_xblock_info(xblock_info, html_block) self.assertIsNone(xblock_info.get('child_info', None)) def test_lib_child_xblock_info(self): html_block = modulestore().get_item(self.child_html.location) xblock_info = create_xblock_info(html_block, include_ancestor_info=True, include_child_info=True) self.validate_component_xblock_info(xblock_info, html_block) self.assertIsNone(xblock_info.get('child_info', None)) ancestors = xblock_info['ancestor_info']['ancestors'] self.assertEqual(len(ancestors), 2) self.assertEqual(ancestors[0]['category'], 'vertical') self.assertEqual(ancestors[0]['id'], unicode(self.vertical.location)) self.assertEqual(ancestors[1]['category'], 'library') def validate_component_xblock_info(self, xblock_info, original_block): """ Validate that the xblock info is correct for the test component. """ self.assertEqual(xblock_info['category'], original_block.category) self.assertEqual(xblock_info['id'], unicode(original_block.location)) self.assertEqual(xblock_info['display_name'], original_block.display_name) self.assertIsNone(xblock_info.get('has_changes', None)) self.assertIsNone(xblock_info.get('published', None)) self.assertIsNone(xblock_info.get('published_on', None)) self.assertIsNone(xblock_info.get('graders', None)) class TestLibraryXBlockCreation(ItemTest): """ Tests the adding of XBlocks to Library """ def test_add_xblock(self): """ Verify we can add an XBlock to a Library. """ lib = LibraryFactory.create() self.create_xblock(parent_usage_key=lib.location, display_name='Test', category="html") lib = self.store.get_library(lib.location.library_key) self.assertTrue(lib.children) xblock_locator = lib.children[0] self.assertEqual(self.store.get_item(xblock_locator).display_name, 'Test') def test_no_add_discussion(self): """ Verify we cannot add a discussion module to a Library. """ lib = LibraryFactory.create() response = self.create_xblock(parent_usage_key=lib.location, display_name='Test', category='discussion') self.assertEqual(response.status_code, 400) lib = self.store.get_library(lib.location.library_key) self.assertFalse(lib.children) def test_no_add_advanced(self): lib = LibraryFactory.create() lib.advanced_modules = ['lti'] lib.save() response = self.create_xblock(parent_usage_key=lib.location, display_name='Test', category='lti') self.assertEqual(response.status_code, 400) lib = self.store.get_library(lib.location.library_key) self.assertFalse(lib.children) @ddt.ddt class TestXBlockPublishingInfo(ItemTest): """ Unit tests for XBlock's outline handling. """ FIRST_SUBSECTION_PATH = [0] FIRST_UNIT_PATH = [0, 0] SECOND_UNIT_PATH = [0, 1] def _create_child(self, parent, category, display_name, publish_item=False, staff_only=False): """ Creates a child xblock for the given parent. """ child = ItemFactory.create( parent_location=parent.location, category=category, display_name=display_name, user_id=self.user.id, publish_item=publish_item ) if staff_only: self._enable_staff_only(child.location) # In case the staff_only state was set, return the updated xblock. return modulestore().get_item(child.location) def _get_child_xblock_info(self, xblock_info, index): """ Returns the child xblock info at the specified index. """ children = xblock_info['child_info']['children'] self.assertGreater(len(children), index) return children[index] def _get_xblock_info(self, location): """ Returns the xblock info for the specified location. """ return create_xblock_info( modulestore().get_item(location), include_child_info=True, include_children_predicate=ALWAYS, ) def _get_xblock_outline_info(self, location): """ Returns the xblock info for the specified location as neeeded for the course outline page. """ return create_xblock_info( modulestore().get_item(location), include_child_info=True, include_children_predicate=ALWAYS, course_outline=True ) def _set_release_date(self, location, start): """ Sets the release date for the specified xblock. """ xblock = modulestore().get_item(location) xblock.start = start self.store.update_item(xblock, self.user.id) def _enable_staff_only(self, location): """ Enables staff only for the specified xblock. """ xblock = modulestore().get_item(location) xblock.visible_to_staff_only = True self.store.update_item(xblock, self.user.id) def _set_display_name(self, location, display_name): """ Sets the display name for the specified xblock. """ xblock = modulestore().get_item(location) xblock.display_name = display_name self.store.update_item(xblock, self.user.id) def _verify_xblock_info_state(self, xblock_info, xblock_info_field, expected_state, path=None, should_equal=True): """ Verify the state of an xblock_info field. If no path is provided then the root item will be verified. If should_equal is True, assert that the current state matches the expected state, otherwise assert that they do not match. """ if path: direct_child_xblock_info = self._get_child_xblock_info(xblock_info, path[0]) remaining_path = path[1:] if len(path) > 1 else None self._verify_xblock_info_state(direct_child_xblock_info, xblock_info_field, expected_state, remaining_path, should_equal) else: if should_equal: self.assertEqual(xblock_info[xblock_info_field], expected_state) else: self.assertNotEqual(xblock_info[xblock_info_field], expected_state) def _verify_has_staff_only_message(self, xblock_info, expected_state, path=None): """ Verify the staff_only_message field of xblock_info. """ self._verify_xblock_info_state(xblock_info, 'staff_only_message', expected_state, path) def _verify_visibility_state(self, xblock_info, expected_state, path=None, should_equal=True): """ Verify the publish state of an item in the xblock_info. """ self._verify_xblock_info_state(xblock_info, 'visibility_state', expected_state, path, should_equal) def _verify_explicit_staff_lock_state(self, xblock_info, expected_state, path=None, should_equal=True): """ Verify the explicit staff lock state of an item in the xblock_info. """ self._verify_xblock_info_state(xblock_info, 'has_explicit_staff_lock', expected_state, path, should_equal) def test_empty_chapter(self): empty_chapter = self._create_child(self.course, 'chapter', "Empty Chapter") xblock_info = self._get_xblock_info(empty_chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.unscheduled) def test_empty_sequential(self): chapter = self._create_child(self.course, 'chapter', "Test Chapter") self._create_child(chapter, 'sequential', "Empty Sequential") xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.unscheduled) self._verify_visibility_state(xblock_info, VisibilityState.unscheduled, path=self.FIRST_SUBSECTION_PATH) def test_published_unit(self): """ Tests the visibility state of a published unit with release date in the future. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(chapter.location, datetime.now(UTC) + timedelta(days=1)) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.ready) self._verify_visibility_state(xblock_info, VisibilityState.ready, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.ready, path=self.FIRST_UNIT_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.SECOND_UNIT_PATH) def test_released_unit(self): """ Tests the visibility state of a published unit with release date in the past. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(chapter.location, datetime.now(UTC) - timedelta(days=1)) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.live) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_UNIT_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.SECOND_UNIT_PATH) def test_unpublished_changes(self): """ Tests the visibility state of a published unit with draft (unpublished) changes. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") unit = self._create_child(sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(sequential, 'vertical', "Staff Only Unit", staff_only=True) # Setting the display name creates a draft version of unit. self._set_display_name(unit.location, 'Updated Unit') xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.needs_attention) self._verify_visibility_state(xblock_info, VisibilityState.needs_attention, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.needs_attention, path=self.FIRST_UNIT_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.SECOND_UNIT_PATH) def test_partially_released_section(self): chapter = self._create_child(self.course, 'chapter', "Test Chapter") released_sequential = self._create_child(chapter, 'sequential', "Released Sequential") self._create_child(released_sequential, 'vertical', "Released Unit", publish_item=True) self._create_child(released_sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(chapter.location, datetime.now(UTC) - timedelta(days=1)) published_sequential = self._create_child(chapter, 'sequential', "Published Sequential") self._create_child(published_sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(published_sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(published_sequential.location, datetime.now(UTC) + timedelta(days=1)) xblock_info = self._get_xblock_info(chapter.location) # Verify the state of the released sequential self._verify_visibility_state(xblock_info, VisibilityState.live, path=[0]) self._verify_visibility_state(xblock_info, VisibilityState.live, path=[0, 0]) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=[0, 1]) # Verify the state of the published sequential self._verify_visibility_state(xblock_info, VisibilityState.ready, path=[1]) self._verify_visibility_state(xblock_info, VisibilityState.ready, path=[1, 0]) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=[1, 1]) # Finally verify the state of the chapter self._verify_visibility_state(xblock_info, VisibilityState.ready) def test_staff_only_section(self): """ Tests that an explicitly staff-locked section and all of its children are visible to staff only. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter", staff_only=True) sequential = self._create_child(chapter, 'sequential', "Test Sequential") vertical = self._create_child(sequential, 'vertical', "Unit") xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.staff_only) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_UNIT_PATH) self._verify_explicit_staff_lock_state(xblock_info, True) self._verify_explicit_staff_lock_state(xblock_info, False, path=self.FIRST_SUBSECTION_PATH) self._verify_explicit_staff_lock_state(xblock_info, False, path=self.FIRST_UNIT_PATH) vertical_info = self._get_xblock_info(vertical.location) add_container_page_publishing_info(vertical, vertical_info) self.assertEqual(_xblock_type_and_display_name(chapter), vertical_info["staff_lock_from"]) def test_no_staff_only_section(self): """ Tests that a section with a staff-locked subsection and a visible subsection is not staff locked itself. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") self._create_child(chapter, 'sequential', "Test Visible Sequential") self._create_child(chapter, 'sequential', "Test Staff Locked Sequential", staff_only=True) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, should_equal=False) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=[0], should_equal=False) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=[1]) def test_staff_only_subsection(self): """ Tests that an explicitly staff-locked subsection and all of its children are visible to staff only. In this case the parent section is also visible to staff only because all of its children are staff only. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential", staff_only=True) vertical = self._create_child(sequential, 'vertical', "Unit") xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.staff_only) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_UNIT_PATH) self._verify_explicit_staff_lock_state(xblock_info, False) self._verify_explicit_staff_lock_state(xblock_info, True, path=self.FIRST_SUBSECTION_PATH) self._verify_explicit_staff_lock_state(xblock_info, False, path=self.FIRST_UNIT_PATH) vertical_info = self._get_xblock_info(vertical.location) add_container_page_publishing_info(vertical, vertical_info) self.assertEqual(_xblock_type_and_display_name(sequential), vertical_info["staff_lock_from"]) def test_no_staff_only_subsection(self): """ Tests that a subsection with a staff-locked unit and a visible unit is not staff locked itself. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Unit") self._create_child(sequential, 'vertical', "Locked Unit", staff_only=True) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, self.FIRST_SUBSECTION_PATH, should_equal=False) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, self.FIRST_UNIT_PATH, should_equal=False) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, self.SECOND_UNIT_PATH) def test_staff_only_unit(self): chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") vertical = self._create_child(sequential, 'vertical', "Unit", staff_only=True) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.staff_only) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.FIRST_UNIT_PATH) self._verify_explicit_staff_lock_state(xblock_info, False) self._verify_explicit_staff_lock_state(xblock_info, False, path=self.FIRST_SUBSECTION_PATH) self._verify_explicit_staff_lock_state(xblock_info, True, path=self.FIRST_UNIT_PATH) vertical_info = self._get_xblock_info(vertical.location) add_container_page_publishing_info(vertical, vertical_info) self.assertEqual(_xblock_type_and_display_name(vertical), vertical_info["staff_lock_from"]) def test_unscheduled_section_with_live_subsection(self): chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(sequential.location, datetime.now(UTC) - timedelta(days=1)) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.needs_attention) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_UNIT_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.SECOND_UNIT_PATH) def test_unreleased_section_with_live_subsection(self): chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Published Unit", publish_item=True) self._create_child(sequential, 'vertical', "Staff Only Unit", staff_only=True) self._set_release_date(chapter.location, datetime.now(UTC) + timedelta(days=1)) self._set_release_date(sequential.location, datetime.now(UTC) - timedelta(days=1)) xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.needs_attention) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_SUBSECTION_PATH) self._verify_visibility_state(xblock_info, VisibilityState.live, path=self.FIRST_UNIT_PATH) self._verify_visibility_state(xblock_info, VisibilityState.staff_only, path=self.SECOND_UNIT_PATH) def test_locked_section_staff_only_message(self): """ Tests that a locked section has a staff only message and its descendants do not. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter", staff_only=True) sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Unit") xblock_info = self._get_xblock_outline_info(chapter.location) self._verify_has_staff_only_message(xblock_info, True) self._verify_has_staff_only_message(xblock_info, False, path=self.FIRST_SUBSECTION_PATH) self._verify_has_staff_only_message(xblock_info, False, path=self.FIRST_UNIT_PATH) def test_locked_unit_staff_only_message(self): """ Tests that a lone locked unit has a staff only message along with its ancestors. """ chapter = self._create_child(self.course, 'chapter', "Test Chapter") sequential = self._create_child(chapter, 'sequential', "Test Sequential") self._create_child(sequential, 'vertical', "Unit", staff_only=True) xblock_info = self._get_xblock_outline_info(chapter.location) self._verify_has_staff_only_message(xblock_info, True) self._verify_has_staff_only_message(xblock_info, True, path=self.FIRST_SUBSECTION_PATH) self._verify_has_staff_only_message(xblock_info, True, path=self.FIRST_UNIT_PATH) @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) def test_self_paced_item_visibility_state(self, store_type): """ Test that in self-paced course, item has `live` visibility state. Test that when item was initially in `scheduled` state in instructor mode, change course pacing to self-paced, now in self-paced course, item should have `live` visibility state. """ SelfPacedConfiguration(enabled=True).save() # Create course, chapter and setup future release date to make chapter in scheduled state course = CourseFactory.create(default_store=store_type) chapter = self._create_child(course, 'chapter', "Test Chapter") self._set_release_date(chapter.location, datetime.now(UTC) + timedelta(days=1)) # Check that chapter has scheduled state xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.ready) self.assertFalse(course.self_paced) # Change course pacing to self paced course.self_paced = True self.store.update_item(course, self.user.id) self.assertTrue(course.self_paced) # Check that in self paced course content has live state now xblock_info = self._get_xblock_info(chapter.location) self._verify_visibility_state(xblock_info, VisibilityState.live)
agpl-3.0
[ 624, 2925, 367, 2974, 6858, 1041, 199, 646, 2022, 199, 504, 2197, 492, 2197, 12, 6871, 199, 646, 366, 3583, 199, 199, 504, 1683, 492, 3371, 12, 4420, 12, 16158, 3346, 199, 504, 15444, 492, 12174, 199, 504, 1134, 1131, 492, 1611, 3227, 199, 504, 14568, 492, 7232, 199, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 23061, 14, 1208, 492, 3837, 63, 3807, 63, 633, 12, 3837, 63, 1972, 63, 633, 199, 199, 504, 22709, 14, 1018, 14, 16432, 14, 277, 63, 1142, 68, 14, 992, 492, 23820, 4232, 6867, 5688, 199, 504, 23061, 14, 4196, 14, 3173, 492, 334, 272, 3931, 63, 2232, 12, 664, 63, 3173, 63, 5876, 199, 9, 199, 199, 504, 23061, 14, 4196, 14, 1053, 492, 334, 272, 1218, 63, 11283, 63, 815, 12, 12112, 26194, 12, 6561, 4783, 2223, 12, 485, 11283, 63, 466, 63, 460, 63, 2918, 63, 354, 12, 1050, 63, 3600, 63, 1606, 63, 4763, 316, 63, 815, 199, 9, 199, 504, 23061, 14, 2219, 14, 1208, 492, 5531, 1746, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 504, 12971, 63, 1176, 14, 992, 492, 15398, 5688, 12, 15398, 21025, 5688, 12, 15398, 21025, 5688, 5318, 199, 504, 9872, 14, 18182, 63, 578, 492, 8790, 387, 4311, 199, 504, 9872, 14, 10012, 492, 23431, 199, 504, 9872, 14, 10012, 14, 1176, 492, 10996, 199, 504, 9872, 14, 10012, 14, 2219, 14, 1176, 63, 1208, 492, 17996, 1746, 12, 7393, 63, 3998, 63, 30538, 63, 27011, 199, 504, 9872, 14, 10012, 14, 2219, 14, 15406, 492, 19319, 12, 11243, 2927, 12, 1104, 63, 9217, 63, 5352, 12, 17862, 199, 504, 9872, 14, 88, 63, 578, 492, 4384, 53, 19283, 63, 12058, 12, 4384, 29317, 63, 12058, 199, 504, 9872, 14, 1972, 63, 578, 492, 6186, 63, 7363, 63, 5390, 199, 504, 12971, 14, 1018, 492, 15398, 33, 2441, 199, 504, 12971, 14, 955, 492, 20488, 12, 2624, 12, 20488, 11506, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 7726, 492, 7448, 25720, 5502, 12, 1804, 3122, 792, 1451, 199, 504, 12971, 14, 396, 14, 2537, 492, 1379, 14357, 199, 504, 12971, 14, 3924, 492, 23798, 2461, 547, 199, 504, 12971, 63, 1176, 14, 751, 63, 1364, 492, 5634, 24784, 1899, 3167, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 11028, 1197, 12, 22574, 199, 504, 15058, 63, 1612, 14, 8268, 14, 8022, 492, 12625, 199, 504, 9872, 14, 12553, 14, 12553, 492, 5611, 12, 2876, 13068, 421, 199, 533, 437, 2441, 774, 8, 24784, 33, 2441, 304, 272, 408, 272, 1379, 12971, 282, 2441, 1021, 272, 408, 272, 28671, 1254, 63, 9663, 275, 399, 17030, 80, 30, 33, 2441, 8024, 8018, 1108, 80, 4335, 339, 901, 845, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 17, 401, 4194, 29, 7812, 14, 1317, 9, 272, 901, 713, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 18, 401, 4194, 29, 7812, 14, 1751, 9, 272, 901, 969, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 19, 401, 4194, 29, 7812, 14, 1708, 9, 339, 768, 24784, 33, 2441, 14, 28135, 63, 509, 360, 5500, 63, 1345, 358, 272, 347, 6474, 63, 1345, 63, 28135, 8, 277, 12, 1853, 12, 1067, 304, 221, 327, 4287, 26, 3507, 29, 8618, 13, 2094, 267, 408, 1123, 370, 314, 6474, 2455, 624, 267, 372, 481, 4338, 8, 277, 14, 24439, 63, 9663, 9, 421, 199, 533, 7020, 774, 8, 6979, 1746, 304, 272, 408, 3523, 511, 1021, 367, 1218, 12, 3354, 12, 436, 3145, 408, 272, 347, 3613, 8, 277, 304, 267, 1613, 8, 2081, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 1972, 63, 498, 275, 291, 14, 1972, 14, 344, 267, 291, 14, 3807, 63, 498, 275, 291, 14, 1972, 14, 1985, 339, 347, 664, 63, 1053, 63, 504, 63, 10012, 8, 277, 12, 4503, 63, 498, 12, 4911, 63, 374, 63, 7185, 29, 797, 304, 267, 408, 267, 2372, 314, 1242, 11812, 701, 314, 11028, 1197, 687, 314, 10996, 267, 408, 267, 1242, 275, 291, 14, 1617, 14, 362, 63, 1053, 8, 3807, 63, 498, 9, 267, 340, 4911, 63, 374, 63, 7185, 26, 288, 291, 14, 1815, 8, 5675, 8, 1053, 12, 283, 374, 63, 7185, 297, 756, 430, 267, 372, 1242, 339, 347, 1177, 63, 3807, 63, 498, 8, 277, 12, 1177, 304, 267, 408, 267, 2372, 314, 11028, 1197, 687, 314, 1177, 4886, 436, 4911, 626, 314, 2004, 63, 600, 1990, 1926, 14, 267, 520, 635, 1177, 26, 267, 408, 267, 4565, 275, 2022, 14, 3640, 8, 1310, 14, 1317, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 1926, 9, 267, 790, 275, 11028, 1197, 14, 504, 63, 875, 8, 6751, 459, 6354, 1105, 267, 340, 790, 14, 1972, 63, 498, 14, 1065, 365, 488, 26, 288, 790, 275, 790, 14, 1130, 63, 9924, 63, 1972, 8, 18806, 14, 504, 63, 875, 8, 6751, 459, 1972, 1197, 5156, 267, 372, 790, 339, 347, 1218, 63, 11283, 8, 277, 12, 1676, 63, 3807, 63, 498, 29, 403, 12, 2929, 63, 354, 29, 403, 12, 4637, 29, 403, 12, 1234, 27025, 29, 403, 304, 267, 666, 275, 469, 288, 283, 1708, 63, 6354, 356, 2649, 8, 277, 14, 3807, 63, 498, 9, 340, 1676, 63, 3807, 63, 498, 365, 488, 587, 2649, 8, 1708, 63, 3807, 63, 498, 395, 288, 283, 3710, 356, 4637, 267, 789, 267, 340, 2929, 63, 354, 365, 440, 488, 26, 288, 666, 459, 2918, 63, 354, 418, 275, 2929, 63, 354, 267, 340, 1234, 27025, 365, 440, 488, 26, 288, 666, 459, 656, 27025, 418, 275, 1234, 27025, 267, 372, 291, 14, 1258, 14, 12774, 63, 1932, 8, 4471, 360, 28160, 14, 4196, 14, 11283, 63, 2232, 659, 2022, 14, 4180, 8, 576, 430, 339, 347, 485, 981, 63, 7870, 8, 277, 12, 1676, 63, 3807, 63, 498, 29, 403, 304, 267, 408, 267, 10560, 282, 13763, 12, 8152, 2399, 11028, 1197, 14 ]
[ 2925, 367, 2974, 6858, 1041, 199, 646, 2022, 199, 504, 2197, 492, 2197, 12, 6871, 199, 646, 366, 3583, 199, 199, 504, 1683, 492, 3371, 12, 4420, 12, 16158, 3346, 199, 504, 15444, 492, 12174, 199, 504, 1134, 1131, 492, 1611, 3227, 199, 504, 14568, 492, 7232, 199, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 23061, 14, 1208, 492, 3837, 63, 3807, 63, 633, 12, 3837, 63, 1972, 63, 633, 199, 199, 504, 22709, 14, 1018, 14, 16432, 14, 277, 63, 1142, 68, 14, 992, 492, 23820, 4232, 6867, 5688, 199, 504, 23061, 14, 4196, 14, 3173, 492, 334, 272, 3931, 63, 2232, 12, 664, 63, 3173, 63, 5876, 199, 9, 199, 199, 504, 23061, 14, 4196, 14, 1053, 492, 334, 272, 1218, 63, 11283, 63, 815, 12, 12112, 26194, 12, 6561, 4783, 2223, 12, 485, 11283, 63, 466, 63, 460, 63, 2918, 63, 354, 12, 1050, 63, 3600, 63, 1606, 63, 4763, 316, 63, 815, 199, 9, 199, 504, 23061, 14, 2219, 14, 1208, 492, 5531, 1746, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 504, 12971, 63, 1176, 14, 992, 492, 15398, 5688, 12, 15398, 21025, 5688, 12, 15398, 21025, 5688, 5318, 199, 504, 9872, 14, 18182, 63, 578, 492, 8790, 387, 4311, 199, 504, 9872, 14, 10012, 492, 23431, 199, 504, 9872, 14, 10012, 14, 1176, 492, 10996, 199, 504, 9872, 14, 10012, 14, 2219, 14, 1176, 63, 1208, 492, 17996, 1746, 12, 7393, 63, 3998, 63, 30538, 63, 27011, 199, 504, 9872, 14, 10012, 14, 2219, 14, 15406, 492, 19319, 12, 11243, 2927, 12, 1104, 63, 9217, 63, 5352, 12, 17862, 199, 504, 9872, 14, 88, 63, 578, 492, 4384, 53, 19283, 63, 12058, 12, 4384, 29317, 63, 12058, 199, 504, 9872, 14, 1972, 63, 578, 492, 6186, 63, 7363, 63, 5390, 199, 504, 12971, 14, 1018, 492, 15398, 33, 2441, 199, 504, 12971, 14, 955, 492, 20488, 12, 2624, 12, 20488, 11506, 199, 504, 12971, 14, 7677, 492, 481, 4338, 199, 504, 12971, 14, 7726, 492, 7448, 25720, 5502, 12, 1804, 3122, 792, 1451, 199, 504, 12971, 14, 396, 14, 2537, 492, 1379, 14357, 199, 504, 12971, 14, 3924, 492, 23798, 2461, 547, 199, 504, 12971, 63, 1176, 14, 751, 63, 1364, 492, 5634, 24784, 1899, 3167, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 11028, 1197, 12, 22574, 199, 504, 15058, 63, 1612, 14, 8268, 14, 8022, 492, 12625, 199, 504, 9872, 14, 12553, 14, 12553, 492, 5611, 12, 2876, 13068, 421, 199, 533, 437, 2441, 774, 8, 24784, 33, 2441, 304, 272, 408, 272, 1379, 12971, 282, 2441, 1021, 272, 408, 272, 28671, 1254, 63, 9663, 275, 399, 17030, 80, 30, 33, 2441, 8024, 8018, 1108, 80, 4335, 339, 901, 845, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 17, 401, 4194, 29, 7812, 14, 1317, 9, 272, 901, 713, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 18, 401, 4194, 29, 7812, 14, 1751, 9, 272, 901, 969, 275, 2624, 8, 885, 628, 28135, 17, 63, 885, 63, 585, 19, 401, 4194, 29, 7812, 14, 1708, 9, 339, 768, 24784, 33, 2441, 14, 28135, 63, 509, 360, 5500, 63, 1345, 358, 272, 347, 6474, 63, 1345, 63, 28135, 8, 277, 12, 1853, 12, 1067, 304, 221, 327, 4287, 26, 3507, 29, 8618, 13, 2094, 267, 408, 1123, 370, 314, 6474, 2455, 624, 267, 372, 481, 4338, 8, 277, 14, 24439, 63, 9663, 9, 421, 199, 533, 7020, 774, 8, 6979, 1746, 304, 272, 408, 3523, 511, 1021, 367, 1218, 12, 3354, 12, 436, 3145, 408, 272, 347, 3613, 8, 277, 304, 267, 1613, 8, 2081, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 1972, 63, 498, 275, 291, 14, 1972, 14, 344, 267, 291, 14, 3807, 63, 498, 275, 291, 14, 1972, 14, 1985, 339, 347, 664, 63, 1053, 63, 504, 63, 10012, 8, 277, 12, 4503, 63, 498, 12, 4911, 63, 374, 63, 7185, 29, 797, 304, 267, 408, 267, 2372, 314, 1242, 11812, 701, 314, 11028, 1197, 687, 314, 10996, 267, 408, 267, 1242, 275, 291, 14, 1617, 14, 362, 63, 1053, 8, 3807, 63, 498, 9, 267, 340, 4911, 63, 374, 63, 7185, 26, 288, 291, 14, 1815, 8, 5675, 8, 1053, 12, 283, 374, 63, 7185, 297, 756, 430, 267, 372, 1242, 339, 347, 1177, 63, 3807, 63, 498, 8, 277, 12, 1177, 304, 267, 408, 267, 2372, 314, 11028, 1197, 687, 314, 1177, 4886, 436, 4911, 626, 314, 2004, 63, 600, 1990, 1926, 14, 267, 520, 635, 1177, 26, 267, 408, 267, 4565, 275, 2022, 14, 3640, 8, 1310, 14, 1317, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 1926, 9, 267, 790, 275, 11028, 1197, 14, 504, 63, 875, 8, 6751, 459, 6354, 1105, 267, 340, 790, 14, 1972, 63, 498, 14, 1065, 365, 488, 26, 288, 790, 275, 790, 14, 1130, 63, 9924, 63, 1972, 8, 18806, 14, 504, 63, 875, 8, 6751, 459, 1972, 1197, 5156, 267, 372, 790, 339, 347, 1218, 63, 11283, 8, 277, 12, 1676, 63, 3807, 63, 498, 29, 403, 12, 2929, 63, 354, 29, 403, 12, 4637, 29, 403, 12, 1234, 27025, 29, 403, 304, 267, 666, 275, 469, 288, 283, 1708, 63, 6354, 356, 2649, 8, 277, 14, 3807, 63, 498, 9, 340, 1676, 63, 3807, 63, 498, 365, 488, 587, 2649, 8, 1708, 63, 3807, 63, 498, 395, 288, 283, 3710, 356, 4637, 267, 789, 267, 340, 2929, 63, 354, 365, 440, 488, 26, 288, 666, 459, 2918, 63, 354, 418, 275, 2929, 63, 354, 267, 340, 1234, 27025, 365, 440, 488, 26, 288, 666, 459, 656, 27025, 418, 275, 1234, 27025, 267, 372, 291, 14, 1258, 14, 12774, 63, 1932, 8, 4471, 360, 28160, 14, 4196, 14, 11283, 63, 2232, 659, 2022, 14, 4180, 8, 576, 430, 339, 347, 485, 981, 63, 7870, 8, 277, 12, 1676, 63, 3807, 63, 498, 29, 403, 304, 267, 408, 267, 10560, 282, 13763, 12, 8152, 2399, 11028, 1197, 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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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 ]
C00kiie/Youtube-Mp3-telegram-bot
youtube_dl/extractor/cctv.py
64
6903
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( float_or_none, try_get, unified_timestamp, ) class CCTVIE(InfoExtractor): IE_DESC = '央视网' _VALID_URL = r'https?://(?:(?:[^/]+)\.(?:cntv|cctv)\.(?:com|cn)|(?:www\.)?ncpa-classic\.com)/(?:[^/]+/)*?(?P<id>[^/?#&]+?)(?:/index)?(?:\.s?html|[?#&]|$)' _TESTS = [{ # fo.addVariable("videoCenterId","id") 'url': 'http://sports.cntv.cn/2016/02/12/ARTIaBRxv4rTT1yWf1frW2wi160212.shtml', 'md5': 'd61ec00a493e09da810bf406a078f691', 'info_dict': { 'id': '5ecdbeab623f4973b40ff25f18b174e8', 'ext': 'mp4', 'title': '[NBA]二少联手砍下46分 雷霆主场击败鹈鹕(快讯)', 'description': 'md5:7e14a5328dc5eb3d1cd6afbbe0574e95', 'duration': 98, 'uploader': 'songjunjie', 'timestamp': 1455279956, 'upload_date': '20160212', }, }, { # var guid = "id" 'url': 'http://tv.cctv.com/2016/02/05/VIDEUS7apq3lKrHG9Dncm03B160205.shtml', 'info_dict': { 'id': 'efc5d49e5b3b4ab2b34f3a502b73d3ae', 'ext': 'mp4', 'title': '[赛车]“车王”舒马赫恢复情况成谜(快讯)', 'description': '2月4日,蒙特泽莫罗透露了关于“车王”舒马赫恢复情况,但情况是否属实遭到了质疑。', 'duration': 37, 'uploader': 'shujun', 'timestamp': 1454677291, 'upload_date': '20160205', }, 'params': { 'skip_download': True, }, }, { # changePlayer('id') 'url': 'http://english.cntv.cn/special/four_comprehensives/index.shtml', 'info_dict': { 'id': '4bb9bb4db7a6471ba85fdeda5af0381e', 'ext': 'mp4', 'title': 'NHnews008 ANNUAL POLITICAL SEASON', 'description': 'Four Comprehensives', 'duration': 60, 'uploader': 'zhangyunlei', 'timestamp': 1425385521, 'upload_date': '20150303', }, 'params': { 'skip_download': True, }, }, { # loadvideo('id') 'url': 'http://cctv.cntv.cn/lm/tvseries_russian/yilugesanghua/index.shtml', 'info_dict': { 'id': 'b15f009ff45c43968b9af583fc2e04b2', 'ext': 'mp4', 'title': 'Путь,усыпанный космеями Серия 1', 'description': 'Путь, усыпанный космеями', 'duration': 2645, 'uploader': 'renxue', 'timestamp': 1477479241, 'upload_date': '20161026', }, 'params': { 'skip_download': True, }, }, { # var initMyAray = 'id' 'url': 'http://www.ncpa-classic.com/2013/05/22/VIDE1369219508996867.shtml', 'info_dict': { 'id': 'a194cfa7f18c426b823d876668325946', 'ext': 'mp4', 'title': '小泽征尔音乐塾 音乐梦想无国界', 'duration': 2173, 'timestamp': 1369248264, 'upload_date': '20130522', }, 'params': { 'skip_download': True, }, }, { # var ids = ["id"] 'url': 'http://www.ncpa-classic.com/clt/more/416/index.shtml', 'info_dict': { 'id': 'a8606119a4884588a79d81c02abecc16', 'ext': 'mp3', 'title': '来自维也纳的新年贺礼', 'description': 'md5:f13764ae8dd484e84dd4b39d5bcba2a7', 'duration': 1578, 'uploader': 'djy', 'timestamp': 1482942419, 'upload_date': '20161228', }, 'params': { 'skip_download': True, }, 'expected_warnings': ['Failed to download m3u8 information'], }, { 'url': 'http://ent.cntv.cn/2016/01/18/ARTIjprSSJH8DryTVr5Bx8Wb160118.shtml', 'only_matching': True, }, { 'url': 'http://tv.cntv.cn/video/C39296/e0210d949f113ddfb38d31f00a4e5c44', 'only_matching': True, }, { 'url': 'http://english.cntv.cn/2016/09/03/VIDEhnkB5y9AgHyIEVphCEz1160903.shtml', 'only_matching': True, }, { 'url': 'http://tv.cctv.com/2016/09/07/VIDE5C1FnlX5bUywlrjhxXOV160907.shtml', 'only_matching': True, }, { 'url': 'http://tv.cntv.cn/video/C39296/95cfac44cabd3ddc4a9438780a4e5c44', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) video_id = self._search_regex( [r'var\s+guid\s*=\s*["\']([\da-fA-F]+)', r'videoCenterId["\']\s*,\s*["\']([\da-fA-F]+)', r'changePlayer\s*\(\s*["\']([\da-fA-F]+)', r'load[Vv]ideo\s*\(\s*["\']([\da-fA-F]+)', r'var\s+initMyAray\s*=\s*["\']([\da-fA-F]+)', r'var\s+ids\s*=\s*\[["\']([\da-fA-F]+)'], webpage, 'video id') data = self._download_json( 'http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do', video_id, query={ 'pid': video_id, 'url': url, 'idl': 32, 'idlr': 32, 'modifyed': 'false', }) title = data['title'] formats = [] video = data.get('video') if isinstance(video, dict): for quality, chapters_key in enumerate(('lowChapters', 'chapters')): video_url = try_get( video, lambda x: x[chapters_key][0]['url'], compat_str) if video_url: formats.append({ 'url': video_url, 'format_id': 'http', 'quality': quality, 'preference': -1, }) hls_url = try_get(data, lambda x: x['hls_url'], compat_str) if hls_url: hls_url = re.sub(r'maxbr=\d+&?', '', hls_url) formats.extend(self._extract_m3u8_formats( hls_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) self._sort_formats(formats) uploader = data.get('editer_name') description = self._html_search_meta( 'description', webpage, default=None) timestamp = unified_timestamp(data.get('f_pgmtime')) duration = float_or_none(try_get(video, lambda x: x['totalLength'])) return { 'id': video_id, 'title': title, 'description': description, 'uploader': uploader, 'timestamp': timestamp, 'duration': duration, 'formats': formats, }
mit
[ 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, 2069, 63, 269, 63, 3592, 12, 272, 862, 63, 362, 12, 272, 25344, 63, 3954, 12, 199, 9, 421, 199, 533, 445, 1028, 54, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 11546, 107, 21482, 229, 20407, 240, 7, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 5169, 26285, 31477, 5169, 6507, 86, 92, 67, 319, 86, 31477, 5169, 957, 92, 6413, 8636, 5169, 1544, 20316, 7966, 387, 13, 25140, 4537, 957, 2447, 5169, 26285, 15, 3342, 31, 2229, 48, 28, 344, 13489, 10197, 3, 6, 2807, 17076, 5169, 15, 1080, 5547, 15840, 14, 83, 31, 1360, 17884, 31, 3, 6, 11752, 4, 3171, 272, 485, 7569, 275, 8910, 267, 327, 7090, 14, 525, 2773, 480, 3722, 13551, 1304, 2266, 344, 531, 267, 283, 633, 356, 283, 1014, 921, 3275, 83, 14, 6507, 86, 14, 6413, 15, 9261, 15, 996, 15, 713, 15, 2294, 41, 65, 7184, 25466, 20, 82, 1481, 17, 89, 55, 70, 17, 4391, 55, 18, 14249, 975, 996, 713, 14, 83, 1360, 297, 267, 283, 1064, 21, 356, 283, 68, 2976, 825, 383, 65, 25919, 69, 1643, 983, 31086, 4361, 13344, 65, 19226, 70, 28776, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 21, 825, 31987, 371, 31353, 70, 1887, 2898, 66, 2167, 556, 821, 70, 1085, 66, 9892, 69, 24, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 6730, 46, 4134, 61, 6923, 235, 15348, 240, 165, 224, 243, 10862, 234, 164, 255, 236, 24233, 2466, 21514, 10469, 250, 116, 166, 251, 229, 4344, 8698, 251, 119, 15977, 120, 12979, 99, 166, 118, 231, 166, 118, 244, 8454, 231, 16989, 105, 14082, 108, 8454, 232, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 23, 69, 1079, 65, 21, 12870, 3833, 21, 2871, 19, 68, 17, 2866, 22, 2756, 32155, 1717, 1342, 69, 2720, 297, 288, 283, 5553, 356, 16096, 12, 288, 283, 13671, 356, 283, 19351, 74, 324, 74, 1873, 297, 288, 283, 3954, 356, 4329, 1229, 1465, 1020, 1367, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 996, 713, 297, 267, 1660, 272, 1660, 469, 267, 327, 2729, 15593, 275, 298, 344, 2, 267, 283, 633, 356, 283, 1014, 921, 6993, 14, 67, 319, 86, 14, 957, 15, 9261, 15, 996, 15, 1717, 15, 5437, 37, 1668, 23, 439, 81, 19, 76, 27399, 31442, 25, 36, 78, 4400, 1644, 34, 975, 996, 1717, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 2829, 67, 21, 68, 1887, 69, 21, 66, 19, 66, 20, 371, 18, 66, 1082, 70, 19, 65, 24653, 66, 2898, 68, 19, 3624, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 6730, 14096, 250, 19182, 100, 61, 8477, 251, 19182, 100, 23434, 234, 8477, 252, 165, 231, 241, 166, 103, 106, 14096, 105, 21135, 96, 11546, 236, 32305, 17950, 114, 16888, 165, 109, 251, 8454, 231, 16989, 105, 14082, 108, 8454, 232, 297, 288, 283, 1802, 356, 283, 18, 31452, 20, 17243, 12356, 165, 241, 248, 19431, 118, 20021, 122, 165, 237, 105, 20407, 246, 14333, 238, 166, 251, 111, 30998, 8379, 112, 6923, 237, 8477, 251, 19182, 100, 23434, 234, 8477, 252, 165, 231, 241, 166, 103, 106, 14096, 105, 21135, 96, 11546, 236, 32305, 17950, 114, 12356, 11046, 229, 32305, 17950, 114, 9729, 8197, 100, 27289, 253, 10270, 253, 24744, 256, 29507, 30998, 12979, 102, 164, 245, 240, 20061, 297, 288, 283, 5553, 356, 6877, 12, 288, 283, 13671, 356, 283, 609, 17189, 324, 297, 288, 283, 3954, 356, 4329, 18163, 1138, 16319, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 996, 1717, 297, 267, 1660, 267, 283, 1162, 356, 469, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 327, 1570, 10921, 360, 344, 358, 267, 283, 633, 356, 283, 1014, 921, 17872, 14, 6507, 86, 14, 6413, 15, 6664, 15, 13672, 63, 863, 22868, 338, 2310, 15, 1080, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 20, 2501, 25, 2501, 20, 697, 23, 65, 772, 3172, 2470, 2426, 70, 770, 65, 21, 2756, 1644, 2835, 69, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 46, 40, 13224, 8662, 1261, 1440, 748, 25480, 19223, 5795, 28883, 297, 288, 283, 1802, 356, 283, 24766, 3599, 22868, 338, 2310, 297, 288, 283, 5553, 356, 5212, 12, 288, 283, 13671, 356, 283, 3951, 621, 89, 324, 274, 73, 297, 288, 283, 3954, 356, 4329, 821, 1703, 1229, 2025, 12, 288, 283, 5064, 63, 602, 356, 283, 1797, 1400, 11810, 297, 267, 1660, 267, 283, 1162, 356, 469, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 327, 2248, 3722, 360, 344, 358, 267, 283, 633, 356, 283, 1014, 921, 67, 319, 86, 14, 6507, 86, 14, 6413, 15, 14344, 15, 6993, 5602, 63, 82, 8630, 15, 89, 382, 85, 3389, 621, 27002, 15, 1080, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 66, 1046, 70, 8581, 556, 2322, 67, 28429, 2333, 66, 25, 2756, 16793, 3003, 18, 69, 966, 66, 18, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 141, 254, 12195, 7413, 16961, 12356, 12195, 8474, 17445, 23645, 21674, 7592, 17445, 141, 118, 31999, 5806, 8474, 23000, 6286, 14978, 23000, 6500, 7038, 95, 21273, 6500, 14978, 413, 297, 288, 283, 1802, 356, 283, 141, 254, 12195, 7413, 16961, 12, 221, 12195, 8474, 17445, 23645, 21674, 7592, 17445, 141, 118, 31999, 5806, 8474, 23000, 6286, 14978, 23000, 6500, 297, 288, 283, 5553, 356, 499, 13067, 12, 288, 283, 13671, 356, 283, 828, 88, 310, 297, 288, 283, 3954, 356, 4329, 1138, 14847, 13571, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 32351, 297, 267, 1660, 267 ]
[ 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, 2069, 63, 269, 63, 3592, 12, 272, 862, 63, 362, 12, 272, 25344, 63, 3954, 12, 199, 9, 421, 199, 533, 445, 1028, 54, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 11546, 107, 21482, 229, 20407, 240, 7, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 5169, 26285, 31477, 5169, 6507, 86, 92, 67, 319, 86, 31477, 5169, 957, 92, 6413, 8636, 5169, 1544, 20316, 7966, 387, 13, 25140, 4537, 957, 2447, 5169, 26285, 15, 3342, 31, 2229, 48, 28, 344, 13489, 10197, 3, 6, 2807, 17076, 5169, 15, 1080, 5547, 15840, 14, 83, 31, 1360, 17884, 31, 3, 6, 11752, 4, 3171, 272, 485, 7569, 275, 8910, 267, 327, 7090, 14, 525, 2773, 480, 3722, 13551, 1304, 2266, 344, 531, 267, 283, 633, 356, 283, 1014, 921, 3275, 83, 14, 6507, 86, 14, 6413, 15, 9261, 15, 996, 15, 713, 15, 2294, 41, 65, 7184, 25466, 20, 82, 1481, 17, 89, 55, 70, 17, 4391, 55, 18, 14249, 975, 996, 713, 14, 83, 1360, 297, 267, 283, 1064, 21, 356, 283, 68, 2976, 825, 383, 65, 25919, 69, 1643, 983, 31086, 4361, 13344, 65, 19226, 70, 28776, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 21, 825, 31987, 371, 31353, 70, 1887, 2898, 66, 2167, 556, 821, 70, 1085, 66, 9892, 69, 24, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 6730, 46, 4134, 61, 6923, 235, 15348, 240, 165, 224, 243, 10862, 234, 164, 255, 236, 24233, 2466, 21514, 10469, 250, 116, 166, 251, 229, 4344, 8698, 251, 119, 15977, 120, 12979, 99, 166, 118, 231, 166, 118, 244, 8454, 231, 16989, 105, 14082, 108, 8454, 232, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 23, 69, 1079, 65, 21, 12870, 3833, 21, 2871, 19, 68, 17, 2866, 22, 2756, 32155, 1717, 1342, 69, 2720, 297, 288, 283, 5553, 356, 16096, 12, 288, 283, 13671, 356, 283, 19351, 74, 324, 74, 1873, 297, 288, 283, 3954, 356, 4329, 1229, 1465, 1020, 1367, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 996, 713, 297, 267, 1660, 272, 1660, 469, 267, 327, 2729, 15593, 275, 298, 344, 2, 267, 283, 633, 356, 283, 1014, 921, 6993, 14, 67, 319, 86, 14, 957, 15, 9261, 15, 996, 15, 1717, 15, 5437, 37, 1668, 23, 439, 81, 19, 76, 27399, 31442, 25, 36, 78, 4400, 1644, 34, 975, 996, 1717, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 2829, 67, 21, 68, 1887, 69, 21, 66, 19, 66, 20, 371, 18, 66, 1082, 70, 19, 65, 24653, 66, 2898, 68, 19, 3624, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 6730, 14096, 250, 19182, 100, 61, 8477, 251, 19182, 100, 23434, 234, 8477, 252, 165, 231, 241, 166, 103, 106, 14096, 105, 21135, 96, 11546, 236, 32305, 17950, 114, 16888, 165, 109, 251, 8454, 231, 16989, 105, 14082, 108, 8454, 232, 297, 288, 283, 1802, 356, 283, 18, 31452, 20, 17243, 12356, 165, 241, 248, 19431, 118, 20021, 122, 165, 237, 105, 20407, 246, 14333, 238, 166, 251, 111, 30998, 8379, 112, 6923, 237, 8477, 251, 19182, 100, 23434, 234, 8477, 252, 165, 231, 241, 166, 103, 106, 14096, 105, 21135, 96, 11546, 236, 32305, 17950, 114, 12356, 11046, 229, 32305, 17950, 114, 9729, 8197, 100, 27289, 253, 10270, 253, 24744, 256, 29507, 30998, 12979, 102, 164, 245, 240, 20061, 297, 288, 283, 5553, 356, 6877, 12, 288, 283, 13671, 356, 283, 609, 17189, 324, 297, 288, 283, 3954, 356, 4329, 18163, 1138, 16319, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 996, 1717, 297, 267, 1660, 267, 283, 1162, 356, 469, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 327, 1570, 10921, 360, 344, 358, 267, 283, 633, 356, 283, 1014, 921, 17872, 14, 6507, 86, 14, 6413, 15, 6664, 15, 13672, 63, 863, 22868, 338, 2310, 15, 1080, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 20, 2501, 25, 2501, 20, 697, 23, 65, 772, 3172, 2470, 2426, 70, 770, 65, 21, 2756, 1644, 2835, 69, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 46, 40, 13224, 8662, 1261, 1440, 748, 25480, 19223, 5795, 28883, 297, 288, 283, 1802, 356, 283, 24766, 3599, 22868, 338, 2310, 297, 288, 283, 5553, 356, 5212, 12, 288, 283, 13671, 356, 283, 3951, 621, 89, 324, 274, 73, 297, 288, 283, 3954, 356, 4329, 821, 1703, 1229, 2025, 12, 288, 283, 5064, 63, 602, 356, 283, 1797, 1400, 11810, 297, 267, 1660, 267, 283, 1162, 356, 469, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 327, 2248, 3722, 360, 344, 358, 267, 283, 633, 356, 283, 1014, 921, 67, 319, 86, 14, 6507, 86, 14, 6413, 15, 14344, 15, 6993, 5602, 63, 82, 8630, 15, 89, 382, 85, 3389, 621, 27002, 15, 1080, 14, 83, 1360, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 66, 1046, 70, 8581, 556, 2322, 67, 28429, 2333, 66, 25, 2756, 16793, 3003, 18, 69, 966, 66, 18, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 141, 254, 12195, 7413, 16961, 12356, 12195, 8474, 17445, 23645, 21674, 7592, 17445, 141, 118, 31999, 5806, 8474, 23000, 6286, 14978, 23000, 6500, 7038, 95, 21273, 6500, 14978, 413, 297, 288, 283, 1802, 356, 283, 141, 254, 12195, 7413, 16961, 12, 221, 12195, 8474, 17445, 23645, 21674, 7592, 17445, 141, 118, 31999, 5806, 8474, 23000, 6286, 14978, 23000, 6500, 297, 288, 283, 5553, 356, 499, 13067, 12, 288, 283, 13671, 356, 283, 828, 88, 310, 297, 288, 283, 3954, 356, 4329, 1138, 14847, 13571, 12, 288, 283, 5064, 63, 602, 356, 283, 9261, 32351, 297, 267, 1660, 267, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1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cut.py
521
2269
from django.template.defaultfilters import cut from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class CutTests(SimpleTestCase): @setup({'cut01': '{% autoescape off %}{{ a|cut:"x" }} {{ b|cut:"x" }}{% endautoescape %}'}) def test_cut01(self): output = self.engine.render_to_string('cut01', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "&y &amp;y") @setup({'cut02': '{{ a|cut:"x" }} {{ b|cut:"x" }}'}) def test_cut02(self): output = self.engine.render_to_string('cut02', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "&amp;y &amp;y") @setup({'cut03': '{% autoescape off %}{{ a|cut:"&" }} {{ b|cut:"&" }}{% endautoescape %}'}) def test_cut03(self): output = self.engine.render_to_string('cut03', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "xy xamp;y") @setup({'cut04': '{{ a|cut:"&" }} {{ b|cut:"&" }}'}) def test_cut04(self): output = self.engine.render_to_string('cut04', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "xy xamp;y") # Passing ';' to cut can break existing HTML entities, so those strings # are auto-escaped. @setup({'cut05': '{% autoescape off %}{{ a|cut:";" }} {{ b|cut:";" }}{% endautoescape %}'}) def test_cut05(self): output = self.engine.render_to_string('cut05', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "x&y x&ampy") @setup({'cut06': '{{ a|cut:";" }} {{ b|cut:";" }}'}) def test_cut06(self): output = self.engine.render_to_string('cut06', {"a": "x&y", "b": mark_safe("x&amp;y")}) self.assertEqual(output, "x&amp;y x&amp;ampy") class FunctionTests(SimpleTestCase): def test_character(self): self.assertEqual(cut('a string to be mangled', 'a'), ' string to be mngled') def test_characters(self): self.assertEqual(cut('a string to be mangled', 'ng'), 'a stri to be maled') def test_non_matching_string(self): self.assertEqual(cut('a string to be mangled', 'strings'), 'a string to be mangled') def test_non_string_input(self): self.assertEqual(cut(123, '2'), '13')
bsd-3-clause
[ 504, 1639, 14, 1160, 14, 885, 4273, 492, 10415, 199, 504, 1639, 14, 396, 492, 24424, 199, 504, 1639, 14, 1208, 14, 28389, 492, 2216, 63, 3489, 199, 199, 504, 2508, 1208, 492, 3272, 421, 199, 533, 445, 337, 2925, 8, 17968, 304, 339, 768, 2758, 3252, 5919, 614, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 88, 2, 3586, 8448, 330, 92, 5919, 5424, 88, 2, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 614, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 614, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 11746, 89, 1253, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 996, 356, 11400, 282, 92, 5919, 5424, 88, 2, 3586, 8448, 330, 92, 5919, 5424, 88, 2, 29281, 272, 347, 511, 63, 5919, 996, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 996, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 11746, 5282, 27, 89, 1253, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 1644, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 6, 2, 3586, 8448, 330, 92, 5919, 5424, 6, 2, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 1644, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1644, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 1702, 671, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 966, 356, 11400, 282, 92, 5919, 5424, 6, 2, 3586, 8448, 330, 92, 5919, 5424, 6, 2, 29281, 272, 347, 511, 63, 5919, 966, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 966, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 1702, 671, 5282, 27, 89, 531, 339, 327, 31755, 20054, 370, 10415, 883, 2059, 3411, 4163, 9045, 12, 880, 5204, 3326, 272, 327, 787, 2599, 13, 13572, 14, 272, 768, 2758, 3252, 5919, 1717, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 9426, 3586, 8448, 330, 92, 5919, 5424, 9426, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 1717, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1717, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 88, 6, 89, 671, 6, 65, 5086, 531, 339, 768, 2758, 3252, 5919, 1690, 356, 11400, 282, 92, 5919, 5424, 9426, 3586, 8448, 330, 92, 5919, 5424, 9426, 29281, 272, 347, 511, 63, 5919, 1690, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1690, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 88, 6, 5282, 27, 89, 671, 6, 5282, 27, 65, 5086, 531, 421, 199, 533, 6801, 2925, 8, 17968, 304, 339, 347, 511, 63, 10856, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 65, 659, 283, 1059, 370, 506, 333, 2753, 1146, 358, 339, 347, 511, 63, 16516, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 2753, 659, 283, 65, 4024, 370, 506, 610, 1146, 358, 339, 347, 511, 63, 2865, 63, 9467, 63, 875, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 5465, 659, 283, 65, 1059, 370, 506, 333, 22183, 358, 339, 347, 511, 63, 2865, 63, 875, 63, 1210, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 8, 4288, 12, 283, 18, 659, 283, 969, 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 ]
[ 1639, 14, 1160, 14, 885, 4273, 492, 10415, 199, 504, 1639, 14, 396, 492, 24424, 199, 504, 1639, 14, 1208, 14, 28389, 492, 2216, 63, 3489, 199, 199, 504, 2508, 1208, 492, 3272, 421, 199, 533, 445, 337, 2925, 8, 17968, 304, 339, 768, 2758, 3252, 5919, 614, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 88, 2, 3586, 8448, 330, 92, 5919, 5424, 88, 2, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 614, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 614, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 11746, 89, 1253, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 996, 356, 11400, 282, 92, 5919, 5424, 88, 2, 3586, 8448, 330, 92, 5919, 5424, 88, 2, 29281, 272, 347, 511, 63, 5919, 996, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 996, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 11746, 5282, 27, 89, 1253, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 1644, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 6, 2, 3586, 8448, 330, 92, 5919, 5424, 6, 2, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 1644, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1644, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 1702, 671, 5282, 27, 89, 531, 339, 768, 2758, 3252, 5919, 966, 356, 11400, 282, 92, 5919, 5424, 6, 2, 3586, 8448, 330, 92, 5919, 5424, 6, 2, 29281, 272, 347, 511, 63, 5919, 966, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 966, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 1702, 671, 5282, 27, 89, 531, 339, 327, 31755, 20054, 370, 10415, 883, 2059, 3411, 4163, 9045, 12, 880, 5204, 3326, 272, 327, 787, 2599, 13, 13572, 14, 272, 768, 2758, 3252, 5919, 1717, 356, 12100, 19102, 2331, 17337, 282, 92, 5919, 5424, 9426, 3586, 8448, 330, 92, 5919, 5424, 9426, 20104, 1284, 15818, 17776, 272, 347, 511, 63, 5919, 1717, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1717, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 88, 6, 89, 671, 6, 65, 5086, 531, 339, 768, 2758, 3252, 5919, 1690, 356, 11400, 282, 92, 5919, 5424, 9426, 3586, 8448, 330, 92, 5919, 5424, 9426, 29281, 272, 347, 511, 63, 5919, 1690, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 5919, 1690, 297, 2420, 65, 582, 298, 88, 6, 89, 401, 298, 66, 582, 2216, 63, 3489, 480, 88, 6, 5282, 27, 89, 531, 1552, 267, 291, 14, 629, 8, 1199, 12, 298, 88, 6, 5282, 27, 89, 671, 6, 5282, 27, 65, 5086, 531, 421, 199, 533, 6801, 2925, 8, 17968, 304, 339, 347, 511, 63, 10856, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 65, 659, 283, 1059, 370, 506, 333, 2753, 1146, 358, 339, 347, 511, 63, 16516, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 2753, 659, 283, 65, 4024, 370, 506, 610, 1146, 358, 339, 347, 511, 63, 2865, 63, 9467, 63, 875, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 360, 65, 1059, 370, 506, 333, 22183, 297, 283, 5465, 659, 283, 65, 1059, 370, 506, 333, 22183, 358, 339, 347, 511, 63, 2865, 63, 875, 63, 1210, 8, 277, 304, 267, 291, 14, 629, 8, 5919, 8, 4288, 12, 283, 18, 659, 283, 969, 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, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
BorgERP/borg-erp-6of3
addons/hr_timesheet_invoice/report/__init__.py
9
1155
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import cost_ledger import account_analytic_profit import report_analytic import hr_timesheet_invoice_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 7918, 63, 28771, 199, 646, 2933, 63, 9782, 63, 496, 3269, 199, 646, 3622, 63, 9782, 199, 646, 16140, 63, 17739, 63, 5404, 63, 3070, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 7918, 63, 28771, 199, 646, 2933, 63, 9782, 63, 496, 3269, 199, 646, 3622, 63, 9782, 199, 646, 16140, 63, 17739, 63, 5404, 63, 3070, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
szeged/servo
tests/wpt/web-platform-tests/tools/third_party/h2/examples/fragments/client_https_setup_fragment.py
25
3887
# -*- coding: utf-8 -*- """ Client HTTPS Setup ~~~~~~~~~~~~~~~~~~ This example code fragment demonstrates how to set up a HTTP/2 client that negotiates HTTP/2 using NPN and ALPN. For the sake of maximum explanatory value this code uses the synchronous, low-level sockets API: however, if you're not using sockets directly (e.g. because you're using asyncio), you should focus on the set up required for the SSLContext object. For other concurrency libraries you may need to use other setup (e.g. for Twisted you'll need to use IProtocolNegotiationFactory). This code requires Python 3.5 or later. """ import h2.connection import socket import ssl def establish_tcp_connection(): """ This function establishes a client-side TCP connection. How it works isn't very important to this example. For the purpose of this example we connect to localhost. """ return socket.create_connection(('localhost', 443)) def get_http2_ssl_context(): """ This function creates an SSLContext object that is suitably configured for HTTP/2. If you're working with Python TLS directly, you'll want to do the exact same setup as this function does. """ # Get the basic context from the standard library. ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH) # RFC 7540 Section 9.2: Implementations of HTTP/2 MUST use TLS version 1.2 # or higher. Disable TLS 1.1 and lower. ctx.options |= ( ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 ) # RFC 7540 Section 9.2.1: A deployment of HTTP/2 over TLS 1.2 MUST disable # compression. ctx.options |= ssl.OP_NO_COMPRESSION # RFC 7540 Section 9.2.2: "deployments of HTTP/2 that use TLS 1.2 MUST # support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256". In practice, the # blacklist defined in this section allows only the AES GCM and ChaCha20 # cipher suites with ephemeral key negotiation. ctx.set_ciphers("ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20") # We want to negotiate using NPN and ALPN. ALPN is mandatory, but NPN may # be absent, so allow that. This setup allows for negotiation of HTTP/1.1. ctx.set_alpn_protocols(["h2", "http/1.1"]) try: ctx.set_npn_protocols(["h2", "http/1.1"]) except NotImplementedError: pass return ctx def negotiate_tls(tcp_conn, context): """ Given an established TCP connection and a HTTP/2-appropriate TLS context, this function: 1. wraps TLS around the TCP connection. 2. confirms that HTTP/2 was negotiated and, if it was not, throws an error. """ # Note that SNI is mandatory for HTTP/2, so you *must* pass the # server_hostname argument. tls_conn = context.wrap_socket(tcp_conn, server_hostname='localhost') # Always prefer the result from ALPN to that from NPN. # You can only check what protocol was negotiated once the handshake is # complete. negotiated_protocol = tls_conn.selected_alpn_protocol() if negotiated_protocol is None: negotiated_protocol = tls_conn.selected_npn_protocol() if negotiated_protocol != "h2": raise RuntimeError("Didn't negotiate HTTP/2!") return tls_conn def main(): # Step 1: Set up your TLS context. context = get_http2_ssl_context() # Step 2: Create a TCP connection. connection = establish_tcp_connection() # Step 3: Wrap the connection in TLS and validate that we negotiated HTTP/2 tls_connection = negotiate_tls(connection, context) # Step 4: Create a client-side H2 connection. http2_connection = h2.connection.H2Connection() # Step 5: Initiate the connection http2_connection.initiate_connection() tls_connection.sendall(http2_connection.data_to_send()) # The TCP, TLS, and HTTP/2 handshakes are now complete. You can enter your # main loop now.
mpl-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 3041, 14147, 12439, 199, 9753, 1714, 199, 199, 2765, 2893, 1233, 7956, 23789, 31216, 4212, 370, 663, 1536, 282, 3101, 15, 18, 1890, 626, 199, 21961, 2335, 3101, 15, 18, 1808, 653, 9060, 436, 12112, 9060, 14, 2104, 314, 308, 1728, 402, 5696, 444, 5140, 8658, 574, 199, 3749, 1233, 4440, 314, 24248, 12, 6465, 13, 1896, 18772, 3261, 26, 13432, 12, 340, 1265, 3984, 440, 199, 4941, 18772, 5370, 334, 69, 14, 71, 14, 2952, 1265, 3984, 1808, 16195, 395, 1265, 1077, 16470, 641, 199, 1589, 663, 1536, 1415, 367, 314, 7799, 2998, 909, 14, 2104, 1163, 406, 4968, 8363, 199, 13297, 1443, 1929, 370, 675, 1163, 3272, 334, 69, 14, 71, 14, 367, 17078, 1265, 7171, 1929, 370, 675, 199, 41, 3658, 4698, 14727, 425, 2927, 680, 199, 199, 2765, 1233, 5074, 2018, 650, 14, 21, 503, 2945, 14, 199, 624, 199, 646, 394, 18, 14, 2105, 199, 646, 2838, 199, 646, 6149, 421, 199, 318, 16873, 63, 8815, 63, 2105, 837, 272, 408, 272, 961, 805, 16873, 397, 282, 1890, 13, 2441, 13488, 1950, 14, 7494, 652, 5419, 5712, 1133, 272, 7437, 11012, 370, 642, 2893, 14, 2104, 314, 12016, 402, 642, 2893, 781, 4907, 272, 370, 11667, 14, 272, 408, 272, 372, 2838, 14, 981, 63, 2105, 4725, 5967, 297, 23865, 430, 421, 199, 318, 664, 63, 1014, 18, 63, 4266, 63, 1100, 837, 272, 408, 272, 961, 805, 8491, 376, 7799, 2998, 909, 626, 365, 308, 4993, 6665, 7526, 367, 272, 3101, 15, 18, 14, 982, 1265, 3984, 6449, 543, 2018, 12213, 5370, 12, 1265, 7171, 2934, 370, 886, 314, 272, 5835, 2011, 3272, 465, 642, 805, 1630, 14, 272, 408, 272, 327, 2372, 314, 5678, 1067, 687, 314, 4465, 3555, 14, 272, 4027, 275, 6149, 14, 981, 63, 885, 63, 1100, 8, 22615, 29, 4266, 14, 14959, 4070, 14, 6613, 63, 5580, 9, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 26, 22467, 1298, 402, 3101, 15, 18, 18095, 675, 12213, 1015, 413, 14, 18, 272, 327, 503, 10948, 14, 17534, 12213, 413, 14, 17, 436, 5117, 14, 272, 4027, 14, 1419, 8901, 334, 267, 6149, 14, 1938, 63, 2826, 63, 21082, 18, 1204, 6149, 14, 1938, 63, 2826, 63, 21082, 19, 1204, 6149, 14, 1938, 63, 2826, 63, 10224, 86, 17, 1204, 6149, 14, 1938, 63, 2826, 63, 10224, 86, 17, 63, 17, 272, 776, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 14, 17, 26, 437, 14295, 402, 3101, 15, 18, 1806, 12213, 413, 14, 18, 18095, 3507, 272, 327, 10291, 14, 272, 4027, 14, 1419, 8901, 6149, 14, 1938, 63, 2826, 63, 30193, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 14, 18, 26, 298, 11060, 1470, 402, 3101, 15, 18, 626, 675, 12213, 413, 14, 18, 18095, 272, 327, 2291, 12213, 63, 4220, 23520, 63, 12115, 63, 9139, 63, 14494, 63, 3933, 63, 29009, 63, 8461, 3912, 1674, 1010, 24471, 12, 314, 272, 327, 23180, 3247, 315, 642, 3420, 6127, 1454, 314, 19093, 598, 9249, 436, 445, 2411, 1049, 65, 1165, 272, 327, 10830, 24203, 543, 26288, 790, 29184, 425, 14, 272, 4027, 14, 409, 63, 27426, 480, 4220, 23520, 11, 14494, 29009, 26, 4220, 23520, 11, 26363, 26363, 1165, 26, 23520, 11, 14494, 29009, 26, 23520, 11, 26363, 26363, 1165, 531, 339, 327, 2136, 2934, 370, 29184, 323, 1808, 653, 9060, 436, 12112, 9060, 14, 12112, 9060, 365, 15230, 12, 1325, 653, 9060, 1443, 272, 327, 506, 9552, 12, 880, 2040, 626, 14, 961, 3272, 6127, 367, 29184, 425, 402, 3101, 15, 17, 14, 17, 14, 272, 4027, 14, 409, 63, 279, 4812, 63, 16541, 5234, 72, 18, 401, 298, 1014, 15, 17, 14, 17, 3135, 339, 862, 26, 267, 4027, 14, 409, 63, 1590, 78, 63, 16541, 5234, 72, 18, 401, 298, 1014, 15, 17, 14, 17, 3135, 272, 871, 4279, 26, 267, 986, 339, 372, 4027, 421, 199, 318, 29184, 323, 63, 9945, 8, 8815, 63, 1631, 12, 1067, 304, 272, 408, 272, 9138, 376, 23594, 13488, 1950, 436, 282, 3101, 15, 18, 13, 11227, 5655, 12213, 1067, 12, 272, 642, 805, 26, 339, 413, 14, 14018, 12213, 6818, 314, 13488, 1950, 14, 272, 499, 14, 406, 1795, 706, 626, 3101, 15, 18, 1990, 29184, 972, 436, 12, 340, 652, 1990, 440, 12, 24266, 376, 1125, 14, 272, 408, 272, 327, 3390, 626, 428, 16730, 365, 15230, 367, 3101, 15, 18, 12, 880, 1265, 627, 7790, 10, 986, 314, 272, 327, 1654, 63, 4269, 1423, 14, 272, 15142, 63, 1631, 275, 1067, 14, 3823, 63, 3450, 8, 8815, 63, 1631, 12, 1654, 63, 4269, 534, 5967, 358, 339, 327, 16763, 16602, 314, 754, 687, 12112, 9060, 370, 626, 687, 653, 9060, 14, 272, 327, 2047, 883, 1454, 1104, 4052, 4113, 1990, 29184, 972, 5403, 314, 14305, 365, 272, 327, 10619, 4883, 14, 272, 29184, 972, 63, 3922, 275, 15142, 63, 1631, 14, 5511, 63, 279, 4812, 63, 3922, 342, 272, 340, 29184, 972, 63, 3922, 365, 488, 26, 267, 29184, 972, 63, 3922, 275, 15142, 63, 1631, 14, 5511, 63, 1590, 78, 63, 3922, 342, 339, 340, 29184, 972, 63, 3922, 1137, 298, 72, 18, 582, 267, 746, 6064, 480, 17366, 78, 1133, 29184, 323, 3101, 15, 18, 9124, 339, 372, 15142, 63, 1631, 421, 199, 318, 2446, 837, 272, 327, 13382, 413, 26, 2494, 1536, 2195, 12213, 1067, 14, 272, 1067, 275, 664, 63, 1014, 18, 63, 4266, 63, 1100, 342, 339, 327, 13382, 499, 26, 2790, 282, 13488, 1950, 14, 272, 1950, 275, 16873, 63, 8815, 63, 2105, 342, 339, 327, 13382, 650, 26, 20322, 314, 1950, 315, 12213, 436, 4107, 626, 781, 29184, 972, 3101, 15, 18, 272, 15142, 63, 2105, 275, 29184, 323, 63, 9945, 8, 2105, 12, 1067, 9, 339, 327, 13382, 841, 26, 2790, 282, 1890, 13, 2441, 869, 18, 1950, 14, 272, 1455, 18, 63, 2105, 275, 394, 18, 14, 2105, 14, 40, 18, 3225, 342, 339, 327, 13382, 959, 26, 21412, 323, 314, 1950, 272, 1455, 18, 63, 2105, 14, 14188, 323, 63, 2105, 342, 272, 15142, 63, 2105, 14, 22695, 8, 1014, 18, 63, 2105, 14, 576, 63 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 3041, 14147, 12439, 199, 9753, 1714, 199, 199, 2765, 2893, 1233, 7956, 23789, 31216, 4212, 370, 663, 1536, 282, 3101, 15, 18, 1890, 626, 199, 21961, 2335, 3101, 15, 18, 1808, 653, 9060, 436, 12112, 9060, 14, 2104, 314, 308, 1728, 402, 5696, 444, 5140, 8658, 574, 199, 3749, 1233, 4440, 314, 24248, 12, 6465, 13, 1896, 18772, 3261, 26, 13432, 12, 340, 1265, 3984, 440, 199, 4941, 18772, 5370, 334, 69, 14, 71, 14, 2952, 1265, 3984, 1808, 16195, 395, 1265, 1077, 16470, 641, 199, 1589, 663, 1536, 1415, 367, 314, 7799, 2998, 909, 14, 2104, 1163, 406, 4968, 8363, 199, 13297, 1443, 1929, 370, 675, 1163, 3272, 334, 69, 14, 71, 14, 367, 17078, 1265, 7171, 1929, 370, 675, 199, 41, 3658, 4698, 14727, 425, 2927, 680, 199, 199, 2765, 1233, 5074, 2018, 650, 14, 21, 503, 2945, 14, 199, 624, 199, 646, 394, 18, 14, 2105, 199, 646, 2838, 199, 646, 6149, 421, 199, 318, 16873, 63, 8815, 63, 2105, 837, 272, 408, 272, 961, 805, 16873, 397, 282, 1890, 13, 2441, 13488, 1950, 14, 7494, 652, 5419, 5712, 1133, 272, 7437, 11012, 370, 642, 2893, 14, 2104, 314, 12016, 402, 642, 2893, 781, 4907, 272, 370, 11667, 14, 272, 408, 272, 372, 2838, 14, 981, 63, 2105, 4725, 5967, 297, 23865, 430, 421, 199, 318, 664, 63, 1014, 18, 63, 4266, 63, 1100, 837, 272, 408, 272, 961, 805, 8491, 376, 7799, 2998, 909, 626, 365, 308, 4993, 6665, 7526, 367, 272, 3101, 15, 18, 14, 982, 1265, 3984, 6449, 543, 2018, 12213, 5370, 12, 1265, 7171, 2934, 370, 886, 314, 272, 5835, 2011, 3272, 465, 642, 805, 1630, 14, 272, 408, 272, 327, 2372, 314, 5678, 1067, 687, 314, 4465, 3555, 14, 272, 4027, 275, 6149, 14, 981, 63, 885, 63, 1100, 8, 22615, 29, 4266, 14, 14959, 4070, 14, 6613, 63, 5580, 9, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 26, 22467, 1298, 402, 3101, 15, 18, 18095, 675, 12213, 1015, 413, 14, 18, 272, 327, 503, 10948, 14, 17534, 12213, 413, 14, 17, 436, 5117, 14, 272, 4027, 14, 1419, 8901, 334, 267, 6149, 14, 1938, 63, 2826, 63, 21082, 18, 1204, 6149, 14, 1938, 63, 2826, 63, 21082, 19, 1204, 6149, 14, 1938, 63, 2826, 63, 10224, 86, 17, 1204, 6149, 14, 1938, 63, 2826, 63, 10224, 86, 17, 63, 17, 272, 776, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 14, 17, 26, 437, 14295, 402, 3101, 15, 18, 1806, 12213, 413, 14, 18, 18095, 3507, 272, 327, 10291, 14, 272, 4027, 14, 1419, 8901, 6149, 14, 1938, 63, 2826, 63, 30193, 339, 327, 7329, 1520, 17814, 15247, 1749, 14, 18, 14, 18, 26, 298, 11060, 1470, 402, 3101, 15, 18, 626, 675, 12213, 413, 14, 18, 18095, 272, 327, 2291, 12213, 63, 4220, 23520, 63, 12115, 63, 9139, 63, 14494, 63, 3933, 63, 29009, 63, 8461, 3912, 1674, 1010, 24471, 12, 314, 272, 327, 23180, 3247, 315, 642, 3420, 6127, 1454, 314, 19093, 598, 9249, 436, 445, 2411, 1049, 65, 1165, 272, 327, 10830, 24203, 543, 26288, 790, 29184, 425, 14, 272, 4027, 14, 409, 63, 27426, 480, 4220, 23520, 11, 14494, 29009, 26, 4220, 23520, 11, 26363, 26363, 1165, 26, 23520, 11, 14494, 29009, 26, 23520, 11, 26363, 26363, 1165, 531, 339, 327, 2136, 2934, 370, 29184, 323, 1808, 653, 9060, 436, 12112, 9060, 14, 12112, 9060, 365, 15230, 12, 1325, 653, 9060, 1443, 272, 327, 506, 9552, 12, 880, 2040, 626, 14, 961, 3272, 6127, 367, 29184, 425, 402, 3101, 15, 17, 14, 17, 14, 272, 4027, 14, 409, 63, 279, 4812, 63, 16541, 5234, 72, 18, 401, 298, 1014, 15, 17, 14, 17, 3135, 339, 862, 26, 267, 4027, 14, 409, 63, 1590, 78, 63, 16541, 5234, 72, 18, 401, 298, 1014, 15, 17, 14, 17, 3135, 272, 871, 4279, 26, 267, 986, 339, 372, 4027, 421, 199, 318, 29184, 323, 63, 9945, 8, 8815, 63, 1631, 12, 1067, 304, 272, 408, 272, 9138, 376, 23594, 13488, 1950, 436, 282, 3101, 15, 18, 13, 11227, 5655, 12213, 1067, 12, 272, 642, 805, 26, 339, 413, 14, 14018, 12213, 6818, 314, 13488, 1950, 14, 272, 499, 14, 406, 1795, 706, 626, 3101, 15, 18, 1990, 29184, 972, 436, 12, 340, 652, 1990, 440, 12, 24266, 376, 1125, 14, 272, 408, 272, 327, 3390, 626, 428, 16730, 365, 15230, 367, 3101, 15, 18, 12, 880, 1265, 627, 7790, 10, 986, 314, 272, 327, 1654, 63, 4269, 1423, 14, 272, 15142, 63, 1631, 275, 1067, 14, 3823, 63, 3450, 8, 8815, 63, 1631, 12, 1654, 63, 4269, 534, 5967, 358, 339, 327, 16763, 16602, 314, 754, 687, 12112, 9060, 370, 626, 687, 653, 9060, 14, 272, 327, 2047, 883, 1454, 1104, 4052, 4113, 1990, 29184, 972, 5403, 314, 14305, 365, 272, 327, 10619, 4883, 14, 272, 29184, 972, 63, 3922, 275, 15142, 63, 1631, 14, 5511, 63, 279, 4812, 63, 3922, 342, 272, 340, 29184, 972, 63, 3922, 365, 488, 26, 267, 29184, 972, 63, 3922, 275, 15142, 63, 1631, 14, 5511, 63, 1590, 78, 63, 3922, 342, 339, 340, 29184, 972, 63, 3922, 1137, 298, 72, 18, 582, 267, 746, 6064, 480, 17366, 78, 1133, 29184, 323, 3101, 15, 18, 9124, 339, 372, 15142, 63, 1631, 421, 199, 318, 2446, 837, 272, 327, 13382, 413, 26, 2494, 1536, 2195, 12213, 1067, 14, 272, 1067, 275, 664, 63, 1014, 18, 63, 4266, 63, 1100, 342, 339, 327, 13382, 499, 26, 2790, 282, 13488, 1950, 14, 272, 1950, 275, 16873, 63, 8815, 63, 2105, 342, 339, 327, 13382, 650, 26, 20322, 314, 1950, 315, 12213, 436, 4107, 626, 781, 29184, 972, 3101, 15, 18, 272, 15142, 63, 2105, 275, 29184, 323, 63, 9945, 8, 2105, 12, 1067, 9, 339, 327, 13382, 841, 26, 2790, 282, 1890, 13, 2441, 869, 18, 1950, 14, 272, 1455, 18, 63, 2105, 275, 394, 18, 14, 2105, 14, 40, 18, 3225, 342, 339, 327, 13382, 959, 26, 21412, 323, 314, 1950, 272, 1455, 18, 63, 2105, 14, 14188, 323, 63, 2105, 342, 272, 15142, 63, 2105, 14, 22695, 8, 1014, 18, 63, 2105, 14, 576, 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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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 ]
F5Networks/f5-common-python
devtools/code_generator.py
1
1330
from __future__ import absolute_import # Copyright 2016 F5 Networks 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. # from f5.devtools.source_engine import SourceEngine from f5.devtools.template_engine import TemplateEngine import os UTILSDIR = os.path.abspath(os.path.dirname(__file__)) COMMONPREFIX = os.path.dirname(UTILSDIR) SOURCE_ROOTDIR = os.path.join(COMMONPREFIX, 'f5', 'bigip') TEMPLATEDIR = os.path.join(UTILSDIR, 'template_library') DEVICECONFDIR = os.path.join(UTILSDIR, 'device_configs') def main(): temp_eng = TemplateEngine(TEMPLATEDIR, DEVICECONFDIR) for fname in os.listdir(DEVICECONFDIR): from_templ_src, uri = temp_eng.process_config_from_fname(fname) src_eng = SourceEngine(SOURCE_ROOTDIR, from_templ_src, uri) src_eng.integrate() if __name__ == '__main__': main()
apache-2.0
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 3, 1898, 7800, 481, 21, 17138, 3277, 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, 259, 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, 504, 289, 21, 14, 32355, 14, 1365, 63, 3908, 492, 5800, 8524, 199, 504, 289, 21, 14, 32355, 14, 1160, 63, 3908, 492, 5458, 8524, 199, 199, 646, 747, 199, 199, 29076, 51, 3022, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 21637, 6351, 275, 747, 14, 515, 14, 3475, 8, 29076, 51, 3022, 9, 199, 10187, 63, 5441, 3022, 275, 747, 14, 515, 14, 904, 8, 21637, 6351, 12, 283, 70, 21, 297, 283, 17833, 358, 199, 24136, 6989, 3927, 275, 747, 14, 515, 14, 904, 8, 29076, 51, 3022, 12, 283, 1160, 63, 4342, 358, 199, 10555, 3103, 3022, 275, 747, 14, 515, 14, 904, 8, 29076, 51, 3022, 12, 283, 1782, 63, 7532, 358, 421, 199, 318, 2446, 837, 272, 2388, 63, 7420, 275, 5458, 8524, 8, 24136, 6989, 3927, 12, 11643, 3103, 3022, 9, 272, 367, 6748, 315, 747, 14, 7374, 8, 10555, 3103, 3022, 304, 267, 687, 63, 808, 76, 63, 2164, 12, 5108, 275, 2388, 63, 7420, 14, 1412, 63, 888, 63, 504, 63, 5252, 8, 5252, 9, 267, 2928, 63, 7420, 275, 5800, 8524, 8, 10187, 63, 5441, 3022, 12, 687, 63, 808, 76, 63, 2164, 12, 5108, 9, 267, 2928, 63, 7420, 14, 26248, 342, 199, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 3679, 63, 646, 199, 3, 1898, 7800, 481, 21, 17138, 3277, 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, 259, 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, 504, 289, 21, 14, 32355, 14, 1365, 63, 3908, 492, 5800, 8524, 199, 504, 289, 21, 14, 32355, 14, 1160, 63, 3908, 492, 5458, 8524, 199, 199, 646, 747, 199, 199, 29076, 51, 3022, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 21637, 6351, 275, 747, 14, 515, 14, 3475, 8, 29076, 51, 3022, 9, 199, 10187, 63, 5441, 3022, 275, 747, 14, 515, 14, 904, 8, 21637, 6351, 12, 283, 70, 21, 297, 283, 17833, 358, 199, 24136, 6989, 3927, 275, 747, 14, 515, 14, 904, 8, 29076, 51, 3022, 12, 283, 1160, 63, 4342, 358, 199, 10555, 3103, 3022, 275, 747, 14, 515, 14, 904, 8, 29076, 51, 3022, 12, 283, 1782, 63, 7532, 358, 421, 199, 318, 2446, 837, 272, 2388, 63, 7420, 275, 5458, 8524, 8, 24136, 6989, 3927, 12, 11643, 3103, 3022, 9, 272, 367, 6748, 315, 747, 14, 7374, 8, 10555, 3103, 3022, 304, 267, 687, 63, 808, 76, 63, 2164, 12, 5108, 275, 2388, 63, 7420, 14, 1412, 63, 888, 63, 504, 63, 5252, 8, 5252, 9, 267, 2928, 63, 7420, 275, 5800, 8524, 8, 10187, 63, 5441, 3022, 12, 687, 63, 808, 76, 63, 2164, 12, 5108, 9, 267, 2928, 63, 7420, 14, 26248, 342, 199, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
ImmobilienScout24/aws-stager
src/main/python/aws_stager/__init__.py
1
1802
# The MIT License (MIT) # # Copyright (c) 2014 ImmobilienScout GmbH # # 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. from __future__ import absolute_import from boto.ec2 import connect_to_region from aws_stager.candidates import CandidateChooser, CANDIDATE_MARK_KEY def fetch_candidate(region, candidate_tag_name): connection = connect_to_region(region) candidates = connection.get_all_tags(filters={ "resource-type": "image", "key": CANDIDATE_MARK_KEY, "value": candidate_tag_name }) candidate_chooser = CandidateChooser(candidates, candidate_tag_name) candidate_chooser.choose_candidate()
mit
[ 3, 221, 710, 10697, 844, 334, 13965, 9, 199, 3, 199, 3, 221, 1898, 334, 67, 9, 6927, 473, 77, 573, 66, 1638, 287, 51, 31009, 23428, 199, 3, 199, 3, 221, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 3, 221, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 3, 221, 315, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 3, 221, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 221, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 3, 221, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 221, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 199, 3, 221, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 221, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 221, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 199, 3, 221, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 199, 3, 221, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 199, 3, 221, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 221, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 199, 3, 221, 2334, 4141, 14, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 504, 6055, 14, 825, 18, 492, 4907, 63, 475, 63, 4551, 199, 199, 504, 11488, 63, 270, 1456, 14, 16389, 492, 6855, 5168, 17693, 12, 445, 3649, 998, 1951, 63, 10520, 63, 3078, 421, 199, 318, 5267, 63, 9007, 8, 4551, 12, 7627, 63, 1450, 63, 354, 304, 272, 1950, 275, 4907, 63, 475, 63, 4551, 8, 4551, 9, 272, 15101, 275, 1950, 14, 362, 63, 452, 63, 2969, 8, 4273, 3126, 1460, 298, 1927, 13, 466, 582, 298, 1569, 401, 1460, 298, 498, 582, 445, 3649, 998, 1951, 63, 10520, 63, 3078, 12, 1460, 298, 585, 582, 7627, 63, 1450, 63, 354, 1460, 3828, 339, 7627, 63, 31123, 275, 6855, 5168, 17693, 8, 16389, 12, 7627, 63, 1450, 63, 354, 9, 339, 7627, 63, 31123, 14, 16143, 63, 9007, 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 ]
[ 221, 710, 10697, 844, 334, 13965, 9, 199, 3, 199, 3, 221, 1898, 334, 67, 9, 6927, 473, 77, 573, 66, 1638, 287, 51, 31009, 23428, 199, 3, 199, 3, 221, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 3, 221, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 3, 221, 315, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 3, 221, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 221, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 3, 221, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 221, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 199, 3, 221, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 221, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 221, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 199, 3, 221, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 199, 3, 221, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 199, 3, 221, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 221, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 199, 3, 221, 2334, 4141, 14, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 504, 6055, 14, 825, 18, 492, 4907, 63, 475, 63, 4551, 199, 199, 504, 11488, 63, 270, 1456, 14, 16389, 492, 6855, 5168, 17693, 12, 445, 3649, 998, 1951, 63, 10520, 63, 3078, 421, 199, 318, 5267, 63, 9007, 8, 4551, 12, 7627, 63, 1450, 63, 354, 304, 272, 1950, 275, 4907, 63, 475, 63, 4551, 8, 4551, 9, 272, 15101, 275, 1950, 14, 362, 63, 452, 63, 2969, 8, 4273, 3126, 1460, 298, 1927, 13, 466, 582, 298, 1569, 401, 1460, 298, 498, 582, 445, 3649, 998, 1951, 63, 10520, 63, 3078, 12, 1460, 298, 585, 582, 7627, 63, 1450, 63, 354, 1460, 3828, 339, 7627, 63, 31123, 275, 6855, 5168, 17693, 8, 16389, 12, 7627, 63, 1450, 63, 354, 9, 339, 7627, 63, 31123, 14, 16143, 63, 9007, 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,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 0, 0, 0, 0, 0, 0, 0, 0 ]
PeterDaveHello/eden
modules/templates/MCOP/config.py
7
79279
# -*- coding: utf-8 -*- try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from datetime import timedelta from gluon import current from gluon.html import * from gluon.storage import Storage from s3 import s3_avatar_represent def config(settings): """ Template for Washington Common Operating Picture (WA-COP) http://psmcop.org """ T = current.T s3 = current.response.s3 # ----------------------------------------------------------------------------- # Pre-Populate settings.base.prepopulate = ("MCOP", "default/users") settings.base.system_name = T("Sahana: Washington Common Operating Picture (WA-COP)") settings.base.system_name_short = T("Sahana") # ============================================================================= # System Settings # ----------------------------------------------------------------------------- # Authorization Settings # Users can self-register #settings.security.self_registration = False # Users need to verify their email settings.auth.registration_requires_verification = True # Users need to be approved settings.auth.registration_requires_approval = True settings.auth.registration_requests_organisation = True settings.auth.registration_organisation_required = True # Approval emails get sent to all admins settings.mail.approver = "ADMIN" settings.auth.registration_link_user_to = {"staff": T("Staff")} settings.auth.registration_link_user_to_default = ["staff"] settings.auth.registration_roles = {"organisation_id": ["USER"], } settings.auth.show_utc_offset = False settings.auth.show_link = False # ----------------------------------------------------------------------------- # Security Policy settings.security.policy = 7 # Apply Controller, Function and Table ACLs settings.security.map = True # ----------------------------------------------------------------------------- # Theme (folder to use for views/layout.html) settings.base.theme = "MCOP" settings.ui.formstyle_row = "bootstrap" settings.ui.formstyle = "bootstrap" settings.ui.filter_formstyle = "bootstrap" settings.ui.hide_report_options = False # Uncomment to use S3MultiSelectWidget on all dropdowns (currently the Auth Registration page & LocationSelectorWidget2 listen to this) settings.ui.multiselect_widget = "search" # @ToDo: Investigate settings.ui.use_button_icons = True # Custom icon classes settings.ui.custom_icons = { "alert": "icon-alert", "building": "icon-building", "contact": "icon-contact", "incident": "icon-incident", "resource": "icon-wrench", "tasks": "icon-tasks", } # Uncomment to show a default cancel button in standalone create/update forms settings.ui.default_cancel_button = True # Uncomment to disable responsive behavior of datatables # - Disabled until tested settings.ui.datatables_responsive = False #settings.gis.map_height = 600 #settings.gis.map_width = 854 # ----------------------------------------------------------------------------- # L10n (Localization) settings settings.L10n.languages = OrderedDict([ ("en", "English"), ]) # Default Language settings.L10n.default_language = "en" # Default timezone for users settings.L10n.utc_offset = "-0800" # Unsortable 'pretty' date format settings.L10n.date_format = "%b %d %Y" # Number formats (defaults to ISO 31-0) # Decimal separator for numbers (defaults to ,) settings.L10n.decimal_separator = "." # Thousands separator for numbers (defaults to space) settings.L10n.thousands_separator = "," # Default Country Code for telephone numbers settings.L10n.default_country_code = 1 # Enable this to change the label for 'Mobile Phone' settings.ui.label_mobile_phone = "Cell Phone" # Enable this to change the label for 'Postcode' settings.ui.label_postcode = "ZIP Code" settings.msg.require_international_phone_numbers = False # PDF to Letter settings.base.paper_size = T("Letter") # Uncomment this to Translate CMS Series Names # - we want this on when running s3translate but off in normal usage as we use the English names to lookup icons in render_posts #settings.L10n.translate_cms_series = True # Uncomment this to Translate Location Names #settings.L10n.translate_gis_location = True # ----------------------------------------------------------------------------- # GIS settings # Restrict the Location Selector to just certain countries settings.gis.countries = ("US",) # Levels for the LocationSelector levels = ("L1", "L2", "L3") # Uncomment to pass Addresses imported from CSV to a Geocoder to try and automate Lat/Lon #settings.gis.geocode_imported_addresses = "google" # Until we add support to S3LocationSelector to set dropdowns from LatLons settings.gis.check_within_parent_boundaries = False # GeoNames username settings.gis.geonames_username = "mcop" # Uncomment to hide Layer Properties tool #settings.gis.layer_properties = False # Uncomment to display the Map Legend as a floating DIV settings.gis.legend = "float" # Uncomment to prevent showing LatLon in Location Represents settings.gis.location_represent_address_only = "icon" # Resources which can be directly added to the main map settings.gis.poi_create_resources = None # ----------------------------------------------------------------------------- # Module settings # Uncomment to customise the list of options for the Priority of a Task. # NB Be very cautious about doing this (see docstring in modules/s3cfg.py) # MCOP sets these to match Wrike settings.project.task_priority_opts = {2: T("High"), 3: T("Normal"), 4: T("Low") } # Uncomment to customise the list of options for the Status of a Task. # NB Be very cautious about doing this (see docstring in modules/s3cfg.py) # MCOP sets these to match Wrike settings.project.task_status_opts = {2: T("Active"), 6: T("Deferred"), 7: T("Canceled"), 12: T("Completed"), } # ----------------------------------------------------------------------------- # Enable this for a UN-style deployment #settings.ui.cluster = True # Enable this to use the label 'Camp' instead of 'Shelter' #settings.ui.camp = True # ----------------------------------------------------------------------------- # Uncomment to restrict the export formats available #settings.ui.export_formats = ("xls",) settings.ui.update_label = "Edit" # ----------------------------------------------------------------------------- # Mariner CommandBridge resource identifiers settings.sync.mcb_resource_identifiers = {"event_incident": "802017D4-08D1-40EA-A03D-4FCFC26883A4", "project_task": "06831BE6-7B49-47F0-80CD-5FB27DEEC330", "cms_post": "A6E68F53-72B8-415A-A50F-BB26D363CD30", } # Mariner CommandBridge domain identifiers settings.sync.mcb_domain_identifiers = {"sahana": "9197B3DC-07DD-4922-96CA-9B6D8A1FC2D2", "wrike": "69A069D9-23E8-422D-BB18-2A3A92FE291C", } # ----------------------------------------------------------------------------- # Disable rheaders def customise_no_rheader_controller(**attr): # Remove rheader attr["rheader"] = None return attr settings.customise_org_facility_controller = customise_no_rheader_controller settings.customise_org_organisation_controller = customise_no_rheader_controller settings.customise_org_resource_controller = customise_no_rheader_controller # ----------------------------------------------------------------------------- # Summary Pages settings.ui.summary = [#{"common": True, # "name": "cms", # "widgets": [{"method": "cms"}] # }, {"common": True, "name": "add", "widgets": [{"method": "create"}], }, {"name": "table", "label": "Table", "widgets": [{"method": "datatable"}] }, {"name": "map", "label": "Map", "widgets": [{"method": "map", "ajax_init": True}], }, {"name": "charts", "label": "Reports", "widgets": [{"method": "report", "ajax_init": True}] }, ] settings.search.filter_manager = False # ============================================================================= # Customise Resources # ----------------------------------------------------------------------------- # Alerts (cms_post) # ----------------------------------------------------------------------------- def cms_post_age(row): """ The age of the post - used for colour-coding markers of Alerts """ if hasattr(row, "cms_post"): row = row.cms_post try: date = row.date except: # not available return current.messages["NONE"] now = current.request.utcnow age = now - date if age < timedelta(days=2): return 1 elif age < timedelta(days=7): return 2 else: return 3 # ----------------------------------------------------------------------------- def customise_cms_post_controller(**attr): # Make GeoJSON output smaller current.s3db.gis_location.gis_feature_type.represent = None # Remove rheader attr["rheader"] = None return attr settings.customise_cms_post_controller = customise_cms_post_controller def customise_cms_post_resource(r, tablename): """ Customise cms_post resource - CRUD Strings - Datatable - Fields - Form Runs after controller customisation But runs before prep """ s3 = current.response.s3 db = current.db s3db = current.s3db table = s3db.cms_post s3.dl_pagelength = 12 list_id = r.get_vars.get("list_id", None) if list_id != "cms_post_datalist": # Default page, not homepage s3.dl_rowsize = 2 #from s3 import FS #s3.filter = FS("series_id$name").belongs(["Alert"]) s3.crud_strings["cms_post"] = Storage( label_create = T("Add"), title_display = T("Alert Details"), title_list = T("Alerts"), title_update = T("Edit Alert"), label_list_button = T("List Alerts"), label_delete_button = T("Delete Alert"), msg_record_created = T("Alert added"), msg_record_modified = T("Alert updated"), msg_record_deleted = T("Alert deleted"), msg_list_empty = T("No Alerts currently registered")) # CRUD Form from s3 import IS_LOCATION, S3LocationSelector table.location_id.requires = IS_LOCATION() table.location_id.widget = S3LocationSelector(levels=levels, show_address=True, show_map=True, points = True, polygons = True, ) # Don't add new Locations here table.location_id.comment = None #table.series_id.readable = table.series_id.writable = True #table.series_id.label = T("Type") stable = s3db.cms_series try: series_id = db(stable.name == "Alert").select(stable.id, limitby=(0, 1) ).first().id table.series_id.default = series_id except: # No suitable prepop pass table.body.label = T("Description") table.body.widget = None from s3 import S3SQLCustomForm, S3SQLInlineComponent crud_fields = ["date", #"series_id", "body", "location_id", #S3SQLInlineComponent( # "document", # name = "file", # label = T("Files"), # fields = [("", "file"), # #"comments", # ], # ), ] incident_id = r.get_vars.get("~.(incident)", None) if incident_id: # Coming from Profile page # Default location to Incident Location itable = s3db.event_incident incident = db(itable.id == incident_id).select(itable.location_id, limitby=(0, 1) ).first() if incident: table.location_id.default = incident.location_id # Add link onaccept def create_onaccept(form): current.s3db.event_post.insert(incident_id=incident_id, post_id=form.vars.id) s3db.configure("cms_post", create_onaccept = create_onaccept, ) else: # Insert into Form crud_fields.insert(0, S3SQLInlineComponent("incident_post", label = T("Incident"), fields = [("", "incident_id")], multiple = False, )) crud_form = S3SQLCustomForm(*crud_fields) from s3 import S3OptionsFilter filter_widgets = s3db.get_config("cms_post", "filter_widgets") # Remove the Type filter # @ToDo: More robust way to identify it del filter_widgets[1] filter_widgets.insert(1, S3OptionsFilter("incident_post.incident_id")) # Return to List view after create/update/delete # We do all this in Popups url_next = URL(c="cms", f="post", args="datalist") # Adapt list fields for cms_post_list_layout? #if r.method == "datalist": # list_fields = r.resource.get_config("list_fields") # list_fields.extend(["event_post.event_id", # "event_post.incident_id", # "series_id", # ]) s3db.configure("cms_post", create_next = url_next, crud_form = crud_form, delete_next = url_next, update_next = url_next, ) if r.representation == "geojson": # Add Virtual field to allow colour-coding by age from s3dal import Field table.age = Field.Method("age", cms_post_age) settings.customise_cms_post_resource = customise_cms_post_resource # ----------------------------------------------------------------------------- # Incidents (event_incident) # ----------------------------------------------------------------------------- def open_incident_filter(selector, tablename=None): """ Default filter for Incidents (callback) """ return [False] # ----------------------------------------------------------------------------- def customise_event_incident_controller(**attr): if "summary" in current.request.args: settings.gis.legend = None # Not working from s3 import s3_set_default_filter s3_set_default_filter("~.closed", open_incident_filter, tablename = "event_incident") # Make GeoJSON output smaller current.s3db.gis_location.gis_feature_type.represent = None s3 = current.response.s3 # Custom postp standard_postp = s3.postp def custom_postp(r, output): # Call standard postp if callable(standard_postp): output = standard_postp(r, output) if r.interactive and isinstance(output, dict): actions = [dict(label=str(T("Open")), _class="action-btn", url=URL(c="event", f="incident", args=["[id]", "profile"])), ] s3.actions = actions return output s3.postp = custom_postp # Remove RHeader attr["rheader"] = None return attr settings.customise_event_incident_controller = customise_event_incident_controller # ----------------------------------------------------------------------------- def customise_event_incident_resource(r, tablename): """ Customise org_resource resource - Customize Fi - List Fields - Form - Filter Widgets Runs after controller customisation But runs before prep """ s3db = current.s3db table = s3db[tablename] crud_strings = current.response.s3.crud_strings # Enable 'Lead Organisation' field table.organisation_id.readable = table.organisation_id.writable = True if r.interactive: table.zero_hour.label = T("Date") table.comments.label = T("Description") crud_strings["event_incident"].label_delete_button = T("Delete Incident") list_fields = ["zero_hour", "name", "location_id", "comments", "organisation_id", "closed", ] # Custom Form location_id_field = table.location_id from s3 import IS_LOCATION, S3LocationSelector location_id_field.requires = IS_LOCATION() location_id_field.widget = S3LocationSelector(levels=levels, show_address=True, show_map=True, points = True, polygons = True, ) # Don't add new Locations here location_id_field.comment = None #from gluon.validators import IS_EMPTY_OR #table.organisation_id.requires = IS_EMPTY_OR(table.organisation_id.requires) from s3 import S3SQLCustomForm, S3SQLInlineComponent crud_fields = ["zero_hour", "name", "location_id", "comments", "organisation_id", S3SQLInlineComponent( "document", name = "file", label = T("Documents"), fields = [("", "file"), #"comments", ], ), ] if r.method != "create": crud_fields.append("closed") crud_form = S3SQLCustomForm(*crud_fields) from s3 import S3TextFilter, S3OptionsFilter, S3LocationFilter filter_widgets = [S3TextFilter(["name", "comments" ], #label = T("Description"), label = T("Search"), _class = "filter-search", ), S3OptionsFilter("closed", cols = 2, ), S3LocationFilter("location_id", #label = T("Location"), levels = levels, ), #S3OptionsFilter("status_id", # label = T("Status"), # # @ToDo: Introspect cols # cols = 3, # ), S3OptionsFilter("organisation_id", represent = "%(name)s", ), ] url_next = URL(c="event", f="incident", args=["[id]", "profile"]) s3db.configure("event_incident", create_next = url_next, crud_form = crud_form, delete_next = URL(c="event", f="incident", args="summary"), filter_widgets = filter_widgets, list_fields = list_fields, update_next = url_next, ) if r.method == "profile" and r.tablename == "event_incident": # Customise tables used by widgets customise_project_task_resource(r, "project_task") from s3 import FS map_widget = dict(label = "Map", type = "map", context = "incident", icon = "icon-map", # Tall/thin fits Puget Sound best height = 600, width = 200, colspan = 1, ) alerts_widget = dict(label = "Alerts", label_create = "Create Alert", type = "datalist", tablename = "cms_post", context = "incident", # Only show Active Alerts filter = FS("expired") == False, icon = "alert", colspan = 1, layer = "Alerts", #list_layout = s3db.cms_post_list_layout, ) resources_widget = dict(label = "Resources", label_create = "Add Resource", type = "datalist", tablename = "event_resource", context = "incident", #filter = FS("status").belongs(event_resource_active_statuses), icon = "resource", colspan = 1, #list_layout = s3db.event_resource_list_layout, ) tasks_widget = dict(label = "Tasks", label_create = "Create Task", type = "datalist", tablename = "project_task", context = "incident", # Only show Active Tasks filter = FS("status").belongs(s3db.project_task_active_statuses), icon = "tasks", colspan = 1, #list_layout = s3db.project_task_list_layout, ) record = r.record record_id = record.id record_name = record.name title = "%s: %s" % (T("Incident"), record_name) marker = current.gis.get_marker(controller = "event", function = "incident") layer = dict(name = record_name, id = "profile-header-%s-%s" % (tablename, record_id), active = True, tablename = tablename, url = "/%s/event/incident.geojson?incident.id=%s" % \ (r.application, record_id), marker = marker, ) if current.auth.s3_has_permission("update", table, record_id=record_id): edit_btn = A(I(_class="icon icon-edit"), _href=URL(c="event", f="incident", args=[record_id, "update.popup"], vars={"refresh": "datalist"}), _class="s3_modal", _title=s3.crud_strings["event_incident"].title_update, ) else: edit_btn = "" # Dropdown of available documents # @ToDo: Use resource.components instead of DAL for security (not required here but good practise) dtable = s3db.doc_document rows = current.db(dtable.doc_id == r.record.doc_id).select(dtable.file) documents = [row.file for row in rows] if documents: doc_list = UL(_class="dropdown-menu", _role="menu", ) retrieve = dtable.file.retrieve for doc in documents: try: doc_name = retrieve(doc)[0] except (IOError, TypeError): doc_name = current.messages["NONE"] doc_url = URL(c="default", f="download", args=[doc]) doc_item = LI(A(I(_class="icon-file"), " ", doc_name, _href=doc_url, ), _role="menuitem", ) doc_list.append(doc_item) docs = DIV(A(I(_class="icon-paper-clip"), SPAN(_class="caret"), _class="btn dropdown-toggle", _href="#", **{"_data-toggle": "dropdown"} ), doc_list, _class="btn-group attachments dropdown pull-right", ) else: docs = "" s3db.configure("event_incident", profile_title = title, profile_header = DIV(edit_btn, H2(title), docs, _class="profile-header", ), profile_layers = (layer,), profile_widgets = (alerts_widget, resources_widget, tasks_widget, map_widget, ), profile_cols = 4 ) settings.customise_event_incident_resource = customise_event_incident_resource # ----------------------------------------------------------------------------- # Facilities (org_facility) # ----------------------------------------------------------------------------- def customise_org_facility_resource(r, tablename): """ Customise org_resource resource - CRUD Strings - List Fields - Form - Report Options Runs after controller customisation But runs before prep """ s3 = current.response.s3 s3db = current.s3db table = s3db.org_facility s3.crud_strings[tablename] = Storage( label_create = T("Add"), title_display = T("Facility Details"), title_list = T("Facilities"), title_update = T("Edit Facility Details"), label_list_button = T("List Facilities"), label_delete_button = T("Delete Facility"), msg_record_created = T("Facility added"), msg_record_modified = T("Facility details updated"), msg_record_deleted = T("Facility deleted"), msg_list_empty = T("No Facilities currently registered")) from s3 import IS_LOCATION, S3LocationSelector location_id_field = table.location_id location_id_field.requires = IS_LOCATION() location_id_field.widget = S3LocationSelector(levels=levels, show_address=True, show_map=True, ) # Don't add new Locations here location_id_field.comment = None list_fields = ["name", "organisation_id", #(T("Type"), "facility_type.name"), "location_id", "phone1", "comments", ] from s3 import S3SQLCustomForm crud_form = S3SQLCustomForm(*list_fields) # Report options report_fields = ["organisation_id", ] report_options = Storage(rows = report_fields, cols = report_fields, fact = ["count(id)" ], defaults=Storage(rows = "organisation_id", cols = "", fact = "count(id)", totals = True, chart = "barchart:rows", #table = "collapse", ) ) url_next = URL(c="org", f="facility", args="summary") s3db.configure("org_facility", create_next = url_next, crud_form = crud_form, delete_next = url_next, list_fields = list_fields, list_layout = render_facilities, report_options = report_options, summary = settings.ui.summary, update_next = url_next, ) if r.method == "summary": settings.gis.legend = None settings.customise_org_facility_resource = customise_org_facility_resource # ----------------------------------------------------------------------------- # Stakeholders (org_organisation) # ----------------------------------------------------------------------------- def customise_org_organisation_resource(r, tablename): """ Customise org_organisation resource - List Fields - CRUD Strings - Form - Filter Runs after controller customisation But runs before prep """ # Load normal Model s3db = current.s3db table = s3db.org_organisation list_fields = ["id", "name", "logo", "phone", "website", ] if r.interactive: # Labels table.comments.label = T("Description") s3.crud_strings["org_organisation"] = Storage( label_create = T("Add"), title_display = T("Stakeholder Details"), title_list = T("Stakeholders"), title_update = T("Edit Stakeholder"), label_list_button = T("List Stakeholders"), label_delete_button = T("Delete Stakeholder"), msg_record_created = T("Stakeholder added"), msg_record_modified = T("Stakeholder updated"), msg_record_deleted = T("Stakeholder deleted"), msg_list_empty = T("No Stakeholders currently registered")) from s3 import S3SQLCustomForm, S3SQLInlineLink crud_form = S3SQLCustomForm("id", "name", S3SQLInlineLink( "organisation_type", field = "organisation_type_id", label = T("Type"), multiple = False, #widget = "hierarchy", ), "logo", "phone", "website", "comments", ) s3db.configure("org_organisation", crud_form = crud_form, ) if r.method == "datalist": # Stakeholder selection page # 2-column datalist, 6 rows per page s3.dl_pagelength = 12 s3.dl_rowsize = 3 from s3 import S3TextFilter, S3OptionsFilter filter_widgets = [S3TextFilter(["name", "acronym", "website", "comments", ], label = T("Search")), S3OptionsFilter("organisation_organisation_type.organisation_type_id", label = T("Type"), ), ] s3db.configure("org_organisation", filter_widgets = filter_widgets, ) if r.method == "profile": # Ensure the correct list_fields are set # @ToDo: Have profile method call these automatically customise_pr_person_resource(r, "pr_person") customise_event_incident_resource(r, "event_incident") # Customise tables used by widgets #customise_cms_post_fields() #customise_hrm_human_resource_fields() #customise_org_office_fields() s3db.org_customise_org_resource_fields("profile") #from s3 import FS contacts_widget = dict(label = "Directory", label_create = "Create Contact", type = "datalist", tablename = "hrm_human_resource", context = "organisation", create_controller = "pr", create_function = "person", icon = "contact", show_on_map = False, # Since they will show within Offices list_layout = render_contacts, ) #map_widget = dict(label = "Map", # type = "map", # context = "organisation", # icon = "icon-map", # height = 383, # width = 568, # ) facilities_widget = dict(label = "Facilities", label_create = "Create Facility", type = "datalist", tablename = "org_facility", context = "organisation", icon = "building", layer = "Facilities", # provided by Catalogue Layer #marker = "office", list_layout = render_facilities, ) resources_widget = dict(label = "Resources", label_create = "Create Resource", type = "datalist", tablename = "org_resource", context = "organisation", icon = "resource", show_on_map = False, # No Marker yet & only show at L1-level anyway #list_layout = s3db.org_resource_list_layout, ) incidents_widget = dict(label = "Incidents", label_create = "Create Incident", type = "datalist", tablename = "event_incident", context = "organisation", icon = "incident", show_on_map = False, # No Marker yet & only show at L1-level anyway #list_layout = s3db.event_incident_list_layout, ) record = r.record title = "%s : %s" % (s3.crud_strings["org_organisation"].title_list, record.name) if record.logo: logo = URL(c="default", f="download", args=[record.logo]) else: logo = "" s3db.configure("org_organisation", profile_title = title, profile_header = DIV(A(IMG(_class="media-object", _src=logo, ), _class="pull-left", #_href=org_url, ), H2(title), _class="profile-header", ), profile_widgets = [contacts_widget, #map_widget, facilities_widget, resources_widget, incidents_widget, #activities_widget, #reports_widget, #assessments_widget, ], #profile_cols = 3 ) # Return to List view after create/update/delete (unless done via Modal) url_next = URL(c="org", f="organisation", args="datalist") s3db.configure("org_organisation", create_next = url_next, delete_next = url_next, # We want the Create form to be in a modal, not inline, for consistency #listadd = False, list_fields = list_fields, update_next = url_next, ) settings.customise_org_organisation_resource = customise_org_organisation_resource # ----------------------------------------------------------------------------- # Resource Inventory (org_resource) # ----------------------------------------------------------------------------- def customise_org_resource_resource(r, tablename): """ Customise org_resource resource - Fields - Filter Runs after controller customisation But runs before prep """ if r.representation == "geojson": # Make GeoJSON output smaller current.s3db.gis_location.gis_feature_type.represent = None elif r.interactive: s3 = current.response.s3 s3db = current.s3db table = s3db.org_resource s3.crud_strings[tablename] = Storage( label_create = T("Add"), title_display = T("Inventory Resource"), title_list = T("Resource Inventory"), title_update = T("Edit Inventory Resource"), label_list_button = T("Resource Inventory"), label_delete_button = T("Delete Inventory Resource"), msg_record_created = T("Inventory Resource added"), msg_record_modified = T("Inventory Resource updated"), msg_record_deleted = T("Inventory Resource deleted"), msg_list_empty = T("No Resources in Inventory")) location_field = table.location_id # Filter from a Profile page? # If so, then default the fields we know get_vars = current.request.get_vars location_id = get_vars.get("~.(location)", None) organisation_id = get_vars.get("~.(organisation)", None) if organisation_id: org_field = table.organisation_id org_field.default = organisation_id org_field.readable = org_field.writable = False if location_id: location_field.default = location_id # We still want to be able to specify a precise location #location_field.readable = location_field.writable = False from s3 import IS_LOCATION, S3LocationSelector location_field.requires = IS_LOCATION() location_field.widget = S3LocationSelector(levels=levels, show_address=True, show_map=True, ) # Don't add new Locations here location_field.comment = None s3db.org_customise_org_resource_fields(r.method) # Configure fields #table.site_id.readable = table.site_id.readable = False #location_field.label = T("District") # Return to Sumamry view after create/update/delete (unless done via Modal) url_next = URL(c="org", f="resource", args="summary") s3db.configure("org_resource", create_next = url_next, delete_next = url_next, # Don't include a Create form in 'More' popups listadd = False if r.method=="datalist" else True, update_next = url_next, ) # This is awful in Popups & inconsistent in dataTable view (People/Documents don't have this & it breaks the styling of the main Save button) s3.cancel = URL(c="org", f="resource") if r.method == "summary": settings.gis.legend = None settings.customise_org_resource_resource = customise_org_resource_resource # ----------------------------------------------------------------------------- def customise_event_resource_resource(r, tablename): """ Customise org_resource resource - Fields - Filter Runs after controller customisation But runs before prep """ if r.representation == "geojson": # Make GeoJSON output smaller current.s3db.gis_location.gis_feature_type.represent = None elif r.interactive: current.response.s3.crud_strings[tablename] = Storage( label_create = T("Add"), title_display = T("Resource Responding"), title_list = T("Resources Responding"), title_update = T("Edit Resource Responding"), label_list_button = T("Resources Responding"), label_delete_button = T("Delete Resource Responding"), msg_record_created = T("Resource Responding added"), msg_record_modified = T("Resource Responding updated"), msg_record_deleted = T("Resource Responding deleted"), msg_list_empty = T("No Resources Responding")) if r.method == "summary": settings.gis.legend = None settings.customise_event_resource_resource = customise_event_resource_resource # ----------------------------------------------------------------------------- # Tasks (project_task) # ----------------------------------------------------------------------------- def active_status_filter(selector, tablename=None): """ Default filter for Tasks (callback) """ return current.s3db.project_task_active_statuses # ----------------------------------------------------------------------------- def customise_project_task_controller(**attr): if "summary" in current.request.args: settings.gis.legend = None # Not working from s3 import s3_set_default_filter s3_set_default_filter("~.status", active_status_filter, tablename = "project_task") # Make GeoJSON output smaller current.s3db.gis_location.gis_feature_type.represent = None # Remove rheader attr["rheader"] = None return attr settings.customise_project_task_controller = customise_project_task_controller # ----------------------------------------------------------------------------- def customise_project_task_resource(r, tablename): """ Customise org_resource resource - List Fields - Fields - Form - Filter Widgets - Report Options Runs after controller customisation But runs before prep """ s3db = current.s3db table = s3db.project_task if r.tablename == "event_incident" and r.method == "profile": # Set list_fields for renderer (project_task_list_layout) list_fields = ["name", "description", "location_id", "date_due", "pe_id", "incident.incident_id", #"organisation_id$logo", "pe_id", "source_url", "modified_by", "status", "priority", ] else: list_fields = ["id", "status", "priority", "incident.incident_id", (T("Task"), "name"), "location_id", "date_due", (T("Wrike Permalink"), "source_url"), ] # Custom Form table.name.label = T("Name") table.description.label = T("Description") table.description.comment = None location_id_field = table.location_id location_id_field.readable = location_id_field.writable = True from s3 import IS_LOCATION, S3LocationSelector location_id_field.requires = IS_LOCATION() location_id_field.widget = S3LocationSelector(levels=levels, show_address=True, show_map=True, points = True, polygons = True, ) from s3 import S3SQLCustomForm, S3SQLInlineComponent crud_fields = ["source_url", "status", "priority", "name", "description", "pe_id", "date_due", "location_id", ] incident_id = r.get_vars.get("~.(incident)", None) if incident_id: # Coming from Profile page # Add link onaccept def create_onaccept(form): current.s3db.event_task.insert(incident_id=incident_id, task_id=form.vars.id) s3db.configure("project_task", create_onaccept = create_onaccept, ) else: # Insert into Form crud_fields.insert(0, S3SQLInlineComponent("incident", label = T("Incident"), fields = [("", "incident_id")], multiple = False, )) if (r.method == None or r.method == "update") and \ r.record and r.record.source_url: # Task imported from Wrike # - lock all fields which should only be edited within Wrike #crud_fields.insert(0, "source_url") current.s3db.event_task.incident_id.writable = False for fieldname in ["source_url", "status", "priority", "name", "description", "pe_id", "date_due"]: table[fieldname].writable = False crud_form = S3SQLCustomForm(*crud_fields) # Filter Widgets from s3 import S3OptionsFilter filter_widgets = s3db.get_config("project_task", "filter_widgets") filter_widgets.insert(2, S3OptionsFilter("incident.incident_id")) # Report options report_fields = ["status", "priority", "incident.incident_id", "pe_id", "location_id", ] report_options = Storage(rows = report_fields, cols = report_fields, fact = ["count(name)"], defaults=Storage(rows = "status", cols = "priority", fact = "count(name)", totals = True, chart = "barchart:rows", ) ) url_next = URL(c="project", f="task", args="summary") s3db.configure("project_task", create_next = url_next, crud_form = crud_form, delete_next = url_next, list_fields = list_fields, onvalidation = None, # don't check pe_id if status Active orderby = "project_task.date_due asc", report_options = report_options, update_next = url_next, ) settings.customise_project_task_resource = customise_project_task_resource # ----------------------------------------------------------------------------- # Contacts (pr_person) # ----------------------------------------------------------------------------- def customise_pr_person_controller(**attr): s3 = current.response.s3 # Custom postp standard_postp = s3.postp def custom_postp(r, output): # Call standard postp if callable(standard_postp): output = standard_postp(r, output) if r.interactive and isinstance(output, dict): actions = [dict(label=str(T("Open")), _class="action-btn", url=URL(c="pr", f="person", args=["[id]", "read"])) ] s3.actions = actions if "form" in output: output["form"].add_class("pr_person") elif "item" in output and hasattr(output["item"], "add_class"): output["item"].add_class("pr_person") return output s3.postp = custom_postp # Remove RHeader attr["rheader"] = None return attr settings.customise_pr_person_controller = customise_pr_person_controller # ----------------------------------------------------------------------------- def customise_pr_person_resource(r, tablename): """ Customise org_resource resource - List Fields - Fields - Form - Filter Widgets - Report Options Runs after controller customisation But runs before prep """ s3db = current.s3db request = current.request s3 = current.response.s3 tablename = "pr_person" # CRUD Strings s3.crud_strings[tablename] = Storage( label_create = T("Add"), title_display = T("Contact Details"), title_list = T("Contact Directory"), title_update = T("Edit Contact Details"), label_list_button = T("List Contacts"), label_delete_button = T("Delete Contact"), msg_record_created = T("Contact added"), msg_record_modified = T("Contact details updated"), msg_record_deleted = T("Contact deleted"), msg_list_empty = T("No Contacts currently registered")) if r.method == "validate": # Can't validate image without the file image_field = s3db.pr_image.image image_field.requires = None MOBILE = settings.get_ui_label_mobile_phone() EMAIL = T("Email") htable = s3db.hrm_human_resource htable.organisation_id.widget = None site_field = htable.site_id from s3 import S3Represent, IS_ONE_OF represent = S3Represent(lookup="org_site") site_field.label = T("Facility") site_field.represent = represent site_field.requires = IS_ONE_OF(current.db, "org_site.site_id", represent, orderby = "org_site.name") from s3layouts import S3AddResourceLink site_field.comment = S3AddResourceLink(c="org", f="facility", vars={"child": "site_id"}, label=T("Create Facility"), title=T("Facility"), tooltip=T("If you don't see the Facility in the list, you can add a new one by clicking link 'Create Facility'.")) # ImageCrop widget doesn't currently work within an Inline Form image_field = s3db.pr_image.image from gluon.validators import IS_IMAGE image_field.requires = IS_IMAGE() image_field.widget = None hr_fields = ["organisation_id", "job_title_id", "site_id", ] # Context from a Profile page?" organisation_id = request.get_vars.get("(organisation)", None) if organisation_id: field = s3db.hrm_human_resource.organisation_id field.default = organisation_id field.readable = field.writable = False hr_fields.remove("organisation_id") from s3 import S3SQLCustomForm, S3SQLInlineComponent s3_sql_custom_fields = [ "first_name", #"middle_name", "last_name", S3SQLInlineComponent( "human_resource", name = "human_resource", label = "", multiple = False, fields = hr_fields, ), S3SQLInlineComponent( "image", name = "image", label = T("Photo"), multiple = False, fields = [("", "image")], filterby = dict(field = "profile", options=[True] ) ), ] list_fields = ["human_resource.organisation_id", "first_name", #"middle_name", "last_name", (T("Job Title"), "human_resource.job_title_id"), (T("Facility"), "human_resource.site_id"), ] # Don't include Email/Phone for unauthenticated users if current.auth.is_logged_in(): list_fields += [(MOBILE, "phone.value"), (EMAIL, "email.value"), ] s3_sql_custom_fields.insert(3, S3SQLInlineComponent( "contact", name = "phone", label = MOBILE, multiple = False, fields = [("", "value")], filterby = dict(field = "contact_method", options = "SMS")), ) s3_sql_custom_fields.insert(3, S3SQLInlineComponent( "contact", name = "email", label = EMAIL, multiple = False, fields = [("", "value")], filterby = dict(field = "contact_method", options = "EMAIL")), ) crud_form = S3SQLCustomForm(*s3_sql_custom_fields) from s3 import S3TextFilter, S3OptionsFilter filter_widgets = [S3TextFilter(["pe_label", "first_name", "middle_name", "last_name", "local_name", "identity.value", "human_resource.organisation_id", "human_resource.job_title_id", "human_resource.site_id", ], label=T("Search"), ), S3OptionsFilter("human_resource.organisation_id", ), S3OptionsFilter("human_resource.job_title_id", ), S3OptionsFilter("human_resource.site_id", ), ] # Return to List view after create/update/delete (unless done via Modal) url_next = URL(c="pr", f="person", ) # Report options report_fields = ["organisation_id", ] report_options = Storage(rows = report_fields, cols = report_fields, fact = ["count(id)" ], defaults=Storage(rows = "organisation_id", cols = "", fact = "count(id)", totals = True, chart = "barchart:rows", #table = "collapse", ) ) s3db.configure(tablename, create_next = url_next, crud_form = crud_form, delete_next = url_next, filter_widgets = filter_widgets, listadd = True, list_fields = list_fields, report_options = report_options, # Don't include a Create form in 'More' popups #listadd = False if r.method=="datalist" else True, #list_layout = render_contacts, update_next = url_next, ) # HR Fields For dataList Cards list_fields = ["person_id", "organisation_id", "site_id$location_id", "site_id$location_id$addr_street", "job_title_id", "email.value", "phone.value", #"modified_by", "modified_on", ] s3db.configure("hrm_human_resource", list_fields = list_fields, ) settings.customise_pr_person_resource = customise_pr_person_resource # ============================================================================= # Custom list_layout renders (Copy & Pasted from DRMP) # @ToDo: re-factor # ----------------------------------------------------------------------------- def render_contacts(list_id, item_id, resource, rfields, record): """ Custom dataList item renderer for Contacts on the Profile pages @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfields: the S3ResourceFields to render @param record: the record as dict """ record_id = record["hrm_human_resource.id"] item_class = "thumbnail" raw = record._row #author = record["hrm_human_resource.modified_by"] #date = record["hrm_human_resource.modified_on"] fullname = record["hrm_human_resource.person_id"] job_title = raw["hrm_human_resource.job_title_id"] or "" if job_title: job_title = "- %s" % record["hrm_human_resource.job_title_id"] #organisation = record["hrm_human_resource.organisation_id"] organisation_id = raw["hrm_human_resource.organisation_id"] #org_url = URL(c="org", f="organisation", args=[organisation_id, "profile"]) person_id = raw["hrm_human_resource.person_id"] #location = record["org_site.location_id"] #location_id = raw["org_site.location_id"] #location_url = URL(c="gis", f="location", # args=[location_id, "profile"]) #address = raw["gis_location.addr_street"] or T("no facility assigned") email = raw["pr_email_contact.value"] or T("no email address") if isinstance(email, list): email = email[0] phone = raw["pr_phone_contact.value"] or T("no phone number") if isinstance(phone, list): phone = phone[0] if person_id: # Use Personal Avatar # @ToDo: Optimise by not doing DB lookups within render, but doing these in the bulk query avatar = s3_avatar_represent(person_id, tablename="pr_person", _class="media-object") else: avatar = IMG(_src=URL(c="static", f="img", args="blank-user.gif"), _class="media-object") # Edit Bar permit = current.auth.s3_has_permission table = current.s3db.pr_person if permit("update", table, record_id=person_id): vars = {"refresh": list_id, "record": record_id, } f = current.request.function if f == "organisation" and organisation_id: vars["(organisation)"] = organisation_id edit_url = URL(c="hrm", f="person", args=[person_id, "update.popup"], vars=vars) title_update = current.response.s3.crud_strings.hrm_human_resource.title_update edit_btn = A(I(" ", _class="icon icon-edit"), _href=edit_url, _class="s3_modal", _title=title_update, ) else: edit_btn = "" edit_url = "#" title_update = "" # Deletions failing due to Integrity Errors #if permit("delete", table, record_id=person_id): # delete_btn = A(I(" ", _class="icon icon-remove-sign"), # _class="dl-item-delete", # ) #else: delete_btn = "" edit_bar = DIV(edit_btn, delete_btn, _class="edit-bar fright", ) avatar = A(avatar, _href=edit_url, _class="pull-left s3_modal", _title=title_update, ) # Render the item body = TAG[""](P(I(_class="icon-phone"), " ", SPAN(phone), " ", ), P(I(_class="icon-envelope-alt"), " ", SPAN(email), _class="main_contact_ph", ), #P(I(_class="icon-home"), # " ", # address, # _class="main_office-add", # ) ) item = DIV(DIV(SPAN(fullname, " ", job_title, _class="card-title"), edit_bar, _class="card-header", ), DIV(avatar, DIV(DIV(body, # Organisation only needed if displaying elsewhere than org profile # Author confusing with main contact record #DIV(#author, # #" - ", # A(organisation, # _href=org_url, # _class="card-organisation", # ), # _class="card-person", # ), _class="media", ), _class="media-body", ), _class="media", ), #docs, _class=item_class, _id=item_id, ) return item # ----------------------------------------------------------------------------- def render_facilities(list_id, item_id, resource, rfields, record): """ Custom dataList item renderer for Facilities on the Profile pages @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfields: the S3ResourceFields to render @param record: the record as dict """ record_id = record["org_facility.id"] item_class = "thumbnail" raw = record._row name = record["org_facility.name"] #author = record["org_facility.modified_by"] #date = record["org_facility.modified_on"] #organisation = record["org_facility.organisation_id"] organisation_id = raw["org_facility.organisation_id"] #location = record["org_facility.location_id"] #location_id = raw["org_facility.location_id"] #location_url = URL(c="gis", f="location", # args=[location_id, "profile"]) address = raw["gis_location.addr_street"] phone = raw["org_facility.phone1"] #facility_type = record["org_facility.facility_type_id"] logo = raw["org_organisation.logo"] org_url = URL(c="org", f="organisation", args=[organisation_id, "profile"]) if logo: logo = A(IMG(_src=URL(c="default", f="download", args=[logo]), _class="media-object", ), _href=org_url, _class="pull-left", ) else: logo = DIV(IMG(_class="media-object"), _class="pull-left") # Edit Bar permit = current.auth.s3_has_permission table = current.db.org_facility if permit("update", table, record_id=record_id): vars = {"refresh": list_id, "record": record_id, } f = current.request.function if f == "organisation" and organisation_id: vars["(organisation)"] = organisation_id edit_btn = A(I(" ", _class="icon icon-edit"), _href=URL(c="org", f="facility", args=[record_id, "update.popup"], vars=vars), _class="s3_modal", _title=current.response.s3.crud_strings.org_facility.title_update, ) else: edit_btn = "" if permit("delete", table, record_id=record_id): delete_btn = A(I(" ", _class="icon icon-remove-sign"), _class="dl-item-delete", ) else: delete_btn = "" edit_bar = DIV(edit_btn, delete_btn, _class="edit-bar fright", ) # Render the item #avatar = logo body = TAG[""](#P(I(_class="icon-flag"), # " ", # SPAN(facility_type), # " ", # _class="main_contact_ph", # ), P(I(_class="icon-phone"), " ", SPAN(phone or T("no phone number")), " ", ), P(I(_class="icon-home"), " ", address, _class="main_facility-add", )) item = DIV(DIV(SPAN(name, _class="card-title"), edit_bar, _class="card-header", ), DIV(#avatar, DIV(DIV(body, DIV(#author, #" - ", #A(organisation, # _href=org_url, # _class="card-organisation", # ), #_class="card-person", ), _class="media", ), _class="media-body", ), _class="media", ), #docs, _class=item_class, _id=item_id, ) return item # ============================================================================= # Modules # Comment/uncomment modules here to disable/enable them settings.modules = OrderedDict([ # Core modules which shouldn't be disabled ("default", Storage( name_nice = "Home", restricted = False, # Use ACLs to control access to this module access = None, # All Users (inc Anonymous) can see this module in the default menu & access the controller module_type = None # This item is not shown in the menu )), ("admin", Storage( name_nice = "Administration", #description = "Site Administration", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu & access the controller module_type = None # This item is handled separately for the menu )), ("appadmin", Storage( name_nice = "Administration", #description = "Site Administration", restricted = True, module_type = None # No Menu )), # ("errors", Storage( # name_nice = "Ticket Viewer", # #description = "Needed for Breadcrumbs", # restricted = False, # module_type = None # No Menu # )), ("sync", Storage( name_nice = "Synchronization", #description = "Synchronization", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu & access the controller module_type = None # This item is handled separately for the menu )), ("translate", Storage( name_nice = "Translation Functionality", #description = "Selective translation of strings based on module.", module_type = None, )), ("gis", Storage( name_nice = "Map", #description = "Situation Awareness & Geospatial Analysis", restricted = True, module_type = 1, # 1st item in the menu )), ("pr", Storage( name_nice = "Persons", description = "Central point to record details on People", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) module_type = None )), ("org", Storage( name_nice = "Organizations", #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', restricted = True, module_type = None )), # All modules below here should be possible to disable safely ("hrm", Storage( name_nice = "Contacts", #description = "Human Resources Management", restricted = True, module_type = None, )), ("cms", Storage( name_nice = "Content Management", restricted = True, module_type = None, )), ("event", Storage( name_nice = "Event Management", restricted = True, module_type = None, )), ("project", Storage( name_nice = "Project Management", restricted = True, module_type = None, )), ("doc", Storage( name_nice = "Documents", #description = "A library of digital resources, such as photos, documents and reports", restricted = True, module_type = None, )), ("stats", Storage( name_nice = "Statistics", restricted = True, module_type = None )), ]) # END =========================================================================
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 893, 26, 272, 327, 2018, 499, 14, 23, 272, 687, 5055, 492, 8773, 199, 2590, 26, 272, 327, 2018, 499, 14, 22, 272, 687, 26752, 14, 2828, 14, 4129, 1001, 14, 8235, 63, 807, 492, 8773, 199, 199, 504, 2197, 492, 6871, 199, 199, 504, 26752, 492, 1453, 199, 504, 26752, 14, 1360, 492, 627, 199, 504, 26752, 14, 3494, 492, 10533, 199, 199, 504, 308, 19, 492, 308, 19, 63, 14584, 63, 13063, 199, 199, 318, 1101, 8, 1751, 304, 272, 408, 267, 5458, 367, 644, 1119, 31673, 13964, 6654, 1958, 19835, 5722, 334, 9004, 13, 32324, 9, 398, 1455, 921, 1190, 77, 26950, 14, 1308, 272, 408, 339, 377, 275, 1453, 14, 52, 272, 308, 19, 275, 1453, 14, 1310, 14, 83, 19, 339, 327, 13722, 272, 327, 5543, 13, 9606, 5434, 272, 2202, 14, 1095, 14, 657, 13817, 275, 1689, 45, 32324, 401, 298, 885, 15, 3707, 531, 339, 2202, 14, 1095, 14, 2253, 63, 354, 275, 377, 480, 51, 11326, 6738, 26, 644, 1119, 31673, 13964, 6654, 1958, 19835, 5722, 334, 9004, 13, 32324, 6320, 272, 2202, 14, 1095, 14, 2253, 63, 354, 63, 3612, 275, 377, 480, 51, 11326, 6738, 531, 339, 327, 26237, 272, 327, 6187, 13303, 272, 327, 13722, 272, 327, 21527, 13303, 272, 327, 20123, 883, 291, 13, 2683, 272, 327, 1751, 14, 4416, 14, 277, 63, 8054, 275, 756, 272, 327, 20123, 1929, 370, 4911, 3932, 3031, 272, 2202, 14, 1178, 14, 8054, 63, 6537, 63, 16257, 275, 715, 272, 327, 20123, 1929, 370, 506, 30055, 272, 2202, 14, 1178, 14, 8054, 63, 6537, 63, 28302, 275, 715, 272, 2202, 14, 1178, 14, 8054, 63, 6615, 63, 17425, 275, 715, 272, 2202, 14, 1178, 14, 8054, 63, 17425, 63, 2427, 275, 715, 339, 327, 19615, 637, 14931, 664, 4847, 370, 1006, 4628, 83, 272, 2202, 14, 1198, 14, 11227, 422, 275, 298, 14288, 2, 339, 2202, 14, 1178, 14, 8054, 63, 1073, 63, 751, 63, 475, 275, 2420, 7018, 582, 377, 480, 18963, 531, 93, 272, 2202, 14, 1178, 14, 8054, 63, 1073, 63, 751, 63, 475, 63, 885, 275, 2097, 7018, 937, 272, 2202, 14, 1178, 14, 8054, 63, 8050, 275, 2420, 17425, 63, 344, 582, 2097, 3791, 2255, 3147, 789, 339, 2202, 14, 1178, 14, 2384, 63, 5834, 63, 2743, 275, 756, 272, 2202, 14, 1178, 14, 2384, 63, 1073, 275, 756, 339, 327, 13722, 272, 327, 13863, 18141, 272, 2202, 14, 4416, 14, 3185, 275, 1520, 327, 14618, 16282, 12, 6801, 436, 6957, 16543, 83, 272, 2202, 14, 4416, 14, 1130, 275, 715, 339, 327, 13722, 272, 327, 23978, 334, 3741, 370, 675, 367, 6858, 15, 4209, 14, 1360, 9, 272, 2202, 14, 1095, 14, 7915, 275, 298, 45, 32324, 2, 272, 2202, 14, 1907, 14, 964, 2487, 63, 1143, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 964, 2487, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 1541, 63, 964, 2487, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 8191, 63, 3070, 63, 1419, 275, 756, 272, 327, 1910, 3349, 370, 675, 428, 19, 3947, 5446, 3339, 641, 1006, 5978, 68, 23311, 334, 19767, 314, 3590, 20764, 2034, 1253, 12625, 11212, 3339, 18, 6938, 370, 642, 9, 272, 2202, 14, 1907, 14, 3029, 2416, 63, 3440, 275, 298, 1733, 2, 339, 327, 768, 1378, 2585, 26, 1010, 27174, 323, 272, 2202, 14, 1907, 14, 1180, 63, 3887, 63, 16471, 275, 715, 339, 327, 8388, 7016, 3992, 272, 2202, 14, 1907, 14, 4229, 63, 16471, 275, 469, 267, 298, 9241, 582, 298, 4677, 13, 9241, 401, 267, 298, 17952, 582, 298, 4677, 13, 17952, 401, 267, 298, 7811, 582, 298, 4677, 13, 7811, 401, 267, 298, 29811, 582, 298, 4677, 13, 29811, 401, 267, 298, 1927, 582, 298, 4677, 13, 87, 15148, 401, 267, 298, 5054, 582, 298, 4677, 13, 5054, 401, 272, 789, 339, 327, 1910, 3349, 370, 2498, 282, 849, 9311, 5528, 315, 18042, 1218, 15, 873, 4513, 272, 2202, 14, 1907, 14, 885, 63, 6406, 63, 3887, 275, 715, 339, 327, 1910, 3349, 370, 3507, 9163, 3398, 5953, 402, 6394, 292, 5921, 272, 327, 446, 5289, 1909, 5133, 12470, 272, 2202, 14, 1907, 14, 4616, 292, 5921, 63, 3853, 3398, 275, 756, 339, 327, 1751, 14, 5668, 14, 1130, 63, 3333, 275, 11624, 272, 327, 1751, 14, 5668, 14, 1130, 63, 2063, 275, 1695, 1477, 339, 327, 13722, 272, 327, 491, 709, 78, 334, 5339, 2072, 9, 2202, 272, 2202, 14, 44, 709, 78, 14, 13209, 275, 8773, 779, 267, 1689, 287, 401, 298, 19410, 1288, 272, 4794, 272, 327, 3758, 8466, 272, 2202, 14, 44, 709, 78, 14, 885, 63, 3671, 275, 298, 287, 2, 272, 327, 3758, 7137, 367, 4390, 272, 2202, 14, 44, 709, 78, 14, 5834, 63, 2743, 275, 3905, 25822, 2, 272, 327, 15254, 361, 461, 283, 9118, 7, 1434, 1475, 272, 2202, 14, 44, 709, 78, 14, 602, 63, 908, 275, 2071, 66, 450, 68, 450, 57, 2, 272, 327, 4860, 6752, 334, 4322, 370, 9055, 7105, 13, 16, 9, 272, 327, 6345, 9432, 367, 5579, 334, 4322, 370, 2360, 9, 272, 2202, 14, 44, 709, 78, 14, 6355, 63, 9896, 275, 14530, 272, 327, 18049, 527, 5915, 9432, 367, 5579, 334, 4322, 370, 4601, 9, 272, 2202, 14, 44, 709, 78, 14, 273, 29737, 63, 9896, 275, 21147, 272, 327, 3758, 19453, 5495, 367, 14001, 9339, 5579, 272, 2202, 14, 44, 709, 78, 14, 885, 63, 6063, 63, 600, 275, 413, 272, 327, 12030, 642, 370, 1570, 314, 1768, 367, 283, 27245, 27585, 7, 272, 2202, 14, 1907, 14, 1302, 63, 11375, 63, 9339, 275, 298, 8108, 27585, 2, 272, 327, 12030, 642, 370, 1570, 314, 1768, 367, 283, 6564, 600, 7, 272, 2202, 14, 1907, 14, 1302, 63, 1932, 600, 275, 298, 16977, 5495, 2, 339, 2202, 14, 1328, 14, 4365, 63, 4404, 6279, 63, 9339, 63, 10548, 275, 756, 272, 327, 15537, 370, 12230, 351, 272, 2202, 14, 1095, 14, 10443, 63, 890, 275, 377, 480, 23496, 531, 339, 327, 1910, 3349, 642, 370, 25540, 29554, 12403, 23923, 272, 327, 446, 781, 2934, 642, 641, 1380, 3879 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 893, 26, 272, 327, 2018, 499, 14, 23, 272, 687, 5055, 492, 8773, 199, 2590, 26, 272, 327, 2018, 499, 14, 22, 272, 687, 26752, 14, 2828, 14, 4129, 1001, 14, 8235, 63, 807, 492, 8773, 199, 199, 504, 2197, 492, 6871, 199, 199, 504, 26752, 492, 1453, 199, 504, 26752, 14, 1360, 492, 627, 199, 504, 26752, 14, 3494, 492, 10533, 199, 199, 504, 308, 19, 492, 308, 19, 63, 14584, 63, 13063, 199, 199, 318, 1101, 8, 1751, 304, 272, 408, 267, 5458, 367, 644, 1119, 31673, 13964, 6654, 1958, 19835, 5722, 334, 9004, 13, 32324, 9, 398, 1455, 921, 1190, 77, 26950, 14, 1308, 272, 408, 339, 377, 275, 1453, 14, 52, 272, 308, 19, 275, 1453, 14, 1310, 14, 83, 19, 339, 327, 13722, 272, 327, 5543, 13, 9606, 5434, 272, 2202, 14, 1095, 14, 657, 13817, 275, 1689, 45, 32324, 401, 298, 885, 15, 3707, 531, 339, 2202, 14, 1095, 14, 2253, 63, 354, 275, 377, 480, 51, 11326, 6738, 26, 644, 1119, 31673, 13964, 6654, 1958, 19835, 5722, 334, 9004, 13, 32324, 6320, 272, 2202, 14, 1095, 14, 2253, 63, 354, 63, 3612, 275, 377, 480, 51, 11326, 6738, 531, 339, 327, 26237, 272, 327, 6187, 13303, 272, 327, 13722, 272, 327, 21527, 13303, 272, 327, 20123, 883, 291, 13, 2683, 272, 327, 1751, 14, 4416, 14, 277, 63, 8054, 275, 756, 272, 327, 20123, 1929, 370, 4911, 3932, 3031, 272, 2202, 14, 1178, 14, 8054, 63, 6537, 63, 16257, 275, 715, 272, 327, 20123, 1929, 370, 506, 30055, 272, 2202, 14, 1178, 14, 8054, 63, 6537, 63, 28302, 275, 715, 272, 2202, 14, 1178, 14, 8054, 63, 6615, 63, 17425, 275, 715, 272, 2202, 14, 1178, 14, 8054, 63, 17425, 63, 2427, 275, 715, 339, 327, 19615, 637, 14931, 664, 4847, 370, 1006, 4628, 83, 272, 2202, 14, 1198, 14, 11227, 422, 275, 298, 14288, 2, 339, 2202, 14, 1178, 14, 8054, 63, 1073, 63, 751, 63, 475, 275, 2420, 7018, 582, 377, 480, 18963, 531, 93, 272, 2202, 14, 1178, 14, 8054, 63, 1073, 63, 751, 63, 475, 63, 885, 275, 2097, 7018, 937, 272, 2202, 14, 1178, 14, 8054, 63, 8050, 275, 2420, 17425, 63, 344, 582, 2097, 3791, 2255, 3147, 789, 339, 2202, 14, 1178, 14, 2384, 63, 5834, 63, 2743, 275, 756, 272, 2202, 14, 1178, 14, 2384, 63, 1073, 275, 756, 339, 327, 13722, 272, 327, 13863, 18141, 272, 2202, 14, 4416, 14, 3185, 275, 1520, 327, 14618, 16282, 12, 6801, 436, 6957, 16543, 83, 272, 2202, 14, 4416, 14, 1130, 275, 715, 339, 327, 13722, 272, 327, 23978, 334, 3741, 370, 675, 367, 6858, 15, 4209, 14, 1360, 9, 272, 2202, 14, 1095, 14, 7915, 275, 298, 45, 32324, 2, 272, 2202, 14, 1907, 14, 964, 2487, 63, 1143, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 964, 2487, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 1541, 63, 964, 2487, 275, 298, 11146, 2, 272, 2202, 14, 1907, 14, 8191, 63, 3070, 63, 1419, 275, 756, 272, 327, 1910, 3349, 370, 675, 428, 19, 3947, 5446, 3339, 641, 1006, 5978, 68, 23311, 334, 19767, 314, 3590, 20764, 2034, 1253, 12625, 11212, 3339, 18, 6938, 370, 642, 9, 272, 2202, 14, 1907, 14, 3029, 2416, 63, 3440, 275, 298, 1733, 2, 339, 327, 768, 1378, 2585, 26, 1010, 27174, 323, 272, 2202, 14, 1907, 14, 1180, 63, 3887, 63, 16471, 275, 715, 339, 327, 8388, 7016, 3992, 272, 2202, 14, 1907, 14, 4229, 63, 16471, 275, 469, 267, 298, 9241, 582, 298, 4677, 13, 9241, 401, 267, 298, 17952, 582, 298, 4677, 13, 17952, 401, 267, 298, 7811, 582, 298, 4677, 13, 7811, 401, 267, 298, 29811, 582, 298, 4677, 13, 29811, 401, 267, 298, 1927, 582, 298, 4677, 13, 87, 15148, 401, 267, 298, 5054, 582, 298, 4677, 13, 5054, 401, 272, 789, 339, 327, 1910, 3349, 370, 2498, 282, 849, 9311, 5528, 315, 18042, 1218, 15, 873, 4513, 272, 2202, 14, 1907, 14, 885, 63, 6406, 63, 3887, 275, 715, 339, 327, 1910, 3349, 370, 3507, 9163, 3398, 5953, 402, 6394, 292, 5921, 272, 327, 446, 5289, 1909, 5133, 12470, 272, 2202, 14, 1907, 14, 4616, 292, 5921, 63, 3853, 3398, 275, 756, 339, 327, 1751, 14, 5668, 14, 1130, 63, 3333, 275, 11624, 272, 327, 1751, 14, 5668, 14, 1130, 63, 2063, 275, 1695, 1477, 339, 327, 13722, 272, 327, 491, 709, 78, 334, 5339, 2072, 9, 2202, 272, 2202, 14, 44, 709, 78, 14, 13209, 275, 8773, 779, 267, 1689, 287, 401, 298, 19410, 1288, 272, 4794, 272, 327, 3758, 8466, 272, 2202, 14, 44, 709, 78, 14, 885, 63, 3671, 275, 298, 287, 2, 272, 327, 3758, 7137, 367, 4390, 272, 2202, 14, 44, 709, 78, 14, 5834, 63, 2743, 275, 3905, 25822, 2, 272, 327, 15254, 361, 461, 283, 9118, 7, 1434, 1475, 272, 2202, 14, 44, 709, 78, 14, 602, 63, 908, 275, 2071, 66, 450, 68, 450, 57, 2, 272, 327, 4860, 6752, 334, 4322, 370, 9055, 7105, 13, 16, 9, 272, 327, 6345, 9432, 367, 5579, 334, 4322, 370, 2360, 9, 272, 2202, 14, 44, 709, 78, 14, 6355, 63, 9896, 275, 14530, 272, 327, 18049, 527, 5915, 9432, 367, 5579, 334, 4322, 370, 4601, 9, 272, 2202, 14, 44, 709, 78, 14, 273, 29737, 63, 9896, 275, 21147, 272, 327, 3758, 19453, 5495, 367, 14001, 9339, 5579, 272, 2202, 14, 44, 709, 78, 14, 885, 63, 6063, 63, 600, 275, 413, 272, 327, 12030, 642, 370, 1570, 314, 1768, 367, 283, 27245, 27585, 7, 272, 2202, 14, 1907, 14, 1302, 63, 11375, 63, 9339, 275, 298, 8108, 27585, 2, 272, 327, 12030, 642, 370, 1570, 314, 1768, 367, 283, 6564, 600, 7, 272, 2202, 14, 1907, 14, 1302, 63, 1932, 600, 275, 298, 16977, 5495, 2, 339, 2202, 14, 1328, 14, 4365, 63, 4404, 6279, 63, 9339, 63, 10548, 275, 756, 272, 327, 15537, 370, 12230, 351, 272, 2202, 14, 1095, 14, 10443, 63, 890, 275, 377, 480, 23496, 531, 339, 327, 1910, 3349, 642, 370, 25540, 29554, 12403, 23923, 272, 327, 446, 781, 2934, 642, 641, 1380, 3879, 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, 1 ]
mikalstill/nova
nova/tests/unit/virt/xenapi/test_agent.py
5
18464
# Copyright 2013 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. import base64 import time import mock from os_xenapi.client import host_agent from os_xenapi.client import XenAPI from oslo_utils import uuidutils from nova import exception from nova import test from nova.virt.xenapi import agent def _get_fake_instance(**kwargs): system_metadata = [] for k, v in kwargs.items(): system_metadata.append({ "key": k, "value": v }) return { "system_metadata": system_metadata, "uuid": "uuid", "key_data": "ssh-rsa asdf", "os_type": "asdf", } class AgentTestCaseBase(test.NoDBTestCase): def _create_agent(self, instance, session="session"): self.session = session self.virtapi = "virtapi" self.vm_ref = "vm_ref" return agent.XenAPIBasedAgent(self.session, self.virtapi, instance, self.vm_ref) class AgentImageFlagsTestCase(AgentTestCaseBase): def test_agent_is_present(self): self.flags(use_agent_default=False, group='xenserver') instance = {"system_metadata": [{"key": "image_xenapi_use_agent", "value": "true"}]} self.assertTrue(agent.should_use_agent(instance)) def test_agent_is_disabled(self): self.flags(use_agent_default=True, group='xenserver') instance = {"system_metadata": [{"key": "image_xenapi_use_agent", "value": "false"}]} self.assertFalse(agent.should_use_agent(instance)) def test_agent_uses_deafault_when_prop_invalid(self): self.flags(use_agent_default=True, group='xenserver') instance = {"system_metadata": [{"key": "image_xenapi_use_agent", "value": "bob"}], "uuid": "uuid"} self.assertTrue(agent.should_use_agent(instance)) def test_agent_default_not_present(self): self.flags(use_agent_default=False, group='xenserver') instance = {"system_metadata": []} self.assertFalse(agent.should_use_agent(instance)) def test_agent_default_present(self): self.flags(use_agent_default=True, group='xenserver') instance = {"system_metadata": []} self.assertTrue(agent.should_use_agent(instance)) class SysMetaKeyTestBase(object): key = None def _create_agent_with_value(self, value): kwargs = {self.key: value} instance = _get_fake_instance(**kwargs) return self._create_agent(instance) def test_get_sys_meta_key_true(self): agent = self._create_agent_with_value("true") self.assertTrue(agent._get_sys_meta_key(self.key)) def test_get_sys_meta_key_false(self): agent = self._create_agent_with_value("False") self.assertFalse(agent._get_sys_meta_key(self.key)) def test_get_sys_meta_key_invalid_is_false(self): agent = self._create_agent_with_value("invalid") self.assertFalse(agent._get_sys_meta_key(self.key)) def test_get_sys_meta_key_missing_is_false(self): instance = _get_fake_instance() agent = self._create_agent(instance) self.assertFalse(agent._get_sys_meta_key(self.key)) class SkipSshFlagTestCase(SysMetaKeyTestBase, AgentTestCaseBase): key = "image_xenapi_skip_agent_inject_ssh" def test_skip_ssh_key_inject(self): agent = self._create_agent_with_value("True") self.assertTrue(agent._skip_ssh_key_inject()) class SkipFileInjectAtBootFlagTestCase(SysMetaKeyTestBase, AgentTestCaseBase): key = "image_xenapi_skip_agent_inject_files_at_boot" def test_skip_inject_files_at_boot(self): agent = self._create_agent_with_value("True") self.assertTrue(agent._skip_inject_files_at_boot()) class InjectSshTestCase(AgentTestCaseBase): @mock.patch.object(agent.XenAPIBasedAgent, 'inject_file') def test_inject_ssh_key_succeeds(self, mock_inject_file): instance = _get_fake_instance() agent = self._create_agent(instance) agent.inject_ssh_key() mock_inject_file.assert_called_once_with("/root/.ssh/authorized_keys", "\n# The following ssh key " "was injected by Nova" "\nssh-rsa asdf\n") @mock.patch.object(agent.XenAPIBasedAgent, 'inject_file') def _test_inject_ssh_key_skipped(self, instance, mock_inject_file): agent = self._create_agent(instance) # make sure its not called agent.inject_ssh_key() mock_inject_file.assert_not_called() def test_inject_ssh_key_skipped_no_key_data(self): instance = _get_fake_instance() instance["key_data"] = None self._test_inject_ssh_key_skipped(instance) def test_inject_ssh_key_skipped_windows(self): instance = _get_fake_instance() instance["os_type"] = "windows" self._test_inject_ssh_key_skipped(instance) def test_inject_ssh_key_skipped_cloud_init_present(self): instance = _get_fake_instance( image_xenapi_skip_agent_inject_ssh="True") self._test_inject_ssh_key_skipped(instance) class FileInjectionTestCase(AgentTestCaseBase): @mock.patch.object(agent.XenAPIBasedAgent, '_call_agent') def test_inject_file(self, mock_call_agent): instance = _get_fake_instance() agent = self._create_agent(instance) b64_path = base64.b64encode(b'path') b64_contents = base64.b64encode(b'contents') agent.inject_file("path", "contents") mock_call_agent.assert_called_once_with(host_agent.inject_file, {'b64_contents': b64_contents, 'b64_path': b64_path}) @mock.patch.object(agent.XenAPIBasedAgent, 'inject_file') def test_inject_files(self, mock_inject_file): instance = _get_fake_instance() agent = self._create_agent(instance) files = [("path1", "content1"), ("path2", "content2")] agent.inject_files(files) mock_inject_file.assert_has_calls( [mock.call("path1", "content1"), mock.call("path2", "content2")]) @mock.patch.object(agent.XenAPIBasedAgent, 'inject_file') def test_inject_files_skipped_when_cloud_init_installed(self, mock_inject_file): instance = _get_fake_instance( image_xenapi_skip_agent_inject_files_at_boot="True") agent = self._create_agent(instance) files = [("path1", "content1"), ("path2", "content2")] agent.inject_files(files) mock_inject_file.assert_not_called() class RebootRetryTestCase(AgentTestCaseBase): @mock.patch.object(agent, '_wait_for_new_dom_id') def test_retry_on_reboot(self, mock_wait): mock_session = mock.Mock() mock_session.VM.get_domid.return_value = "fake_dom_id" agent = self._create_agent(None, mock_session) mock_method = mock.Mock().method() mock_method.side_effect = [XenAPI.Failure(["REBOOT: fake"]), {"returncode": '0', "message": "done"}] result = agent._call_agent(mock_method) self.assertEqual("done", result) self.assertTrue(mock_session.VM.get_domid.called) self.assertEqual(2, mock_method.call_count) mock_wait.assert_called_once_with(mock_session, self.vm_ref, "fake_dom_id", mock_method) @mock.patch.object(time, 'sleep') @mock.patch.object(time, 'time') def test_wait_for_new_dom_id_found(self, mock_time, mock_sleep): mock_session = mock.Mock() mock_session.VM.get_domid.return_value = "new" agent._wait_for_new_dom_id(mock_session, "vm_ref", "old", "method") mock_session.VM.get_domid.assert_called_once_with("vm_ref") self.assertFalse(mock_sleep.called) @mock.patch.object(time, 'sleep') @mock.patch.object(time, 'time') def test_wait_for_new_dom_id_after_retry(self, mock_time, mock_sleep): self.flags(agent_timeout=3, group="xenserver") mock_time.return_value = 0 mock_session = mock.Mock() old = "40" new = "42" mock_session.VM.get_domid.side_effect = [old, "-1", new] agent._wait_for_new_dom_id(mock_session, "vm_ref", old, "method") mock_session.VM.get_domid.assert_called_with("vm_ref") self.assertEqual(3, mock_session.VM.get_domid.call_count) self.assertEqual(2, mock_sleep.call_count) @mock.patch.object(time, 'sleep') @mock.patch.object(time, 'time') def test_wait_for_new_dom_id_timeout(self, mock_time, mock_sleep): self.flags(agent_timeout=3, group="xenserver") def fake_time(): fake_time.time = fake_time.time + 1 return fake_time.time fake_time.time = 0 mock_time.side_effect = fake_time mock_session = mock.Mock() mock_session.VM.get_domid.return_value = "old" mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self.assertRaises(exception.AgentTimeout, agent._wait_for_new_dom_id, mock_session, "vm_ref", "old", mock_method) self.assertEqual(4, mock_session.VM.get_domid.call_count) class SetAdminPasswordTestCase(AgentTestCaseBase): @mock.patch.object(agent.XenAPIBasedAgent, '_call_agent') @mock.patch("nova.virt.xenapi.agent.SimpleDH") def test_exchange_key_with_agent(self, mock_simple_dh, mock_call_agent): agent = self._create_agent(None) instance_mock = mock_simple_dh() instance_mock.get_public.return_value = 4321 mock_call_agent.return_value = "1234" result = agent._exchange_key_with_agent() mock_call_agent.assert_called_once_with(host_agent.key_init, {"pub": "4321"}, success_codes=['D0'], ignore_errors=False) result.compute_shared.assert_called_once_with(1234) @mock.patch.object(agent.XenAPIBasedAgent, '_call_agent') @mock.patch.object(agent.XenAPIBasedAgent, '_save_instance_password_if_sshkey_present') @mock.patch.object(agent.XenAPIBasedAgent, '_exchange_key_with_agent') def test_set_admin_password_works(self, mock_exchange, mock_save, mock_call_agent): mock_dh = mock.Mock(spec_set=agent.SimpleDH) mock_dh.encrypt.return_value = "enc_pass" mock_exchange.return_value = mock_dh agent_inst = self._create_agent(None) agent_inst.set_admin_password("new_pass") mock_dh.encrypt.assert_called_once_with("new_pass\n") mock_call_agent.assert_called_once_with(host_agent.password, {'enc_pass': 'enc_pass'}) mock_save.assert_called_once_with("new_pass") @mock.patch.object(agent.XenAPIBasedAgent, '_add_instance_fault') @mock.patch.object(agent.XenAPIBasedAgent, '_exchange_key_with_agent') def test_set_admin_password_silently_fails(self, mock_exchange, mock_add_fault): error = exception.AgentTimeout(method="fake") mock_exchange.side_effect = error agent_inst = self._create_agent(None) agent_inst.set_admin_password("new_pass") mock_add_fault.assert_called_once_with(error, mock.ANY) class UpgradeRequiredTestCase(test.NoDBTestCase): def test_less_than(self): self.assertTrue(agent.is_upgrade_required('1.2.3.4', '1.2.3.5')) def test_greater_than(self): self.assertFalse(agent.is_upgrade_required('1.2.3.5', '1.2.3.4')) def test_equal(self): self.assertFalse(agent.is_upgrade_required('1.2.3.4', '1.2.3.4')) def test_non_lexical(self): self.assertFalse(agent.is_upgrade_required('1.2.3.10', '1.2.3.4')) def test_length(self): self.assertTrue(agent.is_upgrade_required('1.2.3', '1.2.3.4')) @mock.patch.object(uuidutils, 'generate_uuid') class CallAgentTestCase(AgentTestCaseBase): def test_call_agent_success(self, mock_uuid): session = mock.Mock() instance = {"uuid": "fake"} addl_args = {"foo": "bar"} session.VM.get_domid.return_value = '42' mock_uuid.return_value = 1 mock_method = mock.Mock().method() mock_method.return_value = {'returncode': '4', 'message': "asdf\\r\\n"} mock_method.__name__ = "mock_method" self.assertEqual("asdf", agent._call_agent(session, instance, "vm_ref", mock_method, addl_args, timeout=300, success_codes=['0', '4'])) expected_args = {} expected_args.update(addl_args) mock_method.assert_called_once_with(session, 1, '42', 300, **expected_args) session.VM.get_domid.assert_called_once_with("vm_ref") def _call_agent_setup(self, session, mock_uuid, mock_method, returncode='0', success_codes=None, exception=None): session.XenAPI.Failure = XenAPI.Failure instance = {"uuid": "fake"} addl_args = {"foo": "bar"} session.VM.get_domid.return_value = "42" mock_uuid.return_value = 1 if exception: mock_method.side_effect = exception else: mock_method.return_value = {'returncode': returncode, 'message': "asdf\\r\\n"} return agent._call_agent(session, instance, "vm_ref", mock_method, addl_args, success_codes=success_codes) def _assert_agent_called(self, session, mock_uuid, mock_method): expected_args = {"foo": "bar"} mock_uuid.assert_called_once_with() mock_method.assert_called_once_with(session, 1, '42', 30, **expected_args) session.VM.get_domid.assert_called_once_with("vm_ref") def test_call_agent_works_with_defaults(self, mock_uuid): session = mock.Mock() mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self._call_agent_setup(session, mock_uuid, mock_method) self._assert_agent_called(session, mock_uuid, mock_method) def test_call_agent_fails_with_timeout(self, mock_uuid): session = mock.Mock() mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self.assertRaises(exception.AgentTimeout, self._call_agent_setup, session, mock_uuid, mock_method, exception=XenAPI.Failure(["TIMEOUT:fake"])) self._assert_agent_called(session, mock_uuid, mock_method) def test_call_agent_fails_with_not_implemented(self, mock_uuid): session = mock.Mock() mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self.assertRaises(exception.AgentNotImplemented, self._call_agent_setup, session, mock_uuid, mock_method, exception=XenAPI.Failure(["NOT IMPLEMENTED:"])) self._assert_agent_called(session, mock_uuid, mock_method) def test_call_agent_fails_with_other_error(self, mock_uuid): session = mock.Mock() mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self.assertRaises(exception.AgentError, self._call_agent_setup, session, mock_uuid, mock_method, exception=XenAPI.Failure(["asdf"])) self._assert_agent_called(session, mock_uuid, mock_method) def test_call_agent_fails_with_returned_error(self, mock_uuid): session = mock.Mock() mock_method = mock.Mock().method() mock_method.__name__ = "mock_method" self.assertRaises(exception.AgentError, self._call_agent_setup, session, mock_uuid, mock_method, returncode='42') self._assert_agent_called(session, mock_uuid, mock_method) class XenAPIBasedAgent(AgentTestCaseBase): @mock.patch.object(agent.XenAPIBasedAgent, "_add_instance_fault") @mock.patch.object(agent, "_call_agent") def test_call_agent_swallows_error(self, mock_call_agent, mock_add_instance_fault): fake_error = exception.AgentError(method="bob") mock_call_agent.side_effect = fake_error instance = _get_fake_instance() agent = self._create_agent(instance) agent._call_agent("bob") mock_call_agent.assert_called_once_with(agent.session, agent.instance, agent.vm_ref, "bob", None, None, None) mock_add_instance_fault.assert_called_once_with(fake_error, mock.ANY) @mock.patch.object(agent.XenAPIBasedAgent, "_add_instance_fault") @mock.patch.object(agent, "_call_agent") def test_call_agent_throws_error(self, mock_call_agent, mock_add_instance_fault): fake_error = exception.AgentError(method="bob") mock_call_agent.side_effect = fake_error instance = _get_fake_instance() agent = self._create_agent(instance) self.assertRaises(exception.AgentError, agent._call_agent, "bob", ignore_errors=False) mock_call_agent.assert_called_once_with(agent.session, agent.instance, agent.vm_ref, "bob", None, None, None) self.assertFalse(mock_add_instance_fault.called)
apache-2.0
[ 3, 1898, 6171, 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, 646, 1300, 772, 199, 646, 900, 199, 199, 646, 1683, 199, 504, 747, 63, 20392, 14, 1258, 492, 1591, 63, 4054, 199, 504, 747, 63, 20392, 14, 1258, 492, 30211, 3735, 199, 504, 11258, 63, 1208, 492, 5377, 1208, 199, 199, 504, 5913, 492, 1919, 199, 504, 5913, 492, 511, 199, 504, 5913, 14, 4549, 14, 20392, 492, 6631, 421, 199, 318, 485, 362, 63, 3183, 63, 842, 3682, 958, 304, 272, 2656, 63, 2343, 275, 942, 272, 367, 1022, 12, 373, 315, 2074, 14, 1744, 837, 267, 2656, 63, 2343, 14, 740, 2561, 288, 298, 498, 582, 1022, 12, 288, 298, 585, 582, 373, 267, 3828, 339, 372, 469, 267, 298, 2253, 63, 2343, 582, 2656, 63, 2343, 12, 267, 298, 2580, 582, 298, 2580, 401, 267, 298, 498, 63, 576, 582, 298, 5510, 13, 13487, 465, 1587, 401, 267, 298, 736, 63, 466, 582, 298, 18196, 401, 272, 789, 421, 199, 533, 19866, 1746, 1563, 8, 396, 14, 32437, 304, 272, 347, 485, 981, 63, 4054, 8, 277, 12, 1256, 12, 2351, 628, 1730, 2349, 267, 291, 14, 1730, 275, 2351, 267, 291, 14, 4549, 1246, 275, 298, 4549, 1246, 2, 267, 291, 14, 2611, 63, 1121, 275, 298, 2611, 63, 1121, 2, 267, 372, 6631, 14, 30643, 3735, 20409, 7788, 8, 277, 14, 1730, 12, 291, 14, 4549, 1246, 12, 4228, 1256, 12, 291, 14, 2611, 63, 1121, 9, 421, 199, 533, 19866, 3491, 6381, 1746, 8, 7788, 1746, 1563, 304, 272, 347, 511, 63, 4054, 63, 374, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 797, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 2052, 3570, 9420, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 374, 63, 7011, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 3910, 3570, 9420, 267, 291, 14, 3334, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 5589, 63, 25395, 1879, 63, 6526, 63, 4469, 63, 3197, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 7913, 3570, 467, 288, 298, 2580, 582, 298, 2580, 3570, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 885, 63, 1397, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 797, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 23455, 267, 291, 14, 3334, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 885, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 23455, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 421, 199, 533, 28766, 3396, 1197, 14440, 8, 785, 304, 272, 790, 275, 488, 339, 347, 485, 981, 63, 4054, 63, 1045, 63, 585, 8, 277, 12, 574, 304, 267, 2074, 275, 469, 277, 14, 498, 26, 574, 93, 267, 1256, 275, 485, 362, 63, 3183, 63, 842, 3682, 958, 9, 267, 372, 291, 423, 981, 63, 4054, 8, 842, 9, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 2052, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 2052, 531, 267, 291, 14, 1815, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 3910, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 797, 531, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 3197, 63, 374, 63, 3910, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 3197, 531, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 4752, 63, 374, 63, 3910, 8, 277, 304, 267, 1256, 275, 485, 362, 63, 3183, 63, 842, 342, 267, 6631, 275, 291, 423, 981, 63, 4054, 8, 842, 9, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 421, 199, 533, 8232, 51, 609, 5318, 1746, 8, 11319 ]
[ 1898, 6171, 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, 646, 1300, 772, 199, 646, 900, 199, 199, 646, 1683, 199, 504, 747, 63, 20392, 14, 1258, 492, 1591, 63, 4054, 199, 504, 747, 63, 20392, 14, 1258, 492, 30211, 3735, 199, 504, 11258, 63, 1208, 492, 5377, 1208, 199, 199, 504, 5913, 492, 1919, 199, 504, 5913, 492, 511, 199, 504, 5913, 14, 4549, 14, 20392, 492, 6631, 421, 199, 318, 485, 362, 63, 3183, 63, 842, 3682, 958, 304, 272, 2656, 63, 2343, 275, 942, 272, 367, 1022, 12, 373, 315, 2074, 14, 1744, 837, 267, 2656, 63, 2343, 14, 740, 2561, 288, 298, 498, 582, 1022, 12, 288, 298, 585, 582, 373, 267, 3828, 339, 372, 469, 267, 298, 2253, 63, 2343, 582, 2656, 63, 2343, 12, 267, 298, 2580, 582, 298, 2580, 401, 267, 298, 498, 63, 576, 582, 298, 5510, 13, 13487, 465, 1587, 401, 267, 298, 736, 63, 466, 582, 298, 18196, 401, 272, 789, 421, 199, 533, 19866, 1746, 1563, 8, 396, 14, 32437, 304, 272, 347, 485, 981, 63, 4054, 8, 277, 12, 1256, 12, 2351, 628, 1730, 2349, 267, 291, 14, 1730, 275, 2351, 267, 291, 14, 4549, 1246, 275, 298, 4549, 1246, 2, 267, 291, 14, 2611, 63, 1121, 275, 298, 2611, 63, 1121, 2, 267, 372, 6631, 14, 30643, 3735, 20409, 7788, 8, 277, 14, 1730, 12, 291, 14, 4549, 1246, 12, 4228, 1256, 12, 291, 14, 2611, 63, 1121, 9, 421, 199, 533, 19866, 3491, 6381, 1746, 8, 7788, 1746, 1563, 304, 272, 347, 511, 63, 4054, 63, 374, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 797, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 2052, 3570, 9420, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 374, 63, 7011, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 3910, 3570, 9420, 267, 291, 14, 3334, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 5589, 63, 25395, 1879, 63, 6526, 63, 4469, 63, 3197, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 288, 16870, 498, 582, 298, 1569, 63, 20392, 63, 1180, 63, 4054, 401, 298, 585, 582, 298, 7913, 3570, 467, 288, 298, 2580, 582, 298, 2580, 3570, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 885, 63, 1397, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 797, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 23455, 267, 291, 14, 3334, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 339, 347, 511, 63, 4054, 63, 885, 63, 1881, 8, 277, 304, 267, 291, 14, 2469, 8, 1180, 63, 4054, 63, 885, 29, 549, 12, 1572, 534, 13615, 1000, 358, 267, 1256, 275, 2420, 2253, 63, 2343, 582, 23455, 267, 291, 14, 1815, 8, 4054, 14, 5626, 63, 1180, 63, 4054, 8, 842, 430, 421, 199, 533, 28766, 3396, 1197, 14440, 8, 785, 304, 272, 790, 275, 488, 339, 347, 485, 981, 63, 4054, 63, 1045, 63, 585, 8, 277, 12, 574, 304, 267, 2074, 275, 469, 277, 14, 498, 26, 574, 93, 267, 1256, 275, 485, 362, 63, 3183, 63, 842, 3682, 958, 9, 267, 372, 291, 423, 981, 63, 4054, 8, 842, 9, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 2052, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 2052, 531, 267, 291, 14, 1815, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 3910, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 797, 531, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 3197, 63, 374, 63, 3910, 8, 277, 304, 267, 6631, 275, 291, 423, 981, 63, 4054, 63, 1045, 63, 585, 480, 3197, 531, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 339, 347, 511, 63, 362, 63, 1274, 63, 2024, 63, 498, 63, 4752, 63, 374, 63, 3910, 8, 277, 304, 267, 1256, 275, 485, 362, 63, 3183, 63, 842, 342, 267, 6631, 275, 291, 423, 981, 63, 4054, 8, 842, 9, 267, 291, 14, 3334, 8, 4054, 423, 362, 63, 1274, 63, 2024, 63, 498, 8, 277, 14, 498, 430, 421, 199, 533, 8232, 51, 609, 5318, 1746, 8, 11319, 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, 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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 ]
stamhe/zulip
api/integrations/codebase/zulip_codebase_config.py
124
2537
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2014 Zulip, Inc. # # 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. # Change these values to configure authentication for your codebase account # Note that this is the Codebase API Username, found in the Settings page # for your account CODEBASE_API_USERNAME = "foo@example.com" CODEBASE_API_KEY = "1234561234567abcdef" # The URL of your codebase setup CODEBASE_ROOT_URL = "https://YOUR_COMPANY.codebasehq.com" # When initially started, how many hours of messages to include. # Note that the Codebase API only returns the 20 latest events, # if you have more than 20 events that fit within this window, # earlier ones may be lost CODEBASE_INITIAL_HISTORY_HOURS = 12 # Change these values to configure Zulip authentication for the plugin ZULIP_USER = "codebase-bot@example.com" ZULIP_API_KEY = "0123456789abcdef0123456789abcdef" # The streams to send commit information and ticket information to ZULIP_COMMITS_STREAM_NAME = "codebase" ZULIP_TICKETS_STREAM_NAME = "tickets" # If properly installed, the Zulip API should be in your import # path, but if not, set a custom path below ZULIP_API_PATH = None # Set this to your Zulip API server URI ZULIP_SITE = "https://api.zulip.com" # If you wish to log to a file rather than stdout/stderr, # please fill this out your desired path LOG_FILE = None # This file is used to resume this mirror in case the script shuts down. # It is required and needs to be writeable. RESUME_FILE = "/var/tmp/zulip_codebase.state"
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 22405, 103, 6927, 3107, 11294, 12, 3277, 14, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 3, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 3, 315, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 3, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 3, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 199, 3, 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, 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, 199, 3, 2334, 4141, 14, 4388, 199, 3, 7743, 3520, 1338, 370, 7908, 6299, 367, 2195, 1233, 1095, 2933, 199, 3, 3390, 626, 642, 365, 314, 5495, 1095, 3261, 29739, 12, 1911, 315, 314, 13303, 2034, 199, 3, 367, 2195, 2933, 199, 6012, 5825, 63, 3735, 63, 11958, 275, 298, 1421, 32, 2694, 14, 957, 2, 199, 6012, 5825, 63, 3735, 63, 3078, 275, 298, 19060, 30217, 10678, 2, 199, 199, 3, 710, 2851, 402, 2195, 1233, 1095, 3272, 199, 6012, 5825, 63, 5441, 63, 2632, 275, 298, 2859, 921, 57, 11237, 63, 6790, 8974, 14, 600, 1095, 21550, 14, 957, 2, 199, 199, 3, 3979, 22801, 8239, 12, 4212, 5002, 10857, 402, 3788, 370, 2387, 14, 199, 3, 3390, 626, 314, 5495, 1095, 3261, 1454, 2529, 314, 3388, 8839, 4474, 12, 199, 3, 340, 1265, 1172, 1655, 2419, 3388, 4474, 626, 5542, 4453, 642, 4353, 12, 199, 3, 14119, 7869, 1443, 506, 14669, 199, 6012, 5825, 63, 13768, 63, 30895, 63, 2979, 28746, 275, 3144, 199, 199, 3, 7743, 3520, 1338, 370, 7908, 3107, 11294, 6299, 367, 314, 3589, 199, 58, 1293, 1772, 63, 3791, 275, 298, 600, 1095, 13, 3018, 32, 2694, 14, 957, 2, 199, 58, 1293, 1772, 63, 3735, 63, 3078, 275, 298, 11371, 10678, 11371, 10678, 2, 199, 199, 3, 710, 13788, 370, 3222, 5532, 2556, 436, 12052, 2556, 370, 199, 58, 1293, 1772, 63, 5378, 5930, 63, 9484, 63, 2339, 275, 298, 600, 1095, 2, 199, 58, 1293, 1772, 63, 52, 13884, 30416, 63, 9484, 63, 2339, 275, 298, 9201, 83, 2, 199, 199, 3, 982, 7684, 4903, 12, 314, 3107, 11294, 3261, 1077, 506, 315, 2195, 492, 199, 3, 931, 12, 1325, 340, 440, 12, 663, 282, 3537, 931, 5084, 199, 58, 1293, 1772, 63, 3735, 63, 3243, 275, 488, 199, 199, 3, 2494, 642, 370, 2195, 3107, 11294, 3261, 1654, 9022, 199, 58, 1293, 1772, 63, 7917, 275, 298, 2859, 921, 1246, 14, 14548, 14, 957, 2, 199, 199, 3, 982, 1265, 13809, 370, 943, 370, 282, 570, 7830, 2419, 3839, 15, 3083, 12, 199, 3, 8749, 5554, 642, 734, 2195, 6387, 931, 199, 4947, 63, 3817, 275, 488, 199, 199, 3, 961, 570, 365, 1202, 370, 14604, 642, 15216, 315, 1930, 314, 2884, 1033, 14608, 3224, 14, 199, 3, 2779, 365, 1415, 436, 4839, 370, 506, 2218, 461, 14, 199, 3830, 13847, 63, 3817, 275, 3286, 1391, 15, 2791, 15, 14548, 63, 600, 1095, 14, 929, 2, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 22405, 103, 6927, 3107, 11294, 12, 3277, 14, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 3, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 3, 315, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 3, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 3, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 199, 3, 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, 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, 199, 3, 2334, 4141, 14, 4388, 199, 3, 7743, 3520, 1338, 370, 7908, 6299, 367, 2195, 1233, 1095, 2933, 199, 3, 3390, 626, 642, 365, 314, 5495, 1095, 3261, 29739, 12, 1911, 315, 314, 13303, 2034, 199, 3, 367, 2195, 2933, 199, 6012, 5825, 63, 3735, 63, 11958, 275, 298, 1421, 32, 2694, 14, 957, 2, 199, 6012, 5825, 63, 3735, 63, 3078, 275, 298, 19060, 30217, 10678, 2, 199, 199, 3, 710, 2851, 402, 2195, 1233, 1095, 3272, 199, 6012, 5825, 63, 5441, 63, 2632, 275, 298, 2859, 921, 57, 11237, 63, 6790, 8974, 14, 600, 1095, 21550, 14, 957, 2, 199, 199, 3, 3979, 22801, 8239, 12, 4212, 5002, 10857, 402, 3788, 370, 2387, 14, 199, 3, 3390, 626, 314, 5495, 1095, 3261, 1454, 2529, 314, 3388, 8839, 4474, 12, 199, 3, 340, 1265, 1172, 1655, 2419, 3388, 4474, 626, 5542, 4453, 642, 4353, 12, 199, 3, 14119, 7869, 1443, 506, 14669, 199, 6012, 5825, 63, 13768, 63, 30895, 63, 2979, 28746, 275, 3144, 199, 199, 3, 7743, 3520, 1338, 370, 7908, 3107, 11294, 6299, 367, 314, 3589, 199, 58, 1293, 1772, 63, 3791, 275, 298, 600, 1095, 13, 3018, 32, 2694, 14, 957, 2, 199, 58, 1293, 1772, 63, 3735, 63, 3078, 275, 298, 11371, 10678, 11371, 10678, 2, 199, 199, 3, 710, 13788, 370, 3222, 5532, 2556, 436, 12052, 2556, 370, 199, 58, 1293, 1772, 63, 5378, 5930, 63, 9484, 63, 2339, 275, 298, 600, 1095, 2, 199, 58, 1293, 1772, 63, 52, 13884, 30416, 63, 9484, 63, 2339, 275, 298, 9201, 83, 2, 199, 199, 3, 982, 7684, 4903, 12, 314, 3107, 11294, 3261, 1077, 506, 315, 2195, 492, 199, 3, 931, 12, 1325, 340, 440, 12, 663, 282, 3537, 931, 5084, 199, 58, 1293, 1772, 63, 3735, 63, 3243, 275, 488, 199, 199, 3, 2494, 642, 370, 2195, 3107, 11294, 3261, 1654, 9022, 199, 58, 1293, 1772, 63, 7917, 275, 298, 2859, 921, 1246, 14, 14548, 14, 957, 2, 199, 199, 3, 982, 1265, 13809, 370, 943, 370, 282, 570, 7830, 2419, 3839, 15, 3083, 12, 199, 3, 8749, 5554, 642, 734, 2195, 6387, 931, 199, 4947, 63, 3817, 275, 488, 199, 199, 3, 961, 570, 365, 1202, 370, 14604, 642, 15216, 315, 1930, 314, 2884, 1033, 14608, 3224, 14, 199, 3, 2779, 365, 1415, 436, 4839, 370, 506, 2218, 461, 14, 199, 3830, 13847, 63, 3817, 275, 3286, 1391, 15, 2791, 15, 14548, 63, 600, 1095, 14, 929, 2, 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, 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,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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 ]
TNT-Samuel/Coding-Projects
DNS Server/Source - Copy/Lib/encodings/euc_kr.py
816
1027
# # euc_kr.py: Python Unicode Codec for EUC_KR # # Written by Hye-Shik Chang <perky@FreeBSD.org> # import _codecs_kr, codecs import _multibytecodec as mbc codec = _codecs_kr.getcodec('euc_kr') class Codec(codecs.Codec): encode = codec.encode decode = codec.decode class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): codec = codec class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec = codec class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): codec = codec class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): codec = codec def getregentry(): return codecs.CodecInfo( name='euc_kr', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, )
gpl-3.0
[ 3, 199, 3, 325, 947, 63, 16779, 14, 647, 26, 2018, 6140, 13732, 367, 662, 13371, 63, 23063, 199, 3, 199, 3, 27694, 701, 869, 8048, 13, 2662, 3258, 2799, 621, 665, 529, 10562, 32, 10146, 15400, 14, 1308, 30, 199, 3, 199, 199, 646, 485, 8933, 63, 16779, 12, 6010, 199, 646, 485, 3029, 4414, 9276, 465, 333, 3776, 199, 199, 9276, 275, 485, 8933, 63, 16779, 14, 362, 9276, 360, 15149, 63, 16779, 358, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 272, 3752, 275, 9076, 14, 2143, 272, 4849, 275, 9076, 14, 2708, 199, 199, 533, 24350, 8, 887, 67, 14, 3947, 4414, 17016, 12, 586, 6010, 14, 17016, 304, 272, 9076, 275, 9076, 199, 199, 533, 24385, 8, 887, 67, 14, 3947, 4414, 16703, 12, 586, 6010, 14, 16703, 304, 272, 9076, 275, 9076, 199, 199, 533, 22970, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16132, 12, 6010, 14, 16132, 304, 272, 9076, 275, 9076, 199, 199, 533, 24163, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16551, 12, 6010, 14, 16551, 304, 272, 9076, 275, 9076, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 15149, 63, 16779, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 325, 947, 63, 16779, 14, 647, 26, 2018, 6140, 13732, 367, 662, 13371, 63, 23063, 199, 3, 199, 3, 27694, 701, 869, 8048, 13, 2662, 3258, 2799, 621, 665, 529, 10562, 32, 10146, 15400, 14, 1308, 30, 199, 3, 199, 199, 646, 485, 8933, 63, 16779, 12, 6010, 199, 646, 485, 3029, 4414, 9276, 465, 333, 3776, 199, 199, 9276, 275, 485, 8933, 63, 16779, 14, 362, 9276, 360, 15149, 63, 16779, 358, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 272, 3752, 275, 9076, 14, 2143, 272, 4849, 275, 9076, 14, 2708, 199, 199, 533, 24350, 8, 887, 67, 14, 3947, 4414, 17016, 12, 586, 6010, 14, 17016, 304, 272, 9076, 275, 9076, 199, 199, 533, 24385, 8, 887, 67, 14, 3947, 4414, 16703, 12, 586, 6010, 14, 16703, 304, 272, 9076, 275, 9076, 199, 199, 533, 22970, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16132, 12, 6010, 14, 16132, 304, 272, 9076, 275, 9076, 199, 199, 533, 24163, 8, 8818, 12, 333, 3776, 14, 3947, 4414, 16551, 12, 6010, 14, 16551, 304, 272, 9076, 275, 9076, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 15149, 63, 16779, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
pducks32/intergrala
python/sympy/sympy/mpmath/functions/elliptic.py
18
39057
r""" Elliptic functions historically comprise the elliptic integrals and their inverses, and originate from the problem of computing the arc length of an ellipse. From a more modern point of view, an elliptic function is defined as a doubly periodic function, i.e. a function which satisfies .. math :: f(z + 2 \omega_1) = f(z + 2 \omega_2) = f(z) for some half-periods `\omega_1, \omega_2` with `\mathrm{Im}[\omega_1 / \omega_2] > 0`. The canonical elliptic functions are the Jacobi elliptic functions. More broadly, this section includes quasi-doubly periodic functions (such as the Jacobi theta functions) and other functions useful in the study of elliptic functions. Many different conventions for the arguments of elliptic functions are in use. It is even standard to use different parameterizations for different functions in the same text or software (and mpmath is no exception). The usual parameters are the elliptic nome `q`, which usually must satisfy `|q| < 1`; the elliptic parameter `m` (an arbitrary complex number); the elliptic modulus `k` (an arbitrary complex number); and the half-period ratio `\tau`, which usually must satisfy `\mathrm{Im}[\tau] > 0`. These quantities can be expressed in terms of each other using the following relations: .. math :: m = k^2 .. math :: \tau = -i \frac{K(1-m)}{K(m)} .. math :: q = e^{i \pi \tau} .. math :: k = \frac{\vartheta_2^4(q)}{\vartheta_3^4(q)} In addition, an alternative definition is used for the nome in number theory, which we here denote by q-bar: .. math :: \bar{q} = q^2 = e^{2 i \pi \tau} For convenience, mpmath provides functions to convert between the various parameters (:func:`~mpmath.qfrom`, :func:`~mpmath.mfrom`, :func:`~mpmath.kfrom`, :func:`~mpmath.taufrom`, :func:`~mpmath.qbarfrom`). **References** 1. [AbramowitzStegun]_ 2. [WhittakerWatson]_ """ from .functions import defun, defun_wrapped def nome(ctx, m): m = ctx.convert(m) if not m: return m if m == ctx.one: return m if ctx.isnan(m): return m if ctx.isinf(m): if m == ctx.ninf: return type(m)(-1) else: return ctx.mpc(-1) a = ctx.ellipk(ctx.one-m) b = ctx.ellipk(m) v = ctx.exp(-ctx.pi*a/b) if not ctx._im(m) and ctx._re(m) < 1: if ctx._is_real_type(m): return v.real else: return v.real + 0j elif m == 2: v = ctx.mpc(0, v.imag) return v @defun_wrapped def qfrom(ctx, q=None, m=None, k=None, tau=None, qbar=None): r""" Returns the elliptic nome `q`, given any of `q, m, k, \tau, \bar{q}`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> qfrom(q=0.25) 0.25 >>> qfrom(m=mfrom(q=0.25)) 0.25 >>> qfrom(k=kfrom(q=0.25)) 0.25 >>> qfrom(tau=taufrom(q=0.25)) (0.25 + 0.0j) >>> qfrom(qbar=qbarfrom(q=0.25)) 0.25 """ if q is not None: return ctx.convert(q) if m is not None: return nome(ctx, m) if k is not None: return nome(ctx, ctx.convert(k)**2) if tau is not None: return ctx.expjpi(tau) if qbar is not None: return ctx.sqrt(qbar) @defun_wrapped def qbarfrom(ctx, q=None, m=None, k=None, tau=None, qbar=None): r""" Returns the number-theoretic nome `\bar q`, given any of `q, m, k, \tau, \bar{q}`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> qbarfrom(qbar=0.25) 0.25 >>> qbarfrom(q=qfrom(qbar=0.25)) 0.25 >>> qbarfrom(m=extraprec(20)(mfrom)(qbar=0.25)) # ill-conditioned 0.25 >>> qbarfrom(k=extraprec(20)(kfrom)(qbar=0.25)) # ill-conditioned 0.25 >>> qbarfrom(tau=taufrom(qbar=0.25)) (0.25 + 0.0j) """ if qbar is not None: return ctx.convert(qbar) if q is not None: return ctx.convert(q) ** 2 if m is not None: return nome(ctx, m) ** 2 if k is not None: return nome(ctx, ctx.convert(k)**2) ** 2 if tau is not None: return ctx.expjpi(2*tau) @defun_wrapped def taufrom(ctx, q=None, m=None, k=None, tau=None, qbar=None): r""" Returns the elliptic half-period ratio `\tau`, given any of `q, m, k, \tau, \bar{q}`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> taufrom(tau=0.5j) (0.0 + 0.5j) >>> taufrom(q=qfrom(tau=0.5j)) (0.0 + 0.5j) >>> taufrom(m=mfrom(tau=0.5j)) (0.0 + 0.5j) >>> taufrom(k=kfrom(tau=0.5j)) (0.0 + 0.5j) >>> taufrom(qbar=qbarfrom(tau=0.5j)) (0.0 + 0.5j) """ if tau is not None: return ctx.convert(tau) if m is not None: m = ctx.convert(m) return ctx.j*ctx.ellipk(1-m)/ctx.ellipk(m) if k is not None: k = ctx.convert(k) return ctx.j*ctx.ellipk(1-k**2)/ctx.ellipk(k**2) if q is not None: return ctx.log(q) / (ctx.pi*ctx.j) if qbar is not None: qbar = ctx.convert(qbar) return ctx.log(qbar) / (2*ctx.pi*ctx.j) @defun_wrapped def kfrom(ctx, q=None, m=None, k=None, tau=None, qbar=None): r""" Returns the elliptic modulus `k`, given any of `q, m, k, \tau, \bar{q}`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> kfrom(k=0.25) 0.25 >>> kfrom(m=mfrom(k=0.25)) 0.25 >>> kfrom(q=qfrom(k=0.25)) 0.25 >>> kfrom(tau=taufrom(k=0.25)) (0.25 + 0.0j) >>> kfrom(qbar=qbarfrom(k=0.25)) 0.25 As `q \to 1` and `q \to -1`, `k` rapidly approaches `1` and `i \infty` respectively:: >>> kfrom(q=0.75) 0.9999999999999899166471767 >>> kfrom(q=-0.75) (0.0 + 7041781.096692038332790615j) >>> kfrom(q=1) 1 >>> kfrom(q=-1) (0.0 + +infj) """ if k is not None: return ctx.convert(k) if m is not None: return ctx.sqrt(m) if tau is not None: q = ctx.expjpi(tau) if qbar is not None: q = ctx.sqrt(qbar) if q == 1: return q if q == -1: return ctx.mpc(0,'inf') return (ctx.jtheta(2,0,q)/ctx.jtheta(3,0,q))**2 @defun_wrapped def mfrom(ctx, q=None, m=None, k=None, tau=None, qbar=None): r""" Returns the elliptic parameter `m`, given any of `q, m, k, \tau, \bar{q}`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> mfrom(m=0.25) 0.25 >>> mfrom(q=qfrom(m=0.25)) 0.25 >>> mfrom(k=kfrom(m=0.25)) 0.25 >>> mfrom(tau=taufrom(m=0.25)) (0.25 + 0.0j) >>> mfrom(qbar=qbarfrom(m=0.25)) 0.25 As `q \to 1` and `q \to -1`, `m` rapidly approaches `1` and `-\infty` respectively:: >>> mfrom(q=0.75) 0.9999999999999798332943533 >>> mfrom(q=-0.75) -49586681013729.32611558353 >>> mfrom(q=1) 1.0 >>> mfrom(q=-1) -inf The inverse nome as a function of `q` has an integer Taylor series expansion:: >>> taylor(lambda q: mfrom(q), 0, 7) [0.0, 16.0, -128.0, 704.0, -3072.0, 11488.0, -38400.0, 117632.0] """ if m is not None: return m if k is not None: return k**2 if tau is not None: q = ctx.expjpi(tau) if qbar is not None: q = ctx.sqrt(qbar) if q == 1: return ctx.convert(q) if q == -1: return q*ctx.inf v = (ctx.jtheta(2,0,q)/ctx.jtheta(3,0,q))**4 if ctx._is_real_type(q) and q < 0: v = v.real return v jacobi_spec = { 'sn' : ([3],[2],[1],[4], 'sin', 'tanh'), 'cn' : ([4],[2],[2],[4], 'cos', 'sech'), 'dn' : ([4],[3],[3],[4], '1', 'sech'), 'ns' : ([2],[3],[4],[1], 'csc', 'coth'), 'nc' : ([2],[4],[4],[2], 'sec', 'cosh'), 'nd' : ([3],[4],[4],[3], '1', 'cosh'), 'sc' : ([3],[4],[1],[2], 'tan', 'sinh'), 'sd' : ([3,3],[2,4],[1],[3], 'sin', 'sinh'), 'cd' : ([3],[2],[2],[3], 'cos', '1'), 'cs' : ([4],[3],[2],[1], 'cot', 'csch'), 'dc' : ([2],[3],[3],[2], 'sec', '1'), 'ds' : ([2,4],[3,3],[3],[1], 'csc', 'csch'), 'cc' : None, 'ss' : None, 'nn' : None, 'dd' : None } @defun def ellipfun(ctx, kind, u=None, m=None, q=None, k=None, tau=None): try: S = jacobi_spec[kind] except KeyError: raise ValueError("First argument must be a two-character string " "containing 's', 'c', 'd' or 'n', e.g.: 'sn'") if u is None: def f(*args, **kwargs): return ctx.ellipfun(kind, *args, **kwargs) f.__name__ = kind return f prec = ctx.prec try: ctx.prec += 10 u = ctx.convert(u) q = ctx.qfrom(m=m, q=q, k=k, tau=tau) if S is None: v = ctx.one + 0*q*u elif q == ctx.zero: if S[4] == '1': v = ctx.one else: v = getattr(ctx, S[4])(u) v += 0*q*u elif q == ctx.one: if S[5] == '1': v = ctx.one else: v = getattr(ctx, S[5])(u) v += 0*q*u else: t = u / ctx.jtheta(3, 0, q)**2 v = ctx.one for a in S[0]: v *= ctx.jtheta(a, 0, q) for b in S[1]: v /= ctx.jtheta(b, 0, q) for c in S[2]: v *= ctx.jtheta(c, t, q) for d in S[3]: v /= ctx.jtheta(d, t, q) finally: ctx.prec = prec return +v @defun_wrapped def kleinj(ctx, tau=None, **kwargs): r""" Evaluates the Klein j-invariant, which is a modular function defined for `\tau` in the upper half-plane as .. math :: J(\tau) = \frac{g_2^3(\tau)}{g_2^3(\tau) - 27 g_3^2(\tau)} where `g_2` and `g_3` are the modular invariants of the Weierstrass elliptic function, .. math :: g_2(\tau) = 60 \sum_{(m,n) \in \mathbb{Z}^2 \setminus (0,0)} (m \tau+n)^{-4} g_3(\tau) = 140 \sum_{(m,n) \in \mathbb{Z}^2 \setminus (0,0)} (m \tau+n)^{-6}. An alternative, common notation is that of the j-function `j(\tau) = 1728 J(\tau)`. **Plots** .. literalinclude :: /modules/mpmath/plots/kleinj.py .. image :: /modules/mpmath/plots/kleinj.png .. literalinclude :: /modules/mpmath/plots/kleinj2.py .. image :: /modules/mpmath/plots/kleinj2.png **Examples** Verifying the functional equation `J(\tau) = J(\tau+1) = J(-\tau^{-1})`:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> tau = 0.625+0.75*j >>> tau = 0.625+0.75*j >>> kleinj(tau) (-0.1507492166511182267125242 + 0.07595948379084571927228948j) >>> kleinj(tau+1) (-0.1507492166511182267125242 + 0.07595948379084571927228948j) >>> kleinj(-1/tau) (-0.1507492166511182267125242 + 0.07595948379084571927228946j) The j-function has a famous Laurent series expansion in terms of the nome `\bar{q}`, `j(\tau) = \bar{q}^{-1} + 744 + 196884\bar{q} + \ldots`:: >>> mp.dps = 15 >>> taylor(lambda q: 1728*q*kleinj(qbar=q), 0, 5, singular=True) [1.0, 744.0, 196884.0, 21493760.0, 864299970.0, 20245856256.0] The j-function admits exact evaluation at special algebraic points related to the Heegner numbers 1, 2, 3, 7, 11, 19, 43, 67, 163:: >>> @extraprec(10) ... def h(n): ... v = (1+sqrt(n)*j) ... if n > 2: ... v *= 0.5 ... return v ... >>> mp.dps = 25 >>> for n in [1,2,3,7,11,19,43,67,163]: ... n, chop(1728*kleinj(h(n))) ... (1, 1728.0) (2, 8000.0) (3, 0.0) (7, -3375.0) (11, -32768.0) (19, -884736.0) (43, -884736000.0) (67, -147197952000.0) (163, -262537412640768000.0) Also at other special points, the j-function assumes explicit algebraic values, e.g.:: >>> chop(1728*kleinj(j*sqrt(5))) 1264538.909475140509320227 >>> identify(cbrt(_)) # note: not simplified '((100+sqrt(13520))/2)' >>> (50+26*sqrt(5))**3 1264538.909475140509320227 """ q = ctx.qfrom(tau=tau, **kwargs) t2 = ctx.jtheta(2,0,q) t3 = ctx.jtheta(3,0,q) t4 = ctx.jtheta(4,0,q) P = (t2**8 + t3**8 + t4**8)**3 Q = 54*(t2*t3*t4)**8 return P/Q def RF_calc(ctx, x, y, z, r): if y == z: return RC_calc(ctx, x, y, r) if x == z: return RC_calc(ctx, y, x, r) if x == y: return RC_calc(ctx, z, x, r) if not (ctx.isnormal(x) and ctx.isnormal(y) and ctx.isnormal(z)): if ctx.isnan(x) or ctx.isnan(y) or ctx.isnan(z): return x*y*z if ctx.isinf(x) or ctx.isinf(y) or ctx.isinf(z): return ctx.zero xm,ym,zm = x,y,z A0 = Am = (x+y+z)/3 Q = ctx.root(3*r, -6) * max(abs(A0-x),abs(A0-y),abs(A0-z)) g = ctx.mpf(0.25) pow4 = ctx.one m = 0 while 1: xs = ctx.sqrt(xm) ys = ctx.sqrt(ym) zs = ctx.sqrt(zm) lm = xs*ys + xs*zs + ys*zs Am1 = (Am+lm)*g xm, ym, zm = (xm+lm)*g, (ym+lm)*g, (zm+lm)*g if pow4 * Q < abs(Am): break Am = Am1 m += 1 pow4 *= g t = pow4/Am X = (A0-x)*t Y = (A0-y)*t Z = -X-Y E2 = X*Y-Z**2 E3 = X*Y*Z return ctx.power(Am,-0.5) * (9240-924*E2+385*E2**2+660*E3-630*E2*E3)/9240 def RC_calc(ctx, x, y, r, pv=True): if not (ctx.isnormal(x) and ctx.isnormal(y)): if ctx.isinf(x) or ctx.isinf(y): return 1/(x*y) if y == 0: return ctx.inf if x == 0: return ctx.pi / ctx.sqrt(y) / 2 raise ValueError # Cauchy principal value if pv and ctx._im(y) == 0 and ctx._re(y) < 0: return ctx.sqrt(x/(x-y)) * RC_calc(ctx, x-y, -y, r) if x == y: return 1/ctx.sqrt(x) extraprec = 2*max(0,-ctx.mag(x-y)+ctx.mag(x)) ctx.prec += extraprec if ctx._is_real_type(x) and ctx._is_real_type(y): x = ctx._re(x) y = ctx._re(y) a = ctx.sqrt(x/y) if x < y: b = ctx.sqrt(y-x) v = ctx.acos(a)/b else: b = ctx.sqrt(x-y) v = ctx.acosh(a)/b else: sx = ctx.sqrt(x) sy = ctx.sqrt(y) v = ctx.acos(sx/sy)/(ctx.sqrt((1-x/y))*sy) ctx.prec -= extraprec return v def RJ_calc(ctx, x, y, z, p, r): if not (ctx.isnormal(x) and ctx.isnormal(y) and \ ctx.isnormal(z) and ctx.isnormal(p)): if ctx.isnan(x) or ctx.isnan(y) or ctx.isnan(z) or ctx.isnan(p): return x*y*z if ctx.isinf(x) or ctx.isinf(y) or ctx.isinf(z) or ctx.isinf(p): return ctx.zero if not p: return ctx.inf xm,ym,zm,pm = x,y,z,p A0 = Am = (x + y + z + 2*p)/5 delta = (p-x)*(p-y)*(p-z) Q = ctx.root(0.25*r, -6) * max(abs(A0-x),abs(A0-y),abs(A0-z),abs(A0-p)) m = 0 g = ctx.mpf(0.25) pow4 = ctx.one S = 0 while 1: sx = ctx.sqrt(xm) sy = ctx.sqrt(ym) sz = ctx.sqrt(zm) sp = ctx.sqrt(pm) lm = sx*sy + sx*sz + sy*sz Am1 = (Am+lm)*g xm = (xm+lm)*g; ym = (ym+lm)*g; zm = (zm+lm)*g; pm = (pm+lm)*g dm = (sp+sx) * (sp+sy) * (sp+sz) em = delta * ctx.power(4, -3*m) / dm**2 if pow4 * Q < abs(Am): break T = RC_calc(ctx, ctx.one, ctx.one+em, r) * pow4 / dm S += T pow4 *= g m += 1 Am = Am1 t = ctx.ldexp(1,-2*m) / Am X = (A0-x)*t Y = (A0-y)*t Z = (A0-z)*t P = (-X-Y-Z)/2 E2 = X*Y + X*Z + Y*Z - 3*P**2 E3 = X*Y*Z + 2*E2*P + 4*P**3 E4 = (2*X*Y*Z + E2*P + 3*P**3)*P E5 = X*Y*Z*P**2 P = 24024 - 5148*E2 + 2457*E2**2 + 4004*E3 - 4158*E2*E3 - 3276*E4 + 2772*E5 Q = 24024 v1 = g**m * ctx.power(Am, -1.5) * P/Q v2 = 6*S return v1 + v2 @defun def elliprf(ctx, x, y, z): r""" Evaluates the Carlson symmetric elliptic integral of the first kind .. math :: R_F(x,y,z) = \frac{1}{2} \int_0^{\infty} \frac{dt}{\sqrt{(t+x)(t+y)(t+z)}} which is defined for `x,y,z \notin (-\infty,0)`, and with at most one of `x,y,z` being zero. For real `x,y,z \ge 0`, the principal square root is taken in the integrand. For complex `x,y,z`, the principal square root is taken as `t \to \infty` and as `t \to 0` non-principal branches are chosen as necessary so as to make the integrand continuous. **Examples** Some basic values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> elliprf(0,1,1); pi/2 1.570796326794896619231322 1.570796326794896619231322 >>> elliprf(0,1,inf) 0.0 >>> elliprf(1,1,1) 1.0 >>> elliprf(2,2,2)**2 0.5 >>> elliprf(1,0,0); elliprf(0,0,1); elliprf(0,1,0); elliprf(0,0,0) +inf +inf +inf +inf Representing complete elliptic integrals in terms of `R_F`:: >>> m = mpf(0.75) >>> ellipk(m); elliprf(0,1-m,1) 2.156515647499643235438675 2.156515647499643235438675 >>> ellipe(m); elliprf(0,1-m,1)-m*elliprd(0,1-m,1)/3 1.211056027568459524803563 1.211056027568459524803563 Some symmetries and argument transformations:: >>> x,y,z = 2,3,4 >>> elliprf(x,y,z); elliprf(y,x,z); elliprf(z,y,x) 0.5840828416771517066928492 0.5840828416771517066928492 0.5840828416771517066928492 >>> k = mpf(100000) >>> elliprf(k*x,k*y,k*z); k**(-0.5) * elliprf(x,y,z) 0.001847032121923321253219284 0.001847032121923321253219284 >>> l = sqrt(x*y) + sqrt(y*z) + sqrt(z*x) >>> elliprf(x,y,z); 2*elliprf(x+l,y+l,z+l) 0.5840828416771517066928492 0.5840828416771517066928492 >>> elliprf((x+l)/4,(y+l)/4,(z+l)/4) 0.5840828416771517066928492 Comparing with numerical integration:: >>> x,y,z = 2,3,4 >>> elliprf(x,y,z) 0.5840828416771517066928492 >>> f = lambda t: 0.5*((t+x)*(t+y)*(t+z))**(-0.5) >>> q = extradps(25)(quad) >>> q(f, [0,inf]) 0.5840828416771517066928492 With the following arguments, the square root in the integrand becomes discontinuous at `t = 1/2` if the principal branch is used. To obtain the right value, `-\sqrt{r}` must be taken instead of `\sqrt{r}` on `t \in (0, 1/2)`:: >>> x,y,z = j-1,j,0 >>> elliprf(x,y,z) (0.7961258658423391329305694 - 1.213856669836495986430094j) >>> -q(f, [0,0.5]) + q(f, [0.5,inf]) (0.7961258658423391329305694 - 1.213856669836495986430094j) The so-called *first lemniscate constant*, a transcendental number:: >>> elliprf(0,1,2) 1.31102877714605990523242 >>> extradps(25)(quad)(lambda t: 1/sqrt(1-t**4), [0,1]) 1.31102877714605990523242 >>> gamma('1/4')**2/(4*sqrt(2*pi)) 1.31102877714605990523242 **References** 1. [Carlson]_ 2. [DLMF]_ Chapter 19. Elliptic Integrals """ x = ctx.convert(x) y = ctx.convert(y) z = ctx.convert(z) prec = ctx.prec try: ctx.prec += 20 tol = ctx.eps * 2**10 v = RF_calc(ctx, x, y, z, tol) finally: ctx.prec = prec return +v @defun def elliprc(ctx, x, y, pv=True): r""" Evaluates the degenerate Carlson symmetric elliptic integral of the first kind .. math :: R_C(x,y) = R_F(x,y,y) = \frac{1}{2} \int_0^{\infty} \frac{dt}{(t+y) \sqrt{(t+x)}}. If `y \in (-\infty,0)`, either a value defined by continuity, or with *pv=True* the Cauchy principal value, can be computed. If `x \ge 0, y > 0`, the value can be expressed in terms of elementary functions as .. math :: R_C(x,y) = \begin{cases} \dfrac{1}{\sqrt{y-x}} \cos^{-1}\left(\sqrt{\dfrac{x}{y}}\right), & x < y \\ \dfrac{1}{\sqrt{y}}, & x = y \\ \dfrac{1}{\sqrt{x-y}} \cosh^{-1}\left(\sqrt{\dfrac{x}{y}}\right), & x > y \\ \end{cases}. **Examples** Some special values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> elliprc(1,2)*4; elliprc(0,1)*2; +pi 3.141592653589793238462643 3.141592653589793238462643 3.141592653589793238462643 >>> elliprc(1,0) +inf >>> elliprc(5,5)**2 0.2 >>> elliprc(1,inf); elliprc(inf,1); elliprc(inf,inf) 0.0 0.0 0.0 Comparing with the elementary closed-form solution:: >>> elliprc('1/3', '1/5'); sqrt(7.5)*acosh(sqrt('5/3')) 2.041630778983498390751238 2.041630778983498390751238 >>> elliprc('1/5', '1/3'); sqrt(7.5)*acos(sqrt('3/5')) 1.875180765206547065111085 1.875180765206547065111085 Comparing with numerical integration:: >>> q = extradps(25)(quad) >>> elliprc(2, -3, pv=True) 0.3333969101113672670749334 >>> elliprc(2, -3, pv=False) (0.3333969101113672670749334 + 0.7024814731040726393156375j) >>> 0.5*q(lambda t: 1/(sqrt(t+2)*(t-3)), [0,3-j,6,inf]) (0.3333969101113672670749334 + 0.7024814731040726393156375j) """ x = ctx.convert(x) y = ctx.convert(y) prec = ctx.prec try: ctx.prec += 20 tol = ctx.eps * 2**10 v = RC_calc(ctx, x, y, tol, pv) finally: ctx.prec = prec return +v @defun def elliprj(ctx, x, y, z, p): r""" Evaluates the Carlson symmetric elliptic integral of the third kind .. math :: R_J(x,y,z,p) = \frac{3}{2} \int_0^{\infty} \frac{dt}{(t+p)\sqrt{(t+x)(t+y)(t+z)}}. Like :func:`~mpmath.elliprf`, the branch of the square root in the integrand is defined so as to be continuous along the path of integration for complex values of the arguments. **Examples** Some values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> elliprj(1,1,1,1) 1.0 >>> elliprj(2,2,2,2); 1/(2*sqrt(2)) 0.3535533905932737622004222 0.3535533905932737622004222 >>> elliprj(0,1,2,2) 1.067937989667395702268688 >>> 3*(2*gamma('5/4')**2-pi**2/gamma('1/4')**2)/(sqrt(2*pi)) 1.067937989667395702268688 >>> elliprj(0,1,1,2); 3*pi*(2-sqrt(2))/4 1.380226776765915172432054 1.380226776765915172432054 >>> elliprj(1,3,2,0); elliprj(0,1,1,0); elliprj(0,0,0,0) +inf +inf +inf >>> elliprj(1,inf,1,0); elliprj(1,1,1,inf) 0.0 0.0 >>> chop(elliprj(1+j, 1-j, 1, 1)) 0.8505007163686739432927844 Scale transformation:: >>> x,y,z,p = 2,3,4,5 >>> k = mpf(100000) >>> elliprj(k*x,k*y,k*z,k*p); k**(-1.5)*elliprj(x,y,z,p) 4.521291677592745527851168e-9 4.521291677592745527851168e-9 Comparing with numerical integration:: >>> elliprj(1,2,3,4) 0.2398480997495677621758617 >>> f = lambda t: 1/((t+4)*sqrt((t+1)*(t+2)*(t+3))) >>> 1.5*quad(f, [0,inf]) 0.2398480997495677621758617 >>> elliprj(1,2+1j,3,4-2j) (0.216888906014633498739952 + 0.04081912627366673332369512j) >>> f = lambda t: 1/((t+4-2j)*sqrt((t+1)*(t+2+1j)*(t+3))) >>> 1.5*quad(f, [0,inf]) (0.216888906014633498739952 + 0.04081912627366673332369511j) """ x = ctx.convert(x) y = ctx.convert(y) z = ctx.convert(z) p = ctx.convert(p) prec = ctx.prec try: ctx.prec += 20 tol = ctx.eps * 2**10 v = RJ_calc(ctx, x, y, z, p, tol) finally: ctx.prec = prec return +v @defun def elliprd(ctx, x, y, z): r""" Evaluates the degenerate Carlson symmetric elliptic integral of the third kind or Carlson elliptic integral of the second kind `R_D(x,y,z) = R_J(x,y,z,z)`. See :func:`~mpmath.elliprj` for additional information. **Examples** >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> elliprd(1,2,3) 0.2904602810289906442326534 >>> elliprj(1,2,3,3) 0.2904602810289906442326534 The so-called *second lemniscate constant*, a transcendental number:: >>> elliprd(0,2,1)/3 0.5990701173677961037199612 >>> extradps(25)(quad)(lambda t: t**2/sqrt(1-t**4), [0,1]) 0.5990701173677961037199612 >>> gamma('3/4')**2/sqrt(2*pi) 0.5990701173677961037199612 """ return ctx.elliprj(x,y,z,z) @defun def elliprg(ctx, x, y, z): r""" Evaluates the Carlson completely symmetric elliptic integral of the second kind .. math :: R_G(x,y,z) = \frac{1}{4} \int_0^{\infty} \frac{t}{\sqrt{(t+x)(t+y)(t+z)}} \left( \frac{x}{t+x} + \frac{y}{t+y} + \frac{z}{t+z}\right) dt. **Examples** Evaluation for real and complex arguments:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> elliprg(0,1,1)*4; +pi 3.141592653589793238462643 3.141592653589793238462643 >>> elliprg(0,0.5,1) 0.6753219405238377512600874 >>> chop(elliprg(1+j, 1-j, 2)) 1.172431327676416604532822 A double integral that can be evaluated in terms of `R_G`:: >>> x,y,z = 2,3,4 >>> def f(t,u): ... st = fp.sin(t); ct = fp.cos(t) ... su = fp.sin(u); cu = fp.cos(u) ... return (x*(st*cu)**2 + y*(st*su)**2 + z*ct**2)**0.5 * st ... >>> nprint(mpf(fp.quad(f, [0,fp.pi], [0,2*fp.pi])/(4*fp.pi)), 13) 1.725503028069 >>> nprint(elliprg(x,y,z), 13) 1.725503028069 """ x = ctx.convert(x) y = ctx.convert(y) z = ctx.convert(z) if not z: x, z = z, x if not z: y, z = x, y if not z: return ctx.inf def terms(): T1 = 0.5*z*ctx.elliprf(x,y,z) T2 = -0.5*(x-z)*(y-z)*ctx.elliprd(x,y,z)/3 T3 = 0.5*ctx.sqrt(x*y/z) return T1,T2,T3 return ctx.sum_accurately(terms) @defun_wrapped def ellipf(ctx, phi, m): r""" Evaluates the Legendre incomplete elliptic integral of the first kind .. math :: F(\phi,m) = \int_0^{\phi} \frac{dt}{\sqrt{1-m \sin^2 t}} or equivalently .. math :: F(\phi,m) = \int_0^{\sin \phi} \frac{dt}{\left(\sqrt{1-t^2}\right)\left(\sqrt{1-mt^2}\right)}. The function reduces to a complete elliptic integral of the first kind (see :func:`~mpmath.ellipk`) when `\phi = \frac{\pi}{2}`; that is, .. math :: F\left(\frac{\pi}{2}, m\right) = K(m). In the defining integral, it is assumed that the principal branch of the square root is taken and that the path of integration avoids crossing any branch cuts. Outside `-\pi/2 \le \Re(\phi) \le \pi/2`, the function extends quasi-periodically as .. math :: F(\phi + n \pi, m) = 2 n K(m) + F(\phi,m), n \in \mathbb{Z}. **Plots** .. literalinclude :: /modules/mpmath/plots/ellipf.py .. image :: /modules/mpmath/plots/ellipf.png **Examples** Basic values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> ellipf(0,1) 0.0 >>> ellipf(0,0) 0.0 >>> ellipf(1,0); ellipf(2+3j,0) 1.0 (2.0 + 3.0j) >>> ellipf(1,1); log(sec(1)+tan(1)) 1.226191170883517070813061 1.226191170883517070813061 >>> ellipf(pi/2, -0.5); ellipk(-0.5) 1.415737208425956198892166 1.415737208425956198892166 >>> ellipf(pi/2+eps, 1); ellipf(-pi/2-eps, 1) +inf +inf >>> ellipf(1.5, 1) 3.340677542798311003320813 Comparing with numerical integration:: >>> z,m = 0.5, 1.25 >>> ellipf(z,m) 0.5287219202206327872978255 >>> quad(lambda t: (1-m*sin(t)**2)**(-0.5), [0,z]) 0.5287219202206327872978255 The arguments may be complex numbers:: >>> ellipf(3j, 0.5) (0.0 + 1.713602407841590234804143j) >>> ellipf(3+4j, 5-6j) (1.269131241950351323305741 - 0.3561052815014558335412538j) >>> z,m = 2+3j, 1.25 >>> k = 1011 >>> ellipf(z+pi*k,m); ellipf(z,m) + 2*k*ellipk(m) (4086.184383622179764082821 - 3003.003538923749396546871j) (4086.184383622179764082821 - 3003.003538923749396546871j) For `|\Re(z)| < \pi/2`, the function can be expressed as a hypergeometric series of two variables (see :func:`~mpmath.appellf1`):: >>> z,m = 0.5, 0.25 >>> ellipf(z,m) 0.5050887275786480788831083 >>> sin(z)*appellf1(0.5,0.5,0.5,1.5,sin(z)**2,m*sin(z)**2) 0.5050887275786480788831083 """ z = phi if not (ctx.isnormal(z) and ctx.isnormal(m)): if m == 0: return z + m if z == 0: return z * m if m == ctx.inf or m == ctx.ninf: return z/m raise ValueError x = z.real ctx.prec += max(0, ctx.mag(x)) pi = +ctx.pi away = abs(x) > pi/2 if m == 1: if away: return ctx.inf if away: d = ctx.nint(x/pi) z = z-pi*d P = 2*d*ctx.ellipk(m) else: P = 0 c, s = ctx.cos_sin(z) return s * ctx.elliprf(c**2, 1-m*s**2, 1) + P @defun_wrapped def ellipe(ctx, *args): r""" Called with a single argument `m`, evaluates the Legendre complete elliptic integral of the second kind, `E(m)`, defined by .. math :: E(m) = \int_0^{\pi/2} \sqrt{1-m \sin^2 t} \, dt \,=\, \frac{\pi}{2} \,_2F_1\left(\frac{1}{2}, -\frac{1}{2}, 1, m\right). Called with two arguments `\phi, m`, evaluates the incomplete elliptic integral of the second kind .. math :: E(\phi,m) = \int_0^{\phi} \sqrt{1-m \sin^2 t} \, dt = \int_0^{\sin z} \frac{\sqrt{1-mt^2}}{\sqrt{1-t^2}} \, dt. The incomplete integral reduces to a complete integral when `\phi = \frac{\pi}{2}`; that is, .. math :: E\left(\frac{\pi}{2}, m\right) = E(m). In the defining integral, it is assumed that the principal branch of the square root is taken and that the path of integration avoids crossing any branch cuts. Outside `-\pi/2 \le \Re(z) \le \pi/2`, the function extends quasi-periodically as .. math :: E(\phi + n \pi, m) = 2 n E(m) + F(\phi,m), n \in \mathbb{Z}. **Plots** .. literalinclude :: /modules/mpmath/plots/ellipe.py .. image :: /modules/mpmath/plots/ellipe.png **Examples for the complete integral** Basic values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> ellipe(0) 1.570796326794896619231322 >>> ellipe(1) 1.0 >>> ellipe(-1) 1.910098894513856008952381 >>> ellipe(2) (0.5990701173677961037199612 + 0.5990701173677961037199612j) >>> ellipe(inf) (0.0 + +infj) >>> ellipe(-inf) +inf Verifying the defining integral and hypergeometric representation:: >>> ellipe(0.5) 1.350643881047675502520175 >>> quad(lambda t: sqrt(1-0.5*sin(t)**2), [0, pi/2]) 1.350643881047675502520175 >>> pi/2*hyp2f1(0.5,-0.5,1,0.5) 1.350643881047675502520175 Evaluation is supported for arbitrary complex `m`:: >>> ellipe(0.5+0.25j) (1.360868682163129682716687 - 0.1238733442561786843557315j) >>> ellipe(3+4j) (1.499553520933346954333612 - 1.577879007912758274533309j) A definite integral:: >>> quad(ellipe, [0,1]) 1.333333333333333333333333 **Examples for the incomplete integral** Basic values and limits:: >>> ellipe(0,1) 0.0 >>> ellipe(0,0) 0.0 >>> ellipe(1,0) 1.0 >>> ellipe(2+3j,0) (2.0 + 3.0j) >>> ellipe(1,1); sin(1) 0.8414709848078965066525023 0.8414709848078965066525023 >>> ellipe(pi/2, -0.5); ellipe(-0.5) 1.751771275694817862026502 1.751771275694817862026502 >>> ellipe(pi/2, 1); ellipe(-pi/2, 1) 1.0 -1.0 >>> ellipe(1.5, 1) 0.9974949866040544309417234 Comparing with numerical integration:: >>> z,m = 0.5, 1.25 >>> ellipe(z,m) 0.4740152182652628394264449 >>> quad(lambda t: sqrt(1-m*sin(t)**2), [0,z]) 0.4740152182652628394264449 The arguments may be complex numbers:: >>> ellipe(3j, 0.5) (0.0 + 7.551991234890371873502105j) >>> ellipe(3+4j, 5-6j) (24.15299022574220502424466 + 75.2503670480325997418156j) >>> k = 35 >>> z,m = 2+3j, 1.25 >>> ellipe(z+pi*k,m); ellipe(z,m) + 2*k*ellipe(m) (48.30138799412005235090766 + 17.47255216721987688224357j) (48.30138799412005235090766 + 17.47255216721987688224357j) For `|\Re(z)| < \pi/2`, the function can be expressed as a hypergeometric series of two variables (see :func:`~mpmath.appellf1`):: >>> z,m = 0.5, 0.25 >>> ellipe(z,m) 0.4950017030164151928870375 >>> sin(z)*appellf1(0.5,0.5,-0.5,1.5,sin(z)**2,m*sin(z)**2) 0.4950017030164151928870376 """ if len(args) == 1: return ctx._ellipe(args[0]) else: phi, m = args z = phi if not (ctx.isnormal(z) and ctx.isnormal(m)): if m == 0: return z + m if z == 0: return z * m if m == ctx.inf or m == ctx.ninf: return ctx.inf raise ValueError x = z.real ctx.prec += max(0, ctx.mag(x)) pi = +ctx.pi away = abs(x) > pi/2 if away: d = ctx.nint(x/pi) z = z-pi*d P = 2*d*ctx.ellipe(m) else: P = 0 def terms(): c, s = ctx.cos_sin(z) x = c**2 y = 1-m*s**2 RF = ctx.elliprf(x, y, 1) RD = ctx.elliprd(x, y, 1) return s*RF, -m*s**3*RD/3 return ctx.sum_accurately(terms) + P @defun_wrapped def ellippi(ctx, *args): r""" Called with three arguments `n, \phi, m`, evaluates the Legendre incomplete elliptic integral of the third kind .. math :: \Pi(n; \phi, m) = \int_0^{\phi} \frac{dt}{(1-n \sin^2 t) \sqrt{1-m \sin^2 t}} = \int_0^{\sin \phi} \frac{dt}{(1-nt^2) \sqrt{1-t^2} \sqrt{1-mt^2}}. Called with two arguments `n, m`, evaluates the complete elliptic integral of the third kind `\Pi(n,m) = \Pi(n; \frac{\pi}{2},m)`. In the defining integral, it is assumed that the principal branch of the square root is taken and that the path of integration avoids crossing any branch cuts. Outside `-\pi/2 \le \Re(\phi) \le \pi/2`, the function extends quasi-periodically as .. math :: \Pi(n,\phi+k\pi,m) = 2k\Pi(n,m) + \Pi(n,\phi,m), k \in \mathbb{Z}. **Plots** .. literalinclude :: /modules/mpmath/plots/ellippi.py .. image :: /modules/mpmath/plots/ellippi.png **Examples for the complete integral** Some basic values and limits:: >>> from sympy.mpmath import * >>> mp.dps = 25; mp.pretty = True >>> ellippi(0,-5); ellipk(-5) 0.9555039270640439337379334 0.9555039270640439337379334 >>> ellippi(inf,2) 0.0 >>> ellippi(2,inf) 0.0 >>> abs(ellippi(1,5)) +inf >>> abs(ellippi(0.25,1)) +inf Evaluation in terms of simpler functions:: >>> ellippi(0.25,0.25); ellipe(0.25)/(1-0.25) 1.956616279119236207279727 1.956616279119236207279727 >>> ellippi(3,0); pi/(2*sqrt(-2)) (0.0 - 1.11072073453959156175397j) (0.0 - 1.11072073453959156175397j) >>> ellippi(-3,0); pi/(2*sqrt(4)) 0.7853981633974483096156609 0.7853981633974483096156609 **Examples for the incomplete integral** Basic values and limits:: >>> ellippi(0.25,-0.5); ellippi(0.25,pi/2,-0.5) 1.622944760954741603710555 1.622944760954741603710555 >>> ellippi(1,0,1) 0.0 >>> ellippi(inf,0,1) 0.0 >>> ellippi(0,0.25,0.5); ellipf(0.25,0.5) 0.2513040086544925794134591 0.2513040086544925794134591 >>> ellippi(1,1,1); (log(sec(1)+tan(1))+sec(1)*tan(1))/2 2.054332933256248668692452 2.054332933256248668692452 >>> ellippi(0.25, 53*pi/2, 0.75); 53*ellippi(0.25,0.75) 135.240868757890840755058 135.240868757890840755058 >>> ellippi(0.5,pi/4,0.5); 2*ellipe(pi/4,0.5)-1/sqrt(3) 0.9190227391656969903987269 0.9190227391656969903987269 Complex arguments are supported:: >>> ellippi(0.5, 5+6j-2*pi, -7-8j) (-0.3612856620076747660410167 + 0.5217735339984807829755815j) Some degenerate cases:: >>> ellippi(1,1) +inf >>> ellippi(1,0) +inf >>> ellippi(1,2,0) +inf >>> ellippi(1,2,1) +inf >>> ellippi(1,0,1) 0.0 """ if len(args) == 2: n, m = args complete = True z = phi = ctx.pi/2 else: n, phi, m = args complete = False z = phi if not (ctx.isnormal(n) and ctx.isnormal(z) and ctx.isnormal(m)): if ctx.isnan(n) or ctx.isnan(z) or ctx.isnan(m): raise ValueError if complete: if m == 0: if n == 1: return ctx.inf return ctx.pi/(2*ctx.sqrt(1-n)) if n == 0: return ctx.ellipk(m) if ctx.isinf(n) or ctx.isinf(m): return ctx.zero else: if z == 0: return z if ctx.isinf(n): return ctx.zero if ctx.isinf(m): return ctx.zero if ctx.isinf(n) or ctx.isinf(z) or ctx.isinf(m): raise ValueError if complete: if m == 1: if n == 1: return ctx.inf return -ctx.inf/ctx.sign(n-1) away = False else: x = z.real ctx.prec += max(0, ctx.mag(x)) pi = +ctx.pi away = abs(x) > pi/2 if away: d = ctx.nint(x/pi) z = z-pi*d P = 2*d*ctx.ellippi(n,m) if ctx.isinf(P): return ctx.inf else: P = 0 def terms(): if complete: c, s = ctx.zero, ctx.one else: c, s = ctx.cos_sin(z) x = c**2 y = 1-m*s**2 RF = ctx.elliprf(x, y, 1) RJ = ctx.elliprj(x, y, 1, 1-n*s**2) return s*RF, n*s**3*RJ/3 return ctx.sum_accurately(terms) + P
mit
[ 82, 624, 199, 23525, 764, 3423, 13612, 269, 7288, 1013, 28479, 314, 16028, 764, 17806, 2551, 199, 460, 3932, 315, 422, 874, 12, 436, 6330, 323, 687, 314, 5160, 402, 17226, 314, 199, 9912, 2582, 402, 376, 16028, 261, 14, 11606, 282, 1655, 818, 11641, 2376, 402, 2455, 12, 199, 290, 16028, 764, 805, 365, 3247, 465, 282, 28584, 590, 18745, 805, 12, 284, 14, 69, 14, 199, 65, 805, 1314, 13529, 5604, 199, 199, 703, 3473, 3800, 339, 289, 8, 90, 435, 499, 971, 23524, 63, 17, 9, 275, 289, 8, 90, 435, 499, 971, 23524, 63, 18, 9, 275, 289, 8, 90, 9, 199, 199, 509, 2005, 12995, 13, 20441, 29520, 23524, 63, 17, 12, 971, 23524, 63, 18, 64, 543, 199, 25502, 3442, 5682, 91, 16221, 93, 7023, 23524, 63, 17, 1182, 971, 23524, 63, 18, 61, 690, 378, 2313, 710, 11358, 16028, 764, 199, 5777, 787, 314, 1603, 13286, 4492, 16028, 764, 3423, 14, 16917, 330, 5063, 590, 12, 642, 3420, 199, 9441, 221, 2173, 24950, 13, 1117, 456, 590, 18745, 3423, 334, 10180, 465, 314, 1603, 13286, 4492, 12724, 199, 5777, 9, 436, 1163, 3423, 2997, 315, 314, 25932, 402, 16028, 764, 3423, 14, 199, 199, 4089, 3365, 8758, 852, 367, 314, 2368, 402, 199, 16514, 764, 3423, 787, 315, 675, 14, 2779, 365, 2755, 4465, 370, 675, 199, 14020, 18117, 6236, 90, 1298, 367, 3365, 3423, 315, 314, 2011, 199, 505, 503, 2032, 334, 460, 6118, 3442, 365, 949, 1919, 680, 199, 1918, 20195, 2633, 787, 314, 16028, 764, 949, 278, 658, 81, 3559, 1314, 9987, 199, 7790, 23082, 658, 92, 81, 92, 665, 413, 64, 27, 314, 16028, 764, 2725, 658, 77, 64, 334, 290, 9697, 199, 5254, 1329, 2736, 314, 16028, 764, 3413, 15909, 658, 75, 64, 334, 290, 9697, 6114, 199, 1955, 2736, 436, 314, 12995, 13, 5191, 10463, 29520, 16656, 3559, 1314, 9987, 1471, 199, 18270, 1399, 29520, 3442, 5682, 91, 16221, 93, 7023, 16656, 61, 690, 378, 2313, 199, 20676, 13621, 1417, 883, 506, 19147, 315, 2895, 402, 1924, 1163, 199, 4941, 314, 2569, 16109, 26, 199, 199, 703, 3473, 3800, 339, 333, 275, 1022, 62, 18, 199, 199, 703, 3473, 3800, 339, 971, 16656, 275, 446, 73, 971, 10865, 91, 43, 8, 17, 13, 77, 6769, 91, 43, 8, 77, 6769, 199, 199, 703, 3473, 3800, 339, 1894, 275, 325, 11683, 73, 971, 1038, 971, 16656, 93, 199, 199, 703, 3473, 3800, 339, 1022, 275, 971, 10865, 12911, 1391, 9337, 63, 18, 62, 20, 8, 81, 6769, 12911, 1391, 9337, 63, 19, 62, 20, 8, 81, 6769, 199, 199, 607, 10234, 12, 376, 13943, 5492, 365, 1202, 367, 314, 949, 278, 315, 199, 1955, 30629, 12, 1314, 781, 2348, 477, 4610, 701, 1894, 13, 1700, 26, 199, 199, 703, 3473, 3800, 339, 971, 1700, 91, 81, 93, 275, 1894, 62, 18, 275, 325, 11683, 18, 284, 971, 1038, 971, 16656, 93, 199, 199, 1858, 16777, 12, 6118, 3442, 6571, 3423, 370, 3957, 199, 13007, 314, 7750, 2633, 18479, 1532, 6054, 311, 3442, 14, 81, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 77, 504, 3559, 199, 26, 1532, 6054, 311, 3442, 14, 75, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 16656, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 81, 1700, 504, 14963, 199, 199, 538, 15242, 538, 199, 199, 17, 14, 359, 5583, 345, 573, 25809, 26696, 17924, 25276, 199, 199, 18, 14, 359, 5879, 390, 502, 2570, 55, 292, 834, 25276, 199, 199, 624, 199, 199, 504, 1275, 5777, 492, 347, 324, 12, 347, 324, 63, 9130, 199, 199, 318, 949, 278, 8, 3799, 12, 333, 304, 272, 333, 275, 4027, 14, 3916, 8, 77, 9, 272, 340, 440, 333, 26, 267, 372, 333, 272, 340, 333, 508, 4027, 14, 368, 26, 267, 372, 333, 272, 340, 4027, 14, 12936, 8, 77, 304, 267, 372, 333, 272, 340, 4027, 14, 29326, 8, 77, 304, 267, 340, 333, 508, 4027, 14, 78, 4904, 26, 288, 372, 730, 8, 77, 9, 2801, 17, 9, 267, 587, 26, 288, 372, 4027, 14, 311, 67, 2801, 17, 9, 272, 282, 275, 4027, 14, 352, 317, 2051, 8, 3799, 14, 368, 13, 77, 9, 272, 330, 275, 4027, 14, 352, 317, 2051, 8, 77, 9, 272, 373, 275, 4027, 14, 1474, 2801, 3799, 14, 1038, 10, 65, 15, 66, 9, 272, 340, 440, 4027, 423, 1017, 8, 77, 9, 436, 4027, 423, 264, 8, 77, 9, 665, 413, 26, 267, 340, 4027, 423, 374, 63, 3093, 63, 466, 8, 77, 304, 288, 372, 373, 14, 3093, 267, 587, 26, 288, 372, 373, 14, 3093, 435, 378, 74, 272, 916, 333, 508, 499, 26, 267, 373, 275, 4027, 14, 311, 67, 8, 16, 12, 373, 14, 14688, 9, 272, 372, 373, 199, 199, 32, 318, 324, 63, 9130, 199, 318, 1894, 504, 8, 3799, 12, 1894, 29, 403, 12, 333, 29, 403, 12, 1022, 29, 403, 12, 19188, 29, 403, 12, 1894, 1700, 29, 403, 304, 272, 519, 624, 272, 1803, 314, 16028, 764, 949, 278, 658, 81, 3559, 1627, 1263, 402, 658, 81, 12, 333, 12, 1022, 12, 971, 16656, 12, 971, 1700, 91, 81, 23485, 447, 398, 1306, 687, 5840, 14, 311, 3442, 492, 627, 267, 1306, 6118, 14, 30168, 275, 5661, 27, 6118, 14, 9118, 275, 715, 267, 1306, 1894, 504, 8, 81, 29, 16, 14, 821, 9, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 77, 29, 77, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 75, 29, 75, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 16656, 29, 16656, 504, 8, 81, 29, 16, 14, 821, 430, 267, 334, 16, 14, 821, 435, 378, 14, 16, 74, 9, 267, 1306, 1894, 504, 8, 81, 1700, 29, 81, 1700, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 339, 408, 272, 340, 1894, 365, 440, 488, 26, 267, 372, 4027, 14, 3916, 8, 81, 9, 272, 340, 333, 365, 440, 488, 26, 267, 372, 949, 278, 8, 3799, 12, 333, 9, 272, 340, 1022, 365, 440, 488, 26, 267 ]
[ 624, 199, 23525, 764, 3423, 13612, 269, 7288, 1013, 28479, 314, 16028, 764, 17806, 2551, 199, 460, 3932, 315, 422, 874, 12, 436, 6330, 323, 687, 314, 5160, 402, 17226, 314, 199, 9912, 2582, 402, 376, 16028, 261, 14, 11606, 282, 1655, 818, 11641, 2376, 402, 2455, 12, 199, 290, 16028, 764, 805, 365, 3247, 465, 282, 28584, 590, 18745, 805, 12, 284, 14, 69, 14, 199, 65, 805, 1314, 13529, 5604, 199, 199, 703, 3473, 3800, 339, 289, 8, 90, 435, 499, 971, 23524, 63, 17, 9, 275, 289, 8, 90, 435, 499, 971, 23524, 63, 18, 9, 275, 289, 8, 90, 9, 199, 199, 509, 2005, 12995, 13, 20441, 29520, 23524, 63, 17, 12, 971, 23524, 63, 18, 64, 543, 199, 25502, 3442, 5682, 91, 16221, 93, 7023, 23524, 63, 17, 1182, 971, 23524, 63, 18, 61, 690, 378, 2313, 710, 11358, 16028, 764, 199, 5777, 787, 314, 1603, 13286, 4492, 16028, 764, 3423, 14, 16917, 330, 5063, 590, 12, 642, 3420, 199, 9441, 221, 2173, 24950, 13, 1117, 456, 590, 18745, 3423, 334, 10180, 465, 314, 1603, 13286, 4492, 12724, 199, 5777, 9, 436, 1163, 3423, 2997, 315, 314, 25932, 402, 16028, 764, 3423, 14, 199, 199, 4089, 3365, 8758, 852, 367, 314, 2368, 402, 199, 16514, 764, 3423, 787, 315, 675, 14, 2779, 365, 2755, 4465, 370, 675, 199, 14020, 18117, 6236, 90, 1298, 367, 3365, 3423, 315, 314, 2011, 199, 505, 503, 2032, 334, 460, 6118, 3442, 365, 949, 1919, 680, 199, 1918, 20195, 2633, 787, 314, 16028, 764, 949, 278, 658, 81, 3559, 1314, 9987, 199, 7790, 23082, 658, 92, 81, 92, 665, 413, 64, 27, 314, 16028, 764, 2725, 658, 77, 64, 334, 290, 9697, 199, 5254, 1329, 2736, 314, 16028, 764, 3413, 15909, 658, 75, 64, 334, 290, 9697, 6114, 199, 1955, 2736, 436, 314, 12995, 13, 5191, 10463, 29520, 16656, 3559, 1314, 9987, 1471, 199, 18270, 1399, 29520, 3442, 5682, 91, 16221, 93, 7023, 16656, 61, 690, 378, 2313, 199, 20676, 13621, 1417, 883, 506, 19147, 315, 2895, 402, 1924, 1163, 199, 4941, 314, 2569, 16109, 26, 199, 199, 703, 3473, 3800, 339, 333, 275, 1022, 62, 18, 199, 199, 703, 3473, 3800, 339, 971, 16656, 275, 446, 73, 971, 10865, 91, 43, 8, 17, 13, 77, 6769, 91, 43, 8, 77, 6769, 199, 199, 703, 3473, 3800, 339, 1894, 275, 325, 11683, 73, 971, 1038, 971, 16656, 93, 199, 199, 703, 3473, 3800, 339, 1022, 275, 971, 10865, 12911, 1391, 9337, 63, 18, 62, 20, 8, 81, 6769, 12911, 1391, 9337, 63, 19, 62, 20, 8, 81, 6769, 199, 199, 607, 10234, 12, 376, 13943, 5492, 365, 1202, 367, 314, 949, 278, 315, 199, 1955, 30629, 12, 1314, 781, 2348, 477, 4610, 701, 1894, 13, 1700, 26, 199, 199, 703, 3473, 3800, 339, 971, 1700, 91, 81, 93, 275, 1894, 62, 18, 275, 325, 11683, 18, 284, 971, 1038, 971, 16656, 93, 199, 199, 1858, 16777, 12, 6118, 3442, 6571, 3423, 370, 3957, 199, 13007, 314, 7750, 2633, 18479, 1532, 6054, 311, 3442, 14, 81, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 77, 504, 3559, 199, 26, 1532, 6054, 311, 3442, 14, 75, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 16656, 504, 3559, 520, 1532, 6054, 311, 3442, 14, 81, 1700, 504, 14963, 199, 199, 538, 15242, 538, 199, 199, 17, 14, 359, 5583, 345, 573, 25809, 26696, 17924, 25276, 199, 199, 18, 14, 359, 5879, 390, 502, 2570, 55, 292, 834, 25276, 199, 199, 624, 199, 199, 504, 1275, 5777, 492, 347, 324, 12, 347, 324, 63, 9130, 199, 199, 318, 949, 278, 8, 3799, 12, 333, 304, 272, 333, 275, 4027, 14, 3916, 8, 77, 9, 272, 340, 440, 333, 26, 267, 372, 333, 272, 340, 333, 508, 4027, 14, 368, 26, 267, 372, 333, 272, 340, 4027, 14, 12936, 8, 77, 304, 267, 372, 333, 272, 340, 4027, 14, 29326, 8, 77, 304, 267, 340, 333, 508, 4027, 14, 78, 4904, 26, 288, 372, 730, 8, 77, 9, 2801, 17, 9, 267, 587, 26, 288, 372, 4027, 14, 311, 67, 2801, 17, 9, 272, 282, 275, 4027, 14, 352, 317, 2051, 8, 3799, 14, 368, 13, 77, 9, 272, 330, 275, 4027, 14, 352, 317, 2051, 8, 77, 9, 272, 373, 275, 4027, 14, 1474, 2801, 3799, 14, 1038, 10, 65, 15, 66, 9, 272, 340, 440, 4027, 423, 1017, 8, 77, 9, 436, 4027, 423, 264, 8, 77, 9, 665, 413, 26, 267, 340, 4027, 423, 374, 63, 3093, 63, 466, 8, 77, 304, 288, 372, 373, 14, 3093, 267, 587, 26, 288, 372, 373, 14, 3093, 435, 378, 74, 272, 916, 333, 508, 499, 26, 267, 373, 275, 4027, 14, 311, 67, 8, 16, 12, 373, 14, 14688, 9, 272, 372, 373, 199, 199, 32, 318, 324, 63, 9130, 199, 318, 1894, 504, 8, 3799, 12, 1894, 29, 403, 12, 333, 29, 403, 12, 1022, 29, 403, 12, 19188, 29, 403, 12, 1894, 1700, 29, 403, 304, 272, 519, 624, 272, 1803, 314, 16028, 764, 949, 278, 658, 81, 3559, 1627, 1263, 402, 658, 81, 12, 333, 12, 1022, 12, 971, 16656, 12, 971, 1700, 91, 81, 23485, 447, 398, 1306, 687, 5840, 14, 311, 3442, 492, 627, 267, 1306, 6118, 14, 30168, 275, 5661, 27, 6118, 14, 9118, 275, 715, 267, 1306, 1894, 504, 8, 81, 29, 16, 14, 821, 9, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 77, 29, 77, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 75, 29, 75, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 267, 1306, 1894, 504, 8, 16656, 29, 16656, 504, 8, 81, 29, 16, 14, 821, 430, 267, 334, 16, 14, 821, 435, 378, 14, 16, 74, 9, 267, 1306, 1894, 504, 8, 81, 1700, 29, 81, 1700, 504, 8, 81, 29, 16, 14, 821, 430, 267, 378, 14, 821, 339, 408, 272, 340, 1894, 365, 440, 488, 26, 267, 372, 4027, 14, 3916, 8, 81, 9, 272, 340, 333, 365, 440, 488, 26, 267, 372, 949, 278, 8, 3799, 12, 333, 9, 272, 340, 1022, 365, 440, 488, 26, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
timlau/dnf-utils
plugins/sample.py
1
3103
# dnf-utils - add-on tools for DNF # Copyright (C) 2014 Tim Lauridsen < timlau<AT>fedoraproject<DOT>org > # # 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 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, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. from dnfutils import logger, _ import dnf import dnf.cli import dnf.exceptions import dnfutils # TODO: dnf Plugin class, rename to your <Command> class Sample(dnf.Plugin): # TODO: Use your own command name here (lowercase) name = 'sample' def __init__(self, base, cli): self.base = base self.cli = cli logger.debug('Initialized %s plugin', self.name) if self.cli is not None: # TODO: use your own <Command>Command class here self.cli.register_command(SampleCommand) # TODO: dnf Command class, rename to your <Command>Command class SampleCommand(dnf.cli.Command): """ the util command there is extending the dnf command line """ # TODO: the tool command, use your own command aliases = ["sample"] # TODO: summary for util, shown in dnf help, add your own summary = _('One line description of the util') # TODO usage string for the util, shown by dnf help <command> usage = _('[PARAMETERS]') def configure(self, args): """ setup the client demands""" demands = self.cli.demands demands.sack_activation = True demands.available_repos = True def run(self, args): """ execute the util action here """ # Setup ArgumentParser to handle util # You must only add options not used by dnf already parser = dnfutils.ArgumentParser(self.aliases[0]) # TODO: example options/arg add your own parser.add_argument('cmd', nargs=1, help='the sub command') parser.add_argument('parms', nargs='*', help='the parameters to the sub command') parser.add_argument("--some-option", action='store_true', help='an optional option') # parse the options/args # list available options/args on errors & exit opts = parser.parse_args(args) # show util help & exit if opts.help_cmd: print(parser.format_help()) return # TODO: the main tool code, add your own print('Sample util is running with :') print(' cmd = : %s' % opts.cmd) print(' parms = : %s' % opts.parms) print(' some-option : %s' % opts.some_option)
gpl-2.0
[ 3, 259, 28215, 13, 1208, 446, 1050, 13, 265, 7249, 367, 577, 19749, 199, 3, 259, 1898, 334, 35, 9, 6927, 26244, 7964, 300, 344, 2464, 665, 221, 2906, 416, 85, 28, 619, 30, 15800, 269, 30204, 963, 28, 13203, 30, 1308, 690, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 259, 2752, 12, 3277, 2020, 1227, 2194, 603, 405, 437, 432, 12, 445, 455, 9528, 12, 4828, 12497, 7491, 12, 8217, 14, 199, 199, 504, 28215, 1208, 492, 2512, 12, 485, 199, 199, 646, 28215, 199, 646, 28215, 14, 2764, 199, 646, 28215, 14, 3924, 199, 646, 28215, 1208, 421, 199, 3, 3254, 26, 28215, 11349, 1021, 12, 11441, 370, 2195, 665, 3110, 30, 199, 533, 15227, 8, 4272, 70, 14, 5061, 304, 339, 327, 3254, 26, 3645, 2195, 5705, 1414, 536, 2348, 334, 21636, 9, 272, 536, 275, 283, 3271, 7, 339, 347, 636, 826, 721, 277, 12, 1300, 12, 5053, 304, 267, 291, 14, 1095, 275, 1300, 267, 291, 14, 2764, 275, 5053, 267, 2512, 14, 1757, 360, 23031, 450, 83, 3589, 297, 291, 14, 354, 9, 267, 340, 291, 14, 2764, 365, 440, 488, 26, 288, 327, 3254, 26, 675, 2195, 5705, 665, 3110, 30, 3110, 1021, 2348, 288, 291, 14, 2764, 14, 2683, 63, 1531, 8, 8176, 3110, 9, 421, 199, 3, 3254, 26, 28215, 5817, 1021, 12, 11441, 370, 2195, 665, 3110, 30, 3110, 199, 533, 15227, 3110, 8, 4272, 70, 14, 2764, 14, 3110, 304, 272, 408, 314, 4884, 1414, 2337, 365, 2178, 1098, 314, 28215, 1414, 1004, 408, 339, 327, 3254, 26, 314, 4744, 1414, 12, 675, 2195, 5705, 1414, 272, 5481, 275, 2097, 3271, 937, 339, 327, 3254, 26, 6212, 367, 4884, 12, 9164, 315, 28215, 1720, 12, 1050, 2195, 5705, 272, 6212, 275, 4018, 4395, 1004, 1369, 402, 314, 4884, 358, 272, 327, 3254, 4503, 1059, 367, 314, 4884, 12, 9164, 701, 28215, 1720, 665, 1531, 30, 272, 4503, 275, 4018, 59, 24014, 10374, 339, 347, 7908, 8, 277, 12, 1249, 304, 267, 408, 3272, 314, 1890, 28548, 5915, 624, 267, 28548, 5915, 275, 291, 14, 2764, 14, 23522, 5915, 267, 28548, 5915, 14, 83, 564, 63, 12312, 275, 715, 267, 28548, 5915, 14, 4561, 63, 11857, 275, 715, 339, 347, 1255, 8, 277, 12, 1249, 304, 267, 408, 5341, 314, 4884, 1595, 2348, 408, 267, 327, 12439, 27615, 370, 2429, 4884, 267, 327, 2047, 1471, 1454, 1050, 1511, 440, 1202, 701, 28215, 2575, 267, 1798, 275, 28215, 1208, 14, 10730, 8, 277, 14, 8602, 59, 16, 566, 267, 327, 3254, 26, 2893, 1511, 15, 1273, 1050, 2195, 5705, 267, 1798, 14, 525, 63, 2094, 360, 1760, 297, 9237, 29, 17, 12, 1720, 534, 1589, 1007, 1414, 358, 267, 1798, 14, 525, 63, 2094, 360, 28899, 297, 9237, 534, 7693, 1169, 1720, 534, 1589, 2633, 370, 314, 1007, 1414, 358, 267, 1798, 14, 525, 63, 2094, 6739, 3972, 13, 1422, 401, 1595, 534, 1617, 63, 2052, 297, 1169, 1720, 534, 290, 2716, 945, 358, 398, 327, 2198, 314, 1511, 15, 589, 267, 327, 769, 2808, 1511, 15, 589, 641, 2552, 1253, 4458, 267, 3999, 275, 1798, 14, 1122, 63, 589, 8, 589, 9, 398, 327, 2498, 4884, 1720, 1253, 4458, 267, 340, 3999, 14, 3437, 63, 1760, 26, 288, 870, 8, 2087, 14, 908, 63, 3437, 1012, 288, 372, 398, 327, 3254, 26, 314, 2446, 4744, 1233, 12, 1050, 2195, 5705, 267, 870, 360, 8176, 4884, 365, 3879, 543, 520, 358, 267, 870, 360, 259, 2088, 275, 755, 520, 450, 83, 7, 450, 3999, 14, 1760, 9, 267, 870, 360, 259, 623, 706, 275, 258, 520, 450, 83, 7, 450, 3999, 14, 28899, 9, 267, 870, 360, 259, 2005, 13, 1422, 520, 450, 83, 7, 450, 3999, 14, 3972, 63, 1422, 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 ]
[ 259, 28215, 13, 1208, 446, 1050, 13, 265, 7249, 367, 577, 19749, 199, 3, 259, 1898, 334, 35, 9, 6927, 26244, 7964, 300, 344, 2464, 665, 221, 2906, 416, 85, 28, 619, 30, 15800, 269, 30204, 963, 28, 13203, 30, 1308, 690, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 259, 2752, 12, 3277, 2020, 1227, 2194, 603, 405, 437, 432, 12, 445, 455, 9528, 12, 4828, 12497, 7491, 12, 8217, 14, 199, 199, 504, 28215, 1208, 492, 2512, 12, 485, 199, 199, 646, 28215, 199, 646, 28215, 14, 2764, 199, 646, 28215, 14, 3924, 199, 646, 28215, 1208, 421, 199, 3, 3254, 26, 28215, 11349, 1021, 12, 11441, 370, 2195, 665, 3110, 30, 199, 533, 15227, 8, 4272, 70, 14, 5061, 304, 339, 327, 3254, 26, 3645, 2195, 5705, 1414, 536, 2348, 334, 21636, 9, 272, 536, 275, 283, 3271, 7, 339, 347, 636, 826, 721, 277, 12, 1300, 12, 5053, 304, 267, 291, 14, 1095, 275, 1300, 267, 291, 14, 2764, 275, 5053, 267, 2512, 14, 1757, 360, 23031, 450, 83, 3589, 297, 291, 14, 354, 9, 267, 340, 291, 14, 2764, 365, 440, 488, 26, 288, 327, 3254, 26, 675, 2195, 5705, 665, 3110, 30, 3110, 1021, 2348, 288, 291, 14, 2764, 14, 2683, 63, 1531, 8, 8176, 3110, 9, 421, 199, 3, 3254, 26, 28215, 5817, 1021, 12, 11441, 370, 2195, 665, 3110, 30, 3110, 199, 533, 15227, 3110, 8, 4272, 70, 14, 2764, 14, 3110, 304, 272, 408, 314, 4884, 1414, 2337, 365, 2178, 1098, 314, 28215, 1414, 1004, 408, 339, 327, 3254, 26, 314, 4744, 1414, 12, 675, 2195, 5705, 1414, 272, 5481, 275, 2097, 3271, 937, 339, 327, 3254, 26, 6212, 367, 4884, 12, 9164, 315, 28215, 1720, 12, 1050, 2195, 5705, 272, 6212, 275, 4018, 4395, 1004, 1369, 402, 314, 4884, 358, 272, 327, 3254, 4503, 1059, 367, 314, 4884, 12, 9164, 701, 28215, 1720, 665, 1531, 30, 272, 4503, 275, 4018, 59, 24014, 10374, 339, 347, 7908, 8, 277, 12, 1249, 304, 267, 408, 3272, 314, 1890, 28548, 5915, 624, 267, 28548, 5915, 275, 291, 14, 2764, 14, 23522, 5915, 267, 28548, 5915, 14, 83, 564, 63, 12312, 275, 715, 267, 28548, 5915, 14, 4561, 63, 11857, 275, 715, 339, 347, 1255, 8, 277, 12, 1249, 304, 267, 408, 5341, 314, 4884, 1595, 2348, 408, 267, 327, 12439, 27615, 370, 2429, 4884, 267, 327, 2047, 1471, 1454, 1050, 1511, 440, 1202, 701, 28215, 2575, 267, 1798, 275, 28215, 1208, 14, 10730, 8, 277, 14, 8602, 59, 16, 566, 267, 327, 3254, 26, 2893, 1511, 15, 1273, 1050, 2195, 5705, 267, 1798, 14, 525, 63, 2094, 360, 1760, 297, 9237, 29, 17, 12, 1720, 534, 1589, 1007, 1414, 358, 267, 1798, 14, 525, 63, 2094, 360, 28899, 297, 9237, 534, 7693, 1169, 1720, 534, 1589, 2633, 370, 314, 1007, 1414, 358, 267, 1798, 14, 525, 63, 2094, 6739, 3972, 13, 1422, 401, 1595, 534, 1617, 63, 2052, 297, 1169, 1720, 534, 290, 2716, 945, 358, 398, 327, 2198, 314, 1511, 15, 589, 267, 327, 769, 2808, 1511, 15, 589, 641, 2552, 1253, 4458, 267, 3999, 275, 1798, 14, 1122, 63, 589, 8, 589, 9, 398, 327, 2498, 4884, 1720, 1253, 4458, 267, 340, 3999, 14, 3437, 63, 1760, 26, 288, 870, 8, 2087, 14, 908, 63, 3437, 1012, 288, 372, 398, 327, 3254, 26, 314, 2446, 4744, 1233, 12, 1050, 2195, 5705, 267, 870, 360, 8176, 4884, 365, 3879, 543, 520, 358, 267, 870, 360, 259, 2088, 275, 755, 520, 450, 83, 7, 450, 3999, 14, 1760, 9, 267, 870, 360, 259, 623, 706, 275, 258, 520, 450, 83, 7, 450, 3999, 14, 28899, 9, 267, 870, 360, 259, 2005, 13, 1422, 520, 450, 83, 7, 450, 3999, 14, 3972, 63, 1422, 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, 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, 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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 ]
sdaftuar/bitcoin
contrib/devtools/update-translations.py
17
7584
#!/usr/bin/env python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Run this script from the root of the repository to update all translations from transifex. It will do the following automatically: - fetch all translations using the tx tool - post-process them into valid and committable format - remove invalid control characters - remove location tags (makes diffs less noisy) TODO: - auto-add new translations to the build system according to the translation process ''' from __future__ import division, print_function import subprocess import re import sys import os import io import xml.etree.ElementTree as ET # Name of transifex tool TX = 'tx' # Name of source language file SOURCE_LANG = 'bitcoin_en.ts' # Directory with locale files LOCALE_DIR = 'src/qt/locale' # Minimum number of messages for translation to be considered at all MIN_NUM_MESSAGES = 10 def check_at_repository_root(): if not os.path.exists('.git'): print('No .git directory found') print('Execute this script at the root of the repository', file=sys.stderr) exit(1) def fetch_all_translations(): if subprocess.call([TX, 'pull', '-f', '-a']): print('Error while fetching translations', file=sys.stderr) exit(1) def find_format_specifiers(s): '''Find all format specifiers in a string.''' pos = 0 specifiers = [] while True: percent = s.find('%', pos) if percent < 0: break specifiers.append(s[percent+1]) pos = percent+2 return specifiers def split_format_specifiers(specifiers): '''Split format specifiers between numeric (Qt) and others (strprintf)''' numeric = [] other = [] for s in specifiers: if s in {'1','2','3','4','5','6','7','8','9'}: numeric.append(s) else: other.append(s) # numeric (Qt) can be present in any order, others (strprintf) must be in specified order return set(numeric),other def sanitize_string(s): '''Sanitize string for printing''' return s.replace('\n',' ') def check_format_specifiers(source, translation, errors, numerus): source_f = split_format_specifiers(find_format_specifiers(source)) # assert that no source messages contain both Qt and strprintf format specifiers # if this fails, go change the source as this is hacky and confusing! assert(not(source_f[0] and source_f[1])) try: translation_f = split_format_specifiers(find_format_specifiers(translation)) except IndexError: errors.append("Parse error in translation for '%s': '%s'" % (sanitize_string(source), sanitize_string(translation))) return False else: if source_f != translation_f: if numerus and source_f == (set(), ['n']) and translation_f == (set(), []) and translation.find('%') == -1: # Allow numerus translations to omit %n specifier (usually when it only has one possible value) return True errors.append("Mismatch between '%s' and '%s'" % (sanitize_string(source), sanitize_string(translation))) return False return True def all_ts_files(suffix=''): for filename in os.listdir(LOCALE_DIR): # process only language files, and do not process source language if not filename.endswith('.ts'+suffix) or filename == SOURCE_LANG+suffix: continue if suffix: # remove provided suffix filename = filename[0:-len(suffix)] filepath = os.path.join(LOCALE_DIR, filename) yield(filename, filepath) FIX_RE = re.compile(b'[\x00-\x09\x0b\x0c\x0e-\x1f]') def remove_invalid_characters(s): '''Remove invalid characters from translation string''' return FIX_RE.sub(b'', s) # Override cdata escape function to make our output match Qt's (optional, just for cleaner diffs for # comparison, disable by default) _orig_escape_cdata = None def escape_cdata(text): text = _orig_escape_cdata(text) text = text.replace("'", '&apos;') text = text.replace('"', '&quot;') return text def postprocess_translations(reduce_diff_hacks=False): print('Checking and postprocessing...') if reduce_diff_hacks: global _orig_escape_cdata _orig_escape_cdata = ET._escape_cdata ET._escape_cdata = escape_cdata for (filename,filepath) in all_ts_files(): os.rename(filepath, filepath+'.orig') have_errors = False for (filename,filepath) in all_ts_files('.orig'): # pre-fixups to cope with transifex output parser = ET.XMLParser(encoding='utf-8') # need to override encoding because 'utf8' is not understood only 'utf-8' with open(filepath + '.orig', 'rb') as f: data = f.read() # remove control characters; this must be done over the entire file otherwise the XML parser will fail data = remove_invalid_characters(data) tree = ET.parse(io.BytesIO(data), parser=parser) # iterate over all messages in file root = tree.getroot() for context in root.findall('context'): for message in context.findall('message'): numerus = message.get('numerus') == 'yes' source = message.find('source').text translation_node = message.find('translation') # pick all numerusforms if numerus: translations = [i.text for i in translation_node.findall('numerusform')] else: translations = [translation_node.text] for translation in translations: if translation is None: continue errors = [] valid = check_format_specifiers(source, translation, errors, numerus) for error in errors: print('%s: %s' % (filename, error)) if not valid: # set type to unfinished and clear string if invalid translation_node.clear() translation_node.set('type', 'unfinished') have_errors = True # Remove location tags for location in message.findall('location'): message.remove(location) # Remove entire message if it is an unfinished translation if translation_node.get('type') == 'unfinished': context.remove(message) # check if document is (virtually) empty, and remove it if so num_messages = 0 for context in root.findall('context'): for message in context.findall('message'): num_messages += 1 if num_messages < MIN_NUM_MESSAGES: print('Removing %s, as it contains only %i messages' % (filepath, num_messages)) continue # write fixed-up tree # if diff reduction requested, replace some XML to 'sanitize' to qt formatting if reduce_diff_hacks: out = io.BytesIO() tree.write(out, encoding='utf-8') out = out.getvalue() out = out.replace(b' />', b'/>') with open(filepath, 'wb') as f: f.write(out) else: tree.write(filepath, encoding='utf-8') return have_errors if __name__ == '__main__': check_at_repository_root() fetch_all_translations() postprocess_translations()
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 67, 9, 6927, 644, 416, 3572, 723, 1603, 14, 20744, 16921, 7964, 290, 199, 3, 17484, 1334, 314, 10697, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 2344, 199, 2540, 642, 2884, 687, 314, 1738, 402, 314, 7611, 370, 1678, 1006, 15547, 687, 199, 3936, 338, 70, 476, 14, 199, 7940, 911, 886, 314, 2569, 5847, 26, 199, 199, 13, 5267, 1006, 15547, 1808, 314, 4773, 4744, 199, 13, 2963, 13, 1412, 3062, 1901, 1686, 436, 5532, 1224, 1475, 523, 446, 2813, 3866, 3304, 4110, 523, 446, 2813, 2909, 3762, 334, 391, 9246, 14981, 6656, 949, 19765, 9, 199, 199, 11768, 26, 199, 13, 2599, 13, 525, 892, 15547, 370, 314, 1900, 2656, 7182, 370, 314, 7761, 2112, 199, 2344, 199, 504, 636, 2443, 363, 492, 4629, 12, 870, 63, 1593, 199, 646, 3873, 199, 646, 295, 199, 646, 984, 199, 646, 747, 199, 646, 5890, 199, 646, 2748, 14, 9464, 14, 15325, 465, 12265, 199, 199, 3, 2812, 402, 7115, 338, 70, 476, 4744, 199, 10051, 275, 283, 2347, 7, 199, 3, 2812, 402, 1350, 2637, 570, 199, 10187, 63, 7442, 275, 283, 22816, 63, 287, 14, 1086, 7, 199, 3, 15191, 543, 5867, 1584, 199, 20828, 63, 3022, 275, 283, 2164, 15, 8440, 15, 5508, 7, 199, 3, 22466, 1329, 402, 3788, 367, 7761, 370, 506, 8652, 737, 1006, 199, 4896, 63, 7125, 63, 23229, 275, 1616, 199, 199, 318, 1104, 63, 292, 63, 8421, 63, 1231, 837, 272, 340, 440, 747, 14, 515, 14, 2444, 5175, 3187, 735, 267, 870, 360, 1944, 1275, 3187, 2082, 1911, 358, 267, 870, 360, 12049, 642, 2884, 737, 314, 1738, 402, 314, 7611, 297, 570, 29, 1274, 14, 3083, 9, 267, 4458, 8, 17, 9, 199, 199, 318, 5267, 63, 452, 63, 13982, 837, 272, 340, 3873, 14, 1250, 779, 10051, 12, 283, 9302, 297, 2475, 70, 297, 2475, 65, 9090, 267, 870, 360, 547, 1830, 21239, 15547, 297, 570, 29, 1274, 14, 3083, 9, 267, 4458, 8, 17, 9, 199, 199, 318, 2342, 63, 908, 63, 31659, 8, 83, 304, 272, 1449, 6591, 1006, 1475, 29558, 315, 282, 1059, 10595, 272, 2086, 275, 378, 272, 29558, 275, 942, 272, 1830, 715, 26, 267, 8878, 275, 308, 14, 1623, 3508, 297, 2086, 9, 267, 340, 8878, 665, 378, 26, 288, 2059, 267, 29558, 14, 740, 8, 83, 59, 7045, 11, 17, 566, 267, 2086, 275, 8878, 11, 18, 272, 372, 29558, 199, 199, 318, 3715, 63, 908, 63, 31659, 8, 31659, 304, 272, 1449, 8862, 1475, 29558, 3382, 8950, 334, 4238, 9, 436, 11789, 334, 495, 19139, 9, 2344, 272, 8950, 275, 942, 272, 1163, 275, 942, 272, 367, 308, 315, 29558, 26, 267, 340, 308, 315, 791, 17, 1673, 18, 1673, 19, 1673, 20, 1673, 21, 1673, 22, 1673, 23, 1673, 24, 1673, 25, 936, 26, 288, 8950, 14, 740, 8, 83, 9, 267, 587, 26, 288, 1163, 14, 740, 8, 83, 9, 339, 327, 8950, 334, 4238, 9, 883, 506, 3451, 315, 1263, 1865, 12, 11789, 334, 495, 19139, 9, 1471, 506, 315, 2013, 1865, 272, 372, 663, 8, 6677, 395, 1848, 199, 199, 318, 21077, 63, 875, 8, 83, 304, 272, 1449, 51, 12531, 1059, 367, 16116, 2344, 272, 372, 308, 14, 1814, 2258, 78, 1673, 5320, 199, 199, 318, 1104, 63, 908, 63, 31659, 8, 1365, 12, 7761, 12, 2552, 12, 10330, 20791, 304, 272, 1350, 63, 70, 275, 3715, 63, 908, 63, 31659, 8, 1623, 63, 908, 63, 31659, 8, 1365, 430, 272, 327, 702, 626, 949, 1350, 3788, 1395, 3865, 3959, 436, 620, 19139, 1475, 29558, 272, 327, 340, 642, 6918, 12, 2621, 1570, 314, 1350, 465, 642, 365, 11176, 89, 436, 3743, 4941, 1, 272, 702, 8, 1397, 8, 1365, 63, 70, 59, 16, 61, 436, 1350, 63, 70, 59, 17, 2459, 272, 862, 26, 267, 7761, 63, 70, 275, 3715, 63, 908, 63, 31659, 8, 1623, 63, 908, 63, 31659, 8, 6893, 430, 272, 871, 7888, 26, 267, 2552, 14, 740, 480, 4003, 1125, 315, 7761, 367, 1543, 83, 356, 1543, 83, 4065, 450, 334, 18177, 63, 875, 8, 1365, 395, 21077, 63, 875, 8, 6893, 1724, 267, 372, 756, 272, 587, 26, 267, 340, 1350, 63, 70, 1137, 7761, 63, 70, 26, 288, 340, 10330, 20791, 436, 1350, 63, 70, 508, 334, 409, 1062, 788, 78, 1105, 436, 7761, 63, 70, 508, 334, 409, 1062, 3073, 436, 7761, 14, 1623, 3508, 358, 508, 446, 17, 26, 355, 327, 9812, 10330, 20791, 15547, 370, 19413, 450, 78, 16628, 334, 25118, 1380, 652, 1454, 965, 1373, 3962, 574, 9, 355, 372, 715, 288, 2552, 14, 740, 480, 23055, 3382, 1543, 83, 7, 436, 1543, 83, 4065, 450, 334, 18177, 63, 875, 8, 1365, 395, 21077, 63, 875, 8, 6893, 1724, 288, 372, 756, 272, 372, 715, 199, 199, 318, 1006, 63, 1086, 63, 1725, 8, 4511, 9280, 272, 367, 1788, 315, 747, 14, 7374, 8, 20828, 63, 3022, 304, 267, 327, 2112, 1454, 2637, 1584, 12, 436, 886, 440, 2112, 1350, 2637, 267, 340, 440, 1788, 14, 4130, 5175, 1086, 6828, 4511, 9, 503, 1788, 508, 25470, 63, 7442, 11, 4511, 26, 288, 1980, 267, 340, 4739, 26, 327, 2813, 2741, 4739, 288, 1788, 275, 1788, 59, 16, 6809, 552, 8, 4511, 1874, 267, 9911, 275, 747, 14, 515, 14, 904, 8, 20828, 63, 3022, 12, 1788, 9, 267, 1995, 8, 1501, 12, 9911, 9, 199, 199, 5192, 63, 907, 275, 295, 14, 2014, 8, 66, 22123, 88, 383, 2696, 88, 1643, 60, 88, 16, 66, 60, 88, 16, 67, 60, 88, 16, 69, 2696, 88, 17, 70, 10374, 199, 318, 2813, 63, 3197, 63, 16516, 8, 83, 304, 272, 1449, 5587, 3866, 4110, 687, 7761, 1059, 2344, 272, 372, 7333, 63, 907, 14, 954, 8, 66, 6448, 308, 9, 199, 199, 3, 11041, 286, 576, 4772, 805, 370, 1852, 4154, 1072, 1336, 3959, 1159, 334, 4144, 12, 2951, 367, 3633, 281, 14981, 367, 199, 3, 9132, 12, 3507, 701, 849, 9, 199, 63, 2981, 63, 3765 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 67, 9, 6927, 644, 416, 3572, 723, 1603, 14, 20744, 16921, 7964, 290, 199, 3, 17484, 1334, 314, 10697, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 2344, 199, 2540, 642, 2884, 687, 314, 1738, 402, 314, 7611, 370, 1678, 1006, 15547, 687, 199, 3936, 338, 70, 476, 14, 199, 7940, 911, 886, 314, 2569, 5847, 26, 199, 199, 13, 5267, 1006, 15547, 1808, 314, 4773, 4744, 199, 13, 2963, 13, 1412, 3062, 1901, 1686, 436, 5532, 1224, 1475, 523, 446, 2813, 3866, 3304, 4110, 523, 446, 2813, 2909, 3762, 334, 391, 9246, 14981, 6656, 949, 19765, 9, 199, 199, 11768, 26, 199, 13, 2599, 13, 525, 892, 15547, 370, 314, 1900, 2656, 7182, 370, 314, 7761, 2112, 199, 2344, 199, 504, 636, 2443, 363, 492, 4629, 12, 870, 63, 1593, 199, 646, 3873, 199, 646, 295, 199, 646, 984, 199, 646, 747, 199, 646, 5890, 199, 646, 2748, 14, 9464, 14, 15325, 465, 12265, 199, 199, 3, 2812, 402, 7115, 338, 70, 476, 4744, 199, 10051, 275, 283, 2347, 7, 199, 3, 2812, 402, 1350, 2637, 570, 199, 10187, 63, 7442, 275, 283, 22816, 63, 287, 14, 1086, 7, 199, 3, 15191, 543, 5867, 1584, 199, 20828, 63, 3022, 275, 283, 2164, 15, 8440, 15, 5508, 7, 199, 3, 22466, 1329, 402, 3788, 367, 7761, 370, 506, 8652, 737, 1006, 199, 4896, 63, 7125, 63, 23229, 275, 1616, 199, 199, 318, 1104, 63, 292, 63, 8421, 63, 1231, 837, 272, 340, 440, 747, 14, 515, 14, 2444, 5175, 3187, 735, 267, 870, 360, 1944, 1275, 3187, 2082, 1911, 358, 267, 870, 360, 12049, 642, 2884, 737, 314, 1738, 402, 314, 7611, 297, 570, 29, 1274, 14, 3083, 9, 267, 4458, 8, 17, 9, 199, 199, 318, 5267, 63, 452, 63, 13982, 837, 272, 340, 3873, 14, 1250, 779, 10051, 12, 283, 9302, 297, 2475, 70, 297, 2475, 65, 9090, 267, 870, 360, 547, 1830, 21239, 15547, 297, 570, 29, 1274, 14, 3083, 9, 267, 4458, 8, 17, 9, 199, 199, 318, 2342, 63, 908, 63, 31659, 8, 83, 304, 272, 1449, 6591, 1006, 1475, 29558, 315, 282, 1059, 10595, 272, 2086, 275, 378, 272, 29558, 275, 942, 272, 1830, 715, 26, 267, 8878, 275, 308, 14, 1623, 3508, 297, 2086, 9, 267, 340, 8878, 665, 378, 26, 288, 2059, 267, 29558, 14, 740, 8, 83, 59, 7045, 11, 17, 566, 267, 2086, 275, 8878, 11, 18, 272, 372, 29558, 199, 199, 318, 3715, 63, 908, 63, 31659, 8, 31659, 304, 272, 1449, 8862, 1475, 29558, 3382, 8950, 334, 4238, 9, 436, 11789, 334, 495, 19139, 9, 2344, 272, 8950, 275, 942, 272, 1163, 275, 942, 272, 367, 308, 315, 29558, 26, 267, 340, 308, 315, 791, 17, 1673, 18, 1673, 19, 1673, 20, 1673, 21, 1673, 22, 1673, 23, 1673, 24, 1673, 25, 936, 26, 288, 8950, 14, 740, 8, 83, 9, 267, 587, 26, 288, 1163, 14, 740, 8, 83, 9, 339, 327, 8950, 334, 4238, 9, 883, 506, 3451, 315, 1263, 1865, 12, 11789, 334, 495, 19139, 9, 1471, 506, 315, 2013, 1865, 272, 372, 663, 8, 6677, 395, 1848, 199, 199, 318, 21077, 63, 875, 8, 83, 304, 272, 1449, 51, 12531, 1059, 367, 16116, 2344, 272, 372, 308, 14, 1814, 2258, 78, 1673, 5320, 199, 199, 318, 1104, 63, 908, 63, 31659, 8, 1365, 12, 7761, 12, 2552, 12, 10330, 20791, 304, 272, 1350, 63, 70, 275, 3715, 63, 908, 63, 31659, 8, 1623, 63, 908, 63, 31659, 8, 1365, 430, 272, 327, 702, 626, 949, 1350, 3788, 1395, 3865, 3959, 436, 620, 19139, 1475, 29558, 272, 327, 340, 642, 6918, 12, 2621, 1570, 314, 1350, 465, 642, 365, 11176, 89, 436, 3743, 4941, 1, 272, 702, 8, 1397, 8, 1365, 63, 70, 59, 16, 61, 436, 1350, 63, 70, 59, 17, 2459, 272, 862, 26, 267, 7761, 63, 70, 275, 3715, 63, 908, 63, 31659, 8, 1623, 63, 908, 63, 31659, 8, 6893, 430, 272, 871, 7888, 26, 267, 2552, 14, 740, 480, 4003, 1125, 315, 7761, 367, 1543, 83, 356, 1543, 83, 4065, 450, 334, 18177, 63, 875, 8, 1365, 395, 21077, 63, 875, 8, 6893, 1724, 267, 372, 756, 272, 587, 26, 267, 340, 1350, 63, 70, 1137, 7761, 63, 70, 26, 288, 340, 10330, 20791, 436, 1350, 63, 70, 508, 334, 409, 1062, 788, 78, 1105, 436, 7761, 63, 70, 508, 334, 409, 1062, 3073, 436, 7761, 14, 1623, 3508, 358, 508, 446, 17, 26, 355, 327, 9812, 10330, 20791, 15547, 370, 19413, 450, 78, 16628, 334, 25118, 1380, 652, 1454, 965, 1373, 3962, 574, 9, 355, 372, 715, 288, 2552, 14, 740, 480, 23055, 3382, 1543, 83, 7, 436, 1543, 83, 4065, 450, 334, 18177, 63, 875, 8, 1365, 395, 21077, 63, 875, 8, 6893, 1724, 288, 372, 756, 272, 372, 715, 199, 199, 318, 1006, 63, 1086, 63, 1725, 8, 4511, 9280, 272, 367, 1788, 315, 747, 14, 7374, 8, 20828, 63, 3022, 304, 267, 327, 2112, 1454, 2637, 1584, 12, 436, 886, 440, 2112, 1350, 2637, 267, 340, 440, 1788, 14, 4130, 5175, 1086, 6828, 4511, 9, 503, 1788, 508, 25470, 63, 7442, 11, 4511, 26, 288, 1980, 267, 340, 4739, 26, 327, 2813, 2741, 4739, 288, 1788, 275, 1788, 59, 16, 6809, 552, 8, 4511, 1874, 267, 9911, 275, 747, 14, 515, 14, 904, 8, 20828, 63, 3022, 12, 1788, 9, 267, 1995, 8, 1501, 12, 9911, 9, 199, 199, 5192, 63, 907, 275, 295, 14, 2014, 8, 66, 22123, 88, 383, 2696, 88, 1643, 60, 88, 16, 66, 60, 88, 16, 67, 60, 88, 16, 69, 2696, 88, 17, 70, 10374, 199, 318, 2813, 63, 3197, 63, 16516, 8, 83, 304, 272, 1449, 5587, 3866, 4110, 687, 7761, 1059, 2344, 272, 372, 7333, 63, 907, 14, 954, 8, 66, 6448, 308, 9, 199, 199, 3, 11041, 286, 576, 4772, 805, 370, 1852, 4154, 1072, 1336, 3959, 1159, 334, 4144, 12, 2951, 367, 3633, 281, 14981, 367, 199, 3, 9132, 12, 3507, 701, 849, 9, 199, 63, 2981, 63, 3765, 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, 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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 ]
VanyaDNDZ/django-sybase-backend
sqlsybase_server/pyodbc/compiler.py
1
10019
from django.db.models.sql import compiler from datetime import datetime import re from django.db.models.base import Model REV_ODIR = { 'ASC': 'DESC', 'DESC': 'ASC' } SQL_SERVER_8_LIMIT_QUERY = \ """SELECT * FROM ( SELECT TOP %(limit)s * FROM ( %(orig_sql)s ORDER BY %(ord)s ) AS %(table)s ORDER BY %(rev_ord)s ) AS %(table)s ORDER BY %(ord)s""" SQL_SERVER_8_NO_LIMIT_QUERY = \ """SELECT * FROM %(table)s WHERE %(key)s NOT IN ( %(orig_sql)s ORDER BY %(ord)s )""" # Strategies for handling limit+offset emulation: USE_ROW_NUMBER = 0 # For SQL Server >= 2005 USE_TOP_HMARK = 1 # For SQL Server 2000 when both limit and offset are provided USE_TOP_LMARK = 2 # For SQL Server 2000 when offset but no limit is provided class SQLCompiler(compiler.SQLCompiler): def resolve_columns(self, row, fields=()): index_start = len(self.query.extra_select.keys()) values = [self.query.convert_values(v, None, connection=self.connection) for v in row[:index_start]] for value, field in map(None, row[index_start:], fields): values.append(self.query.convert_values(value, field, connection=self.connection)) return tuple(values) """ use django as_sql with editing limit """ def as_sql(self, with_limits=True, with_col_aliases=False): """ Creates the SQL for this query. Returns the SQL string and list of parameters. If 'with_limits' is False, any limit/offset information is not included in the query. """ do_offset = with_limits and (self.query.high_mark is not None or self.query.low_mark != 0) if not do_offset: return super(SQLCompiler, self).as_sql(with_limits=False, with_col_aliases=with_col_aliases) select_re = re.compile('^SELECT[ ]+(DISTINCT\s)?') query, params = super(SQLCompiler, self).as_sql(with_limits=False, with_col_aliases=with_col_aliases) m = select_re.match(query) if with_limits and m != None: num = None insert = None if self.query.high_mark is not None: num = self.query.high_mark - self.query.low_mark if num <= 0: return None, None insert = 'TOP %d' % num if insert is not None: if m.groups()[0] != None: query = select_re.sub('SELECT DISTINCT %s ' % insert, query) else: query = select_re.sub('SELECT %s ' % insert, query) return query, params class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): def as_sql_legacy(self): # We don't need quote_name_unless_alias() here, since these are all # going to be column names (so we can avoid the extra overhead). qn = self.connection.ops.quote_name opts = self.query.model._meta returns_id = bool(self.return_id and self.connection.features.can_return_id_from_insert) if returns_id: result = ['SET NOCOUNT ON'] else: result = [] result.append('INSERT INTO %s' % qn(opts.db_table)) result.append('(%s)' % ', '.join([qn(c) for c in self.query.columns])) values = [self.placeholder(*v) for v in self.query.values] result.append('VALUES (%s)' % ', '.join(values)) if returns_id: result.append(';\nSELECT SCOPE_IDENTITY()') params = self.query.params sql = ' '.join(result) meta = self.query.get_meta() if meta.has_auto_field: # db_column is None if not explicitly specified by model field auto_field_column = meta.auto_field.db_column or meta.auto_field.column if auto_field_column in self.query.columns: quoted_table = self.connection.ops.quote_name(meta.db_table) if returns_id: sql = "SET NOCOUNT ON" else: sql = "" if len(self.query.columns) == 1 and not params: sql += "INSERT INTO %s DEFAULT VALUES" % quoted_table else: sql += "SET IDENTITY_INSERT %s ON;\n%s;\nSET IDENTITY_INSERT %s OFF" % \ (quoted_table, sql, quoted_table) if returns_id: sql += '\n;SELECT SCOPE_IDENTITY()' return sql, params def as_sql(self): from django.db.models.fields import DateTimeField from django.db.models.fields import DateField """ using django as_sql() with exclude Datetime field with None value which is nullable """ # return super(SQLInsertCompiler, self).as_sql() qn = self.connection.ops.quote_name opts = self.query.model._meta result = ['INSERT INTO %s' % qn(opts.db_table)] has_fields = bool(self.query.fields) preset_fields = self.query.fields if has_fields else [opts.pk] fields = [] if len(self.query.objs) == 1: # check only one row insert # multi-row pass # so multi-row rows will crash for field in preset_fields: # if not isinstance(field, (DateField, DateTimeField)): # fields.append(field) if field.get_db_prep_save( getattr(self.query.objs[0], field.attname) if self.query.raw else field.pre_save(self.query.objs[0], True), connection=self.connection) is not None: fields.append(field) elif field.blank is not True: fields.append(field) else: fields = preset_fields result.append('(%s)' % ', '.join([qn(f.column) for f in fields])) if has_fields: params = values = [ [ f.get_db_prep_save(getattr(obj, f.attname) if self.query.raw else f.pre_save(obj, True), connection=self.connection) for f in fields ] for obj in self.query.objs ] else: values = [[self.connection.ops.pk_default_value()] for obj in self.query.objs] params = [[]] fields = [None] can_bulk = (not any(hasattr(field, "get_placeholder") for field in fields) and not self.return_id and self.connection.features.has_bulk_insert) if can_bulk: placeholders = [["%s"] * len(fields)] else: placeholders = [ [self.placeholder(field, v) for field, v in zip(fields, val)] for val in values ] # Oracle Spatial needs to remove some values due to #10888 params = self.connection.ops.modify_insert_params(placeholders, params) if self.return_id and self.connection.features.can_return_id_from_insert: params = params[0] col = "%s.%s" % (qn(opts.db_table), qn(opts.pk.column)) result.append("VALUES (%s)" % ", ".join(placeholders[0])) r_fmt, r_params = self.connection.ops.return_insert_id() # Skip empty r_fmt to allow subclasses to customize behaviour for # 3rd party backends. Refs #19096. if r_fmt: result.append(r_fmt % col) params += r_params return [(" ".join(result), tuple(params))] if can_bulk: result.append(self.connection.ops.bulk_insert_sql(fields, len(values))) return [(" ".join(result), tuple([v for val in values for v in val]))] else: return [ (" ".join(result + ["VALUES (%s)" % ", ".join(p)]), vals) for p, vals in zip(placeholders, params) ] class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler): pass class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler): def as_sql(self): """ Copy of django UpdateCommpiler as_sql need cheack datetime field """ self.pre_sql_setup() if not self.query.values: return '', () table = self.query.tables[0] qn = self.quote_name_unless_alias result = ['UPDATE %s' % qn(table)] result.append('SET') values, update_params = [], [] for field, model, val in self.query.values: if hasattr(val, 'prepare_database_save'): val = val.prepare_database_save(field) else: val = field.get_db_prep_save(val, connection=self.connection) # Getting the placeholder for the field. if hasattr(field, 'get_placeholder'): placeholder = field.get_placeholder(val, self.connection) else: placeholder = '%s' if hasattr(val, 'evaluate'): val = SQLEvaluator(val, self.query, allow_joins=False) name = field.column if hasattr(val, 'as_sql'): sql, params = val.as_sql(qn, self.connection) values.append('%s = %s' % (qn(name), sql)) update_params.extend(params) elif val is not None: values.append('%s = %s' % (qn(name), placeholder)) update_params.append(val) else: values.append('%s = NULL' % qn(name)) if not values: return '', () result.append(', '.join(values)) where, params = self.query.where.as_sql(qn=qn, connection=self.connection) if where: result.append('WHERE %s' % where) return ' '.join(result), tuple(update_params + params) class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler): pass class SQLDateCompiler(compiler.SQLDateCompiler, SQLCompiler): pass
unlicense
[ 504, 1639, 14, 697, 14, 992, 14, 3009, 492, 6365, 199, 504, 2197, 492, 2197, 199, 646, 295, 199, 504, 1639, 14, 697, 14, 992, 14, 1095, 492, 5822, 199, 199, 23817, 63, 47, 3022, 275, 469, 272, 283, 22767, 356, 283, 15119, 297, 272, 283, 15119, 356, 283, 22767, 7, 199, 93, 199, 199, 4657, 63, 6613, 63, 24, 63, 13387, 63, 11938, 275, 971, 199, 624, 4859, 627, 199, 12491, 334, 523, 10468, 32582, 2818, 3097, 9, 83, 627, 523, 4442, 334, 272, 2818, 2981, 63, 3009, 9, 83, 272, 16044, 6515, 2818, 2181, 9, 83, 523, 776, 4319, 2818, 1224, 9, 83, 523, 16044, 6515, 2818, 4964, 63, 2181, 9, 83, 199, 9, 4319, 2818, 1224, 9, 83, 199, 12125, 6515, 2818, 2181, 9, 83, 624, 199, 199, 4657, 63, 6613, 63, 24, 63, 2826, 63, 13387, 63, 11938, 275, 971, 199, 624, 4859, 627, 199, 12491, 2818, 1224, 9, 83, 199, 17688, 2818, 498, 9, 83, 2845, 1621, 334, 523, 2818, 2981, 63, 3009, 9, 83, 523, 16044, 6515, 2818, 2181, 9, 83, 199, 9471, 199, 199, 3, 8303, 30363, 367, 7252, 2304, 11, 2743, 15074, 26, 199, 4701, 63, 11415, 63, 9190, 275, 378, 221, 327, 2104, 5385, 7146, 2356, 11811, 199, 4701, 63, 11422, 63, 40, 10520, 275, 413, 221, 327, 2104, 5385, 7146, 12293, 1380, 3865, 2304, 436, 3268, 787, 2741, 199, 4701, 63, 11422, 63, 44, 10520, 275, 499, 221, 327, 2104, 5385, 7146, 12293, 1380, 3268, 1325, 949, 2304, 365, 2741, 421, 199, 533, 5385, 9131, 8, 5772, 14, 4657, 9131, 304, 2286, 347, 7512, 63, 3406, 8, 277, 12, 1962, 12, 1504, 23603, 267, 1478, 63, 928, 275, 822, 8, 277, 14, 1131, 14, 2911, 63, 2416, 14, 1612, 1012, 267, 1338, 275, 359, 277, 14, 1131, 14, 3916, 63, 1459, 8, 86, 12, 488, 12, 1950, 29, 277, 14, 2105, 9, 367, 373, 315, 1962, 1491, 1080, 63, 928, 2677, 267, 367, 574, 12, 901, 315, 2341, 8, 403, 12, 1962, 59, 1080, 63, 928, 8429, 1504, 304, 288, 1338, 14, 740, 8, 277, 14, 1131, 14, 3916, 63, 1459, 8, 585, 12, 901, 12, 1950, 29, 277, 14, 2105, 430, 267, 372, 2008, 8, 1459, 9, 339, 408, 272, 675, 1639, 465, 63, 3009, 543, 20401, 2304, 272, 408, 272, 347, 465, 63, 3009, 8, 277, 12, 543, 63, 9368, 29, 549, 12, 543, 63, 761, 63, 8602, 29, 797, 304, 267, 408, 267, 10560, 314, 5385, 367, 642, 1827, 14, 1803, 314, 5385, 1059, 436, 769, 402, 267, 2633, 14, 398, 982, 283, 1045, 63, 9368, 7, 365, 756, 12, 1263, 2304, 15, 2743, 2556, 365, 440, 5120, 267, 315, 314, 1827, 14, 267, 408, 267, 886, 63, 2743, 275, 543, 63, 9368, 436, 334, 277, 14, 1131, 14, 6260, 63, 1657, 365, 440, 488, 503, 291, 14, 1131, 14, 674, 63, 1657, 1137, 378, 9, 267, 340, 440, 886, 63, 2743, 26, 288, 372, 1613, 8, 4657, 9131, 12, 291, 680, 305, 63, 3009, 8, 1045, 63, 9368, 29, 797, 12, 10028, 543, 63, 761, 63, 8602, 29, 1045, 63, 761, 63, 8602, 9, 267, 3504, 63, 264, 275, 295, 14, 2014, 9097, 4859, 59, 1622, 15622, 13783, 28437, 60, 83, 5547, 358, 267, 1827, 12, 1862, 275, 1613, 8, 4657, 9131, 12, 291, 680, 305, 63, 3009, 8, 1045, 63, 9368, 29, 797, 12, 9144, 543, 63, 761, 63, 8602, 29, 1045, 63, 761, 63, 8602, 9, 267, 333, 275, 3504, 63, 264, 14, 1431, 8, 1131, 9, 267, 340, 543, 63, 9368, 436, 333, 1137, 488, 26, 288, 1967, 275, 488, 288, 5518, 275, 488, 288, 340, 291, 14, 1131, 14, 6260, 63, 1657, 365, 440, 488, 26, 355, 1967, 275, 291, 14, 1131, 14, 6260, 63, 1657, 446, 291, 14, 1131, 14, 674, 63, 1657, 355, 340, 1967, 2695, 378, 26, 490, 372, 488, 12, 488, 355, 5518, 275, 283, 11422, 450, 68, 7, 450, 1967, 288, 340, 5518, 365, 440, 488, 26, 355, 340, 333, 14, 2634, 3430, 16, 61, 1137, 488, 26, 490, 1827, 275, 3504, 63, 264, 14, 954, 360, 4859, 28424, 28437, 450, 83, 283, 450, 5518, 12, 1827, 9, 355, 587, 26, 490, 1827, 275, 3504, 63, 264, 14, 954, 360, 4859, 450, 83, 283, 450, 5518, 12, 1827, 9, 267, 372, 1827, 12, 1862, 421, 199, 533, 5385, 9971, 9131, 8, 5772, 14, 4657, 9971, 9131, 12, 5385, 9131, 304, 339, 347, 465, 63, 3009, 63, 10000, 8, 277, 304, 267, 327, 2136, 2793, 1133, 1929, 6313, 63, 354, 63, 18447, 63, 3620, 342, 2348, 12, 3967, 3520, 787, 1006, 267, 327, 9995, 370, 506, 2763, 1561, 334, 1152, 781, 883, 5126, 314, 2402, 24075, 680, 267, 18293, 275, 291, 14, 2105, 14, 1483, 14, 3513, 63, 354, 267, 3999, 275, 291, 14, 1131, 14, 1238, 423, 2024, 267, 2529, 63, 344, 275, 2155, 8, 277, 14, 1107, 63, 344, 436, 2079, 291, 14, 2105, 14, 3179, 14, 2425, 63, 1107, 63, 344, 63, 504, 63, 3176, 9, 398, 340, 2529, 63, 344, 26, 288, 754, 275, 788, 3597, 4825, 8760, 5258, 418, 267, 587, 26, 288, 754, 275, 942, 398, 754, 14, 740, 360, 10258, 12872, 450, 83, 7, 450, 18293, 8, 3291, 14, 697, 63, 1224, 430, 267, 754, 14, 740, 360, 4042, 83, 3171, 450, 1656, 1987, 904, 779, 15156, 8, 67, 9, 367, 286, 315, 291, 14, 1131, 14, 3406, 2459, 398, 1338, 275, 359, 277, 14, 6199, 2031, 86, 9, 367, 373, 315, 291, 14, 1131, 14, 1459, 61, 267, 754, 14, 740, 360, 15514, 4366, 83, 3171, 450, 1656, 1987, 904, 8, 1459, 430, 398, 340, 2529, 63, 344, 26, 288, 754, 14, 740, 360, 3779, 78, 4859, 428, 1439, 1510, 63, 7466, 1922, 19004, 398, 1862, 275, 291, 14, 1131, 14, 1162, 267, 3875, 275, 283, 1987, 904, 8, 1099, 9, 398, 3404, 275, 291, 14, 1131, 14, 362, 63, 2024, 342, 267, 340, 3404, 14, 1989, 63, 2495, 63, 698, 26, 288, 327, 1592, 63, 2301, 365, 488, 340, 440, 7662, 2013, 701, 1402, 901, 288, 2599, 63, 698, 63, 2301, 275, 3404, 14, 2495, 63, 698, 14, 697, 63, 2301, 503, 3404 ]
[ 1639, 14, 697, 14, 992, 14, 3009, 492, 6365, 199, 504, 2197, 492, 2197, 199, 646, 295, 199, 504, 1639, 14, 697, 14, 992, 14, 1095, 492, 5822, 199, 199, 23817, 63, 47, 3022, 275, 469, 272, 283, 22767, 356, 283, 15119, 297, 272, 283, 15119, 356, 283, 22767, 7, 199, 93, 199, 199, 4657, 63, 6613, 63, 24, 63, 13387, 63, 11938, 275, 971, 199, 624, 4859, 627, 199, 12491, 334, 523, 10468, 32582, 2818, 3097, 9, 83, 627, 523, 4442, 334, 272, 2818, 2981, 63, 3009, 9, 83, 272, 16044, 6515, 2818, 2181, 9, 83, 523, 776, 4319, 2818, 1224, 9, 83, 523, 16044, 6515, 2818, 4964, 63, 2181, 9, 83, 199, 9, 4319, 2818, 1224, 9, 83, 199, 12125, 6515, 2818, 2181, 9, 83, 624, 199, 199, 4657, 63, 6613, 63, 24, 63, 2826, 63, 13387, 63, 11938, 275, 971, 199, 624, 4859, 627, 199, 12491, 2818, 1224, 9, 83, 199, 17688, 2818, 498, 9, 83, 2845, 1621, 334, 523, 2818, 2981, 63, 3009, 9, 83, 523, 16044, 6515, 2818, 2181, 9, 83, 199, 9471, 199, 199, 3, 8303, 30363, 367, 7252, 2304, 11, 2743, 15074, 26, 199, 4701, 63, 11415, 63, 9190, 275, 378, 221, 327, 2104, 5385, 7146, 2356, 11811, 199, 4701, 63, 11422, 63, 40, 10520, 275, 413, 221, 327, 2104, 5385, 7146, 12293, 1380, 3865, 2304, 436, 3268, 787, 2741, 199, 4701, 63, 11422, 63, 44, 10520, 275, 499, 221, 327, 2104, 5385, 7146, 12293, 1380, 3268, 1325, 949, 2304, 365, 2741, 421, 199, 533, 5385, 9131, 8, 5772, 14, 4657, 9131, 304, 2286, 347, 7512, 63, 3406, 8, 277, 12, 1962, 12, 1504, 23603, 267, 1478, 63, 928, 275, 822, 8, 277, 14, 1131, 14, 2911, 63, 2416, 14, 1612, 1012, 267, 1338, 275, 359, 277, 14, 1131, 14, 3916, 63, 1459, 8, 86, 12, 488, 12, 1950, 29, 277, 14, 2105, 9, 367, 373, 315, 1962, 1491, 1080, 63, 928, 2677, 267, 367, 574, 12, 901, 315, 2341, 8, 403, 12, 1962, 59, 1080, 63, 928, 8429, 1504, 304, 288, 1338, 14, 740, 8, 277, 14, 1131, 14, 3916, 63, 1459, 8, 585, 12, 901, 12, 1950, 29, 277, 14, 2105, 430, 267, 372, 2008, 8, 1459, 9, 339, 408, 272, 675, 1639, 465, 63, 3009, 543, 20401, 2304, 272, 408, 272, 347, 465, 63, 3009, 8, 277, 12, 543, 63, 9368, 29, 549, 12, 543, 63, 761, 63, 8602, 29, 797, 304, 267, 408, 267, 10560, 314, 5385, 367, 642, 1827, 14, 1803, 314, 5385, 1059, 436, 769, 402, 267, 2633, 14, 398, 982, 283, 1045, 63, 9368, 7, 365, 756, 12, 1263, 2304, 15, 2743, 2556, 365, 440, 5120, 267, 315, 314, 1827, 14, 267, 408, 267, 886, 63, 2743, 275, 543, 63, 9368, 436, 334, 277, 14, 1131, 14, 6260, 63, 1657, 365, 440, 488, 503, 291, 14, 1131, 14, 674, 63, 1657, 1137, 378, 9, 267, 340, 440, 886, 63, 2743, 26, 288, 372, 1613, 8, 4657, 9131, 12, 291, 680, 305, 63, 3009, 8, 1045, 63, 9368, 29, 797, 12, 10028, 543, 63, 761, 63, 8602, 29, 1045, 63, 761, 63, 8602, 9, 267, 3504, 63, 264, 275, 295, 14, 2014, 9097, 4859, 59, 1622, 15622, 13783, 28437, 60, 83, 5547, 358, 267, 1827, 12, 1862, 275, 1613, 8, 4657, 9131, 12, 291, 680, 305, 63, 3009, 8, 1045, 63, 9368, 29, 797, 12, 9144, 543, 63, 761, 63, 8602, 29, 1045, 63, 761, 63, 8602, 9, 267, 333, 275, 3504, 63, 264, 14, 1431, 8, 1131, 9, 267, 340, 543, 63, 9368, 436, 333, 1137, 488, 26, 288, 1967, 275, 488, 288, 5518, 275, 488, 288, 340, 291, 14, 1131, 14, 6260, 63, 1657, 365, 440, 488, 26, 355, 1967, 275, 291, 14, 1131, 14, 6260, 63, 1657, 446, 291, 14, 1131, 14, 674, 63, 1657, 355, 340, 1967, 2695, 378, 26, 490, 372, 488, 12, 488, 355, 5518, 275, 283, 11422, 450, 68, 7, 450, 1967, 288, 340, 5518, 365, 440, 488, 26, 355, 340, 333, 14, 2634, 3430, 16, 61, 1137, 488, 26, 490, 1827, 275, 3504, 63, 264, 14, 954, 360, 4859, 28424, 28437, 450, 83, 283, 450, 5518, 12, 1827, 9, 355, 587, 26, 490, 1827, 275, 3504, 63, 264, 14, 954, 360, 4859, 450, 83, 283, 450, 5518, 12, 1827, 9, 267, 372, 1827, 12, 1862, 421, 199, 533, 5385, 9971, 9131, 8, 5772, 14, 4657, 9971, 9131, 12, 5385, 9131, 304, 339, 347, 465, 63, 3009, 63, 10000, 8, 277, 304, 267, 327, 2136, 2793, 1133, 1929, 6313, 63, 354, 63, 18447, 63, 3620, 342, 2348, 12, 3967, 3520, 787, 1006, 267, 327, 9995, 370, 506, 2763, 1561, 334, 1152, 781, 883, 5126, 314, 2402, 24075, 680, 267, 18293, 275, 291, 14, 2105, 14, 1483, 14, 3513, 63, 354, 267, 3999, 275, 291, 14, 1131, 14, 1238, 423, 2024, 267, 2529, 63, 344, 275, 2155, 8, 277, 14, 1107, 63, 344, 436, 2079, 291, 14, 2105, 14, 3179, 14, 2425, 63, 1107, 63, 344, 63, 504, 63, 3176, 9, 398, 340, 2529, 63, 344, 26, 288, 754, 275, 788, 3597, 4825, 8760, 5258, 418, 267, 587, 26, 288, 754, 275, 942, 398, 754, 14, 740, 360, 10258, 12872, 450, 83, 7, 450, 18293, 8, 3291, 14, 697, 63, 1224, 430, 267, 754, 14, 740, 360, 4042, 83, 3171, 450, 1656, 1987, 904, 779, 15156, 8, 67, 9, 367, 286, 315, 291, 14, 1131, 14, 3406, 2459, 398, 1338, 275, 359, 277, 14, 6199, 2031, 86, 9, 367, 373, 315, 291, 14, 1131, 14, 1459, 61, 267, 754, 14, 740, 360, 15514, 4366, 83, 3171, 450, 1656, 1987, 904, 8, 1459, 430, 398, 340, 2529, 63, 344, 26, 288, 754, 14, 740, 360, 3779, 78, 4859, 428, 1439, 1510, 63, 7466, 1922, 19004, 398, 1862, 275, 291, 14, 1131, 14, 1162, 267, 3875, 275, 283, 1987, 904, 8, 1099, 9, 398, 3404, 275, 291, 14, 1131, 14, 362, 63, 2024, 342, 267, 340, 3404, 14, 1989, 63, 2495, 63, 698, 26, 288, 327, 1592, 63, 2301, 365, 488, 340, 440, 7662, 2013, 701, 1402, 901, 288, 2599, 63, 698, 63, 2301, 275, 3404, 14, 2495, 63, 698, 14, 697, 63, 2301, 503, 3404, 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,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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 ]
ptkool/spark
python/pyspark/broadcast.py
13
7295
# # 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 gc import os import sys from tempfile import NamedTemporaryFile import threading from pyspark.java_gateway import local_connect_and_auth from pyspark.serializers import ChunkedStream, pickle_protocol from pyspark.util import _exception_message, print_exec if sys.version < '3': import cPickle as pickle else: import pickle unicode = str __all__ = ['Broadcast'] # Holds broadcasted data received from Java, keyed by its id. _broadcastRegistry = {} def _from_id(bid): from pyspark.broadcast import _broadcastRegistry if bid not in _broadcastRegistry: raise Exception("Broadcast variable '%s' not loaded!" % bid) return _broadcastRegistry[bid] class Broadcast(object): """ A broadcast variable created with :meth:`SparkContext.broadcast`. Access its value through :attr:`value`. Examples: >>> from pyspark.context import SparkContext >>> sc = SparkContext('local', 'test') >>> b = sc.broadcast([1, 2, 3, 4, 5]) >>> b.value [1, 2, 3, 4, 5] >>> sc.parallelize([0, 0]).flatMap(lambda x: b.value).collect() [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] >>> b.unpersist() >>> large_broadcast = sc.broadcast(range(10000)) """ def __init__(self, sc=None, value=None, pickle_registry=None, path=None, sock_file=None): """ Should not be called directly by users -- use :meth:`SparkContext.broadcast` instead. """ if sc is not None: # we're on the driver. We want the pickled data to end up in a file (maybe encrypted) f = NamedTemporaryFile(delete=False, dir=sc._temp_dir) self._path = f.name self._sc = sc self._python_broadcast = sc._jvm.PythonRDD.setupBroadcast(self._path) if sc._encryption_enabled: # with encryption, we ask the jvm to do the encryption for us, we send it data # over a socket port, auth_secret = self._python_broadcast.setupEncryptionServer() (encryption_sock_file, _) = local_connect_and_auth(port, auth_secret) broadcast_out = ChunkedStream(encryption_sock_file, 8192) else: # no encryption, we can just write pickled data directly to the file from python broadcast_out = f self.dump(value, broadcast_out) if sc._encryption_enabled: self._python_broadcast.waitTillDataReceived() self._jbroadcast = sc._jsc.broadcast(self._python_broadcast) self._pickle_registry = pickle_registry else: # we're on an executor self._jbroadcast = None self._sc = None self._python_broadcast = None if sock_file is not None: # the jvm is doing decryption for us. Read the value # immediately from the sock_file self._value = self.load(sock_file) else: # the jvm just dumps the pickled data in path -- we'll unpickle lazily when # the value is requested assert(path is not None) self._path = path def dump(self, value, f): try: pickle.dump(value, f, pickle_protocol) except pickle.PickleError: raise except Exception as e: msg = "Could not serialize broadcast: %s: %s" \ % (e.__class__.__name__, _exception_message(e)) print_exec(sys.stderr) raise pickle.PicklingError(msg) f.close() def load_from_path(self, path): with open(path, 'rb', 1 << 20) as f: return self.load(f) def load(self, file): # "file" could also be a socket gc.disable() try: return pickle.load(file) finally: gc.enable() @property def value(self): """ Return the broadcasted value """ if not hasattr(self, "_value") and self._path is not None: # we only need to decrypt it here when encryption is enabled and # if its on the driver, since executor decryption is handled already if self._sc is not None and self._sc._encryption_enabled: port, auth_secret = self._python_broadcast.setupDecryptionServer() (decrypted_sock_file, _) = local_connect_and_auth(port, auth_secret) self._python_broadcast.waitTillBroadcastDataSent() return self.load(decrypted_sock_file) else: self._value = self.load_from_path(self._path) return self._value def unpersist(self, blocking=False): """ Delete cached copies of this broadcast on the executors. If the broadcast is used after this is called, it will need to be re-sent to each executor. :param blocking: Whether to block until unpersisting has completed """ if self._jbroadcast is None: raise Exception("Broadcast can only be unpersisted in driver") self._jbroadcast.unpersist(blocking) def destroy(self, blocking=False): """ Destroy all data and metadata related to this broadcast variable. Use this with caution; once a broadcast variable has been destroyed, it cannot be used again. .. versionchanged:: 3.0.0 Added optional argument `blocking` to specify whether to block until all blocks are deleted. """ if self._jbroadcast is None: raise Exception("Broadcast can only be destroyed in driver") self._jbroadcast.destroy(blocking) os.unlink(self._path) def __reduce__(self): if self._jbroadcast is None: raise Exception("Broadcast can only be serialized in driver") self._pickle_registry.add(self) return _from_id, (self._jbroadcast.id(),) class BroadcastPickleRegistry(threading.local): """ Thread-local registry for broadcast variables that have been pickled """ def __init__(self): self.__dict__.setdefault("_registry", set()) def __iter__(self): for bcast in self._registry: yield bcast def add(self, bcast): self._registry.add(bcast) def clear(self): self._registry.clear() if __name__ == "__main__": import doctest (failure_count, test_count) = doctest.testmod() if failure_count: sys.exit(-1)
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 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, 9486, 199, 646, 747, 199, 646, 984, 199, 504, 5549, 492, 31825, 199, 646, 5796, 199, 199, 504, 15847, 14, 6138, 63, 7019, 492, 2257, 63, 2242, 63, 460, 63, 1178, 199, 504, 15847, 14, 12844, 492, 25246, 379, 3296, 12, 5927, 63, 3922, 199, 504, 15847, 14, 1974, 492, 485, 1971, 63, 1188, 12, 870, 63, 1628, 199, 199, 692, 984, 14, 1023, 665, 283, 19, 356, 272, 492, 17572, 465, 5927, 199, 2836, 26, 272, 492, 5927, 272, 2649, 275, 620, 199, 199, 363, 452, 363, 275, 788, 12105, 418, 421, 199, 3, 869, 8250, 330, 5063, 9765, 471, 666, 3086, 687, 9586, 12, 19272, 701, 2399, 1305, 14, 199, 63, 10786, 10899, 275, 1052, 421, 199, 318, 485, 504, 63, 344, 8, 17949, 304, 272, 687, 15847, 14, 10786, 492, 485, 10786, 10899, 272, 340, 330, 344, 440, 315, 485, 10786, 10899, 26, 267, 746, 2186, 480, 12105, 1750, 1543, 83, 7, 440, 6511, 9539, 450, 330, 344, 9, 272, 372, 485, 10786, 10899, 59, 17949, 61, 421, 199, 533, 699, 5659, 8, 785, 304, 339, 408, 272, 437, 11180, 1750, 2737, 543, 520, 5247, 1705, 27110, 2998, 14, 10786, 2313, 272, 11003, 2399, 574, 4012, 520, 962, 1705, 585, 2313, 339, 6058, 26, 339, 1306, 687, 15847, 14, 1100, 492, 21769, 272, 1306, 4061, 275, 21769, 360, 1832, 297, 283, 396, 358, 272, 1306, 330, 275, 4061, 14, 10786, 779, 17, 12, 499, 12, 650, 12, 841, 12, 959, 566, 272, 1306, 330, 14, 585, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 61, 272, 1306, 4061, 14, 27675, 779, 16, 12, 378, 6575, 7088, 2956, 8, 2734, 671, 26, 330, 14, 585, 680, 7112, 342, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 61, 272, 1306, 330, 14, 324, 23619, 342, 339, 1306, 7031, 63, 10786, 275, 4061, 14, 10786, 8, 1842, 8, 9943, 430, 272, 408, 339, 347, 636, 826, 721, 277, 12, 4061, 29, 403, 12, 574, 29, 403, 12, 5927, 63, 5189, 29, 403, 12, 931, 29, 403, 12, 326, 6771, 63, 493, 29, 403, 304, 267, 408, 267, 7719, 440, 506, 2797, 5370, 701, 4390, 1553, 675, 520, 5247, 1705, 27110, 2998, 14, 10786, 64, 267, 3140, 14, 267, 408, 267, 340, 4061, 365, 440, 488, 26, 288, 327, 781, 3984, 641, 314, 5253, 14, 221, 2136, 2934, 314, 18731, 666, 370, 1284, 1536, 315, 282, 570, 334, 11853, 14862, 9, 288, 289, 275, 31825, 8, 1807, 29, 797, 12, 2935, 29, 551, 423, 808, 63, 694, 9, 288, 291, 423, 515, 275, 289, 14, 354, 288, 291, 423, 551, 275, 4061, 288, 291, 423, 1548, 63, 10786, 275, 4061, 423, 15813, 14, 4718, 24378, 14, 2758, 12105, 8, 277, 423, 515, 9, 288, 340, 4061, 423, 15113, 63, 3827, 26, 355, 327, 543, 14396, 12, 781, 7198, 314, 1335, 2611, 370, 886, 314, 14396, 367, 2739, 12, 781, 3222, 652, 666, 355, 327, 1806, 282, 2838, 355, 1844, 12, 1790, 63, 4731, 275, 291, 423, 1548, 63, 10786, 14, 2758, 25687, 3120, 342, 355, 334, 15113, 63, 5096, 63, 493, 12, 20795, 275, 2257, 63, 2242, 63, 460, 63, 1178, 8, 719, 12, 1790, 63, 4731, 9, 355, 11180, 63, 548, 275, 25246, 379, 3296, 8, 15113, 63, 5096, 63, 493, 12, 28828, 9, 288, 587, 26, 355, 327, 949, 14396, 12, 781, 883, 2951, 2218, 18731, 666, 5370, 370, 314, 570, 687, 2366, 355, 11180, 63, 548, 275, 289, 288, 291, 14, 2724, 8, 585, 12, 11180, 63, 548, 9, 288, 340, 4061, 423, 15113, 63, 3827, 26, 355, 291, 423, 1548, 63, 10786, 14, 2573, 52, 778, 1451, 9392, 342, 288, 291, 423, 74, 10786, 275, 4061, 423, 74, 551, 14, 10786, 8, 277, 423, 1548, 63, 10786, 9, 288, 291, 423, 8092, 63, 5189, 275, 5927, 63, 5189, 267, 587, 26, 288, 327, 781, 3984, 641, 376, 13270, 288, 291, 423, 74, 10786, 275, 488, 288, 291, 423, 551, 275, 488, 288, 291, 423, 1548, 63, 10786, 275, 488, 288, 340, 6771, 63, 493, 365, 440, 488, 26, 355, 327, 314, 1335, 2611, 365, 9689, 477, 7950, 367, 2739, 14, 221, 5574, 314, 574, 355, 327, 9939, 687, 314, 6771, 63, 493, 355, 291, 423, 585, 275, 291, 14, 912, 8, 5096, 63, 493, 9, 288, 587, 26, 355, 327, 314, 1335, 2611, 2951, 16864, 314, 18731, 666, 315, 931, 1553, 781, 7171, 625, 8092, 29667, 3444, 1380, 355, 327, 314, 574, 365, 5839, 355, 702, 8, 515, 365, 440, 488, 9, 355, 291, 423, 515, 275, 931, 339, 347, 5461, 8, 277, 12, 574, 12, 289, 304, 267, 862, 26, 288, 5927, 14, 2724, 8, 585, 12, 289, 12, 5927, 63, 3922, 9, 267, 871, 5927, 14, 12755, 547, 26, 288, 746, 267, 871, 2186, 465, 325, 26, 288, 1499, 275, 298, 6531, 440, 8437, 11180, 26, 450, 83, 26, 450, 83, 2, 971, 2116, 450, 334, 69, 855, 533, 4914, 354, 3108, 485, 1971, 63, 1188, 8, 69, 430, 288, 870, 63 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 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, 9486, 199, 646, 747, 199, 646, 984, 199, 504, 5549, 492, 31825, 199, 646, 5796, 199, 199, 504, 15847, 14, 6138, 63, 7019, 492, 2257, 63, 2242, 63, 460, 63, 1178, 199, 504, 15847, 14, 12844, 492, 25246, 379, 3296, 12, 5927, 63, 3922, 199, 504, 15847, 14, 1974, 492, 485, 1971, 63, 1188, 12, 870, 63, 1628, 199, 199, 692, 984, 14, 1023, 665, 283, 19, 356, 272, 492, 17572, 465, 5927, 199, 2836, 26, 272, 492, 5927, 272, 2649, 275, 620, 199, 199, 363, 452, 363, 275, 788, 12105, 418, 421, 199, 3, 869, 8250, 330, 5063, 9765, 471, 666, 3086, 687, 9586, 12, 19272, 701, 2399, 1305, 14, 199, 63, 10786, 10899, 275, 1052, 421, 199, 318, 485, 504, 63, 344, 8, 17949, 304, 272, 687, 15847, 14, 10786, 492, 485, 10786, 10899, 272, 340, 330, 344, 440, 315, 485, 10786, 10899, 26, 267, 746, 2186, 480, 12105, 1750, 1543, 83, 7, 440, 6511, 9539, 450, 330, 344, 9, 272, 372, 485, 10786, 10899, 59, 17949, 61, 421, 199, 533, 699, 5659, 8, 785, 304, 339, 408, 272, 437, 11180, 1750, 2737, 543, 520, 5247, 1705, 27110, 2998, 14, 10786, 2313, 272, 11003, 2399, 574, 4012, 520, 962, 1705, 585, 2313, 339, 6058, 26, 339, 1306, 687, 15847, 14, 1100, 492, 21769, 272, 1306, 4061, 275, 21769, 360, 1832, 297, 283, 396, 358, 272, 1306, 330, 275, 4061, 14, 10786, 779, 17, 12, 499, 12, 650, 12, 841, 12, 959, 566, 272, 1306, 330, 14, 585, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 61, 272, 1306, 4061, 14, 27675, 779, 16, 12, 378, 6575, 7088, 2956, 8, 2734, 671, 26, 330, 14, 585, 680, 7112, 342, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 959, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 61, 272, 1306, 330, 14, 324, 23619, 342, 339, 1306, 7031, 63, 10786, 275, 4061, 14, 10786, 8, 1842, 8, 9943, 430, 272, 408, 339, 347, 636, 826, 721, 277, 12, 4061, 29, 403, 12, 574, 29, 403, 12, 5927, 63, 5189, 29, 403, 12, 931, 29, 403, 12, 326, 6771, 63, 493, 29, 403, 304, 267, 408, 267, 7719, 440, 506, 2797, 5370, 701, 4390, 1553, 675, 520, 5247, 1705, 27110, 2998, 14, 10786, 64, 267, 3140, 14, 267, 408, 267, 340, 4061, 365, 440, 488, 26, 288, 327, 781, 3984, 641, 314, 5253, 14, 221, 2136, 2934, 314, 18731, 666, 370, 1284, 1536, 315, 282, 570, 334, 11853, 14862, 9, 288, 289, 275, 31825, 8, 1807, 29, 797, 12, 2935, 29, 551, 423, 808, 63, 694, 9, 288, 291, 423, 515, 275, 289, 14, 354, 288, 291, 423, 551, 275, 4061, 288, 291, 423, 1548, 63, 10786, 275, 4061, 423, 15813, 14, 4718, 24378, 14, 2758, 12105, 8, 277, 423, 515, 9, 288, 340, 4061, 423, 15113, 63, 3827, 26, 355, 327, 543, 14396, 12, 781, 7198, 314, 1335, 2611, 370, 886, 314, 14396, 367, 2739, 12, 781, 3222, 652, 666, 355, 327, 1806, 282, 2838, 355, 1844, 12, 1790, 63, 4731, 275, 291, 423, 1548, 63, 10786, 14, 2758, 25687, 3120, 342, 355, 334, 15113, 63, 5096, 63, 493, 12, 20795, 275, 2257, 63, 2242, 63, 460, 63, 1178, 8, 719, 12, 1790, 63, 4731, 9, 355, 11180, 63, 548, 275, 25246, 379, 3296, 8, 15113, 63, 5096, 63, 493, 12, 28828, 9, 288, 587, 26, 355, 327, 949, 14396, 12, 781, 883, 2951, 2218, 18731, 666, 5370, 370, 314, 570, 687, 2366, 355, 11180, 63, 548, 275, 289, 288, 291, 14, 2724, 8, 585, 12, 11180, 63, 548, 9, 288, 340, 4061, 423, 15113, 63, 3827, 26, 355, 291, 423, 1548, 63, 10786, 14, 2573, 52, 778, 1451, 9392, 342, 288, 291, 423, 74, 10786, 275, 4061, 423, 74, 551, 14, 10786, 8, 277, 423, 1548, 63, 10786, 9, 288, 291, 423, 8092, 63, 5189, 275, 5927, 63, 5189, 267, 587, 26, 288, 327, 781, 3984, 641, 376, 13270, 288, 291, 423, 74, 10786, 275, 488, 288, 291, 423, 551, 275, 488, 288, 291, 423, 1548, 63, 10786, 275, 488, 288, 340, 6771, 63, 493, 365, 440, 488, 26, 355, 327, 314, 1335, 2611, 365, 9689, 477, 7950, 367, 2739, 14, 221, 5574, 314, 574, 355, 327, 9939, 687, 314, 6771, 63, 493, 355, 291, 423, 585, 275, 291, 14, 912, 8, 5096, 63, 493, 9, 288, 587, 26, 355, 327, 314, 1335, 2611, 2951, 16864, 314, 18731, 666, 315, 931, 1553, 781, 7171, 625, 8092, 29667, 3444, 1380, 355, 327, 314, 574, 365, 5839, 355, 702, 8, 515, 365, 440, 488, 9, 355, 291, 423, 515, 275, 931, 339, 347, 5461, 8, 277, 12, 574, 12, 289, 304, 267, 862, 26, 288, 5927, 14, 2724, 8, 585, 12, 289, 12, 5927, 63, 3922, 9, 267, 871, 5927, 14, 12755, 547, 26, 288, 746, 267, 871, 2186, 465, 325, 26, 288, 1499, 275, 298, 6531, 440, 8437, 11180, 26, 450, 83, 26, 450, 83, 2, 971, 2116, 450, 334, 69, 855, 533, 4914, 354, 3108, 485, 1971, 63, 1188, 8, 69, 430, 288, 870, 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,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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 ]
vijaylbais/boto
boto/ec2containerservice/__init__.py
54
1717
# Copyright (c) 2015 Amazon.com, Inc. or its affiliates. # All Rights Reserved # # 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, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing 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 MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR 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. # from boto.regioninfo import get_regions def regions(): """ Get all available regions for the Amazon EC2 Container Service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.ec2containerservice.layer1 import EC2ContainerServiceConnection return get_regions('ec2containerservice', connection_cls=EC2ContainerServiceConnection) def connect_to_region(region_name, **kw_params): for region in regions(): if region.name == region_name: return region.connect(**kw_params) return None
mit
[ 3, 1898, 334, 67, 9, 6900, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 199, 3, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 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, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 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, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 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, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 504, 6055, 14, 4551, 815, 492, 664, 63, 11963, 421, 199, 318, 16150, 837, 272, 408, 272, 2372, 1006, 2808, 16150, 367, 314, 14347, 15352, 18, 15395, 7591, 14, 339, 520, 4500, 26, 769, 272, 520, 1107, 26, 437, 769, 402, 520, 533, 1705, 10914, 14, 4551, 815, 14, 10708, 2354, 64, 272, 408, 272, 687, 6055, 14, 825, 18, 3600, 1364, 14, 1897, 17, 492, 15352, 18, 4076, 3167, 3225, 272, 372, 664, 63, 11963, 360, 825, 18, 3600, 1364, 297, 2432, 1950, 63, 1886, 29, 4220, 18, 4076, 3167, 3225, 9, 421, 199, 318, 4907, 63, 475, 63, 4551, 8, 4551, 63, 354, 12, 1011, 829, 63, 1162, 304, 272, 367, 4897, 315, 16150, 837, 267, 340, 4897, 14, 354, 508, 4897, 63, 354, 26, 288, 372, 4897, 14, 2242, 3682, 829, 63, 1162, 9, 272, 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 ]
[ 1898, 334, 67, 9, 6900, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 199, 3, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 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, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 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, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 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, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 504, 6055, 14, 4551, 815, 492, 664, 63, 11963, 421, 199, 318, 16150, 837, 272, 408, 272, 2372, 1006, 2808, 16150, 367, 314, 14347, 15352, 18, 15395, 7591, 14, 339, 520, 4500, 26, 769, 272, 520, 1107, 26, 437, 769, 402, 520, 533, 1705, 10914, 14, 4551, 815, 14, 10708, 2354, 64, 272, 408, 272, 687, 6055, 14, 825, 18, 3600, 1364, 14, 1897, 17, 492, 15352, 18, 4076, 3167, 3225, 272, 372, 664, 63, 11963, 360, 825, 18, 3600, 1364, 297, 2432, 1950, 63, 1886, 29, 4220, 18, 4076, 3167, 3225, 9, 421, 199, 318, 4907, 63, 475, 63, 4551, 8, 4551, 63, 354, 12, 1011, 829, 63, 1162, 304, 272, 367, 4897, 315, 16150, 837, 267, 340, 4897, 14, 354, 508, 4897, 63, 354, 26, 288, 372, 4897, 14, 2242, 3682, 829, 63, 1162, 9, 272, 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, 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, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
bradmontgomery/django-rainbowtests
setup.py
2
1284
from setuptools import setup from rainbowtests import __version__ setup( name='django-rainbowtests', version=__version__, description="A colorful Django Test Runner.", long_description=open('README.rst').read(), author='Brad Montgomery', author_email='brad@bradmontgomery.net', url='https://github.com/bradmontgomery/django-rainbowtests', license='MIT', packages=['rainbowtests'], include_package_data=True, package_data={'': ['README.rst', 'LICENSE.txt']}, zip_safe=False, install_requires=['django'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Libraries :: Python Modules', ] )
mit
[ 504, 9116, 492, 3272, 199, 504, 660, 262, 22856, 2219, 492, 636, 1023, 363, 199, 199, 2758, 8, 272, 536, 534, 1176, 13, 6322, 22856, 2219, 297, 272, 1015, 18971, 1023, 3108, 272, 1369, 628, 33, 3164, 1893, 5634, 1379, 3378, 1372, 4765, 272, 1846, 63, 1802, 29, 1490, 360, 18195, 14, 8332, 1959, 739, 1062, 272, 4132, 534, 34, 9525, 603, 1888, 71, 1377, 651, 297, 272, 4132, 63, 2123, 534, 7828, 68, 32, 7828, 6428, 1888, 71, 1377, 651, 14, 846, 297, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 7828, 6428, 1888, 71, 1377, 651, 15, 1176, 13, 6322, 22856, 2219, 297, 272, 4190, 534, 13965, 297, 272, 6117, 2968, 6322, 22856, 2219, 995, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 2559, 63, 576, 3713, 356, 788, 18195, 14, 8332, 297, 283, 3961, 14, 2424, 14949, 272, 3482, 63, 3489, 29, 797, 12, 272, 3907, 63, 6537, 2968, 1176, 995, 272, 19137, 1524, 267, 283, 23753, 9795, 3800, 841, 446, 29521, 297, 267, 283, 8263, 3800, 6001, 9711, 297, 267, 283, 16442, 3800, 5634, 297, 267, 283, 23910, 23975, 3800, 23493, 297, 267, 283, 3761, 3800, 25718, 26330, 3800, 10697, 844, 297, 267, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 267, 283, 11411, 8466, 3800, 2018, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 20, 297, 267, 283, 12157, 3800, 22026, 3800, 644, 11178, 15, 2856, 297, 267, 283, 12157, 3800, 2290, 15290, 3800, 11940, 297, 267, 283, 12157, 3800, 2290, 15290, 3800, 31454, 3800, 2018, 18167, 297, 272, 1622, 199, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 9116, 492, 3272, 199, 504, 660, 262, 22856, 2219, 492, 636, 1023, 363, 199, 199, 2758, 8, 272, 536, 534, 1176, 13, 6322, 22856, 2219, 297, 272, 1015, 18971, 1023, 3108, 272, 1369, 628, 33, 3164, 1893, 5634, 1379, 3378, 1372, 4765, 272, 1846, 63, 1802, 29, 1490, 360, 18195, 14, 8332, 1959, 739, 1062, 272, 4132, 534, 34, 9525, 603, 1888, 71, 1377, 651, 297, 272, 4132, 63, 2123, 534, 7828, 68, 32, 7828, 6428, 1888, 71, 1377, 651, 14, 846, 297, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 7828, 6428, 1888, 71, 1377, 651, 15, 1176, 13, 6322, 22856, 2219, 297, 272, 4190, 534, 13965, 297, 272, 6117, 2968, 6322, 22856, 2219, 995, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 2559, 63, 576, 3713, 356, 788, 18195, 14, 8332, 297, 283, 3961, 14, 2424, 14949, 272, 3482, 63, 3489, 29, 797, 12, 272, 3907, 63, 6537, 2968, 1176, 995, 272, 19137, 1524, 267, 283, 23753, 9795, 3800, 841, 446, 29521, 297, 267, 283, 8263, 3800, 6001, 9711, 297, 267, 283, 16442, 3800, 5634, 297, 267, 283, 23910, 23975, 3800, 23493, 297, 267, 283, 3761, 3800, 25718, 26330, 3800, 10697, 844, 297, 267, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 267, 283, 11411, 8466, 3800, 2018, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 20, 297, 267, 283, 12157, 3800, 22026, 3800, 644, 11178, 15, 2856, 297, 267, 283, 12157, 3800, 2290, 15290, 3800, 11940, 297, 267, 283, 12157, 3800, 2290, 15290, 3800, 31454, 3800, 2018, 18167, 297, 272, 1622, 199, 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, 32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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 ]
googleapis/python-bigquery
samples/snippets/materialized_view_test.py
1
2840
# Copyright 2020 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. import datetime import uuid from google.api_core import exceptions from google.cloud import bigquery import pytest import materialized_view def temp_suffix(): now = datetime.datetime.now() return f"{now.strftime('%Y%m%d%H%M%S')}_{uuid.uuid4().hex[:8]}" @pytest.fixture(autouse=True) def bigquery_client_patch(monkeypatch, bigquery_client): monkeypatch.setattr(bigquery, "Client", lambda: bigquery_client) @pytest.fixture(scope="module") def dataset_id(bigquery_client): dataset_id = f"mvdataset_{temp_suffix()}" bigquery_client.create_dataset(dataset_id) yield dataset_id bigquery_client.delete_dataset(dataset_id, delete_contents=True) @pytest.fixture(scope="module") def base_table_id(bigquery_client, project_id, dataset_id): base_table_id = f"{project_id}.{dataset_id}.base_{temp_suffix()}" # Schema from materialized views guide: # https://cloud.google.com/bigquery/docs/materialized-views#create base_table = bigquery.Table(base_table_id) base_table.schema = [ bigquery.SchemaField("product_id", bigquery.SqlTypeNames.INT64), bigquery.SchemaField("clicks", bigquery.SqlTypeNames.INT64), ] bigquery_client.create_table(base_table) yield base_table_id bigquery_client.delete_table(base_table_id) @pytest.fixture(scope="module") def view_id(bigquery_client, project_id, dataset_id): view_id = f"{project_id}.{dataset_id}.mview_{temp_suffix()}" yield view_id bigquery_client.delete_table(view_id, not_found_ok=True) def test_materialized_view(capsys, bigquery_client, base_table_id, view_id): override_values = { "base_table_id": base_table_id, "view_id": view_id, } view = materialized_view.create_materialized_view(override_values) assert base_table_id in view.mview_query out, _ = capsys.readouterr() assert view_id in out view = materialized_view.update_materialized_view(override_values) assert view.mview_enable_refresh assert view.mview_refresh_interval == datetime.timedelta(hours=1) out, _ = capsys.readouterr() assert view_id in out materialized_view.delete_materialized_view(override_values) with pytest.raises(exceptions.NotFound): bigquery_client.get_table(view_id)
apache-2.0
[ 3, 1898, 25455, 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, 199, 646, 2197, 199, 646, 5377, 199, 199, 504, 6233, 14, 1246, 63, 1018, 492, 4967, 199, 504, 6233, 14, 4091, 492, 7282, 1131, 199, 646, 4613, 199, 199, 646, 6285, 1759, 63, 1345, 421, 199, 318, 2388, 63, 4511, 837, 272, 3063, 275, 2197, 14, 2083, 14, 2131, 342, 272, 372, 289, 14381, 2131, 14, 6205, 3508, 57, 5, 77, 5, 68, 5, 40, 5, 45, 5, 51, 21004, 7348, 2580, 14, 2580, 20, 1252, 4097, 1491, 24, 61, 7063, 421, 199, 32, 4462, 14, 5997, 8, 6898, 7130, 29, 549, 9, 199, 318, 7282, 1131, 63, 1258, 63, 2068, 8, 20372, 2068, 12, 7282, 1131, 63, 1258, 304, 272, 17309, 14, 10202, 8, 23256, 12, 298, 3041, 401, 2400, 26, 7282, 1131, 63, 1258, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 4789, 63, 344, 8, 23256, 63, 1258, 304, 272, 4789, 63, 344, 275, 289, 2, 12393, 5214, 7348, 808, 63, 4511, 342, 7063, 272, 7282, 1131, 63, 1258, 14, 981, 63, 5214, 8, 5214, 63, 344, 9, 272, 1995, 4789, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 5214, 8, 5214, 63, 344, 12, 3145, 63, 4407, 29, 549, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 1300, 63, 1224, 63, 344, 8, 23256, 63, 1258, 12, 2199, 63, 344, 12, 4789, 63, 344, 304, 272, 1300, 63, 1224, 63, 344, 275, 289, 14381, 1715, 63, 344, 26944, 5214, 63, 344, 5565, 1095, 7348, 808, 63, 4511, 342, 7063, 272, 327, 13268, 687, 6285, 1759, 6858, 22885, 26, 272, 327, 4178, 921, 4091, 14, 3098, 14, 957, 15, 23256, 15, 4757, 15, 9820, 1759, 13, 4196, 3, 981, 272, 1300, 63, 1224, 275, 7282, 1131, 14, 3186, 8, 1095, 63, 1224, 63, 344, 9, 272, 1300, 63, 1224, 14, 3629, 275, 359, 267, 7282, 1131, 14, 6700, 792, 480, 2558, 63, 344, 401, 7282, 1131, 14, 16790, 804, 5866, 14, 2919, 772, 395, 267, 7282, 1131, 14, 6700, 792, 480, 4891, 83, 401, 7282, 1131, 14, 16790, 804, 5866, 14, 2919, 772, 395, 272, 1622, 272, 7282, 1131, 63, 1258, 14, 981, 63, 1224, 8, 1095, 63, 1224, 9, 272, 1995, 1300, 63, 1224, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 1224, 8, 1095, 63, 1224, 63, 344, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 2455, 63, 344, 8, 23256, 63, 1258, 12, 2199, 63, 344, 12, 4789, 63, 344, 304, 272, 2455, 63, 344, 275, 289, 14381, 1715, 63, 344, 26944, 5214, 63, 344, 5565, 77, 1345, 7348, 808, 63, 4511, 342, 7063, 272, 1995, 2455, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 1224, 8, 1345, 63, 344, 12, 440, 63, 4214, 63, 745, 29, 549, 9, 421, 199, 318, 511, 63, 9820, 1759, 63, 1345, 8, 2874, 1274, 12, 7282, 1131, 63, 1258, 12, 1300, 63, 1224, 63, 344, 12, 2455, 63, 344, 304, 272, 4278, 63, 1459, 275, 469, 267, 298, 1095, 63, 1224, 63, 344, 582, 1300, 63, 1224, 63, 344, 12, 267, 298, 1345, 63, 344, 582, 2455, 63, 344, 12, 272, 789, 272, 2455, 275, 6285, 1759, 63, 1345, 14, 981, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 702, 1300, 63, 1224, 63, 344, 315, 2455, 14, 77, 1345, 63, 1131, 272, 734, 12, 485, 275, 4021, 1274, 14, 739, 7837, 82, 342, 272, 702, 2455, 63, 344, 315, 734, 339, 2455, 275, 6285, 1759, 63, 1345, 14, 873, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 702, 2455, 14, 77, 1345, 63, 4296, 63, 6635, 272, 702, 2455, 14, 77, 1345, 63, 6635, 63, 4284, 508, 2197, 14, 7473, 8, 8419, 29, 17, 9, 272, 734, 12, 485, 275, 4021, 1274, 14, 739, 7837, 82, 342, 272, 702, 2455, 63, 344, 315, 734, 339, 6285, 1759, 63, 1345, 14, 1807, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 543, 4613, 14, 3536, 8, 3924, 14, 4667, 304, 267, 7282, 1131, 63, 1258, 14, 362, 63, 1224, 8, 1345, 63, 344, 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 ]
[ 1898, 25455, 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, 199, 646, 2197, 199, 646, 5377, 199, 199, 504, 6233, 14, 1246, 63, 1018, 492, 4967, 199, 504, 6233, 14, 4091, 492, 7282, 1131, 199, 646, 4613, 199, 199, 646, 6285, 1759, 63, 1345, 421, 199, 318, 2388, 63, 4511, 837, 272, 3063, 275, 2197, 14, 2083, 14, 2131, 342, 272, 372, 289, 14381, 2131, 14, 6205, 3508, 57, 5, 77, 5, 68, 5, 40, 5, 45, 5, 51, 21004, 7348, 2580, 14, 2580, 20, 1252, 4097, 1491, 24, 61, 7063, 421, 199, 32, 4462, 14, 5997, 8, 6898, 7130, 29, 549, 9, 199, 318, 7282, 1131, 63, 1258, 63, 2068, 8, 20372, 2068, 12, 7282, 1131, 63, 1258, 304, 272, 17309, 14, 10202, 8, 23256, 12, 298, 3041, 401, 2400, 26, 7282, 1131, 63, 1258, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 4789, 63, 344, 8, 23256, 63, 1258, 304, 272, 4789, 63, 344, 275, 289, 2, 12393, 5214, 7348, 808, 63, 4511, 342, 7063, 272, 7282, 1131, 63, 1258, 14, 981, 63, 5214, 8, 5214, 63, 344, 9, 272, 1995, 4789, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 5214, 8, 5214, 63, 344, 12, 3145, 63, 4407, 29, 549, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 1300, 63, 1224, 63, 344, 8, 23256, 63, 1258, 12, 2199, 63, 344, 12, 4789, 63, 344, 304, 272, 1300, 63, 1224, 63, 344, 275, 289, 14381, 1715, 63, 344, 26944, 5214, 63, 344, 5565, 1095, 7348, 808, 63, 4511, 342, 7063, 272, 327, 13268, 687, 6285, 1759, 6858, 22885, 26, 272, 327, 4178, 921, 4091, 14, 3098, 14, 957, 15, 23256, 15, 4757, 15, 9820, 1759, 13, 4196, 3, 981, 272, 1300, 63, 1224, 275, 7282, 1131, 14, 3186, 8, 1095, 63, 1224, 63, 344, 9, 272, 1300, 63, 1224, 14, 3629, 275, 359, 267, 7282, 1131, 14, 6700, 792, 480, 2558, 63, 344, 401, 7282, 1131, 14, 16790, 804, 5866, 14, 2919, 772, 395, 267, 7282, 1131, 14, 6700, 792, 480, 4891, 83, 401, 7282, 1131, 14, 16790, 804, 5866, 14, 2919, 772, 395, 272, 1622, 272, 7282, 1131, 63, 1258, 14, 981, 63, 1224, 8, 1095, 63, 1224, 9, 272, 1995, 1300, 63, 1224, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 1224, 8, 1095, 63, 1224, 63, 344, 9, 421, 199, 32, 4462, 14, 5997, 8, 2645, 628, 578, 531, 199, 318, 2455, 63, 344, 8, 23256, 63, 1258, 12, 2199, 63, 344, 12, 4789, 63, 344, 304, 272, 2455, 63, 344, 275, 289, 14381, 1715, 63, 344, 26944, 5214, 63, 344, 5565, 77, 1345, 7348, 808, 63, 4511, 342, 7063, 272, 1995, 2455, 63, 344, 272, 7282, 1131, 63, 1258, 14, 1807, 63, 1224, 8, 1345, 63, 344, 12, 440, 63, 4214, 63, 745, 29, 549, 9, 421, 199, 318, 511, 63, 9820, 1759, 63, 1345, 8, 2874, 1274, 12, 7282, 1131, 63, 1258, 12, 1300, 63, 1224, 63, 344, 12, 2455, 63, 344, 304, 272, 4278, 63, 1459, 275, 469, 267, 298, 1095, 63, 1224, 63, 344, 582, 1300, 63, 1224, 63, 344, 12, 267, 298, 1345, 63, 344, 582, 2455, 63, 344, 12, 272, 789, 272, 2455, 275, 6285, 1759, 63, 1345, 14, 981, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 702, 1300, 63, 1224, 63, 344, 315, 2455, 14, 77, 1345, 63, 1131, 272, 734, 12, 485, 275, 4021, 1274, 14, 739, 7837, 82, 342, 272, 702, 2455, 63, 344, 315, 734, 339, 2455, 275, 6285, 1759, 63, 1345, 14, 873, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 702, 2455, 14, 77, 1345, 63, 4296, 63, 6635, 272, 702, 2455, 14, 77, 1345, 63, 6635, 63, 4284, 508, 2197, 14, 7473, 8, 8419, 29, 17, 9, 272, 734, 12, 485, 275, 4021, 1274, 14, 739, 7837, 82, 342, 272, 702, 2455, 63, 344, 315, 734, 339, 6285, 1759, 63, 1345, 14, 1807, 63, 9820, 1759, 63, 1345, 8, 4415, 63, 1459, 9, 272, 543, 4613, 14, 3536, 8, 3924, 14, 4667, 304, 267, 7282, 1131, 63, 1258, 14, 362, 63, 1224, 8, 1345, 63, 344, 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, 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,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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 ]
incessantmeraki/p2pworkshop
persisted-chat/node_modules/node-gyp/gyp/gyptest.py
1752
8019
#!/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. __doc__ = """ gyptest.py -- test runner for GYP tests. """ import os import optparse import subprocess import sys class CommandRunner(object): """ Executor class for commands, including "commands" implemented by Python functions. """ verbose = True active = True def __init__(self, dictionary={}): self.subst_dictionary(dictionary) def subst_dictionary(self, dictionary): self._subst_dictionary = dictionary def subst(self, string, dictionary=None): """ Substitutes (via the format operator) the values in the specified dictionary into the specified command. The command can be an (action, string) tuple. In all cases, we perform substitution on strings and don't worry if something isn't a string. (It's probably a Python function to be executed.) """ if dictionary is None: dictionary = self._subst_dictionary if dictionary: try: string = string % dictionary except TypeError: pass return string def display(self, command, stdout=None, stderr=None): if not self.verbose: return if type(command) == type(()): func = command[0] args = command[1:] s = '%s(%s)' % (func.__name__, ', '.join(map(repr, args))) if type(command) == type([]): # TODO: quote arguments containing spaces # TODO: handle meta characters? s = ' '.join(command) else: s = self.subst(command) if not s.endswith('\n'): s += '\n' sys.stdout.write(s) sys.stdout.flush() def execute(self, command, stdout=None, stderr=None): """ Executes a single command. """ if not self.active: return 0 if type(command) == type(''): command = self.subst(command) cmdargs = shlex.split(command) if cmdargs[0] == 'cd': command = (os.chdir,) + tuple(cmdargs[1:]) if type(command) == type(()): func = command[0] args = command[1:] return func(*args) else: if stdout is sys.stdout: # Same as passing sys.stdout, except python2.4 doesn't fail on it. subout = None else: # Open pipe for anything else so Popen works on python2.4. subout = subprocess.PIPE if stderr is sys.stderr: # Same as passing sys.stderr, except python2.4 doesn't fail on it. suberr = None elif stderr is None: # Merge with stdout if stderr isn't specified. suberr = subprocess.STDOUT else: # Open pipe for anything else so Popen works on python2.4. suberr = subprocess.PIPE p = subprocess.Popen(command, shell=(sys.platform == 'win32'), stdout=subout, stderr=suberr) p.wait() if stdout is None: self.stdout = p.stdout.read() elif stdout is not sys.stdout: stdout.write(p.stdout.read()) if stderr not in (None, sys.stderr): stderr.write(p.stderr.read()) return p.returncode def run(self, command, display=None, stdout=None, stderr=None): """ Runs a single command, displaying it first. """ if display is None: display = command self.display(display) return self.execute(command, stdout, stderr) class Unbuffered(object): def __init__(self, fp): self.fp = fp def write(self, arg): self.fp.write(arg) self.fp.flush() def __getattr__(self, attr): return getattr(self.fp, attr) sys.stdout = Unbuffered(sys.stdout) sys.stderr = Unbuffered(sys.stderr) def is_test_name(f): return f.startswith('gyptest') and f.endswith('.py') def find_all_gyptest_files(directory): result = [] for root, dirs, files in os.walk(directory): if '.svn' in dirs: dirs.remove('.svn') result.extend([ os.path.join(root, f) for f in files if is_test_name(f) ]) result.sort() return result def main(argv=None): if argv is None: argv = sys.argv usage = "gyptest.py [-ahlnq] [-f formats] [test ...]" parser = optparse.OptionParser(usage=usage) parser.add_option("-a", "--all", action="store_true", help="run all tests") parser.add_option("-C", "--chdir", action="store", default=None, help="chdir to the specified directory") parser.add_option("-f", "--format", action="store", default='', help="run tests with the specified formats") parser.add_option("-G", '--gyp_option', action="append", default=[], help="Add -G options to the gyp command line") parser.add_option("-l", "--list", action="store_true", help="list available tests and exit") parser.add_option("-n", "--no-exec", action="store_true", help="no execute, just print the command line") parser.add_option("--passed", action="store_true", help="report passed tests") parser.add_option("--path", action="append", default=[], help="additional $PATH directory") parser.add_option("-q", "--quiet", action="store_true", help="quiet, don't print test command lines") opts, args = parser.parse_args(argv[1:]) if opts.chdir: os.chdir(opts.chdir) if opts.path: extra_path = [os.path.abspath(p) for p in opts.path] extra_path = os.pathsep.join(extra_path) os.environ['PATH'] = extra_path + os.pathsep + os.environ['PATH'] if not args: if not opts.all: sys.stderr.write('Specify -a to get all tests.\n') return 1 args = ['test'] tests = [] for arg in args: if os.path.isdir(arg): tests.extend(find_all_gyptest_files(os.path.normpath(arg))) else: if not is_test_name(os.path.basename(arg)): print >>sys.stderr, arg, 'is not a valid gyp test name.' sys.exit(1) tests.append(arg) if opts.list: for test in tests: print test sys.exit(0) CommandRunner.verbose = not opts.quiet CommandRunner.active = not opts.no_exec cr = CommandRunner() os.environ['PYTHONPATH'] = os.path.abspath('test/lib') if not opts.quiet: sys.stdout.write('PYTHONPATH=%s\n' % os.environ['PYTHONPATH']) passed = [] failed = [] no_result = [] if opts.format: format_list = opts.format.split(',') else: # TODO: not duplicate this mapping from pylib/gyp/__init__.py format_list = { 'aix5': ['make'], 'freebsd7': ['make'], 'freebsd8': ['make'], 'openbsd5': ['make'], 'cygwin': ['msvs'], 'win32': ['msvs', 'ninja'], 'linux2': ['make', 'ninja'], 'linux3': ['make', 'ninja'], 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'], }[sys.platform] for format in format_list: os.environ['TESTGYP_FORMAT'] = format if not opts.quiet: sys.stdout.write('TESTGYP_FORMAT=%s\n' % format) gyp_options = [] for option in opts.gyp_option: gyp_options += ['-G', option] if gyp_options and not opts.quiet: sys.stdout.write('Extra Gyp options: %s\n' % gyp_options) for test in tests: status = cr.run([sys.executable, test] + gyp_options, stdout=sys.stdout, stderr=sys.stderr) if status == 2: no_result.append(test) elif status: failed.append(test) else: passed.append(test) if not opts.quiet: def report(description, tests): if tests: if len(tests) == 1: sys.stdout.write("\n%s the following test:\n" % description) else: fmt = "\n%s the following %d tests:\n" sys.stdout.write(fmt % (description, len(tests))) sys.stdout.write("\t" + "\n\t".join(tests) + "\n") if opts.passed: report("Passed", passed) report("Failed", failed) report("No result from", no_result) if failed: return 1 else: return 0 if __name__ == "__main__": sys.exit(main())
mit
[ 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, 363, 1301, 363, 275, 408, 199, 6179, 396, 14, 647, 1553, 511, 7876, 367, 25686, 2295, 14, 199, 624, 199, 199, 646, 747, 199, 646, 8691, 199, 646, 3873, 199, 646, 984, 199, 199, 533, 5817, 7446, 8, 785, 304, 523, 408, 523, 9434, 4139, 1021, 367, 3718, 12, 5893, 298, 4405, 2, 6366, 701, 523, 2018, 3423, 14, 523, 408, 523, 3376, 275, 715, 523, 4702, 275, 715, 819, 347, 636, 826, 721, 277, 12, 2600, 16420, 272, 291, 14, 16747, 63, 9086, 8, 9086, 9, 819, 347, 27321, 63, 9086, 8, 277, 12, 2600, 304, 272, 291, 423, 16747, 63, 9086, 275, 2600, 819, 347, 27321, 8, 277, 12, 1059, 12, 2600, 29, 403, 304, 272, 408, 272, 4804, 6329, 3862, 334, 12897, 314, 1475, 4182, 9, 314, 1338, 315, 314, 2013, 272, 2600, 1901, 314, 2013, 1414, 14, 339, 710, 1414, 883, 506, 376, 334, 1287, 12, 1059, 9, 2008, 14, 221, 1010, 1006, 5560, 12, 781, 272, 5147, 20584, 641, 3326, 436, 2793, 1133, 30944, 340, 6020, 5712, 1133, 272, 282, 1059, 14, 221, 334, 7940, 1159, 8646, 282, 2018, 805, 370, 506, 7934, 4959, 272, 408, 272, 340, 2600, 365, 488, 26, 489, 2600, 275, 291, 423, 16747, 63, 9086, 272, 340, 2600, 26, 489, 862, 26, 267, 1059, 275, 1059, 450, 2600, 489, 871, 3146, 26, 267, 986, 272, 372, 1059, 819, 347, 2929, 8, 277, 12, 1414, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 340, 440, 291, 14, 3832, 26, 489, 372, 272, 340, 730, 8, 1531, 9, 508, 730, 8, 5109, 489, 2562, 275, 1414, 59, 16, 61, 489, 1249, 275, 1414, 59, 17, 2938, 489, 308, 275, 1543, 83, 4042, 83, 3171, 450, 334, 1532, 855, 354, 3108, 1656, 1987, 904, 8, 1130, 8, 2722, 12, 1249, 1724, 272, 340, 730, 8, 1531, 9, 508, 730, 779, 4682, 489, 327, 3254, 26, 221, 6313, 2368, 3035, 7883, 489, 327, 3254, 26, 221, 2429, 3404, 4110, 31, 489, 308, 275, 283, 1987, 904, 8, 1531, 9, 272, 587, 26, 489, 308, 275, 291, 14, 16747, 8, 1531, 9, 272, 340, 440, 308, 14, 4130, 2258, 78, 735, 489, 308, 847, 1557, 78, 7, 272, 984, 14, 2703, 14, 952, 8, 83, 9, 272, 984, 14, 2703, 14, 4939, 342, 819, 347, 5341, 8, 277, 12, 1414, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 408, 272, 9434, 3862, 282, 2849, 1414, 14, 272, 408, 272, 340, 440, 291, 14, 2682, 26, 489, 372, 378, 272, 340, 730, 8, 1531, 9, 508, 730, 360, 735, 489, 1414, 275, 291, 14, 16747, 8, 1531, 9, 489, 2088, 589, 275, 16701, 14, 1294, 8, 1531, 9, 489, 340, 2088, 589, 59, 16, 61, 508, 283, 2866, 356, 268, 1414, 275, 334, 736, 14, 8563, 4258, 435, 2008, 8, 1760, 589, 59, 17, 5728, 272, 340, 730, 8, 1531, 9, 508, 730, 8, 5109, 489, 2562, 275, 1414, 59, 16, 61, 489, 1249, 275, 1414, 59, 17, 2938, 489, 372, 2562, 2031, 589, 9, 272, 587, 26, 489, 340, 3839, 365, 984, 14, 2703, 26, 267, 327, 14766, 465, 9476, 984, 14, 2703, 12, 871, 2366, 18, 14, 20, 3181, 1133, 2449, 641, 652, 14, 267, 1007, 548, 275, 488, 489, 587, 26, 267, 327, 3232, 5200, 367, 7003, 587, 880, 13995, 5419, 641, 2366, 18, 14, 20, 14, 267, 1007, 548, 275, 3873, 14, 6089, 489, 340, 4635, 365, 984, 14, 3083, 26, 267, 327, 14766, 465, 9476, 984, 14, 3083, 12, 871, 2366, 18, 14, 20, 3181, 1133, 2449, 641, 652, 14, 267, 1007, 1508, 275, 488, 489, 916, 4635, 365, 488, 26, 267, 327, 14076, 543, 3839, 340, 4635, 5712, 1133, 2013, 14, 267, 1007, 1508, 275, 3873, 14, 13850, 489, 587, 26, 267, 327, 3232, 5200, 367, 7003, 587, 880, 13995, 5419, 641, 2366, 18, 14, 20, 14, 267, 1007, 1508, 275, 3873, 14, 6089, 489, 299, 275, 3873, 14, 7942, 8, 1531, 12, 2574, 5218, 2687, 1274, 14, 3246, 508, 283, 2676, 708, 659, 2574, 3839, 29, 954, 548, 12, 2574, 4635, 29, 954, 1508, 9, 489, 299, 14, 2573, 342, 489, 340, 3839, 365, 488, 26, 267, 291, 14, 2703, 275, 299, 14, 2703, 14, 739, 342, 489, 916, 3839, 365, 440, 984, 14, 2703, 26, 267, 3839, 14, 952, 8, 80, 14, 2703, 14, 739, 1012, 489, 340, 4635, 440, 315, 334, 403, 12, 984, 14, 3083, 304, 267, 4635, 14, 952, 8, 80, 14, 3083, 14, 739, 1012, 489, 372, 299, 14, 9913, 819, 347, 1255, 8, 277, 12, 1414, 12, 2929, 29, 403, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 408, 272, 23773, 282, 2849, 1414, 12, 20589, 652, 1642, 14, 272, 408, 272, 340, 2929, 365, 488, 26, 489, 2929, 275, 1414, 272, 291, 14, 2918, 8, 2918, 9, 272, 372, 291, 14, 2526, 8, 1531, 12, 3839, 12, 4635, 9, 421, 199, 533, 1910, 17605, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 4090, 304, 272, 291, 14, 3997, 275, 4090, 523, 347, 2218, 8, 277, 12, 1680, 304, 272, 291, 14, 3997, 14, 952, 8, 1273, 9, 272, 291, 14, 3997, 14, 4939, 342, 523, 347, 636, 5675, 721, 277, 12, 1921, 304, 272, 372, 2519, 8, 277, 14, 3997, 12, 1921, 9, 199, 199, 1274, 14, 2703, 275, 1910, 17605, 8, 1274, 14, 2703, 9, 199, 1274, 14, 3083, 275, 1910, 17605, 8, 1274, 14, 3083, 9, 421, 199, 318, 365, 63, 396, 63, 354, 8, 70, 304, 523, 372, 289, 14, 2460, 360, 6179, 396, 358, 436, 289, 14, 4130, 5175, 647, 358, 421, 199, 318, 2342, 63, 452, 63, 6179, 396, 63, 1725, 8, 3619, 304, 523, 754, 275, 942, 523, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 3619, 304, 272, 340, 1987, 6836, 7, 315, 7606, 26, 489, 7606, 14 ]
[ 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, 363, 1301, 363, 275, 408, 199, 6179, 396, 14, 647, 1553, 511, 7876, 367, 25686, 2295, 14, 199, 624, 199, 199, 646, 747, 199, 646, 8691, 199, 646, 3873, 199, 646, 984, 199, 199, 533, 5817, 7446, 8, 785, 304, 523, 408, 523, 9434, 4139, 1021, 367, 3718, 12, 5893, 298, 4405, 2, 6366, 701, 523, 2018, 3423, 14, 523, 408, 523, 3376, 275, 715, 523, 4702, 275, 715, 819, 347, 636, 826, 721, 277, 12, 2600, 16420, 272, 291, 14, 16747, 63, 9086, 8, 9086, 9, 819, 347, 27321, 63, 9086, 8, 277, 12, 2600, 304, 272, 291, 423, 16747, 63, 9086, 275, 2600, 819, 347, 27321, 8, 277, 12, 1059, 12, 2600, 29, 403, 304, 272, 408, 272, 4804, 6329, 3862, 334, 12897, 314, 1475, 4182, 9, 314, 1338, 315, 314, 2013, 272, 2600, 1901, 314, 2013, 1414, 14, 339, 710, 1414, 883, 506, 376, 334, 1287, 12, 1059, 9, 2008, 14, 221, 1010, 1006, 5560, 12, 781, 272, 5147, 20584, 641, 3326, 436, 2793, 1133, 30944, 340, 6020, 5712, 1133, 272, 282, 1059, 14, 221, 334, 7940, 1159, 8646, 282, 2018, 805, 370, 506, 7934, 4959, 272, 408, 272, 340, 2600, 365, 488, 26, 489, 2600, 275, 291, 423, 16747, 63, 9086, 272, 340, 2600, 26, 489, 862, 26, 267, 1059, 275, 1059, 450, 2600, 489, 871, 3146, 26, 267, 986, 272, 372, 1059, 819, 347, 2929, 8, 277, 12, 1414, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 340, 440, 291, 14, 3832, 26, 489, 372, 272, 340, 730, 8, 1531, 9, 508, 730, 8, 5109, 489, 2562, 275, 1414, 59, 16, 61, 489, 1249, 275, 1414, 59, 17, 2938, 489, 308, 275, 1543, 83, 4042, 83, 3171, 450, 334, 1532, 855, 354, 3108, 1656, 1987, 904, 8, 1130, 8, 2722, 12, 1249, 1724, 272, 340, 730, 8, 1531, 9, 508, 730, 779, 4682, 489, 327, 3254, 26, 221, 6313, 2368, 3035, 7883, 489, 327, 3254, 26, 221, 2429, 3404, 4110, 31, 489, 308, 275, 283, 1987, 904, 8, 1531, 9, 272, 587, 26, 489, 308, 275, 291, 14, 16747, 8, 1531, 9, 272, 340, 440, 308, 14, 4130, 2258, 78, 735, 489, 308, 847, 1557, 78, 7, 272, 984, 14, 2703, 14, 952, 8, 83, 9, 272, 984, 14, 2703, 14, 4939, 342, 819, 347, 5341, 8, 277, 12, 1414, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 408, 272, 9434, 3862, 282, 2849, 1414, 14, 272, 408, 272, 340, 440, 291, 14, 2682, 26, 489, 372, 378, 272, 340, 730, 8, 1531, 9, 508, 730, 360, 735, 489, 1414, 275, 291, 14, 16747, 8, 1531, 9, 489, 2088, 589, 275, 16701, 14, 1294, 8, 1531, 9, 489, 340, 2088, 589, 59, 16, 61, 508, 283, 2866, 356, 268, 1414, 275, 334, 736, 14, 8563, 4258, 435, 2008, 8, 1760, 589, 59, 17, 5728, 272, 340, 730, 8, 1531, 9, 508, 730, 8, 5109, 489, 2562, 275, 1414, 59, 16, 61, 489, 1249, 275, 1414, 59, 17, 2938, 489, 372, 2562, 2031, 589, 9, 272, 587, 26, 489, 340, 3839, 365, 984, 14, 2703, 26, 267, 327, 14766, 465, 9476, 984, 14, 2703, 12, 871, 2366, 18, 14, 20, 3181, 1133, 2449, 641, 652, 14, 267, 1007, 548, 275, 488, 489, 587, 26, 267, 327, 3232, 5200, 367, 7003, 587, 880, 13995, 5419, 641, 2366, 18, 14, 20, 14, 267, 1007, 548, 275, 3873, 14, 6089, 489, 340, 4635, 365, 984, 14, 3083, 26, 267, 327, 14766, 465, 9476, 984, 14, 3083, 12, 871, 2366, 18, 14, 20, 3181, 1133, 2449, 641, 652, 14, 267, 1007, 1508, 275, 488, 489, 916, 4635, 365, 488, 26, 267, 327, 14076, 543, 3839, 340, 4635, 5712, 1133, 2013, 14, 267, 1007, 1508, 275, 3873, 14, 13850, 489, 587, 26, 267, 327, 3232, 5200, 367, 7003, 587, 880, 13995, 5419, 641, 2366, 18, 14, 20, 14, 267, 1007, 1508, 275, 3873, 14, 6089, 489, 299, 275, 3873, 14, 7942, 8, 1531, 12, 2574, 5218, 2687, 1274, 14, 3246, 508, 283, 2676, 708, 659, 2574, 3839, 29, 954, 548, 12, 2574, 4635, 29, 954, 1508, 9, 489, 299, 14, 2573, 342, 489, 340, 3839, 365, 488, 26, 267, 291, 14, 2703, 275, 299, 14, 2703, 14, 739, 342, 489, 916, 3839, 365, 440, 984, 14, 2703, 26, 267, 3839, 14, 952, 8, 80, 14, 2703, 14, 739, 1012, 489, 340, 4635, 440, 315, 334, 403, 12, 984, 14, 3083, 304, 267, 4635, 14, 952, 8, 80, 14, 3083, 14, 739, 1012, 489, 372, 299, 14, 9913, 819, 347, 1255, 8, 277, 12, 1414, 12, 2929, 29, 403, 12, 3839, 29, 403, 12, 4635, 29, 403, 304, 272, 408, 272, 23773, 282, 2849, 1414, 12, 20589, 652, 1642, 14, 272, 408, 272, 340, 2929, 365, 488, 26, 489, 2929, 275, 1414, 272, 291, 14, 2918, 8, 2918, 9, 272, 372, 291, 14, 2526, 8, 1531, 12, 3839, 12, 4635, 9, 421, 199, 533, 1910, 17605, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 4090, 304, 272, 291, 14, 3997, 275, 4090, 523, 347, 2218, 8, 277, 12, 1680, 304, 272, 291, 14, 3997, 14, 952, 8, 1273, 9, 272, 291, 14, 3997, 14, 4939, 342, 523, 347, 636, 5675, 721, 277, 12, 1921, 304, 272, 372, 2519, 8, 277, 14, 3997, 12, 1921, 9, 199, 199, 1274, 14, 2703, 275, 1910, 17605, 8, 1274, 14, 2703, 9, 199, 1274, 14, 3083, 275, 1910, 17605, 8, 1274, 14, 3083, 9, 421, 199, 318, 365, 63, 396, 63, 354, 8, 70, 304, 523, 372, 289, 14, 2460, 360, 6179, 396, 358, 436, 289, 14, 4130, 5175, 647, 358, 421, 199, 318, 2342, 63, 452, 63, 6179, 396, 63, 1725, 8, 3619, 304, 523, 754, 275, 942, 523, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 3619, 304, 272, 340, 1987, 6836, 7, 315, 7606, 26, 489, 7606, 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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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 ]
justinfinkle/pydiffexp
scripts/osmo_yeast_prep.py
1
2736
import sys import warnings import numpy as np import pandas as pd def parse_title(title, split_str=" "): """ Parse the title of GSE13100 into usable metadata. Should work with pandas apply() Args: title: split_str: Returns: """ split = title.split(split_str) meta = [] if len(split) == 2: meta = [split[0], "NA", "NA", split[1]] elif len(split) == 8: meta = ['MUT', split[4], int(split[5].replace('t', "")), split[-1]] elif len(split) == 6: meta = ['WT', split[2], int(split[3].replace('t', "")), split[-1]] return pd.Series(meta, index=['condition', 'rna_type', 'time', 'rep']) def mi_to_array(mi): labels = np.array(mRNA.columns.labels) x = np.array([lev[labels[ii]].values.tolist() for ii, lev in enumerate(mi.levels)]) return x.T if __name__ == '__main__': # Change output for easier reading pd.set_option('display.width', 200) # Parse R GEOQuery data into a pandas multiindex data = pd.read_csv("../data/GSE13100/GSE13100_BgCorrected_data.csv", index_col=0) row_info = pd.read_csv("../data/GSE13100/GSE13100_BgCorrected_rowinfo.csv").fillna("NA") col_info = pd.read_csv("../data/GSE13100/GSE13100_BgCorrected_colinfo.csv") # Compile the experiment information exp_info = col_info.title.apply(parse_title) exp_info.insert(0, 'geo', col_info.geo_accession.values) # Make sure the order matches the data data.sort_index(axis=1, ascending=True, inplace=True) exp_info.sort_values('geo', ascending=True, inplace=True) if not np.array_equal(data.columns.values, exp_info.geo.values): warnings.warn('Data columns and experimental info are not equal. Values may not match labels') # Make the columns a multiindex data.columns = pd.MultiIndex.from_arrays(exp_info.values.T.tolist(), names=exp_info.columns.values) data.sort_index(axis=1, inplace=True) # Select only the RA data and quantile normalize it. Log2 tranform will happen in pydiffexp pipeline idx = pd.IndexSlice mRNA = data.loc[:, idx[:, :, 'TR', :, :]] mRNA.to_pickle("../data/GSE13100/bgcorrected_GSE13100_TR_data.pkl") sys.exit() # Plot the distributions of the RA abundance info_idx = mi_to_array(mRNA.columns) fig, ax = plt.subplots(6, 7) ax_list = ax.flatten() for ii in range(mRNA.shape[1]): color = 'red' if info_idx[ii, 1] == 'MUT' else 'blue' title = 'time: {}, rep: {}'.format(info_idx[ii, 3], info_idx[ii, 4]) ax_list[ii].hist(np.log2(mRNA.values[:, ii]+1), color=color) ax_list[ii].set_title(title) plt.show() # Pickle Data mRNA.to_pickle('../data/GSE13100/log2_bgcorrected_GSE13100_TR_data.pkl')
gpl-3.0
[ 646, 984, 199, 646, 3598, 199, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 421, 199, 318, 2198, 63, 1213, 8, 1213, 12, 3715, 63, 495, 628, 26699, 272, 408, 272, 6077, 314, 2538, 402, 598, 899, 969, 1960, 1901, 18025, 3341, 14, 7719, 1736, 543, 10634, 4838, 342, 272, 3033, 26, 267, 2538, 26, 267, 3715, 63, 495, 26, 339, 1803, 26, 339, 408, 272, 3715, 275, 2538, 14, 1294, 8, 1294, 63, 495, 9, 272, 3404, 275, 942, 272, 340, 822, 8, 1294, 9, 508, 499, 26, 267, 3404, 275, 359, 1294, 59, 16, 467, 298, 7170, 401, 298, 7170, 401, 3715, 59, 17, 2677, 272, 916, 822, 8, 1294, 9, 508, 1695, 26, 267, 3404, 275, 788, 25890, 297, 3715, 59, 20, 467, 1109, 8, 1294, 59, 21, 1055, 1814, 360, 84, 297, 6899, 395, 3715, 1988, 17, 2677, 272, 916, 822, 8, 1294, 9, 508, 1227, 26, 267, 3404, 275, 788, 21283, 297, 3715, 59, 18, 467, 1109, 8, 1294, 59, 19, 1055, 1814, 360, 84, 297, 6899, 395, 3715, 1988, 17, 2677, 272, 372, 6454, 14, 9641, 8, 2024, 12, 1478, 2968, 5394, 297, 283, 82, 3540, 63, 466, 297, 283, 521, 297, 283, 1155, 1105, 421, 199, 318, 10684, 63, 475, 63, 1144, 8, 2664, 304, 272, 3628, 275, 980, 14, 1144, 8, 77, 25179, 14, 3406, 14, 3512, 9, 272, 671, 275, 980, 14, 1144, 779, 6972, 59, 3512, 59, 5908, 20230, 1459, 14, 13633, 342, 367, 15393, 12, 1026, 86, 315, 3874, 8, 2664, 14, 11402, 3948, 272, 372, 671, 14, 52, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 327, 7743, 1072, 367, 14905, 7664, 272, 6454, 14, 409, 63, 1422, 360, 2918, 14, 2063, 297, 1926, 9, 339, 327, 6077, 820, 21390, 3227, 666, 1901, 282, 10634, 3510, 1080, 272, 666, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 576, 14, 4737, 401, 1478, 63, 761, 29, 16, 9, 272, 1962, 63, 815, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 1143, 815, 14, 4737, 3471, 4498, 3540, 480, 7170, 531, 272, 1048, 63, 815, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 331, 472, 545, 14, 4737, 531, 339, 327, 24562, 314, 11805, 2556, 272, 1437, 63, 815, 275, 1048, 63, 815, 14, 1213, 14, 4998, 8, 1122, 63, 1213, 9, 272, 1437, 63, 815, 14, 3176, 8, 16, 12, 283, 6721, 297, 1048, 63, 815, 14, 6721, 63, 645, 823, 438, 14, 1459, 9, 339, 327, 4155, 3238, 314, 1865, 4450, 314, 666, 272, 666, 14, 3191, 63, 1080, 8, 3127, 29, 17, 12, 24525, 29, 549, 12, 16304, 29, 549, 9, 272, 1437, 63, 815, 14, 3191, 63, 1459, 360, 6721, 297, 24525, 29, 549, 12, 16304, 29, 549, 9, 272, 340, 440, 980, 14, 1144, 63, 1452, 8, 576, 14, 3406, 14, 1459, 12, 1437, 63, 815, 14, 6721, 14, 1459, 304, 267, 3598, 14, 4050, 360, 1451, 4362, 436, 22820, 2256, 787, 440, 4472, 14, 13468, 1443, 440, 1336, 3628, 358, 339, 327, 4155, 314, 4362, 282, 3510, 1080, 272, 666, 14, 3406, 275, 6454, 14, 3947, 2681, 14, 504, 63, 10095, 8, 1474, 63, 815, 14, 1459, 14, 52, 14, 13633, 1062, 1561, 29, 1474, 63, 815, 14, 3406, 14, 1459, 9, 272, 666, 14, 3191, 63, 1080, 8, 3127, 29, 17, 12, 16304, 29, 549, 9, 339, 327, 9496, 1454, 314, 31632, 666, 436, 31975, 7666, 652, 14, 5297, 18, 7115, 964, 911, 5992, 315, 1134, 3028, 1474, 7679, 272, 4280, 275, 6454, 14, 2681, 14034, 272, 333, 25179, 275, 666, 14, 2102, 3981, 4280, 3981, 13785, 283, 1766, 297, 13785, 520, 2677, 272, 333, 25179, 14, 475, 63, 8092, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 6856, 28125, 63, 39, 899, 969, 1960, 63, 1766, 63, 576, 14, 23947, 531, 272, 984, 14, 2224, 342, 339, 327, 14794, 314, 10208, 402, 314, 31632, 2236, 725, 554, 272, 2256, 63, 2996, 275, 10684, 63, 475, 63, 1144, 8, 77, 25179, 14, 3406, 9, 272, 6085, 12, 2185, 275, 4488, 14, 21430, 8, 22, 12, 1520, 9, 272, 2185, 63, 513, 275, 2185, 14, 8487, 342, 272, 367, 15393, 315, 1425, 8, 77, 25179, 14, 1392, 59, 17, 4682, 267, 3164, 275, 283, 581, 7, 340, 2256, 63, 2996, 59, 5908, 12, 413, 61, 508, 283, 25890, 7, 587, 283, 6304, 7, 267, 2538, 275, 283, 521, 26, 5479, 1833, 26, 9499, 908, 8, 815, 63, 2996, 59, 5908, 12, 650, 467, 2256, 63, 2996, 59, 5908, 12, 841, 566, 267, 2185, 63, 513, 59, 5908, 1055, 11141, 8, 1590, 14, 793, 18, 8, 77, 25179, 14, 1459, 3981, 15393, 2807, 17, 395, 3164, 29, 2326, 9, 267, 2185, 63, 513, 59, 5908, 1055, 409, 63, 1213, 8, 1213, 9, 272, 4488, 14, 2384, 342, 339, 327, 31732, 3918, 272, 333, 25179, 14, 475, 63, 8092, 24592, 576, 15, 39, 899, 969, 1960, 15, 793, 18, 63, 6856, 28125, 63, 39, 899, 969, 1960, 63, 1766, 63, 576, 14, 23947, 358, 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 ]
[ 984, 199, 646, 3598, 199, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 421, 199, 318, 2198, 63, 1213, 8, 1213, 12, 3715, 63, 495, 628, 26699, 272, 408, 272, 6077, 314, 2538, 402, 598, 899, 969, 1960, 1901, 18025, 3341, 14, 7719, 1736, 543, 10634, 4838, 342, 272, 3033, 26, 267, 2538, 26, 267, 3715, 63, 495, 26, 339, 1803, 26, 339, 408, 272, 3715, 275, 2538, 14, 1294, 8, 1294, 63, 495, 9, 272, 3404, 275, 942, 272, 340, 822, 8, 1294, 9, 508, 499, 26, 267, 3404, 275, 359, 1294, 59, 16, 467, 298, 7170, 401, 298, 7170, 401, 3715, 59, 17, 2677, 272, 916, 822, 8, 1294, 9, 508, 1695, 26, 267, 3404, 275, 788, 25890, 297, 3715, 59, 20, 467, 1109, 8, 1294, 59, 21, 1055, 1814, 360, 84, 297, 6899, 395, 3715, 1988, 17, 2677, 272, 916, 822, 8, 1294, 9, 508, 1227, 26, 267, 3404, 275, 788, 21283, 297, 3715, 59, 18, 467, 1109, 8, 1294, 59, 19, 1055, 1814, 360, 84, 297, 6899, 395, 3715, 1988, 17, 2677, 272, 372, 6454, 14, 9641, 8, 2024, 12, 1478, 2968, 5394, 297, 283, 82, 3540, 63, 466, 297, 283, 521, 297, 283, 1155, 1105, 421, 199, 318, 10684, 63, 475, 63, 1144, 8, 2664, 304, 272, 3628, 275, 980, 14, 1144, 8, 77, 25179, 14, 3406, 14, 3512, 9, 272, 671, 275, 980, 14, 1144, 779, 6972, 59, 3512, 59, 5908, 20230, 1459, 14, 13633, 342, 367, 15393, 12, 1026, 86, 315, 3874, 8, 2664, 14, 11402, 3948, 272, 372, 671, 14, 52, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 327, 7743, 1072, 367, 14905, 7664, 272, 6454, 14, 409, 63, 1422, 360, 2918, 14, 2063, 297, 1926, 9, 339, 327, 6077, 820, 21390, 3227, 666, 1901, 282, 10634, 3510, 1080, 272, 666, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 576, 14, 4737, 401, 1478, 63, 761, 29, 16, 9, 272, 1962, 63, 815, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 1143, 815, 14, 4737, 3471, 4498, 3540, 480, 7170, 531, 272, 1048, 63, 815, 275, 6454, 14, 739, 63, 4737, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 39, 899, 969, 1960, 63, 23571, 8380, 7983, 63, 331, 472, 545, 14, 4737, 531, 339, 327, 24562, 314, 11805, 2556, 272, 1437, 63, 815, 275, 1048, 63, 815, 14, 1213, 14, 4998, 8, 1122, 63, 1213, 9, 272, 1437, 63, 815, 14, 3176, 8, 16, 12, 283, 6721, 297, 1048, 63, 815, 14, 6721, 63, 645, 823, 438, 14, 1459, 9, 339, 327, 4155, 3238, 314, 1865, 4450, 314, 666, 272, 666, 14, 3191, 63, 1080, 8, 3127, 29, 17, 12, 24525, 29, 549, 12, 16304, 29, 549, 9, 272, 1437, 63, 815, 14, 3191, 63, 1459, 360, 6721, 297, 24525, 29, 549, 12, 16304, 29, 549, 9, 272, 340, 440, 980, 14, 1144, 63, 1452, 8, 576, 14, 3406, 14, 1459, 12, 1437, 63, 815, 14, 6721, 14, 1459, 304, 267, 3598, 14, 4050, 360, 1451, 4362, 436, 22820, 2256, 787, 440, 4472, 14, 13468, 1443, 440, 1336, 3628, 358, 339, 327, 4155, 314, 4362, 282, 3510, 1080, 272, 666, 14, 3406, 275, 6454, 14, 3947, 2681, 14, 504, 63, 10095, 8, 1474, 63, 815, 14, 1459, 14, 52, 14, 13633, 1062, 1561, 29, 1474, 63, 815, 14, 3406, 14, 1459, 9, 272, 666, 14, 3191, 63, 1080, 8, 3127, 29, 17, 12, 16304, 29, 549, 9, 339, 327, 9496, 1454, 314, 31632, 666, 436, 31975, 7666, 652, 14, 5297, 18, 7115, 964, 911, 5992, 315, 1134, 3028, 1474, 7679, 272, 4280, 275, 6454, 14, 2681, 14034, 272, 333, 25179, 275, 666, 14, 2102, 3981, 4280, 3981, 13785, 283, 1766, 297, 13785, 520, 2677, 272, 333, 25179, 14, 475, 63, 8092, 480, 5093, 576, 15, 39, 899, 969, 1960, 15, 6856, 28125, 63, 39, 899, 969, 1960, 63, 1766, 63, 576, 14, 23947, 531, 272, 984, 14, 2224, 342, 339, 327, 14794, 314, 10208, 402, 314, 31632, 2236, 725, 554, 272, 2256, 63, 2996, 275, 10684, 63, 475, 63, 1144, 8, 77, 25179, 14, 3406, 9, 272, 6085, 12, 2185, 275, 4488, 14, 21430, 8, 22, 12, 1520, 9, 272, 2185, 63, 513, 275, 2185, 14, 8487, 342, 272, 367, 15393, 315, 1425, 8, 77, 25179, 14, 1392, 59, 17, 4682, 267, 3164, 275, 283, 581, 7, 340, 2256, 63, 2996, 59, 5908, 12, 413, 61, 508, 283, 25890, 7, 587, 283, 6304, 7, 267, 2538, 275, 283, 521, 26, 5479, 1833, 26, 9499, 908, 8, 815, 63, 2996, 59, 5908, 12, 650, 467, 2256, 63, 2996, 59, 5908, 12, 841, 566, 267, 2185, 63, 513, 59, 5908, 1055, 11141, 8, 1590, 14, 793, 18, 8, 77, 25179, 14, 1459, 3981, 15393, 2807, 17, 395, 3164, 29, 2326, 9, 267, 2185, 63, 513, 59, 5908, 1055, 409, 63, 1213, 8, 1213, 9, 272, 4488, 14, 2384, 342, 339, 327, 31732, 3918, 272, 333, 25179, 14, 475, 63, 8092, 24592, 576, 15, 39, 899, 969, 1960, 15, 793, 18, 63, 6856, 28125, 63, 39, 899, 969, 1960, 63, 1766, 63, 576, 14, 23947, 358, 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, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
eagleamon/home-assistant
homeassistant/components/ffmpeg.py
1
6820
""" Component that will help set the ffmpeg component. For more details about this component, please refer to the documentation at https://home-assistant.io/components/ffmpeg/ """ import asyncio import logging import os import voluptuous as vol from homeassistant.core import callback from homeassistant.const import ( ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) from homeassistant.config import load_yaml_config_file import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity DOMAIN = 'ffmpeg' REQUIREMENTS = ["ha-ffmpeg==1.2"] _LOGGER = logging.getLogger(__name__) SERVICE_START = 'start' SERVICE_STOP = 'stop' SERVICE_RESTART = 'restart' DATA_FFMPEG = 'ffmpeg' CONF_INITIAL_STATE = 'initial_state' CONF_INPUT = 'input' CONF_FFMPEG_BIN = 'ffmpeg_bin' CONF_EXTRA_ARGUMENTS = 'extra_arguments' CONF_OUTPUT = 'output' CONF_RUN_TEST = 'run_test' DEFAULT_BINARY = 'ffmpeg' DEFAULT_RUN_TEST = True CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Optional(CONF_FFMPEG_BIN, default=DEFAULT_BINARY): cv.string, vol.Optional(CONF_RUN_TEST, default=DEFAULT_RUN_TEST): cv.boolean, }), }, extra=vol.ALLOW_EXTRA) SERVICE_FFMPEG_SCHEMA = vol.Schema({ vol.Optional(ATTR_ENTITY_ID): cv.entity_ids, }) def start(hass, entity_id=None): """Start a ffmpeg process on entity.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.services.call(DOMAIN, SERVICE_START, data) def stop(hass, entity_id=None): """Stop a ffmpeg process on entity.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.services.call(DOMAIN, SERVICE_STOP, data) def restart(hass, entity_id=None): """Restart a ffmpeg process on entity.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.services.call(DOMAIN, SERVICE_RESTART, data) @asyncio.coroutine def async_setup(hass, config): """Setup the FFmpeg component.""" conf = config.get(DOMAIN, {}) manager = FFmpegManager( hass, conf.get(CONF_FFMPEG_BIN, DEFAULT_BINARY), conf.get(CONF_RUN_TEST, DEFAULT_RUN_TEST) ) descriptions = yield from hass.loop.run_in_executor( None, load_yaml_config_file, os.path.join(os.path.dirname(__file__), 'services.yaml')) # register service @asyncio.coroutine def async_service_handle(service): """Handle service ffmpeg process.""" entity_ids = service.data.get(ATTR_ENTITY_ID) if entity_ids: devices = [device for device in manager.entities if device.entity_id in entity_ids] else: devices = manager.entities tasks = [] for device in devices: if service.service == SERVICE_START: tasks.append(device.async_start_ffmpeg()) elif service.service == SERVICE_STOP: tasks.append(device.async_stop_ffmpeg()) else: tasks.append(device.async_restart_ffmpeg()) if tasks: yield from asyncio.wait(tasks, loop=hass.loop) hass.services.async_register( DOMAIN, SERVICE_START, async_service_handle, descriptions[DOMAIN].get(SERVICE_START), schema=SERVICE_FFMPEG_SCHEMA) hass.services.async_register( DOMAIN, SERVICE_STOP, async_service_handle, descriptions[DOMAIN].get(SERVICE_STOP), schema=SERVICE_FFMPEG_SCHEMA) hass.services.async_register( DOMAIN, SERVICE_RESTART, async_service_handle, descriptions[DOMAIN].get(SERVICE_RESTART), schema=SERVICE_FFMPEG_SCHEMA) hass.data[DATA_FFMPEG] = manager return True class FFmpegManager(object): """Helper for ha-ffmpeg.""" def __init__(self, hass, ffmpeg_bin, run_test): """Initialize helper.""" self.hass = hass self._cache = {} self._bin = ffmpeg_bin self._run_test = run_test self._entities = [] @property def binary(self): """Return ffmpeg binary from config.""" return self._bin @property def entities(self): """Return ffmpeg entities for services.""" return self._entities @callback def async_register_device(self, device): """Register a ffmpeg process/device.""" self._entities.append(device) @asyncio.coroutine def async_shutdown(event): """Stop ffmpeg process.""" yield from device.async_stop_ffmpeg() self.hass.bus.async_listen_once( EVENT_HOMEASSISTANT_STOP, async_shutdown) # start on startup if device.initial_state: @asyncio.coroutine def async_start(event): """Start ffmpeg process.""" yield from device.async_start_ffmpeg() yield from device.async_update_ha_state() self.hass.bus.async_listen_once( EVENT_HOMEASSISTANT_START, async_start) @asyncio.coroutine def async_run_test(self, input_source): """Run test on this input. TRUE is deactivate or run correct. This method must be run in the event loop. """ from haffmpeg import Test if self._run_test: # if in cache if input_source in self._cache: return self._cache[input_source] # run test ffmpeg_test = Test(self.binary, loop=self.hass.loop) success = yield from ffmpeg_test.run_test(input_source) if not success: _LOGGER.error("FFmpeg '%s' test fails!", input_source) self._cache[input_source] = False return False self._cache[input_source] = True return True class FFmpegBase(Entity): """Interface object for ffmpeg.""" def __init__(self, initial_state=True): """Initialize ffmpeg base object.""" self.ffmpeg = None self.initial_state = initial_state @property def available(self): """Return True if entity is available.""" return self.ffmpeg.is_running @property def should_poll(self): """Return True if entity has to be polled for state.""" return False def async_start_ffmpeg(self): """Start a ffmpeg process. This method must be run in the event loop and returns a coroutine. """ raise NotImplementedError() def async_stop_ffmpeg(self): """Stop a ffmpeg process. This method must be run in the event loop and returns a coroutine. """ return self.ffmpeg.close() @asyncio.coroutine def async_restart_ffmpeg(self): """Stop a ffmpeg process.""" yield from self.async_stop_ffmpeg() yield from self.async_start_ffmpeg()
apache-2.0
[ 624, 199, 7004, 626, 911, 1720, 663, 314, 16328, 16801, 3931, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 3931, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 27648, 15, 199, 624, 199, 646, 16195, 199, 646, 2050, 199, 646, 747, 199, 199, 646, 30291, 465, 5236, 199, 199, 504, 8846, 14, 1018, 492, 3233, 199, 504, 8846, 14, 1297, 492, 334, 272, 10762, 63, 13630, 63, 998, 12, 6461, 63, 9524, 16435, 840, 1441, 63, 7363, 12, 6461, 63, 9524, 16435, 840, 1441, 63, 11632, 9, 199, 504, 8846, 14, 888, 492, 2248, 63, 5963, 63, 888, 63, 493, 199, 646, 8846, 14, 7546, 14, 888, 63, 6136, 465, 6277, 199, 504, 8846, 14, 7546, 14, 4502, 492, 17680, 199, 199, 7378, 275, 283, 27648, 7, 199, 29168, 20967, 275, 2097, 2411, 13, 27648, 389, 17, 14, 18, 937, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 10486, 63, 7363, 275, 283, 928, 7, 199, 10486, 63, 11632, 275, 283, 2379, 7, 199, 10486, 63, 15740, 2294, 275, 283, 10506, 7, 199, 199, 3998, 63, 1665, 45, 17557, 275, 283, 27648, 7, 199, 199, 3103, 63, 13768, 63, 6689, 275, 283, 2747, 63, 929, 7, 199, 3103, 63, 7321, 275, 283, 1210, 7, 199, 3103, 63, 1665, 45, 17557, 63, 9431, 275, 283, 27648, 63, 1393, 7, 199, 3103, 63, 18555, 63, 24165, 51, 275, 283, 2911, 63, 4958, 7, 199, 3103, 63, 8414, 275, 283, 1199, 7, 199, 3103, 63, 9390, 63, 2864, 275, 283, 1065, 63, 396, 7, 199, 199, 3472, 63, 13246, 275, 283, 27648, 7, 199, 3472, 63, 9390, 63, 2864, 275, 715, 199, 199, 5569, 63, 10926, 275, 5236, 14, 6700, 2561, 272, 15265, 26, 5236, 14, 6700, 2561, 267, 5236, 14, 7012, 8, 3103, 63, 1665, 45, 17557, 63, 9431, 12, 849, 29, 3472, 63, 13246, 304, 6277, 14, 875, 12, 267, 5236, 14, 7012, 8, 3103, 63, 9390, 63, 2864, 12, 849, 29, 3472, 63, 9390, 63, 2864, 304, 6277, 14, 4871, 12, 272, 9998, 199, 1386, 2402, 29, 5650, 14, 12231, 63, 18555, 9, 199, 199, 10486, 63, 1665, 45, 17557, 63, 10926, 275, 5236, 14, 6700, 2561, 272, 5236, 14, 7012, 8, 5280, 63, 13630, 63, 998, 304, 6277, 14, 4502, 63, 1580, 12, 199, 1552, 421, 199, 318, 1343, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 3162, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 7363, 12, 666, 9, 421, 199, 318, 3631, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 6293, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 11632, 12, 666, 9, 421, 199, 318, 11004, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 25493, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 15740, 2294, 12, 666, 9, 421, 199, 32, 19343, 14, 16675, 199, 318, 5316, 63, 2758, 8, 5387, 12, 1101, 304, 272, 408, 8555, 314, 25046, 16801, 3931, 1041, 272, 3743, 275, 1101, 14, 362, 8, 7378, 12, 5009, 339, 5256, 275, 25046, 16801, 2988, 8, 267, 6298, 12, 267, 3743, 14, 362, 8, 3103, 63, 1665, 45, 17557, 63, 9431, 12, 6186, 63, 13246, 395, 267, 3743, 14, 362, 8, 3103, 63, 9390, 63, 2864, 12, 6186, 63, 9390, 63, 2864, 9, 272, 776, 339, 18714, 275, 1995, 687, 6298, 14, 3813, 14, 1065, 63, 262, 63, 13471, 8, 267, 488, 12, 2248, 63, 5963, 63, 888, 63, 493, 12, 267, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 5950, 14, 5963, 1333, 339, 327, 2274, 2435, 272, 768, 19343, 14, 16675, 272, 347, 5316, 63, 1364, 63, 2479, 8, 1364, 304, 267, 408, 5940, 2435, 16328, 16801, 2112, 1041, 267, 4642, 63, 1580, 275, 2435, 14, 576, 14, 362, 8, 5280, 63, 13630, 63, 998, 9, 398, 340, 4642, 63, 1580, 26, 288, 7256, 275, 359, 1782, 367, 2243, 315, 5256, 14, 8327, 2432, 340, 2243, 14, 4502, 63, 344, 315, 4642, 63, 1580, 61, 267, 587, 26, 288, 7256, 275, 5256, 14, 8327, 398, 6527, 275, 942, 267, 367, 2243, 315, 7256, 26, 288, 340, 2435, 14, 1364, 508, 16655, 63, 7363, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 928, 63, 27648, 1012, 288, 916, 2435, 14, 1364, 508, 16655, 63, 11632, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 2379, 63, 27648, 1012, 288, 587, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 10506, 63, 27648, 1012, 398, 340, 6527, 26, 288, 1995, 687, 16195, 14, 2573, 8, 5054, 12, 4438, 29, 5387, 14, 3813, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 7363, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 7363, 395, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 11632, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 11632, 395, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 15740, 2294, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 15740, 2294, 395, 267, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 576, 59, 3998, 63, 1665, 45, 17557, 61, 275, 5256, 272, 372, 715, 421, 199, 533, 25046, 16801, 2988, 8, 785, 304, 272, 408 ]
[ 199, 7004, 626, 911, 1720, 663, 314, 16328, 16801, 3931, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 3931, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 27648, 15, 199, 624, 199, 646, 16195, 199, 646, 2050, 199, 646, 747, 199, 199, 646, 30291, 465, 5236, 199, 199, 504, 8846, 14, 1018, 492, 3233, 199, 504, 8846, 14, 1297, 492, 334, 272, 10762, 63, 13630, 63, 998, 12, 6461, 63, 9524, 16435, 840, 1441, 63, 7363, 12, 6461, 63, 9524, 16435, 840, 1441, 63, 11632, 9, 199, 504, 8846, 14, 888, 492, 2248, 63, 5963, 63, 888, 63, 493, 199, 646, 8846, 14, 7546, 14, 888, 63, 6136, 465, 6277, 199, 504, 8846, 14, 7546, 14, 4502, 492, 17680, 199, 199, 7378, 275, 283, 27648, 7, 199, 29168, 20967, 275, 2097, 2411, 13, 27648, 389, 17, 14, 18, 937, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 10486, 63, 7363, 275, 283, 928, 7, 199, 10486, 63, 11632, 275, 283, 2379, 7, 199, 10486, 63, 15740, 2294, 275, 283, 10506, 7, 199, 199, 3998, 63, 1665, 45, 17557, 275, 283, 27648, 7, 199, 199, 3103, 63, 13768, 63, 6689, 275, 283, 2747, 63, 929, 7, 199, 3103, 63, 7321, 275, 283, 1210, 7, 199, 3103, 63, 1665, 45, 17557, 63, 9431, 275, 283, 27648, 63, 1393, 7, 199, 3103, 63, 18555, 63, 24165, 51, 275, 283, 2911, 63, 4958, 7, 199, 3103, 63, 8414, 275, 283, 1199, 7, 199, 3103, 63, 9390, 63, 2864, 275, 283, 1065, 63, 396, 7, 199, 199, 3472, 63, 13246, 275, 283, 27648, 7, 199, 3472, 63, 9390, 63, 2864, 275, 715, 199, 199, 5569, 63, 10926, 275, 5236, 14, 6700, 2561, 272, 15265, 26, 5236, 14, 6700, 2561, 267, 5236, 14, 7012, 8, 3103, 63, 1665, 45, 17557, 63, 9431, 12, 849, 29, 3472, 63, 13246, 304, 6277, 14, 875, 12, 267, 5236, 14, 7012, 8, 3103, 63, 9390, 63, 2864, 12, 849, 29, 3472, 63, 9390, 63, 2864, 304, 6277, 14, 4871, 12, 272, 9998, 199, 1386, 2402, 29, 5650, 14, 12231, 63, 18555, 9, 199, 199, 10486, 63, 1665, 45, 17557, 63, 10926, 275, 5236, 14, 6700, 2561, 272, 5236, 14, 7012, 8, 5280, 63, 13630, 63, 998, 304, 6277, 14, 4502, 63, 1580, 12, 199, 1552, 421, 199, 318, 1343, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 3162, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 7363, 12, 666, 9, 421, 199, 318, 3631, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 6293, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 11632, 12, 666, 9, 421, 199, 318, 11004, 8, 5387, 12, 4642, 63, 344, 29, 403, 304, 272, 408, 25493, 282, 16328, 16801, 2112, 641, 4642, 1041, 272, 666, 275, 469, 5280, 63, 13630, 63, 998, 26, 4642, 63, 344, 93, 340, 4642, 63, 344, 587, 1052, 272, 6298, 14, 5950, 14, 1250, 8, 7378, 12, 16655, 63, 15740, 2294, 12, 666, 9, 421, 199, 32, 19343, 14, 16675, 199, 318, 5316, 63, 2758, 8, 5387, 12, 1101, 304, 272, 408, 8555, 314, 25046, 16801, 3931, 1041, 272, 3743, 275, 1101, 14, 362, 8, 7378, 12, 5009, 339, 5256, 275, 25046, 16801, 2988, 8, 267, 6298, 12, 267, 3743, 14, 362, 8, 3103, 63, 1665, 45, 17557, 63, 9431, 12, 6186, 63, 13246, 395, 267, 3743, 14, 362, 8, 3103, 63, 9390, 63, 2864, 12, 6186, 63, 9390, 63, 2864, 9, 272, 776, 339, 18714, 275, 1995, 687, 6298, 14, 3813, 14, 1065, 63, 262, 63, 13471, 8, 267, 488, 12, 2248, 63, 5963, 63, 888, 63, 493, 12, 267, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 5950, 14, 5963, 1333, 339, 327, 2274, 2435, 272, 768, 19343, 14, 16675, 272, 347, 5316, 63, 1364, 63, 2479, 8, 1364, 304, 267, 408, 5940, 2435, 16328, 16801, 2112, 1041, 267, 4642, 63, 1580, 275, 2435, 14, 576, 14, 362, 8, 5280, 63, 13630, 63, 998, 9, 398, 340, 4642, 63, 1580, 26, 288, 7256, 275, 359, 1782, 367, 2243, 315, 5256, 14, 8327, 2432, 340, 2243, 14, 4502, 63, 344, 315, 4642, 63, 1580, 61, 267, 587, 26, 288, 7256, 275, 5256, 14, 8327, 398, 6527, 275, 942, 267, 367, 2243, 315, 7256, 26, 288, 340, 2435, 14, 1364, 508, 16655, 63, 7363, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 928, 63, 27648, 1012, 288, 916, 2435, 14, 1364, 508, 16655, 63, 11632, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 2379, 63, 27648, 1012, 288, 587, 26, 355, 6527, 14, 740, 8, 1782, 14, 4146, 63, 10506, 63, 27648, 1012, 398, 340, 6527, 26, 288, 1995, 687, 16195, 14, 2573, 8, 5054, 12, 4438, 29, 5387, 14, 3813, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 7363, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 7363, 395, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 11632, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 11632, 395, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 5950, 14, 4146, 63, 2683, 8, 267, 15265, 12, 16655, 63, 15740, 2294, 12, 5316, 63, 1364, 63, 2479, 12, 267, 18714, 59, 7378, 1055, 362, 8, 10486, 63, 15740, 2294, 395, 267, 4177, 29, 10486, 63, 1665, 45, 17557, 63, 10926, 9, 339, 6298, 14, 576, 59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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 ]
rlaager/libvirt
docs/index.py
53
37181
#!/usr/bin/python -u # # imports the API description and fills up a database with # name relevance to modules, functions or web pages # # Operation needed: # ================= # # install mysqld, the python wrappers for mysql and libxml2, start mysqld # - mysql-server # - mysql # - php-mysql # - MySQL-python # Change the root passwd of mysql: # mysqladmin -u root password new_password # Create the new database libvir # mysqladmin -p create libvir # Create a database user 'veillard' and give him password access # change veillard and abcde with the right user name and passwd # mysql -p # password: # mysql> GRANT ALL PRIVILEGES ON libvir TO veillard@localhost # IDENTIFIED BY 'abcde' WITH GRANT OPTION; # mysql> GRANT ALL PRIVILEGES ON libvir.* TO veillard@localhost # IDENTIFIED BY 'abcde' WITH GRANT OPTION; # # As the user check the access: # mysql -p libvir # Enter password: # Welcome to the MySQL monitor.... # mysql> use libvir # Database changed # mysql> quit # Bye # # Then run the script in the doc subdir, it will create the symbols and # word tables and populate them with information extracted from # the libvirt-api.xml API description, and make then accessible read-only # by nobody@loaclhost the user expected to be Apache's one # # On the Apache configuration, make sure you have php support enabled # import MySQLdb import libxml2 import sys import string import os # # We are not interested in parsing errors here # def callback(ctx, str): return libxml2.registerErrorHandler(callback, None) # # The dictionary of tables required and the SQL command needed # to create them # TABLES={ "symbols" : """CREATE TABLE symbols ( name varchar(255) BINARY NOT NULL, module varchar(255) BINARY NOT NULL, type varchar(25) NOT NULL, descr varchar(255), UNIQUE KEY name (name), KEY module (module))""", "words" : """CREATE TABLE words ( name varchar(50) BINARY NOT NULL, symbol varchar(255) BINARY NOT NULL, relevance int, KEY name (name), KEY symbol (symbol), UNIQUE KEY ID (name, symbol))""", "wordsHTML" : """CREATE TABLE wordsHTML ( name varchar(50) BINARY NOT NULL, resource varchar(255) BINARY NOT NULL, section varchar(255), id varchar(50), relevance int, KEY name (name), KEY resource (resource), UNIQUE KEY ref (name, resource))""", "wordsArchive" : """CREATE TABLE wordsArchive ( name varchar(50) BINARY NOT NULL, ID int(11) NOT NULL, relevance int, KEY name (name), UNIQUE KEY ref (name, ID))""", "pages" : """CREATE TABLE pages ( resource varchar(255) BINARY NOT NULL, title varchar(255) BINARY NOT NULL, UNIQUE KEY name (resource))""", "archives" : """CREATE TABLE archives ( ID int(11) NOT NULL auto_increment, resource varchar(255) BINARY NOT NULL, title varchar(255) BINARY NOT NULL, UNIQUE KEY id (ID,resource(255)), INDEX (ID), INDEX (resource))""", "Queries" : """CREATE TABLE Queries ( ID int(11) NOT NULL auto_increment, Value varchar(50) NOT NULL, Count int(11) NOT NULL, UNIQUE KEY id (ID,Value(35)), INDEX (ID))""", "AllQueries" : """CREATE TABLE AllQueries ( ID int(11) NOT NULL auto_increment, Value varchar(50) NOT NULL, Count int(11) NOT NULL, UNIQUE KEY id (ID,Value(35)), INDEX (ID))""", } # # The XML API description file to parse # API="libvirt-api.xml" DB=None ######################################################################### # # # MySQL database interfaces # # # ######################################################################### def createTable(db, name): global TABLES if db is None: return -1 if name is None: return -1 c = db.cursor() ret = c.execute("DROP TABLE IF EXISTS %s" % (name)) if ret == 1: print "Removed table %s" % (name) print "Creating table %s" % (name) try: ret = c.execute(TABLES[name]) except: print "Failed to create table %s" % (name) return -1 return ret def checkTables(db, verbose = 1): global TABLES if db is None: return -1 c = db.cursor() nbtables = c.execute("show tables") if verbose: print "Found %d tables" % (nbtables) tables = {} i = 0 while i < nbtables: l = c.fetchone() name = l[0] tables[name] = {} i = i + 1 for table in TABLES.keys(): if not tables.has_key(table): print "table %s missing" % (table) createTable(db, table) try: ret = c.execute("SELECT count(*) from %s" % table) row = c.fetchone() if verbose: print "Table %s contains %d records" % (table, row[0]) except: print "Troubles with table %s : repairing" % (table) ret = c.execute("repair table %s" % table) print "repairing returned %d" % (ret) ret = c.execute("SELECT count(*) from %s" % table) row = c.fetchone() print "Table %s contains %d records" % (table, row[0]) if verbose: print "checkTables finished" # make sure apache can access the tables read-only try: ret = c.execute("GRANT SELECT ON libvir.* TO nobody@localhost") ret = c.execute("GRANT INSERT,SELECT,UPDATE ON libvir.Queries TO nobody@localhost") except: pass return 0 def openMySQL(db="libvir", passwd=None, verbose = 1): global DB if passwd is None: try: passwd = os.environ["MySQL_PASS"] except: print "No password available, set environment MySQL_PASS" sys.exit(1) DB = MySQLdb.connect(passwd=passwd, db=db) if DB is None: return -1 ret = checkTables(DB, verbose) return ret def updateWord(name, symbol, relevance): global DB if DB is None: openMySQL() if DB is None: return -1 if name is None: return -1 if symbol is None: return -1 c = DB.cursor() try: ret = c.execute( """INSERT INTO words (name, symbol, relevance) VALUES ('%s','%s', %d)""" % (name, symbol, relevance)) except: try: ret = c.execute( """UPDATE words SET relevance = %d where name = '%s' and symbol = '%s'""" % (relevance, name, symbol)) except: print "Update word (%s, %s, %s) failed command" % (name, symbol, relevance) print "UPDATE words SET relevance = %d where name = '%s' and symbol = '%s'" % (relevance, name, symbol) print sys.exc_type, sys.exc_value return -1 return ret def updateSymbol(name, module, type, desc): global DB updateWord(name, name, 50) if DB is None: openMySQL() if DB is None: return -1 if name is None: return -1 if module is None: return -1 if type is None: return -1 try: desc = string.replace(desc, "'", " ") l = string.split(desc, ".") desc = l[0] desc = desc[0:99] except: desc = "" c = DB.cursor() try: ret = c.execute( """INSERT INTO symbols (name, module, type, descr) VALUES ('%s','%s', '%s', '%s')""" % (name, module, type, desc)) except: try: ret = c.execute( """UPDATE symbols SET module='%s', type='%s', descr='%s' where name='%s'""" % (module, type, desc, name)) except: print "Update symbol (%s, %s, %s) failed command" % (name, module, type) print """UPDATE symbols SET module='%s', type='%s', descr='%s' where name='%s'""" % (module, type, desc, name) print sys.exc_type, sys.exc_value return -1 return ret def addFunction(name, module, desc = ""): return updateSymbol(name, module, 'function', desc) def addMacro(name, module, desc = ""): return updateSymbol(name, module, 'macro', desc) def addEnum(name, module, desc = ""): return updateSymbol(name, module, 'enum', desc) def addStruct(name, module, desc = ""): return updateSymbol(name, module, 'struct', desc) def addConst(name, module, desc = ""): return updateSymbol(name, module, 'const', desc) def addType(name, module, desc = ""): return updateSymbol(name, module, 'type', desc) def addFunctype(name, module, desc = ""): return updateSymbol(name, module, 'functype', desc) def addPage(resource, title): global DB if DB is None: openMySQL() if DB is None: return -1 if resource is None: return -1 c = DB.cursor() try: ret = c.execute( """INSERT INTO pages (resource, title) VALUES ('%s','%s')""" % (resource, title)) except: try: ret = c.execute( """UPDATE pages SET title='%s' WHERE resource='%s'""" % (title, resource)) except: print "Update symbol (%s, %s, %s) failed command" % (name, module, type) print """UPDATE pages SET title='%s' WHERE resource='%s'""" % (title, resource) print sys.exc_type, sys.exc_value return -1 return ret def updateWordHTML(name, resource, desc, id, relevance): global DB if DB is None: openMySQL() if DB is None: return -1 if name is None: return -1 if resource is None: return -1 if id is None: id = "" if desc is None: desc = "" else: try: desc = string.replace(desc, "'", " ") desc = desc[0:99] except: desc = "" c = DB.cursor() try: ret = c.execute( """INSERT INTO wordsHTML (name, resource, section, id, relevance) VALUES ('%s','%s', '%s', '%s', '%d')""" % (name, resource, desc, id, relevance)) except: try: ret = c.execute( """UPDATE wordsHTML SET section='%s', id='%s', relevance='%d' where name='%s' and resource='%s'""" % (desc, id, relevance, name, resource)) except: print "Update symbol (%s, %s, %d) failed command" % (name, resource, relevance) print """UPDATE wordsHTML SET section='%s', id='%s', relevance='%d' where name='%s' and resource='%s'""" % (desc, id, relevance, name, resource) print sys.exc_type, sys.exc_value return -1 return ret def checkXMLMsgArchive(url): global DB if DB is None: openMySQL() if DB is None: return -1 if url is None: return -1 c = DB.cursor() try: ret = c.execute( """SELECT ID FROM archives WHERE resource='%s'""" % (url)) row = c.fetchone() if row is None: return -1 except: return -1 return row[0] def addXMLMsgArchive(url, title): global DB if DB is None: openMySQL() if DB is None: return -1 if url is None: return -1 if title is None: title = "" else: title = string.replace(title, "'", " ") title = title[0:99] c = DB.cursor() try: cmd = """INSERT INTO archives (resource, title) VALUES ('%s','%s')""" % (url, title) ret = c.execute(cmd) cmd = """SELECT ID FROM archives WHERE resource='%s'""" % (url) ret = c.execute(cmd) row = c.fetchone() if row is None: print "addXMLMsgArchive failed to get the ID: %s" % (url) return -1 except: print "addXMLMsgArchive failed command: %s" % (cmd) return -1 return((int)(row[0])) def updateWordArchive(name, id, relevance): global DB if DB is None: openMySQL() if DB is None: return -1 if name is None: return -1 if id is None: return -1 c = DB.cursor() try: ret = c.execute( """INSERT INTO wordsArchive (name, id, relevance) VALUES ('%s', '%d', '%d')""" % (name, id, relevance)) except: try: ret = c.execute( """UPDATE wordsArchive SET relevance='%d' where name='%s' and ID='%d'""" % (relevance, name, id)) except: print "Update word archive (%s, %d, %d) failed command" % (name, id, relevance) print """UPDATE wordsArchive SET relevance='%d' where name='%s' and ID='%d'""" % (relevance, name, id) print sys.exc_type, sys.exc_value return -1 return ret ######################################################################### # # # Word dictionary and analysis routines # # # ######################################################################### # # top 100 english word without the one len < 3 + own set # dropWords = { 'the':0, 'this':0, 'can':0, 'man':0, 'had':0, 'him':0, 'only':0, 'and':0, 'not':0, 'been':0, 'other':0, 'even':0, 'are':0, 'was':0, 'new':0, 'most':0, 'but':0, 'when':0, 'some':0, 'made':0, 'from':0, 'who':0, 'could':0, 'after':0, 'that':0, 'will':0, 'time':0, 'also':0, 'have':0, 'more':0, 'these':0, 'did':0, 'was':0, 'two':0, 'many':0, 'they':0, 'may':0, 'before':0, 'for':0, 'which':0, 'out':0, 'then':0, 'must':0, 'one':0, 'through':0, 'with':0, 'you':0, 'said':0, 'first':0, 'back':0, 'were':0, 'what':0, 'any':0, 'years':0, 'his':0, 'her':0, 'where':0, 'all':0, 'its':0, 'now':0, 'much':0, 'she':0, 'about':0, 'such':0, 'your':0, 'there':0, 'into':0, 'like':0, 'may':0, 'would':0, 'than':0, 'our':0, 'well':0, 'their':0, 'them':0, 'over':0, 'down':0, 'net':0, 'www':0, 'bad':0, 'Okay':0, 'bin':0, 'cur':0, } wordsDict = {} wordsDictHTML = {} wordsDictArchive = {} def cleanupWordsString(str): str = string.replace(str, ".", " ") str = string.replace(str, "!", " ") str = string.replace(str, "?", " ") str = string.replace(str, ",", " ") str = string.replace(str, "'", " ") str = string.replace(str, '"', " ") str = string.replace(str, ";", " ") str = string.replace(str, "(", " ") str = string.replace(str, ")", " ") str = string.replace(str, "{", " ") str = string.replace(str, "}", " ") str = string.replace(str, "<", " ") str = string.replace(str, ">", " ") str = string.replace(str, "=", " ") str = string.replace(str, "/", " ") str = string.replace(str, "*", " ") str = string.replace(str, ":", " ") str = string.replace(str, "#", " ") str = string.replace(str, "\\", " ") str = string.replace(str, "\n", " ") str = string.replace(str, "\r", " ") str = string.replace(str, "\xc2", " ") str = string.replace(str, "\xa0", " ") return str def cleanupDescrString(str): str = string.replace(str, "'", " ") str = string.replace(str, "\n", " ") str = string.replace(str, "\r", " ") str = string.replace(str, "\xc2", " ") str = string.replace(str, "\xa0", " ") l = string.split(str) str = string.join(str) return str def splitIdentifier(str): ret = [] while str != "": cur = string.lower(str[0]) str = str[1:] if ((cur < 'a') or (cur > 'z')): continue while (str != "") and (str[0] >= 'A') and (str[0] <= 'Z'): cur = cur + string.lower(str[0]) str = str[1:] while (str != "") and (str[0] >= 'a') and (str[0] <= 'z'): cur = cur + str[0] str = str[1:] while (str != "") and (str[0] >= '0') and (str[0] <= '9'): str = str[1:] ret.append(cur) return ret def addWord(word, module, symbol, relevance): global wordsDict if word is None or len(word) < 3: return -1 if module is None or symbol is None: return -1 if dropWords.has_key(word): return 0 if ord(word[0]) > 0x80: return 0 if wordsDict.has_key(word): d = wordsDict[word] if d is None: return 0 if len(d) > 500: wordsDict[word] = None return 0 try: relevance = relevance + d[(module, symbol)] except: pass else: wordsDict[word] = {} wordsDict[word][(module, symbol)] = relevance return relevance def addString(str, module, symbol, relevance): if str is None or len(str) < 3: return -1 ret = 0 str = cleanupWordsString(str) l = string.split(str) for word in l: if len(word) > 2: ret = ret + addWord(word, module, symbol, 5) return ret def addWordHTML(word, resource, id, section, relevance): global wordsDictHTML if word is None or len(word) < 3: return -1 if resource is None or section is None: return -1 if dropWords.has_key(word): return 0 if ord(word[0]) > 0x80: return 0 section = cleanupDescrString(section) if wordsDictHTML.has_key(word): d = wordsDictHTML[word] if d is None: print "skipped %s" % (word) return 0 try: (r,i,s) = d[resource] if i is not None: id = i if s is not None: section = s relevance = relevance + r except: pass else: wordsDictHTML[word] = {} d = wordsDictHTML[word] d[resource] = (relevance, id, section) return relevance def addStringHTML(str, resource, id, section, relevance): if str is None or len(str) < 3: return -1 ret = 0 str = cleanupWordsString(str) l = string.split(str) for word in l: if len(word) > 2: try: r = addWordHTML(word, resource, id, section, relevance) if r < 0: print "addWordHTML failed: %s %s" % (word, resource) ret = ret + r except: print "addWordHTML failed: %s %s %d" % (word, resource, relevance) print sys.exc_type, sys.exc_value return ret def addWordArchive(word, id, relevance): global wordsDictArchive if word is None or len(word) < 3: return -1 if id is None or id == -1: return -1 if dropWords.has_key(word): return 0 if ord(word[0]) > 0x80: return 0 if wordsDictArchive.has_key(word): d = wordsDictArchive[word] if d is None: print "skipped %s" % (word) return 0 try: r = d[id] relevance = relevance + r except: pass else: wordsDictArchive[word] = {} d = wordsDictArchive[word] d[id] = relevance return relevance def addStringArchive(str, id, relevance): if str is None or len(str) < 3: return -1 ret = 0 str = cleanupWordsString(str) l = string.split(str) for word in l: i = len(word) if i > 2: try: r = addWordArchive(word, id, relevance) if r < 0: print "addWordArchive failed: %s %s" % (word, id) else: ret = ret + r except: print "addWordArchive failed: %s %s %d" % (word, id, relevance) print sys.exc_type, sys.exc_value return ret ######################################################################### # # # XML API description analysis # # # ######################################################################### def loadAPI(filename): doc = libxml2.parseFile(filename) print "loaded %s" % (filename) return doc def foundExport(file, symbol): if file is None: return 0 if symbol is None: return 0 addFunction(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPIFile(top): count = 0 name = top.prop("name") cur = top.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "exports": count = count + foundExport(name, cur.prop("symbol")) else: print "unexpected element %s in API doc <file name='%s'>" % (name) cur = cur.next return count def analyzeAPIFiles(top): count = 0 cur = top.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "file": count = count + analyzeAPIFile(cur) else: print "unexpected element %s in API doc <files>" % (cur.name) cur = cur.next return count def analyzeAPIEnum(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 addEnum(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPIConst(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 addConst(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPIType(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 addType(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPIFunctype(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 addFunctype(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPIStruct(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 addStruct(symbol, file) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) info = top.prop("info") if info is not None: info = string.replace(info, "'", " ") info = string.strip(info) l = string.split(info) for word in l: if len(word) > 2: addWord(word, file, symbol, 5) return 1 def analyzeAPIMacro(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 symbol = string.replace(symbol, "'", " ") symbol = string.strip(symbol) info = None cur = top.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "info": info = cur.content break cur = cur.next l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) if info is None: addMacro(symbol, file) print "Macro %s description has no <info>" % (symbol) return 0 info = string.replace(info, "'", " ") info = string.strip(info) addMacro(symbol, file, info) l = string.split(info) for word in l: if len(word) > 2: addWord(word, file, symbol, 5) return 1 def analyzeAPIFunction(top): file = top.prop("file") if file is None: return 0 symbol = top.prop("name") if symbol is None: return 0 symbol = string.replace(symbol, "'", " ") symbol = string.strip(symbol) info = None cur = top.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "info": info = cur.content elif cur.name == "return": rinfo = cur.prop("info") if rinfo is not None: rinfo = string.replace(rinfo, "'", " ") rinfo = string.strip(rinfo) addString(rinfo, file, symbol, 7) elif cur.name == "arg": ainfo = cur.prop("info") if ainfo is not None: ainfo = string.replace(ainfo, "'", " ") ainfo = string.strip(ainfo) addString(ainfo, file, symbol, 5) name = cur.prop("name") if name is not None: name = string.replace(name, "'", " ") name = string.strip(name) addWord(name, file, symbol, 7) cur = cur.next if info is None: print "Function %s description has no <info>" % (symbol) addFunction(symbol, file, "") else: info = string.replace(info, "'", " ") info = string.strip(info) addFunction(symbol, file, info) addString(info, file, symbol, 5) l = splitIdentifier(symbol) for word in l: addWord(word, file, symbol, 10) return 1 def analyzeAPISymbols(top): count = 0 cur = top.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "macro": count = count + analyzeAPIMacro(cur) elif cur.name == "function": count = count + analyzeAPIFunction(cur) elif cur.name == "const": count = count + analyzeAPIConst(cur) elif cur.name == "typedef": count = count + analyzeAPIType(cur) elif cur.name == "struct": count = count + analyzeAPIStruct(cur) elif cur.name == "enum": count = count + analyzeAPIEnum(cur) elif cur.name == "functype": count = count + analyzeAPIFunctype(cur) else: print "unexpected element %s in API doc <files>" % (cur.name) cur = cur.next return count def analyzeAPI(doc): count = 0 if doc is None: return -1 root = doc.getRootElement() if root.name != "api": print "Unexpected root name" return -1 cur = root.children while cur is not None: if cur.type == 'text': cur = cur.next continue if cur.name == "files": pass # count = count + analyzeAPIFiles(cur) elif cur.name == "symbols": count = count + analyzeAPISymbols(cur) else: print "unexpected element %s in API doc" % (cur.name) cur = cur.next return count ######################################################################### # # # Web pages parsing and analysis # # # ######################################################################### import glob def analyzeHTMLText(doc, resource, p, section, id): words = 0 try: content = p.content words = words + addStringHTML(content, resource, id, section, 5) except: return -1 return words def analyzeHTMLPara(doc, resource, p, section, id): words = 0 try: content = p.content words = words + addStringHTML(content, resource, id, section, 5) except: return -1 return words def analyzeHTMLPre(doc, resource, p, section, id): words = 0 try: content = p.content words = words + addStringHTML(content, resource, id, section, 5) except: return -1 return words def analyzeHTML(doc, resource, p, section, id): words = 0 try: content = p.content words = words + addStringHTML(content, resource, id, section, 5) except: return -1 return words def analyzeHTML(doc, resource): para = 0 ctxt = doc.xpathNewContext() try: res = ctxt.xpathEval("//head/title") title = res[0].content except: title = "Page %s" % (resource) addPage(resource, title) try: items = ctxt.xpathEval("//h1 | //h2 | //h3 | //text()") section = title id = "" for item in items: if item.name == 'h1' or item.name == 'h2' or item.name == 'h3': section = item.content if item.prop("id"): id = item.prop("id") elif item.prop("name"): id = item.prop("name") elif item.type == 'text': analyzeHTMLText(doc, resource, item, section, id) para = para + 1 elif item.name == 'p': analyzeHTMLPara(doc, resource, item, section, id) para = para + 1 elif item.name == 'pre': analyzeHTMLPre(doc, resource, item, section, id) para = para + 1 else: print "Page %s, unexpected %s element" % (resource, item.name) except: print "Page %s: problem analyzing" % (resource) print sys.exc_type, sys.exc_value return para def analyzeHTMLPages(): ret = 0 HTMLfiles = glob.glob("*.html") + glob.glob("tutorial/*.html") + \ glob.glob("CIM/*.html") + glob.glob("ocaml/*.html") + \ glob.glob("ruby/*.html") for html in HTMLfiles: if html[0:3] == "API": continue if html == "xml.html": continue try: doc = libxml2.parseFile(html) except: doc = libxml2.htmlParseFile(html, None) try: res = analyzeHTML(doc, html) print "Parsed %s : %d paragraphs" % (html, res) ret = ret + 1 except: print "could not parse %s" % (html) return ret ######################################################################### # # # Mail archives parsing and analysis # # # ######################################################################### import time def getXMLDateArchive(t = None): if t is None: t = time.time() T = time.gmtime(t) month = time.strftime("%B", T) year = T[0] url = "http://www.redhat.com/archives/libvir-list/%d-%s/date.html" % (year, month) return url def scanXMLMsgArchive(url, title, force = 0): if url is None or title is None: return 0 ID = checkXMLMsgArchive(url) if force == 0 and ID != -1: return 0 if ID == -1: ID = addXMLMsgArchive(url, title) if ID == -1: return 0 try: print "Loading %s" % (url) doc = libxml2.htmlParseFile(url, None) except: doc = None if doc is None: print "Failed to parse %s" % (url) return 0 addStringArchive(title, ID, 20) ctxt = doc.xpathNewContext() texts = ctxt.xpathEval("//pre//text()") for text in texts: addStringArchive(text.content, ID, 5) return 1 def scanXMLDateArchive(t = None, force = 0): global wordsDictArchive wordsDictArchive = {} url = getXMLDateArchive(t) print "loading %s" % (url) try: doc = libxml2.htmlParseFile(url, None) except: doc = None if doc is None: print "Failed to parse %s" % (url) return -1 ctxt = doc.xpathNewContext() anchors = ctxt.xpathEval("//a[@href]") links = 0 newmsg = 0 for anchor in anchors: href = anchor.prop("href") if href is None or href[0:3] != "msg": continue try: links = links + 1 msg = libxml2.buildURI(href, url) title = anchor.content if title is not None and title[0:4] == 'Re: ': title = title[4:] if title is not None and title[0:6] == '[xml] ': title = title[6:] newmsg = newmsg + scanXMLMsgArchive(msg, title, force) except: pass return newmsg ######################################################################### # # # Main code: open the DB, the API XML and analyze it # # # ######################################################################### def analyzeArchives(t = None, force = 0): global wordsDictArchive ret = scanXMLDateArchive(t, force) print "Indexed %d words in %d archive pages" % (len(wordsDictArchive), ret) i = 0 skipped = 0 for word in wordsDictArchive.keys(): refs = wordsDictArchive[word] if refs is None: skipped = skipped + 1 continue for id in refs.keys(): relevance = refs[id] updateWordArchive(word, id, relevance) i = i + 1 print "Found %d associations in HTML pages" % (i) def analyzeHTMLTop(): global wordsDictHTML ret = analyzeHTMLPages() print "Indexed %d words in %d HTML pages" % (len(wordsDictHTML), ret) i = 0 skipped = 0 for word in wordsDictHTML.keys(): refs = wordsDictHTML[word] if refs is None: skipped = skipped + 1 continue for resource in refs.keys(): (relevance, id, section) = refs[resource] updateWordHTML(word, resource, section, id, relevance) i = i + 1 print "Found %d associations in HTML pages" % (i) def analyzeAPITop(): global wordsDict global API try: doc = loadAPI(API) ret = analyzeAPI(doc) print "Analyzed %d blocs" % (ret) doc.freeDoc() except: print "Failed to parse and analyze %s" % (API) print sys.exc_type, sys.exc_value sys.exit(1) print "Indexed %d words" % (len(wordsDict)) i = 0 skipped = 0 for word in wordsDict.keys(): refs = wordsDict[word] if refs is None: skipped = skipped + 1 continue for (module, symbol) in refs.keys(): updateWord(word, symbol, refs[(module, symbol)]) i = i + 1 print "Found %d associations, skipped %d words" % (i, skipped) def usage(): print "Usage index.py [--force] [--archive] [--archive-year year] [--archive-month month] [--API] [--docs]" sys.exit(1) def main(): try: openMySQL() except: print "Failed to open the database" print sys.exc_type, sys.exc_value sys.exit(1) args = sys.argv[1:] force = 0 if args: i = 0 while i < len(args): if args[i] == '--force': force = 1 elif args[i] == '--archive': analyzeArchives(None, force) elif args[i] == '--archive-year': i = i + 1 year = args[i] months = ["January" , "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] for month in months: try: str = "%s-%s" % (year, month) T = time.strptime(str, "%Y-%B") t = time.mktime(T) + 3600 * 24 * 10 analyzeArchives(t, force) except: print "Failed to index month archive:" print sys.exc_type, sys.exc_value elif args[i] == '--archive-month': i = i + 1 month = args[i] try: T = time.strptime(month, "%Y-%B") t = time.mktime(T) + 3600 * 24 * 10 analyzeArchives(t, force) except: print "Failed to index month archive:" print sys.exc_type, sys.exc_value elif args[i] == '--API': analyzeAPITop() elif args[i] == '--docs': analyzeHTMLTop() else: usage() i = i + 1 else: usage() if __name__ == "__main__": main()
lgpl-2.1
[ 3381, 2647, 15, 1393, 15, 1548, 446, 85, 199, 3, 199, 3, 8925, 314, 3261, 1369, 436, 1794, 478, 1536, 282, 3050, 543, 199, 3, 536, 295, 28791, 370, 4621, 12, 3423, 503, 3330, 6497, 199, 3, 199, 3, 17954, 4346, 26, 199, 3, 16248, 199, 3, 199, 3, 3907, 333, 588, 81, 1447, 12, 314, 2366, 17995, 367, 12896, 436, 15404, 18, 12, 1343, 333, 588, 81, 1447, 199, 3, 221, 446, 12896, 13, 1000, 199, 3, 221, 446, 12896, 199, 3, 221, 446, 3945, 80, 13, 8644, 199, 3, 221, 446, 11200, 13, 1548, 199, 3, 7743, 314, 1738, 15081, 402, 12896, 26, 199, 3, 259, 12896, 2113, 446, 85, 1738, 2505, 892, 63, 2060, 199, 3, 2790, 314, 892, 3050, 1973, 1042, 199, 3, 259, 12896, 2113, 446, 80, 1218, 1973, 1042, 199, 3, 2790, 282, 3050, 922, 283, 432, 778, 1005, 7, 436, 8120, 26457, 2505, 2879, 199, 3, 1570, 11199, 778, 1005, 436, 13022, 271, 543, 314, 2451, 922, 536, 436, 15081, 199, 3, 259, 12896, 446, 80, 199, 3, 259, 2505, 26, 199, 3, 259, 12896, 30, 21772, 1441, 11727, 28644, 8453, 39, 654, 5258, 1973, 1042, 2296, 11199, 778, 1005, 32, 5967, 199, 3, 3698, 26179, 31223, 6515, 283, 28109, 7, 1663, 21772, 1441, 11662, 1075, 27, 199, 3, 259, 12896, 30, 21772, 1441, 11727, 28644, 8453, 39, 654, 5258, 1973, 1042, 2795, 2296, 11199, 778, 1005, 32, 5967, 199, 3, 3698, 26179, 31223, 6515, 283, 28109, 7, 1663, 21772, 1441, 11662, 1075, 27, 199, 3, 199, 3, 3709, 314, 922, 1104, 314, 2879, 26, 199, 3, 259, 12896, 446, 80, 1973, 1042, 199, 3, 259, 16401, 2505, 26, 199, 3, 259, 644, 14628, 370, 314, 11200, 8372, 4496, 199, 3, 259, 12896, 30, 675, 1973, 1042, 199, 3, 259, 8692, 2896, 199, 3, 259, 12896, 30, 17242, 199, 3, 259, 4885, 69, 199, 3, 199, 3, 9442, 1255, 314, 2884, 315, 314, 1382, 15488, 12, 652, 911, 1218, 314, 6698, 436, 199, 3, 4349, 6716, 436, 13904, 3062, 543, 2556, 12509, 687, 199, 3, 314, 13108, 13, 1246, 14, 1652, 3261, 1369, 12, 436, 1852, 2066, 17909, 1586, 13, 2118, 199, 3, 701, 949, 2030, 32, 320, 5853, 1102, 314, 922, 1420, 370, 506, 3668, 1159, 1373, 199, 3, 199, 3, 4068, 314, 3668, 2897, 12, 1852, 3238, 1265, 1172, 3945, 80, 2291, 5223, 199, 3, 199, 199, 646, 25709, 199, 646, 15404, 18, 199, 646, 984, 199, 646, 1059, 199, 646, 747, 199, 199, 3, 199, 3, 2136, 787, 440, 22201, 315, 6057, 2552, 2348, 199, 3, 199, 318, 3233, 8, 3799, 12, 620, 304, 272, 372, 199, 773, 1652, 18, 14, 2683, 25933, 8, 3058, 12, 488, 9, 199, 199, 3, 199, 3, 710, 2600, 402, 6716, 1415, 436, 314, 5385, 1414, 4346, 199, 3, 370, 1218, 3062, 199, 3, 199, 10129, 11344, 3126, 523, 298, 7450, 2, 520, 408, 8366, 9934, 6698, 334, 1779, 536, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 859, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 730, 31044, 8, 821, 9, 2845, 5962, 12, 1779, 16193, 31044, 8, 2299, 395, 1779, 6778, 41, 10526, 9301, 536, 334, 354, 395, 1779, 9301, 859, 334, 578, 430, 7208, 523, 298, 3148, 2, 520, 408, 8366, 9934, 5932, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 5272, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 9301, 5272, 334, 5155, 395, 1779, 6778, 41, 10526, 9301, 2870, 334, 354, 12, 5272, 430, 7208, 523, 298, 3148, 4943, 2, 520, 408, 8366, 9934, 5932, 4943, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 3420, 31044, 8, 2299, 395, 1779, 1305, 31044, 8, 1400, 395, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 9301, 2073, 334, 1927, 395, 1779, 6778, 41, 10526, 9301, 2984, 334, 354, 12, 2073, 430, 7208, 523, 298, 3148, 13042, 2, 520, 408, 8366, 9934, 5932, 13042, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 6778, 41, 10526, 9301, 2984, 334, 354, 12, 2870, 430, 7208, 523, 298, 5856, 2, 520, 408, 8366, 9934, 6497, 334, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 2538, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 536, 334, 1927, 430, 7208, 523, 298, 28067, 2, 520, 408, 8366, 9934, 25993, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 2538, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1927, 8, 2299, 1826, 1779, 17055, 334, 998, 395, 1779, 17055, 334, 1927, 430, 7208, 523, 298, 13611, 2, 520, 408, 8366, 9934, 5843, 5460, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 1594, 31044, 8, 1400, 9, 2845, 5962, 12, 1779, 14826, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1110, 8, 1276, 1826, 1779, 17055, 334, 998, 430, 7208, 523, 298, 2422, 13611, 2, 520, 408, 8366, 9934, 2900, 13611, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 1594, 31044, 8, 1400, 9, 2845, 5962, 12, 1779, 14826, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1110, 8, 1276, 1826, 1779, 17055, 334, 998, 430, 7208, 199, 93, 199, 199, 3, 199, 3, 710, 4692, 3261, 1369, 570, 370, 2198, 199, 3, 199, 3735, 628, 11877, 13, 1246, 14, 1652, 2, 199, 2846, 29, 403, 199, 199, 3949, 3, 199, 3, 6208, 755, 327, 199, 3, 8295, 11200, 3050, 8386, 14960, 327, 199, 3, 6208, 755, 327, 199, 3949, 3, 199, 318, 1218, 3186, 8, 697, 12, 536, 304, 272, 2288, 377, 17041, 339, 340, 1592, 365, 488, 26, 267, 372, 446 ]
[ 2647, 15, 1393, 15, 1548, 446, 85, 199, 3, 199, 3, 8925, 314, 3261, 1369, 436, 1794, 478, 1536, 282, 3050, 543, 199, 3, 536, 295, 28791, 370, 4621, 12, 3423, 503, 3330, 6497, 199, 3, 199, 3, 17954, 4346, 26, 199, 3, 16248, 199, 3, 199, 3, 3907, 333, 588, 81, 1447, 12, 314, 2366, 17995, 367, 12896, 436, 15404, 18, 12, 1343, 333, 588, 81, 1447, 199, 3, 221, 446, 12896, 13, 1000, 199, 3, 221, 446, 12896, 199, 3, 221, 446, 3945, 80, 13, 8644, 199, 3, 221, 446, 11200, 13, 1548, 199, 3, 7743, 314, 1738, 15081, 402, 12896, 26, 199, 3, 259, 12896, 2113, 446, 85, 1738, 2505, 892, 63, 2060, 199, 3, 2790, 314, 892, 3050, 1973, 1042, 199, 3, 259, 12896, 2113, 446, 80, 1218, 1973, 1042, 199, 3, 2790, 282, 3050, 922, 283, 432, 778, 1005, 7, 436, 8120, 26457, 2505, 2879, 199, 3, 1570, 11199, 778, 1005, 436, 13022, 271, 543, 314, 2451, 922, 536, 436, 15081, 199, 3, 259, 12896, 446, 80, 199, 3, 259, 2505, 26, 199, 3, 259, 12896, 30, 21772, 1441, 11727, 28644, 8453, 39, 654, 5258, 1973, 1042, 2296, 11199, 778, 1005, 32, 5967, 199, 3, 3698, 26179, 31223, 6515, 283, 28109, 7, 1663, 21772, 1441, 11662, 1075, 27, 199, 3, 259, 12896, 30, 21772, 1441, 11727, 28644, 8453, 39, 654, 5258, 1973, 1042, 2795, 2296, 11199, 778, 1005, 32, 5967, 199, 3, 3698, 26179, 31223, 6515, 283, 28109, 7, 1663, 21772, 1441, 11662, 1075, 27, 199, 3, 199, 3, 3709, 314, 922, 1104, 314, 2879, 26, 199, 3, 259, 12896, 446, 80, 1973, 1042, 199, 3, 259, 16401, 2505, 26, 199, 3, 259, 644, 14628, 370, 314, 11200, 8372, 4496, 199, 3, 259, 12896, 30, 675, 1973, 1042, 199, 3, 259, 8692, 2896, 199, 3, 259, 12896, 30, 17242, 199, 3, 259, 4885, 69, 199, 3, 199, 3, 9442, 1255, 314, 2884, 315, 314, 1382, 15488, 12, 652, 911, 1218, 314, 6698, 436, 199, 3, 4349, 6716, 436, 13904, 3062, 543, 2556, 12509, 687, 199, 3, 314, 13108, 13, 1246, 14, 1652, 3261, 1369, 12, 436, 1852, 2066, 17909, 1586, 13, 2118, 199, 3, 701, 949, 2030, 32, 320, 5853, 1102, 314, 922, 1420, 370, 506, 3668, 1159, 1373, 199, 3, 199, 3, 4068, 314, 3668, 2897, 12, 1852, 3238, 1265, 1172, 3945, 80, 2291, 5223, 199, 3, 199, 199, 646, 25709, 199, 646, 15404, 18, 199, 646, 984, 199, 646, 1059, 199, 646, 747, 199, 199, 3, 199, 3, 2136, 787, 440, 22201, 315, 6057, 2552, 2348, 199, 3, 199, 318, 3233, 8, 3799, 12, 620, 304, 272, 372, 199, 773, 1652, 18, 14, 2683, 25933, 8, 3058, 12, 488, 9, 199, 199, 3, 199, 3, 710, 2600, 402, 6716, 1415, 436, 314, 5385, 1414, 4346, 199, 3, 370, 1218, 3062, 199, 3, 199, 10129, 11344, 3126, 523, 298, 7450, 2, 520, 408, 8366, 9934, 6698, 334, 1779, 536, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 859, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 730, 31044, 8, 821, 9, 2845, 5962, 12, 1779, 16193, 31044, 8, 2299, 395, 1779, 6778, 41, 10526, 9301, 536, 334, 354, 395, 1779, 9301, 859, 334, 578, 430, 7208, 523, 298, 3148, 2, 520, 408, 8366, 9934, 5932, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 5272, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 9301, 5272, 334, 5155, 395, 1779, 6778, 41, 10526, 9301, 2870, 334, 354, 12, 5272, 430, 7208, 523, 298, 3148, 4943, 2, 520, 408, 8366, 9934, 5932, 4943, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 3420, 31044, 8, 2299, 395, 1779, 1305, 31044, 8, 1400, 395, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 9301, 2073, 334, 1927, 395, 1779, 6778, 41, 10526, 9301, 2984, 334, 354, 12, 2073, 430, 7208, 523, 298, 3148, 13042, 2, 520, 408, 8366, 9934, 5932, 13042, 334, 1779, 536, 31044, 8, 1400, 9, 32698, 2845, 5962, 12, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 295, 28791, 1109, 12, 1779, 9301, 536, 334, 354, 395, 1779, 6778, 41, 10526, 9301, 2984, 334, 354, 12, 2870, 430, 7208, 523, 298, 5856, 2, 520, 408, 8366, 9934, 6497, 334, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 2538, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 536, 334, 1927, 430, 7208, 523, 298, 28067, 2, 520, 408, 8366, 9934, 25993, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 2073, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 2538, 31044, 8, 2299, 9, 32698, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1927, 8, 2299, 1826, 1779, 17055, 334, 998, 395, 1779, 17055, 334, 1927, 430, 7208, 523, 298, 13611, 2, 520, 408, 8366, 9934, 5843, 5460, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 1594, 31044, 8, 1400, 9, 2845, 5962, 12, 1779, 14826, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1110, 8, 1276, 1826, 1779, 17055, 334, 998, 430, 7208, 523, 298, 2422, 13611, 2, 520, 408, 8366, 9934, 2900, 13611, 334, 1779, 2870, 1109, 8, 845, 9, 2845, 5962, 2599, 63, 9728, 12, 1779, 1594, 31044, 8, 1400, 9, 2845, 5962, 12, 1779, 14826, 1109, 8, 845, 9, 2845, 5962, 12, 1779, 6778, 41, 10526, 9301, 1305, 334, 998, 12, 1110, 8, 1276, 1826, 1779, 17055, 334, 998, 430, 7208, 199, 93, 199, 199, 3, 199, 3, 710, 4692, 3261, 1369, 570, 370, 2198, 199, 3, 199, 3735, 628, 11877, 13, 1246, 14, 1652, 2, 199, 2846, 29, 403, 199, 199, 3949, 3, 199, 3, 6208, 755, 327, 199, 3, 8295, 11200, 3050, 8386, 14960, 327, 199, 3, 6208, 755, 327, 199, 3949, 3, 199, 318, 1218, 3186, 8, 697, 12, 536, 304, 272, 2288, 377, 17041, 339, 340, 1592, 365, 488, 26, 267, 372, 446, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
codepantry/django
django/contrib/syndication/views.py
192
8680
from __future__ import unicode_literals from calendar import timegm from django.conf import settings from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.http import Http404, HttpResponse from django.template import TemplateDoesNotExist, loader from django.utils import feedgenerator, six from django.utils.encoding import force_text, iri_to_uri, smart_text from django.utils.html import escape from django.utils.http import http_date from django.utils.timezone import get_default_timezone, is_naive, make_aware def add_domain(domain, url, secure=False): protocol = 'https' if secure else 'http' if url.startswith('//'): # Support network-path reference (see #16753) - RSS requires a protocol url = '%s:%s' % (protocol, url) elif not url.startswith(('http://', 'https://', 'mailto:')): url = iri_to_uri('%s://%s%s' % (protocol, domain, url)) return url class FeedDoesNotExist(ObjectDoesNotExist): pass class Feed(object): feed_type = feedgenerator.DefaultFeed title_template = None description_template = None def __call__(self, request, *args, **kwargs): try: obj = self.get_object(request, *args, **kwargs) except ObjectDoesNotExist: raise Http404('Feed object does not exist.') feedgen = self.get_feed(obj, request) response = HttpResponse(content_type=feedgen.content_type) if hasattr(self, 'item_pubdate') or hasattr(self, 'item_updateddate'): # if item_pubdate or item_updateddate is defined for the feed, set # header so as ConditionalGetMiddleware is able to send 304 NOT MODIFIED response['Last-Modified'] = http_date( timegm(feedgen.latest_post_date().utctimetuple())) feedgen.write(response, 'utf-8') return response def item_title(self, item): # Titles should be double escaped by default (see #6533) return escape(force_text(item)) def item_description(self, item): return force_text(item) def item_link(self, item): try: return item.get_absolute_url() except AttributeError: raise ImproperlyConfigured( 'Give your %s class a get_absolute_url() method, or define an ' 'item_link() method in your Feed class.' % item.__class__.__name__ ) def __get_dynamic_attr(self, attname, obj, default=None): try: attr = getattr(self, attname) except AttributeError: return default if callable(attr): # Check co_argcount rather than try/excepting the function and # catching the TypeError, because something inside the function # may raise the TypeError. This technique is more accurate. try: code = six.get_function_code(attr) except AttributeError: code = six.get_function_code(attr.__call__) if code.co_argcount == 2: # one argument is 'self' return attr(obj) else: return attr() return attr def feed_extra_kwargs(self, obj): """ Returns an extra keyword arguments dictionary that is used when initializing the feed generator. """ return {} def item_extra_kwargs(self, item): """ Returns an extra keyword arguments dictionary that is used with the `add_item` call of the feed generator. """ return {} def get_object(self, request, *args, **kwargs): return None def get_context_data(self, **kwargs): """ Returns a dictionary to use as extra context if either ``self.description_template`` or ``self.item_template`` are used. Default implementation preserves the old behavior of using {'obj': item, 'site': current_site} as the context. """ return {'obj': kwargs.get('item'), 'site': kwargs.get('site')} def get_feed(self, obj, request): """ Returns a feedgenerator.DefaultFeed object, fully populated, for this feed. Raises FeedDoesNotExist for invalid parameters. """ current_site = get_current_site(request) link = self.__get_dynamic_attr('link', obj) link = add_domain(current_site.domain, link, request.is_secure()) feed = self.feed_type( title=self.__get_dynamic_attr('title', obj), subtitle=self.__get_dynamic_attr('subtitle', obj), link=link, description=self.__get_dynamic_attr('description', obj), language=settings.LANGUAGE_CODE, feed_url=add_domain( current_site.domain, self.__get_dynamic_attr('feed_url', obj) or request.path, request.is_secure(), ), author_name=self.__get_dynamic_attr('author_name', obj), author_link=self.__get_dynamic_attr('author_link', obj), author_email=self.__get_dynamic_attr('author_email', obj), categories=self.__get_dynamic_attr('categories', obj), feed_copyright=self.__get_dynamic_attr('feed_copyright', obj), feed_guid=self.__get_dynamic_attr('feed_guid', obj), ttl=self.__get_dynamic_attr('ttl', obj), **self.feed_extra_kwargs(obj) ) title_tmp = None if self.title_template is not None: try: title_tmp = loader.get_template(self.title_template) except TemplateDoesNotExist: pass description_tmp = None if self.description_template is not None: try: description_tmp = loader.get_template(self.description_template) except TemplateDoesNotExist: pass for item in self.__get_dynamic_attr('items', obj): context = self.get_context_data(item=item, site=current_site, obj=obj, request=request) if title_tmp is not None: title = title_tmp.render(context, request) else: title = self.__get_dynamic_attr('item_title', item) if description_tmp is not None: description = description_tmp.render(context, request) else: description = self.__get_dynamic_attr('item_description', item) link = add_domain( current_site.domain, self.__get_dynamic_attr('item_link', item), request.is_secure(), ) enc = None enc_url = self.__get_dynamic_attr('item_enclosure_url', item) if enc_url: enc = feedgenerator.Enclosure( url=smart_text(enc_url), length=smart_text(self.__get_dynamic_attr('item_enclosure_length', item)), mime_type=smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item)) ) author_name = self.__get_dynamic_attr('item_author_name', item) if author_name is not None: author_email = self.__get_dynamic_attr('item_author_email', item) author_link = self.__get_dynamic_attr('item_author_link', item) else: author_email = author_link = None tz = get_default_timezone() pubdate = self.__get_dynamic_attr('item_pubdate', item) if pubdate and is_naive(pubdate): pubdate = make_aware(pubdate, tz) updateddate = self.__get_dynamic_attr('item_updateddate', item) if updateddate and is_naive(updateddate): updateddate = make_aware(updateddate, tz) feed.add_item( title=title, link=link, description=description, unique_id=self.__get_dynamic_attr('item_guid', item, link), unique_id_is_permalink=self.__get_dynamic_attr( 'item_guid_is_permalink', item), enclosure=enc, pubdate=pubdate, updateddate=updateddate, author_name=author_name, author_email=author_email, author_link=author_link, categories=self.__get_dynamic_attr('item_categories', item), item_copyright=self.__get_dynamic_attr('item_copyright', item), **self.item_extra_kwargs(item) ) return feed
bsd-3-clause
[ 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 11234, 492, 900, 13844, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 8619, 14, 17469, 492, 664, 63, 1818, 63, 2124, 199, 504, 1639, 14, 1018, 14, 3924, 492, 11897, 12, 24803, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 12, 6183, 199, 504, 1639, 14, 1160, 492, 27193, 12, 5077, 199, 504, 1639, 14, 1208, 492, 4733, 4679, 12, 3816, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 505, 12, 24086, 63, 475, 63, 2302, 12, 11179, 63, 505, 199, 504, 1639, 14, 1208, 14, 1360, 492, 4772, 199, 504, 1639, 14, 1208, 14, 1014, 492, 1455, 63, 602, 199, 504, 1639, 14, 1208, 14, 7145, 492, 664, 63, 885, 63, 7145, 12, 365, 63, 21578, 12, 1852, 63, 14600, 421, 199, 318, 1050, 63, 2261, 8, 2261, 12, 1166, 12, 11153, 29, 797, 304, 272, 4113, 275, 283, 2859, 7, 340, 11153, 587, 283, 1014, 7, 272, 340, 1166, 14, 2460, 15079, 735, 267, 327, 12502, 2784, 13, 515, 3659, 334, 3239, 327, 975, 22566, 9, 446, 30331, 5074, 282, 4113, 267, 1166, 275, 1543, 83, 2689, 83, 7, 450, 334, 3922, 12, 1166, 9, 272, 916, 440, 1166, 14, 2460, 4725, 1014, 921, 297, 283, 2859, 921, 297, 283, 26206, 26, 8109, 267, 1166, 275, 24086, 63, 475, 63, 2302, 3508, 83, 13827, 83, 5, 83, 7, 450, 334, 3922, 12, 2881, 12, 1166, 430, 272, 372, 1166, 421, 199, 533, 16261, 7400, 8, 1692, 7400, 304, 272, 986, 421, 199, 533, 16261, 8, 785, 304, 272, 4733, 63, 466, 275, 4733, 4679, 14, 2698, 7658, 272, 2538, 63, 1160, 275, 488, 272, 1369, 63, 1160, 275, 488, 339, 347, 636, 1250, 721, 277, 12, 1056, 12, 627, 589, 12, 1011, 958, 304, 267, 862, 26, 288, 1559, 275, 291, 14, 362, 63, 785, 8, 1069, 12, 627, 589, 12, 1011, 958, 9, 267, 871, 24803, 26, 288, 746, 4760, 5188, 360, 7658, 909, 1630, 440, 2187, 2659, 267, 4733, 2268, 275, 291, 14, 362, 63, 3871, 8, 1113, 12, 1056, 9, 267, 1177, 275, 6183, 8, 1317, 63, 466, 29, 3871, 2268, 14, 1317, 63, 466, 9, 267, 340, 2688, 8, 277, 12, 283, 1053, 63, 30218, 358, 503, 2688, 8, 277, 12, 283, 1053, 63, 5334, 602, 735, 288, 327, 340, 1242, 63, 30218, 503, 1242, 63, 5334, 602, 365, 3247, 367, 314, 4733, 12, 663, 288, 327, 1406, 880, 465, 24191, 1002, 6608, 365, 7688, 370, 3222, 20398, 2845, 10362, 1914, 19679, 288, 1177, 459, 6090, 13, 11911, 418, 275, 1455, 63, 602, 8, 355, 900, 13844, 8, 3871, 2268, 14, 7410, 63, 1932, 63, 602, 1252, 5834, 22309, 4059, 267, 4733, 2268, 14, 952, 8, 1310, 12, 283, 1624, 13, 24, 358, 267, 372, 1177, 339, 347, 1242, 63, 1213, 8, 277, 12, 1242, 304, 267, 327, 377, 390, 2978, 1077, 506, 4270, 11077, 701, 849, 334, 3239, 327, 2182, 1153, 9, 267, 372, 4772, 8, 3990, 63, 505, 8, 1053, 430, 339, 347, 1242, 63, 1802, 8, 277, 12, 1242, 304, 267, 372, 3542, 63, 505, 8, 1053, 9, 339, 347, 1242, 63, 1073, 8, 277, 12, 1242, 304, 267, 862, 26, 288, 372, 1242, 14, 362, 63, 6116, 63, 633, 342, 267, 871, 4281, 26, 288, 746, 11897, 8, 355, 283, 39, 1912, 2195, 450, 83, 1021, 282, 664, 63, 6116, 63, 633, 342, 1083, 12, 503, 5627, 376, 283, 355, 283, 1053, 63, 1073, 342, 1083, 315, 2195, 16261, 1021, 3530, 450, 1242, 855, 533, 4914, 354, 363, 288, 776, 339, 347, 636, 362, 63, 7764, 63, 962, 8, 277, 12, 15115, 354, 12, 1559, 12, 849, 29, 403, 304, 267, 862, 26, 288, 1921, 275, 2519, 8, 277, 12, 15115, 354, 9, 267, 871, 4281, 26, 288, 372, 849, 267, 340, 4550, 8, 962, 304, 288, 327, 2670, 512, 63, 30513, 7830, 2419, 862, 15, 2590, 316, 314, 805, 436, 288, 327, 8579, 316, 314, 3146, 12, 2952, 6020, 6272, 314, 805, 288, 327, 1443, 746, 314, 3146, 14, 961, 32414, 365, 1655, 23189, 14, 288, 862, 26, 355, 1233, 275, 3816, 14, 362, 63, 1593, 63, 600, 8, 962, 9, 288, 871, 4281, 26, 355, 1233, 275, 3816, 14, 362, 63, 1593, 63, 600, 8, 962, 855, 1250, 3368, 288, 340, 1233, 14, 331, 63, 30513, 508, 499, 26, 755, 327, 1373, 1423, 365, 283, 277, 7, 355, 372, 1921, 8, 1113, 9, 288, 587, 26, 355, 372, 1921, 342, 267, 372, 1921, 339, 347, 4733, 63, 2911, 63, 958, 8, 277, 12, 1559, 304, 267, 408, 267, 1803, 376, 2402, 4252, 2368, 2600, 626, 365, 1202, 1380, 267, 29141, 314, 4733, 4306, 14, 267, 408, 267, 372, 1052, 339, 347, 1242, 63, 2911, 63, 958, 8, 277, 12, 1242, 304, 267, 408, 267, 1803, 376, 2402, 4252, 2368, 2600, 626, 365, 1202, 543, 267, 314, 658, 525, 63, 1053, 64, 1240, 402, 314, 4733, 4306, 14, 267, 408, 267, 372, 1052, 339, 347, 664, 63, 785, 8, 277, 12, 1056, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 488, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 408, 267, 1803, 282, 2600, 370, 675, 465, 2402, 1067, 340, 1902, 267, 1124, 277, 14, 1802, 63, 1160, 1040, 503, 1124, 277, 14, 1053, 63, 1160, 1040, 787, 1202, 14, 398, 3758, 4514, 876, 20603, 314, 2269, 5953, 267, 402, 1808, 791, 1113, 356, 1242, 12, 283, 2124, 356, 1453, 63, 2124, 93, 465, 314, 1067, 14, 267, 408, 267, 372, 791, 1113, 356, 2074, 14, 362, 360, 1053, 659, 283, 2124, 356, 2074, 14, 362, 360, 2124, 21004, 339, 347, 664, 63, 3871, 8, 277, 12, 1559, 12, 1056, 304, 267, 408, 267, 1803, 282, 4733, 4679, 14, 2698, 7658, 909, 12, 9999, 16460, 12, 367, 267, 642, 4733, 14, 6218, 16261, 7400, 367, 3866, 2633, 14, 267, 408, 267, 1453, 63, 2124, 275, 664, 63, 1818, 63, 2124, 8, 1069, 9, 398, 2142, 275, 291, 855, 362, 63, 7764, 63, 962, 360, 1073, 297, 1559, 9, 267, 2142, 275, 1050, 63, 2261, 8, 1818, 63 ]
[ 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 11234, 492, 900, 13844, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 8619, 14, 17469, 492, 664, 63, 1818, 63, 2124, 199, 504, 1639, 14, 1018, 14, 3924, 492, 11897, 12, 24803, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 12, 6183, 199, 504, 1639, 14, 1160, 492, 27193, 12, 5077, 199, 504, 1639, 14, 1208, 492, 4733, 4679, 12, 3816, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 505, 12, 24086, 63, 475, 63, 2302, 12, 11179, 63, 505, 199, 504, 1639, 14, 1208, 14, 1360, 492, 4772, 199, 504, 1639, 14, 1208, 14, 1014, 492, 1455, 63, 602, 199, 504, 1639, 14, 1208, 14, 7145, 492, 664, 63, 885, 63, 7145, 12, 365, 63, 21578, 12, 1852, 63, 14600, 421, 199, 318, 1050, 63, 2261, 8, 2261, 12, 1166, 12, 11153, 29, 797, 304, 272, 4113, 275, 283, 2859, 7, 340, 11153, 587, 283, 1014, 7, 272, 340, 1166, 14, 2460, 15079, 735, 267, 327, 12502, 2784, 13, 515, 3659, 334, 3239, 327, 975, 22566, 9, 446, 30331, 5074, 282, 4113, 267, 1166, 275, 1543, 83, 2689, 83, 7, 450, 334, 3922, 12, 1166, 9, 272, 916, 440, 1166, 14, 2460, 4725, 1014, 921, 297, 283, 2859, 921, 297, 283, 26206, 26, 8109, 267, 1166, 275, 24086, 63, 475, 63, 2302, 3508, 83, 13827, 83, 5, 83, 7, 450, 334, 3922, 12, 2881, 12, 1166, 430, 272, 372, 1166, 421, 199, 533, 16261, 7400, 8, 1692, 7400, 304, 272, 986, 421, 199, 533, 16261, 8, 785, 304, 272, 4733, 63, 466, 275, 4733, 4679, 14, 2698, 7658, 272, 2538, 63, 1160, 275, 488, 272, 1369, 63, 1160, 275, 488, 339, 347, 636, 1250, 721, 277, 12, 1056, 12, 627, 589, 12, 1011, 958, 304, 267, 862, 26, 288, 1559, 275, 291, 14, 362, 63, 785, 8, 1069, 12, 627, 589, 12, 1011, 958, 9, 267, 871, 24803, 26, 288, 746, 4760, 5188, 360, 7658, 909, 1630, 440, 2187, 2659, 267, 4733, 2268, 275, 291, 14, 362, 63, 3871, 8, 1113, 12, 1056, 9, 267, 1177, 275, 6183, 8, 1317, 63, 466, 29, 3871, 2268, 14, 1317, 63, 466, 9, 267, 340, 2688, 8, 277, 12, 283, 1053, 63, 30218, 358, 503, 2688, 8, 277, 12, 283, 1053, 63, 5334, 602, 735, 288, 327, 340, 1242, 63, 30218, 503, 1242, 63, 5334, 602, 365, 3247, 367, 314, 4733, 12, 663, 288, 327, 1406, 880, 465, 24191, 1002, 6608, 365, 7688, 370, 3222, 20398, 2845, 10362, 1914, 19679, 288, 1177, 459, 6090, 13, 11911, 418, 275, 1455, 63, 602, 8, 355, 900, 13844, 8, 3871, 2268, 14, 7410, 63, 1932, 63, 602, 1252, 5834, 22309, 4059, 267, 4733, 2268, 14, 952, 8, 1310, 12, 283, 1624, 13, 24, 358, 267, 372, 1177, 339, 347, 1242, 63, 1213, 8, 277, 12, 1242, 304, 267, 327, 377, 390, 2978, 1077, 506, 4270, 11077, 701, 849, 334, 3239, 327, 2182, 1153, 9, 267, 372, 4772, 8, 3990, 63, 505, 8, 1053, 430, 339, 347, 1242, 63, 1802, 8, 277, 12, 1242, 304, 267, 372, 3542, 63, 505, 8, 1053, 9, 339, 347, 1242, 63, 1073, 8, 277, 12, 1242, 304, 267, 862, 26, 288, 372, 1242, 14, 362, 63, 6116, 63, 633, 342, 267, 871, 4281, 26, 288, 746, 11897, 8, 355, 283, 39, 1912, 2195, 450, 83, 1021, 282, 664, 63, 6116, 63, 633, 342, 1083, 12, 503, 5627, 376, 283, 355, 283, 1053, 63, 1073, 342, 1083, 315, 2195, 16261, 1021, 3530, 450, 1242, 855, 533, 4914, 354, 363, 288, 776, 339, 347, 636, 362, 63, 7764, 63, 962, 8, 277, 12, 15115, 354, 12, 1559, 12, 849, 29, 403, 304, 267, 862, 26, 288, 1921, 275, 2519, 8, 277, 12, 15115, 354, 9, 267, 871, 4281, 26, 288, 372, 849, 267, 340, 4550, 8, 962, 304, 288, 327, 2670, 512, 63, 30513, 7830, 2419, 862, 15, 2590, 316, 314, 805, 436, 288, 327, 8579, 316, 314, 3146, 12, 2952, 6020, 6272, 314, 805, 288, 327, 1443, 746, 314, 3146, 14, 961, 32414, 365, 1655, 23189, 14, 288, 862, 26, 355, 1233, 275, 3816, 14, 362, 63, 1593, 63, 600, 8, 962, 9, 288, 871, 4281, 26, 355, 1233, 275, 3816, 14, 362, 63, 1593, 63, 600, 8, 962, 855, 1250, 3368, 288, 340, 1233, 14, 331, 63, 30513, 508, 499, 26, 755, 327, 1373, 1423, 365, 283, 277, 7, 355, 372, 1921, 8, 1113, 9, 288, 587, 26, 355, 372, 1921, 342, 267, 372, 1921, 339, 347, 4733, 63, 2911, 63, 958, 8, 277, 12, 1559, 304, 267, 408, 267, 1803, 376, 2402, 4252, 2368, 2600, 626, 365, 1202, 1380, 267, 29141, 314, 4733, 4306, 14, 267, 408, 267, 372, 1052, 339, 347, 1242, 63, 2911, 63, 958, 8, 277, 12, 1242, 304, 267, 408, 267, 1803, 376, 2402, 4252, 2368, 2600, 626, 365, 1202, 543, 267, 314, 658, 525, 63, 1053, 64, 1240, 402, 314, 4733, 4306, 14, 267, 408, 267, 372, 1052, 339, 347, 664, 63, 785, 8, 277, 12, 1056, 12, 627, 589, 12, 1011, 958, 304, 267, 372, 488, 339, 347, 664, 63, 1100, 63, 576, 8, 277, 12, 1011, 958, 304, 267, 408, 267, 1803, 282, 2600, 370, 675, 465, 2402, 1067, 340, 1902, 267, 1124, 277, 14, 1802, 63, 1160, 1040, 503, 1124, 277, 14, 1053, 63, 1160, 1040, 787, 1202, 14, 398, 3758, 4514, 876, 20603, 314, 2269, 5953, 267, 402, 1808, 791, 1113, 356, 1242, 12, 283, 2124, 356, 1453, 63, 2124, 93, 465, 314, 1067, 14, 267, 408, 267, 372, 791, 1113, 356, 2074, 14, 362, 360, 1053, 659, 283, 2124, 356, 2074, 14, 362, 360, 2124, 21004, 339, 347, 664, 63, 3871, 8, 277, 12, 1559, 12, 1056, 304, 267, 408, 267, 1803, 282, 4733, 4679, 14, 2698, 7658, 909, 12, 9999, 16460, 12, 367, 267, 642, 4733, 14, 6218, 16261, 7400, 367, 3866, 2633, 14, 267, 408, 267, 1453, 63, 2124, 275, 664, 63, 1818, 63, 2124, 8, 1069, 9, 398, 2142, 275, 291, 855, 362, 63, 7764, 63, 962, 360, 1073, 297, 1559, 9, 267, 2142, 275, 1050, 63, 2261, 8, 1818, 63, 0 ]
[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 ]
bright-sparks/chromium-spacewalk
chrome/browser/web_dev_style/js_checker.py
44
9115
# Copyright (c) 2012 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. """Presubmit script for Chromium JS resources. See chrome/browser/PRESUBMIT.py """ import regex_check class JSChecker(object): def __init__(self, input_api, output_api, file_filter=None): self.input_api = input_api self.output_api = output_api self.file_filter = file_filter def RegexCheck(self, line_number, line, regex, message): return regex_check.RegexCheck( self.input_api.re, line_number, line, regex, message) def ChromeSendCheck(self, i, line): """Checks for a particular misuse of 'chrome.send'.""" return self.RegexCheck(i, line, r"chrome\.send\('[^']+'\s*(, \[\])\)", 'Passing an empty array to chrome.send is unnecessary') def ConstCheck(self, i, line): """Check for use of the 'const' keyword.""" if self.input_api.re.search(r'\*\s+@const', line): # Probably a JsDoc line return '' return self.RegexCheck(i, line, r'(?:^|\s|\()(const)\s', 'Use /** @const */ var varName; instead of const varName;') def EndJsDocCommentCheck(self, i, line): msg = 'End JSDoc comments with */ instead of **/' def _check(regex): return self.RegexCheck(i, line, regex, msg) return _check(r'^\s*(\*\*/)\s*$') or _check(r'/\*\* @[a-zA-Z]+.* (\*\*/)') def GetElementByIdCheck(self, i, line): """Checks for use of 'document.getElementById' instead of '$'.""" return self.RegexCheck(i, line, r"(document\.getElementById)\('", "Use $('id'), from chrome://resources/js/util.js, instead of " "document.getElementById('id')") def InheritDocCheck(self, i, line): """Checks for use of '@inheritDoc' instead of '@override'.""" return self.RegexCheck(i, line, r"\* (@inheritDoc)", "@inheritDoc is deprecated, use @override instead") def WrapperTypeCheck(self, i, line): """Check for wrappers (new String()) instead of builtins (string).""" return self.RegexCheck(i, line, r"(?:/\*)?\*.*?@(?:param|return|type) ?" # /** @param/@return/@type r"{[^}]*\b(String|Boolean|Number)\b[^}]*}", # {(Boolean|Number|String)} "Don't use wrapper types (i.e. new String() or @type {String})") def VarNameCheck(self, i, line): """See the style guide. http://goo.gl/uKir6""" return self.RegexCheck(i, line, r"var (?!g_\w+)([a-z]*[_$][\w_$]*)(?<! \$)", "Please use var namesLikeThis <http://goo.gl/uKir6>") def _GetErrorHighlight(self, start, length): """Takes a start position and a length, and produces a row of '^'s to highlight the corresponding part of a string. """ return start * ' ' + length * '^' def _MakeErrorOrWarning(self, error_text, filename): """Takes a few lines of text indicating a style violation and turns it into a PresubmitError (if |filename| is in a directory where we've already taken out all the style guide violations) or a PresubmitPromptWarning (if it's in a directory where we haven't done that yet). """ # TODO(tbreisacher): Once we've cleaned up the style nits in all of # resources/ we can get rid of this function. path = self.input_api.os_path resources = path.join(self.input_api.PresubmitLocalPath(), 'resources') dirs = ( path.join(resources, 'bookmark_manager'), path.join(resources, 'extensions'), path.join(resources, 'file_manager'), path.join(resources, 'help'), path.join(resources, 'history'), path.join(resources, 'memory_internals'), path.join(resources, 'net_export'), path.join(resources, 'net_internals'), path.join(resources, 'network_action_predictor'), path.join(resources, 'ntp4'), path.join(resources, 'options'), path.join(resources, 'password_manager_internals'), path.join(resources, 'print_preview'), path.join(resources, 'profiler'), path.join(resources, 'sync_promo'), path.join(resources, 'tracing'), path.join(resources, 'uber'), ) if filename.startswith(dirs): return self.output_api.PresubmitError(error_text) else: return self.output_api.PresubmitPromptWarning(error_text) def ClosureLint(self, file_to_lint, source=None): """Lints |file_to_lint| and returns the errors.""" import sys import warnings old_path = sys.path old_filters = warnings.filters try: closure_linter_path = self.input_api.os_path.join( self.input_api.change.RepositoryRoot(), "third_party", "closure_linter") gflags_path = self.input_api.os_path.join( self.input_api.change.RepositoryRoot(), "third_party", "python_gflags") sys.path.insert(0, closure_linter_path) sys.path.insert(0, gflags_path) warnings.filterwarnings('ignore', category=DeprecationWarning) from closure_linter import errors, runner from closure_linter.common import errorhandler finally: sys.path = old_path warnings.filters = old_filters class ErrorHandlerImpl(errorhandler.ErrorHandler): """Filters out errors that don't apply to Chromium JavaScript code.""" def __init__(self, re): self._errors = [] self.re = re def HandleFile(self, filename, first_token): self._filename = filename def HandleError(self, error): if (self._valid(error)): error.filename = self._filename self._errors.append(error) def GetErrors(self): return self._errors def HasErrors(self): return bool(self._errors) def _valid(self, error): """Check whether an error is valid. Most errors are valid, with a few exceptions which are listed here. """ is_grit_statement = bool( self.re.search("</?(include|if)", error.token.line)) # Ignore missing spaces before "(" until Promise#catch issue is solved. # http://crbug.com/338301 if (error.code == errors.MISSING_SPACE and error.token.string == '(' and 'catch(' in error.token.line): return False # Ignore "}.bind(" errors. http://crbug.com/397697 if (error.code == errors.MISSING_SEMICOLON_AFTER_FUNCTION and '}.bind(' in error.token.line): return False return not is_grit_statement and error.code not in [ errors.COMMA_AT_END_OF_LITERAL, errors.JSDOC_ILLEGAL_QUESTION_WITH_PIPE, errors.LINE_TOO_LONG, errors.MISSING_JSDOC_TAG_THIS, ] error_handler = ErrorHandlerImpl(self.input_api.re) runner.Run(file_to_lint, error_handler, source=source) return error_handler.GetErrors() def RunChecks(self): """Check for violations of the Chromium JavaScript style guide. See http://chromium.org/developers/web-development-style-guide#TOC-JavaScript """ results = [] affected_files = self.input_api.change.AffectedFiles( file_filter=self.file_filter, include_deletes=False) affected_js_files = filter(lambda f: f.LocalPath().endswith('.js'), affected_files) for f in affected_js_files: error_lines = [] # Check for the following: # * document.getElementById() # * the 'const' keyword # * Passing an empty array to 'chrome.send()' for i, line in enumerate(f.NewContents(), start=1): error_lines += filter(None, [ self.ChromeSendCheck(i, line), self.ConstCheck(i, line), self.GetElementByIdCheck(i, line), self.InheritDocCheck(i, line), self.WrapperTypeCheck(i, line), self.VarNameCheck(i, line), ]) # Use closure linter to check for several different errors. lint_errors = self.ClosureLint(self.input_api.os_path.join( self.input_api.change.RepositoryRoot(), f.LocalPath())) for error in lint_errors: highlight = self._GetErrorHighlight( error.token.start_index, error.token.length) error_msg = ' line %d: E%04d: %s\n%s\n%s' % ( error.token.line_number, error.code, error.message, error.token.line.rstrip(), highlight) error_lines.append(error_msg) if error_lines: error_lines = [ 'Found JavaScript style violations in %s:' % f.LocalPath()] + error_lines results.append(self._MakeErrorOrWarning( '\n'.join(error_lines), f.AbsoluteLocalPath())) if results: results.append(self.output_api.PresubmitNotifyResult( 'See the JavaScript style guide at ' 'http://www.chromium.org/developers/web-development-style-guide' '#TOC-JavaScript and if you have any feedback about the JavaScript ' 'PRESUBMIT check, contact tbreisacher@chromium.org or ' 'dbeam@chromium.org')) return results
bsd-3-clause
[ 3, 1898, 334, 67, 9, 6029, 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, 624, 30607, 2884, 367, 12051, 18001, 5944, 14, 199, 199, 9295, 18221, 15, 5750, 15, 14956, 2533, 13965, 14, 647, 199, 624, 199, 199, 646, 5163, 63, 1074, 421, 199, 533, 18001, 3048, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 1324, 63, 1246, 12, 1072, 63, 1246, 12, 570, 63, 1541, 29, 403, 304, 272, 291, 14, 1210, 63, 1246, 275, 1324, 63, 1246, 272, 291, 14, 1199, 63, 1246, 275, 1072, 63, 1246, 272, 291, 14, 493, 63, 1541, 275, 570, 63, 1541, 819, 347, 12939, 1799, 8, 277, 12, 1004, 63, 1955, 12, 1004, 12, 5163, 12, 1245, 304, 272, 372, 5163, 63, 1074, 14, 5103, 1799, 8, 267, 291, 14, 1210, 63, 1246, 14, 264, 12, 1004, 63, 1955, 12, 1004, 12, 5163, 12, 1245, 9, 819, 347, 16776, 6795, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 282, 6770, 3201, 1180, 402, 283, 9887, 14, 2254, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 2, 9887, 4537, 2254, 60, 360, 4735, 418, 19192, 83, 5830, 12, 971, 7023, 27147, 4186, 267, 283, 4986, 316, 376, 2701, 1625, 370, 18221, 14, 2254, 365, 23361, 358, 819, 347, 13435, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 1799, 367, 675, 402, 314, 283, 1297, 7, 4252, 1041, 272, 340, 291, 14, 1210, 63, 1246, 14, 264, 14, 1733, 8, 82, 1154, 7590, 83, 11, 32, 1297, 297, 1004, 304, 489, 327, 22770, 6665, 282, 26231, 3768, 1004, 489, 372, 2125, 339, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 20459, 62, 6113, 83, 6113, 24851, 1297, 2862, 83, 297, 267, 283, 6119, 1182, 538, 768, 1297, 11589, 2729, 2729, 985, 27, 3140, 402, 950, 2729, 985, 10784, 819, 347, 9599, 16633, 3768, 7488, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 1499, 275, 283, 3005, 1603, 3693, 679, 6786, 543, 11589, 3140, 402, 1011, 4805, 272, 347, 485, 1074, 8, 3821, 304, 489, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 5163, 12, 1499, 9, 272, 372, 485, 1074, 8, 82, 15542, 83, 22588, 7590, 15870, 2862, 83, 10, 9988, 503, 485, 1074, 8, 82, 32575, 27804, 768, 59, 65, 13, 6353, 13, 58, 2807, 2795, 14749, 7590, 15870, 5942, 819, 347, 2372, 2162, 18954, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 675, 402, 283, 3554, 14, 26215, 7, 3140, 402, 4505, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 26507, 3554, 4537, 26215, 2862, 360, 401, 267, 298, 6119, 2672, 360, 344, 659, 687, 18221, 921, 4435, 15, 3596, 15, 1974, 14, 3596, 12, 3140, 402, 298, 267, 298, 3554, 14, 26215, 360, 344, 26530, 819, 347, 27502, 3768, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 675, 402, 10267, 6486, 3768, 7, 3140, 402, 10267, 4415, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 3212, 10, 8593, 6486, 3768, 4186, 267, 9244, 6486, 3768, 365, 5906, 12, 675, 768, 4415, 3140, 531, 819, 347, 21947, 804, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 1799, 367, 17995, 334, 1222, 2624, 1012, 3140, 402, 12963, 334, 875, 10477, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 267, 519, 2, 5169, 6307, 10, 5547, 60, 10, 6697, 32, 5169, 635, 92, 1107, 92, 466, 9, 5805, 2, 258, 327, 1182, 538, 768, 635, 15, 32, 1107, 15, 32, 466, 267, 519, 14381, 4735, 93, 25739, 66, 8, 1558, 92, 4082, 92, 3259, 2862, 66, 4735, 93, 3672, 10750, 221, 327, 26458, 4082, 92, 3259, 92, 1558, 6769, 267, 298, 16932, 1133, 675, 4975, 2943, 334, 73, 14, 69, 14, 892, 2624, 342, 503, 768, 466, 469, 1558, 1552, 531, 819, 347, 21084, 985, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 9295, 314, 3449, 22885, 14, 1455, 921, 29546, 14, 3528, 15, 85, 43, 723, 22, 624, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 267, 519, 2, 1391, 7558, 1, 71, 18005, 87, 8771, 779, 65, 13, 90, 3672, 13040, 4, 30679, 87, 63, 4, 3672, 18168, 11230, 971, 4, 4186, 267, 298, 8254, 675, 2729, 1561, 12545, 2765, 665, 1014, 921, 29546, 14, 3528, 15, 85, 43, 723, 22, 9579, 819, 347, 485, 1002, 547, 11688, 4040, 8, 277, 12, 1343, 12, 2582, 304, 272, 408, 32488, 282, 1343, 3421, 436, 282, 2582, 12, 436, 16904, 282, 1962, 402, 14452, 7, 83, 370, 2126, 11850, 314, 5226, 1777, 402, 282, 1059, 14, 272, 408, 272, 372, 1343, 627, 283, 283, 435, 2582, 627, 14452, 7, 819, 347, 485, 5483, 547, 2844, 3849, 8, 277, 12, 1125, 63, 505, 12, 1788, 304, 272, 408, 32488, 282, 9284, 2385, 402, 1318, 9297, 282, 3449, 1321, 10410, 436, 25449, 652, 1901, 2126, 282, 510, 15527, 547, 334, 692, 1204, 1501, 92, 365, 315, 282, 2082, 2382, 781, 9064, 2575, 2126, 9394, 734, 1006, 314, 3449, 22885, 1321, 22938, 9, 503, 282, 510, 15527, 20430, 3849, 2126, 334, 692, 652, 1159, 315, 282, 2082, 2382, 781, 19051, 1133, 4224, 626, 5966, 680, 272, 408, 272, 327, 3254, 8, 5842, 264, 374, 19728, 304, 19468, 781, 9064, 12364, 1536, 314, 3449, 302, 1405, 315, 1006, 402, 272, 327, 5944, 15, 781, 883, 664, 16146, 402, 642, 805, 14, 272, 931, 275, 291, 14, 1210, 63, 1246, 14, 736, 63, 515, 272, 5944, 275, 931, 14, 904, 8, 277, 14, 1210, 63, 1246, 14, 30607, 26453, 1062, 283, 4435, 358, 272, 7606, 275, 334, 267, 931, 14, 904, 8, 4435, 12, 283, 17341, 63, 2609, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 5359, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 493, 63, 2609, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 3437, 659, 267, 931, 14, 904, 8, 4435, 12 ]
[ 1898, 334, 67, 9, 6029, 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, 624, 30607, 2884, 367, 12051, 18001, 5944, 14, 199, 199, 9295, 18221, 15, 5750, 15, 14956, 2533, 13965, 14, 647, 199, 624, 199, 199, 646, 5163, 63, 1074, 421, 199, 533, 18001, 3048, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 1324, 63, 1246, 12, 1072, 63, 1246, 12, 570, 63, 1541, 29, 403, 304, 272, 291, 14, 1210, 63, 1246, 275, 1324, 63, 1246, 272, 291, 14, 1199, 63, 1246, 275, 1072, 63, 1246, 272, 291, 14, 493, 63, 1541, 275, 570, 63, 1541, 819, 347, 12939, 1799, 8, 277, 12, 1004, 63, 1955, 12, 1004, 12, 5163, 12, 1245, 304, 272, 372, 5163, 63, 1074, 14, 5103, 1799, 8, 267, 291, 14, 1210, 63, 1246, 14, 264, 12, 1004, 63, 1955, 12, 1004, 12, 5163, 12, 1245, 9, 819, 347, 16776, 6795, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 282, 6770, 3201, 1180, 402, 283, 9887, 14, 2254, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 2, 9887, 4537, 2254, 60, 360, 4735, 418, 19192, 83, 5830, 12, 971, 7023, 27147, 4186, 267, 283, 4986, 316, 376, 2701, 1625, 370, 18221, 14, 2254, 365, 23361, 358, 819, 347, 13435, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 1799, 367, 675, 402, 314, 283, 1297, 7, 4252, 1041, 272, 340, 291, 14, 1210, 63, 1246, 14, 264, 14, 1733, 8, 82, 1154, 7590, 83, 11, 32, 1297, 297, 1004, 304, 489, 327, 22770, 6665, 282, 26231, 3768, 1004, 489, 372, 2125, 339, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 20459, 62, 6113, 83, 6113, 24851, 1297, 2862, 83, 297, 267, 283, 6119, 1182, 538, 768, 1297, 11589, 2729, 2729, 985, 27, 3140, 402, 950, 2729, 985, 10784, 819, 347, 9599, 16633, 3768, 7488, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 1499, 275, 283, 3005, 1603, 3693, 679, 6786, 543, 11589, 3140, 402, 1011, 4805, 272, 347, 485, 1074, 8, 3821, 304, 489, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 5163, 12, 1499, 9, 272, 372, 485, 1074, 8, 82, 15542, 83, 22588, 7590, 15870, 2862, 83, 10, 9988, 503, 485, 1074, 8, 82, 32575, 27804, 768, 59, 65, 13, 6353, 13, 58, 2807, 2795, 14749, 7590, 15870, 5942, 819, 347, 2372, 2162, 18954, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 675, 402, 283, 3554, 14, 26215, 7, 3140, 402, 4505, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 26507, 3554, 4537, 26215, 2862, 360, 401, 267, 298, 6119, 2672, 360, 344, 659, 687, 18221, 921, 4435, 15, 3596, 15, 1974, 14, 3596, 12, 3140, 402, 298, 267, 298, 3554, 14, 26215, 360, 344, 26530, 819, 347, 27502, 3768, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 11834, 367, 675, 402, 10267, 6486, 3768, 7, 3140, 402, 10267, 4415, 23690, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 519, 3212, 10, 8593, 6486, 3768, 4186, 267, 9244, 6486, 3768, 365, 5906, 12, 675, 768, 4415, 3140, 531, 819, 347, 21947, 804, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 1799, 367, 17995, 334, 1222, 2624, 1012, 3140, 402, 12963, 334, 875, 10477, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 267, 519, 2, 5169, 6307, 10, 5547, 60, 10, 6697, 32, 5169, 635, 92, 1107, 92, 466, 9, 5805, 2, 258, 327, 1182, 538, 768, 635, 15, 32, 1107, 15, 32, 466, 267, 519, 14381, 4735, 93, 25739, 66, 8, 1558, 92, 4082, 92, 3259, 2862, 66, 4735, 93, 3672, 10750, 221, 327, 26458, 4082, 92, 3259, 92, 1558, 6769, 267, 298, 16932, 1133, 675, 4975, 2943, 334, 73, 14, 69, 14, 892, 2624, 342, 503, 768, 466, 469, 1558, 1552, 531, 819, 347, 21084, 985, 1799, 8, 277, 12, 284, 12, 1004, 304, 272, 408, 9295, 314, 3449, 22885, 14, 1455, 921, 29546, 14, 3528, 15, 85, 43, 723, 22, 624, 272, 372, 291, 14, 5103, 1799, 8, 73, 12, 1004, 12, 267, 519, 2, 1391, 7558, 1, 71, 18005, 87, 8771, 779, 65, 13, 90, 3672, 13040, 4, 30679, 87, 63, 4, 3672, 18168, 11230, 971, 4, 4186, 267, 298, 8254, 675, 2729, 1561, 12545, 2765, 665, 1014, 921, 29546, 14, 3528, 15, 85, 43, 723, 22, 9579, 819, 347, 485, 1002, 547, 11688, 4040, 8, 277, 12, 1343, 12, 2582, 304, 272, 408, 32488, 282, 1343, 3421, 436, 282, 2582, 12, 436, 16904, 282, 1962, 402, 14452, 7, 83, 370, 2126, 11850, 314, 5226, 1777, 402, 282, 1059, 14, 272, 408, 272, 372, 1343, 627, 283, 283, 435, 2582, 627, 14452, 7, 819, 347, 485, 5483, 547, 2844, 3849, 8, 277, 12, 1125, 63, 505, 12, 1788, 304, 272, 408, 32488, 282, 9284, 2385, 402, 1318, 9297, 282, 3449, 1321, 10410, 436, 25449, 652, 1901, 2126, 282, 510, 15527, 547, 334, 692, 1204, 1501, 92, 365, 315, 282, 2082, 2382, 781, 9064, 2575, 2126, 9394, 734, 1006, 314, 3449, 22885, 1321, 22938, 9, 503, 282, 510, 15527, 20430, 3849, 2126, 334, 692, 652, 1159, 315, 282, 2082, 2382, 781, 19051, 1133, 4224, 626, 5966, 680, 272, 408, 272, 327, 3254, 8, 5842, 264, 374, 19728, 304, 19468, 781, 9064, 12364, 1536, 314, 3449, 302, 1405, 315, 1006, 402, 272, 327, 5944, 15, 781, 883, 664, 16146, 402, 642, 805, 14, 272, 931, 275, 291, 14, 1210, 63, 1246, 14, 736, 63, 515, 272, 5944, 275, 931, 14, 904, 8, 277, 14, 1210, 63, 1246, 14, 30607, 26453, 1062, 283, 4435, 358, 272, 7606, 275, 334, 267, 931, 14, 904, 8, 4435, 12, 283, 17341, 63, 2609, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 5359, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 493, 63, 2609, 659, 267, 931, 14, 904, 8, 4435, 12, 283, 3437, 659, 267, 931, 14, 904, 8, 4435, 12, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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005
5307
#!/usr/bin/python # # rt-mutex tester # # (C) 2006 Thomas Gleixner <tglx@linutronix.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # import os import sys import getopt import shutil import string # Globals quiet = 0 test = 0 comments = 0 sysfsprefix = "/sys/devices/system/rttest/rttest" statusfile = "/status" commandfile = "/command" # Command opcodes cmd_opcodes = { "schedother" : "1", "schedfifo" : "2", "lock" : "3", "locknowait" : "4", "lockint" : "5", "lockintnowait" : "6", "lockcont" : "7", "unlock" : "8", "signal" : "11", "resetevent" : "98", "reset" : "99", } test_opcodes = { "prioeq" : ["P" , "eq" , None], "priolt" : ["P" , "lt" , None], "priogt" : ["P" , "gt" , None], "nprioeq" : ["N" , "eq" , None], "npriolt" : ["N" , "lt" , None], "npriogt" : ["N" , "gt" , None], "unlocked" : ["M" , "eq" , 0], "trylock" : ["M" , "eq" , 1], "blocked" : ["M" , "eq" , 2], "blockedwake" : ["M" , "eq" , 3], "locked" : ["M" , "eq" , 4], "opcodeeq" : ["O" , "eq" , None], "opcodelt" : ["O" , "lt" , None], "opcodegt" : ["O" , "gt" , None], "eventeq" : ["E" , "eq" , None], "eventlt" : ["E" , "lt" , None], "eventgt" : ["E" , "gt" , None], } # Print usage information def usage(): print "rt-tester.py <-c -h -q -t> <testfile>" print " -c display comments after first command" print " -h help" print " -q quiet mode" print " -t test mode (syntax check)" print " testfile: read test specification from testfile" print " otherwise from stdin" return # Print progress when not in quiet mode def progress(str): if not quiet: print str # Analyse a status value def analyse(val, top, arg): intval = int(val) if top[0] == "M": intval = intval / (10 ** int(arg)) intval = intval % 10 argval = top[2] elif top[0] == "O": argval = int(cmd_opcodes.get(arg, arg)) else: argval = int(arg) # progress("%d %s %d" %(intval, top[1], argval)) if top[1] == "eq" and intval == argval: return 1 if top[1] == "lt" and intval < argval: return 1 if top[1] == "gt" and intval > argval: return 1 return 0 # Parse the commandline try: (options, arguments) = getopt.getopt(sys.argv[1:],'chqt') except getopt.GetoptError, ex: usage() sys.exit(1) # Parse commandline options for option, value in options: if option == "-c": comments = 1 elif option == "-q": quiet = 1 elif option == "-t": test = 1 elif option == '-h': usage() sys.exit(0) # Select the input source if arguments: try: fd = open(arguments[0]) except Exception,ex: sys.stderr.write("File not found %s\n" %(arguments[0])) sys.exit(1) else: fd = sys.stdin linenr = 0 # Read the test patterns while 1: linenr = linenr + 1 line = fd.readline() if not len(line): break line = line.strip() parts = line.split(":") if not parts or len(parts) < 1: continue if len(parts[0]) == 0: continue if parts[0].startswith("#"): if comments > 1: progress(line) continue if comments == 1: comments = 2 progress(line) cmd = parts[0].strip().lower() opc = parts[1].strip().lower() tid = parts[2].strip() dat = parts[3].strip() try: # Test or wait for a status value if cmd == "t" or cmd == "w": testop = test_opcodes[opc] fname = "%s%s%s" %(sysfsprefix, tid, statusfile) if test: print fname continue while 1: query = 1 fsta = open(fname, 'r') status = fsta.readline().strip() fsta.close() stat = status.split(",") for s in stat: s = s.strip() if s.startswith(testop[0]): # Separate status value val = s[2:].strip() query = analyse(val, testop, dat) break if query or cmd == "t": break progress(" " + status) if not query: sys.stderr.write("Test failed in line %d\n" %(linenr)) sys.exit(1) # Issue a command to the tester elif cmd == "c": cmdnr = cmd_opcodes[opc] # Build command string and sys filename cmdstr = "%s:%s" %(cmdnr, dat) fname = "%s%s%s" %(sysfsprefix, tid, commandfile) if test: print fname continue fcmd = open(fname, 'w') fcmd.write(cmdstr) fcmd.close() except Exception,ex: sys.stderr.write(str(ex)) sys.stderr.write("\nSyntax error in line %d\n" %(linenr)) if not test: fd.close() sys.exit(1) # Normal exit pass print "Pass" sys.exit(0)
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 14059, 13, 19078, 17570, 199, 3, 199, 3, 334, 35, 9, 8315, 27864, 598, 274, 1148, 1372, 665, 84, 18660, 32, 472, 5373, 1148, 14, 271, 30, 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, 1015, 499, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 14, 199, 3, 199, 646, 747, 199, 646, 984, 199, 646, 12733, 199, 646, 5145, 199, 646, 1059, 199, 199, 3, 13641, 83, 199, 10243, 275, 378, 199, 396, 275, 378, 199, 6223, 275, 378, 199, 199, 1274, 2319, 1861, 275, 3286, 1274, 15, 6410, 15, 2253, 15, 2591, 396, 15, 2591, 396, 2, 199, 1205, 493, 275, 3286, 1205, 2, 199, 1531, 493, 275, 3286, 1531, 2, 199, 199, 3, 5817, 27388, 199, 1760, 63, 22022, 275, 469, 272, 298, 10487, 1848, 2, 259, 520, 298, 17, 401, 272, 298, 10487, 22976, 2, 258, 520, 298, 18, 401, 272, 298, 831, 2, 3515, 520, 298, 19, 401, 272, 298, 831, 20870, 2, 259, 520, 298, 20, 401, 272, 298, 831, 442, 2, 755, 520, 298, 21, 401, 272, 298, 831, 442, 20870, 2, 520, 298, 22, 401, 272, 298, 831, 11096, 2, 420, 520, 298, 23, 401, 272, 298, 17966, 2, 263, 520, 298, 24, 401, 272, 298, 4653, 2, 263, 520, 298, 845, 401, 272, 298, 264, 30563, 782, 2, 259, 520, 298, 2905, 401, 272, 298, 3958, 2, 260, 520, 298, 1020, 401, 272, 789, 199, 199, 396, 63, 22022, 275, 469, 272, 298, 20572, 4077, 2, 263, 520, 2097, 48, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 1359, 28934, 2, 263, 520, 2097, 48, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 1359, 974, 84, 2, 263, 520, 2097, 48, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 78, 20572, 4077, 2, 755, 520, 2097, 46, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 78, 1359, 28934, 2, 755, 520, 2097, 46, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 78, 1359, 974, 84, 2, 755, 520, 2097, 46, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 32489, 2, 420, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 378, 467, 272, 298, 893, 831, 2, 755, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 413, 467, 272, 298, 17726, 2, 755, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 499, 467, 272, 298, 17726, 15181, 2, 257, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 650, 467, 272, 298, 9325, 2, 263, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 841, 467, 272, 298, 14325, 4077, 2, 420, 520, 2097, 47, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 14325, 4116, 2, 420, 520, 2097, 47, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 14325, 3308, 2, 420, 520, 2097, 47, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 12056, 266, 81, 2, 755, 520, 2097, 37, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 1430, 4116, 2, 755, 520, 2097, 37, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 1430, 3308, 2, 755, 520, 2097, 37, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 789, 199, 199, 3, 9101, 4503, 2556, 199, 318, 4503, 837, 272, 870, 298, 2591, 13, 8234, 14, 647, 25549, 67, 446, 72, 446, 81, 446, 84, 30, 665, 21091, 4335, 272, 870, 298, 446, 67, 259, 2929, 6786, 2410, 1642, 1414, 2, 272, 870, 298, 446, 72, 259, 1720, 2, 272, 870, 298, 446, 81, 259, 11971, 818, 2, 272, 870, 298, 446, 84, 259, 511, 818, 334, 7093, 1104, 2924, 272, 870, 298, 30530, 26, 1586, 511, 8929, 687, 30530, 2, 272, 870, 298, 4257, 687, 9009, 2, 272, 372, 199, 199, 3, 9101, 6696, 1380, 440, 315, 11971, 818, 199, 318, 6696, 8, 495, 304, 272, 340, 440, 11971, 26, 267, 870, 620, 199, 199, 3, 14279, 261, 282, 2004, 574, 199, 318, 21297, 8, 637, 12, 2746, 12, 1680, 304, 339, 26111, 275, 1109, 8, 637, 9, 339, 340, 2746, 59, 16, 61, 508, 298, 45, 582, 267, 26111, 275, 26111, 1182, 334, 709, 1011, 1109, 8, 1273, 430, 199, 198, 442, 637, 275, 26111, 450, 1616, 267, 27610, 275, 2746, 59, 18, 61, 272, 916, 2746, 59, 16, 61, 508, 298, 47, 582, 267, 27610, 275, 1109, 8, 1760, 63, 22022, 14, 362, 8, 1273, 12, 1680, 430, 272, 587, 26, 267, 27610, 275, 1109, 8, 1273, 9, 339, 327, 6696, 3647, 68, 450, 83, 450, 68, 2, 2818, 442, 637, 12, 2746, 59, 17, 467, 27610, 430, 339, 340, 2746, 59, 17, 61, 508, 298, 4077, 2, 436, 26111, 508, 27610, 26, 199, 198, 1107, 413, 272, 340, 2746, 59, 17, 61, 508, 298, 4116, 2, 436, 26111, 665, 27610, 26, 267, 372, 413, 272, 340, 2746, 59, 17, 61, 508, 298, 3308, 2, 436, 26111, 690, 27610, 26, 199, 198, 1107, 413, 272, 372, 378, 199, 199, 3, 6077, 314, 28279, 199, 893, 26, 272, 334, 1419, 12, 2368, 9, 275, 12733, 14, 18907, 8, 1274, 14, 3020, 59, 17, 8429, 7, 335, 8440, 358, 199, 2590, 12733, 14, 1002, 29368, 12, 444, 26, 272, 4503, 342, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 3, 6077, 28279, 1511, 199, 509, 945, 12, 574, 315, 1511, 26, 272, 340, 945, 508, 3905, 67, 582, 267, 6786, 275, 413, 272, 916, 945, 508, 3905, 81, 582, 267, 11971, 275, 413, 272, 916, 945, 508, 3905, 84, 582, 267, 511, 275, 413, 272, 916, 945, 508, 2475, 72, 356, 267, 4503, 342, 267, 984, 14, 2224, 8, 16, 9, 199, 199, 3, 9496, 314, 1324, 1350, 199, 692, 2368, 26, 272, 862, 26, 267, 6111, 275, 1551, 8, 4958, 59, 16, 566, 272, 871, 2186, 12, 476, 26, 267, 984, 14, 3083, 14, 952, 480, 1173, 440, 1911, 450, 83, 60, 78, 2, 2818, 4958, 59, 16, 2459, 267, 984, 14, 2224 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 14059, 13, 19078, 17570, 199, 3, 199, 3, 334, 35, 9, 8315, 27864, 598, 274, 1148, 1372, 665, 84, 18660, 32, 472, 5373, 1148, 14, 271, 30, 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, 1015, 499, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 14, 199, 3, 199, 646, 747, 199, 646, 984, 199, 646, 12733, 199, 646, 5145, 199, 646, 1059, 199, 199, 3, 13641, 83, 199, 10243, 275, 378, 199, 396, 275, 378, 199, 6223, 275, 378, 199, 199, 1274, 2319, 1861, 275, 3286, 1274, 15, 6410, 15, 2253, 15, 2591, 396, 15, 2591, 396, 2, 199, 1205, 493, 275, 3286, 1205, 2, 199, 1531, 493, 275, 3286, 1531, 2, 199, 199, 3, 5817, 27388, 199, 1760, 63, 22022, 275, 469, 272, 298, 10487, 1848, 2, 259, 520, 298, 17, 401, 272, 298, 10487, 22976, 2, 258, 520, 298, 18, 401, 272, 298, 831, 2, 3515, 520, 298, 19, 401, 272, 298, 831, 20870, 2, 259, 520, 298, 20, 401, 272, 298, 831, 442, 2, 755, 520, 298, 21, 401, 272, 298, 831, 442, 20870, 2, 520, 298, 22, 401, 272, 298, 831, 11096, 2, 420, 520, 298, 23, 401, 272, 298, 17966, 2, 263, 520, 298, 24, 401, 272, 298, 4653, 2, 263, 520, 298, 845, 401, 272, 298, 264, 30563, 782, 2, 259, 520, 298, 2905, 401, 272, 298, 3958, 2, 260, 520, 298, 1020, 401, 272, 789, 199, 199, 396, 63, 22022, 275, 469, 272, 298, 20572, 4077, 2, 263, 520, 2097, 48, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 1359, 28934, 2, 263, 520, 2097, 48, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 1359, 974, 84, 2, 263, 520, 2097, 48, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 78, 20572, 4077, 2, 755, 520, 2097, 46, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 78, 1359, 28934, 2, 755, 520, 2097, 46, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 78, 1359, 974, 84, 2, 755, 520, 2097, 46, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 32489, 2, 420, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 378, 467, 272, 298, 893, 831, 2, 755, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 413, 467, 272, 298, 17726, 2, 755, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 499, 467, 272, 298, 17726, 15181, 2, 257, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 650, 467, 272, 298, 9325, 2, 263, 520, 2097, 45, 2, 2360, 298, 4077, 2, 2360, 841, 467, 272, 298, 14325, 4077, 2, 420, 520, 2097, 47, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 14325, 4116, 2, 420, 520, 2097, 47, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 14325, 3308, 2, 420, 520, 2097, 47, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 298, 12056, 266, 81, 2, 755, 520, 2097, 37, 2, 2360, 298, 4077, 2, 2360, 488, 467, 272, 298, 1430, 4116, 2, 755, 520, 2097, 37, 2, 2360, 298, 4116, 2, 2360, 488, 467, 272, 298, 1430, 3308, 2, 755, 520, 2097, 37, 2, 2360, 298, 3308, 2, 2360, 488, 467, 272, 789, 199, 199, 3, 9101, 4503, 2556, 199, 318, 4503, 837, 272, 870, 298, 2591, 13, 8234, 14, 647, 25549, 67, 446, 72, 446, 81, 446, 84, 30, 665, 21091, 4335, 272, 870, 298, 446, 67, 259, 2929, 6786, 2410, 1642, 1414, 2, 272, 870, 298, 446, 72, 259, 1720, 2, 272, 870, 298, 446, 81, 259, 11971, 818, 2, 272, 870, 298, 446, 84, 259, 511, 818, 334, 7093, 1104, 2924, 272, 870, 298, 30530, 26, 1586, 511, 8929, 687, 30530, 2, 272, 870, 298, 4257, 687, 9009, 2, 272, 372, 199, 199, 3, 9101, 6696, 1380, 440, 315, 11971, 818, 199, 318, 6696, 8, 495, 304, 272, 340, 440, 11971, 26, 267, 870, 620, 199, 199, 3, 14279, 261, 282, 2004, 574, 199, 318, 21297, 8, 637, 12, 2746, 12, 1680, 304, 339, 26111, 275, 1109, 8, 637, 9, 339, 340, 2746, 59, 16, 61, 508, 298, 45, 582, 267, 26111, 275, 26111, 1182, 334, 709, 1011, 1109, 8, 1273, 430, 199, 198, 442, 637, 275, 26111, 450, 1616, 267, 27610, 275, 2746, 59, 18, 61, 272, 916, 2746, 59, 16, 61, 508, 298, 47, 582, 267, 27610, 275, 1109, 8, 1760, 63, 22022, 14, 362, 8, 1273, 12, 1680, 430, 272, 587, 26, 267, 27610, 275, 1109, 8, 1273, 9, 339, 327, 6696, 3647, 68, 450, 83, 450, 68, 2, 2818, 442, 637, 12, 2746, 59, 17, 467, 27610, 430, 339, 340, 2746, 59, 17, 61, 508, 298, 4077, 2, 436, 26111, 508, 27610, 26, 199, 198, 1107, 413, 272, 340, 2746, 59, 17, 61, 508, 298, 4116, 2, 436, 26111, 665, 27610, 26, 267, 372, 413, 272, 340, 2746, 59, 17, 61, 508, 298, 3308, 2, 436, 26111, 690, 27610, 26, 199, 198, 1107, 413, 272, 372, 378, 199, 199, 3, 6077, 314, 28279, 199, 893, 26, 272, 334, 1419, 12, 2368, 9, 275, 12733, 14, 18907, 8, 1274, 14, 3020, 59, 17, 8429, 7, 335, 8440, 358, 199, 2590, 12733, 14, 1002, 29368, 12, 444, 26, 272, 4503, 342, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 3, 6077, 28279, 1511, 199, 509, 945, 12, 574, 315, 1511, 26, 272, 340, 945, 508, 3905, 67, 582, 267, 6786, 275, 413, 272, 916, 945, 508, 3905, 81, 582, 267, 11971, 275, 413, 272, 916, 945, 508, 3905, 84, 582, 267, 511, 275, 413, 272, 916, 945, 508, 2475, 72, 356, 267, 4503, 342, 267, 984, 14, 2224, 8, 16, 9, 199, 199, 3, 9496, 314, 1324, 1350, 199, 692, 2368, 26, 272, 862, 26, 267, 6111, 275, 1551, 8, 4958, 59, 16, 566, 272, 871, 2186, 12, 476, 26, 267, 984, 14, 3083, 14, 952, 480, 1173, 440, 1911, 450, 83, 60, 78, 2, 2818, 4958, 59, 16, 2459, 267, 984, 14, 2224, 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 ]
ctruchi/deluge-webui2
deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py
8
1555
## # Copyright 2007 Steve 'Tarka' Smith (tarka@internode.on.net) # Distributed under the same terms as Deluge ## import logging from exceptions import Exception from struct import unpack import gzip, socket log = logging.getLogger(__name__) class PGException(Exception): pass # Incrementally reads PeerGuardian blocklists v1 and v2. # See http://wiki.phoenixlabs.org/wiki/P2B_Format class PGReader: def __init__(self, filename): log.debug("PGReader loading: %s", filename) try: self.fd = gzip.open(filename, "rb") except IOError, e: log.debug("Blocklist: PGReader: Incorrect file type or list is corrupt") # 4 bytes, should be 0xffffffff buf = self.fd.read(4) hdr = unpack("l", buf)[0] if hdr != -1: raise PGException(_("Invalid leader") + " %d"%hdr) magic = self.fd.read(3) if magic != "P2B": raise PGException(_("Invalid magic code")) buf = self.fd.read(1) ver = ord(buf) if ver != 1 and ver != 2: raise PGException(_("Invalid version") + " %d" % ver) def next(self): # Skip over the string buf = -1 while buf != 0: buf = self.fd.read(1) if buf == "": # EOF return False buf = ord(buf) buf = self.fd.read(4) start = socket.inet_ntoa(buf) buf = self.fd.read(4) end = socket.inet_ntoa(buf) return (start, end) def close(self): self.fd.close()
gpl-3.0
[ 309, 199, 3, 1898, 10219, 17854, 432, 283, 52, 1096, 65, 7, 25924, 334, 84, 1096, 65, 32, 1058, 932, 14, 265, 14, 846, 9, 199, 3, 17484, 1334, 314, 2011, 2895, 465, 18464, 17730, 199, 309, 199, 199, 646, 2050, 199, 504, 4967, 492, 2186, 199, 504, 2702, 492, 7787, 199, 646, 11756, 12, 2838, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 26595, 1726, 8, 1726, 304, 272, 986, 199, 199, 3, 1010, 4062, 1183, 11597, 11379, 281, 11548, 31186, 1853, 6717, 373, 17, 436, 373, 18, 14, 199, 3, 1666, 1455, 921, 6797, 14, 21936, 287, 1148, 76, 2101, 14, 1308, 15, 6797, 15, 48, 18, 34, 63, 3484, 199, 533, 26595, 5929, 26, 339, 347, 636, 826, 721, 277, 12, 1788, 304, 267, 943, 14, 1757, 480, 11115, 5929, 8697, 26, 450, 83, 401, 1788, 9, 398, 862, 26, 288, 291, 14, 2592, 275, 11756, 14, 1490, 8, 1501, 12, 298, 4848, 531, 267, 871, 5925, 12, 325, 26, 1779, 943, 14, 1757, 480, 3142, 513, 26, 26595, 5929, 26, 1010, 4525, 570, 730, 503, 769, 365, 29221, 531, 398, 327, 841, 2783, 12, 1077, 506, 378, 21870, 267, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 15260, 275, 7787, 480, 76, 401, 4123, 2788, 16, 61, 267, 340, 15260, 1137, 446, 17, 26, 288, 746, 26595, 1726, 6115, 3364, 23092, 531, 435, 298, 450, 68, 6808, 11244, 9, 398, 10628, 275, 291, 14, 2592, 14, 739, 8, 19, 9, 267, 340, 10628, 1137, 298, 48, 18, 34, 582, 288, 746, 26595, 1726, 6115, 3364, 10628, 1233, 2237, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 17, 9, 267, 809, 275, 6206, 8, 1436, 9, 267, 340, 809, 1137, 413, 436, 809, 1137, 499, 26, 288, 746, 26595, 1726, 6115, 3364, 1015, 531, 435, 298, 450, 68, 2, 450, 809, 9, 2378, 347, 2163, 8, 277, 304, 398, 327, 8232, 1806, 314, 1059, 267, 4123, 275, 446, 17, 267, 1830, 4123, 1137, 378, 26, 288, 4123, 275, 291, 14, 2592, 14, 739, 8, 17, 9, 288, 340, 4123, 508, 10812, 221, 327, 9027, 355, 372, 756, 288, 4123, 275, 6206, 8, 1436, 9, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 1343, 275, 2838, 14, 10811, 63, 343, 20047, 8, 1436, 9, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 1284, 275, 2838, 14, 10811, 63, 343, 20047, 8, 1436, 9, 398, 372, 334, 928, 12, 1284, 9, 339, 347, 4002, 8, 277, 304, 267, 291, 14, 2592, 14, 1600, 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 ]
[ 199, 3, 1898, 10219, 17854, 432, 283, 52, 1096, 65, 7, 25924, 334, 84, 1096, 65, 32, 1058, 932, 14, 265, 14, 846, 9, 199, 3, 17484, 1334, 314, 2011, 2895, 465, 18464, 17730, 199, 309, 199, 199, 646, 2050, 199, 504, 4967, 492, 2186, 199, 504, 2702, 492, 7787, 199, 646, 11756, 12, 2838, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 26595, 1726, 8, 1726, 304, 272, 986, 199, 199, 3, 1010, 4062, 1183, 11597, 11379, 281, 11548, 31186, 1853, 6717, 373, 17, 436, 373, 18, 14, 199, 3, 1666, 1455, 921, 6797, 14, 21936, 287, 1148, 76, 2101, 14, 1308, 15, 6797, 15, 48, 18, 34, 63, 3484, 199, 533, 26595, 5929, 26, 339, 347, 636, 826, 721, 277, 12, 1788, 304, 267, 943, 14, 1757, 480, 11115, 5929, 8697, 26, 450, 83, 401, 1788, 9, 398, 862, 26, 288, 291, 14, 2592, 275, 11756, 14, 1490, 8, 1501, 12, 298, 4848, 531, 267, 871, 5925, 12, 325, 26, 1779, 943, 14, 1757, 480, 3142, 513, 26, 26595, 5929, 26, 1010, 4525, 570, 730, 503, 769, 365, 29221, 531, 398, 327, 841, 2783, 12, 1077, 506, 378, 21870, 267, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 15260, 275, 7787, 480, 76, 401, 4123, 2788, 16, 61, 267, 340, 15260, 1137, 446, 17, 26, 288, 746, 26595, 1726, 6115, 3364, 23092, 531, 435, 298, 450, 68, 6808, 11244, 9, 398, 10628, 275, 291, 14, 2592, 14, 739, 8, 19, 9, 267, 340, 10628, 1137, 298, 48, 18, 34, 582, 288, 746, 26595, 1726, 6115, 3364, 10628, 1233, 2237, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 17, 9, 267, 809, 275, 6206, 8, 1436, 9, 267, 340, 809, 1137, 413, 436, 809, 1137, 499, 26, 288, 746, 26595, 1726, 6115, 3364, 1015, 531, 435, 298, 450, 68, 2, 450, 809, 9, 2378, 347, 2163, 8, 277, 304, 398, 327, 8232, 1806, 314, 1059, 267, 4123, 275, 446, 17, 267, 1830, 4123, 1137, 378, 26, 288, 4123, 275, 291, 14, 2592, 14, 739, 8, 17, 9, 288, 340, 4123, 508, 10812, 221, 327, 9027, 355, 372, 756, 288, 4123, 275, 6206, 8, 1436, 9, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 1343, 275, 2838, 14, 10811, 63, 343, 20047, 8, 1436, 9, 398, 4123, 275, 291, 14, 2592, 14, 739, 8, 20, 9, 267, 1284, 275, 2838, 14, 10811, 63, 343, 20047, 8, 1436, 9, 398, 372, 334, 928, 12, 1284, 9, 339, 347, 4002, 8, 277, 304, 267, 291, 14, 2592, 14, 1600, 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, 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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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 ]
Tong-Chen/scikit-learn
sklearn/manifold/tests/test_isomap.py
31
3991
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from sklearn import datasets from sklearn import manifold from sklearn import neighbors from sklearn import pipeline from sklearn import preprocessing from sklearn.utils.testing import assert_less eigen_solvers = ['auto', 'dense', 'arpack'] path_methods = ['auto', 'FW', 'D'] def test_isomap_simple_grid(): # Isomap should preserve distances when all neighbors are used N_per_side = 5 Npts = N_per_side ** 2 n_neighbors = Npts - 1 # grid of equidistant points in 2D, n_components = n_dim X = np.array(list(product(range(N_per_side), repeat=2))) # distances from each point to all others G = neighbors.kneighbors_graph(X, n_neighbors, mode='distance').toarray() for eigen_solver in eigen_solvers: for path_method in path_methods: clf = manifold.Isomap(n_neighbors=n_neighbors, n_components=2, eigen_solver=eigen_solver, path_method=path_method) clf.fit(X) G_iso = neighbors.kneighbors_graph(clf.embedding_, n_neighbors, mode='distance').toarray() assert_array_almost_equal(G, G_iso) def test_isomap_reconstruction_error(): # Same setup as in test_isomap_simple_grid, with an added dimension N_per_side = 5 Npts = N_per_side ** 2 n_neighbors = Npts - 1 # grid of equidistant points in 2D, n_components = n_dim X = np.array(list(product(range(N_per_side), repeat=2))) # add noise in a third dimension rng = np.random.RandomState(0) noise = 0.1 * rng.randn(Npts, 1) X = np.concatenate((X, noise), 1) # compute input kernel G = neighbors.kneighbors_graph(X, n_neighbors, mode='distance').toarray() centerer = preprocessing.KernelCenterer() K = centerer.fit_transform(-0.5 * G ** 2) for eigen_solver in eigen_solvers: for path_method in path_methods: clf = manifold.Isomap(n_neighbors=n_neighbors, n_components=2, eigen_solver=eigen_solver, path_method=path_method) clf.fit(X) # compute output kernel G_iso = neighbors.kneighbors_graph(clf.embedding_, n_neighbors, mode='distance').toarray() K_iso = centerer.fit_transform(-0.5 * G_iso ** 2) # make sure error agrees reconstruction_error = np.linalg.norm(K - K_iso) / Npts assert_almost_equal(reconstruction_error, clf.reconstruction_error()) def test_transform(): n_samples = 200 n_components = 10 noise_scale = 0.01 # Create S-curve dataset X, y = datasets.samples_generator.make_s_curve(n_samples) # Compute isomap embedding iso = manifold.Isomap(n_components, 2) X_iso = iso.fit_transform(X) # Re-embed a noisy version of the points rng = np.random.RandomState(0) noise = noise_scale * rng.randn(*X.shape) X_iso2 = iso.transform(X + noise) # Make sure the rms error on re-embedding is comparable to noise_scale assert_less(np.sqrt(np.mean((X_iso - X_iso2) ** 2)), 2 * noise_scale) def test_pipeline(): # check that Isomap works fine as a transformer in a Pipeline # only checks that no error is raised. # TODO check that it actually does something useful X, y = datasets.make_blobs(random_state=0) clf = pipeline.Pipeline( [('isomap', manifold.Isomap()), ('clf', neighbors.KNeighborsClassifier())]) clf.fit(X, y) assert_less(.9, clf.score(X, y)) if __name__ == '__main__': import nose nose.runmodule()
bsd-3-clause
[ 504, 7975, 492, 3336, 199, 646, 2680, 465, 980, 199, 504, 2680, 14, 4776, 492, 702, 63, 4398, 63, 1452, 12, 702, 63, 1144, 63, 4398, 63, 1452, 199, 199, 504, 6357, 492, 13148, 199, 504, 6357, 492, 2169, 32294, 199, 504, 6357, 492, 15845, 199, 504, 6357, 492, 7679, 199, 504, 6357, 492, 26471, 199, 504, 6357, 14, 1208, 14, 4776, 492, 702, 63, 2003, 199, 199, 19545, 63, 11263, 83, 275, 788, 2495, 297, 283, 7253, 297, 283, 285, 1389, 418, 199, 515, 63, 2474, 275, 788, 2495, 297, 283, 19445, 297, 283, 36, 418, 421, 199, 318, 511, 63, 4595, 1130, 63, 4129, 63, 3825, 837, 272, 327, 473, 1152, 1130, 1077, 11211, 15108, 1380, 1006, 15845, 787, 1202, 272, 653, 63, 529, 63, 2441, 275, 959, 272, 653, 8382, 275, 653, 63, 529, 63, 2441, 1011, 499, 272, 302, 63, 11113, 275, 653, 8382, 446, 413, 339, 327, 6068, 402, 325, 783, 2686, 867, 4501, 315, 499, 36, 12, 302, 63, 4608, 275, 302, 63, 3572, 272, 1323, 275, 980, 14, 1144, 8, 513, 8, 2558, 8, 1842, 8, 46, 63, 529, 63, 2441, 395, 11982, 29, 18, 1724, 339, 327, 15108, 687, 1924, 2376, 370, 1006, 11789, 272, 598, 275, 15845, 14, 75, 11113, 63, 2180, 8, 56, 12, 302, 63, 11113, 12, 3521, 818, 534, 5590, 1959, 18993, 342, 339, 367, 11471, 63, 11263, 315, 11471, 63, 11263, 83, 26, 267, 367, 931, 63, 765, 315, 931, 63, 2474, 26, 288, 6975, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 11113, 29, 78, 63, 11113, 12, 302, 63, 4608, 29, 18, 12, 3303, 11471, 63, 11263, 29, 19545, 63, 11263, 12, 3303, 931, 63, 765, 29, 515, 63, 765, 9, 288, 6975, 14, 3269, 8, 56, 9, 953, 598, 63, 4595, 275, 15845, 14, 75, 11113, 63, 2180, 8, 9694, 14, 14275, 3131, 6901, 302, 63, 11113, 12, 6901, 818, 534, 5590, 1959, 18993, 342, 288, 702, 63, 1144, 63, 4398, 63, 1452, 8, 39, 12, 598, 63, 4595, 9, 421, 199, 318, 511, 63, 4595, 1130, 63, 264, 12708, 63, 705, 837, 272, 327, 14766, 3272, 465, 315, 511, 63, 4595, 1130, 63, 4129, 63, 3825, 12, 543, 376, 3483, 6240, 272, 653, 63, 529, 63, 2441, 275, 959, 272, 653, 8382, 275, 653, 63, 529, 63, 2441, 1011, 499, 272, 302, 63, 11113, 275, 653, 8382, 446, 413, 339, 327, 6068, 402, 325, 783, 2686, 867, 4501, 315, 499, 36, 12, 302, 63, 4608, 275, 302, 63, 3572, 272, 1323, 275, 980, 14, 1144, 8, 513, 8, 2558, 8, 1842, 8, 46, 63, 529, 63, 2441, 395, 11982, 29, 18, 1724, 339, 327, 1050, 11145, 315, 282, 10919, 6240, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 11145, 275, 378, 14, 17, 627, 9038, 14, 10843, 8, 46, 8382, 12, 413, 9, 272, 1323, 275, 980, 14, 13433, 1332, 56, 12, 11145, 395, 413, 9, 339, 327, 4526, 1324, 5114, 272, 598, 275, 15845, 14, 75, 11113, 63, 2180, 8, 56, 12, 302, 63, 11113, 12, 3521, 818, 534, 5590, 1959, 18993, 342, 339, 9679, 266, 3859, 275, 26471, 14, 14127, 18345, 266, 3859, 342, 272, 1804, 275, 9679, 266, 3859, 14, 3269, 63, 4711, 2801, 16, 14, 21, 627, 598, 1011, 499, 9, 339, 367, 11471, 63, 11263, 315, 11471, 63, 11263, 83, 26, 267, 367, 931, 63, 765, 315, 931, 63, 2474, 26, 288, 6975, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 11113, 29, 78, 63, 11113, 12, 302, 63, 4608, 29, 18, 12, 3303, 11471, 63, 11263, 29, 19545, 63, 11263, 12, 3303, 931, 63, 765, 29, 515, 63, 765, 9, 288, 6975, 14, 3269, 8, 56, 9, 953, 327, 4526, 1072, 5114, 288, 598, 63, 4595, 275, 15845, 14, 75, 11113, 63, 2180, 8, 9694, 14, 14275, 3131, 6901, 302, 63, 11113, 12, 6901, 818, 534, 5590, 1959, 18993, 342, 953, 1804, 63, 4595, 275, 9679, 266, 3859, 14, 3269, 63, 4711, 2801, 16, 14, 21, 627, 598, 63, 4595, 1011, 499, 9, 953, 327, 1852, 3238, 1125, 1839, 5710, 288, 295, 12708, 63, 705, 275, 980, 14, 10096, 14, 4791, 8, 43, 446, 1804, 63, 4595, 9, 1182, 653, 8382, 288, 702, 63, 4398, 63, 1452, 8, 264, 12708, 63, 705, 12, 1816, 6975, 14, 264, 12708, 63, 705, 1012, 421, 199, 318, 511, 63, 4711, 837, 272, 302, 63, 3356, 275, 1926, 272, 302, 63, 4608, 275, 1616, 272, 11145, 63, 3467, 275, 378, 14, 614, 339, 327, 2790, 428, 13, 11895, 4789, 272, 1323, 12, 612, 275, 13148, 14, 3356, 63, 4679, 14, 1875, 63, 83, 63, 11895, 8, 78, 63, 3356, 9, 339, 327, 8354, 11601, 1130, 12452, 272, 11601, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 4608, 12, 499, 9, 272, 1323, 63, 4595, 275, 11601, 14, 3269, 63, 4711, 8, 56, 9, 339, 327, 799, 13, 6427, 282, 949, 19765, 1015, 402, 314, 4501, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 11145, 275, 11145, 63, 3467, 627, 9038, 14, 10843, 2031, 56, 14, 1392, 9, 272, 1323, 63, 4595, 18, 275, 11601, 14, 4711, 8, 56, 435, 11145, 9, 339, 327, 4155, 3238, 314, 32205, 1125, 641, 295, 13, 14275, 365, 1013, 19816, 370, 11145, 63, 3467, 272, 702, 63, 2003, 8, 1590, 14, 5079, 8, 1590, 14, 3670, 1332, 56, 63, 4595, 446, 1323, 63, 4595, 18, 9, 1011, 499, 1826, 499, 627, 11145, 63, 3467, 9, 421, 199, 318, 511, 63, 7379, 837, 272, 327, 1104, 626, 473, 1152, 1130, 5419, 15701, 465, 282, 21484, 315, 282, 19090, 272, 327, 1454, 5920, 626, 949, 1125, 365, 4915, 14, 272, 327, 3254, 1104, 626, 652, 5965, 1630, 6020, 2997, 272, 1323, 12, 612, 275, 13148, 14, 1875, 63, 21893, 8, 2355, 63, 929, 29, 16, 9, 272, 6975, 275, 7679, 14, 17562, 8, 267, 4274, 4595, 1130, 297, 2169, 32294, 14, 41, 1152, 1130, 4000, 268, 661, 9694, 297, 15845, 14, 43, 20011, 8508, 30719, 272, 6975, 14, 3269, 8, 56, 12, 612, 9, 272, 702, 63, 2003, 13417, 25, 12, 6975, 14, 3397, 8, 56, 12, 612 ]
[ 7975, 492, 3336, 199, 646, 2680, 465, 980, 199, 504, 2680, 14, 4776, 492, 702, 63, 4398, 63, 1452, 12, 702, 63, 1144, 63, 4398, 63, 1452, 199, 199, 504, 6357, 492, 13148, 199, 504, 6357, 492, 2169, 32294, 199, 504, 6357, 492, 15845, 199, 504, 6357, 492, 7679, 199, 504, 6357, 492, 26471, 199, 504, 6357, 14, 1208, 14, 4776, 492, 702, 63, 2003, 199, 199, 19545, 63, 11263, 83, 275, 788, 2495, 297, 283, 7253, 297, 283, 285, 1389, 418, 199, 515, 63, 2474, 275, 788, 2495, 297, 283, 19445, 297, 283, 36, 418, 421, 199, 318, 511, 63, 4595, 1130, 63, 4129, 63, 3825, 837, 272, 327, 473, 1152, 1130, 1077, 11211, 15108, 1380, 1006, 15845, 787, 1202, 272, 653, 63, 529, 63, 2441, 275, 959, 272, 653, 8382, 275, 653, 63, 529, 63, 2441, 1011, 499, 272, 302, 63, 11113, 275, 653, 8382, 446, 413, 339, 327, 6068, 402, 325, 783, 2686, 867, 4501, 315, 499, 36, 12, 302, 63, 4608, 275, 302, 63, 3572, 272, 1323, 275, 980, 14, 1144, 8, 513, 8, 2558, 8, 1842, 8, 46, 63, 529, 63, 2441, 395, 11982, 29, 18, 1724, 339, 327, 15108, 687, 1924, 2376, 370, 1006, 11789, 272, 598, 275, 15845, 14, 75, 11113, 63, 2180, 8, 56, 12, 302, 63, 11113, 12, 3521, 818, 534, 5590, 1959, 18993, 342, 339, 367, 11471, 63, 11263, 315, 11471, 63, 11263, 83, 26, 267, 367, 931, 63, 765, 315, 931, 63, 2474, 26, 288, 6975, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 11113, 29, 78, 63, 11113, 12, 302, 63, 4608, 29, 18, 12, 3303, 11471, 63, 11263, 29, 19545, 63, 11263, 12, 3303, 931, 63, 765, 29, 515, 63, 765, 9, 288, 6975, 14, 3269, 8, 56, 9, 953, 598, 63, 4595, 275, 15845, 14, 75, 11113, 63, 2180, 8, 9694, 14, 14275, 3131, 6901, 302, 63, 11113, 12, 6901, 818, 534, 5590, 1959, 18993, 342, 288, 702, 63, 1144, 63, 4398, 63, 1452, 8, 39, 12, 598, 63, 4595, 9, 421, 199, 318, 511, 63, 4595, 1130, 63, 264, 12708, 63, 705, 837, 272, 327, 14766, 3272, 465, 315, 511, 63, 4595, 1130, 63, 4129, 63, 3825, 12, 543, 376, 3483, 6240, 272, 653, 63, 529, 63, 2441, 275, 959, 272, 653, 8382, 275, 653, 63, 529, 63, 2441, 1011, 499, 272, 302, 63, 11113, 275, 653, 8382, 446, 413, 339, 327, 6068, 402, 325, 783, 2686, 867, 4501, 315, 499, 36, 12, 302, 63, 4608, 275, 302, 63, 3572, 272, 1323, 275, 980, 14, 1144, 8, 513, 8, 2558, 8, 1842, 8, 46, 63, 529, 63, 2441, 395, 11982, 29, 18, 1724, 339, 327, 1050, 11145, 315, 282, 10919, 6240, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 11145, 275, 378, 14, 17, 627, 9038, 14, 10843, 8, 46, 8382, 12, 413, 9, 272, 1323, 275, 980, 14, 13433, 1332, 56, 12, 11145, 395, 413, 9, 339, 327, 4526, 1324, 5114, 272, 598, 275, 15845, 14, 75, 11113, 63, 2180, 8, 56, 12, 302, 63, 11113, 12, 3521, 818, 534, 5590, 1959, 18993, 342, 339, 9679, 266, 3859, 275, 26471, 14, 14127, 18345, 266, 3859, 342, 272, 1804, 275, 9679, 266, 3859, 14, 3269, 63, 4711, 2801, 16, 14, 21, 627, 598, 1011, 499, 9, 339, 367, 11471, 63, 11263, 315, 11471, 63, 11263, 83, 26, 267, 367, 931, 63, 765, 315, 931, 63, 2474, 26, 288, 6975, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 11113, 29, 78, 63, 11113, 12, 302, 63, 4608, 29, 18, 12, 3303, 11471, 63, 11263, 29, 19545, 63, 11263, 12, 3303, 931, 63, 765, 29, 515, 63, 765, 9, 288, 6975, 14, 3269, 8, 56, 9, 953, 327, 4526, 1072, 5114, 288, 598, 63, 4595, 275, 15845, 14, 75, 11113, 63, 2180, 8, 9694, 14, 14275, 3131, 6901, 302, 63, 11113, 12, 6901, 818, 534, 5590, 1959, 18993, 342, 953, 1804, 63, 4595, 275, 9679, 266, 3859, 14, 3269, 63, 4711, 2801, 16, 14, 21, 627, 598, 63, 4595, 1011, 499, 9, 953, 327, 1852, 3238, 1125, 1839, 5710, 288, 295, 12708, 63, 705, 275, 980, 14, 10096, 14, 4791, 8, 43, 446, 1804, 63, 4595, 9, 1182, 653, 8382, 288, 702, 63, 4398, 63, 1452, 8, 264, 12708, 63, 705, 12, 1816, 6975, 14, 264, 12708, 63, 705, 1012, 421, 199, 318, 511, 63, 4711, 837, 272, 302, 63, 3356, 275, 1926, 272, 302, 63, 4608, 275, 1616, 272, 11145, 63, 3467, 275, 378, 14, 614, 339, 327, 2790, 428, 13, 11895, 4789, 272, 1323, 12, 612, 275, 13148, 14, 3356, 63, 4679, 14, 1875, 63, 83, 63, 11895, 8, 78, 63, 3356, 9, 339, 327, 8354, 11601, 1130, 12452, 272, 11601, 275, 2169, 32294, 14, 41, 1152, 1130, 8, 78, 63, 4608, 12, 499, 9, 272, 1323, 63, 4595, 275, 11601, 14, 3269, 63, 4711, 8, 56, 9, 339, 327, 799, 13, 6427, 282, 949, 19765, 1015, 402, 314, 4501, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 11145, 275, 11145, 63, 3467, 627, 9038, 14, 10843, 2031, 56, 14, 1392, 9, 272, 1323, 63, 4595, 18, 275, 11601, 14, 4711, 8, 56, 435, 11145, 9, 339, 327, 4155, 3238, 314, 32205, 1125, 641, 295, 13, 14275, 365, 1013, 19816, 370, 11145, 63, 3467, 272, 702, 63, 2003, 8, 1590, 14, 5079, 8, 1590, 14, 3670, 1332, 56, 63, 4595, 446, 1323, 63, 4595, 18, 9, 1011, 499, 1826, 499, 627, 11145, 63, 3467, 9, 421, 199, 318, 511, 63, 7379, 837, 272, 327, 1104, 626, 473, 1152, 1130, 5419, 15701, 465, 282, 21484, 315, 282, 19090, 272, 327, 1454, 5920, 626, 949, 1125, 365, 4915, 14, 272, 327, 3254, 1104, 626, 652, 5965, 1630, 6020, 2997, 272, 1323, 12, 612, 275, 13148, 14, 1875, 63, 21893, 8, 2355, 63, 929, 29, 16, 9, 272, 6975, 275, 7679, 14, 17562, 8, 267, 4274, 4595, 1130, 297, 2169, 32294, 14, 41, 1152, 1130, 4000, 268, 661, 9694, 297, 15845, 14, 43, 20011, 8508, 30719, 272, 6975, 14, 3269, 8, 56, 12, 612, 9, 272, 702, 63, 2003, 13417, 25, 12, 6975, 14, 3397, 8, 56, 12, 612, 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,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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 ]
Crescent-Saturn/Hello_Python
Week8/Bubble_shoot_final.py
1
3541
# Basic infrastructure for Bubble Shooter import simplegui import random import math # Global constants WIDTH = 800 HEIGHT = 600 FIRING_POSITION = [WIDTH // 2, HEIGHT] FIRING_LINE_LENGTH = 60 FIRING_ANGLE_VEL_INC = 0.02 BUBBLE_RADIUS = 20 COLOR_LIST = ["Red", "Green", "Blue", "White"] # global variables firing_angle = math.pi / 2 firing_angle_vel = 0 bubble_stuck = True # firing sound firing_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/Collision8-Bit.ogg") # helper functions to handle transformations def angle_to_vector(ang): return [math.cos(ang), math.sin(ang)] def dist(p,q): return math.sqrt((p[0]-q[0])**2+(p[1]-q[1])**2) # class defintion for Bubbles class Bubble: def __init__(self, sound = None): self.pos = list(FIRING_POSITION) self.vel = [0, 0] self.color = random.choice(COLOR_LIST) self.sound = sound def update(self): self.pos[0] += self.vel[0] self.pos[1] += self.vel[1] if self.pos[0] <= BUBBLE_RADIUS or self.pos[0] >= WIDTH - BUBBLE_RADIUS: self.vel[0] = - self.vel[0] def fire_bubble(self, vel): self.vel = vel if self.sound: self.sound.play() def is_stuck(self, stuck_bubbles): if self.pos[1] <= BUBBLE_RADIUS: return True for a in stuck_bubbles: if self.collide(a): return True return False def collide(self, bubble): return dist(self.pos, bubble.pos) <= BUBBLE_RADIUS*2 def draw(self, canvas): canvas.draw_circle(self.pos, BUBBLE_RADIUS, 1, "White", self.color) # define keyhandlers to control firing_angle def keydown(key): global a_bubble, firing_angle_vel, bubble_stuck if simplegui.KEY_MAP["space"] == key: bubble_stuck = False vel = angle_to_vector(firing_angle) a_bubble.fire_bubble([4 * vel[0], -4 * vel[1]]) elif simplegui.KEY_MAP["left"] == key: firing_angle_vel += FIRING_ANGLE_VEL_INC elif simplegui.KEY_MAP["right"] == key: firing_angle_vel -= FIRING_ANGLE_VEL_INC def keyup(key): global firing_angle_vel if simplegui.KEY_MAP["left"] == key: firing_angle_vel -= FIRING_ANGLE_VEL_INC elif simplegui.KEY_MAP["right"] == key: firing_angle_vel += FIRING_ANGLE_VEL_INC # define draw handler def draw(canvas): global firing_angle, a_bubble, bubble_stuck # update firing angle firing_angle += firing_angle_vel #draw firing line orient = angle_to_vector(firing_angle) upper_endpoint = [FIRING_POSITION[0] + FIRING_LINE_LENGTH * orient[0], FIRING_POSITION[1] - FIRING_LINE_LENGTH * orient[1]] canvas.draw_line(FIRING_POSITION, upper_endpoint, 4, "White") # update a_bubble and check for sticking a_bubble.update() if a_bubble.is_stuck(stuck_bubbles): bubble_stuck = True stuck_bubbles.add(a_bubble) a_bubble = Bubble(firing_sound) # draw a bubble and stuck bubbles a_bubble.draw(canvas) for b in stuck_bubbles: b.draw(canvas) # create frame and register handlers frame = simplegui.create_frame("Bubble Shooter", WIDTH, HEIGHT) frame.set_keydown_handler(keydown) frame.set_keyup_handler(keyup) frame.set_draw_handler(draw) # create initial buble and start frame a_bubble = Bubble(firing_sound) stuck_bubbles = set([]) frame.start()
gpl-3.0
[ 3, 10082, 28890, 6976, 367, 699, 21749, 428, 19112, 351, 199, 199, 646, 3486, 5885, 199, 646, 2196, 199, 646, 3473, 199, 199, 3, 13641, 5262, 199, 11139, 275, 23466, 199, 13509, 275, 11624, 199, 1976, 25127, 63, 15717, 275, 359, 11139, 5001, 499, 12, 8378, 2830, 61, 199, 1976, 25127, 63, 6174, 63, 9127, 275, 5212, 199, 1976, 25127, 63, 30421, 63, 10429, 63, 25205, 275, 378, 14, 996, 199, 34, 2533, 34, 906, 63, 19662, 30373, 275, 3388, 199, 7134, 63, 4924, 275, 2097, 10858, 401, 298, 19456, 401, 298, 15617, 401, 298, 19803, 937, 199, 199, 3, 2288, 2860, 199, 1795, 316, 63, 4593, 275, 3473, 14, 1038, 1182, 499, 199, 1795, 316, 63, 4593, 63, 1090, 275, 378, 199, 66, 21749, 63, 270, 10112, 275, 715, 199, 199, 3, 289, 16648, 20453, 199, 1795, 316, 63, 14990, 275, 3486, 5885, 14, 912, 63, 14990, 480, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 600, 1339, 348, 541, 269, 13, 12186, 15, 2001, 23656, 24, 13, 4734, 14, 24798, 531, 421, 199, 3, 5922, 3423, 370, 2429, 25947, 199, 318, 9324, 63, 475, 63, 4106, 8, 621, 304, 272, 372, 359, 3442, 14, 5197, 8, 621, 395, 3473, 14, 5911, 8, 621, 1874, 199, 199, 318, 2917, 8, 80, 12, 81, 304, 272, 372, 3473, 14, 5079, 1332, 80, 59, 16, 11285, 81, 59, 16, 566, 538, 18, 15622, 80, 59, 17, 11285, 81, 59, 17, 566, 538, 18, 9, 421, 199, 3, 1021, 347, 262, 296, 367, 699, 21749, 83, 199, 533, 699, 21749, 26, 2286, 347, 636, 826, 721, 277, 12, 20453, 275, 488, 304, 267, 291, 14, 1712, 275, 769, 8, 1976, 25127, 63, 15717, 9, 267, 291, 14, 1090, 275, 359, 16, 12, 378, 61, 267, 291, 14, 2326, 275, 2196, 14, 5095, 8, 7134, 63, 4924, 9, 267, 291, 14, 14990, 275, 20453, 5493, 347, 1678, 8, 277, 304, 267, 291, 14, 1712, 59, 16, 61, 847, 291, 14, 1090, 59, 16, 61, 267, 291, 14, 1712, 59, 17, 61, 847, 291, 14, 1090, 59, 17, 61, 267, 340, 291, 14, 1712, 59, 16, 61, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 503, 291, 14, 1712, 59, 16, 61, 2356, 644, 998, 2080, 446, 699, 2533, 34, 906, 63, 19662, 30373, 26, 288, 291, 14, 1090, 59, 16, 61, 275, 446, 291, 14, 1090, 59, 16, 61, 15567, 347, 8344, 63, 66, 21749, 8, 277, 12, 373, 352, 304, 267, 291, 14, 1090, 275, 373, 352, 267, 340, 291, 14, 14990, 26, 288, 291, 14, 14990, 14, 2802, 342, 1467, 326, 272, 347, 365, 63, 270, 10112, 8, 277, 12, 410, 10112, 63, 66, 21749, 83, 304, 4960, 340, 291, 14, 1712, 59, 17, 61, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 26, 288, 372, 715, 267, 367, 282, 315, 410, 10112, 63, 66, 21749, 83, 26, 288, 340, 291, 14, 761, 8409, 8, 65, 304, 355, 372, 715, 267, 372, 756, 339, 347, 1048, 8409, 8, 277, 12, 330, 21749, 304, 267, 372, 2917, 8, 277, 14, 1712, 12, 330, 21749, 14, 1712, 9, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 10, 18, 267, 15567, 347, 5954, 8, 277, 12, 10218, 304, 267, 10218, 14, 5485, 63, 11001, 8, 277, 14, 1712, 12, 699, 2533, 34, 906, 63, 19662, 30373, 12, 413, 12, 298, 19803, 401, 291, 14, 2326, 9, 288, 199, 199, 3, 5627, 790, 5586, 370, 3304, 289, 16648, 63, 4593, 199, 318, 790, 2110, 8, 498, 304, 272, 2288, 282, 63, 66, 21749, 12, 289, 16648, 63, 4593, 63, 1090, 12, 330, 21749, 63, 270, 10112, 272, 340, 3486, 5885, 14, 3078, 63, 5443, 905, 2638, 937, 508, 790, 26, 267, 330, 21749, 63, 270, 10112, 275, 756, 267, 373, 352, 275, 9324, 63, 475, 63, 4106, 8, 1795, 316, 63, 4593, 9, 267, 282, 63, 66, 21749, 14, 8935, 63, 66, 21749, 779, 20, 627, 373, 352, 59, 16, 467, 446, 20, 627, 373, 352, 59, 17, 3934, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 3039, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 847, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 1019, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 4862, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 199, 199, 318, 790, 384, 8, 498, 304, 272, 2288, 289, 16648, 63, 4593, 63, 1090, 272, 340, 3486, 5885, 14, 3078, 63, 5443, 905, 3039, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 4862, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 1019, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 847, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 1362, 199, 3, 5627, 5954, 3016, 199, 318, 5954, 8, 7682, 304, 272, 2288, 289, 16648, 63, 4593, 12, 282, 63, 66, 21749, 12, 330, 21749, 63, 270, 10112, 2286, 327, 1678, 289, 16648, 9324, 272, 289, 16648, 63, 4593, 847, 289, 16648, 63, 4593, 63, 1090, 2286, 327, 5485, 289, 16648, 1004, 272, 25626, 275, 9324, 63, 475, 63, 4106, 8, 1795, 316, 63, 4593, 9, 272, 7008, 63, 6520, 275, 359, 1976, 25127, 63, 15717, 59, 16, 61, 435, 28137, 1206, 63, 6174, 63, 9127, 627, 25626, 59, 16, 467, 221, 1993, 28137, 1206, 63, 15717, 59, 17, 61, 446, 28137, 1206, 63, 6174, 63, 9127, 627, 25626, 59, 17, 2677, 272, 10218, 14, 5485, 63, 604, 8, 1976, 25127, 63, 15717, 12, 7008, 63, 6520, 12, 841, 12, 298, 19803, 531, 2286, 327, 1678, 282, 63, 66, 21749, 436, 1104, 367, 29404, 316, 272, 282, 63, 66, 21749, 14, 873, 342, 272, 340, 282, 63, 66, 21749, 14, 374, 63, 270, 10112, 8, 270, 10112, 63, 66, 21749, 83, 304, 267, 330, 21749, 63, 270, 10112, 275, 715, 267, 410, 10112, 63, 66, 21749, 83, 14, 525, 8, 65, 63, 66, 21749, 9, 267, 282, 63, 66, 21749, 275, 699, 21749, 8, 1795, 316, 63, 14990, 9, 5493, 327, 5954, 282, 330, 21749, 436, 410, 10112, 330, 21749, 83 ]
[ 10082, 28890, 6976, 367, 699, 21749, 428, 19112, 351, 199, 199, 646, 3486, 5885, 199, 646, 2196, 199, 646, 3473, 199, 199, 3, 13641, 5262, 199, 11139, 275, 23466, 199, 13509, 275, 11624, 199, 1976, 25127, 63, 15717, 275, 359, 11139, 5001, 499, 12, 8378, 2830, 61, 199, 1976, 25127, 63, 6174, 63, 9127, 275, 5212, 199, 1976, 25127, 63, 30421, 63, 10429, 63, 25205, 275, 378, 14, 996, 199, 34, 2533, 34, 906, 63, 19662, 30373, 275, 3388, 199, 7134, 63, 4924, 275, 2097, 10858, 401, 298, 19456, 401, 298, 15617, 401, 298, 19803, 937, 199, 199, 3, 2288, 2860, 199, 1795, 316, 63, 4593, 275, 3473, 14, 1038, 1182, 499, 199, 1795, 316, 63, 4593, 63, 1090, 275, 378, 199, 66, 21749, 63, 270, 10112, 275, 715, 199, 199, 3, 289, 16648, 20453, 199, 1795, 316, 63, 14990, 275, 3486, 5885, 14, 912, 63, 14990, 480, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 600, 1339, 348, 541, 269, 13, 12186, 15, 2001, 23656, 24, 13, 4734, 14, 24798, 531, 421, 199, 3, 5922, 3423, 370, 2429, 25947, 199, 318, 9324, 63, 475, 63, 4106, 8, 621, 304, 272, 372, 359, 3442, 14, 5197, 8, 621, 395, 3473, 14, 5911, 8, 621, 1874, 199, 199, 318, 2917, 8, 80, 12, 81, 304, 272, 372, 3473, 14, 5079, 1332, 80, 59, 16, 11285, 81, 59, 16, 566, 538, 18, 15622, 80, 59, 17, 11285, 81, 59, 17, 566, 538, 18, 9, 421, 199, 3, 1021, 347, 262, 296, 367, 699, 21749, 83, 199, 533, 699, 21749, 26, 2286, 347, 636, 826, 721, 277, 12, 20453, 275, 488, 304, 267, 291, 14, 1712, 275, 769, 8, 1976, 25127, 63, 15717, 9, 267, 291, 14, 1090, 275, 359, 16, 12, 378, 61, 267, 291, 14, 2326, 275, 2196, 14, 5095, 8, 7134, 63, 4924, 9, 267, 291, 14, 14990, 275, 20453, 5493, 347, 1678, 8, 277, 304, 267, 291, 14, 1712, 59, 16, 61, 847, 291, 14, 1090, 59, 16, 61, 267, 291, 14, 1712, 59, 17, 61, 847, 291, 14, 1090, 59, 17, 61, 267, 340, 291, 14, 1712, 59, 16, 61, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 503, 291, 14, 1712, 59, 16, 61, 2356, 644, 998, 2080, 446, 699, 2533, 34, 906, 63, 19662, 30373, 26, 288, 291, 14, 1090, 59, 16, 61, 275, 446, 291, 14, 1090, 59, 16, 61, 15567, 347, 8344, 63, 66, 21749, 8, 277, 12, 373, 352, 304, 267, 291, 14, 1090, 275, 373, 352, 267, 340, 291, 14, 14990, 26, 288, 291, 14, 14990, 14, 2802, 342, 1467, 326, 272, 347, 365, 63, 270, 10112, 8, 277, 12, 410, 10112, 63, 66, 21749, 83, 304, 4960, 340, 291, 14, 1712, 59, 17, 61, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 26, 288, 372, 715, 267, 367, 282, 315, 410, 10112, 63, 66, 21749, 83, 26, 288, 340, 291, 14, 761, 8409, 8, 65, 304, 355, 372, 715, 267, 372, 756, 339, 347, 1048, 8409, 8, 277, 12, 330, 21749, 304, 267, 372, 2917, 8, 277, 14, 1712, 12, 330, 21749, 14, 1712, 9, 2695, 699, 2533, 34, 906, 63, 19662, 30373, 10, 18, 267, 15567, 347, 5954, 8, 277, 12, 10218, 304, 267, 10218, 14, 5485, 63, 11001, 8, 277, 14, 1712, 12, 699, 2533, 34, 906, 63, 19662, 30373, 12, 413, 12, 298, 19803, 401, 291, 14, 2326, 9, 288, 199, 199, 3, 5627, 790, 5586, 370, 3304, 289, 16648, 63, 4593, 199, 318, 790, 2110, 8, 498, 304, 272, 2288, 282, 63, 66, 21749, 12, 289, 16648, 63, 4593, 63, 1090, 12, 330, 21749, 63, 270, 10112, 272, 340, 3486, 5885, 14, 3078, 63, 5443, 905, 2638, 937, 508, 790, 26, 267, 330, 21749, 63, 270, 10112, 275, 756, 267, 373, 352, 275, 9324, 63, 475, 63, 4106, 8, 1795, 316, 63, 4593, 9, 267, 282, 63, 66, 21749, 14, 8935, 63, 66, 21749, 779, 20, 627, 373, 352, 59, 16, 467, 446, 20, 627, 373, 352, 59, 17, 3934, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 3039, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 847, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 1019, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 4862, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 199, 199, 318, 790, 384, 8, 498, 304, 272, 2288, 289, 16648, 63, 4593, 63, 1090, 272, 340, 3486, 5885, 14, 3078, 63, 5443, 905, 3039, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 4862, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 272, 916, 3486, 5885, 14, 3078, 63, 5443, 905, 1019, 937, 508, 790, 26, 267, 289, 16648, 63, 4593, 63, 1090, 847, 28137, 1206, 63, 30421, 63, 10429, 63, 25205, 1362, 199, 3, 5627, 5954, 3016, 199, 318, 5954, 8, 7682, 304, 272, 2288, 289, 16648, 63, 4593, 12, 282, 63, 66, 21749, 12, 330, 21749, 63, 270, 10112, 2286, 327, 1678, 289, 16648, 9324, 272, 289, 16648, 63, 4593, 847, 289, 16648, 63, 4593, 63, 1090, 2286, 327, 5485, 289, 16648, 1004, 272, 25626, 275, 9324, 63, 475, 63, 4106, 8, 1795, 316, 63, 4593, 9, 272, 7008, 63, 6520, 275, 359, 1976, 25127, 63, 15717, 59, 16, 61, 435, 28137, 1206, 63, 6174, 63, 9127, 627, 25626, 59, 16, 467, 221, 1993, 28137, 1206, 63, 15717, 59, 17, 61, 446, 28137, 1206, 63, 6174, 63, 9127, 627, 25626, 59, 17, 2677, 272, 10218, 14, 5485, 63, 604, 8, 1976, 25127, 63, 15717, 12, 7008, 63, 6520, 12, 841, 12, 298, 19803, 531, 2286, 327, 1678, 282, 63, 66, 21749, 436, 1104, 367, 29404, 316, 272, 282, 63, 66, 21749, 14, 873, 342, 272, 340, 282, 63, 66, 21749, 14, 374, 63, 270, 10112, 8, 270, 10112, 63, 66, 21749, 83, 304, 267, 330, 21749, 63, 270, 10112, 275, 715, 267, 410, 10112, 63, 66, 21749, 83, 14, 525, 8, 65, 63, 66, 21749, 9, 267, 282, 63, 66, 21749, 275, 699, 21749, 8, 1795, 316, 63, 14990, 9, 5493, 327, 5954, 282, 330, 21749, 436, 410, 10112, 330, 21749, 83, 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,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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 ]
ubc/edx-platform
cms/djangoapps/contentstore/views/library.py
57
9271
""" Views related to content libraries. A content library is a structure containing XBlocks which can be re-used in the multiple courses. """ from __future__ import absolute_import import json import logging from contentstore.views.item import create_xblock_info from contentstore.utils import reverse_library_url, add_instructor from django.http import HttpResponseNotAllowed, Http404 from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.conf import settings from django.utils.translation import ugettext as _ from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import ensure_csrf_cookie from edxmako.shortcuts import render_to_response from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.locator import LibraryLocator, LibraryUsageLocator from xmodule.modulestore.exceptions import DuplicateCourseError from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from .user import user_with_role from .component import get_component_templates, CONTAINER_TEMPLATES from student.auth import ( STUDIO_VIEW_USERS, STUDIO_EDIT_ROLES, get_user_permissions, has_studio_read_access, has_studio_write_access ) from student.roles import CourseInstructorRole, CourseStaffRole, LibraryUserRole from util.json_request import expect_json, JsonResponse, JsonResponseBadRequest __all__ = ['library_handler', 'manage_library_users'] log = logging.getLogger(__name__) LIBRARIES_ENABLED = settings.FEATURES.get('ENABLE_CONTENT_LIBRARIES', False) @login_required @ensure_csrf_cookie @require_http_methods(('GET', 'POST')) def library_handler(request, library_key_string=None): """ RESTful interface to most content library related functionality. """ if not LIBRARIES_ENABLED: log.exception("Attempted to use the content library API when the libraries feature is disabled.") raise Http404 # Should never happen because we test the feature in urls.py also if library_key_string is not None and request.method == 'POST': return HttpResponseNotAllowed(("POST",)) if request.method == 'POST': return _create_library(request) # request method is get, since only GET and POST are allowed by @require_http_methods(('GET', 'POST')) if library_key_string: return _display_library(library_key_string, request) return _list_libraries(request) def _display_library(library_key_string, request): """ Displays single library """ library_key = CourseKey.from_string(library_key_string) if not isinstance(library_key, LibraryLocator): log.exception("Non-library key passed to content libraries API.") # Should never happen due to url regex raise Http404 # This is not a library if not has_studio_read_access(request.user, library_key): log.exception( u"User %s tried to access library %s without permission", request.user.username, unicode(library_key) ) raise PermissionDenied() library = modulestore().get_library(library_key) if library is None: log.exception(u"Library %s not found", unicode(library_key)) raise Http404 response_format = 'html' if ( request.REQUEST.get('format', 'html') == 'json' or 'application/json' in request.META.get('HTTP_ACCEPT', 'text/html') ): response_format = 'json' return library_blocks_view(library, request.user, response_format) def _list_libraries(request): """ List all accessible libraries """ lib_info = [ { "display_name": lib.display_name, "library_key": unicode(lib.location.library_key), } for lib in modulestore().get_libraries() if has_studio_read_access(request.user, lib.location.library_key) ] return JsonResponse(lib_info) @expect_json def _create_library(request): """ Helper method for creating a new library. """ display_name = None try: display_name = request.json['display_name'] org = request.json['org'] library = request.json.get('number', None) if library is None: library = request.json['library'] store = modulestore() with store.default_store(ModuleStoreEnum.Type.split): new_lib = store.create_library( org=org, library=library, user_id=request.user.id, fields={"display_name": display_name}, ) # Give the user admin ("Instructor") role for this library: add_instructor(new_lib.location.library_key, request.user, request.user) except KeyError as error: log.exception("Unable to create library - missing required JSON key.") return JsonResponseBadRequest({ "ErrMsg": _("Unable to create library - missing required field '{field}'").format(field=error.message) }) except InvalidKeyError as error: log.exception("Unable to create library - invalid key.") return JsonResponseBadRequest({ "ErrMsg": _("Unable to create library '{name}'.\n\n{err}").format(name=display_name, err=error.message) }) except DuplicateCourseError: log.exception("Unable to create library - one already exists with the same key.") return JsonResponseBadRequest({ 'ErrMsg': _( 'There is already a library defined with the same ' 'organization and library code. Please ' 'change your library code so that it is unique within your organization.' ) }) lib_key_str = unicode(new_lib.location.library_key) return JsonResponse({ 'url': reverse_library_url('library_handler', lib_key_str), 'library_key': lib_key_str, }) def library_blocks_view(library, user, response_format): """ The main view of a course's content library. Shows all the XBlocks in the library, and allows adding/editing/deleting them. Can be called with response_format="json" to get a JSON-formatted list of the XBlocks in the library along with library metadata. Assumes that read permissions have been checked before calling this. """ assert isinstance(library.location.library_key, LibraryLocator) assert isinstance(library.location, LibraryUsageLocator) children = library.children if response_format == "json": # The JSON response for this request is short and sweet: prev_version = library.runtime.course_entry.structure['previous_version'] return JsonResponse({ "display_name": library.display_name, "library_id": unicode(library.location.library_key), "version": unicode(library.runtime.course_entry.course_key.version), "previous_version": unicode(prev_version) if prev_version else None, "blocks": [unicode(x) for x in children], }) can_edit = has_studio_write_access(user, library.location.library_key) xblock_info = create_xblock_info(library, include_ancestor_info=False, graders=[]) component_templates = get_component_templates(library, library=True) if can_edit else [] return render_to_response('library.html', { 'can_edit': can_edit, 'context_library': library, 'component_templates': json.dumps(component_templates), 'xblock_info': xblock_info, 'templates': CONTAINER_TEMPLATES, }) def manage_library_users(request, library_key_string): """ Studio UI for editing the users within a library. Uses the /course_team/:library_key/:user_email/ REST API to make changes. """ library_key = CourseKey.from_string(library_key_string) if not isinstance(library_key, LibraryLocator): raise Http404 # This is not a library user_perms = get_user_permissions(request.user, library_key) if not user_perms & STUDIO_VIEW_USERS: raise PermissionDenied() library = modulestore().get_library(library_key) if library is None: raise Http404 # Segment all the users explicitly associated with this library, ensuring each user only has one role listed: instructors = set(CourseInstructorRole(library_key).users_with_role()) staff = set(CourseStaffRole(library_key).users_with_role()) - instructors users = set(LibraryUserRole(library_key).users_with_role()) - instructors - staff formatted_users = [] for user in instructors: formatted_users.append(user_with_role(user, 'instructor')) for user in staff: formatted_users.append(user_with_role(user, 'staff')) for user in users: formatted_users.append(user_with_role(user, 'library_user')) return render_to_response('manage_users_lib.html', { 'context_library': library, 'users': formatted_users, 'allow_actions': bool(user_perms & STUDIO_EDIT_ROLES), 'library_key': unicode(library_key), 'lib_users_url': reverse_library_url('manage_library_users', library_key_string), 'show_children_previews': library.show_children_previews })
agpl-3.0
[ 624, 199, 21180, 4048, 370, 1564, 8363, 14, 199, 33, 1564, 3555, 365, 282, 5523, 3035, 15398, 83, 1314, 883, 506, 295, 13, 2972, 315, 314, 199, 6048, 13588, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 2022, 199, 646, 2050, 199, 199, 504, 23061, 14, 4196, 14, 1053, 492, 1218, 63, 11283, 63, 815, 199, 504, 23061, 14, 1208, 492, 3837, 63, 4342, 63, 633, 12, 1050, 63, 14891, 199, 504, 1639, 14, 1014, 492, 6183, 29967, 12, 4760, 5188, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 1018, 14, 3924, 492, 23724, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1014, 492, 4409, 63, 1014, 63, 2474, 199, 504, 1639, 14, 4196, 14, 11582, 14, 10088, 492, 4868, 63, 10088, 63, 5306, 199, 504, 22435, 19491, 14, 17469, 492, 3795, 63, 475, 63, 1310, 199, 504, 15058, 63, 1612, 492, 6378, 10230, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 22574, 199, 504, 15058, 63, 1612, 14, 8268, 14, 6354, 492, 11243, 10725, 12, 11243, 7692, 10725, 199, 504, 9872, 14, 10012, 14, 3924, 492, 23942, 6979, 547, 199, 504, 9872, 14, 10012, 492, 23431, 199, 504, 9872, 14, 10012, 14, 1176, 492, 10996, 199, 504, 1275, 751, 492, 922, 63, 1045, 63, 3756, 199, 199, 504, 1275, 3173, 492, 664, 63, 3173, 63, 5876, 12, 1868, 6166, 568, 540, 63, 25437, 199, 504, 6474, 14, 1178, 492, 334, 272, 4384, 53, 19283, 63, 12058, 63, 28164, 12, 4384, 53, 19283, 63, 17929, 63, 6245, 654, 12, 664, 63, 751, 63, 6060, 12, 965, 63, 19806, 63, 739, 63, 2732, 12, 965, 63, 19806, 63, 952, 63, 2732, 199, 9, 199, 504, 6474, 14, 8050, 492, 5531, 30742, 7422, 12, 5531, 18963, 7422, 12, 11243, 1899, 7422, 199, 504, 4884, 14, 1001, 63, 1069, 492, 4282, 63, 1001, 12, 21072, 12, 21072, 12380, 199, 199, 363, 452, 363, 275, 788, 4342, 63, 2232, 297, 283, 9053, 63, 4342, 63, 3707, 418, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 32723, 63, 15704, 275, 2202, 14, 13313, 14, 362, 360, 8898, 63, 9663, 63, 32723, 297, 756, 9, 421, 199, 32, 2886, 63, 2427, 199, 32, 7505, 63, 10088, 63, 5306, 199, 32, 4365, 63, 1014, 63, 2474, 4725, 2970, 297, 283, 4030, 1333, 199, 318, 3555, 63, 2232, 8, 1069, 12, 3555, 63, 498, 63, 875, 29, 403, 304, 272, 408, 272, 14880, 1893, 3217, 370, 4750, 1564, 3555, 4048, 9330, 14, 272, 408, 272, 340, 440, 25764, 50, 25244, 63, 15704, 26, 267, 943, 14, 1971, 480, 15322, 471, 370, 675, 314, 1564, 3555, 3261, 1380, 314, 8363, 3878, 365, 6980, 2685, 267, 746, 4760, 5188, 221, 327, 7719, 7078, 5992, 2952, 781, 511, 314, 3878, 315, 8187, 14, 647, 2597, 339, 340, 3555, 63, 498, 63, 875, 365, 440, 488, 436, 1056, 14, 765, 508, 283, 4030, 356, 267, 372, 6183, 29967, 9313, 4030, 401, 430, 339, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 372, 485, 981, 63, 4342, 8, 1069, 9, 339, 327, 1056, 1083, 365, 664, 12, 3967, 1454, 9576, 436, 8761, 787, 4370, 701, 768, 4365, 63, 1014, 63, 2474, 4725, 2970, 297, 283, 4030, 1333, 272, 340, 3555, 63, 498, 63, 875, 26, 267, 372, 485, 2918, 63, 4342, 8, 4342, 63, 498, 63, 875, 12, 1056, 9, 339, 372, 485, 513, 63, 10159, 8, 1069, 9, 421, 199, 318, 485, 2918, 63, 4342, 8, 4342, 63, 498, 63, 875, 12, 1056, 304, 272, 408, 272, 28750, 2849, 3555, 272, 408, 272, 3555, 63, 498, 275, 22574, 14, 504, 63, 875, 8, 4342, 63, 498, 63, 875, 9, 272, 340, 440, 1228, 8, 4342, 63, 498, 12, 11243, 10725, 304, 267, 943, 14, 1971, 480, 6932, 13, 4342, 790, 3032, 370, 1564, 8363, 3261, 2685, 221, 327, 7719, 7078, 5992, 7037, 370, 1166, 5163, 267, 746, 4760, 5188, 221, 327, 961, 365, 440, 282, 3555, 272, 340, 440, 965, 63, 19806, 63, 739, 63, 2732, 8, 1069, 14, 751, 12, 3555, 63, 498, 304, 267, 943, 14, 1971, 8, 288, 399, 2, 1899, 450, 83, 16416, 370, 2879, 3555, 450, 83, 1928, 4983, 401, 288, 1056, 14, 751, 14, 2473, 12, 2649, 8, 4342, 63, 498, 9, 267, 776, 267, 746, 23724, 342, 339, 3555, 275, 10996, 1252, 362, 63, 4342, 8, 4342, 63, 498, 9, 272, 340, 3555, 365, 488, 26, 267, 943, 14, 1971, 8, 85, 2, 7424, 450, 83, 440, 1911, 401, 2649, 8, 4342, 63, 498, 430, 267, 746, 4760, 5188, 339, 1177, 63, 908, 275, 283, 1360, 7, 272, 340, 334, 288, 1056, 14, 6780, 14, 362, 360, 908, 297, 283, 1360, 358, 508, 283, 1001, 7, 503, 288, 283, 3578, 15, 1001, 7, 315, 1056, 14, 10614, 14, 362, 360, 2856, 63, 13089, 297, 283, 505, 15, 1360, 358, 272, 3461, 267, 1177, 63, 908, 275, 283, 1001, 7, 339, 372, 3555, 63, 4166, 63, 1345, 8, 4342, 12, 1056, 14, 751, 12, 1177, 63, 908, 9, 421, 199, 318, 485, 513, 63, 10159, 8, 1069, 304, 272, 408, 272, 3820, 1006, 17909, 8363, 272, 408, 272, 1973, 63, 815, 275, 359, 267, 469, 288, 298, 2918, 63, 354, 582, 1973, 14, 2918, 63, 354, 12, 288, 298, 4342, 63, 498, 582, 2649, 8, 773, 14, 1985, 14, 4342, 63, 498, 395, 267, 789, 267, 367, 1973, 315, 10996, 1252, 362, 63, 10159, 342, 267, 340, 965, 63, 19806, 63, 739, 63, 2732, 8, 1069, 14, 751, 12, 1973, 14, 1985, 14, 4342, 63, 498, 9, 272, 1622, 272, 372, 21072, 8, 773, 63, 815, 9, 421, 199, 32, 4921, 63, 1001, 199, 318, 485, 981, 63, 4342, 8, 1069, 304, 272, 408, 272, 11642, 1083, 367, 6425, 282, 892, 3555, 14, 272, 408, 272, 2929, 63, 354, 275, 488, 272, 862, 26, 267, 2929, 63, 354, 275, 1056, 14, 1001, 459, 2918, 63, 354, 418, 267, 5981, 275, 1056, 14, 1001, 459, 1308, 418, 267, 3555, 275 ]
[ 199, 21180, 4048, 370, 1564, 8363, 14, 199, 33, 1564, 3555, 365, 282, 5523, 3035, 15398, 83, 1314, 883, 506, 295, 13, 2972, 315, 314, 199, 6048, 13588, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 2022, 199, 646, 2050, 199, 199, 504, 23061, 14, 4196, 14, 1053, 492, 1218, 63, 11283, 63, 815, 199, 504, 23061, 14, 1208, 492, 3837, 63, 4342, 63, 633, 12, 1050, 63, 14891, 199, 504, 1639, 14, 1014, 492, 6183, 29967, 12, 4760, 5188, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 1018, 14, 3924, 492, 23724, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1014, 492, 4409, 63, 1014, 63, 2474, 199, 504, 1639, 14, 4196, 14, 11582, 14, 10088, 492, 4868, 63, 10088, 63, 5306, 199, 504, 22435, 19491, 14, 17469, 492, 3795, 63, 475, 63, 1310, 199, 504, 15058, 63, 1612, 492, 6378, 10230, 199, 504, 15058, 63, 1612, 14, 8268, 14, 1612, 492, 22574, 199, 504, 15058, 63, 1612, 14, 8268, 14, 6354, 492, 11243, 10725, 12, 11243, 7692, 10725, 199, 504, 9872, 14, 10012, 14, 3924, 492, 23942, 6979, 547, 199, 504, 9872, 14, 10012, 492, 23431, 199, 504, 9872, 14, 10012, 14, 1176, 492, 10996, 199, 504, 1275, 751, 492, 922, 63, 1045, 63, 3756, 199, 199, 504, 1275, 3173, 492, 664, 63, 3173, 63, 5876, 12, 1868, 6166, 568, 540, 63, 25437, 199, 504, 6474, 14, 1178, 492, 334, 272, 4384, 53, 19283, 63, 12058, 63, 28164, 12, 4384, 53, 19283, 63, 17929, 63, 6245, 654, 12, 664, 63, 751, 63, 6060, 12, 965, 63, 19806, 63, 739, 63, 2732, 12, 965, 63, 19806, 63, 952, 63, 2732, 199, 9, 199, 504, 6474, 14, 8050, 492, 5531, 30742, 7422, 12, 5531, 18963, 7422, 12, 11243, 1899, 7422, 199, 504, 4884, 14, 1001, 63, 1069, 492, 4282, 63, 1001, 12, 21072, 12, 21072, 12380, 199, 199, 363, 452, 363, 275, 788, 4342, 63, 2232, 297, 283, 9053, 63, 4342, 63, 3707, 418, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 32723, 63, 15704, 275, 2202, 14, 13313, 14, 362, 360, 8898, 63, 9663, 63, 32723, 297, 756, 9, 421, 199, 32, 2886, 63, 2427, 199, 32, 7505, 63, 10088, 63, 5306, 199, 32, 4365, 63, 1014, 63, 2474, 4725, 2970, 297, 283, 4030, 1333, 199, 318, 3555, 63, 2232, 8, 1069, 12, 3555, 63, 498, 63, 875, 29, 403, 304, 272, 408, 272, 14880, 1893, 3217, 370, 4750, 1564, 3555, 4048, 9330, 14, 272, 408, 272, 340, 440, 25764, 50, 25244, 63, 15704, 26, 267, 943, 14, 1971, 480, 15322, 471, 370, 675, 314, 1564, 3555, 3261, 1380, 314, 8363, 3878, 365, 6980, 2685, 267, 746, 4760, 5188, 221, 327, 7719, 7078, 5992, 2952, 781, 511, 314, 3878, 315, 8187, 14, 647, 2597, 339, 340, 3555, 63, 498, 63, 875, 365, 440, 488, 436, 1056, 14, 765, 508, 283, 4030, 356, 267, 372, 6183, 29967, 9313, 4030, 401, 430, 339, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 372, 485, 981, 63, 4342, 8, 1069, 9, 339, 327, 1056, 1083, 365, 664, 12, 3967, 1454, 9576, 436, 8761, 787, 4370, 701, 768, 4365, 63, 1014, 63, 2474, 4725, 2970, 297, 283, 4030, 1333, 272, 340, 3555, 63, 498, 63, 875, 26, 267, 372, 485, 2918, 63, 4342, 8, 4342, 63, 498, 63, 875, 12, 1056, 9, 339, 372, 485, 513, 63, 10159, 8, 1069, 9, 421, 199, 318, 485, 2918, 63, 4342, 8, 4342, 63, 498, 63, 875, 12, 1056, 304, 272, 408, 272, 28750, 2849, 3555, 272, 408, 272, 3555, 63, 498, 275, 22574, 14, 504, 63, 875, 8, 4342, 63, 498, 63, 875, 9, 272, 340, 440, 1228, 8, 4342, 63, 498, 12, 11243, 10725, 304, 267, 943, 14, 1971, 480, 6932, 13, 4342, 790, 3032, 370, 1564, 8363, 3261, 2685, 221, 327, 7719, 7078, 5992, 7037, 370, 1166, 5163, 267, 746, 4760, 5188, 221, 327, 961, 365, 440, 282, 3555, 272, 340, 440, 965, 63, 19806, 63, 739, 63, 2732, 8, 1069, 14, 751, 12, 3555, 63, 498, 304, 267, 943, 14, 1971, 8, 288, 399, 2, 1899, 450, 83, 16416, 370, 2879, 3555, 450, 83, 1928, 4983, 401, 288, 1056, 14, 751, 14, 2473, 12, 2649, 8, 4342, 63, 498, 9, 267, 776, 267, 746, 23724, 342, 339, 3555, 275, 10996, 1252, 362, 63, 4342, 8, 4342, 63, 498, 9, 272, 340, 3555, 365, 488, 26, 267, 943, 14, 1971, 8, 85, 2, 7424, 450, 83, 440, 1911, 401, 2649, 8, 4342, 63, 498, 430, 267, 746, 4760, 5188, 339, 1177, 63, 908, 275, 283, 1360, 7, 272, 340, 334, 288, 1056, 14, 6780, 14, 362, 360, 908, 297, 283, 1360, 358, 508, 283, 1001, 7, 503, 288, 283, 3578, 15, 1001, 7, 315, 1056, 14, 10614, 14, 362, 360, 2856, 63, 13089, 297, 283, 505, 15, 1360, 358, 272, 3461, 267, 1177, 63, 908, 275, 283, 1001, 7, 339, 372, 3555, 63, 4166, 63, 1345, 8, 4342, 12, 1056, 14, 751, 12, 1177, 63, 908, 9, 421, 199, 318, 485, 513, 63, 10159, 8, 1069, 304, 272, 408, 272, 3820, 1006, 17909, 8363, 272, 408, 272, 1973, 63, 815, 275, 359, 267, 469, 288, 298, 2918, 63, 354, 582, 1973, 14, 2918, 63, 354, 12, 288, 298, 4342, 63, 498, 582, 2649, 8, 773, 14, 1985, 14, 4342, 63, 498, 395, 267, 789, 267, 367, 1973, 315, 10996, 1252, 362, 63, 10159, 342, 267, 340, 965, 63, 19806, 63, 739, 63, 2732, 8, 1069, 14, 751, 12, 1973, 14, 1985, 14, 4342, 63, 498, 9, 272, 1622, 272, 372, 21072, 8, 773, 63, 815, 9, 421, 199, 32, 4921, 63, 1001, 199, 318, 485, 981, 63, 4342, 8, 1069, 304, 272, 408, 272, 11642, 1083, 367, 6425, 282, 892, 3555, 14, 272, 408, 272, 2929, 63, 354, 275, 488, 272, 862, 26, 267, 2929, 63, 354, 275, 1056, 14, 1001, 459, 2918, 63, 354, 418, 267, 5981, 275, 1056, 14, 1001, 459, 1308, 418, 267, 3555, 275, 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,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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 ]
LeoDepriester/Kodi-Pymote
xbmcjson/xbmcjson.py
2
2528
#!/bin/env python import urllib, urllib2 import json from StringIO import StringIO PLAYER_VIDEO=1 class XBMCTransport(object): """Base class for XBMC transport""" def execute(self, method, args): pass class XBMCJsonTransport(XBMCTransport): """HTTP Json transport""" def __init__(self, url, username='xbmc', password='xbmc'): self.url=url self.username=username self.password=password self.id = 0 def execute(self, method, *args, **kwargs): header = { 'Content-Type' : 'application/json', 'User-Agent' : 'python-xbmc' } # Params are given as a dictionnary if len(args) == 1: args=args[0] # Use kwargs for param=value style else: args = kwargs params={} params['jsonrpc']='2.0' params['id']=self.id self.id +=1 params['method']=method params['params']=args values=json.dumps(params) # HTTP Authentication password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() password_mgr.add_password(None, self.url, self.username, self.password) auth_handler = urllib2.HTTPBasicAuthHandler(password_mgr) opener = urllib2.build_opener(auth_handler) urllib2.install_opener(opener) data = values req = urllib2.Request(self.url, data, header) response = urllib2.urlopen(req) the_page = response.read() if len(the_page) > 0 : return json.load(StringIO(the_page)) else: return None # for readability class XBMC(object): """XBMC client""" def __init__(self, url, username='xbmc', password='xbmc'): self.transport = XBMCJsonTransport(url, username, password) # Dynamic namespace class instanciation for cl in namespaces: s = "self.%s = %s(self.transport)"%(cl,cl) exec(s) def execute(self, *args, **kwargs): self.transport.execute(*args, **kwargs) class XBMCNamespace(object): """Base class for XBMC namespace.""" def __init__(self, xbmc): self.xbmc = xbmc def __getattr__(self, name): klass= self.__class__.__name__ method=name xbmcmethod = "%s.%s"%(klass, method) def hook(*args, **kwargs): return self.xbmc.execute(xbmcmethod, *args, **kwargs) return hook # Dynamic namespace class injection namespaces = ["VideoLibrary", "AudioLibrary", "Application", "Player", "Input", "System", "Playlist", "Addons", "AudioLibrary", "Files", "GUI" , "JSONRPC", "PVR", "xbmc"] for cl in namespaces: s = """class %s(XBMCNamespace): \"\"\"XBMC %s namespace. \"\"\" pass """%(cl,cl) exec (s)
gpl-3.0
[ 3381, 1393, 15, 1813, 2366, 199, 199, 646, 4011, 12, 4011, 18, 199, 646, 2022, 199, 504, 5228, 492, 5228, 199, 199, 11625, 540, 63, 20142, 29, 17, 199, 199, 533, 1323, 15225, 1028, 4808, 8, 785, 304, 523, 408, 1563, 1021, 367, 1323, 28994, 7773, 624, 523, 347, 5341, 8, 277, 12, 1083, 12, 1249, 304, 272, 986, 199, 199, 533, 1323, 28994, 9653, 7836, 8, 56, 15225, 1028, 4808, 304, 523, 408, 2856, 14587, 7773, 624, 523, 347, 636, 826, 721, 277, 12, 1166, 12, 3434, 534, 21382, 297, 2505, 534, 21382, 735, 272, 291, 14, 633, 29, 633, 272, 291, 14, 2473, 29, 2473, 272, 291, 14, 2060, 29, 2060, 272, 291, 14, 344, 275, 378, 819, 347, 5341, 8, 277, 12, 1083, 12, 627, 589, 12, 1011, 958, 304, 272, 1406, 275, 469, 267, 283, 2714, 13, 804, 7, 520, 283, 3578, 15, 1001, 297, 267, 283, 1899, 13, 7788, 7, 520, 283, 1548, 13, 21382, 7, 267, 789, 272, 327, 30370, 787, 1627, 465, 282, 487, 414, 78, 695, 272, 340, 822, 8, 589, 9, 508, 413, 26, 489, 1249, 29, 589, 59, 16, 61, 272, 327, 3645, 2074, 367, 1215, 29, 585, 3449, 272, 587, 26, 489, 1249, 275, 2074, 272, 1862, 7622, 272, 1862, 459, 31395, 32373, 18, 14, 16, 7, 272, 1862, 459, 344, 13784, 277, 14, 344, 272, 291, 14, 344, 847, 17, 272, 1862, 459, 765, 13784, 765, 272, 1862, 459, 1162, 13784, 589, 339, 1338, 29, 1001, 14, 4180, 8, 1162, 9, 272, 327, 3101, 15995, 272, 2505, 63, 7755, 275, 4011, 18, 14, 2856, 6139, 20752, 3007, 2698, 27422, 342, 5591, 2505, 63, 7755, 14, 525, 63, 2060, 8, 403, 12, 291, 14, 633, 12, 291, 14, 2473, 12, 291, 14, 2060, 9, 5591, 1790, 63, 2232, 275, 4011, 18, 14, 2856, 6845, 21547, 8, 2060, 63, 7755, 9, 272, 16088, 275, 4011, 18, 14, 1506, 63, 11637, 8, 1178, 63, 2232, 9, 5591, 4011, 18, 14, 3174, 63, 11637, 8, 11637, 9, 339, 666, 275, 1338, 272, 2648, 275, 4011, 18, 14, 2017, 8, 277, 14, 633, 12, 666, 12, 1406, 9, 272, 1177, 275, 4011, 18, 14, 10890, 8, 2103, 9, 272, 314, 63, 1606, 275, 1177, 14, 739, 342, 272, 340, 822, 8, 1589, 63, 1606, 9, 690, 378, 520, 489, 372, 2022, 14, 912, 8, 6424, 8, 1589, 63, 1606, 430, 272, 587, 26, 489, 372, 488, 327, 367, 1586, 3616, 199, 199, 533, 1323, 28994, 8, 785, 304, 523, 408, 20806, 7608, 1890, 624, 523, 347, 636, 826, 721, 277, 12, 1166, 12, 3434, 534, 21382, 297, 2505, 534, 21382, 735, 272, 291, 14, 5545, 275, 1323, 28994, 9653, 7836, 8, 633, 12, 3434, 12, 2505, 9, 272, 327, 21907, 3231, 1021, 2727, 290, 559, 425, 272, 367, 824, 315, 10747, 26, 489, 308, 275, 298, 277, 4111, 83, 275, 450, 83, 8, 277, 14, 5545, 2924, 2840, 429, 12, 429, 9, 489, 2146, 8, 83, 9, 272, 347, 5341, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 489, 291, 14, 5545, 14, 2526, 2031, 589, 12, 1011, 958, 9, 199, 199, 533, 1323, 28994, 8814, 8, 785, 304, 523, 408, 1563, 1021, 367, 1323, 28994, 3231, 1041, 523, 347, 636, 826, 721, 277, 12, 11709, 304, 272, 291, 14, 21382, 275, 11709, 523, 347, 636, 5675, 721, 277, 12, 536, 304, 272, 8531, 29, 291, 855, 533, 4914, 354, 363, 272, 1083, 29, 354, 272, 11709, 765, 275, 2071, 83, 4111, 83, 14007, 11645, 12, 1083, 9, 272, 347, 5759, 2031, 589, 12, 1011, 958, 304, 489, 372, 291, 14, 21382, 14, 2526, 8, 21382, 765, 12, 627, 589, 12, 1011, 958, 9, 272, 372, 5759, 199, 199, 3, 21907, 3231, 1021, 315, 8923, 199, 9247, 275, 2097, 9166, 7424, 401, 298, 15484, 7424, 401, 298, 5039, 401, 298, 10921, 401, 298, 3205, 401, 298, 3989, 401, 298, 27259, 401, 298, 1123, 4654, 401, 298, 15484, 7424, 401, 298, 5535, 401, 298, 14438, 2, 2360, 298, 6243, 8171, 401, 298, 48, 20271, 401, 298, 21382, 937, 199, 509, 824, 315, 10747, 26, 523, 308, 275, 408, 533, 450, 83, 8, 20806, 7608, 8814, 304, 523, 971, 3212, 3212, 2, 20806, 7608, 450, 83, 3231, 14, 971, 3212, 3212, 2, 523, 986, 523, 408, 2840, 429, 12, 429, 9, 523, 2146, 334, 83, 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 ]
[ 1393, 15, 1813, 2366, 199, 199, 646, 4011, 12, 4011, 18, 199, 646, 2022, 199, 504, 5228, 492, 5228, 199, 199, 11625, 540, 63, 20142, 29, 17, 199, 199, 533, 1323, 15225, 1028, 4808, 8, 785, 304, 523, 408, 1563, 1021, 367, 1323, 28994, 7773, 624, 523, 347, 5341, 8, 277, 12, 1083, 12, 1249, 304, 272, 986, 199, 199, 533, 1323, 28994, 9653, 7836, 8, 56, 15225, 1028, 4808, 304, 523, 408, 2856, 14587, 7773, 624, 523, 347, 636, 826, 721, 277, 12, 1166, 12, 3434, 534, 21382, 297, 2505, 534, 21382, 735, 272, 291, 14, 633, 29, 633, 272, 291, 14, 2473, 29, 2473, 272, 291, 14, 2060, 29, 2060, 272, 291, 14, 344, 275, 378, 819, 347, 5341, 8, 277, 12, 1083, 12, 627, 589, 12, 1011, 958, 304, 272, 1406, 275, 469, 267, 283, 2714, 13, 804, 7, 520, 283, 3578, 15, 1001, 297, 267, 283, 1899, 13, 7788, 7, 520, 283, 1548, 13, 21382, 7, 267, 789, 272, 327, 30370, 787, 1627, 465, 282, 487, 414, 78, 695, 272, 340, 822, 8, 589, 9, 508, 413, 26, 489, 1249, 29, 589, 59, 16, 61, 272, 327, 3645, 2074, 367, 1215, 29, 585, 3449, 272, 587, 26, 489, 1249, 275, 2074, 272, 1862, 7622, 272, 1862, 459, 31395, 32373, 18, 14, 16, 7, 272, 1862, 459, 344, 13784, 277, 14, 344, 272, 291, 14, 344, 847, 17, 272, 1862, 459, 765, 13784, 765, 272, 1862, 459, 1162, 13784, 589, 339, 1338, 29, 1001, 14, 4180, 8, 1162, 9, 272, 327, 3101, 15995, 272, 2505, 63, 7755, 275, 4011, 18, 14, 2856, 6139, 20752, 3007, 2698, 27422, 342, 5591, 2505, 63, 7755, 14, 525, 63, 2060, 8, 403, 12, 291, 14, 633, 12, 291, 14, 2473, 12, 291, 14, 2060, 9, 5591, 1790, 63, 2232, 275, 4011, 18, 14, 2856, 6845, 21547, 8, 2060, 63, 7755, 9, 272, 16088, 275, 4011, 18, 14, 1506, 63, 11637, 8, 1178, 63, 2232, 9, 5591, 4011, 18, 14, 3174, 63, 11637, 8, 11637, 9, 339, 666, 275, 1338, 272, 2648, 275, 4011, 18, 14, 2017, 8, 277, 14, 633, 12, 666, 12, 1406, 9, 272, 1177, 275, 4011, 18, 14, 10890, 8, 2103, 9, 272, 314, 63, 1606, 275, 1177, 14, 739, 342, 272, 340, 822, 8, 1589, 63, 1606, 9, 690, 378, 520, 489, 372, 2022, 14, 912, 8, 6424, 8, 1589, 63, 1606, 430, 272, 587, 26, 489, 372, 488, 327, 367, 1586, 3616, 199, 199, 533, 1323, 28994, 8, 785, 304, 523, 408, 20806, 7608, 1890, 624, 523, 347, 636, 826, 721, 277, 12, 1166, 12, 3434, 534, 21382, 297, 2505, 534, 21382, 735, 272, 291, 14, 5545, 275, 1323, 28994, 9653, 7836, 8, 633, 12, 3434, 12, 2505, 9, 272, 327, 21907, 3231, 1021, 2727, 290, 559, 425, 272, 367, 824, 315, 10747, 26, 489, 308, 275, 298, 277, 4111, 83, 275, 450, 83, 8, 277, 14, 5545, 2924, 2840, 429, 12, 429, 9, 489, 2146, 8, 83, 9, 272, 347, 5341, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 489, 291, 14, 5545, 14, 2526, 2031, 589, 12, 1011, 958, 9, 199, 199, 533, 1323, 28994, 8814, 8, 785, 304, 523, 408, 1563, 1021, 367, 1323, 28994, 3231, 1041, 523, 347, 636, 826, 721, 277, 12, 11709, 304, 272, 291, 14, 21382, 275, 11709, 523, 347, 636, 5675, 721, 277, 12, 536, 304, 272, 8531, 29, 291, 855, 533, 4914, 354, 363, 272, 1083, 29, 354, 272, 11709, 765, 275, 2071, 83, 4111, 83, 14007, 11645, 12, 1083, 9, 272, 347, 5759, 2031, 589, 12, 1011, 958, 304, 489, 372, 291, 14, 21382, 14, 2526, 8, 21382, 765, 12, 627, 589, 12, 1011, 958, 9, 272, 372, 5759, 199, 199, 3, 21907, 3231, 1021, 315, 8923, 199, 9247, 275, 2097, 9166, 7424, 401, 298, 15484, 7424, 401, 298, 5039, 401, 298, 10921, 401, 298, 3205, 401, 298, 3989, 401, 298, 27259, 401, 298, 1123, 4654, 401, 298, 15484, 7424, 401, 298, 5535, 401, 298, 14438, 2, 2360, 298, 6243, 8171, 401, 298, 48, 20271, 401, 298, 21382, 937, 199, 509, 824, 315, 10747, 26, 523, 308, 275, 408, 533, 450, 83, 8, 20806, 7608, 8814, 304, 523, 971, 3212, 3212, 2, 20806, 7608, 450, 83, 3231, 14, 971, 3212, 3212, 2, 523, 986, 523, 408, 2840, 429, 12, 429, 9, 523, 2146, 334, 83, 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, 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,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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 ]
salamer/django
django/contrib/gis/db/backends/spatialite/introspection.py
391
3131
from django.contrib.gis.gdal import OGRGeomType from django.db.backends.sqlite3.introspection import ( DatabaseIntrospection, FlexibleFieldLookupDict, ) from django.utils import six class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): """ Sublcass that includes updates the `base_data_types_reverse` dict for geometry field types. """ base_data_types_reverse = FlexibleFieldLookupDict.base_data_types_reverse.copy() base_data_types_reverse.update( {'point': 'GeometryField', 'linestring': 'GeometryField', 'polygon': 'GeometryField', 'multipoint': 'GeometryField', 'multilinestring': 'GeometryField', 'multipolygon': 'GeometryField', 'geometrycollection': 'GeometryField', }) class SpatiaLiteIntrospection(DatabaseIntrospection): data_types_reverse = GeoFlexibleFieldLookupDict() def get_geometry_type(self, table_name, geo_col): cursor = self.connection.cursor() try: # Querying the `geometry_columns` table to get additional metadata. type_col = 'type' if self.connection.ops.spatial_version < (4, 0, 0) else 'geometry_type' cursor.execute('SELECT coord_dimension, srid, %s ' 'FROM geometry_columns ' 'WHERE f_table_name=%%s AND f_geometry_column=%%s' % type_col, (table_name, geo_col)) row = cursor.fetchone() if not row: raise Exception('Could not find a geometry column for "%s"."%s"' % (table_name, geo_col)) # OGRGeomType does not require GDAL and makes it easy to convert # from OGC geom type name to Django field. ogr_type = row[2] if isinstance(ogr_type, six.integer_types) and ogr_type > 1000: # Spatialite versions >= 4 use the new SFSQL 1.2 offsets # 1000 (Z), 2000 (M), and 3000 (ZM) to indicate the presence of # higher dimensional coordinates (M not yet supported by Django). ogr_type = ogr_type % 1000 + OGRGeomType.wkb25bit field_type = OGRGeomType(ogr_type).django # Getting any GeometryField keyword arguments that are not the default. dim = row[0] srid = row[1] field_params = {} if srid != 4326: field_params['srid'] = srid if (isinstance(dim, six.string_types) and 'Z' in dim) or dim == 3: field_params['dim'] = 3 finally: cursor.close() return field_type, field_params def get_indexes(self, cursor, table_name): indexes = super(SpatiaLiteIntrospection, self).get_indexes(cursor, table_name) cursor.execute('SELECT f_geometry_column ' 'FROM geometry_columns ' 'WHERE f_table_name=%s AND spatial_index_enabled=1', (table_name,)) for row in cursor.fetchall(): indexes[row[0]] = {'primary_key': False, 'unique': False} return indexes
bsd-3-clause
[ 504, 1639, 14, 2828, 14, 5668, 14, 11600, 492, 25756, 199, 504, 1639, 14, 697, 14, 7765, 14, 10659, 19, 14, 21627, 492, 334, 272, 8692, 30516, 12, 481, 8196, 792, 7521, 2141, 12, 199, 9, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 8875, 9389, 792, 7521, 2141, 8, 9389, 792, 7521, 2141, 304, 272, 408, 272, 4804, 10181, 405, 626, 6952, 7029, 314, 658, 1095, 63, 576, 63, 1313, 63, 4471, 64, 1211, 272, 367, 3400, 901, 2943, 14, 272, 408, 272, 1300, 63, 576, 63, 1313, 63, 4471, 275, 481, 8196, 792, 7521, 2141, 14, 1095, 63, 576, 63, 1313, 63, 4471, 14, 1574, 342, 272, 1300, 63, 576, 63, 1313, 63, 4471, 14, 873, 8, 267, 791, 1403, 356, 283, 6831, 792, 297, 268, 283, 604, 875, 356, 283, 6831, 792, 297, 268, 283, 16295, 356, 283, 6831, 792, 297, 268, 283, 3029, 1403, 356, 283, 6831, 792, 297, 268, 283, 21108, 875, 356, 283, 6831, 792, 297, 268, 283, 8016, 393, 6585, 356, 283, 6831, 792, 297, 268, 283, 7660, 3627, 356, 283, 6831, 792, 297, 268, 3828, 421, 199, 533, 25177, 30516, 8, 7243, 30516, 304, 272, 666, 63, 1313, 63, 4471, 275, 8875, 9389, 792, 7521, 2141, 342, 339, 347, 664, 63, 7660, 63, 466, 8, 277, 12, 1817, 63, 354, 12, 8509, 63, 761, 304, 267, 3920, 275, 291, 14, 2105, 14, 3937, 342, 267, 862, 26, 288, 327, 8133, 316, 314, 658, 7660, 63, 3406, 64, 1817, 370, 664, 4722, 3341, 14, 288, 730, 63, 761, 275, 283, 466, 7, 340, 291, 14, 2105, 14, 1483, 14, 11679, 63, 1023, 665, 334, 20, 12, 378, 12, 378, 9, 587, 283, 7660, 63, 466, 7, 288, 3920, 14, 2526, 360, 4859, 11021, 63, 7430, 12, 15627, 12, 450, 83, 283, 2574, 283, 12491, 3400, 63, 3406, 283, 2574, 283, 17688, 289, 63, 1224, 63, 354, 2458, 5, 83, 2401, 289, 63, 7660, 63, 2301, 2458, 5, 83, 7, 450, 730, 63, 761, 12, 2574, 334, 1224, 63, 354, 12, 8509, 63, 761, 430, 288, 1962, 275, 3920, 14, 11591, 342, 288, 340, 440, 1962, 26, 355, 746, 2186, 360, 6531, 440, 2342, 282, 3400, 2763, 367, 2071, 83, 1674, 6808, 83, 4507, 450, 1816, 334, 1224, 63, 354, 12, 8509, 63, 761, 430, 953, 327, 25756, 1630, 440, 4409, 15801, 436, 7704, 652, 8837, 370, 3957, 288, 327, 687, 593, 7484, 9671, 730, 536, 370, 5634, 901, 14, 288, 20713, 63, 466, 275, 1962, 59, 18, 61, 288, 340, 1228, 8, 14945, 63, 466, 12, 3816, 14, 4115, 63, 1313, 9, 436, 20713, 63, 466, 690, 5198, 26, 355, 327, 13423, 1175, 5459, 2356, 841, 675, 314, 892, 29531, 4657, 413, 14, 18, 15340, 355, 327, 5198, 334, 58, 395, 12293, 334, 45, 395, 436, 29664, 334, 58, 45, 9, 370, 6623, 314, 20024, 402, 355, 327, 10948, 28341, 8983, 334, 45, 440, 5966, 3748, 701, 5634, 680, 355, 20713, 63, 466, 275, 20713, 63, 466, 450, 5198, 435, 25756, 14, 18914, 821, 2075, 288, 901, 63, 466, 275, 25756, 8, 14945, 63, 466, 680, 1176, 953, 327, 20703, 1263, 30490, 4252, 2368, 626, 787, 440, 314, 849, 14, 288, 8134, 275, 1962, 59, 16, 61, 288, 15627, 275, 1962, 59, 17, 61, 288, 901, 63, 1162, 275, 1052, 288, 340, 15627, 1137, 26719, 26, 355, 901, 63, 1162, 459, 10498, 418, 275, 15627, 288, 340, 334, 6074, 8, 3572, 12, 3816, 14, 875, 63, 1313, 9, 436, 283, 58, 7, 315, 8134, 9, 503, 8134, 508, 650, 26, 355, 901, 63, 1162, 459, 3572, 418, 275, 650, 267, 3753, 26, 288, 3920, 14, 1600, 342, 398, 372, 901, 63, 466, 12, 901, 63, 1162, 339, 347, 664, 63, 10116, 8, 277, 12, 3920, 12, 1817, 63, 354, 304, 267, 10507, 275, 1613, 8, 12739, 23675, 30516, 12, 291, 680, 362, 63, 10116, 8, 3937, 12, 1817, 63, 354, 9, 267, 3920, 14, 2526, 360, 4859, 289, 63, 7660, 63, 2301, 283, 2432, 283, 12491, 3400, 63, 3406, 283, 2432, 283, 17688, 289, 63, 1224, 63, 354, 2458, 83, 2401, 11469, 63, 1080, 63, 3827, 29, 17, 297, 334, 1224, 63, 354, 4641, 267, 367, 1962, 315, 3920, 14, 10174, 837, 288, 10507, 59, 1143, 59, 16, 2677, 275, 791, 3327, 63, 498, 356, 756, 12, 283, 3235, 356, 756, 93, 267, 372, 10507, 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 ]
[ 1639, 14, 2828, 14, 5668, 14, 11600, 492, 25756, 199, 504, 1639, 14, 697, 14, 7765, 14, 10659, 19, 14, 21627, 492, 334, 272, 8692, 30516, 12, 481, 8196, 792, 7521, 2141, 12, 199, 9, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 8875, 9389, 792, 7521, 2141, 8, 9389, 792, 7521, 2141, 304, 272, 408, 272, 4804, 10181, 405, 626, 6952, 7029, 314, 658, 1095, 63, 576, 63, 1313, 63, 4471, 64, 1211, 272, 367, 3400, 901, 2943, 14, 272, 408, 272, 1300, 63, 576, 63, 1313, 63, 4471, 275, 481, 8196, 792, 7521, 2141, 14, 1095, 63, 576, 63, 1313, 63, 4471, 14, 1574, 342, 272, 1300, 63, 576, 63, 1313, 63, 4471, 14, 873, 8, 267, 791, 1403, 356, 283, 6831, 792, 297, 268, 283, 604, 875, 356, 283, 6831, 792, 297, 268, 283, 16295, 356, 283, 6831, 792, 297, 268, 283, 3029, 1403, 356, 283, 6831, 792, 297, 268, 283, 21108, 875, 356, 283, 6831, 792, 297, 268, 283, 8016, 393, 6585, 356, 283, 6831, 792, 297, 268, 283, 7660, 3627, 356, 283, 6831, 792, 297, 268, 3828, 421, 199, 533, 25177, 30516, 8, 7243, 30516, 304, 272, 666, 63, 1313, 63, 4471, 275, 8875, 9389, 792, 7521, 2141, 342, 339, 347, 664, 63, 7660, 63, 466, 8, 277, 12, 1817, 63, 354, 12, 8509, 63, 761, 304, 267, 3920, 275, 291, 14, 2105, 14, 3937, 342, 267, 862, 26, 288, 327, 8133, 316, 314, 658, 7660, 63, 3406, 64, 1817, 370, 664, 4722, 3341, 14, 288, 730, 63, 761, 275, 283, 466, 7, 340, 291, 14, 2105, 14, 1483, 14, 11679, 63, 1023, 665, 334, 20, 12, 378, 12, 378, 9, 587, 283, 7660, 63, 466, 7, 288, 3920, 14, 2526, 360, 4859, 11021, 63, 7430, 12, 15627, 12, 450, 83, 283, 2574, 283, 12491, 3400, 63, 3406, 283, 2574, 283, 17688, 289, 63, 1224, 63, 354, 2458, 5, 83, 2401, 289, 63, 7660, 63, 2301, 2458, 5, 83, 7, 450, 730, 63, 761, 12, 2574, 334, 1224, 63, 354, 12, 8509, 63, 761, 430, 288, 1962, 275, 3920, 14, 11591, 342, 288, 340, 440, 1962, 26, 355, 746, 2186, 360, 6531, 440, 2342, 282, 3400, 2763, 367, 2071, 83, 1674, 6808, 83, 4507, 450, 1816, 334, 1224, 63, 354, 12, 8509, 63, 761, 430, 953, 327, 25756, 1630, 440, 4409, 15801, 436, 7704, 652, 8837, 370, 3957, 288, 327, 687, 593, 7484, 9671, 730, 536, 370, 5634, 901, 14, 288, 20713, 63, 466, 275, 1962, 59, 18, 61, 288, 340, 1228, 8, 14945, 63, 466, 12, 3816, 14, 4115, 63, 1313, 9, 436, 20713, 63, 466, 690, 5198, 26, 355, 327, 13423, 1175, 5459, 2356, 841, 675, 314, 892, 29531, 4657, 413, 14, 18, 15340, 355, 327, 5198, 334, 58, 395, 12293, 334, 45, 395, 436, 29664, 334, 58, 45, 9, 370, 6623, 314, 20024, 402, 355, 327, 10948, 28341, 8983, 334, 45, 440, 5966, 3748, 701, 5634, 680, 355, 20713, 63, 466, 275, 20713, 63, 466, 450, 5198, 435, 25756, 14, 18914, 821, 2075, 288, 901, 63, 466, 275, 25756, 8, 14945, 63, 466, 680, 1176, 953, 327, 20703, 1263, 30490, 4252, 2368, 626, 787, 440, 314, 849, 14, 288, 8134, 275, 1962, 59, 16, 61, 288, 15627, 275, 1962, 59, 17, 61, 288, 901, 63, 1162, 275, 1052, 288, 340, 15627, 1137, 26719, 26, 355, 901, 63, 1162, 459, 10498, 418, 275, 15627, 288, 340, 334, 6074, 8, 3572, 12, 3816, 14, 875, 63, 1313, 9, 436, 283, 58, 7, 315, 8134, 9, 503, 8134, 508, 650, 26, 355, 901, 63, 1162, 459, 3572, 418, 275, 650, 267, 3753, 26, 288, 3920, 14, 1600, 342, 398, 372, 901, 63, 466, 12, 901, 63, 1162, 339, 347, 664, 63, 10116, 8, 277, 12, 3920, 12, 1817, 63, 354, 304, 267, 10507, 275, 1613, 8, 12739, 23675, 30516, 12, 291, 680, 362, 63, 10116, 8, 3937, 12, 1817, 63, 354, 9, 267, 3920, 14, 2526, 360, 4859, 289, 63, 7660, 63, 2301, 283, 2432, 283, 12491, 3400, 63, 3406, 283, 2432, 283, 17688, 289, 63, 1224, 63, 354, 2458, 83, 2401, 11469, 63, 1080, 63, 3827, 29, 17, 297, 334, 1224, 63, 354, 4641, 267, 367, 1962, 315, 3920, 14, 10174, 837, 288, 10507, 59, 1143, 59, 16, 2677, 275, 791, 3327, 63, 498, 356, 756, 12, 283, 3235, 356, 756, 93, 267, 372, 10507, 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, 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, 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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 ]
zhenv5/scikit-learn
sklearn/gaussian_process/regression_models.py
259
2166
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause """ The built-in regression models submodule for the gaussian_process module. """ import numpy as np def constant(x): """ Zero order polynomial (constant, p = 1) regression model. x --> f(x) = 1 Parameters ---------- x : array_like An array with shape (n_eval, n_features) giving the locations x at which the regression model should be evaluated. Returns ------- f : array_like An array with shape (n_eval, p) with the values of the regression model. """ x = np.asarray(x, dtype=np.float) n_eval = x.shape[0] f = np.ones([n_eval, 1]) return f def linear(x): """ First order polynomial (linear, p = n+1) regression model. x --> f(x) = [ 1, x_1, ..., x_n ].T Parameters ---------- x : array_like An array with shape (n_eval, n_features) giving the locations x at which the regression model should be evaluated. Returns ------- f : array_like An array with shape (n_eval, p) with the values of the regression model. """ x = np.asarray(x, dtype=np.float) n_eval = x.shape[0] f = np.hstack([np.ones([n_eval, 1]), x]) return f def quadratic(x): """ Second order polynomial (quadratic, p = n*(n-1)/2+n+1) regression model. x --> f(x) = [ 1, { x_i, i = 1,...,n }, { x_i * x_j, (i,j) = 1,...,n } ].T i > j Parameters ---------- x : array_like An array with shape (n_eval, n_features) giving the locations x at which the regression model should be evaluated. Returns ------- f : array_like An array with shape (n_eval, p) with the values of the regression model. """ x = np.asarray(x, dtype=np.float) n_eval, n_features = x.shape f = np.hstack([np.ones([n_eval, 1]), x]) for k in range(n_features): f = np.hstack([f, x[:, k, np.newaxis] * x[:, k:]]) return f
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 6529, 26, 28882, 2946, 577, 456, 567, 71, 665, 11908, 2946, 14, 68, 456, 567, 71, 32, 6799, 14, 957, 30, 199, 3, 260, 334, 2786, 590, 7761, 12, 1937, 4514, 2436, 9, 199, 3, 491, 530, 4894, 26, 6289, 650, 8502, 199, 199, 624, 199, 1918, 6137, 13, 262, 10864, 1709, 22988, 367, 314, 28912, 63, 1412, 859, 14, 199, 624, 421, 199, 646, 2680, 465, 980, 421, 199, 318, 4413, 8, 88, 304, 272, 408, 272, 15708, 1865, 11849, 334, 4083, 12, 299, 275, 413, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 413, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 272, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 275, 671, 14, 1392, 59, 16, 61, 272, 289, 275, 980, 14, 4548, 779, 78, 63, 2579, 12, 413, 566, 272, 372, 289, 421, 199, 318, 7798, 8, 88, 304, 272, 408, 272, 7758, 1865, 11849, 334, 6676, 12, 299, 275, 302, 11, 17, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 359, 413, 12, 671, 63, 17, 12, 14263, 671, 63, 78, 221, 1055, 52, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 272, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 275, 671, 14, 1392, 59, 16, 61, 272, 289, 275, 980, 14, 20949, 779, 1590, 14, 4548, 779, 78, 63, 2579, 12, 413, 2522, 671, 566, 272, 372, 289, 421, 199, 318, 16744, 19826, 8, 88, 304, 272, 408, 272, 16707, 1865, 11849, 334, 14567, 19826, 12, 299, 275, 302, 5830, 78, 13, 17, 2447, 18, 11, 78, 11, 17, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 359, 413, 12, 469, 671, 63, 73, 12, 284, 275, 413, 32699, 78, 1660, 469, 671, 63, 73, 627, 671, 63, 74, 12, 221, 334, 73, 12, 74, 9, 275, 413, 32699, 78, 789, 221, 1055, 52, 12933, 284, 690, 1335, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 339, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 12, 302, 63, 3179, 275, 671, 14, 1392, 272, 289, 275, 980, 14, 20949, 779, 1590, 14, 4548, 779, 78, 63, 2579, 12, 413, 2522, 671, 566, 272, 367, 1022, 315, 1425, 8, 78, 63, 3179, 304, 267, 289, 275, 980, 14, 20949, 779, 70, 12, 671, 3981, 1022, 12, 980, 14, 14483, 61, 627, 671, 3981, 1022, 2938, 566, 339, 372, 289, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 6529, 26, 28882, 2946, 577, 456, 567, 71, 665, 11908, 2946, 14, 68, 456, 567, 71, 32, 6799, 14, 957, 30, 199, 3, 260, 334, 2786, 590, 7761, 12, 1937, 4514, 2436, 9, 199, 3, 491, 530, 4894, 26, 6289, 650, 8502, 199, 199, 624, 199, 1918, 6137, 13, 262, 10864, 1709, 22988, 367, 314, 28912, 63, 1412, 859, 14, 199, 624, 421, 199, 646, 2680, 465, 980, 421, 199, 318, 4413, 8, 88, 304, 272, 408, 272, 15708, 1865, 11849, 334, 4083, 12, 299, 275, 413, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 413, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 272, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 275, 671, 14, 1392, 59, 16, 61, 272, 289, 275, 980, 14, 4548, 779, 78, 63, 2579, 12, 413, 566, 272, 372, 289, 421, 199, 318, 7798, 8, 88, 304, 272, 408, 272, 7758, 1865, 11849, 334, 6676, 12, 299, 275, 302, 11, 17, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 359, 413, 12, 671, 63, 17, 12, 14263, 671, 63, 78, 221, 1055, 52, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 272, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 275, 671, 14, 1392, 59, 16, 61, 272, 289, 275, 980, 14, 20949, 779, 1590, 14, 4548, 779, 78, 63, 2579, 12, 413, 2522, 671, 566, 272, 372, 289, 421, 199, 318, 16744, 19826, 8, 88, 304, 272, 408, 272, 16707, 1865, 11849, 334, 14567, 19826, 12, 299, 275, 302, 5830, 78, 13, 17, 2447, 18, 11, 78, 11, 17, 9, 10864, 1402, 14, 339, 671, 10541, 289, 8, 88, 9, 275, 359, 413, 12, 469, 671, 63, 73, 12, 284, 275, 413, 32699, 78, 1660, 469, 671, 63, 73, 627, 671, 63, 74, 12, 221, 334, 73, 12, 74, 9, 275, 413, 32699, 78, 789, 221, 1055, 52, 12933, 284, 690, 1335, 339, 3897, 272, 4143, 272, 671, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 302, 63, 3179, 9, 15131, 314, 9918, 671, 737, 267, 1314, 314, 10864, 1402, 1077, 506, 13006, 14, 339, 1803, 272, 5514, 272, 289, 520, 1625, 63, 2930, 267, 1626, 1625, 543, 2215, 334, 78, 63, 2579, 12, 299, 9, 543, 314, 1338, 402, 314, 10864, 267, 1402, 14, 272, 408, 339, 671, 275, 980, 14, 8748, 8, 88, 12, 2152, 29, 1590, 14, 1609, 9, 272, 302, 63, 2579, 12, 302, 63, 3179, 275, 671, 14, 1392, 272, 289, 275, 980, 14, 20949, 779, 1590, 14, 4548, 779, 78, 63, 2579, 12, 413, 2522, 671, 566, 272, 367, 1022, 315, 1425, 8, 78, 63, 3179, 304, 267, 289, 275, 980, 14, 20949, 779, 70, 12, 671, 3981, 1022, 12, 980, 14, 14483, 61, 627, 671, 3981, 1022, 2938, 566, 339, 372, 289, 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, 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, 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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 ]
noblisnsp/volatility
volatility/plugins/overlays/windows/win2003_sp0_x86_vtypes.py
58
288637
ntkrnlmp_types = { 'LIST_ENTRY64' : [ 0x10, { 'Flink' : [ 0x0, ['unsigned long long']], 'Blink' : [ 0x8, ['unsigned long long']], } ], 'LIST_ENTRY32' : [ 0x8, { 'Flink' : [ 0x0, ['unsigned long']], 'Blink' : [ 0x4, ['unsigned long']], } ], '__unnamed_100a' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], } ], '_ULARGE_INTEGER' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], 'u' : [ 0x0, ['__unnamed_100a']], 'QuadPart' : [ 0x0, ['unsigned long long']], } ], '_LIST_ENTRY' : [ 0x8, { 'Flink' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'Blink' : [ 0x4, ['pointer', ['_LIST_ENTRY']]], } ], '_IMAGE_NT_HEADERS' : [ 0xf8, { 'Signature' : [ 0x0, ['unsigned long']], 'FileHeader' : [ 0x4, ['_IMAGE_FILE_HEADER']], 'OptionalHeader' : [ 0x18, ['_IMAGE_OPTIONAL_HEADER']], } ], '__unnamed_101b' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], } ], '_LARGE_INTEGER' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], 'u' : [ 0x0, ['__unnamed_101b']], 'QuadPart' : [ 0x0, ['long long']], } ], '_LUID' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], } ], '_KPRCB' : [ 0xdd0, { 'MinorVersion' : [ 0x0, ['unsigned short']], 'MajorVersion' : [ 0x2, ['unsigned short']], 'CurrentThread' : [ 0x4, ['pointer', ['_KTHREAD']]], 'NextThread' : [ 0x8, ['pointer', ['_KTHREAD']]], 'IdleThread' : [ 0xc, ['pointer', ['_KTHREAD']]], 'Number' : [ 0x10, ['unsigned char']], 'Reserved' : [ 0x11, ['unsigned char']], 'BuildType' : [ 0x12, ['unsigned short']], 'SetMember' : [ 0x14, ['unsigned long']], 'CpuType' : [ 0x18, ['unsigned char']], 'CpuID' : [ 0x19, ['unsigned char']], 'CpuStep' : [ 0x1a, ['unsigned short']], 'ProcessorState' : [ 0x1c, ['_KPROCESSOR_STATE']], 'KernelReserved' : [ 0x33c, ['array', 16, ['unsigned long']]], 'HalReserved' : [ 0x37c, ['array', 16, ['unsigned long']]], 'PrcbPad0' : [ 0x3bc, ['array', 92, ['unsigned char']]], 'LockQueue' : [ 0x418, ['array', 16, ['_KSPIN_LOCK_QUEUE']]], 'PrcbPad1' : [ 0x498, ['array', 8, ['unsigned char']]], 'NpxThread' : [ 0x4a0, ['pointer', ['_KTHREAD']]], 'InterruptCount' : [ 0x4a4, ['unsigned long']], 'KernelTime' : [ 0x4a8, ['unsigned long']], 'UserTime' : [ 0x4ac, ['unsigned long']], 'DpcTime' : [ 0x4b0, ['unsigned long']], 'DebugDpcTime' : [ 0x4b4, ['unsigned long']], 'InterruptTime' : [ 0x4b8, ['unsigned long']], 'AdjustDpcThreshold' : [ 0x4bc, ['unsigned long']], 'PageColor' : [ 0x4c0, ['unsigned long']], 'SkipTick' : [ 0x4c4, ['unsigned char']], 'DebuggerSavedIRQL' : [ 0x4c5, ['unsigned char']], 'Spare1' : [ 0x4c6, ['array', 6, ['unsigned char']]], 'ParentNode' : [ 0x4cc, ['pointer', ['_KNODE']]], 'MultiThreadProcessorSet' : [ 0x4d0, ['unsigned long']], 'MultiThreadSetMaster' : [ 0x4d4, ['pointer', ['_KPRCB']]], 'ThreadStartCount' : [ 0x4d8, ['array', 2, ['unsigned long']]], 'CcFastReadNoWait' : [ 0x4e0, ['unsigned long']], 'CcFastReadWait' : [ 0x4e4, ['unsigned long']], 'CcFastReadNotPossible' : [ 0x4e8, ['unsigned long']], 'CcCopyReadNoWait' : [ 0x4ec, ['unsigned long']], 'CcCopyReadWait' : [ 0x4f0, ['unsigned long']], 'CcCopyReadNoWaitMiss' : [ 0x4f4, ['unsigned long']], 'KeAlignmentFixupCount' : [ 0x4f8, ['unsigned long']], 'SpareCounter0' : [ 0x4fc, ['unsigned long']], 'KeDcacheFlushCount' : [ 0x500, ['unsigned long']], 'KeExceptionDispatchCount' : [ 0x504, ['unsigned long']], 'KeFirstLevelTbFills' : [ 0x508, ['unsigned long']], 'KeFloatingEmulationCount' : [ 0x50c, ['unsigned long']], 'KeIcacheFlushCount' : [ 0x510, ['unsigned long']], 'KeSecondLevelTbFills' : [ 0x514, ['unsigned long']], 'KeSystemCalls' : [ 0x518, ['unsigned long']], 'SpareCounter1' : [ 0x51c, ['unsigned long']], 'PPLookasideList' : [ 0x520, ['array', 16, ['_PP_LOOKASIDE_LIST']]], 'PPNPagedLookasideList' : [ 0x5a0, ['array', 32, ['_PP_LOOKASIDE_LIST']]], 'PPPagedLookasideList' : [ 0x6a0, ['array', 32, ['_PP_LOOKASIDE_LIST']]], 'PacketBarrier' : [ 0x7a0, ['unsigned long']], 'ReverseStall' : [ 0x7a4, ['unsigned long']], 'IpiFrame' : [ 0x7a8, ['pointer', ['void']]], 'PrcbPad2' : [ 0x7ac, ['array', 52, ['unsigned char']]], 'CurrentPacket' : [ 0x7e0, ['array', 3, ['pointer', ['void']]]], 'TargetSet' : [ 0x7ec, ['unsigned long']], 'WorkerRoutine' : [ 0x7f0, ['pointer', ['void']]], 'IpiFrozen' : [ 0x7f4, ['unsigned long']], 'PrcbPad3' : [ 0x7f8, ['array', 40, ['unsigned char']]], 'RequestSummary' : [ 0x820, ['unsigned long']], 'SignalDone' : [ 0x824, ['pointer', ['_KPRCB']]], 'PrcbPad4' : [ 0x828, ['array', 56, ['unsigned char']]], 'DpcData' : [ 0x860, ['array', 2, ['_KDPC_DATA']]], 'DpcStack' : [ 0x888, ['pointer', ['void']]], 'MaximumDpcQueueDepth' : [ 0x88c, ['unsigned long']], 'DpcRequestRate' : [ 0x890, ['unsigned long']], 'MinimumDpcRate' : [ 0x894, ['unsigned long']], 'DpcInterruptRequested' : [ 0x898, ['unsigned char']], 'DpcThreadRequested' : [ 0x899, ['unsigned char']], 'DpcRoutineActive' : [ 0x89a, ['unsigned char']], 'DpcThreadActive' : [ 0x89b, ['unsigned char']], 'PrcbLock' : [ 0x89c, ['unsigned long']], 'DpcLastCount' : [ 0x8a0, ['unsigned long']], 'TimerHand' : [ 0x8a4, ['unsigned long']], 'TimerRequest' : [ 0x8a8, ['unsigned long']], 'DpcThread' : [ 0x8ac, ['pointer', ['void']]], 'DpcEvent' : [ 0x8b0, ['_KEVENT']], 'ThreadDpcEnable' : [ 0x8c0, ['unsigned char']], 'QuantumEnd' : [ 0x8c1, ['unsigned char']], 'PrcbPad50' : [ 0x8c2, ['unsigned char']], 'IdleSchedule' : [ 0x8c3, ['unsigned char']], 'DpcSetEventRequest' : [ 0x8c4, ['long']], 'PrcbPad5' : [ 0x8c8, ['array', 22, ['unsigned char']]], 'CallDpc' : [ 0x8e0, ['_KDPC']], 'PrcbPad7' : [ 0x900, ['array', 8, ['unsigned long']]], 'WaitListHead' : [ 0x920, ['_LIST_ENTRY']], 'ReadySummary' : [ 0x928, ['unsigned long']], 'SelectNextLast' : [ 0x92c, ['unsigned long']], 'DispatcherReadyListHead' : [ 0x930, ['array', 32, ['_LIST_ENTRY']]], 'DeferredReadyListHead' : [ 0xa30, ['_SINGLE_LIST_ENTRY']], 'PrcbPad72' : [ 0xa34, ['array', 11, ['unsigned long']]], 'ChainedInterruptList' : [ 0xa60, ['pointer', ['void']]], 'LookasideIrpFloat' : [ 0xa64, ['long']], 'SpareFields0' : [ 0xa68, ['array', 4, ['unsigned long']]], 'VendorString' : [ 0xa78, ['array', 13, ['unsigned char']]], 'InitialApicId' : [ 0xa85, ['unsigned char']], 'LogicalProcessorsPerPhysicalProcessor' : [ 0xa86, ['unsigned char']], 'MHz' : [ 0xa88, ['unsigned long']], 'FeatureBits' : [ 0xa8c, ['unsigned long']], 'UpdateSignature' : [ 0xa90, ['_LARGE_INTEGER']], 'IsrTime' : [ 0xa98, ['unsigned long long']], 'NpxSaveArea' : [ 0xaa0, ['_FX_SAVE_AREA']], 'PowerState' : [ 0xcb0, ['_PROCESSOR_POWER_STATE']], } ], '_KPCR' : [ 0xef0, { 'NtTib' : [ 0x0, ['_NT_TIB']], 'Used_ExceptionList' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'Used_StackBase' : [ 0x4, ['pointer', ['void']]], 'PerfGlobalGroupMask' : [ 0x8, ['pointer', ['void']]], 'TssCopy' : [ 0xc, ['pointer', ['void']]], 'ContextSwitches' : [ 0x10, ['unsigned long']], 'SetMemberCopy' : [ 0x14, ['unsigned long']], 'Used_Self' : [ 0x18, ['pointer', ['void']]], 'SelfPcr' : [ 0x1c, ['pointer', ['_KPCR']]], 'Prcb' : [ 0x20, ['pointer', ['_KPRCB']]], 'Irql' : [ 0x24, ['unsigned char']], 'IRR' : [ 0x28, ['unsigned long']], 'IrrActive' : [ 0x2c, ['unsigned long']], 'IDR' : [ 0x30, ['unsigned long']], 'KdVersionBlock' : [ 0x34, ['pointer', ['void']]], 'IDT' : [ 0x38, ['pointer', ['_KIDTENTRY']]], 'GDT' : [ 0x3c, ['pointer', ['_KGDTENTRY']]], 'TSS' : [ 0x40, ['pointer', ['_KTSS']]], 'MajorVersion' : [ 0x44, ['unsigned short']], 'MinorVersion' : [ 0x46, ['unsigned short']], 'SetMember' : [ 0x48, ['unsigned long']], 'StallScaleFactor' : [ 0x4c, ['unsigned long']], 'SpareUnused' : [ 0x50, ['unsigned char']], 'Number' : [ 0x51, ['unsigned char']], 'Spare0' : [ 0x52, ['unsigned char']], 'SecondLevelCacheAssociativity' : [ 0x53, ['unsigned char']], 'VdmAlert' : [ 0x54, ['unsigned long']], 'KernelReserved' : [ 0x58, ['array', 14, ['unsigned long']]], 'SecondLevelCacheSize' : [ 0x90, ['unsigned long']], 'HalReserved' : [ 0x94, ['array', 16, ['unsigned long']]], 'InterruptMode' : [ 0xd4, ['unsigned long']], 'Spare1' : [ 0xd8, ['unsigned char']], 'KernelReserved2' : [ 0xdc, ['array', 17, ['unsigned long']]], 'PrcbData' : [ 0x120, ['_KPRCB']], } ], '_KAPC' : [ 0x30, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'Spare0' : [ 0x4, ['unsigned long']], 'Thread' : [ 0x8, ['pointer', ['_KTHREAD']]], 'ApcListEntry' : [ 0xc, ['_LIST_ENTRY']], 'KernelRoutine' : [ 0x14, ['pointer', ['void']]], 'RundownRoutine' : [ 0x18, ['pointer', ['void']]], 'NormalRoutine' : [ 0x1c, ['pointer', ['void']]], 'NormalContext' : [ 0x20, ['pointer', ['void']]], 'SystemArgument1' : [ 0x24, ['pointer', ['void']]], 'SystemArgument2' : [ 0x28, ['pointer', ['void']]], 'ApcStateIndex' : [ 0x2c, ['unsigned char']], 'ApcMode' : [ 0x2d, ['unsigned char']], 'Inserted' : [ 0x2e, ['unsigned char']], } ], '_SINGLE_LIST_ENTRY' : [ 0x4, { 'Next' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_KTHREAD' : [ 0x1c8, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'MutantListHead' : [ 0x10, ['_LIST_ENTRY']], 'InitialStack' : [ 0x18, ['pointer', ['void']]], 'StackLimit' : [ 0x1c, ['pointer', ['void']]], 'KernelStack' : [ 0x20, ['pointer', ['void']]], 'ThreadLock' : [ 0x24, ['unsigned long']], 'ContextSwitches' : [ 0x28, ['unsigned long']], 'State' : [ 0x2c, ['unsigned char']], 'NpxState' : [ 0x2d, ['unsigned char']], 'WaitIrql' : [ 0x2e, ['unsigned char']], 'WaitMode' : [ 0x2f, ['unsigned char']], 'Teb' : [ 0x30, ['pointer', ['void']]], 'ApcState' : [ 0x34, ['_KAPC_STATE']], 'ApcQueueLock' : [ 0x4c, ['unsigned long']], 'WaitStatus' : [ 0x50, ['long']], 'WaitBlockList' : [ 0x54, ['pointer', ['_KWAIT_BLOCK']]], 'Alertable' : [ 0x58, ['unsigned char']], 'WaitNext' : [ 0x59, ['unsigned char']], 'WaitReason' : [ 0x5a, ['unsigned char']], 'Priority' : [ 0x5b, ['unsigned char']], 'EnableStackSwap' : [ 0x5c, ['unsigned char']], 'SwapBusy' : [ 0x5d, ['unsigned char']], 'Alerted' : [ 0x5e, ['array', 2, ['unsigned char']]], 'WaitListEntry' : [ 0x60, ['_LIST_ENTRY']], 'SwapListEntry' : [ 0x60, ['_SINGLE_LIST_ENTRY']], 'Queue' : [ 0x68, ['pointer', ['_KQUEUE']]], 'WaitTime' : [ 0x6c, ['unsigned long']], 'KernelApcDisable' : [ 0x70, ['short']], 'SpecialApcDisable' : [ 0x72, ['short']], 'CombinedApcDisable' : [ 0x70, ['unsigned long']], 'Timer' : [ 0x78, ['_KTIMER']], 'WaitBlock' : [ 0xa0, ['array', 4, ['_KWAIT_BLOCK']]], 'QueueListEntry' : [ 0x100, ['_LIST_ENTRY']], 'ApcStateIndex' : [ 0x108, ['unsigned char']], 'ApcQueueable' : [ 0x109, ['unsigned char']], 'Preempted' : [ 0x10a, ['unsigned char']], 'ProcessReadyQueue' : [ 0x10b, ['unsigned char']], 'KernelStackResident' : [ 0x10c, ['unsigned char']], 'Saturation' : [ 0x10d, ['unsigned char']], 'IdealProcessor' : [ 0x10e, ['unsigned char']], 'NextProcessor' : [ 0x10f, ['unsigned char']], 'BasePriority' : [ 0x110, ['unsigned char']], 'Spare4' : [ 0x111, ['unsigned char']], 'PriorityDecrement' : [ 0x112, ['unsigned char']], 'Quantum' : [ 0x113, ['unsigned char']], 'SystemAffinityActive' : [ 0x114, ['unsigned char']], 'PreviousMode' : [ 0x115, ['unsigned char']], 'ResourceIndex' : [ 0x116, ['unsigned char']], 'DisableBoost' : [ 0x117, ['unsigned char']], 'UserAffinity' : [ 0x118, ['unsigned long']], 'Process' : [ 0x11c, ['pointer', ['_KPROCESS']]], 'Affinity' : [ 0x120, ['unsigned long']], 'ServiceTable' : [ 0x124, ['pointer', ['void']]], 'ApcStatePointer' : [ 0x128, ['array', 2, ['pointer', ['_KAPC_STATE']]]], 'SavedApcState' : [ 0x130, ['_KAPC_STATE']], 'CallbackStack' : [ 0x148, ['pointer', ['void']]], 'Win32Thread' : [ 0x14c, ['pointer', ['void']]], 'TrapFrame' : [ 0x150, ['pointer', ['_KTRAP_FRAME']]], 'KernelTime' : [ 0x154, ['unsigned long']], 'UserTime' : [ 0x158, ['unsigned long']], 'StackBase' : [ 0x15c, ['pointer', ['void']]], 'SuspendApc' : [ 0x160, ['_KAPC']], 'SuspendSemaphore' : [ 0x190, ['_KSEMAPHORE']], 'TlsArray' : [ 0x1a4, ['pointer', ['void']]], 'LegoData' : [ 0x1a8, ['pointer', ['void']]], 'ThreadListEntry' : [ 0x1ac, ['_LIST_ENTRY']], 'LargeStack' : [ 0x1b4, ['unsigned char']], 'PowerState' : [ 0x1b5, ['unsigned char']], 'NpxIrql' : [ 0x1b6, ['unsigned char']], 'Spare5' : [ 0x1b7, ['unsigned char']], 'AutoAlignment' : [ 0x1b8, ['unsigned char']], 'Iopl' : [ 0x1b9, ['unsigned char']], 'FreezeCount' : [ 0x1ba, ['unsigned char']], 'SuspendCount' : [ 0x1bb, ['unsigned char']], 'Spare0' : [ 0x1bc, ['array', 1, ['unsigned char']]], 'UserIdealProcessor' : [ 0x1bd, ['unsigned char']], 'DeferredProcessor' : [ 0x1be, ['unsigned char']], 'AdjustReason' : [ 0x1bf, ['unsigned char']], 'AdjustIncrement' : [ 0x1c0, ['unsigned char']], 'Spare2' : [ 0x1c1, ['array', 3, ['unsigned char']]], } ], '_FAST_MUTEX' : [ 0x20, { 'Count' : [ 0x0, ['long']], 'Owner' : [ 0x4, ['pointer', ['_KTHREAD']]], 'Contention' : [ 0x8, ['unsigned long']], 'Event' : [ 0xc, ['_KEVENT']], 'OldIrql' : [ 0x1c, ['unsigned long']], } ], '_SLIST_HEADER' : [ 0x8, { 'Alignment' : [ 0x0, ['unsigned long long']], 'Next' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Depth' : [ 0x4, ['unsigned short']], 'Sequence' : [ 0x6, ['unsigned short']], } ], '_NPAGED_LOOKASIDE_LIST' : [ 0x100, { 'L' : [ 0x0, ['_GENERAL_LOOKASIDE']], 'Lock__ObsoleteButDoNotDelete' : [ 0x80, ['unsigned long']], } ], '_PAGED_LOOKASIDE_LIST' : [ 0x100, { 'L' : [ 0x0, ['_GENERAL_LOOKASIDE']], 'Lock__ObsoleteButDoNotDelete' : [ 0x80, ['_FAST_MUTEX']], } ], '_GENERAL_LOOKASIDE' : [ 0x80, { 'ListHead' : [ 0x0, ['_SLIST_HEADER']], 'Depth' : [ 0x8, ['unsigned short']], 'MaximumDepth' : [ 0xa, ['unsigned short']], 'TotalAllocates' : [ 0xc, ['unsigned long']], 'AllocateMisses' : [ 0x10, ['unsigned long']], 'AllocateHits' : [ 0x10, ['unsigned long']], 'TotalFrees' : [ 0x14, ['unsigned long']], 'FreeMisses' : [ 0x18, ['unsigned long']], 'FreeHits' : [ 0x18, ['unsigned long']], 'Type' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPool', 1: 'PagedPool', 2: 'NonPagedPoolMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'Tag' : [ 0x20, ['unsigned long']], 'Size' : [ 0x24, ['unsigned long']], 'Allocate' : [ 0x28, ['pointer', ['void']]], 'Free' : [ 0x2c, ['pointer', ['void']]], 'ListEntry' : [ 0x30, ['_LIST_ENTRY']], 'LastTotalAllocates' : [ 0x38, ['unsigned long']], 'LastAllocateMisses' : [ 0x3c, ['unsigned long']], 'LastAllocateHits' : [ 0x3c, ['unsigned long']], 'Future' : [ 0x40, ['array', 2, ['unsigned long']]], } ], '_EX_RUNDOWN_REF' : [ 0x4, { 'Count' : [ 0x0, ['unsigned long']], 'Ptr' : [ 0x0, ['pointer', ['void']]], } ], '_EX_FAST_REF' : [ 0x4, { 'Object' : [ 0x0, ['pointer', ['void']]], 'RefCnt' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], } ], '_EX_PUSH_LOCK' : [ 0x4, { 'Waiting' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Exclusive' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Shared' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], 'Ptr' : [ 0x0, ['pointer', ['void']]], } ], '_EX_PUSH_LOCK_WAIT_BLOCK' : [ 0x24, { 'WakeEvent' : [ 0x0, ['_KEVENT']], 'Next' : [ 0x10, ['pointer', ['_EX_PUSH_LOCK_WAIT_BLOCK']]], 'Last' : [ 0x14, ['pointer', ['_EX_PUSH_LOCK_WAIT_BLOCK']]], 'Previous' : [ 0x18, ['pointer', ['_EX_PUSH_LOCK_WAIT_BLOCK']]], 'ShareCount' : [ 0x1c, ['unsigned long']], 'Exclusive' : [ 0x20, ['unsigned char']], } ], '_EX_PUSH_LOCK_CACHE_AWARE' : [ 0x80, { 'Locks' : [ 0x0, ['array', 32, ['pointer', ['_EX_PUSH_LOCK']]]], } ], '_ETHREAD' : [ 0x260, { 'Tcb' : [ 0x0, ['_KTHREAD']], 'CreateTime' : [ 0x1c8, ['_LARGE_INTEGER']], 'NestedFaultCount' : [ 0x1c8, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'ApcNeeded' : [ 0x1c8, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ExitTime' : [ 0x1d0, ['_LARGE_INTEGER']], 'LpcReplyChain' : [ 0x1d0, ['_LIST_ENTRY']], 'KeyedWaitChain' : [ 0x1d0, ['_LIST_ENTRY']], 'ExitStatus' : [ 0x1d8, ['long']], 'OfsChain' : [ 0x1d8, ['pointer', ['void']]], 'PostBlockList' : [ 0x1dc, ['_LIST_ENTRY']], 'TerminationPort' : [ 0x1e4, ['pointer', ['_TERMINATION_PORT']]], 'ReaperLink' : [ 0x1e4, ['pointer', ['_ETHREAD']]], 'KeyedWaitValue' : [ 0x1e4, ['pointer', ['void']]], 'ActiveTimerListLock' : [ 0x1e8, ['unsigned long']], 'ActiveTimerListHead' : [ 0x1ec, ['_LIST_ENTRY']], 'Cid' : [ 0x1f4, ['_CLIENT_ID']], 'LpcReplySemaphore' : [ 0x1fc, ['_KSEMAPHORE']], 'KeyedWaitSemaphore' : [ 0x1fc, ['_KSEMAPHORE']], 'LpcReplyMessage' : [ 0x210, ['pointer', ['void']]], 'LpcWaitingOnPort' : [ 0x210, ['pointer', ['void']]], 'ImpersonationInfo' : [ 0x214, ['pointer', ['_PS_IMPERSONATION_INFORMATION']]], 'IrpList' : [ 0x218, ['_LIST_ENTRY']], 'TopLevelIrp' : [ 0x220, ['unsigned long']], 'DeviceToVerify' : [ 0x224, ['pointer', ['_DEVICE_OBJECT']]], 'ThreadsProcess' : [ 0x228, ['pointer', ['_EPROCESS']]], 'StartAddress' : [ 0x22c, ['pointer', ['void']]], 'Win32StartAddress' : [ 0x230, ['pointer', ['void']]], 'LpcReceivedMessageId' : [ 0x230, ['unsigned long']], 'ThreadListEntry' : [ 0x234, ['_LIST_ENTRY']], 'RundownProtect' : [ 0x23c, ['_EX_RUNDOWN_REF']], 'ThreadLock' : [ 0x240, ['_EX_PUSH_LOCK']], 'LpcReplyMessageId' : [ 0x244, ['unsigned long']], 'ReadClusterSize' : [ 0x248, ['unsigned long']], 'GrantedAccess' : [ 0x24c, ['unsigned long']], 'CrossThreadFlags' : [ 0x250, ['unsigned long']], 'Terminated' : [ 0x250, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DeadThread' : [ 0x250, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'HideFromDebugger' : [ 0x250, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ActiveImpersonationInfo' : [ 0x250, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'SystemThread' : [ 0x250, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'HardErrorsAreDisabled' : [ 0x250, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'BreakOnTermination' : [ 0x250, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'SkipCreationMsg' : [ 0x250, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'SkipTerminationMsg' : [ 0x250, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'SameThreadPassiveFlags' : [ 0x254, ['unsigned long']], 'ActiveExWorker' : [ 0x254, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ExWorkerCanWaitUser' : [ 0x254, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'MemoryMaker' : [ 0x254, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'KeyedEventInUse' : [ 0x254, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'SameThreadApcFlags' : [ 0x258, ['unsigned long']], 'LpcReceivedMsgIdValid' : [ 0x258, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'LpcExitThreadCalled' : [ 0x258, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'AddressSpaceOwner' : [ 0x258, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'ForwardClusterOnly' : [ 0x25c, ['unsigned char']], 'DisablePageFaultClustering' : [ 0x25d, ['unsigned char']], } ], '_EPROCESS' : [ 0x278, { 'Pcb' : [ 0x0, ['_KPROCESS']], 'ProcessLock' : [ 0x6c, ['_EX_PUSH_LOCK']], 'CreateTime' : [ 0x70, ['_LARGE_INTEGER']], 'ExitTime' : [ 0x78, ['_LARGE_INTEGER']], 'RundownProtect' : [ 0x80, ['_EX_RUNDOWN_REF']], 'UniqueProcessId' : [ 0x84, ['pointer', ['void']]], 'ActiveProcessLinks' : [ 0x88, ['_LIST_ENTRY']], 'QuotaUsage' : [ 0x90, ['array', 3, ['unsigned long']]], 'QuotaPeak' : [ 0x9c, ['array', 3, ['unsigned long']]], 'CommitCharge' : [ 0xa8, ['unsigned long']], 'PeakVirtualSize' : [ 0xac, ['unsigned long']], 'VirtualSize' : [ 0xb0, ['unsigned long']], 'SessionProcessLinks' : [ 0xb4, ['_LIST_ENTRY']], 'DebugPort' : [ 0xbc, ['pointer', ['void']]], 'ExceptionPort' : [ 0xc0, ['pointer', ['void']]], 'ObjectTable' : [ 0xc4, ['pointer', ['_HANDLE_TABLE']]], 'Token' : [ 0xc8, ['_EX_FAST_REF']], 'WorkingSetPage' : [ 0xcc, ['unsigned long']], 'AddressCreationLock' : [ 0xd0, ['_KGUARDED_MUTEX']], 'HyperSpaceLock' : [ 0xf0, ['unsigned long']], 'ForkInProgress' : [ 0xf4, ['pointer', ['_ETHREAD']]], 'HardwareTrigger' : [ 0xf8, ['unsigned long']], 'PhysicalVadRoot' : [ 0xfc, ['pointer', ['_MM_AVL_TABLE']]], 'CloneRoot' : [ 0x100, ['pointer', ['void']]], 'NumberOfPrivatePages' : [ 0x104, ['unsigned long']], 'NumberOfLockedPages' : [ 0x108, ['unsigned long']], 'Win32Process' : [ 0x10c, ['pointer', ['void']]], 'Job' : [ 0x110, ['pointer', ['_EJOB']]], 'SectionObject' : [ 0x114, ['pointer', ['void']]], 'SectionBaseAddress' : [ 0x118, ['pointer', ['void']]], 'QuotaBlock' : [ 0x11c, ['pointer', ['_EPROCESS_QUOTA_BLOCK']]], 'WorkingSetWatch' : [ 0x120, ['pointer', ['_PAGEFAULT_HISTORY']]], 'Win32WindowStation' : [ 0x124, ['pointer', ['void']]], 'InheritedFromUniqueProcessId' : [ 0x128, ['pointer', ['void']]], 'LdtInformation' : [ 0x12c, ['pointer', ['void']]], 'VadFreeHint' : [ 0x130, ['pointer', ['void']]], 'VdmObjects' : [ 0x134, ['pointer', ['void']]], 'DeviceMap' : [ 0x138, ['pointer', ['void']]], 'Spare0' : [ 0x13c, ['array', 3, ['pointer', ['void']]]], 'PageDirectoryPte' : [ 0x148, ['_HARDWARE_PTE']], 'Filler' : [ 0x148, ['unsigned long long']], 'Session' : [ 0x150, ['pointer', ['void']]], 'ImageFileName' : [ 0x154, ['array', 16, ['unsigned char']]], 'JobLinks' : [ 0x164, ['_LIST_ENTRY']], 'LockedPagesList' : [ 0x16c, ['pointer', ['void']]], 'ThreadListHead' : [ 0x170, ['_LIST_ENTRY']], 'SecurityPort' : [ 0x178, ['pointer', ['void']]], 'PaeTop' : [ 0x17c, ['pointer', ['void']]], 'ActiveThreads' : [ 0x180, ['unsigned long']], 'GrantedAccess' : [ 0x184, ['unsigned long']], 'DefaultHardErrorProcessing' : [ 0x188, ['unsigned long']], 'LastThreadExitStatus' : [ 0x18c, ['long']], 'Peb' : [ 0x190, ['pointer', ['_PEB']]], 'PrefetchTrace' : [ 0x194, ['_EX_FAST_REF']], 'ReadOperationCount' : [ 0x198, ['_LARGE_INTEGER']], 'WriteOperationCount' : [ 0x1a0, ['_LARGE_INTEGER']], 'OtherOperationCount' : [ 0x1a8, ['_LARGE_INTEGER']], 'ReadTransferCount' : [ 0x1b0, ['_LARGE_INTEGER']], 'WriteTransferCount' : [ 0x1b8, ['_LARGE_INTEGER']], 'OtherTransferCount' : [ 0x1c0, ['_LARGE_INTEGER']], 'CommitChargeLimit' : [ 0x1c8, ['unsigned long']], 'CommitChargePeak' : [ 0x1cc, ['unsigned long']], 'AweInfo' : [ 0x1d0, ['pointer', ['void']]], 'SeAuditProcessCreationInfo' : [ 0x1d4, ['_SE_AUDIT_PROCESS_CREATION_INFO']], 'Vm' : [ 0x1d8, ['_MMSUPPORT']], 'MmProcessLinks' : [ 0x238, ['_LIST_ENTRY']], 'ModifiedPageCount' : [ 0x240, ['unsigned long']], 'JobStatus' : [ 0x244, ['unsigned long']], 'Flags' : [ 0x248, ['unsigned long']], 'CreateReported' : [ 0x248, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'NoDebugInherit' : [ 0x248, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ProcessExiting' : [ 0x248, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ProcessDelete' : [ 0x248, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Wow64SplitPages' : [ 0x248, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'VmDeleted' : [ 0x248, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'OutswapEnabled' : [ 0x248, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'Outswapped' : [ 0x248, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'ForkFailed' : [ 0x248, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Wow64VaSpace4Gb' : [ 0x248, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'AddressSpaceInitialized' : [ 0x248, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned long')]], 'SetTimerResolution' : [ 0x248, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'BreakOnTermination' : [ 0x248, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'SessionCreationUnderway' : [ 0x248, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'WriteWatch' : [ 0x248, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'ProcessInSession' : [ 0x248, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'OverrideAddressSpace' : [ 0x248, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'HasAddressSpace' : [ 0x248, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'LaunchPrefetched' : [ 0x248, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'InjectInpageErrors' : [ 0x248, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'VmTopDown' : [ 0x248, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'ImageNotifyDone' : [ 0x248, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'PdeUpdateNeeded' : [ 0x248, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'VdmAllowed' : [ 0x248, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'Unused' : [ 0x248, ['BitField', dict(start_bit = 25, end_bit = 32, native_type='unsigned long')]], 'ExitStatus' : [ 0x24c, ['long']], 'NextPageColor' : [ 0x250, ['unsigned short']], 'SubSystemMinorVersion' : [ 0x252, ['unsigned char']], 'SubSystemMajorVersion' : [ 0x253, ['unsigned char']], 'SubSystemVersion' : [ 0x252, ['unsigned short']], 'PriorityClass' : [ 0x254, ['unsigned char']], 'VadRoot' : [ 0x258, ['_MM_AVL_TABLE']], } ], '_OBJECT_ATTRIBUTES' : [ 0x18, { 'Length' : [ 0x0, ['unsigned long']], 'RootDirectory' : [ 0x4, ['pointer', ['void']]], 'ObjectName' : [ 0x8, ['pointer', ['_UNICODE_STRING']]], 'Attributes' : [ 0xc, ['unsigned long']], 'SecurityDescriptor' : [ 0x10, ['pointer', ['void']]], 'SecurityQualityOfService' : [ 0x14, ['pointer', ['void']]], } ], '_OBJECT_TYPE' : [ 0x190, { 'Mutex' : [ 0x0, ['_ERESOURCE']], 'TypeList' : [ 0x38, ['_LIST_ENTRY']], 'Name' : [ 0x40, ['_UNICODE_STRING']], 'DefaultObject' : [ 0x48, ['pointer', ['void']]], 'Index' : [ 0x4c, ['unsigned long']], 'TotalNumberOfObjects' : [ 0x50, ['unsigned long']], 'TotalNumberOfHandles' : [ 0x54, ['unsigned long']], 'HighWaterNumberOfObjects' : [ 0x58, ['unsigned long']], 'HighWaterNumberOfHandles' : [ 0x5c, ['unsigned long']], 'TypeInfo' : [ 0x60, ['_OBJECT_TYPE_INITIALIZER']], 'Key' : [ 0xac, ['unsigned long']], 'ObjectLocks' : [ 0xb0, ['array', 4, ['_ERESOURCE']]], } ], '_OBJECT_HANDLE_INFORMATION' : [ 0x8, { 'HandleAttributes' : [ 0x0, ['unsigned long']], 'GrantedAccess' : [ 0x4, ['unsigned long']], } ], '_PERFINFO_GROUPMASK' : [ 0x20, { 'Masks' : [ 0x0, ['array', 8, ['unsigned long']]], } ], '_KGUARDED_MUTEX' : [ 0x20, { 'Count' : [ 0x0, ['long']], 'Owner' : [ 0x4, ['pointer', ['_KTHREAD']]], 'Contention' : [ 0x8, ['unsigned long']], 'Event' : [ 0xc, ['_KEVENT']], 'KernelApcDisable' : [ 0x1c, ['short']], 'SpecialApcDisable' : [ 0x1e, ['short']], 'CombinedApcDisable' : [ 0x1c, ['unsigned long']], } ], '_KLOCK_QUEUE_HANDLE' : [ 0xc, { 'LockQueue' : [ 0x0, ['_KSPIN_LOCK_QUEUE']], 'OldIrql' : [ 0x8, ['unsigned char']], } ], '_KPROCESS' : [ 0x6c, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'ProfileListHead' : [ 0x10, ['_LIST_ENTRY']], 'DirectoryTableBase' : [ 0x18, ['array', 2, ['unsigned long']]], 'LdtDescriptor' : [ 0x20, ['_KGDTENTRY']], 'Int21Descriptor' : [ 0x28, ['_KIDTENTRY']], 'IopmOffset' : [ 0x30, ['unsigned short']], 'Iopl' : [ 0x32, ['unsigned char']], 'Unused' : [ 0x33, ['unsigned char']], 'ActiveProcessors' : [ 0x34, ['unsigned long']], 'KernelTime' : [ 0x38, ['unsigned long']], 'UserTime' : [ 0x3c, ['unsigned long']], 'ReadyListHead' : [ 0x40, ['_LIST_ENTRY']], 'SwapListEntry' : [ 0x48, ['_SINGLE_LIST_ENTRY']], 'VdmTrapcHandler' : [ 0x4c, ['pointer', ['void']]], 'ThreadListHead' : [ 0x50, ['_LIST_ENTRY']], 'ProcessLock' : [ 0x58, ['unsigned long']], 'Affinity' : [ 0x5c, ['unsigned long']], 'StackCount' : [ 0x60, ['unsigned short']], 'BasePriority' : [ 0x62, ['unsigned char']], 'ThreadQuantum' : [ 0x63, ['unsigned char']], 'AutoAlignment' : [ 0x64, ['unsigned char']], 'State' : [ 0x65, ['unsigned char']], 'ThreadSeed' : [ 0x66, ['unsigned char']], 'DisableBoost' : [ 0x67, ['unsigned char']], 'PowerState' : [ 0x68, ['unsigned char']], 'DisableQuantum' : [ 0x69, ['unsigned char']], 'IdealNode' : [ 0x6a, ['unsigned char']], 'Spare' : [ 0x6b, ['unsigned char']], } ], '_KQUEUE' : [ 0x28, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'EntryListHead' : [ 0x10, ['_LIST_ENTRY']], 'CurrentCount' : [ 0x18, ['unsigned long']], 'MaximumCount' : [ 0x1c, ['unsigned long']], 'ThreadListHead' : [ 0x20, ['_LIST_ENTRY']], } ], '_KWAIT_BLOCK' : [ 0x18, { 'WaitListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Thread' : [ 0x8, ['pointer', ['_KTHREAD']]], 'Object' : [ 0xc, ['pointer', ['void']]], 'NextWaitBlock' : [ 0x10, ['pointer', ['_KWAIT_BLOCK']]], 'WaitKey' : [ 0x14, ['unsigned short']], 'WaitType' : [ 0x16, ['unsigned short']], } ], '_KTIMER' : [ 0x28, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'DueTime' : [ 0x10, ['_ULARGE_INTEGER']], 'TimerListEntry' : [ 0x18, ['_LIST_ENTRY']], 'Dpc' : [ 0x20, ['pointer', ['_KDPC']]], 'Period' : [ 0x24, ['long']], } ], '_KEVENT' : [ 0x10, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], } ], '__unnamed_1128' : [ 0x208, { 'FnArea' : [ 0x0, ['_FNSAVE_FORMAT']], 'FxArea' : [ 0x0, ['_FXSAVE_FORMAT']], } ], '_FX_SAVE_AREA' : [ 0x210, { 'U' : [ 0x0, ['__unnamed_1128']], 'NpxSavedCpu' : [ 0x208, ['unsigned long']], 'Cr0NpxState' : [ 0x20c, ['unsigned long']], } ], '__unnamed_1132' : [ 0x4, { 'Flink' : [ 0x0, ['unsigned long']], 'WsIndex' : [ 0x0, ['unsigned long']], 'Event' : [ 0x0, ['pointer', ['_KEVENT']]], 'ReadStatus' : [ 0x0, ['long']], 'NextStackPfn' : [ 0x0, ['_SINGLE_LIST_ENTRY']], } ], '__unnamed_1136' : [ 0x4, { 'Blink' : [ 0x0, ['unsigned long']], 'ShareCount' : [ 0x0, ['unsigned long']], } ], '__unnamed_1139' : [ 0x4, { 'ShortFlags' : [ 0x0, ['unsigned short']], 'ReferenceCount' : [ 0x2, ['unsigned short']], } ], '__unnamed_113b' : [ 0x4, { 'e1' : [ 0x0, ['_MMPFNENTRY']], 'e2' : [ 0x0, ['__unnamed_1139']], } ], '__unnamed_1144' : [ 0x4, { 'EntireFrame' : [ 0x0, ['unsigned long']], 'PteFrame' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 26, native_type='unsigned long')]], 'InPageError' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'VerifierAllocation' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'AweAllocation' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'LockCharged' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'KernelStack' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'MustBeCached' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_MMPFN' : [ 0x18, { 'u1' : [ 0x0, ['__unnamed_1132']], 'PteAddress' : [ 0x4, ['pointer', ['_MMPTE']]], 'u2' : [ 0x8, ['__unnamed_1136']], 'u3' : [ 0xc, ['__unnamed_113b']], 'OriginalPte' : [ 0x10, ['_MMPTE']], 'AweReferenceCount' : [ 0x10, ['long']], 'u4' : [ 0x14, ['__unnamed_1144']], } ], '__unnamed_114e' : [ 0x4, { 'Long' : [ 0x0, ['unsigned long']], 'Flush' : [ 0x0, ['_HARDWARE_PTE']], 'Hard' : [ 0x0, ['_MMPTE_HARDWARE']], 'Proto' : [ 0x0, ['_MMPTE_PROTOTYPE']], 'Soft' : [ 0x0, ['_MMPTE_SOFTWARE']], 'Trans' : [ 0x0, ['_MMPTE_TRANSITION']], 'Subsect' : [ 0x0, ['_MMPTE_SUBSECTION']], 'List' : [ 0x0, ['_MMPTE_LIST']], } ], '_MMPTE' : [ 0x4, { 'u' : [ 0x0, ['__unnamed_114e']], } ], '_MMPAGING_FILE' : [ 0x3c, { 'Size' : [ 0x0, ['unsigned long']], 'MaximumSize' : [ 0x4, ['unsigned long']], 'MinimumSize' : [ 0x8, ['unsigned long']], 'FreeSpace' : [ 0xc, ['unsigned long']], 'CurrentUsage' : [ 0x10, ['unsigned long']], 'PeakUsage' : [ 0x14, ['unsigned long']], 'HighestPage' : [ 0x18, ['unsigned long']], 'File' : [ 0x1c, ['pointer', ['_FILE_OBJECT']]], 'Entry' : [ 0x20, ['array', 2, ['pointer', ['_MMMOD_WRITER_MDL_ENTRY']]]], 'PageFileName' : [ 0x28, ['_UNICODE_STRING']], 'Bitmap' : [ 0x30, ['pointer', ['_RTL_BITMAP']]], 'PageFileNumber' : [ 0x34, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned long')]], 'ReferenceCount' : [ 0x34, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned long')]], 'BootPartition' : [ 0x34, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Reserved' : [ 0x34, ['BitField', dict(start_bit = 9, end_bit = 32, native_type='unsigned long')]], 'FileHandle' : [ 0x38, ['pointer', ['void']]], } ], '_EXCEPTION_RECORD64' : [ 0x98, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['unsigned long long']], 'ExceptionAddress' : [ 0x10, ['unsigned long long']], 'NumberParameters' : [ 0x18, ['unsigned long']], '__unusedAlignment' : [ 0x1c, ['unsigned long']], 'ExceptionInformation' : [ 0x20, ['array', 15, ['unsigned long long']]], } ], '_EXCEPTION_RECORD32' : [ 0x50, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['unsigned long']], 'ExceptionAddress' : [ 0xc, ['unsigned long']], 'NumberParameters' : [ 0x10, ['unsigned long']], 'ExceptionInformation' : [ 0x14, ['array', 15, ['unsigned long']]], } ], '_DBGKM_EXCEPTION64' : [ 0xa0, { 'ExceptionRecord' : [ 0x0, ['_EXCEPTION_RECORD64']], 'FirstChance' : [ 0x98, ['unsigned long']], } ], '_DBGKM_EXCEPTION32' : [ 0x54, { 'ExceptionRecord' : [ 0x0, ['_EXCEPTION_RECORD32']], 'FirstChance' : [ 0x50, ['unsigned long']], } ], '_DBGKD_LOAD_SYMBOLS64' : [ 0x28, { 'PathNameLength' : [ 0x0, ['unsigned long']], 'BaseOfDll' : [ 0x8, ['unsigned long long']], 'ProcessId' : [ 0x10, ['unsigned long long']], 'CheckSum' : [ 0x18, ['unsigned long']], 'SizeOfImage' : [ 0x1c, ['unsigned long']], 'UnloadSymbols' : [ 0x20, ['unsigned char']], } ], '_DBGKD_LOAD_SYMBOLS32' : [ 0x18, { 'PathNameLength' : [ 0x0, ['unsigned long']], 'BaseOfDll' : [ 0x4, ['unsigned long']], 'ProcessId' : [ 0x8, ['unsigned long']], 'CheckSum' : [ 0xc, ['unsigned long']], 'SizeOfImage' : [ 0x10, ['unsigned long']], 'UnloadSymbols' : [ 0x14, ['unsigned char']], } ], '_DBGKD_READ_MEMORY64' : [ 0x10, { 'TargetBaseAddress' : [ 0x0, ['unsigned long long']], 'TransferCount' : [ 0x8, ['unsigned long']], 'ActualBytesRead' : [ 0xc, ['unsigned long']], } ], '_DBGKD_READ_MEMORY32' : [ 0xc, { 'TargetBaseAddress' : [ 0x0, ['unsigned long']], 'TransferCount' : [ 0x4, ['unsigned long']], 'ActualBytesRead' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_MEMORY64' : [ 0x10, { 'TargetBaseAddress' : [ 0x0, ['unsigned long long']], 'TransferCount' : [ 0x8, ['unsigned long']], 'ActualBytesWritten' : [ 0xc, ['unsigned long']], } ], '_DBGKD_WRITE_MEMORY32' : [ 0xc, { 'TargetBaseAddress' : [ 0x0, ['unsigned long']], 'TransferCount' : [ 0x4, ['unsigned long']], 'ActualBytesWritten' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_BREAKPOINT64' : [ 0x10, { 'BreakPointAddress' : [ 0x0, ['unsigned long long']], 'BreakPointHandle' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_BREAKPOINT32' : [ 0x8, { 'BreakPointAddress' : [ 0x0, ['unsigned long']], 'BreakPointHandle' : [ 0x4, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO64' : [ 0x10, { 'IoAddress' : [ 0x0, ['unsigned long long']], 'DataSize' : [ 0x8, ['unsigned long']], 'DataValue' : [ 0xc, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO32' : [ 0xc, { 'DataSize' : [ 0x0, ['unsigned long']], 'IoAddress' : [ 0x4, ['unsigned long']], 'DataValue' : [ 0x8, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO_EXTENDED64' : [ 0x20, { 'DataSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['unsigned long']], 'BusNumber' : [ 0x8, ['unsigned long']], 'AddressSpace' : [ 0xc, ['unsigned long']], 'IoAddress' : [ 0x10, ['unsigned long long']], 'DataValue' : [ 0x18, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO_EXTENDED32' : [ 0x18, { 'DataSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['unsigned long']], 'BusNumber' : [ 0x8, ['unsigned long']], 'AddressSpace' : [ 0xc, ['unsigned long']], 'IoAddress' : [ 0x10, ['unsigned long']], 'DataValue' : [ 0x14, ['unsigned long']], } ], '_DBGKD_SET_SPECIAL_CALL32' : [ 0x4, { 'SpecialCall' : [ 0x0, ['unsigned long']], } ], '_DBGKD_SET_SPECIAL_CALL64' : [ 0x8, { 'SpecialCall' : [ 0x0, ['unsigned long long']], } ], '_DBGKD_SET_INTERNAL_BREAKPOINT32' : [ 0x8, { 'BreakpointAddress' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x4, ['unsigned long']], } ], '_DBGKD_SET_INTERNAL_BREAKPOINT64' : [ 0x10, { 'BreakpointAddress' : [ 0x0, ['unsigned long long']], 'Flags' : [ 0x8, ['unsigned long']], } ], '_DBGKD_GET_INTERNAL_BREAKPOINT64' : [ 0x20, { 'BreakpointAddress' : [ 0x0, ['unsigned long long']], 'Flags' : [ 0x8, ['unsigned long']], 'Calls' : [ 0xc, ['unsigned long']], 'MaxCallsPerPeriod' : [ 0x10, ['unsigned long']], 'MinInstructions' : [ 0x14, ['unsigned long']], 'MaxInstructions' : [ 0x18, ['unsigned long']], 'TotalInstructions' : [ 0x1c, ['unsigned long']], } ], '_DBGKD_GET_INTERNAL_BREAKPOINT32' : [ 0x1c, { 'BreakpointAddress' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x4, ['unsigned long']], 'Calls' : [ 0x8, ['unsigned long']], 'MaxCallsPerPeriod' : [ 0xc, ['unsigned long']], 'MinInstructions' : [ 0x10, ['unsigned long']], 'MaxInstructions' : [ 0x14, ['unsigned long']], 'TotalInstructions' : [ 0x18, ['unsigned long']], } ], '__unnamed_11ca' : [ 0x28, { 'ReadMemory' : [ 0x0, ['_DBGKD_READ_MEMORY64']], 'WriteMemory' : [ 0x0, ['_DBGKD_WRITE_MEMORY64']], 'GetContext' : [ 0x0, ['_DBGKD_GET_CONTEXT']], 'SetContext' : [ 0x0, ['_DBGKD_SET_CONTEXT']], 'WriteBreakPoint' : [ 0x0, ['_DBGKD_WRITE_BREAKPOINT64']], 'RestoreBreakPoint' : [ 0x0, ['_DBGKD_RESTORE_BREAKPOINT']], 'Continue' : [ 0x0, ['_DBGKD_CONTINUE']], 'Continue2' : [ 0x0, ['_DBGKD_CONTINUE2']], 'ReadWriteIo' : [ 0x0, ['_DBGKD_READ_WRITE_IO64']], 'ReadWriteIoExtended' : [ 0x0, ['_DBGKD_READ_WRITE_IO_EXTENDED64']], 'QuerySpecialCalls' : [ 0x0, ['_DBGKD_QUERY_SPECIAL_CALLS']], 'SetSpecialCall' : [ 0x0, ['_DBGKD_SET_SPECIAL_CALL64']], 'SetInternalBreakpoint' : [ 0x0, ['_DBGKD_SET_INTERNAL_BREAKPOINT64']], 'GetInternalBreakpoint' : [ 0x0, ['_DBGKD_GET_INTERNAL_BREAKPOINT64']], 'GetVersion64' : [ 0x0, ['_DBGKD_GET_VERSION64']], 'BreakPointEx' : [ 0x0, ['_DBGKD_BREAKPOINTEX']], 'ReadWriteMsr' : [ 0x0, ['_DBGKD_READ_WRITE_MSR']], 'SearchMemory' : [ 0x0, ['_DBGKD_SEARCH_MEMORY']], 'GetSetBusData' : [ 0x0, ['_DBGKD_GET_SET_BUS_DATA']], 'FillMemory' : [ 0x0, ['_DBGKD_FILL_MEMORY']], 'QueryMemory' : [ 0x0, ['_DBGKD_QUERY_MEMORY']], 'SwitchPartition' : [ 0x0, ['_DBGKD_SWITCH_PARTITION']], } ], '_DBGKD_MANIPULATE_STATE64' : [ 0x38, { 'ApiNumber' : [ 0x0, ['unsigned long']], 'ProcessorLevel' : [ 0x4, ['unsigned short']], 'Processor' : [ 0x6, ['unsigned short']], 'ReturnStatus' : [ 0x8, ['long']], 'u' : [ 0x10, ['__unnamed_11ca']], } ], '__unnamed_11d1' : [ 0x28, { 'ReadMemory' : [ 0x0, ['_DBGKD_READ_MEMORY32']], 'WriteMemory' : [ 0x0, ['_DBGKD_WRITE_MEMORY32']], 'ReadMemory64' : [ 0x0, ['_DBGKD_READ_MEMORY64']], 'WriteMemory64' : [ 0x0, ['_DBGKD_WRITE_MEMORY64']], 'GetContext' : [ 0x0, ['_DBGKD_GET_CONTEXT']], 'SetContext' : [ 0x0, ['_DBGKD_SET_CONTEXT']], 'WriteBreakPoint' : [ 0x0, ['_DBGKD_WRITE_BREAKPOINT32']], 'RestoreBreakPoint' : [ 0x0, ['_DBGKD_RESTORE_BREAKPOINT']], 'Continue' : [ 0x0, ['_DBGKD_CONTINUE']], 'Continue2' : [ 0x0, ['_DBGKD_CONTINUE2']], 'ReadWriteIo' : [ 0x0, ['_DBGKD_READ_WRITE_IO32']], 'ReadWriteIoExtended' : [ 0x0, ['_DBGKD_READ_WRITE_IO_EXTENDED32']], 'QuerySpecialCalls' : [ 0x0, ['_DBGKD_QUERY_SPECIAL_CALLS']], 'SetSpecialCall' : [ 0x0, ['_DBGKD_SET_SPECIAL_CALL32']], 'SetInternalBreakpoint' : [ 0x0, ['_DBGKD_SET_INTERNAL_BREAKPOINT32']], 'GetInternalBreakpoint' : [ 0x0, ['_DBGKD_GET_INTERNAL_BREAKPOINT32']], 'GetVersion32' : [ 0x0, ['_DBGKD_GET_VERSION32']], 'BreakPointEx' : [ 0x0, ['_DBGKD_BREAKPOINTEX']], 'ReadWriteMsr' : [ 0x0, ['_DBGKD_READ_WRITE_MSR']], 'SearchMemory' : [ 0x0, ['_DBGKD_SEARCH_MEMORY']], } ], '_DBGKD_MANIPULATE_STATE32' : [ 0x34, { 'ApiNumber' : [ 0x0, ['unsigned long']], 'ProcessorLevel' : [ 0x4, ['unsigned short']], 'Processor' : [ 0x6, ['unsigned short']], 'ReturnStatus' : [ 0x8, ['long']], 'u' : [ 0xc, ['__unnamed_11d1']], } ], '__unnamed_11e0' : [ 0x8, { 'FileOffset' : [ 0x0, ['_LARGE_INTEGER']], 'ActiveCount' : [ 0x0, ['unsigned short']], } ], '_VACB' : [ 0x18, { 'BaseAddress' : [ 0x0, ['pointer', ['void']]], 'SharedCacheMap' : [ 0x4, ['pointer', ['_SHARED_CACHE_MAP']]], 'Overlay' : [ 0x8, ['__unnamed_11e0']], 'LruList' : [ 0x10, ['_LIST_ENTRY']], } ], '_SHARED_CACHE_MAP' : [ 0x130, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteSize' : [ 0x2, ['short']], 'OpenCount' : [ 0x4, ['unsigned long']], 'FileSize' : [ 0x8, ['_LARGE_INTEGER']], 'BcbList' : [ 0x10, ['_LIST_ENTRY']], 'SectionSize' : [ 0x18, ['_LARGE_INTEGER']], 'ValidDataLength' : [ 0x20, ['_LARGE_INTEGER']], 'ValidDataGoal' : [ 0x28, ['_LARGE_INTEGER']], 'InitialVacbs' : [ 0x30, ['array', 4, ['pointer', ['_VACB']]]], 'Vacbs' : [ 0x40, ['pointer', ['pointer', ['_VACB']]]], 'FileObject' : [ 0x44, ['pointer', ['_FILE_OBJECT']]], 'ActiveVacb' : [ 0x48, ['pointer', ['_VACB']]], 'NeedToZero' : [ 0x4c, ['pointer', ['void']]], 'ActivePage' : [ 0x50, ['unsigned long']], 'NeedToZeroPage' : [ 0x54, ['unsigned long']], 'ActiveVacbSpinLock' : [ 0x58, ['unsigned long']], 'VacbActiveCount' : [ 0x5c, ['unsigned long']], 'DirtyPages' : [ 0x60, ['unsigned long']], 'SharedCacheMapLinks' : [ 0x64, ['_LIST_ENTRY']], 'Flags' : [ 0x6c, ['unsigned long']], 'Status' : [ 0x70, ['long']], 'Mbcb' : [ 0x74, ['pointer', ['_MBCB']]], 'Section' : [ 0x78, ['pointer', ['void']]], 'CreateEvent' : [ 0x7c, ['pointer', ['_KEVENT']]], 'WaitOnActiveCount' : [ 0x80, ['pointer', ['_KEVENT']]], 'PagesToWrite' : [ 0x84, ['unsigned long']], 'BeyondLastFlush' : [ 0x88, ['long long']], 'Callbacks' : [ 0x90, ['pointer', ['_CACHE_MANAGER_CALLBACKS']]], 'LazyWriteContext' : [ 0x94, ['pointer', ['void']]], 'PrivateList' : [ 0x98, ['_LIST_ENTRY']], 'LogHandle' : [ 0xa0, ['pointer', ['void']]], 'FlushToLsnRoutine' : [ 0xa4, ['pointer', ['void']]], 'DirtyPageThreshold' : [ 0xa8, ['unsigned long']], 'LazyWritePassCount' : [ 0xac, ['unsigned long']], 'UninitializeEvent' : [ 0xb0, ['pointer', ['_CACHE_UNINITIALIZE_EVENT']]], 'NeedToZeroVacb' : [ 0xb4, ['pointer', ['_VACB']]], 'BcbSpinLock' : [ 0xb8, ['unsigned long']], 'Reserved' : [ 0xbc, ['pointer', ['void']]], 'Event' : [ 0xc0, ['_KEVENT']], 'VacbPushLock' : [ 0xd0, ['_EX_PUSH_LOCK']], 'PrivateCacheMap' : [ 0xd8, ['_PRIVATE_CACHE_MAP']], } ], '_VACB_LEVEL_REFERENCE' : [ 0x8, { 'Reference' : [ 0x0, ['long']], 'SpecialReference' : [ 0x4, ['long']], } ], '__unnamed_1202' : [ 0x10, { 'FreeListsInUseUlong' : [ 0x0, ['array', 4, ['unsigned long']]], 'FreeListsInUseBytes' : [ 0x0, ['array', 16, ['unsigned char']]], } ], '__unnamed_1204' : [ 0x2, { 'FreeListsInUseTerminate' : [ 0x0, ['unsigned short']], 'DecommitCount' : [ 0x0, ['unsigned short']], } ], '_HEAP' : [ 0x588, { 'Entry' : [ 0x0, ['_HEAP_ENTRY']], 'Signature' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['unsigned long']], 'ForceFlags' : [ 0x10, ['unsigned long']], 'VirtualMemoryThreshold' : [ 0x14, ['unsigned long']], 'SegmentReserve' : [ 0x18, ['unsigned long']], 'SegmentCommit' : [ 0x1c, ['unsigned long']], 'DeCommitFreeBlockThreshold' : [ 0x20, ['unsigned long']], 'DeCommitTotalFreeThreshold' : [ 0x24, ['unsigned long']], 'TotalFreeSize' : [ 0x28, ['unsigned long']], 'MaximumAllocationSize' : [ 0x2c, ['unsigned long']], 'ProcessHeapsListIndex' : [ 0x30, ['unsigned short']], 'HeaderValidateLength' : [ 0x32, ['unsigned short']], 'HeaderValidateCopy' : [ 0x34, ['pointer', ['void']]], 'NextAvailableTagIndex' : [ 0x38, ['unsigned short']], 'MaximumTagIndex' : [ 0x3a, ['unsigned short']], 'TagEntries' : [ 0x3c, ['pointer', ['_HEAP_TAG_ENTRY']]], 'UCRSegments' : [ 0x40, ['pointer', ['_HEAP_UCR_SEGMENT']]], 'UnusedUnCommittedRanges' : [ 0x44, ['pointer', ['_HEAP_UNCOMMMTTED_RANGE']]], 'AlignRound' : [ 0x48, ['unsigned long']], 'AlignMask' : [ 0x4c, ['unsigned long']], 'VirtualAllocdBlocks' : [ 0x50, ['_LIST_ENTRY']], 'Segments' : [ 0x58, ['array', 64, ['pointer', ['_HEAP_SEGMENT']]]], 'u' : [ 0x158, ['__unnamed_1202']], 'u2' : [ 0x168, ['__unnamed_1204']], 'AllocatorBackTraceIndex' : [ 0x16a, ['unsigned short']], 'NonDedicatedListLength' : [ 0x16c, ['unsigned long']], 'LargeBlocksIndex' : [ 0x170, ['pointer', ['void']]], 'PseudoTagEntries' : [ 0x174, ['pointer', ['_HEAP_PSEUDO_TAG_ENTRY']]], 'FreeLists' : [ 0x178, ['array', 128, ['_LIST_ENTRY']]], 'LockVariable' : [ 0x578, ['pointer', ['_HEAP_LOCK']]], 'CommitRoutine' : [ 0x57c, ['pointer', ['void']]], 'FrontEndHeap' : [ 0x580, ['pointer', ['void']]], 'FrontHeapLockCount' : [ 0x584, ['unsigned short']], 'FrontEndHeapType' : [ 0x586, ['unsigned char']], 'LastSegmentIndex' : [ 0x587, ['unsigned char']], } ], '_HEAP_ENTRY' : [ 0x8, { 'Size' : [ 0x0, ['unsigned short']], 'PreviousSize' : [ 0x2, ['unsigned short']], 'SubSegmentCode' : [ 0x0, ['pointer', ['void']]], 'SmallTagIndex' : [ 0x4, ['unsigned char']], 'Flags' : [ 0x5, ['unsigned char']], 'UnusedBytes' : [ 0x6, ['unsigned char']], 'SegmentIndex' : [ 0x7, ['unsigned char']], } ], '_HEAP_SUBSEGMENT' : [ 0x20, { 'Bucket' : [ 0x0, ['pointer', ['void']]], 'UserBlocks' : [ 0x4, ['pointer', ['_HEAP_USERDATA_HEADER']]], 'AggregateExchg' : [ 0x8, ['_INTERLOCK_SEQ']], 'BlockSize' : [ 0x10, ['unsigned short']], 'FreeThreshold' : [ 0x12, ['unsigned short']], 'BlockCount' : [ 0x14, ['unsigned short']], 'SizeIndex' : [ 0x16, ['unsigned char']], 'AffinityIndex' : [ 0x17, ['unsigned char']], 'Alignment' : [ 0x10, ['array', 2, ['unsigned long']]], 'SFreeListEntry' : [ 0x18, ['_SINGLE_LIST_ENTRY']], 'Lock' : [ 0x1c, ['unsigned long']], } ], '_TOKEN' : [ 0xa8, { 'TokenSource' : [ 0x0, ['_TOKEN_SOURCE']], 'TokenId' : [ 0x10, ['_LUID']], 'AuthenticationId' : [ 0x18, ['_LUID']], 'ParentTokenId' : [ 0x20, ['_LUID']], 'ExpirationTime' : [ 0x28, ['_LARGE_INTEGER']], 'TokenLock' : [ 0x30, ['pointer', ['_ERESOURCE']]], 'AuditPolicy' : [ 0x38, ['_SEP_AUDIT_POLICY']], 'ModifiedId' : [ 0x40, ['_LUID']], 'SessionId' : [ 0x48, ['unsigned long']], 'UserAndGroupCount' : [ 0x4c, ['unsigned long']], 'RestrictedSidCount' : [ 0x50, ['unsigned long']], 'PrivilegeCount' : [ 0x54, ['unsigned long']], 'VariableLength' : [ 0x58, ['unsigned long']], 'DynamicCharged' : [ 0x5c, ['unsigned long']], 'DynamicAvailable' : [ 0x60, ['unsigned long']], 'DefaultOwnerIndex' : [ 0x64, ['unsigned long']], 'UserAndGroups' : [ 0x68, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'RestrictedSids' : [ 0x6c, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'PrimaryGroup' : [ 0x70, ['pointer', ['void']]], 'Privileges' : [ 0x74, ['pointer', ['_LUID_AND_ATTRIBUTES']]], 'DynamicPart' : [ 0x78, ['pointer', ['unsigned long']]], 'DefaultDacl' : [ 0x7c, ['pointer', ['_ACL']]], 'TokenType' : [ 0x80, ['Enumeration', dict(target = 'long', choices = {1: 'TokenPrimary', 2: 'TokenImpersonation'})]], 'ImpersonationLevel' : [ 0x84, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'TokenFlags' : [ 0x88, ['unsigned char']], 'TokenInUse' : [ 0x89, ['unsigned char']], 'ProxyData' : [ 0x8c, ['pointer', ['_SECURITY_TOKEN_PROXY_DATA']]], 'AuditData' : [ 0x90, ['pointer', ['_SECURITY_TOKEN_AUDIT_DATA']]], 'LogonSession' : [ 0x94, ['pointer', ['_SEP_LOGON_SESSION_REFERENCES']]], 'OriginatingLogonSession' : [ 0x98, ['_LUID']], 'VariablePart' : [ 0xa0, ['unsigned long']], } ], '_SEP_LOGON_SESSION_REFERENCES' : [ 0x18, { 'Next' : [ 0x0, ['pointer', ['_SEP_LOGON_SESSION_REFERENCES']]], 'LogonId' : [ 0x4, ['_LUID']], 'ReferenceCount' : [ 0xc, ['unsigned long']], 'Flags' : [ 0x10, ['unsigned long']], 'pDeviceMap' : [ 0x14, ['pointer', ['_DEVICE_MAP']]], } ], '_HEAP_UCR_SEGMENT' : [ 0x10, { 'Next' : [ 0x0, ['pointer', ['_HEAP_UCR_SEGMENT']]], 'ReservedSize' : [ 0x4, ['unsigned long']], 'CommittedSize' : [ 0x8, ['unsigned long']], 'filler' : [ 0xc, ['unsigned long']], } ], '_HMAP_TABLE' : [ 0x2000, { 'Table' : [ 0x0, ['array', 512, ['_HMAP_ENTRY']]], } ], '_ERESOURCE' : [ 0x38, { 'SystemResourcesList' : [ 0x0, ['_LIST_ENTRY']], 'OwnerTable' : [ 0x8, ['pointer', ['_OWNER_ENTRY']]], 'ActiveCount' : [ 0xc, ['short']], 'Flag' : [ 0xe, ['unsigned short']], 'SharedWaiters' : [ 0x10, ['pointer', ['_KSEMAPHORE']]], 'ExclusiveWaiters' : [ 0x14, ['pointer', ['_KEVENT']]], 'OwnerThreads' : [ 0x18, ['array', 2, ['_OWNER_ENTRY']]], 'ContentionCount' : [ 0x28, ['unsigned long']], 'NumberOfSharedWaiters' : [ 0x2c, ['unsigned short']], 'NumberOfExclusiveWaiters' : [ 0x2e, ['unsigned short']], 'Address' : [ 0x30, ['pointer', ['void']]], 'CreatorBackTraceIndex' : [ 0x30, ['unsigned long']], 'SpinLock' : [ 0x34, ['unsigned long']], } ], '_OBJECT_SYMBOLIC_LINK' : [ 0x20, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LinkTarget' : [ 0x8, ['_UNICODE_STRING']], 'LinkTargetRemaining' : [ 0x10, ['_UNICODE_STRING']], 'LinkTargetObject' : [ 0x18, ['pointer', ['void']]], 'DosDeviceDriveIndex' : [ 0x1c, ['unsigned long']], } ], '_POOL_BLOCK_HEAD' : [ 0x10, { 'Header' : [ 0x0, ['_POOL_HEADER']], 'List' : [ 0x8, ['_LIST_ENTRY']], } ], '_DISPATCHER_HEADER' : [ 0x10, { 'Type' : [ 0x0, ['unsigned char']], 'Absolute' : [ 0x1, ['unsigned char']], 'Size' : [ 0x2, ['unsigned char']], 'Inserted' : [ 0x3, ['unsigned char']], 'DebugActive' : [ 0x3, ['unsigned char']], 'Lock' : [ 0x0, ['long']], 'SignalState' : [ 0x4, ['long']], 'WaitListHead' : [ 0x8, ['_LIST_ENTRY']], } ], '_LDR_DATA_TABLE_ENTRY' : [ 0x50, { 'InLoadOrderLinks' : [ 0x0, ['_LIST_ENTRY']], 'InMemoryOrderLinks' : [ 0x8, ['_LIST_ENTRY']], 'InInitializationOrderLinks' : [ 0x10, ['_LIST_ENTRY']], 'DllBase' : [ 0x18, ['pointer', ['void']]], 'EntryPoint' : [ 0x1c, ['pointer', ['void']]], 'SizeOfImage' : [ 0x20, ['unsigned long']], 'FullDllName' : [ 0x24, ['_UNICODE_STRING']], 'BaseDllName' : [ 0x2c, ['_UNICODE_STRING']], 'Flags' : [ 0x34, ['unsigned long']], 'LoadCount' : [ 0x38, ['unsigned short']], 'TlsIndex' : [ 0x3a, ['unsigned short']], 'HashLinks' : [ 0x3c, ['_LIST_ENTRY']], 'SectionPointer' : [ 0x3c, ['pointer', ['void']]], 'CheckSum' : [ 0x40, ['unsigned long']], 'TimeDateStamp' : [ 0x44, ['unsigned long']], 'LoadedImports' : [ 0x44, ['pointer', ['void']]], 'EntryPointActivationContext' : [ 0x48, ['pointer', ['_ACTIVATION_CONTEXT']]], 'PatchInformation' : [ 0x4c, ['pointer', ['void']]], } ], '_HEAP_UNCOMMMTTED_RANGE' : [ 0x10, { 'Next' : [ 0x0, ['pointer', ['_HEAP_UNCOMMMTTED_RANGE']]], 'Address' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], 'filler' : [ 0xc, ['unsigned long']], } ], '_LUID_AND_ATTRIBUTES' : [ 0xc, { 'Luid' : [ 0x0, ['_LUID']], 'Attributes' : [ 0x8, ['unsigned long']], } ], '_VI_DEADLOCK_GLOBALS' : [ 0x128, { 'Nodes' : [ 0x0, ['array', 2, ['unsigned long']]], 'Resources' : [ 0x8, ['array', 2, ['unsigned long']]], 'Threads' : [ 0x10, ['array', 2, ['unsigned long']]], 'TimeAcquire' : [ 0x18, ['long long']], 'TimeRelease' : [ 0x20, ['long long']], 'BytesAllocated' : [ 0x28, ['unsigned long']], 'ResourceDatabase' : [ 0x2c, ['pointer', ['_LIST_ENTRY']]], 'ThreadDatabase' : [ 0x30, ['pointer', ['_LIST_ENTRY']]], 'AllocationFailures' : [ 0x34, ['unsigned long']], 'NodesTrimmedBasedOnAge' : [ 0x38, ['unsigned long']], 'NodesTrimmedBasedOnCount' : [ 0x3c, ['unsigned long']], 'NodesSearched' : [ 0x40, ['unsigned long']], 'MaxNodesSearched' : [ 0x44, ['unsigned long']], 'SequenceNumber' : [ 0x48, ['unsigned long']], 'RecursionDepthLimit' : [ 0x4c, ['unsigned long']], 'SearchedNodesLimit' : [ 0x50, ['unsigned long']], 'DepthLimitHits' : [ 0x54, ['unsigned long']], 'SearchLimitHits' : [ 0x58, ['unsigned long']], 'ABC_ACB_Skipped' : [ 0x5c, ['unsigned long']], 'OutOfOrderReleases' : [ 0x60, ['unsigned long']], 'NodesReleasedOutOfOrder' : [ 0x64, ['unsigned long']], 'TotalReleases' : [ 0x68, ['unsigned long']], 'RootNodesDeleted' : [ 0x6c, ['unsigned long']], 'ForgetHistoryCounter' : [ 0x70, ['unsigned long']], 'PoolTrimCounter' : [ 0x74, ['unsigned long']], 'FreeResourceList' : [ 0x78, ['_LIST_ENTRY']], 'FreeThreadList' : [ 0x80, ['_LIST_ENTRY']], 'FreeNodeList' : [ 0x88, ['_LIST_ENTRY']], 'FreeResourceCount' : [ 0x90, ['unsigned long']], 'FreeThreadCount' : [ 0x94, ['unsigned long']], 'FreeNodeCount' : [ 0x98, ['unsigned long']], 'Instigator' : [ 0x9c, ['pointer', ['void']]], 'NumberOfParticipants' : [ 0xa0, ['unsigned long']], 'Participant' : [ 0xa4, ['array', 32, ['pointer', ['_VI_DEADLOCK_NODE']]]], 'CacheReductionInProgress' : [ 0x124, ['unsigned long']], } ], '_THERMAL_INFORMATION' : [ 0x4c, { 'ThermalStamp' : [ 0x0, ['unsigned long']], 'ThermalConstant1' : [ 0x4, ['unsigned long']], 'ThermalConstant2' : [ 0x8, ['unsigned long']], 'Processors' : [ 0xc, ['unsigned long']], 'SamplingPeriod' : [ 0x10, ['unsigned long']], 'CurrentTemperature' : [ 0x14, ['unsigned long']], 'PassiveTripPoint' : [ 0x18, ['unsigned long']], 'CriticalTripPoint' : [ 0x1c, ['unsigned long']], 'ActiveTripPointCount' : [ 0x20, ['unsigned char']], 'ActiveTripPoint' : [ 0x24, ['array', 10, ['unsigned long']]], } ], '_DBGKD_SEARCH_MEMORY' : [ 0x18, { 'SearchAddress' : [ 0x0, ['unsigned long long']], 'FoundAddress' : [ 0x0, ['unsigned long long']], 'SearchLength' : [ 0x8, ['unsigned long long']], 'PatternLength' : [ 0x10, ['unsigned long']], } ], '_SECTION_OBJECT' : [ 0x18, { 'StartingVa' : [ 0x0, ['pointer', ['void']]], 'EndingVa' : [ 0x4, ['pointer', ['void']]], 'Parent' : [ 0x8, ['pointer', ['void']]], 'LeftChild' : [ 0xc, ['pointer', ['void']]], 'RightChild' : [ 0x10, ['pointer', ['void']]], 'Segment' : [ 0x14, ['pointer', ['_SEGMENT_OBJECT']]], } ], '_POWER_STATE' : [ 0x4, { 'SystemState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DeviceState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], } ], '_SEGMENT_OBJECT' : [ 0x30, { 'BaseAddress' : [ 0x0, ['pointer', ['void']]], 'TotalNumberOfPtes' : [ 0x4, ['unsigned long']], 'SizeOfSegment' : [ 0x8, ['_LARGE_INTEGER']], 'NonExtendedPtes' : [ 0x10, ['unsigned long']], 'ImageCommitment' : [ 0x14, ['unsigned long']], 'ControlArea' : [ 0x18, ['pointer', ['_CONTROL_AREA']]], 'Subsection' : [ 0x1c, ['pointer', ['_SUBSECTION']]], 'LargeControlArea' : [ 0x20, ['pointer', ['_LARGE_CONTROL_AREA']]], 'MmSectionFlags' : [ 0x24, ['pointer', ['_MMSECTION_FLAGS']]], 'MmSubSectionFlags' : [ 0x28, ['pointer', ['_MMSUBSECTION_FLAGS']]], } ], '__unnamed_12ea' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x0, ['_MMSECTION_FLAGS']], } ], '_CONTROL_AREA' : [ 0x30, { 'Segment' : [ 0x0, ['pointer', ['_SEGMENT']]], 'DereferenceList' : [ 0x4, ['_LIST_ENTRY']], 'NumberOfSectionReferences' : [ 0xc, ['unsigned long']], 'NumberOfPfnReferences' : [ 0x10, ['unsigned long']], 'NumberOfMappedViews' : [ 0x14, ['unsigned long']], 'NumberOfSystemCacheViews' : [ 0x18, ['unsigned long']], 'NumberOfUserReferences' : [ 0x1c, ['unsigned long']], 'u' : [ 0x20, ['__unnamed_12ea']], 'FilePointer' : [ 0x24, ['pointer', ['_FILE_OBJECT']]], 'WaitingForDeletion' : [ 0x28, ['pointer', ['_EVENT_COUNTER']]], 'ModifiedWriteCount' : [ 0x2c, ['unsigned short']], 'FlushInProgressCount' : [ 0x2e, ['unsigned short']], } ], '_HANDLE_TABLE' : [ 0x44, { 'TableCode' : [ 0x0, ['unsigned long']], 'QuotaProcess' : [ 0x4, ['pointer', ['_EPROCESS']]], 'UniqueProcessId' : [ 0x8, ['pointer', ['void']]], 'HandleTableLock' : [ 0xc, ['array', 4, ['_EX_PUSH_LOCK']]], 'HandleTableList' : [ 0x1c, ['_LIST_ENTRY']], 'HandleContentionEvent' : [ 0x24, ['_EX_PUSH_LOCK']], 'DebugInfo' : [ 0x28, ['pointer', ['_HANDLE_TRACE_DEBUG_INFO']]], 'ExtraInfoPages' : [ 0x2c, ['long']], 'FirstFree' : [ 0x30, ['unsigned long']], 'LastFree' : [ 0x34, ['unsigned long']], 'NextHandleNeedingPool' : [ 0x38, ['unsigned long']], 'HandleCount' : [ 0x3c, ['long']], 'Flags' : [ 0x40, ['unsigned long']], 'StrictFIFO' : [ 0x40, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], } ], '_POOL_HEADER' : [ 0x8, { 'PreviousSize' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned short')]], 'PoolIndex' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 16, native_type='unsigned short')]], 'BlockSize' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned short')]], 'PoolType' : [ 0x2, ['BitField', dict(start_bit = 9, end_bit = 16, native_type='unsigned short')]], 'Ulong1' : [ 0x0, ['unsigned long']], 'PoolTag' : [ 0x4, ['unsigned long']], 'AllocatorBackTraceIndex' : [ 0x4, ['unsigned short']], 'PoolTagHash' : [ 0x6, ['unsigned short']], } ], '_MMPTE_PROTOTYPE' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ProtoAddressLow' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 8, native_type='unsigned long')]], 'ReadOnly' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'WhichPool' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'ProtoAddressHigh' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 32, native_type='unsigned long')]], } ], '_MMSUPPORT' : [ 0x60, { 'WorkingSetExpansionLinks' : [ 0x0, ['_LIST_ENTRY']], 'LastTrimTime' : [ 0x8, ['_LARGE_INTEGER']], 'Flags' : [ 0x10, ['_MMSUPPORT_FLAGS']], 'PageFaultCount' : [ 0x14, ['unsigned long']], 'PeakWorkingSetSize' : [ 0x18, ['unsigned long']], 'GrowthSinceLastEstimate' : [ 0x1c, ['unsigned long']], 'MinimumWorkingSetSize' : [ 0x20, ['unsigned long']], 'MaximumWorkingSetSize' : [ 0x24, ['unsigned long']], 'VmWorkingSetList' : [ 0x28, ['pointer', ['_MMWSL']]], 'Claim' : [ 0x2c, ['unsigned long']], 'NextEstimationSlot' : [ 0x30, ['unsigned long']], 'NextAgingSlot' : [ 0x34, ['unsigned long']], 'EstimatedAvailable' : [ 0x38, ['unsigned long']], 'WorkingSetSize' : [ 0x3c, ['unsigned long']], 'WorkingSetMutex' : [ 0x40, ['_KGUARDED_MUTEX']], } ], '_EX_WORK_QUEUE' : [ 0x3c, { 'WorkerQueue' : [ 0x0, ['_KQUEUE']], 'DynamicThreadCount' : [ 0x28, ['unsigned long']], 'WorkItemsProcessed' : [ 0x2c, ['unsigned long']], 'WorkItemsProcessedLastPass' : [ 0x30, ['unsigned long']], 'QueueDepthLastPass' : [ 0x34, ['unsigned long']], 'Info' : [ 0x38, ['EX_QUEUE_WORKER_INFO']], } ], '_MMSUBSECTION_FLAGS' : [ 0x4, { 'ReadOnly' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReadWrite' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'SubsectionStatic' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'GlobalMemory' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 9, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'StartingSector4132' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 20, native_type='unsigned long')]], 'SectorEndOffset' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 32, native_type='unsigned long')]], } ], '_HEAP_TAG_ENTRY' : [ 0x40, { 'Allocs' : [ 0x0, ['unsigned long']], 'Frees' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], 'TagIndex' : [ 0xc, ['unsigned short']], 'CreatorBackTraceIndex' : [ 0xe, ['unsigned short']], 'TagName' : [ 0x10, ['array', 24, ['unsigned short']]], } ], '_EPROCESS_QUOTA_BLOCK' : [ 0x40, { 'QuotaEntry' : [ 0x0, ['array', 3, ['_EPROCESS_QUOTA_ENTRY']]], 'QuotaList' : [ 0x30, ['_LIST_ENTRY']], 'ReferenceCount' : [ 0x38, ['unsigned long']], 'ProcessCount' : [ 0x3c, ['unsigned long']], } ], '_UNICODE_STRING' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x4, ['pointer', ['unsigned short']]], } ], '_NT_TIB' : [ 0x1c, { 'ExceptionList' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'StackBase' : [ 0x4, ['pointer', ['void']]], 'StackLimit' : [ 0x8, ['pointer', ['void']]], 'SubSystemTib' : [ 0xc, ['pointer', ['void']]], 'FiberData' : [ 0x10, ['pointer', ['void']]], 'Version' : [ 0x10, ['unsigned long']], 'ArbitraryUserPointer' : [ 0x14, ['pointer', ['void']]], 'Self' : [ 0x18, ['pointer', ['_NT_TIB']]], } ], '_EVENT_COUNTER' : [ 0x18, { 'ListEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'RefCount' : [ 0x4, ['unsigned long']], 'Event' : [ 0x8, ['_KEVENT']], } ], '_EJOB' : [ 0x180, { 'Event' : [ 0x0, ['_KEVENT']], 'JobLinks' : [ 0x10, ['_LIST_ENTRY']], 'ProcessListHead' : [ 0x18, ['_LIST_ENTRY']], 'JobLock' : [ 0x20, ['_ERESOURCE']], 'TotalUserTime' : [ 0x58, ['_LARGE_INTEGER']], 'TotalKernelTime' : [ 0x60, ['_LARGE_INTEGER']], 'ThisPeriodTotalUserTime' : [ 0x68, ['_LARGE_INTEGER']], 'ThisPeriodTotalKernelTime' : [ 0x70, ['_LARGE_INTEGER']], 'TotalPageFaultCount' : [ 0x78, ['unsigned long']], 'TotalProcesses' : [ 0x7c, ['unsigned long']], 'ActiveProcesses' : [ 0x80, ['unsigned long']], 'TotalTerminatedProcesses' : [ 0x84, ['unsigned long']], 'PerProcessUserTimeLimit' : [ 0x88, ['_LARGE_INTEGER']], 'PerJobUserTimeLimit' : [ 0x90, ['_LARGE_INTEGER']], 'LimitFlags' : [ 0x98, ['unsigned long']], 'MinimumWorkingSetSize' : [ 0x9c, ['unsigned long']], 'MaximumWorkingSetSize' : [ 0xa0, ['unsigned long']], 'ActiveProcessLimit' : [ 0xa4, ['unsigned long']], 'Affinity' : [ 0xa8, ['unsigned long']], 'PriorityClass' : [ 0xac, ['unsigned char']], 'UIRestrictionsClass' : [ 0xb0, ['unsigned long']], 'SecurityLimitFlags' : [ 0xb4, ['unsigned long']], 'Token' : [ 0xb8, ['pointer', ['void']]], 'Filter' : [ 0xbc, ['pointer', ['_PS_JOB_TOKEN_FILTER']]], 'EndOfJobTimeAction' : [ 0xc0, ['unsigned long']], 'CompletionPort' : [ 0xc4, ['pointer', ['void']]], 'CompletionKey' : [ 0xc8, ['pointer', ['void']]], 'SessionId' : [ 0xcc, ['unsigned long']], 'SchedulingClass' : [ 0xd0, ['unsigned long']], 'ReadOperationCount' : [ 0xd8, ['unsigned long long']], 'WriteOperationCount' : [ 0xe0, ['unsigned long long']], 'OtherOperationCount' : [ 0xe8, ['unsigned long long']], 'ReadTransferCount' : [ 0xf0, ['unsigned long long']], 'WriteTransferCount' : [ 0xf8, ['unsigned long long']], 'OtherTransferCount' : [ 0x100, ['unsigned long long']], 'IoInfo' : [ 0x108, ['_IO_COUNTERS']], 'ProcessMemoryLimit' : [ 0x138, ['unsigned long']], 'JobMemoryLimit' : [ 0x13c, ['unsigned long']], 'PeakProcessMemoryUsed' : [ 0x140, ['unsigned long']], 'PeakJobMemoryUsed' : [ 0x144, ['unsigned long']], 'CurrentJobMemoryUsed' : [ 0x148, ['unsigned long']], 'MemoryLimitsLock' : [ 0x14c, ['_KGUARDED_MUTEX']], 'JobSetLinks' : [ 0x16c, ['_LIST_ENTRY']], 'MemberLevel' : [ 0x174, ['unsigned long']], 'JobFlags' : [ 0x178, ['unsigned long']], } ], '_LARGE_CONTROL_AREA' : [ 0x40, { 'Segment' : [ 0x0, ['pointer', ['_SEGMENT']]], 'DereferenceList' : [ 0x4, ['_LIST_ENTRY']], 'NumberOfSectionReferences' : [ 0xc, ['unsigned long']], 'NumberOfPfnReferences' : [ 0x10, ['unsigned long']], 'NumberOfMappedViews' : [ 0x14, ['unsigned long']], 'NumberOfSubsections' : [ 0x18, ['unsigned short']], 'FlushInProgressCount' : [ 0x1a, ['unsigned short']], 'NumberOfUserReferences' : [ 0x1c, ['unsigned long']], 'u' : [ 0x20, ['__unnamed_12ea']], 'FilePointer' : [ 0x24, ['pointer', ['_FILE_OBJECT']]], 'WaitingForDeletion' : [ 0x28, ['pointer', ['_EVENT_COUNTER']]], 'ModifiedWriteCount' : [ 0x2c, ['unsigned short']], 'NumberOfSystemCacheViews' : [ 0x2e, ['unsigned short']], 'StartingFrame' : [ 0x30, ['unsigned long']], 'UserGlobalList' : [ 0x34, ['_LIST_ENTRY']], 'SessionId' : [ 0x3c, ['unsigned long']], } ], '__unnamed_1326' : [ 0x4, { 'BaseMid' : [ 0x0, ['unsigned char']], 'Flags1' : [ 0x1, ['unsigned char']], 'Flags2' : [ 0x2, ['unsigned char']], 'BaseHi' : [ 0x3, ['unsigned char']], } ], '__unnamed_132d' : [ 0x4, { 'BaseMid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'Type' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 13, native_type='unsigned long')]], 'Dpl' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 15, native_type='unsigned long')]], 'Pres' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'LimitHi' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 20, native_type='unsigned long')]], 'Sys' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'Reserved_0' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'Default_Big' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'Granularity' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'BaseHi' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_132f' : [ 0x4, { 'Bytes' : [ 0x0, ['__unnamed_1326']], 'Bits' : [ 0x0, ['__unnamed_132d']], } ], '_KGDTENTRY' : [ 0x8, { 'LimitLow' : [ 0x0, ['unsigned short']], 'BaseLow' : [ 0x2, ['unsigned short']], 'HighWord' : [ 0x4, ['__unnamed_132f']], } ], '_PS_JOB_TOKEN_FILTER' : [ 0x24, { 'CapturedSidCount' : [ 0x0, ['unsigned long']], 'CapturedSids' : [ 0x4, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'CapturedSidsLength' : [ 0x8, ['unsigned long']], 'CapturedGroupCount' : [ 0xc, ['unsigned long']], 'CapturedGroups' : [ 0x10, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'CapturedGroupsLength' : [ 0x14, ['unsigned long']], 'CapturedPrivilegeCount' : [ 0x18, ['unsigned long']], 'CapturedPrivileges' : [ 0x1c, ['pointer', ['_LUID_AND_ATTRIBUTES']]], 'CapturedPrivilegesLength' : [ 0x20, ['unsigned long']], } ], '_MM_DRIVER_VERIFIER_DATA' : [ 0x70, { 'Level' : [ 0x0, ['unsigned long']], 'RaiseIrqls' : [ 0x4, ['unsigned long']], 'AcquireSpinLocks' : [ 0x8, ['unsigned long']], 'SynchronizeExecutions' : [ 0xc, ['unsigned long']], 'AllocationsAttempted' : [ 0x10, ['unsigned long']], 'AllocationsSucceeded' : [ 0x14, ['unsigned long']], 'AllocationsSucceededSpecialPool' : [ 0x18, ['unsigned long']], 'AllocationsWithNoTag' : [ 0x1c, ['unsigned long']], 'TrimRequests' : [ 0x20, ['unsigned long']], 'Trims' : [ 0x24, ['unsigned long']], 'AllocationsFailed' : [ 0x28, ['unsigned long']], 'AllocationsFailedDeliberately' : [ 0x2c, ['unsigned long']], 'Loads' : [ 0x30, ['unsigned long']], 'Unloads' : [ 0x34, ['unsigned long']], 'UnTrackedPool' : [ 0x38, ['unsigned long']], 'UserTrims' : [ 0x3c, ['unsigned long']], 'CurrentPagedPoolAllocations' : [ 0x40, ['unsigned long']], 'CurrentNonPagedPoolAllocations' : [ 0x44, ['unsigned long']], 'PeakPagedPoolAllocations' : [ 0x48, ['unsigned long']], 'PeakNonPagedPoolAllocations' : [ 0x4c, ['unsigned long']], 'PagedBytes' : [ 0x50, ['unsigned long']], 'NonPagedBytes' : [ 0x54, ['unsigned long']], 'PeakPagedBytes' : [ 0x58, ['unsigned long']], 'PeakNonPagedBytes' : [ 0x5c, ['unsigned long']], 'BurstAllocationsFailedDeliberately' : [ 0x60, ['unsigned long']], 'SessionTrims' : [ 0x64, ['unsigned long']], 'Reserved' : [ 0x68, ['array', 2, ['unsigned long']]], } ], '_IMAGE_FILE_HEADER' : [ 0x14, { 'Machine' : [ 0x0, ['unsigned short']], 'NumberOfSections' : [ 0x2, ['unsigned short']], 'TimeDateStamp' : [ 0x4, ['unsigned long']], 'PointerToSymbolTable' : [ 0x8, ['unsigned long']], 'NumberOfSymbols' : [ 0xc, ['unsigned long']], 'SizeOfOptionalHeader' : [ 0x10, ['unsigned short']], 'Characteristics' : [ 0x12, ['unsigned short']], } ], '_FILE_OBJECT' : [ 0x70, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'Vpb' : [ 0x8, ['pointer', ['_VPB']]], 'FsContext' : [ 0xc, ['pointer', ['void']]], 'FsContext2' : [ 0x10, ['pointer', ['void']]], 'SectionObjectPointer' : [ 0x14, ['pointer', ['_SECTION_OBJECT_POINTERS']]], 'PrivateCacheMap' : [ 0x18, ['pointer', ['void']]], 'FinalStatus' : [ 0x1c, ['long']], 'RelatedFileObject' : [ 0x20, ['pointer', ['_FILE_OBJECT']]], 'LockOperation' : [ 0x24, ['unsigned char']], 'DeletePending' : [ 0x25, ['unsigned char']], 'ReadAccess' : [ 0x26, ['unsigned char']], 'WriteAccess' : [ 0x27, ['unsigned char']], 'DeleteAccess' : [ 0x28, ['unsigned char']], 'SharedRead' : [ 0x29, ['unsigned char']], 'SharedWrite' : [ 0x2a, ['unsigned char']], 'SharedDelete' : [ 0x2b, ['unsigned char']], 'Flags' : [ 0x2c, ['unsigned long']], 'FileName' : [ 0x30, ['_UNICODE_STRING']], 'CurrentByteOffset' : [ 0x38, ['_LARGE_INTEGER']], 'Waiters' : [ 0x40, ['unsigned long']], 'Busy' : [ 0x44, ['unsigned long']], 'LastLock' : [ 0x48, ['pointer', ['void']]], 'Lock' : [ 0x4c, ['_KEVENT']], 'Event' : [ 0x5c, ['_KEVENT']], 'CompletionContext' : [ 0x6c, ['pointer', ['_IO_COMPLETION_CONTEXT']]], } ], '_MMPTE_HARDWARE' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Writable' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Owner' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Accessed' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Dirty' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'LargePage' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Global' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_IO_COMPLETION_CONTEXT' : [ 0x8, { 'Port' : [ 0x0, ['pointer', ['void']]], 'Key' : [ 0x4, ['pointer', ['void']]], } ], '_CALL_HASH_ENTRY' : [ 0x14, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'CallersAddress' : [ 0x8, ['pointer', ['void']]], 'CallersCaller' : [ 0xc, ['pointer', ['void']]], 'CallCount' : [ 0x10, ['unsigned long']], } ], '_HMAP_ENTRY' : [ 0x10, { 'BlockAddress' : [ 0x0, ['unsigned long']], 'BinAddress' : [ 0x4, ['unsigned long']], 'CmView' : [ 0x8, ['pointer', ['_CM_VIEW_OF_FILE']]], 'MemAlloc' : [ 0xc, ['unsigned long']], } ], '_DBGKD_SET_CONTEXT' : [ 0x4, { 'ContextFlags' : [ 0x0, ['unsigned long']], } ], '_MMSECTION_FLAGS' : [ 0x4, { 'BeingDeleted' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'BeingCreated' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'BeingPurged' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'NoModifiedWriting' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'FailAllIo' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Image' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Based' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'File' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Networked' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'NoCache' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'PhysicalMemory' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'Reserve' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'Commit' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'FloppyMedia' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'WasPurged' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'UserReference' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'GlobalMemory' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'DeleteOnClose' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'FilePointerNull' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'DebugSymbolsLoaded' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'SetMappedFileIoComplete' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'CollidedFlush' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'NoChange' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'HadUserReference' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'ImageMappedInSystemSpace' : [ 0x0, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'UserWritable' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'Accessed' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'GlobalOnlyPerSession' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'Rom' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'filler' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 32, native_type='unsigned long')]], } ], '_DEFERRED_WRITE' : [ 0x28, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteSize' : [ 0x2, ['short']], 'FileObject' : [ 0x4, ['pointer', ['_FILE_OBJECT']]], 'BytesToWrite' : [ 0x8, ['unsigned long']], 'DeferredWriteLinks' : [ 0xc, ['_LIST_ENTRY']], 'Event' : [ 0x14, ['pointer', ['_KEVENT']]], 'PostRoutine' : [ 0x18, ['pointer', ['void']]], 'Context1' : [ 0x1c, ['pointer', ['void']]], 'Context2' : [ 0x20, ['pointer', ['void']]], 'LimitModifiedPages' : [ 0x24, ['unsigned char']], } ], '_SID_AND_ATTRIBUTES' : [ 0x8, { 'Sid' : [ 0x0, ['pointer', ['void']]], 'Attributes' : [ 0x4, ['unsigned long']], } ], '_HIVE_LIST_ENTRY' : [ 0x1c, { 'Name' : [ 0x0, ['pointer', ['unsigned short']]], 'BaseName' : [ 0x4, ['pointer', ['unsigned short']]], 'CmHive' : [ 0x8, ['pointer', ['_CMHIVE']]], 'HHiveFlags' : [ 0xc, ['unsigned long']], 'CmHiveFlags' : [ 0x10, ['unsigned long']], 'CmHive2' : [ 0x14, ['pointer', ['_CMHIVE']]], 'ThreadFinished' : [ 0x18, ['unsigned char']], 'ThreadStarted' : [ 0x19, ['unsigned char']], 'Allocate' : [ 0x1a, ['unsigned char']], } ], '_KSPIN_LOCK_QUEUE' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_KSPIN_LOCK_QUEUE']]], 'Lock' : [ 0x4, ['pointer', ['unsigned long']]], } ], '_PS_IMPERSONATION_INFORMATION' : [ 0xc, { 'Token' : [ 0x0, ['pointer', ['void']]], 'CopyOnOpen' : [ 0x4, ['unsigned char']], 'EffectiveOnly' : [ 0x5, ['unsigned char']], 'ImpersonationLevel' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], } ], '__unnamed_1393' : [ 0x4, { 'LegacyDeviceNode' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], 'PendingDeviceRelations' : [ 0x0, ['pointer', ['_DEVICE_RELATIONS']]], } ], '__unnamed_1395' : [ 0x4, { 'NextResourceDeviceNode' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], } ], '__unnamed_1399' : [ 0x10, { 'DockStatus' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'DOCK_NOTDOCKDEVICE', 1: 'DOCK_QUIESCENT', 2: 'DOCK_ARRIVING', 3: 'DOCK_DEPARTING', 4: 'DOCK_EJECTIRP_COMPLETED'})]], 'ListEntry' : [ 0x4, ['_LIST_ENTRY']], 'SerialNumber' : [ 0xc, ['pointer', ['unsigned short']]], } ], '_DEVICE_NODE' : [ 0x114, { 'Sibling' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], 'Child' : [ 0x4, ['pointer', ['_DEVICE_NODE']]], 'Parent' : [ 0x8, ['pointer', ['_DEVICE_NODE']]], 'LastChild' : [ 0xc, ['pointer', ['_DEVICE_NODE']]], 'Level' : [ 0x10, ['unsigned long']], 'Notify' : [ 0x14, ['pointer', ['_PO_DEVICE_NOTIFY']]], 'State' : [ 0x18, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]], 'PreviousState' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]], 'StateHistory' : [ 0x20, ['array', -80, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]]], 'StateHistoryEntry' : [ 0x70, ['unsigned long']], 'CompletionStatus' : [ 0x74, ['long']], 'PendingIrp' : [ 0x78, ['pointer', ['_IRP']]], 'Flags' : [ 0x7c, ['unsigned long']], 'UserFlags' : [ 0x80, ['unsigned long']], 'Problem' : [ 0x84, ['unsigned long']], 'PhysicalDeviceObject' : [ 0x88, ['pointer', ['_DEVICE_OBJECT']]], 'ResourceList' : [ 0x8c, ['pointer', ['_CM_RESOURCE_LIST']]], 'ResourceListTranslated' : [ 0x90, ['pointer', ['_CM_RESOURCE_LIST']]], 'InstancePath' : [ 0x94, ['_UNICODE_STRING']], 'ServiceName' : [ 0x9c, ['_UNICODE_STRING']], 'DuplicatePDO' : [ 0xa4, ['pointer', ['_DEVICE_OBJECT']]], 'ResourceRequirements' : [ 0xa8, ['pointer', ['_IO_RESOURCE_REQUIREMENTS_LIST']]], 'InterfaceType' : [ 0xac, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0xb0, ['unsigned long']], 'ChildInterfaceType' : [ 0xb4, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'ChildBusNumber' : [ 0xb8, ['unsigned long']], 'ChildBusTypeIndex' : [ 0xbc, ['unsigned short']], 'RemovalPolicy' : [ 0xbe, ['unsigned char']], 'HardwareRemovalPolicy' : [ 0xbf, ['unsigned char']], 'TargetDeviceNotify' : [ 0xc0, ['_LIST_ENTRY']], 'DeviceArbiterList' : [ 0xc8, ['_LIST_ENTRY']], 'DeviceTranslatorList' : [ 0xd0, ['_LIST_ENTRY']], 'NoTranslatorMask' : [ 0xd8, ['unsigned short']], 'QueryTranslatorMask' : [ 0xda, ['unsigned short']], 'NoArbiterMask' : [ 0xdc, ['unsigned short']], 'QueryArbiterMask' : [ 0xde, ['unsigned short']], 'OverUsed1' : [ 0xe0, ['__unnamed_1393']], 'OverUsed2' : [ 0xe4, ['__unnamed_1395']], 'BootResources' : [ 0xe8, ['pointer', ['_CM_RESOURCE_LIST']]], 'CapabilityFlags' : [ 0xec, ['unsigned long']], 'DockInfo' : [ 0xf0, ['__unnamed_1399']], 'DisableableDepends' : [ 0x100, ['unsigned long']], 'PendedSetInterfaceState' : [ 0x104, ['_LIST_ENTRY']], 'LegacyBusListEntry' : [ 0x10c, ['_LIST_ENTRY']], } ], '__unnamed_139e' : [ 0x38, { 'CriticalSection' : [ 0x0, ['_RTL_CRITICAL_SECTION']], 'Resource' : [ 0x0, ['_ERESOURCE']], } ], '_HEAP_LOCK' : [ 0x38, { 'Lock' : [ 0x0, ['__unnamed_139e']], } ], '_MMCOLOR_TABLES' : [ 0xc, { 'Flink' : [ 0x0, ['unsigned long']], 'Blink' : [ 0x4, ['pointer', ['void']]], 'Count' : [ 0x8, ['unsigned long']], } ], '_ACL' : [ 0x8, { 'AclRevision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'AclSize' : [ 0x2, ['unsigned short']], 'AceCount' : [ 0x4, ['unsigned short']], 'Sbz2' : [ 0x6, ['unsigned short']], } ], '_DBGKD_FILL_MEMORY' : [ 0x10, { 'Address' : [ 0x0, ['unsigned long long']], 'Length' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['unsigned short']], 'PatternLength' : [ 0xe, ['unsigned short']], } ], '_PP_LOOKASIDE_LIST' : [ 0x8, { 'P' : [ 0x0, ['pointer', ['_GENERAL_LOOKASIDE']]], 'L' : [ 0x4, ['pointer', ['_GENERAL_LOOKASIDE']]], } ], '_PHYSICAL_MEMORY_RUN' : [ 0x8, { 'BasePage' : [ 0x0, ['unsigned long']], 'PageCount' : [ 0x4, ['unsigned long']], } ], '__unnamed_13b3' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x0, ['_MM_SESSION_SPACE_FLAGS']], } ], '_MM_SESSION_SPACE' : [ 0x1f00, { 'GlobalVirtualAddress' : [ 0x0, ['pointer', ['_MM_SESSION_SPACE']]], 'ReferenceCount' : [ 0x4, ['unsigned long']], 'u' : [ 0x8, ['__unnamed_13b3']], 'SessionId' : [ 0xc, ['unsigned long']], 'ProcessList' : [ 0x10, ['_LIST_ENTRY']], 'LastProcessSwappedOutTime' : [ 0x18, ['_LARGE_INTEGER']], 'SessionPageDirectoryIndex' : [ 0x20, ['unsigned long']], 'NonPagablePages' : [ 0x24, ['unsigned long']], 'CommittedPages' : [ 0x28, ['unsigned long']], 'PagedPoolStart' : [ 0x2c, ['pointer', ['void']]], 'PagedPoolEnd' : [ 0x30, ['pointer', ['void']]], 'PagedPoolBasePde' : [ 0x34, ['pointer', ['_MMPTE']]], 'Color' : [ 0x38, ['unsigned long']], 'ProcessOutSwapCount' : [ 0x3c, ['unsigned long']], 'SessionPoolAllocationFailures' : [ 0x40, ['array', 4, ['unsigned long']]], 'ImageList' : [ 0x50, ['_LIST_ENTRY']], 'LocaleId' : [ 0x58, ['unsigned long']], 'AttachCount' : [ 0x5c, ['unsigned long']], 'AttachEvent' : [ 0x60, ['_KEVENT']], 'LastProcess' : [ 0x70, ['pointer', ['_EPROCESS']]], 'ProcessReferenceToSession' : [ 0x74, ['long']], 'WsListEntry' : [ 0x78, ['_LIST_ENTRY']], 'Lookaside' : [ 0x80, ['array', 26, ['_GENERAL_LOOKASIDE']]], 'Session' : [ 0xd80, ['_MMSESSION']], 'PagedPoolMutex' : [ 0xdc0, ['_KGUARDED_MUTEX']], 'PagedPoolInfo' : [ 0xde0, ['_MM_PAGED_POOL_INFO']], 'Vm' : [ 0xe00, ['_MMSUPPORT']], 'Wsle' : [ 0xe60, ['pointer', ['_MMWSLE']]], 'Win32KDriverUnload' : [ 0xe64, ['pointer', ['void']]], 'PagedPool' : [ 0xe68, ['_POOL_DESCRIPTOR']], 'PageTables' : [ 0x1e98, ['pointer', ['_MMPTE']]], 'ImageLoadingCount' : [ 0x1e9c, ['long']], } ], '_PEB' : [ 0x230, { 'InheritedAddressSpace' : [ 0x0, ['unsigned char']], 'ReadImageFileExecOptions' : [ 0x1, ['unsigned char']], 'BeingDebugged' : [ 0x2, ['unsigned char']], 'SpareBool' : [ 0x3, ['unsigned char']], 'Mutant' : [ 0x4, ['pointer', ['void']]], 'ImageBaseAddress' : [ 0x8, ['pointer', ['void']]], 'Ldr' : [ 0xc, ['pointer', ['_PEB_LDR_DATA']]], 'ProcessParameters' : [ 0x10, ['pointer', ['_RTL_USER_PROCESS_PARAMETERS']]], 'SubSystemData' : [ 0x14, ['pointer', ['void']]], 'ProcessHeap' : [ 0x18, ['pointer', ['void']]], 'FastPebLock' : [ 0x1c, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'SparePtr1' : [ 0x20, ['pointer', ['void']]], 'SparePtr2' : [ 0x24, ['pointer', ['void']]], 'EnvironmentUpdateCount' : [ 0x28, ['unsigned long']], 'KernelCallbackTable' : [ 0x2c, ['pointer', ['void']]], 'SystemReserved' : [ 0x30, ['array', 1, ['unsigned long']]], 'ExecuteOptions' : [ 0x34, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'SpareBits' : [ 0x34, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'FreeList' : [ 0x38, ['pointer', ['_PEB_FREE_BLOCK']]], 'TlsExpansionCounter' : [ 0x3c, ['unsigned long']], 'TlsBitmap' : [ 0x40, ['pointer', ['void']]], 'TlsBitmapBits' : [ 0x44, ['array', 2, ['unsigned long']]], 'ReadOnlySharedMemoryBase' : [ 0x4c, ['pointer', ['void']]], 'ReadOnlySharedMemoryHeap' : [ 0x50, ['pointer', ['void']]], 'ReadOnlyStaticServerData' : [ 0x54, ['pointer', ['pointer', ['void']]]], 'AnsiCodePageData' : [ 0x58, ['pointer', ['void']]], 'OemCodePageData' : [ 0x5c, ['pointer', ['void']]], 'UnicodeCaseTableData' : [ 0x60, ['pointer', ['void']]], 'NumberOfProcessors' : [ 0x64, ['unsigned long']], 'NtGlobalFlag' : [ 0x68, ['unsigned long']], 'CriticalSectionTimeout' : [ 0x70, ['_LARGE_INTEGER']], 'HeapSegmentReserve' : [ 0x78, ['unsigned long']], 'HeapSegmentCommit' : [ 0x7c, ['unsigned long']], 'HeapDeCommitTotalFreeThreshold' : [ 0x80, ['unsigned long']], 'HeapDeCommitFreeBlockThreshold' : [ 0x84, ['unsigned long']], 'NumberOfHeaps' : [ 0x88, ['unsigned long']], 'MaximumNumberOfHeaps' : [ 0x8c, ['unsigned long']], 'ProcessHeaps' : [ 0x90, ['pointer', ['pointer', ['void']]]], 'GdiSharedHandleTable' : [ 0x94, ['pointer', ['void']]], 'ProcessStarterHelper' : [ 0x98, ['pointer', ['void']]], 'GdiDCAttributeList' : [ 0x9c, ['unsigned long']], 'LoaderLock' : [ 0xa0, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'OSMajorVersion' : [ 0xa4, ['unsigned long']], 'OSMinorVersion' : [ 0xa8, ['unsigned long']], 'OSBuildNumber' : [ 0xac, ['unsigned short']], 'OSCSDVersion' : [ 0xae, ['unsigned short']], 'OSPlatformId' : [ 0xb0, ['unsigned long']], 'ImageSubsystem' : [ 0xb4, ['unsigned long']], 'ImageSubsystemMajorVersion' : [ 0xb8, ['unsigned long']], 'ImageSubsystemMinorVersion' : [ 0xbc, ['unsigned long']], 'ImageProcessAffinityMask' : [ 0xc0, ['unsigned long']], 'GdiHandleBuffer' : [ 0xc4, ['array', 34, ['unsigned long']]], 'PostProcessInitRoutine' : [ 0x14c, ['pointer', ['void']]], 'TlsExpansionBitmap' : [ 0x150, ['pointer', ['void']]], 'TlsExpansionBitmapBits' : [ 0x154, ['array', 32, ['unsigned long']]], 'SessionId' : [ 0x1d4, ['unsigned long']], 'AppCompatFlags' : [ 0x1d8, ['_ULARGE_INTEGER']], 'AppCompatFlagsUser' : [ 0x1e0, ['_ULARGE_INTEGER']], 'pShimData' : [ 0x1e8, ['pointer', ['void']]], 'AppCompatInfo' : [ 0x1ec, ['pointer', ['void']]], 'CSDVersion' : [ 0x1f0, ['_UNICODE_STRING']], 'ActivationContextData' : [ 0x1f8, ['pointer', ['_ACTIVATION_CONTEXT_DATA']]], 'ProcessAssemblyStorageMap' : [ 0x1fc, ['pointer', ['_ASSEMBLY_STORAGE_MAP']]], 'SystemDefaultActivationContextData' : [ 0x200, ['pointer', ['_ACTIVATION_CONTEXT_DATA']]], 'SystemAssemblyStorageMap' : [ 0x204, ['pointer', ['_ASSEMBLY_STORAGE_MAP']]], 'MinimumStackCommit' : [ 0x208, ['unsigned long']], 'FlsCallback' : [ 0x20c, ['pointer', ['pointer', ['void']]]], 'FlsListHead' : [ 0x210, ['_LIST_ENTRY']], 'FlsBitmap' : [ 0x218, ['pointer', ['void']]], 'FlsBitmapBits' : [ 0x21c, ['array', 4, ['unsigned long']]], 'FlsHighIndex' : [ 0x22c, ['unsigned long']], } ], '_HEAP_FREE_ENTRY' : [ 0x10, { 'Size' : [ 0x0, ['unsigned short']], 'PreviousSize' : [ 0x2, ['unsigned short']], 'SubSegmentCode' : [ 0x0, ['pointer', ['void']]], 'SmallTagIndex' : [ 0x4, ['unsigned char']], 'Flags' : [ 0x5, ['unsigned char']], 'UnusedBytes' : [ 0x6, ['unsigned char']], 'SegmentIndex' : [ 0x7, ['unsigned char']], 'FreeList' : [ 0x8, ['_LIST_ENTRY']], } ], '_DBGKD_GET_CONTEXT' : [ 0x4, { 'Unused' : [ 0x0, ['unsigned long']], } ], '_MMPTE_SOFTWARE' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PageFileLow' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 5, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PageFileHigh' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_IO_RESOURCE_REQUIREMENTS_LIST' : [ 0x48, { 'ListSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0x8, ['unsigned long']], 'SlotNumber' : [ 0xc, ['unsigned long']], 'Reserved' : [ 0x10, ['array', 3, ['unsigned long']]], 'AlternativeLists' : [ 0x1c, ['unsigned long']], 'List' : [ 0x20, ['array', 1, ['_IO_RESOURCE_LIST']]], } ], '__unnamed_13e3' : [ 0x8, { 'IoStatus' : [ 0x0, ['_IO_STATUS_BLOCK']], 'LastByte' : [ 0x0, ['_LARGE_INTEGER']], } ], '_MMMOD_WRITER_MDL_ENTRY' : [ 0x60, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'WriteOffset' : [ 0x8, ['_LARGE_INTEGER']], 'u' : [ 0x10, ['__unnamed_13e3']], 'Irp' : [ 0x18, ['pointer', ['_IRP']]], 'LastPageToWrite' : [ 0x1c, ['unsigned long']], 'PagingListHead' : [ 0x20, ['pointer', ['_MMMOD_WRITER_LISTHEAD']]], 'CurrentList' : [ 0x24, ['pointer', ['_LIST_ENTRY']]], 'PagingFile' : [ 0x28, ['pointer', ['_MMPAGING_FILE']]], 'File' : [ 0x2c, ['pointer', ['_FILE_OBJECT']]], 'ControlArea' : [ 0x30, ['pointer', ['_CONTROL_AREA']]], 'FileResource' : [ 0x34, ['pointer', ['_ERESOURCE']]], 'IssueTime' : [ 0x38, ['_LARGE_INTEGER']], 'Mdl' : [ 0x40, ['_MDL']], 'Page' : [ 0x5c, ['array', 1, ['unsigned long']]], } ], '_CACHE_UNINITIALIZE_EVENT' : [ 0x14, { 'Next' : [ 0x0, ['pointer', ['_CACHE_UNINITIALIZE_EVENT']]], 'Event' : [ 0x4, ['_KEVENT']], } ], '_SECURITY_TOKEN_AUDIT_DATA' : [ 0xc, { 'Length' : [ 0x0, ['unsigned long']], 'GrantMask' : [ 0x4, ['unsigned long']], 'DenyMask' : [ 0x8, ['unsigned long']], } ], '_CM_RESOURCE_LIST' : [ 0x24, { 'Count' : [ 0x0, ['unsigned long']], 'List' : [ 0x4, ['array', 1, ['_CM_FULL_RESOURCE_DESCRIPTOR']]], } ], '_CM_FULL_RESOURCE_DESCRIPTOR' : [ 0x20, { 'InterfaceType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0x4, ['unsigned long']], 'PartialResourceList' : [ 0x8, ['_CM_PARTIAL_RESOURCE_LIST']], } ], '_EPROCESS_QUOTA_ENTRY' : [ 0x10, { 'Usage' : [ 0x0, ['unsigned long']], 'Limit' : [ 0x4, ['unsigned long']], 'Peak' : [ 0x8, ['unsigned long']], 'Return' : [ 0xc, ['unsigned long']], } ], '__unnamed_13f9' : [ 0x50, { 'CellData' : [ 0x0, ['_CELL_DATA']], 'List' : [ 0x0, ['array', 1, ['unsigned long']]], } ], '_CM_CACHED_VALUE_INDEX' : [ 0x54, { 'CellIndex' : [ 0x0, ['unsigned long']], 'Data' : [ 0x4, ['__unnamed_13f9']], } ], '_KSEMAPHORE' : [ 0x14, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'Limit' : [ 0x10, ['long']], } ], '_PROCESSOR_POWER_STATE' : [ 0x120, { 'IdleFunction' : [ 0x0, ['pointer', ['void']]], 'Idle0KernelTimeLimit' : [ 0x4, ['unsigned long']], 'Idle0LastTime' : [ 0x8, ['unsigned long']], 'IdleHandlers' : [ 0xc, ['pointer', ['void']]], 'IdleState' : [ 0x10, ['pointer', ['void']]], 'IdleHandlersCount' : [ 0x14, ['unsigned long']], 'LastCheck' : [ 0x18, ['unsigned long long']], 'IdleTimes' : [ 0x20, ['PROCESSOR_IDLE_TIMES']], 'IdleTime1' : [ 0x40, ['unsigned long']], 'PromotionCheck' : [ 0x44, ['unsigned long']], 'IdleTime2' : [ 0x48, ['unsigned long']], 'CurrentThrottle' : [ 0x4c, ['unsigned char']], 'ThermalThrottleLimit' : [ 0x4d, ['unsigned char']], 'CurrentThrottleIndex' : [ 0x4e, ['unsigned char']], 'ThermalThrottleIndex' : [ 0x4f, ['unsigned char']], 'PerfSystemTime' : [ 0x50, ['unsigned long']], 'PerfIdleTime' : [ 0x54, ['unsigned long']], 'DebugDelta' : [ 0x58, ['unsigned long long']], 'DebugCount' : [ 0x60, ['unsigned long']], 'LastSysTime' : [ 0x64, ['unsigned long']], 'TotalIdleStateTime' : [ 0x68, ['array', 3, ['unsigned long long']]], 'TotalIdleTransitions' : [ 0x80, ['array', 3, ['unsigned long']]], 'PreviousC3StateTime' : [ 0x90, ['unsigned long long']], 'KneeThrottleIndex' : [ 0x98, ['unsigned char']], 'ThrottleLimitIndex' : [ 0x99, ['unsigned char']], 'PerfStatesCount' : [ 0x9a, ['unsigned char']], 'ProcessorMinThrottle' : [ 0x9b, ['unsigned char']], 'ProcessorMaxThrottle' : [ 0x9c, ['unsigned char']], 'LastBusyPercentage' : [ 0x9d, ['unsigned char']], 'LastC3Percentage' : [ 0x9e, ['unsigned char']], 'LastAdjustedBusyPercentage' : [ 0x9f, ['unsigned char']], 'PromotionCount' : [ 0xa0, ['unsigned long']], 'DemotionCount' : [ 0xa4, ['unsigned long']], 'ErrorCount' : [ 0xa8, ['unsigned long']], 'RetryCount' : [ 0xac, ['unsigned long']], 'Flags' : [ 0xb0, ['unsigned long']], 'PerfCounterFrequency' : [ 0xb8, ['_LARGE_INTEGER']], 'PerfTickCount' : [ 0xc0, ['unsigned long']], 'PerfTimer' : [ 0xc8, ['_KTIMER']], 'PerfDpc' : [ 0xf0, ['_KDPC']], 'PerfStates' : [ 0x110, ['pointer', ['PROCESSOR_PERF_STATE']]], 'PerfSetThrottle' : [ 0x114, ['pointer', ['void']]], 'Spare1' : [ 0x118, ['array', 2, ['unsigned long']]], } ], '_DBGKD_READ_WRITE_MSR' : [ 0xc, { 'Msr' : [ 0x0, ['unsigned long']], 'DataValueLow' : [ 0x4, ['unsigned long']], 'DataValueHigh' : [ 0x8, ['unsigned long']], } ], '_MMPFNENTRY' : [ 0x4, { 'Modified' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReadInProgress' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'WriteInProgress' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'PrototypePte' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'PageColor' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned long')]], 'PageLocation' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 11, native_type='unsigned long')]], 'RemovalRequested' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'CacheAttribute' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 14, native_type='unsigned long')]], 'Rom' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'ParityError' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'DontUse' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long')]], } ], '_IO_COUNTERS' : [ 0x30, { 'ReadOperationCount' : [ 0x0, ['unsigned long long']], 'WriteOperationCount' : [ 0x8, ['unsigned long long']], 'OtherOperationCount' : [ 0x10, ['unsigned long long']], 'ReadTransferCount' : [ 0x18, ['unsigned long long']], 'WriteTransferCount' : [ 0x20, ['unsigned long long']], 'OtherTransferCount' : [ 0x28, ['unsigned long long']], } ], '_KTSS' : [ 0x20ac, { 'Backlink' : [ 0x0, ['unsigned short']], 'Reserved0' : [ 0x2, ['unsigned short']], 'Esp0' : [ 0x4, ['unsigned long']], 'Ss0' : [ 0x8, ['unsigned short']], 'Reserved1' : [ 0xa, ['unsigned short']], 'NotUsed1' : [ 0xc, ['array', 4, ['unsigned long']]], 'CR3' : [ 0x1c, ['unsigned long']], 'Eip' : [ 0x20, ['unsigned long']], 'EFlags' : [ 0x24, ['unsigned long']], 'Eax' : [ 0x28, ['unsigned long']], 'Ecx' : [ 0x2c, ['unsigned long']], 'Edx' : [ 0x30, ['unsigned long']], 'Ebx' : [ 0x34, ['unsigned long']], 'Esp' : [ 0x38, ['unsigned long']], 'Ebp' : [ 0x3c, ['unsigned long']], 'Esi' : [ 0x40, ['unsigned long']], 'Edi' : [ 0x44, ['unsigned long']], 'Es' : [ 0x48, ['unsigned short']], 'Reserved2' : [ 0x4a, ['unsigned short']], 'Cs' : [ 0x4c, ['unsigned short']], 'Reserved3' : [ 0x4e, ['unsigned short']], 'Ss' : [ 0x50, ['unsigned short']], 'Reserved4' : [ 0x52, ['unsigned short']], 'Ds' : [ 0x54, ['unsigned short']], 'Reserved5' : [ 0x56, ['unsigned short']], 'Fs' : [ 0x58, ['unsigned short']], 'Reserved6' : [ 0x5a, ['unsigned short']], 'Gs' : [ 0x5c, ['unsigned short']], 'Reserved7' : [ 0x5e, ['unsigned short']], 'LDT' : [ 0x60, ['unsigned short']], 'Reserved8' : [ 0x62, ['unsigned short']], 'Flags' : [ 0x64, ['unsigned short']], 'IoMapBase' : [ 0x66, ['unsigned short']], 'IoMaps' : [ 0x68, ['array', 1, ['_KiIoAccessMap']]], 'IntDirectionMap' : [ 0x208c, ['array', 32, ['unsigned char']]], } ], '_TOKEN_SOURCE' : [ 0x10, { 'SourceName' : [ 0x0, ['array', 8, ['unsigned char']]], 'SourceIdentifier' : [ 0x8, ['_LUID']], } ], '_DBGKD_QUERY_MEMORY' : [ 0x18, { 'Address' : [ 0x0, ['unsigned long long']], 'Reserved' : [ 0x8, ['unsigned long long']], 'AddressSpace' : [ 0x10, ['unsigned long']], 'Flags' : [ 0x14, ['unsigned long']], } ], '_KIDTENTRY' : [ 0x8, { 'Offset' : [ 0x0, ['unsigned short']], 'Selector' : [ 0x2, ['unsigned short']], 'Access' : [ 0x4, ['unsigned short']], 'ExtendedOffset' : [ 0x6, ['unsigned short']], } ], '_DEVICE_OBJECT_POWER_EXTENSION' : [ 0x4c, { 'IdleCount' : [ 0x0, ['long']], 'ConservationIdleTime' : [ 0x4, ['unsigned long']], 'PerformanceIdleTime' : [ 0x8, ['unsigned long']], 'DeviceObject' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'IdleList' : [ 0x10, ['_LIST_ENTRY']], 'DeviceType' : [ 0x18, ['unsigned char']], 'State' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'NotifySourceList' : [ 0x20, ['_LIST_ENTRY']], 'NotifyTargetList' : [ 0x28, ['_LIST_ENTRY']], 'PowerChannelSummary' : [ 0x30, ['_POWER_CHANNEL_SUMMARY']], 'Volume' : [ 0x44, ['_LIST_ENTRY']], } ], '_MMSUPPORT_FLAGS' : [ 0x4, { 'SessionSpace' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'BeingTrimmed' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'SessionLeader' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'TrimHard' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'MaximumWorkingSetHard' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'ForceTrim' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'MinimumWorkingSetHard' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'Available0' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'MemoryPriority' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'GrowWsleHash' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'AcquiredUnsafe' : [ 0x2, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'Available' : [ 0x2, ['BitField', dict(start_bit = 2, end_bit = 16, native_type='unsigned short')]], } ], '_KSYSTEM_TIME' : [ 0xc, { 'LowPart' : [ 0x0, ['unsigned long']], 'High1Time' : [ 0x4, ['long']], 'High2Time' : [ 0x8, ['long']], } ], '_TERMINATION_PORT' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_TERMINATION_PORT']]], 'Port' : [ 0x4, ['pointer', ['void']]], } ], '_MMMOD_WRITER_LISTHEAD' : [ 0x18, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'Event' : [ 0x8, ['_KEVENT']], } ], '_IO_STATUS_BLOCK' : [ 0x8, { 'Status' : [ 0x0, ['long']], 'Pointer' : [ 0x0, ['pointer', ['void']]], 'Information' : [ 0x4, ['unsigned long']], } ], '_SYSTEM_POWER_POLICY' : [ 0xe8, { 'Revision' : [ 0x0, ['unsigned long']], 'PowerButton' : [ 0x4, ['POWER_ACTION_POLICY']], 'SleepButton' : [ 0x10, ['POWER_ACTION_POLICY']], 'LidClose' : [ 0x1c, ['POWER_ACTION_POLICY']], 'LidOpenWake' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'Reserved' : [ 0x2c, ['unsigned long']], 'Idle' : [ 0x30, ['POWER_ACTION_POLICY']], 'IdleTimeout' : [ 0x3c, ['unsigned long']], 'IdleSensitivity' : [ 0x40, ['unsigned char']], 'DynamicThrottle' : [ 0x41, ['unsigned char']], 'Spare2' : [ 0x42, ['array', 2, ['unsigned char']]], 'MinSleep' : [ 0x44, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'MaxSleep' : [ 0x48, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'ReducedLatencySleep' : [ 0x4c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'WinLogonFlags' : [ 0x50, ['unsigned long']], 'Spare3' : [ 0x54, ['unsigned long']], 'DozeS4Timeout' : [ 0x58, ['unsigned long']], 'BroadcastCapacityResolution' : [ 0x5c, ['unsigned long']], 'DischargePolicy' : [ 0x60, ['array', 4, ['SYSTEM_POWER_LEVEL']]], 'VideoTimeout' : [ 0xc0, ['unsigned long']], 'VideoDimDisplay' : [ 0xc4, ['unsigned char']], 'VideoReserved' : [ 0xc8, ['array', 3, ['unsigned long']]], 'SpindownTimeout' : [ 0xd4, ['unsigned long']], 'OptimizeForPower' : [ 0xd8, ['unsigned char']], 'FanThrottleTolerance' : [ 0xd9, ['unsigned char']], 'ForcedThrottle' : [ 0xda, ['unsigned char']], 'MinThrottle' : [ 0xdb, ['unsigned char']], 'OverThrottled' : [ 0xdc, ['POWER_ACTION_POLICY']], } ], '_POP_THERMAL_ZONE' : [ 0xd0, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'State' : [ 0x8, ['unsigned char']], 'Flags' : [ 0x9, ['unsigned char']], 'Mode' : [ 0xa, ['unsigned char']], 'PendingMode' : [ 0xb, ['unsigned char']], 'ActivePoint' : [ 0xc, ['unsigned char']], 'PendingActivePoint' : [ 0xd, ['unsigned char']], 'Throttle' : [ 0x10, ['long']], 'LastTime' : [ 0x18, ['unsigned long long']], 'SampleRate' : [ 0x20, ['unsigned long']], 'LastTemp' : [ 0x24, ['unsigned long']], 'PassiveTimer' : [ 0x28, ['_KTIMER']], 'PassiveDpc' : [ 0x50, ['_KDPC']], 'OverThrottled' : [ 0x70, ['_POP_ACTION_TRIGGER']], 'Irp' : [ 0x7c, ['pointer', ['_IRP']]], 'Info' : [ 0x80, ['_THERMAL_INFORMATION']], } ], '_DBGKD_CONTINUE2' : [ 0x20, { 'ContinueStatus' : [ 0x0, ['long']], 'ControlSet' : [ 0x4, ['_X86_DBGKD_CONTROL_SET']], 'AnyControlSet' : [ 0x4, ['_DBGKD_ANY_CONTROL_SET']], } ], '_SECURITY_TOKEN_PROXY_DATA' : [ 0x18, { 'Length' : [ 0x0, ['unsigned long']], 'ProxyClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'ProxyFull', 1: 'ProxyService', 2: 'ProxyTree', 3: 'ProxyDirectory'})]], 'PathInfo' : [ 0x8, ['_UNICODE_STRING']], 'ContainerMask' : [ 0x10, ['unsigned long']], 'ObjectMask' : [ 0x14, ['unsigned long']], } ], '_PROCESSOR_POWER_POLICY' : [ 0x4c, { 'Revision' : [ 0x0, ['unsigned long']], 'DynamicThrottle' : [ 0x4, ['unsigned char']], 'Spare' : [ 0x5, ['array', 3, ['unsigned char']]], 'DisableCStates' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Reserved' : [ 0x8, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], 'PolicyCount' : [ 0xc, ['unsigned long']], 'Policy' : [ 0x10, ['array', 3, ['_PROCESSOR_POWER_POLICY_INFO']]], } ], '_IMAGE_DOS_HEADER' : [ 0x40, { 'e_magic' : [ 0x0, ['unsigned short']], 'e_cblp' : [ 0x2, ['unsigned short']], 'e_cp' : [ 0x4, ['unsigned short']], 'e_crlc' : [ 0x6, ['unsigned short']], 'e_cparhdr' : [ 0x8, ['unsigned short']], 'e_minalloc' : [ 0xa, ['unsigned short']], 'e_maxalloc' : [ 0xc, ['unsigned short']], 'e_ss' : [ 0xe, ['unsigned short']], 'e_sp' : [ 0x10, ['unsigned short']], 'e_csum' : [ 0x12, ['unsigned short']], 'e_ip' : [ 0x14, ['unsigned short']], 'e_cs' : [ 0x16, ['unsigned short']], 'e_lfarlc' : [ 0x18, ['unsigned short']], 'e_ovno' : [ 0x1a, ['unsigned short']], 'e_res' : [ 0x1c, ['array', 4, ['unsigned short']]], 'e_oemid' : [ 0x24, ['unsigned short']], 'e_oeminfo' : [ 0x26, ['unsigned short']], 'e_res2' : [ 0x28, ['array', 10, ['unsigned short']]], 'e_lfanew' : [ 0x3c, ['long']], } ], '_OWNER_ENTRY' : [ 0x8, { 'OwnerThread' : [ 0x0, ['unsigned long']], 'OwnerCount' : [ 0x4, ['long']], 'TableSize' : [ 0x4, ['unsigned long']], } ], '_HEAP_VIRTUAL_ALLOC_ENTRY' : [ 0x20, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'ExtraStuff' : [ 0x8, ['_HEAP_ENTRY_EXTRA']], 'CommitSize' : [ 0x10, ['unsigned long']], 'ReserveSize' : [ 0x14, ['unsigned long']], 'BusyBlock' : [ 0x18, ['_HEAP_ENTRY']], } ], '_RTL_ATOM_TABLE' : [ 0x44, { 'Signature' : [ 0x0, ['unsigned long']], 'CriticalSection' : [ 0x4, ['_RTL_CRITICAL_SECTION']], 'RtlHandleTable' : [ 0x1c, ['_RTL_HANDLE_TABLE']], 'NumberOfBuckets' : [ 0x3c, ['unsigned long']], 'Buckets' : [ 0x40, ['array', 1, ['pointer', ['_RTL_ATOM_TABLE_ENTRY']]]], } ], '_FNSAVE_FORMAT' : [ 0x6c, { 'ControlWord' : [ 0x0, ['unsigned long']], 'StatusWord' : [ 0x4, ['unsigned long']], 'TagWord' : [ 0x8, ['unsigned long']], 'ErrorOffset' : [ 0xc, ['unsigned long']], 'ErrorSelector' : [ 0x10, ['unsigned long']], 'DataOffset' : [ 0x14, ['unsigned long']], 'DataSelector' : [ 0x18, ['unsigned long']], 'RegisterArea' : [ 0x1c, ['array', 80, ['unsigned char']]], } ], 'EX_QUEUE_WORKER_INFO' : [ 0x4, { 'QueueDisabled' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'MakeThreadsAsNecessary' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'WaitMode' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'WorkerCount' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'QueueWorkerInfo' : [ 0x0, ['long']], } ], 'SYSTEM_POWER_LEVEL' : [ 0x18, { 'Enable' : [ 0x0, ['unsigned char']], 'Spare' : [ 0x1, ['array', 3, ['unsigned char']]], 'BatteryLevel' : [ 0x4, ['unsigned long']], 'PowerPolicy' : [ 0x8, ['POWER_ACTION_POLICY']], 'MinSystemState' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], 'POWER_ACTION_POLICY' : [ 0xc, { 'Action' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject'})]], 'Flags' : [ 0x4, ['unsigned long']], 'EventCode' : [ 0x8, ['unsigned long']], } ], 'PROCESSOR_PERF_STATE' : [ 0x20, { 'PercentFrequency' : [ 0x0, ['unsigned char']], 'MinCapacity' : [ 0x1, ['unsigned char']], 'Power' : [ 0x2, ['unsigned short']], 'IncreaseLevel' : [ 0x4, ['unsigned char']], 'DecreaseLevel' : [ 0x5, ['unsigned char']], 'Flags' : [ 0x6, ['unsigned short']], 'IncreaseTime' : [ 0x8, ['unsigned long']], 'DecreaseTime' : [ 0xc, ['unsigned long']], 'IncreaseCount' : [ 0x10, ['unsigned long']], 'DecreaseCount' : [ 0x14, ['unsigned long']], 'PerformanceTime' : [ 0x18, ['unsigned long long']], } ], 'PROCESSOR_IDLE_TIMES' : [ 0x20, { 'StartTime' : [ 0x0, ['unsigned long long']], 'EndTime' : [ 0x8, ['unsigned long long']], 'IdleHandlerReserved' : [ 0x10, ['array', 4, ['unsigned long']]], } ], '_IMAGE_ROM_OPTIONAL_HEADER' : [ 0x38, { 'Magic' : [ 0x0, ['unsigned short']], 'MajorLinkerVersion' : [ 0x2, ['unsigned char']], 'MinorLinkerVersion' : [ 0x3, ['unsigned char']], 'SizeOfCode' : [ 0x4, ['unsigned long']], 'SizeOfInitializedData' : [ 0x8, ['unsigned long']], 'SizeOfUninitializedData' : [ 0xc, ['unsigned long']], 'AddressOfEntryPoint' : [ 0x10, ['unsigned long']], 'BaseOfCode' : [ 0x14, ['unsigned long']], 'BaseOfData' : [ 0x18, ['unsigned long']], 'BaseOfBss' : [ 0x1c, ['unsigned long']], 'GprMask' : [ 0x20, ['unsigned long']], 'CprMask' : [ 0x24, ['array', 4, ['unsigned long']]], 'GpValue' : [ 0x34, ['unsigned long']], } ], '_iobuf' : [ 0x20, { '_ptr' : [ 0x0, ['pointer', ['unsigned char']]], '_cnt' : [ 0x4, ['long']], '_base' : [ 0x8, ['pointer', ['unsigned char']]], '_flag' : [ 0xc, ['long']], '_file' : [ 0x10, ['long']], '_charbuf' : [ 0x14, ['long']], '_bufsiz' : [ 0x18, ['long']], '_tmpfname' : [ 0x1c, ['pointer', ['unsigned char']]], } ], '_MMPTE_LIST' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'OneEntry' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'filler0' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'filler1' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'NextEntry' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_CMHIVE' : [ 0x56c, { 'Hive' : [ 0x0, ['_HHIVE']], 'FileHandles' : [ 0x2d0, ['array', 3, ['pointer', ['void']]]], 'NotifyList' : [ 0x2dc, ['_LIST_ENTRY']], 'HiveList' : [ 0x2e4, ['_LIST_ENTRY']], 'HiveLock' : [ 0x2ec, ['pointer', ['_FAST_MUTEX']]], 'ViewLock' : [ 0x2f0, ['pointer', ['_FAST_MUTEX']]], 'LRUViewListHead' : [ 0x2f4, ['_LIST_ENTRY']], 'PinViewListHead' : [ 0x2fc, ['_LIST_ENTRY']], 'FileObject' : [ 0x304, ['pointer', ['_FILE_OBJECT']]], 'FileFullPath' : [ 0x308, ['_UNICODE_STRING']], 'FileUserName' : [ 0x310, ['_UNICODE_STRING']], 'MappedViews' : [ 0x318, ['unsigned short']], 'PinnedViews' : [ 0x31a, ['unsigned short']], 'UseCount' : [ 0x31c, ['unsigned long']], 'SecurityCount' : [ 0x320, ['unsigned long']], 'SecurityCacheSize' : [ 0x324, ['unsigned long']], 'SecurityHitHint' : [ 0x328, ['long']], 'SecurityCache' : [ 0x32c, ['pointer', ['_CM_KEY_SECURITY_CACHE_ENTRY']]], 'SecurityHash' : [ 0x330, ['array', 64, ['_LIST_ENTRY']]], 'UnloadEvent' : [ 0x530, ['pointer', ['_KEVENT']]], 'RootKcb' : [ 0x534, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'Frozen' : [ 0x538, ['unsigned char']], 'UnloadWorkItem' : [ 0x53c, ['pointer', ['_WORK_QUEUE_ITEM']]], 'GrowOnlyMode' : [ 0x540, ['unsigned char']], 'GrowOffset' : [ 0x544, ['unsigned long']], 'KcbConvertListHead' : [ 0x548, ['_LIST_ENTRY']], 'KnodeConvertListHead' : [ 0x550, ['_LIST_ENTRY']], 'CellRemapArray' : [ 0x558, ['pointer', ['_CM_CELL_REMAP_BLOCK']]], 'Flags' : [ 0x55c, ['unsigned long']], 'TrustClassEntry' : [ 0x560, ['_LIST_ENTRY']], 'FlushCount' : [ 0x568, ['unsigned long']], } ], '_HANDLE_TRACE_DEBUG_INFO' : [ 0x80, { 'RefCount' : [ 0x0, ['long']], 'TableSize' : [ 0x4, ['unsigned long']], 'BitMaskFlags' : [ 0x8, ['unsigned long']], 'CloseCompactionLock' : [ 0xc, ['_FAST_MUTEX']], 'CurrentStackIndex' : [ 0x2c, ['unsigned long']], 'TraceDb' : [ 0x30, ['array', 1, ['_HANDLE_TRACE_DB_ENTRY']]], } ], '_MDL' : [ 0x1c, { 'Next' : [ 0x0, ['pointer', ['_MDL']]], 'Size' : [ 0x4, ['short']], 'MdlFlags' : [ 0x6, ['short']], 'Process' : [ 0x8, ['pointer', ['_EPROCESS']]], 'MappedSystemVa' : [ 0xc, ['pointer', ['void']]], 'StartVa' : [ 0x10, ['pointer', ['void']]], 'ByteCount' : [ 0x14, ['unsigned long']], 'ByteOffset' : [ 0x18, ['unsigned long']], } ], '_HHIVE' : [ 0x2d0, { 'Signature' : [ 0x0, ['unsigned long']], 'GetCellRoutine' : [ 0x4, ['pointer', ['void']]], 'ReleaseCellRoutine' : [ 0x8, ['pointer', ['void']]], 'Allocate' : [ 0xc, ['pointer', ['void']]], 'Free' : [ 0x10, ['pointer', ['void']]], 'FileSetSize' : [ 0x14, ['pointer', ['void']]], 'FileWrite' : [ 0x18, ['pointer', ['void']]], 'FileRead' : [ 0x1c, ['pointer', ['void']]], 'FileFlush' : [ 0x20, ['pointer', ['void']]], 'BaseBlock' : [ 0x24, ['pointer', ['_HBASE_BLOCK']]], 'DirtyVector' : [ 0x28, ['_RTL_BITMAP']], 'DirtyCount' : [ 0x30, ['unsigned long']], 'DirtyAlloc' : [ 0x34, ['unsigned long']], 'BaseBlockAlloc' : [ 0x38, ['unsigned long']], 'Cluster' : [ 0x3c, ['unsigned long']], 'Flat' : [ 0x40, ['unsigned char']], 'ReadOnly' : [ 0x41, ['unsigned char']], 'Log' : [ 0x42, ['unsigned char']], 'HiveFlags' : [ 0x44, ['unsigned long']], 'LogSize' : [ 0x48, ['unsigned long']], 'RefreshCount' : [ 0x4c, ['unsigned long']], 'StorageTypeCount' : [ 0x50, ['unsigned long']], 'Version' : [ 0x54, ['unsigned long']], 'Storage' : [ 0x58, ['array', 2, ['_DUAL']]], } ], '_PAGEFAULT_HISTORY' : [ 0x18, { 'CurrentIndex' : [ 0x0, ['unsigned long']], 'MaxIndex' : [ 0x4, ['unsigned long']], 'SpinLock' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['pointer', ['void']]], 'WatchInfo' : [ 0x10, ['array', 1, ['_PROCESS_WS_WATCH_INFORMATION']]], } ], '_RTL_ATOM_TABLE_ENTRY' : [ 0x10, { 'HashLink' : [ 0x0, ['pointer', ['_RTL_ATOM_TABLE_ENTRY']]], 'HandleIndex' : [ 0x4, ['unsigned short']], 'Atom' : [ 0x6, ['unsigned short']], 'ReferenceCount' : [ 0x8, ['unsigned short']], 'Flags' : [ 0xa, ['unsigned char']], 'NameLength' : [ 0xb, ['unsigned char']], 'Name' : [ 0xc, ['array', 1, ['unsigned short']]], } ], '_MM_SESSION_SPACE_FLAGS' : [ 0x4, { 'Initialized' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DeletePending' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Filler' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], } ], '_CM_PARTIAL_RESOURCE_LIST' : [ 0x18, { 'Version' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'Count' : [ 0x4, ['unsigned long']], 'PartialDescriptors' : [ 0x8, ['array', 1, ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '__unnamed_14c7' : [ 0x28, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Wcb' : [ 0x0, ['_WAIT_CONTEXT_BLOCK']], } ], '_DEVICE_OBJECT' : [ 0xb8, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'ReferenceCount' : [ 0x4, ['long']], 'DriverObject' : [ 0x8, ['pointer', ['_DRIVER_OBJECT']]], 'NextDevice' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'AttachedDevice' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'CurrentIrp' : [ 0x14, ['pointer', ['_IRP']]], 'Timer' : [ 0x18, ['pointer', ['_IO_TIMER']]], 'Flags' : [ 0x1c, ['unsigned long']], 'Characteristics' : [ 0x20, ['unsigned long']], 'Vpb' : [ 0x24, ['pointer', ['_VPB']]], 'DeviceExtension' : [ 0x28, ['pointer', ['void']]], 'DeviceType' : [ 0x2c, ['unsigned long']], 'StackSize' : [ 0x30, ['unsigned char']], 'Queue' : [ 0x34, ['__unnamed_14c7']], 'AlignmentRequirement' : [ 0x5c, ['unsigned long']], 'DeviceQueue' : [ 0x60, ['_KDEVICE_QUEUE']], 'Dpc' : [ 0x74, ['_KDPC']], 'ActiveThreadCount' : [ 0x94, ['unsigned long']], 'SecurityDescriptor' : [ 0x98, ['pointer', ['void']]], 'DeviceLock' : [ 0x9c, ['_KEVENT']], 'SectorSize' : [ 0xac, ['unsigned short']], 'Spare1' : [ 0xae, ['unsigned short']], 'DeviceObjectExtension' : [ 0xb0, ['pointer', ['_DEVOBJ_EXTENSION']]], 'Reserved' : [ 0xb4, ['pointer', ['void']]], } ], '_SECTION_OBJECT_POINTERS' : [ 0xc, { 'DataSectionObject' : [ 0x0, ['pointer', ['void']]], 'SharedCacheMap' : [ 0x4, ['pointer', ['void']]], 'ImageSectionObject' : [ 0x8, ['pointer', ['void']]], } ], '_SEP_AUDIT_POLICY' : [ 0x8, { 'PolicyElements' : [ 0x0, ['_SEP_AUDIT_POLICY_CATEGORIES']], 'PolicyOverlay' : [ 0x0, ['_SEP_AUDIT_POLICY_OVERLAY']], 'Overlay' : [ 0x0, ['unsigned long long']], } ], '_MM_AVL_TABLE' : [ 0x20, { 'BalancedRoot' : [ 0x0, ['_MMADDRESS_NODE']], 'DepthOfTree' : [ 0x14, ['BitField', dict(start_bit = 0, end_bit = 5, native_type='unsigned long')]], 'Unused' : [ 0x14, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned long')]], 'NumberGenericTableElements' : [ 0x14, ['BitField', dict(start_bit = 8, end_bit = 32, native_type='unsigned long')]], 'NodeHint' : [ 0x18, ['pointer', ['void']]], 'NodeFreeHint' : [ 0x1c, ['pointer', ['void']]], } ], '_RTL_BITMAP' : [ 0x8, { 'SizeOfBitMap' : [ 0x0, ['unsigned long']], 'Buffer' : [ 0x4, ['pointer', ['unsigned long']]], } ], '_MBCB' : [ 0x80, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeIsInZone' : [ 0x2, ['short']], 'PagesToWrite' : [ 0x4, ['unsigned long']], 'DirtyPages' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], 'BitmapRanges' : [ 0x10, ['_LIST_ENTRY']], 'ResumeWritePage' : [ 0x18, ['long long']], 'BitmapRange1' : [ 0x20, ['_BITMAP_RANGE']], 'BitmapRange2' : [ 0x40, ['_BITMAP_RANGE']], 'BitmapRange3' : [ 0x60, ['_BITMAP_RANGE']], } ], '_POWER_CHANNEL_SUMMARY' : [ 0x14, { 'Signature' : [ 0x0, ['unsigned long']], 'TotalCount' : [ 0x4, ['unsigned long']], 'D0Count' : [ 0x8, ['unsigned long']], 'NotifyList' : [ 0xc, ['_LIST_ENTRY']], } ], '_CM_VIEW_OF_FILE' : [ 0x24, { 'LRUViewList' : [ 0x0, ['_LIST_ENTRY']], 'PinViewList' : [ 0x8, ['_LIST_ENTRY']], 'FileOffset' : [ 0x10, ['unsigned long']], 'Size' : [ 0x14, ['unsigned long']], 'ViewAddress' : [ 0x18, ['pointer', ['unsigned long']]], 'Bcb' : [ 0x1c, ['pointer', ['void']]], 'UseCount' : [ 0x20, ['unsigned long']], } ], '_KDEVICE_QUEUE' : [ 0x14, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceListHead' : [ 0x4, ['_LIST_ENTRY']], 'Lock' : [ 0xc, ['unsigned long']], 'Busy' : [ 0x10, ['unsigned char']], } ], '_KUSER_SHARED_DATA' : [ 0x330, { 'TickCountLowDeprecated' : [ 0x0, ['unsigned long']], 'TickCountMultiplier' : [ 0x4, ['unsigned long']], 'InterruptTime' : [ 0x8, ['_KSYSTEM_TIME']], 'SystemTime' : [ 0x14, ['_KSYSTEM_TIME']], 'TimeZoneBias' : [ 0x20, ['_KSYSTEM_TIME']], 'ImageNumberLow' : [ 0x2c, ['unsigned short']], 'ImageNumberHigh' : [ 0x2e, ['unsigned short']], 'NtSystemRoot' : [ 0x30, ['array', 260, ['unsigned short']]], 'MaxStackTraceDepth' : [ 0x238, ['unsigned long']], 'CryptoExponent' : [ 0x23c, ['unsigned long']], 'TimeZoneId' : [ 0x240, ['unsigned long']], 'LargePageMinimum' : [ 0x244, ['unsigned long']], 'Reserved2' : [ 0x248, ['array', 7, ['unsigned long']]], 'NtProductType' : [ 0x264, ['Enumeration', dict(target = 'long', choices = {1: 'NtProductWinNt', 2: 'NtProductLanManNt', 3: 'NtProductServer'})]], 'ProductTypeIsValid' : [ 0x268, ['unsigned char']], 'NtMajorVersion' : [ 0x26c, ['unsigned long']], 'NtMinorVersion' : [ 0x270, ['unsigned long']], 'ProcessorFeatures' : [ 0x274, ['array', 64, ['unsigned char']]], 'Reserved1' : [ 0x2b4, ['unsigned long']], 'Reserved3' : [ 0x2b8, ['unsigned long']], 'TimeSlip' : [ 0x2bc, ['unsigned long']], 'AlternativeArchitecture' : [ 0x2c0, ['Enumeration', dict(target = 'long', choices = {0: 'StandardDesign', 1: 'NEC98x86', 2: 'EndAlternatives'})]], 'SystemExpirationDate' : [ 0x2c8, ['_LARGE_INTEGER']], 'SuiteMask' : [ 0x2d0, ['unsigned long']], 'KdDebuggerEnabled' : [ 0x2d4, ['unsigned char']], 'ActiveConsoleId' : [ 0x2d8, ['unsigned long']], 'DismountCount' : [ 0x2dc, ['unsigned long']], 'ComPlusPackage' : [ 0x2e0, ['unsigned long']], 'LastSystemRITEventTickCount' : [ 0x2e4, ['unsigned long']], 'NumberOfPhysicalPages' : [ 0x2e8, ['unsigned long']], 'SafeBootMode' : [ 0x2ec, ['unsigned char']], 'TraceLogging' : [ 0x2f0, ['unsigned long']], 'Fill0' : [ 0x2f8, ['unsigned long long']], 'SystemCall' : [ 0x300, ['array', 4, ['unsigned long long']]], 'TickCount' : [ 0x320, ['_KSYSTEM_TIME']], 'TickCountQuad' : [ 0x320, ['unsigned long long']], } ], '_OBJECT_TYPE_INITIALIZER' : [ 0x4c, { 'Length' : [ 0x0, ['unsigned short']], 'UseDefaultObject' : [ 0x2, ['unsigned char']], 'CaseInsensitive' : [ 0x3, ['unsigned char']], 'InvalidAttributes' : [ 0x4, ['unsigned long']], 'GenericMapping' : [ 0x8, ['_GENERIC_MAPPING']], 'ValidAccessMask' : [ 0x18, ['unsigned long']], 'SecurityRequired' : [ 0x1c, ['unsigned char']], 'MaintainHandleCount' : [ 0x1d, ['unsigned char']], 'MaintainTypeList' : [ 0x1e, ['unsigned char']], 'PoolType' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPool', 1: 'PagedPool', 2: 'NonPagedPoolMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'DefaultPagedPoolCharge' : [ 0x24, ['unsigned long']], 'DefaultNonPagedPoolCharge' : [ 0x28, ['unsigned long']], 'DumpProcedure' : [ 0x2c, ['pointer', ['void']]], 'OpenProcedure' : [ 0x30, ['pointer', ['void']]], 'CloseProcedure' : [ 0x34, ['pointer', ['void']]], 'DeleteProcedure' : [ 0x38, ['pointer', ['void']]], 'ParseProcedure' : [ 0x3c, ['pointer', ['void']]], 'SecurityProcedure' : [ 0x40, ['pointer', ['void']]], 'QueryNameProcedure' : [ 0x44, ['pointer', ['void']]], 'OkayToCloseProcedure' : [ 0x48, ['pointer', ['void']]], } ], '__unnamed_1515' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'SubsectionFlags' : [ 0x0, ['_MMSUBSECTION_FLAGS']], } ], '_SUBSECTION' : [ 0x20, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'u' : [ 0x4, ['__unnamed_1515']], 'StartingSector' : [ 0x8, ['unsigned long']], 'NumberOfFullSectors' : [ 0xc, ['unsigned long']], 'SubsectionBase' : [ 0x10, ['pointer', ['_MMPTE']]], 'UnusedPtes' : [ 0x14, ['unsigned long']], 'PtesInSubsection' : [ 0x18, ['unsigned long']], 'NextSubsection' : [ 0x1c, ['pointer', ['_SUBSECTION']]], } ], '__unnamed_151e' : [ 0x4, { 'Balance' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='long')]], 'Parent' : [ 0x0, ['pointer', ['_MMVAD']]], } ], '__unnamed_1521' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'VadFlags' : [ 0x0, ['_MMVAD_FLAGS']], } ], '__unnamed_1524' : [ 0x4, { 'LongFlags2' : [ 0x0, ['unsigned long']], 'VadFlags2' : [ 0x0, ['_MMVAD_FLAGS2']], } ], '__unnamed_1527' : [ 0x8, { 'List' : [ 0x0, ['_LIST_ENTRY']], 'Secured' : [ 0x0, ['_MMADDRESS_LIST']], } ], '__unnamed_152d' : [ 0x4, { 'Banked' : [ 0x0, ['pointer', ['_MMBANKED_SECTION']]], 'ExtendedInfo' : [ 0x0, ['pointer', ['_MMEXTEND_INFO']]], } ], '_MMVAD_LONG' : [ 0x34, { 'u1' : [ 0x0, ['__unnamed_151e']], 'LeftChild' : [ 0x4, ['pointer', ['_MMVAD']]], 'RightChild' : [ 0x8, ['pointer', ['_MMVAD']]], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], 'u' : [ 0x14, ['__unnamed_1521']], 'ControlArea' : [ 0x18, ['pointer', ['_CONTROL_AREA']]], 'FirstPrototypePte' : [ 0x1c, ['pointer', ['_MMPTE']]], 'LastContiguousPte' : [ 0x20, ['pointer', ['_MMPTE']]], 'u2' : [ 0x24, ['__unnamed_1524']], 'u3' : [ 0x28, ['__unnamed_1527']], 'u4' : [ 0x30, ['__unnamed_152d']], } ], '_MMVAD_FLAGS' : [ 0x4, { 'CommitCharge' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 19, native_type='unsigned long')]], 'PhysicalMapping' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'ImageMap' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'UserPhysicalPages' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'NoChange' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'WriteWatch' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 29, native_type='unsigned long')]], 'LargePages' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'MemCommit' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'PrivateMemory' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_POOL_DESCRIPTOR' : [ 0x1030, { 'PoolType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPool', 1: 'PagedPool', 2: 'NonPagedPoolMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'PoolIndex' : [ 0x4, ['unsigned long']], 'RunningAllocs' : [ 0x8, ['unsigned long']], 'RunningDeAllocs' : [ 0xc, ['unsigned long']], 'TotalPages' : [ 0x10, ['unsigned long']], 'TotalBigPages' : [ 0x14, ['unsigned long']], 'Threshold' : [ 0x18, ['unsigned long']], 'LockAddress' : [ 0x1c, ['pointer', ['void']]], 'PendingFrees' : [ 0x20, ['pointer', ['void']]], 'PendingFreeDepth' : [ 0x24, ['long']], 'TotalBytes' : [ 0x28, ['unsigned long']], 'Spare0' : [ 0x2c, ['unsigned long']], 'ListHeads' : [ 0x30, ['array', 512, ['_LIST_ENTRY']]], } ], '_HARDWARE_PTE' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Owner' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Accessed' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Dirty' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'LargePage' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Global' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'reserved' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_PEB_LDR_DATA' : [ 0x28, { 'Length' : [ 0x0, ['unsigned long']], 'Initialized' : [ 0x4, ['unsigned char']], 'SsHandle' : [ 0x8, ['pointer', ['void']]], 'InLoadOrderModuleList' : [ 0xc, ['_LIST_ENTRY']], 'InMemoryOrderModuleList' : [ 0x14, ['_LIST_ENTRY']], 'InInitializationOrderModuleList' : [ 0x1c, ['_LIST_ENTRY']], 'EntryInProgress' : [ 0x24, ['pointer', ['void']]], } ], '_DBGKD_SWITCH_PARTITION' : [ 0x4, { 'Partition' : [ 0x0, ['unsigned long']], } ], '_DBGKD_GET_VERSION32' : [ 0x28, { 'MajorVersion' : [ 0x0, ['unsigned short']], 'MinorVersion' : [ 0x2, ['unsigned short']], 'ProtocolVersion' : [ 0x4, ['unsigned short']], 'Flags' : [ 0x6, ['unsigned short']], 'KernBase' : [ 0x8, ['unsigned long']], 'PsLoadedModuleList' : [ 0xc, ['unsigned long']], 'MachineType' : [ 0x10, ['unsigned short']], 'ThCallbackStack' : [ 0x12, ['unsigned short']], 'NextCallback' : [ 0x14, ['unsigned short']], 'FramePointer' : [ 0x16, ['unsigned short']], 'KiCallUserMode' : [ 0x18, ['unsigned long']], 'KeUserCallbackDispatcher' : [ 0x1c, ['unsigned long']], 'BreakpointWithStatus' : [ 0x20, ['unsigned long']], 'DebuggerDataList' : [ 0x24, ['unsigned long']], } ], '_MM_PAGED_POOL_INFO' : [ 0x20, { 'PagedPoolAllocationMap' : [ 0x0, ['pointer', ['_RTL_BITMAP']]], 'EndOfPagedPoolBitmap' : [ 0x4, ['pointer', ['_RTL_BITMAP']]], 'FirstPteForPagedPool' : [ 0x8, ['pointer', ['_MMPTE']]], 'LastPteForPagedPool' : [ 0xc, ['pointer', ['_MMPTE']]], 'NextPdeForPagedPoolExpansion' : [ 0x10, ['pointer', ['_MMPTE']]], 'PagedPoolHint' : [ 0x14, ['unsigned long']], 'PagedPoolCommit' : [ 0x18, ['unsigned long']], 'AllocatedPagedPool' : [ 0x1c, ['unsigned long']], } ], '_INTERLOCK_SEQ' : [ 0x8, { 'Depth' : [ 0x0, ['unsigned short']], 'FreeEntryOffset' : [ 0x2, ['unsigned short']], 'OffsetAndDepth' : [ 0x0, ['unsigned long']], 'Sequence' : [ 0x4, ['unsigned long']], 'Exchg' : [ 0x0, ['long long']], } ], '_VPB' : [ 0x58, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'Flags' : [ 0x4, ['unsigned short']], 'VolumeLabelLength' : [ 0x6, ['unsigned short']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'RealDevice' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'SerialNumber' : [ 0x10, ['unsigned long']], 'ReferenceCount' : [ 0x14, ['unsigned long']], 'VolumeLabel' : [ 0x18, ['array', 32, ['unsigned short']]], } ], '_MMSESSION' : [ 0x40, { 'SystemSpaceViewLock' : [ 0x0, ['_KGUARDED_MUTEX']], 'SystemSpaceViewLockPointer' : [ 0x20, ['pointer', ['_KGUARDED_MUTEX']]], 'SystemSpaceViewStart' : [ 0x24, ['pointer', ['unsigned char']]], 'SystemSpaceViewTable' : [ 0x28, ['pointer', ['_MMVIEW']]], 'SystemSpaceHashSize' : [ 0x2c, ['unsigned long']], 'SystemSpaceHashEntries' : [ 0x30, ['unsigned long']], 'SystemSpaceHashKey' : [ 0x34, ['unsigned long']], 'BitmapFailures' : [ 0x38, ['unsigned long']], 'SystemSpaceBitMap' : [ 0x3c, ['pointer', ['_RTL_BITMAP']]], } ], '_GENERIC_MAPPING' : [ 0x10, { 'GenericRead' : [ 0x0, ['unsigned long']], 'GenericWrite' : [ 0x4, ['unsigned long']], 'GenericExecute' : [ 0x8, ['unsigned long']], 'GenericAll' : [ 0xc, ['unsigned long']], } ], '_KiIoAccessMap' : [ 0x2024, { 'DirectionMap' : [ 0x0, ['array', 32, ['unsigned char']]], 'IoMap' : [ 0x20, ['array', 8196, ['unsigned char']]], } ], '_DBGKD_RESTORE_BREAKPOINT' : [ 0x4, { 'BreakPointHandle' : [ 0x0, ['unsigned long']], } ], '_EXCEPTION_REGISTRATION_RECORD' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'Handler' : [ 0x4, ['pointer', ['void']]], } ], '_SEP_AUDIT_POLICY_OVERLAY' : [ 0x8, { 'PolicyBits' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 36, native_type='unsigned long long')]], 'SetBit' : [ 0x0, ['BitField', dict(start_bit = 36, end_bit = 37, native_type='unsigned long long')]], } ], '_POOL_TRACKER_BIG_PAGES' : [ 0x10, { 'Va' : [ 0x0, ['pointer', ['void']]], 'Key' : [ 0x4, ['unsigned long']], 'NumberOfPages' : [ 0x8, ['unsigned long']], 'QuotaObject' : [ 0xc, ['pointer', ['void']]], } ], '_PROCESS_WS_WATCH_INFORMATION' : [ 0x8, { 'FaultingPc' : [ 0x0, ['pointer', ['void']]], 'FaultingVa' : [ 0x4, ['pointer', ['void']]], } ], '_MMPTE_SUBSECTION' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'SubsectionAddressLow' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 5, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'SubsectionAddressHigh' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 31, native_type='unsigned long')]], 'WhichPool' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_VI_DEADLOCK_NODE' : [ 0x68, { 'Parent' : [ 0x0, ['pointer', ['_VI_DEADLOCK_NODE']]], 'ChildrenList' : [ 0x4, ['_LIST_ENTRY']], 'SiblingsList' : [ 0xc, ['_LIST_ENTRY']], 'ResourceList' : [ 0x14, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x14, ['_LIST_ENTRY']], 'Root' : [ 0x1c, ['pointer', ['_VI_DEADLOCK_RESOURCE']]], 'ThreadEntry' : [ 0x20, ['pointer', ['_VI_DEADLOCK_THREAD']]], 'Active' : [ 0x24, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'OnlyTryAcquireUsed' : [ 0x24, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ReleasedOutOfOrder' : [ 0x24, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'SequenceNumber' : [ 0x24, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'StackTrace' : [ 0x28, ['array', 8, ['pointer', ['void']]]], 'ParentStackTrace' : [ 0x48, ['array', 8, ['pointer', ['void']]]], } ], '_CONTEXT' : [ 0x2cc, { 'ContextFlags' : [ 0x0, ['unsigned long']], 'Dr0' : [ 0x4, ['unsigned long']], 'Dr1' : [ 0x8, ['unsigned long']], 'Dr2' : [ 0xc, ['unsigned long']], 'Dr3' : [ 0x10, ['unsigned long']], 'Dr6' : [ 0x14, ['unsigned long']], 'Dr7' : [ 0x18, ['unsigned long']], 'FloatSave' : [ 0x1c, ['_FLOATING_SAVE_AREA']], 'SegGs' : [ 0x8c, ['unsigned long']], 'SegFs' : [ 0x90, ['unsigned long']], 'SegEs' : [ 0x94, ['unsigned long']], 'SegDs' : [ 0x98, ['unsigned long']], 'Edi' : [ 0x9c, ['unsigned long']], 'Esi' : [ 0xa0, ['unsigned long']], 'Ebx' : [ 0xa4, ['unsigned long']], 'Edx' : [ 0xa8, ['unsigned long']], 'Ecx' : [ 0xac, ['unsigned long']], 'Eax' : [ 0xb0, ['unsigned long']], 'Ebp' : [ 0xb4, ['unsigned long']], 'Eip' : [ 0xb8, ['unsigned long']], 'SegCs' : [ 0xbc, ['unsigned long']], 'EFlags' : [ 0xc0, ['unsigned long']], 'Esp' : [ 0xc4, ['unsigned long']], 'SegSs' : [ 0xc8, ['unsigned long']], 'ExtendedRegisters' : [ 0xcc, ['array', 512, ['unsigned char']]], } ], '_IMAGE_OPTIONAL_HEADER' : [ 0xe0, { 'Magic' : [ 0x0, ['unsigned short']], 'MajorLinkerVersion' : [ 0x2, ['unsigned char']], 'MinorLinkerVersion' : [ 0x3, ['unsigned char']], 'SizeOfCode' : [ 0x4, ['unsigned long']], 'SizeOfInitializedData' : [ 0x8, ['unsigned long']], 'SizeOfUninitializedData' : [ 0xc, ['unsigned long']], 'AddressOfEntryPoint' : [ 0x10, ['unsigned long']], 'BaseOfCode' : [ 0x14, ['unsigned long']], 'BaseOfData' : [ 0x18, ['unsigned long']], 'ImageBase' : [ 0x1c, ['unsigned long']], 'SectionAlignment' : [ 0x20, ['unsigned long']], 'FileAlignment' : [ 0x24, ['unsigned long']], 'MajorOperatingSystemVersion' : [ 0x28, ['unsigned short']], 'MinorOperatingSystemVersion' : [ 0x2a, ['unsigned short']], 'MajorImageVersion' : [ 0x2c, ['unsigned short']], 'MinorImageVersion' : [ 0x2e, ['unsigned short']], 'MajorSubsystemVersion' : [ 0x30, ['unsigned short']], 'MinorSubsystemVersion' : [ 0x32, ['unsigned short']], 'Win32VersionValue' : [ 0x34, ['unsigned long']], 'SizeOfImage' : [ 0x38, ['unsigned long']], 'SizeOfHeaders' : [ 0x3c, ['unsigned long']], 'CheckSum' : [ 0x40, ['unsigned long']], 'Subsystem' : [ 0x44, ['unsigned short']], 'DllCharacteristics' : [ 0x46, ['unsigned short']], 'SizeOfStackReserve' : [ 0x48, ['unsigned long']], 'SizeOfStackCommit' : [ 0x4c, ['unsigned long']], 'SizeOfHeapReserve' : [ 0x50, ['unsigned long']], 'SizeOfHeapCommit' : [ 0x54, ['unsigned long']], 'LoaderFlags' : [ 0x58, ['unsigned long']], 'NumberOfRvaAndSizes' : [ 0x5c, ['unsigned long']], 'DataDirectory' : [ 0x60, ['array', 16, ['_IMAGE_DATA_DIRECTORY']]], } ], '_DBGKD_QUERY_SPECIAL_CALLS' : [ 0x4, { 'NumberOfSpecialCalls' : [ 0x0, ['unsigned long']], } ], 'CMP_OFFSET_ARRAY' : [ 0xc, { 'FileOffset' : [ 0x0, ['unsigned long']], 'DataBuffer' : [ 0x4, ['pointer', ['void']]], 'DataLength' : [ 0x8, ['unsigned long']], } ], '_PCI_PDO_EXTENSION' : [ 0xd8, { 'Next' : [ 0x0, ['pointer', ['_PCI_PDO_EXTENSION']]], 'ExtensionType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1768116272: 'PciPdoExtensionType', 1768116273: 'PciFdoExtensionType', 1768116274: 'PciArb_Io', 1768116275: 'PciArb_Memory', 1768116276: 'PciArb_Interrupt', 1768116277: 'PciArb_BusNumber', 1768116278: 'PciTrans_Interrupt', 1768116279: 'PciInterface_BusHandler', 1768116280: 'PciInterface_IntRouteHandler', 1768116281: 'PciInterface_PciCb', 1768116282: 'PciInterface_LegacyDeviceDetection', 1768116283: 'PciInterface_PmeHandler', 1768116284: 'PciInterface_DevicePresent', 1768116285: 'PciInterface_NativeIde', 1768116286: 'PciInterface_Location', 1768116287: 'PciInterface_AgpTarget'})]], 'IrpDispatchTable' : [ 0x8, ['pointer', ['_PCI_MJ_DISPATCH_TABLE']]], 'DeviceState' : [ 0xc, ['unsigned char']], 'TentativeNextState' : [ 0xd, ['unsigned char']], 'SecondaryExtMutex' : [ 0x10, ['_FAST_MUTEX']], 'Slot' : [ 0x30, ['_PCI_SLOT_NUMBER']], 'PhysicalDeviceObject' : [ 0x34, ['pointer', ['_DEVICE_OBJECT']]], 'ParentFdoExtension' : [ 0x38, ['pointer', ['_PCI_FDO_EXTENSION']]], 'SecondaryExtension' : [ 0x3c, ['_SINGLE_LIST_ENTRY']], 'BusInterfaceReferenceCount' : [ 0x40, ['unsigned long']], 'AgpInterfaceReferenceCount' : [ 0x44, ['unsigned long']], 'VendorId' : [ 0x48, ['unsigned short']], 'DeviceId' : [ 0x4a, ['unsigned short']], 'SubsystemVendorId' : [ 0x4c, ['unsigned short']], 'SubsystemId' : [ 0x4e, ['unsigned short']], 'RevisionId' : [ 0x50, ['unsigned char']], 'ProgIf' : [ 0x51, ['unsigned char']], 'SubClass' : [ 0x52, ['unsigned char']], 'BaseClass' : [ 0x53, ['unsigned char']], 'AdditionalResourceCount' : [ 0x54, ['unsigned char']], 'AdjustedInterruptLine' : [ 0x55, ['unsigned char']], 'InterruptPin' : [ 0x56, ['unsigned char']], 'RawInterruptLine' : [ 0x57, ['unsigned char']], 'CapabilitiesPtr' : [ 0x58, ['unsigned char']], 'SavedLatencyTimer' : [ 0x59, ['unsigned char']], 'SavedCacheLineSize' : [ 0x5a, ['unsigned char']], 'HeaderType' : [ 0x5b, ['unsigned char']], 'NotPresent' : [ 0x5c, ['unsigned char']], 'ReportedMissing' : [ 0x5d, ['unsigned char']], 'ExpectedWritebackFailure' : [ 0x5e, ['unsigned char']], 'NoTouchPmeEnable' : [ 0x5f, ['unsigned char']], 'LegacyDriver' : [ 0x60, ['unsigned char']], 'UpdateHardware' : [ 0x61, ['unsigned char']], 'MovedDevice' : [ 0x62, ['unsigned char']], 'DisablePowerDown' : [ 0x63, ['unsigned char']], 'NeedsHotPlugConfiguration' : [ 0x64, ['unsigned char']], 'IDEInNativeMode' : [ 0x65, ['unsigned char']], 'BIOSAllowsIDESwitchToNativeMode' : [ 0x66, ['unsigned char']], 'IoSpaceUnderNativeIdeControl' : [ 0x67, ['unsigned char']], 'OnDebugPath' : [ 0x68, ['unsigned char']], 'PowerState' : [ 0x6c, ['PCI_POWER_STATE']], 'Dependent' : [ 0xac, ['PCI_HEADER_TYPE_DEPENDENT']], 'HackFlags' : [ 0xb0, ['unsigned long long']], 'Resources' : [ 0xb8, ['pointer', ['PCI_FUNCTION_RESOURCES']]], 'BridgeFdoExtension' : [ 0xbc, ['pointer', ['_PCI_FDO_EXTENSION']]], 'NextBridge' : [ 0xc0, ['pointer', ['_PCI_PDO_EXTENSION']]], 'NextHashEntry' : [ 0xc4, ['pointer', ['_PCI_PDO_EXTENSION']]], 'Lock' : [ 0xc8, ['_PCI_LOCK']], 'PowerCapabilities' : [ 0xd0, ['_PCI_PMC']], 'TargetAgpCapabilityId' : [ 0xd2, ['unsigned char']], 'CommandEnables' : [ 0xd4, ['unsigned short']], 'InitialCommand' : [ 0xd6, ['unsigned short']], } ], '_HMAP_DIRECTORY' : [ 0x1000, { 'Directory' : [ 0x0, ['array', 1024, ['pointer', ['_HMAP_TABLE']]]], } ], '_OBJECT_HEADER' : [ 0x20, { 'PointerCount' : [ 0x0, ['long']], 'HandleCount' : [ 0x4, ['long']], 'NextToFree' : [ 0x4, ['pointer', ['void']]], 'Type' : [ 0x8, ['pointer', ['_OBJECT_TYPE']]], 'NameInfoOffset' : [ 0xc, ['unsigned char']], 'HandleInfoOffset' : [ 0xd, ['unsigned char']], 'QuotaInfoOffset' : [ 0xe, ['unsigned char']], 'Flags' : [ 0xf, ['unsigned char']], 'ObjectCreateInfo' : [ 0x10, ['pointer', ['_OBJECT_CREATE_INFORMATION']]], 'QuotaBlockCharged' : [ 0x10, ['pointer', ['void']]], 'SecurityDescriptor' : [ 0x14, ['pointer', ['void']]], 'Body' : [ 0x18, ['_QUAD']], } ], '_QUAD' : [ 0x8, { 'DoNotUseThisField' : [ 0x0, ['double']], } ], '_SECURITY_DESCRIPTOR' : [ 0x14, { 'Revision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'Control' : [ 0x2, ['unsigned short']], 'Owner' : [ 0x4, ['pointer', ['void']]], 'Group' : [ 0x8, ['pointer', ['void']]], 'Sacl' : [ 0xc, ['pointer', ['_ACL']]], 'Dacl' : [ 0x10, ['pointer', ['_ACL']]], } ], '__unnamed_15a1' : [ 0x8, { 'UserData' : [ 0x0, ['pointer', ['void']]], 'Owner' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_15a3' : [ 0x8, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], } ], '_RTLP_RANGE_LIST_ENTRY' : [ 0x28, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'Allocated' : [ 0x10, ['__unnamed_15a1']], 'Merged' : [ 0x10, ['__unnamed_15a3']], 'Attributes' : [ 0x18, ['unsigned char']], 'PublicFlags' : [ 0x19, ['unsigned char']], 'PrivateFlags' : [ 0x1a, ['unsigned short']], 'ListEntry' : [ 0x1c, ['_LIST_ENTRY']], } ], '_KAPC_STATE' : [ 0x18, { 'ApcListHead' : [ 0x0, ['array', 2, ['_LIST_ENTRY']]], 'Process' : [ 0x10, ['pointer', ['_KPROCESS']]], 'KernelApcInProgress' : [ 0x14, ['unsigned char']], 'KernelApcPending' : [ 0x15, ['unsigned char']], 'UserApcPending' : [ 0x16, ['unsigned char']], } ], '_OBJECT_HEADER_CREATOR_INFO' : [ 0x10, { 'TypeList' : [ 0x0, ['_LIST_ENTRY']], 'CreatorUniqueProcess' : [ 0x8, ['pointer', ['void']]], 'CreatorBackTraceIndex' : [ 0xc, ['unsigned short']], 'Reserved' : [ 0xe, ['unsigned short']], } ], '_HEAP_STOP_ON_VALUES' : [ 0x18, { 'AllocAddress' : [ 0x0, ['unsigned long']], 'AllocTag' : [ 0x4, ['_HEAP_STOP_ON_TAG']], 'ReAllocAddress' : [ 0x8, ['unsigned long']], 'ReAllocTag' : [ 0xc, ['_HEAP_STOP_ON_TAG']], 'FreeAddress' : [ 0x10, ['unsigned long']], 'FreeTag' : [ 0x14, ['_HEAP_STOP_ON_TAG']], } ], '_DEVICE_RELATIONS' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'Objects' : [ 0x4, ['array', 1, ['pointer', ['_DEVICE_OBJECT']]]], } ], '_DEVICE_MAP' : [ 0x30, { 'DosDevicesDirectory' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY']]], 'GlobalDosDevicesDirectory' : [ 0x4, ['pointer', ['_OBJECT_DIRECTORY']]], 'ReferenceCount' : [ 0x8, ['unsigned long']], 'DriveMap' : [ 0xc, ['unsigned long']], 'DriveType' : [ 0x10, ['array', 32, ['unsigned char']]], } ], '_HEAP_PSEUDO_TAG_ENTRY' : [ 0xc, { 'Allocs' : [ 0x0, ['unsigned long']], 'Frees' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], } ], '_IO_RESOURCE_LIST' : [ 0x28, { 'Version' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'Count' : [ 0x4, ['unsigned long']], 'Descriptors' : [ 0x8, ['array', 1, ['_IO_RESOURCE_DESCRIPTOR']]], } ], '_MMBANKED_SECTION' : [ 0x20, { 'BasePhysicalPage' : [ 0x0, ['unsigned long']], 'BasedPte' : [ 0x4, ['pointer', ['_MMPTE']]], 'BankSize' : [ 0x8, ['unsigned long']], 'BankShift' : [ 0xc, ['unsigned long']], 'BankedRoutine' : [ 0x10, ['pointer', ['void']]], 'Context' : [ 0x14, ['pointer', ['void']]], 'CurrentMappedPte' : [ 0x18, ['pointer', ['_MMPTE']]], 'BankTemplate' : [ 0x1c, ['array', 1, ['_MMPTE']]], } ], '_RTL_CRITICAL_SECTION' : [ 0x18, { 'DebugInfo' : [ 0x0, ['pointer', ['_RTL_CRITICAL_SECTION_DEBUG']]], 'LockCount' : [ 0x4, ['long']], 'RecursionCount' : [ 0x8, ['long']], 'OwningThread' : [ 0xc, ['pointer', ['void']]], 'LockSemaphore' : [ 0x10, ['pointer', ['void']]], 'SpinCount' : [ 0x14, ['unsigned long']], } ], '_HEAP_SEGMENT' : [ 0x3c, { 'Entry' : [ 0x0, ['_HEAP_ENTRY']], 'Signature' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['unsigned long']], 'Heap' : [ 0x10, ['pointer', ['_HEAP']]], 'LargestUnCommittedRange' : [ 0x14, ['unsigned long']], 'BaseAddress' : [ 0x18, ['pointer', ['void']]], 'NumberOfPages' : [ 0x1c, ['unsigned long']], 'FirstEntry' : [ 0x20, ['pointer', ['_HEAP_ENTRY']]], 'LastValidEntry' : [ 0x24, ['pointer', ['_HEAP_ENTRY']]], 'NumberOfUnCommittedPages' : [ 0x28, ['unsigned long']], 'NumberOfUnCommittedRanges' : [ 0x2c, ['unsigned long']], 'UnCommittedRanges' : [ 0x30, ['pointer', ['_HEAP_UNCOMMMTTED_RANGE']]], 'AllocatorBackTraceIndex' : [ 0x34, ['unsigned short']], 'Reserved' : [ 0x36, ['unsigned short']], 'LastEntryInSegment' : [ 0x38, ['pointer', ['_HEAP_ENTRY']]], } ], '_KTRAP_FRAME' : [ 0x8c, { 'DbgEbp' : [ 0x0, ['unsigned long']], 'DbgEip' : [ 0x4, ['unsigned long']], 'DbgArgMark' : [ 0x8, ['unsigned long']], 'DbgArgPointer' : [ 0xc, ['unsigned long']], 'TempSegCs' : [ 0x10, ['unsigned long']], 'TempEsp' : [ 0x14, ['unsigned long']], 'Dr0' : [ 0x18, ['unsigned long']], 'Dr1' : [ 0x1c, ['unsigned long']], 'Dr2' : [ 0x20, ['unsigned long']], 'Dr3' : [ 0x24, ['unsigned long']], 'Dr6' : [ 0x28, ['unsigned long']], 'Dr7' : [ 0x2c, ['unsigned long']], 'SegGs' : [ 0x30, ['unsigned long']], 'SegEs' : [ 0x34, ['unsigned long']], 'SegDs' : [ 0x38, ['unsigned long']], 'Edx' : [ 0x3c, ['unsigned long']], 'Ecx' : [ 0x40, ['unsigned long']], 'Eax' : [ 0x44, ['unsigned long']], 'PreviousPreviousMode' : [ 0x48, ['unsigned long']], 'ExceptionList' : [ 0x4c, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'SegFs' : [ 0x50, ['unsigned long']], 'Edi' : [ 0x54, ['unsigned long']], 'Esi' : [ 0x58, ['unsigned long']], 'Ebx' : [ 0x5c, ['unsigned long']], 'Ebp' : [ 0x60, ['unsigned long']], 'ErrCode' : [ 0x64, ['unsigned long']], 'Eip' : [ 0x68, ['unsigned long']], 'SegCs' : [ 0x6c, ['unsigned long']], 'EFlags' : [ 0x70, ['unsigned long']], 'HardwareEsp' : [ 0x74, ['unsigned long']], 'HardwareSegSs' : [ 0x78, ['unsigned long']], 'V86Es' : [ 0x7c, ['unsigned long']], 'V86Ds' : [ 0x80, ['unsigned long']], 'V86Fs' : [ 0x84, ['unsigned long']], 'V86Gs' : [ 0x88, ['unsigned long']], } ], '__unnamed_15d4' : [ 0x5, { 'Acquired' : [ 0x0, ['unsigned char']], 'CacheLineSize' : [ 0x1, ['unsigned char']], 'LatencyTimer' : [ 0x2, ['unsigned char']], 'EnablePERR' : [ 0x3, ['unsigned char']], 'EnableSERR' : [ 0x4, ['unsigned char']], } ], '_PCI_FDO_EXTENSION' : [ 0xe0, { 'List' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'ExtensionType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1768116272: 'PciPdoExtensionType', 1768116273: 'PciFdoExtensionType', 1768116274: 'PciArb_Io', 1768116275: 'PciArb_Memory', 1768116276: 'PciArb_Interrupt', 1768116277: 'PciArb_BusNumber', 1768116278: 'PciTrans_Interrupt', 1768116279: 'PciInterface_BusHandler', 1768116280: 'PciInterface_IntRouteHandler', 1768116281: 'PciInterface_PciCb', 1768116282: 'PciInterface_LegacyDeviceDetection', 1768116283: 'PciInterface_PmeHandler', 1768116284: 'PciInterface_DevicePresent', 1768116285: 'PciInterface_NativeIde', 1768116286: 'PciInterface_Location', 1768116287: 'PciInterface_AgpTarget'})]], 'IrpDispatchTable' : [ 0x8, ['pointer', ['_PCI_MJ_DISPATCH_TABLE']]], 'DeviceState' : [ 0xc, ['unsigned char']], 'TentativeNextState' : [ 0xd, ['unsigned char']], 'SecondaryExtMutex' : [ 0x10, ['_FAST_MUTEX']], 'PhysicalDeviceObject' : [ 0x30, ['pointer', ['_DEVICE_OBJECT']]], 'FunctionalDeviceObject' : [ 0x34, ['pointer', ['_DEVICE_OBJECT']]], 'AttachedDeviceObject' : [ 0x38, ['pointer', ['_DEVICE_OBJECT']]], 'ChildListMutex' : [ 0x3c, ['_FAST_MUTEX']], 'ChildPdoList' : [ 0x5c, ['pointer', ['_PCI_PDO_EXTENSION']]], 'BusRootFdoExtension' : [ 0x60, ['pointer', ['_PCI_FDO_EXTENSION']]], 'ParentFdoExtension' : [ 0x64, ['pointer', ['_PCI_FDO_EXTENSION']]], 'ChildBridgePdoList' : [ 0x68, ['pointer', ['_PCI_PDO_EXTENSION']]], 'PciBusInterface' : [ 0x6c, ['pointer', ['_PCI_BUS_INTERFACE_STANDARD']]], 'MaxSubordinateBus' : [ 0x70, ['unsigned char']], 'BusHandler' : [ 0x74, ['pointer', ['_BUS_HANDLER']]], 'BaseBus' : [ 0x78, ['unsigned char']], 'Fake' : [ 0x79, ['unsigned char']], 'Scanned' : [ 0x7a, ['unsigned char']], 'ArbitersInitialized' : [ 0x7b, ['unsigned char']], 'BrokenVideoHackApplied' : [ 0x7c, ['unsigned char']], 'Hibernated' : [ 0x7d, ['unsigned char']], 'PowerState' : [ 0x80, ['PCI_POWER_STATE']], 'SecondaryExtension' : [ 0xc0, ['_SINGLE_LIST_ENTRY']], 'ChildWaitWakeCount' : [ 0xc4, ['unsigned long']], 'IchHackConfig' : [ 0xc8, ['pointer', ['_PCI_COMMON_CONFIG']]], 'Lock' : [ 0xcc, ['_PCI_LOCK']], 'HotPlugParameters' : [ 0xd4, ['__unnamed_15d4']], 'BusHackFlags' : [ 0xdc, ['unsigned long']], } ], '__unnamed_15d8' : [ 0xc, { 'Start' : [ 0x0, ['_LARGE_INTEGER']], 'Length' : [ 0x8, ['unsigned long']], } ], '__unnamed_15da' : [ 0xc, { 'Level' : [ 0x0, ['unsigned long']], 'Vector' : [ 0x4, ['unsigned long']], 'Affinity' : [ 0x8, ['unsigned long']], } ], '__unnamed_15dc' : [ 0xc, { 'Channel' : [ 0x0, ['unsigned long']], 'Port' : [ 0x4, ['unsigned long']], 'Reserved1' : [ 0x8, ['unsigned long']], } ], '__unnamed_15de' : [ 0xc, { 'Data' : [ 0x0, ['array', 3, ['unsigned long']]], } ], '__unnamed_15e0' : [ 0xc, { 'Start' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned long']], } ], '__unnamed_15e2' : [ 0xc, { 'DataSize' : [ 0x0, ['unsigned long']], 'Reserved1' : [ 0x4, ['unsigned long']], 'Reserved2' : [ 0x8, ['unsigned long']], } ], '__unnamed_15e4' : [ 0xc, { 'Generic' : [ 0x0, ['__unnamed_15d8']], 'Port' : [ 0x0, ['__unnamed_15d8']], 'Interrupt' : [ 0x0, ['__unnamed_15da']], 'Memory' : [ 0x0, ['__unnamed_15d8']], 'Dma' : [ 0x0, ['__unnamed_15dc']], 'DevicePrivate' : [ 0x0, ['__unnamed_15de']], 'BusNumber' : [ 0x0, ['__unnamed_15e0']], 'DeviceSpecificData' : [ 0x0, ['__unnamed_15e2']], } ], '_CM_PARTIAL_RESOURCE_DESCRIPTOR' : [ 0x10, { 'Type' : [ 0x0, ['unsigned char']], 'ShareDisposition' : [ 0x1, ['unsigned char']], 'Flags' : [ 0x2, ['unsigned short']], 'u' : [ 0x4, ['__unnamed_15e4']], } ], '_WAIT_CONTEXT_BLOCK' : [ 0x28, { 'WaitQueueEntry' : [ 0x0, ['_KDEVICE_QUEUE_ENTRY']], 'DeviceRoutine' : [ 0x10, ['pointer', ['void']]], 'DeviceContext' : [ 0x14, ['pointer', ['void']]], 'NumberOfMapRegisters' : [ 0x18, ['unsigned long']], 'DeviceObject' : [ 0x1c, ['pointer', ['void']]], 'CurrentIrp' : [ 0x20, ['pointer', ['void']]], 'BufferChainingDpc' : [ 0x24, ['pointer', ['_KDPC']]], } ], '_CM_KEY_CONTROL_BLOCK' : [ 0x48, { 'RefCount' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'ExtFlags' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'PrivateAlloc' : [ 0x4, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Delete' : [ 0x4, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'DelayedCloseIndex' : [ 0x4, ['BitField', dict(start_bit = 10, end_bit = 22, native_type='unsigned long')]], 'TotalLevels' : [ 0x4, ['BitField', dict(start_bit = 22, end_bit = 32, native_type='unsigned long')]], 'KeyHash' : [ 0x8, ['_CM_KEY_HASH']], 'ConvKey' : [ 0x8, ['unsigned long']], 'NextHash' : [ 0xc, ['pointer', ['_CM_KEY_HASH']]], 'KeyHive' : [ 0x10, ['pointer', ['_HHIVE']]], 'KeyCell' : [ 0x14, ['unsigned long']], 'ParentKcb' : [ 0x18, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'NameBlock' : [ 0x1c, ['pointer', ['_CM_NAME_CONTROL_BLOCK']]], 'CachedSecurity' : [ 0x20, ['pointer', ['_CM_KEY_SECURITY_CACHE']]], 'ValueCache' : [ 0x24, ['_CACHED_CHILD_LIST']], 'IndexHint' : [ 0x2c, ['pointer', ['_CM_INDEX_HINT_BLOCK']]], 'HashKey' : [ 0x2c, ['unsigned long']], 'SubKeyCount' : [ 0x2c, ['unsigned long']], 'KeyBodyListHead' : [ 0x30, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x30, ['_LIST_ENTRY']], 'KcbLastWriteTime' : [ 0x38, ['_LARGE_INTEGER']], 'KcbMaxNameLen' : [ 0x40, ['unsigned short']], 'KcbMaxValueNameLen' : [ 0x42, ['unsigned short']], 'KcbMaxValueDataLen' : [ 0x44, ['unsigned long']], } ], '_KDPC' : [ 0x20, { 'Type' : [ 0x0, ['short']], 'Number' : [ 0x2, ['unsigned char']], 'Importance' : [ 0x3, ['unsigned char']], 'DpcListEntry' : [ 0x4, ['_LIST_ENTRY']], 'DeferredRoutine' : [ 0xc, ['pointer', ['void']]], 'DeferredContext' : [ 0x10, ['pointer', ['void']]], 'SystemArgument1' : [ 0x14, ['pointer', ['void']]], 'SystemArgument2' : [ 0x18, ['pointer', ['void']]], 'DpcData' : [ 0x1c, ['pointer', ['void']]], } ], '_PCI_BUS_INTERFACE_STANDARD' : [ 0x20, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], 'ReadConfig' : [ 0x10, ['pointer', ['void']]], 'WriteConfig' : [ 0x14, ['pointer', ['void']]], 'PinToLine' : [ 0x18, ['pointer', ['void']]], 'LineToPin' : [ 0x1c, ['pointer', ['void']]], } ], '_WORK_QUEUE_ITEM' : [ 0x10, { 'List' : [ 0x0, ['_LIST_ENTRY']], 'WorkerRoutine' : [ 0x8, ['pointer', ['void']]], 'Parameter' : [ 0xc, ['pointer', ['void']]], } ], '_PI_RESOURCE_ARBITER_ENTRY' : [ 0x38, { 'DeviceArbiterList' : [ 0x0, ['_LIST_ENTRY']], 'ResourceType' : [ 0x8, ['unsigned char']], 'ArbiterInterface' : [ 0xc, ['pointer', ['_ARBITER_INTERFACE']]], 'Level' : [ 0x10, ['unsigned long']], 'ResourceList' : [ 0x14, ['_LIST_ENTRY']], 'BestResourceList' : [ 0x1c, ['_LIST_ENTRY']], 'BestConfig' : [ 0x24, ['_LIST_ENTRY']], 'ActiveArbiterList' : [ 0x2c, ['_LIST_ENTRY']], 'State' : [ 0x34, ['unsigned char']], 'ResourcesChanged' : [ 0x35, ['unsigned char']], } ], '_SEP_AUDIT_POLICY_CATEGORIES' : [ 0x8, { 'System' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned long')]], 'Logon' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned long')]], 'ObjectAccess' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 12, native_type='unsigned long')]], 'PrivilegeUse' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 16, native_type='unsigned long')]], 'DetailedTracking' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 20, native_type='unsigned long')]], 'PolicyChange' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 24, native_type='unsigned long')]], 'AccountManagement' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 28, native_type='unsigned long')]], 'DirectoryServiceAccess' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 32, native_type='unsigned long')]], 'AccountLogon' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned long')]], } ], '_CM_KEY_HASH' : [ 0x10, { 'ConvKey' : [ 0x0, ['unsigned long']], 'NextHash' : [ 0x4, ['pointer', ['_CM_KEY_HASH']]], 'KeyHive' : [ 0x8, ['pointer', ['_HHIVE']]], 'KeyCell' : [ 0xc, ['unsigned long']], } ], '__unnamed_161e' : [ 0x4, { 'MasterIrp' : [ 0x0, ['pointer', ['_IRP']]], 'IrpCount' : [ 0x0, ['long']], 'SystemBuffer' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_1624' : [ 0x8, { 'UserApcRoutine' : [ 0x0, ['pointer', ['void']]], 'UserApcContext' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_1626' : [ 0x8, { 'AsynchronousParameters' : [ 0x0, ['__unnamed_1624']], 'AllocationSize' : [ 0x0, ['_LARGE_INTEGER']], } ], '__unnamed_162e' : [ 0x28, { 'DeviceQueueEntry' : [ 0x0, ['_KDEVICE_QUEUE_ENTRY']], 'DriverContext' : [ 0x0, ['array', 4, ['pointer', ['void']]]], 'Thread' : [ 0x10, ['pointer', ['_ETHREAD']]], 'AuxiliaryBuffer' : [ 0x14, ['pointer', ['unsigned char']]], 'ListEntry' : [ 0x18, ['_LIST_ENTRY']], 'CurrentStackLocation' : [ 0x20, ['pointer', ['_IO_STACK_LOCATION']]], 'PacketType' : [ 0x20, ['unsigned long']], 'OriginalFileObject' : [ 0x24, ['pointer', ['_FILE_OBJECT']]], } ], '__unnamed_1630' : [ 0x30, { 'Overlay' : [ 0x0, ['__unnamed_162e']], 'Apc' : [ 0x0, ['_KAPC']], 'CompletionKey' : [ 0x0, ['pointer', ['void']]], } ], '_IRP' : [ 0x70, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'MdlAddress' : [ 0x4, ['pointer', ['_MDL']]], 'Flags' : [ 0x8, ['unsigned long']], 'AssociatedIrp' : [ 0xc, ['__unnamed_161e']], 'ThreadListEntry' : [ 0x10, ['_LIST_ENTRY']], 'IoStatus' : [ 0x18, ['_IO_STATUS_BLOCK']], 'RequestorMode' : [ 0x20, ['unsigned char']], 'PendingReturned' : [ 0x21, ['unsigned char']], 'StackCount' : [ 0x22, ['unsigned char']], 'CurrentLocation' : [ 0x23, ['unsigned char']], 'Cancel' : [ 0x24, ['unsigned char']], 'CancelIrql' : [ 0x25, ['unsigned char']], 'ApcEnvironment' : [ 0x26, ['unsigned char']], 'AllocationFlags' : [ 0x27, ['unsigned char']], 'UserIosb' : [ 0x28, ['pointer', ['_IO_STATUS_BLOCK']]], 'UserEvent' : [ 0x2c, ['pointer', ['_KEVENT']]], 'Overlay' : [ 0x30, ['__unnamed_1626']], 'CancelRoutine' : [ 0x38, ['pointer', ['void']]], 'UserBuffer' : [ 0x3c, ['pointer', ['void']]], 'Tail' : [ 0x40, ['__unnamed_1630']], } ], '_PCI_LOCK' : [ 0x8, { 'Atom' : [ 0x0, ['unsigned long']], 'OldIrql' : [ 0x4, ['unsigned char']], } ], '_CM_KEY_SECURITY_CACHE_ENTRY' : [ 0x8, { 'Cell' : [ 0x0, ['unsigned long']], 'CachedSecurity' : [ 0x4, ['pointer', ['_CM_KEY_SECURITY_CACHE']]], } ], '__unnamed_163b' : [ 0x4, { 'PhysicalAddress' : [ 0x0, ['unsigned long']], 'VirtualSize' : [ 0x0, ['unsigned long']], } ], '_IMAGE_SECTION_HEADER' : [ 0x28, { 'Name' : [ 0x0, ['array', 8, ['unsigned char']]], 'Misc' : [ 0x8, ['__unnamed_163b']], 'VirtualAddress' : [ 0xc, ['unsigned long']], 'SizeOfRawData' : [ 0x10, ['unsigned long']], 'PointerToRawData' : [ 0x14, ['unsigned long']], 'PointerToRelocations' : [ 0x18, ['unsigned long']], 'PointerToLinenumbers' : [ 0x1c, ['unsigned long']], 'NumberOfRelocations' : [ 0x20, ['unsigned short']], 'NumberOfLinenumbers' : [ 0x22, ['unsigned short']], 'Characteristics' : [ 0x24, ['unsigned long']], } ], '__unnamed_1641' : [ 0x4, { 'Level' : [ 0x0, ['unsigned long']], } ], '_POP_ACTION_TRIGGER' : [ 0xc, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PolicyDeviceSystemButton', 1: 'PolicyDeviceThermalZone', 2: 'PolicyDeviceBattery', 3: 'PolicyInitiatePowerActionAPI', 4: 'PolicySetPowerStateAPI', 5: 'PolicyImmediateDozeS4', 6: 'PolicySystemIdle'})]], 'Flags' : [ 0x4, ['unsigned char']], 'Spare' : [ 0x5, ['array', 3, ['unsigned char']]], 'Battery' : [ 0x8, ['__unnamed_1641']], 'Wait' : [ 0x8, ['pointer', ['_POP_TRIGGER_WAIT']]], } ], '_ETIMER' : [ 0x98, { 'KeTimer' : [ 0x0, ['_KTIMER']], 'TimerApc' : [ 0x28, ['_KAPC']], 'TimerDpc' : [ 0x58, ['_KDPC']], 'ActiveTimerListEntry' : [ 0x78, ['_LIST_ENTRY']], 'Lock' : [ 0x80, ['unsigned long']], 'Period' : [ 0x84, ['long']], 'ApcAssociated' : [ 0x88, ['unsigned char']], 'WakeTimer' : [ 0x89, ['unsigned char']], 'WakeTimerListEntry' : [ 0x8c, ['_LIST_ENTRY']], } ], '_DBGKD_BREAKPOINTEX' : [ 0x8, { 'BreakPointCount' : [ 0x0, ['unsigned long']], 'ContinueStatus' : [ 0x4, ['long']], } ], '_CM_CELL_REMAP_BLOCK' : [ 0x8, { 'OldCell' : [ 0x0, ['unsigned long']], 'NewCell' : [ 0x4, ['unsigned long']], } ], '_PCI_PMC' : [ 0x2, { 'Version' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'PMEClock' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Rsvd1' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'DeviceSpecificInitialization' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'Rsvd2' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], 'Support' : [ 0x1, ['_PM_SUPPORT']], } ], '_DBGKD_CONTINUE' : [ 0x4, { 'ContinueStatus' : [ 0x0, ['long']], } ], '__unnamed_1658' : [ 0x4, { 'VirtualAddress' : [ 0x0, ['pointer', ['void']]], 'Long' : [ 0x0, ['unsigned long']], 'e1' : [ 0x0, ['_MMWSLENTRY']], } ], '_MMWSLE' : [ 0x4, { 'u1' : [ 0x0, ['__unnamed_1658']], } ], '_EXCEPTION_POINTERS' : [ 0x8, { 'ExceptionRecord' : [ 0x0, ['pointer', ['_EXCEPTION_RECORD']]], 'ContextRecord' : [ 0x4, ['pointer', ['_CONTEXT']]], } ], '__unnamed_1660' : [ 0x4, { 'Balance' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='long')]], 'Parent' : [ 0x0, ['pointer', ['_MMADDRESS_NODE']]], } ], '_MMADDRESS_NODE' : [ 0x14, { 'u1' : [ 0x0, ['__unnamed_1660']], 'LeftChild' : [ 0x4, ['pointer', ['_MMADDRESS_NODE']]], 'RightChild' : [ 0x8, ['pointer', ['_MMADDRESS_NODE']]], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], } ], '_RTL_USER_PROCESS_PARAMETERS' : [ 0x290, { 'MaximumLength' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], 'Flags' : [ 0x8, ['unsigned long']], 'DebugFlags' : [ 0xc, ['unsigned long']], 'ConsoleHandle' : [ 0x10, ['pointer', ['void']]], 'ConsoleFlags' : [ 0x14, ['unsigned long']], 'StandardInput' : [ 0x18, ['pointer', ['void']]], 'StandardOutput' : [ 0x1c, ['pointer', ['void']]], 'StandardError' : [ 0x20, ['pointer', ['void']]], 'CurrentDirectory' : [ 0x24, ['_CURDIR']], 'DllPath' : [ 0x30, ['_UNICODE_STRING']], 'ImagePathName' : [ 0x38, ['_UNICODE_STRING']], 'CommandLine' : [ 0x40, ['_UNICODE_STRING']], 'Environment' : [ 0x48, ['pointer', ['void']]], 'StartingX' : [ 0x4c, ['unsigned long']], 'StartingY' : [ 0x50, ['unsigned long']], 'CountX' : [ 0x54, ['unsigned long']], 'CountY' : [ 0x58, ['unsigned long']], 'CountCharsX' : [ 0x5c, ['unsigned long']], 'CountCharsY' : [ 0x60, ['unsigned long']], 'FillAttribute' : [ 0x64, ['unsigned long']], 'WindowFlags' : [ 0x68, ['unsigned long']], 'ShowWindowFlags' : [ 0x6c, ['unsigned long']], 'WindowTitle' : [ 0x70, ['_UNICODE_STRING']], 'DesktopInfo' : [ 0x78, ['_UNICODE_STRING']], 'ShellInfo' : [ 0x80, ['_UNICODE_STRING']], 'RuntimeData' : [ 0x88, ['_UNICODE_STRING']], 'CurrentDirectores' : [ 0x90, ['array', 32, ['_RTL_DRIVE_LETTER_CURDIR']]], } ], '_CACHE_MANAGER_CALLBACKS' : [ 0x10, { 'AcquireForLazyWrite' : [ 0x0, ['pointer', ['void']]], 'ReleaseFromLazyWrite' : [ 0x4, ['pointer', ['void']]], 'AcquireForReadAhead' : [ 0x8, ['pointer', ['void']]], 'ReleaseFromReadAhead' : [ 0xc, ['pointer', ['void']]], } ], '_CELL_DATA' : [ 0x50, { 'u' : [ 0x0, ['_u']], } ], '_SE_AUDIT_PROCESS_CREATION_INFO' : [ 0x4, { 'ImageFileName' : [ 0x0, ['pointer', ['_OBJECT_NAME_INFORMATION']]], } ], '_HEAP_ENTRY_EXTRA' : [ 0x8, { 'AllocatorBackTraceIndex' : [ 0x0, ['unsigned short']], 'TagIndex' : [ 0x2, ['unsigned short']], 'Settable' : [ 0x4, ['unsigned long']], 'ZeroInit' : [ 0x0, ['unsigned long long']], } ], '_VI_DEADLOCK_RESOURCE' : [ 0x80, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'VfDeadlockUnknown', 1: 'VfDeadlockMutex', 2: 'VfDeadlockMutexAbandoned', 3: 'VfDeadlockFastMutex', 4: 'VfDeadlockFastMutexUnsafe', 5: 'VfDeadlockSpinLock', 6: 'VfDeadlockQueuedSpinLock', 7: 'VfDeadlockTypeMaximum'})]], 'NodeCount' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'RecursionCount' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long')]], 'ResourceAddress' : [ 0x8, ['pointer', ['void']]], 'ThreadOwner' : [ 0xc, ['pointer', ['_VI_DEADLOCK_THREAD']]], 'ResourceList' : [ 0x10, ['_LIST_ENTRY']], 'HashChainList' : [ 0x18, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x18, ['_LIST_ENTRY']], 'StackTrace' : [ 0x20, ['array', 8, ['pointer', ['void']]]], 'LastAcquireTrace' : [ 0x40, ['array', 8, ['pointer', ['void']]]], 'LastReleaseTrace' : [ 0x60, ['array', 8, ['pointer', ['void']]]], } ], '_CLIENT_ID' : [ 0x8, { 'UniqueProcess' : [ 0x0, ['pointer', ['void']]], 'UniqueThread' : [ 0x4, ['pointer', ['void']]], } ], '_PEB_FREE_BLOCK' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_PEB_FREE_BLOCK']]], 'Size' : [ 0x4, ['unsigned long']], } ], '_PO_DEVICE_NOTIFY' : [ 0x28, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'TargetDevice' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'WakeNeeded' : [ 0xc, ['unsigned char']], 'OrderLevel' : [ 0xd, ['unsigned char']], 'DeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'Node' : [ 0x14, ['pointer', ['void']]], 'DeviceName' : [ 0x18, ['pointer', ['unsigned short']]], 'DriverName' : [ 0x1c, ['pointer', ['unsigned short']]], 'ChildCount' : [ 0x20, ['unsigned long']], 'ActiveChild' : [ 0x24, ['unsigned long']], } ], '_MMPFNLIST' : [ 0x10, { 'Total' : [ 0x0, ['unsigned long']], 'ListName' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'ZeroedPageList', 1: 'FreePageList', 2: 'StandbyPageList', 3: 'ModifiedPageList', 4: 'ModifiedNoWritePageList', 5: 'BadPageList', 6: 'ActiveAndValid', 7: 'TransitionPage'})]], 'Flink' : [ 0x8, ['unsigned long']], 'Blink' : [ 0xc, ['unsigned long']], } ], '__unnamed_1684' : [ 0x4, { 'Spare' : [ 0x0, ['array', 4, ['unsigned char']]], } ], '__unnamed_1686' : [ 0x4, { 'PrimaryBus' : [ 0x0, ['unsigned char']], 'SecondaryBus' : [ 0x1, ['unsigned char']], 'SubordinateBus' : [ 0x2, ['unsigned char']], 'SubtractiveDecode' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IsaBitSet' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'VgaBitSet' : [ 0x3, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'WeChangedBusNumbers' : [ 0x3, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'IsaBitRequired' : [ 0x3, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], } ], 'PCI_HEADER_TYPE_DEPENDENT' : [ 0x4, { 'type0' : [ 0x0, ['__unnamed_1684']], 'type1' : [ 0x0, ['__unnamed_1686']], 'type2' : [ 0x0, ['__unnamed_1686']], } ], '_DBGKD_GET_SET_BUS_DATA' : [ 0x14, { 'BusDataType' : [ 0x0, ['unsigned long']], 'BusNumber' : [ 0x4, ['unsigned long']], 'SlotNumber' : [ 0x8, ['unsigned long']], 'Offset' : [ 0xc, ['unsigned long']], 'Length' : [ 0x10, ['unsigned long']], } ], '_OBJECT_HEADER_NAME_INFO' : [ 0x10, { 'Directory' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY']]], 'Name' : [ 0x4, ['_UNICODE_STRING']], 'QueryReferences' : [ 0xc, ['unsigned long']], } ], '_KINTERRUPT' : [ 0x1e4, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'InterruptListEntry' : [ 0x4, ['_LIST_ENTRY']], 'ServiceRoutine' : [ 0xc, ['pointer', ['void']]], 'ServiceContext' : [ 0x10, ['pointer', ['void']]], 'SpinLock' : [ 0x14, ['unsigned long']], 'TickCount' : [ 0x18, ['unsigned long']], 'ActualLock' : [ 0x1c, ['pointer', ['unsigned long']]], 'DispatchAddress' : [ 0x20, ['pointer', ['void']]], 'Vector' : [ 0x24, ['unsigned long']], 'Irql' : [ 0x28, ['unsigned char']], 'SynchronizeIrql' : [ 0x29, ['unsigned char']], 'FloatingSave' : [ 0x2a, ['unsigned char']], 'Connected' : [ 0x2b, ['unsigned char']], 'Number' : [ 0x2c, ['unsigned char']], 'ShareVector' : [ 0x2d, ['unsigned char']], 'Mode' : [ 0x30, ['Enumeration', dict(target = 'long', choices = {0: 'LevelSensitive', 1: 'Latched'})]], 'ServiceCount' : [ 0x34, ['unsigned long']], 'DispatchCount' : [ 0x38, ['unsigned long']], 'DispatchCode' : [ 0x3c, ['array', 106, ['unsigned long']]], } ], '_BITMAP_RANGE' : [ 0x20, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'BasePage' : [ 0x8, ['long long']], 'FirstDirtyPage' : [ 0x10, ['unsigned long']], 'LastDirtyPage' : [ 0x14, ['unsigned long']], 'DirtyPages' : [ 0x18, ['unsigned long']], 'Bitmap' : [ 0x1c, ['pointer', ['unsigned long']]], } ], '_PCI_ARBITER_INSTANCE' : [ 0xe0, { 'Header' : [ 0x0, ['PCI_SECONDARY_EXTENSION']], 'Interface' : [ 0xc, ['pointer', ['_PCI_INTERFACE']]], 'BusFdoExtension' : [ 0x10, ['pointer', ['_PCI_FDO_EXTENSION']]], 'InstanceName' : [ 0x14, ['array', 24, ['unsigned short']]], 'CommonInstance' : [ 0x44, ['_ARBITER_INSTANCE']], } ], '_HANDLE_TRACE_DB_ENTRY' : [ 0x50, { 'ClientId' : [ 0x0, ['_CLIENT_ID']], 'Handle' : [ 0x8, ['pointer', ['void']]], 'Type' : [ 0xc, ['unsigned long']], 'StackTrace' : [ 0x10, ['array', 16, ['pointer', ['void']]]], } ], '_BUS_EXTENSION_LIST' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['void']]], 'BusExtension' : [ 0x4, ['pointer', ['_PI_BUS_EXTENSION']]], } ], '_PCI_MJ_DISPATCH_TABLE' : [ 0x20, { 'PnpIrpMaximumMinorFunction' : [ 0x0, ['unsigned long']], 'PnpIrpDispatchTable' : [ 0x4, ['pointer', ['_PCI_MN_DISPATCH_TABLE']]], 'PowerIrpMaximumMinorFunction' : [ 0x8, ['unsigned long']], 'PowerIrpDispatchTable' : [ 0xc, ['pointer', ['_PCI_MN_DISPATCH_TABLE']]], 'SystemControlIrpDispatchStyle' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'IRP_COMPLETE', 1: 'IRP_DOWNWARD', 2: 'IRP_UPWARD', 3: 'IRP_DISPATCH'})]], 'SystemControlIrpDispatchFunction' : [ 0x14, ['pointer', ['void']]], 'OtherIrpDispatchStyle' : [ 0x18, ['Enumeration', dict(target = 'long', choices = {0: 'IRP_COMPLETE', 1: 'IRP_DOWNWARD', 2: 'IRP_UPWARD', 3: 'IRP_DISPATCH'})]], 'OtherIrpDispatchFunction' : [ 0x1c, ['pointer', ['void']]], } ], '_POP_TRIGGER_WAIT' : [ 0x20, { 'Event' : [ 0x0, ['_KEVENT']], 'Status' : [ 0x10, ['long']], 'Link' : [ 0x14, ['_LIST_ENTRY']], 'Trigger' : [ 0x1c, ['pointer', ['_POP_ACTION_TRIGGER']]], } ], '_IO_TIMER' : [ 0x18, { 'Type' : [ 0x0, ['short']], 'TimerFlag' : [ 0x2, ['short']], 'TimerList' : [ 0x4, ['_LIST_ENTRY']], 'TimerRoutine' : [ 0xc, ['pointer', ['void']]], 'Context' : [ 0x10, ['pointer', ['void']]], 'DeviceObject' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], } ], '_FXSAVE_FORMAT' : [ 0x208, { 'ControlWord' : [ 0x0, ['unsigned short']], 'StatusWord' : [ 0x2, ['unsigned short']], 'TagWord' : [ 0x4, ['unsigned short']], 'ErrorOpcode' : [ 0x6, ['unsigned short']], 'ErrorOffset' : [ 0x8, ['unsigned long']], 'ErrorSelector' : [ 0xc, ['unsigned long']], 'DataOffset' : [ 0x10, ['unsigned long']], 'DataSelector' : [ 0x14, ['unsigned long']], 'MXCsr' : [ 0x18, ['unsigned long']], 'MXCsrMask' : [ 0x1c, ['unsigned long']], 'RegisterArea' : [ 0x20, ['array', 128, ['unsigned char']]], 'Reserved3' : [ 0xa0, ['array', 128, ['unsigned char']]], 'Reserved4' : [ 0x120, ['array', 224, ['unsigned char']]], 'Align16Byte' : [ 0x200, ['array', 8, ['unsigned char']]], } ], '_MMWSLENTRY' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'LockedInWs' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'LockedInMemory' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 8, native_type='unsigned long')]], 'SameProtectAsProto' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Direct' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Age' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned long')]], 'VirtualPageNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_OBJECT_DIRECTORY' : [ 0xa0, { 'HashBuckets' : [ 0x0, ['array', 37, ['pointer', ['_OBJECT_DIRECTORY_ENTRY']]]], 'Lock' : [ 0x94, ['_EX_PUSH_LOCK']], 'DeviceMap' : [ 0x98, ['pointer', ['_DEVICE_MAP']]], 'SessionId' : [ 0x9c, ['unsigned long']], } ], '_OBJECT_CREATE_INFORMATION' : [ 0x30, { 'Attributes' : [ 0x0, ['unsigned long']], 'RootDirectory' : [ 0x4, ['pointer', ['void']]], 'ParseContext' : [ 0x8, ['pointer', ['void']]], 'ProbeMode' : [ 0xc, ['unsigned char']], 'PagedPoolCharge' : [ 0x10, ['unsigned long']], 'NonPagedPoolCharge' : [ 0x14, ['unsigned long']], 'SecurityDescriptorCharge' : [ 0x18, ['unsigned long']], 'SecurityDescriptor' : [ 0x1c, ['pointer', ['void']]], 'SecurityQos' : [ 0x20, ['pointer', ['_SECURITY_QUALITY_OF_SERVICE']]], 'SecurityQualityOfService' : [ 0x24, ['_SECURITY_QUALITY_OF_SERVICE']], } ], '_HEAP_LOOKASIDE' : [ 0x30, { 'ListHead' : [ 0x0, ['_SLIST_HEADER']], 'Depth' : [ 0x8, ['unsigned short']], 'MaximumDepth' : [ 0xa, ['unsigned short']], 'TotalAllocates' : [ 0xc, ['unsigned long']], 'AllocateMisses' : [ 0x10, ['unsigned long']], 'TotalFrees' : [ 0x14, ['unsigned long']], 'FreeMisses' : [ 0x18, ['unsigned long']], 'LastTotalAllocates' : [ 0x1c, ['unsigned long']], 'LastAllocateMisses' : [ 0x20, ['unsigned long']], 'Counters' : [ 0x24, ['array', 2, ['unsigned long']]], } ], '_KDPC_DATA' : [ 0x14, { 'DpcListHead' : [ 0x0, ['_LIST_ENTRY']], 'DpcLock' : [ 0x8, ['unsigned long']], 'DpcQueueDepth' : [ 0xc, ['unsigned long']], 'DpcCount' : [ 0x10, ['unsigned long']], } ], '_ARBITER_INTERFACE' : [ 0x18, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], 'ArbiterHandler' : [ 0x10, ['pointer', ['void']]], 'Flags' : [ 0x14, ['unsigned long']], } ], '_CALL_PERFORMANCE_DATA' : [ 0x204, { 'SpinLock' : [ 0x0, ['unsigned long']], 'HashTable' : [ 0x4, ['array', 64, ['_LIST_ENTRY']]], } ], '_MMWSL' : [ 0x698, { 'FirstFree' : [ 0x0, ['unsigned long']], 'FirstDynamic' : [ 0x4, ['unsigned long']], 'LastEntry' : [ 0x8, ['unsigned long']], 'NextSlot' : [ 0xc, ['unsigned long']], 'Wsle' : [ 0x10, ['pointer', ['_MMWSLE']]], 'LastInitializedWsle' : [ 0x14, ['unsigned long']], 'NonDirectCount' : [ 0x18, ['unsigned long']], 'HashTable' : [ 0x1c, ['pointer', ['_MMWSLE_HASH']]], 'HashTableSize' : [ 0x20, ['unsigned long']], 'NumberOfCommittedPageTables' : [ 0x24, ['unsigned long']], 'HashTableStart' : [ 0x28, ['pointer', ['void']]], 'HighestPermittedHashAddress' : [ 0x2c, ['pointer', ['void']]], 'NumberOfImageWaiters' : [ 0x30, ['unsigned long']], 'VadBitMapHint' : [ 0x34, ['unsigned long']], 'UsedPageTableEntries' : [ 0x38, ['array', 768, ['unsigned short']]], 'CommittedPageTables' : [ 0x638, ['array', 24, ['unsigned long']]], } ], '_RTL_DRIVE_LETTER_CURDIR' : [ 0x10, { 'Flags' : [ 0x0, ['unsigned short']], 'Length' : [ 0x2, ['unsigned short']], 'TimeStamp' : [ 0x4, ['unsigned long']], 'DosPath' : [ 0x8, ['_STRING']], } ], 'PCI_FUNCTION_RESOURCES' : [ 0x150, { 'Limit' : [ 0x0, ['array', 7, ['_IO_RESOURCE_DESCRIPTOR']]], 'Current' : [ 0xe0, ['array', 7, ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '_EXCEPTION_RECORD' : [ 0x50, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['pointer', ['_EXCEPTION_RECORD']]], 'ExceptionAddress' : [ 0xc, ['pointer', ['void']]], 'NumberParameters' : [ 0x10, ['unsigned long']], 'ExceptionInformation' : [ 0x14, ['array', 15, ['unsigned long']]], } ], '_KMUTANT' : [ 0x20, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'MutantListEntry' : [ 0x10, ['_LIST_ENTRY']], 'OwnerThread' : [ 0x18, ['pointer', ['_KTHREAD']]], 'Abandoned' : [ 0x1c, ['unsigned char']], 'ApcDisable' : [ 0x1d, ['unsigned char']], } ], '__unnamed_16f4' : [ 0x4, { 'ImageCommitment' : [ 0x0, ['unsigned long']], 'CreatingProcess' : [ 0x0, ['pointer', ['_EPROCESS']]], } ], '__unnamed_16f8' : [ 0x4, { 'ImageInformation' : [ 0x0, ['pointer', ['_SECTION_IMAGE_INFORMATION']]], 'FirstMappedVa' : [ 0x0, ['pointer', ['void']]], } ], '_SEGMENT' : [ 0x40, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'TotalNumberOfPtes' : [ 0x4, ['unsigned long']], 'NonExtendedPtes' : [ 0x8, ['unsigned long']], 'WritableUserReferences' : [ 0xc, ['unsigned long']], 'SizeOfSegment' : [ 0x10, ['unsigned long long']], 'SegmentPteTemplate' : [ 0x18, ['_MMPTE']], 'NumberOfCommittedPages' : [ 0x1c, ['unsigned long']], 'ExtendInfo' : [ 0x20, ['pointer', ['_MMEXTEND_INFO']]], 'SegmentFlags' : [ 0x24, ['_SEGMENT_FLAGS']], 'BasedAddress' : [ 0x28, ['pointer', ['void']]], 'u1' : [ 0x2c, ['__unnamed_16f4']], 'u2' : [ 0x30, ['__unnamed_16f8']], 'PrototypePte' : [ 0x34, ['pointer', ['_MMPTE']]], 'ThePtes' : [ 0x38, ['array', 1, ['_MMPTE']]], } ], '_PCI_COMMON_EXTENSION' : [ 0x30, { 'Next' : [ 0x0, ['pointer', ['void']]], 'ExtensionType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1768116272: 'PciPdoExtensionType', 1768116273: 'PciFdoExtensionType', 1768116274: 'PciArb_Io', 1768116275: 'PciArb_Memory', 1768116276: 'PciArb_Interrupt', 1768116277: 'PciArb_BusNumber', 1768116278: 'PciTrans_Interrupt', 1768116279: 'PciInterface_BusHandler', 1768116280: 'PciInterface_IntRouteHandler', 1768116281: 'PciInterface_PciCb', 1768116282: 'PciInterface_LegacyDeviceDetection', 1768116283: 'PciInterface_PmeHandler', 1768116284: 'PciInterface_DevicePresent', 1768116285: 'PciInterface_NativeIde', 1768116286: 'PciInterface_Location', 1768116287: 'PciInterface_AgpTarget'})]], 'IrpDispatchTable' : [ 0x8, ['pointer', ['_PCI_MJ_DISPATCH_TABLE']]], 'DeviceState' : [ 0xc, ['unsigned char']], 'TentativeNextState' : [ 0xd, ['unsigned char']], 'SecondaryExtMutex' : [ 0x10, ['_FAST_MUTEX']], } ], '_MI_VERIFIER_DRIVER_ENTRY' : [ 0x58, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'Loads' : [ 0x8, ['unsigned long']], 'Unloads' : [ 0xc, ['unsigned long']], 'BaseName' : [ 0x10, ['_UNICODE_STRING']], 'StartAddress' : [ 0x18, ['pointer', ['void']]], 'EndAddress' : [ 0x1c, ['pointer', ['void']]], 'Flags' : [ 0x20, ['unsigned long']], 'Signature' : [ 0x24, ['unsigned long']], 'PoolPageHeaders' : [ 0x28, ['_SLIST_HEADER']], 'PoolTrackers' : [ 0x30, ['_SLIST_HEADER']], 'CurrentPagedPoolAllocations' : [ 0x38, ['unsigned long']], 'CurrentNonPagedPoolAllocations' : [ 0x3c, ['unsigned long']], 'PeakPagedPoolAllocations' : [ 0x40, ['unsigned long']], 'PeakNonPagedPoolAllocations' : [ 0x44, ['unsigned long']], 'PagedBytes' : [ 0x48, ['unsigned long']], 'NonPagedBytes' : [ 0x4c, ['unsigned long']], 'PeakPagedBytes' : [ 0x50, ['unsigned long']], 'PeakNonPagedBytes' : [ 0x54, ['unsigned long']], } ], '_PRIVATE_CACHE_MAP' : [ 0x58, { 'NodeTypeCode' : [ 0x0, ['short']], 'Flags' : [ 0x0, ['_PRIVATE_CACHE_MAP_FLAGS']], 'UlongFlags' : [ 0x0, ['unsigned long']], 'ReadAheadMask' : [ 0x4, ['unsigned long']], 'FileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], 'FileOffset1' : [ 0x10, ['_LARGE_INTEGER']], 'BeyondLastByte1' : [ 0x18, ['_LARGE_INTEGER']], 'FileOffset2' : [ 0x20, ['_LARGE_INTEGER']], 'BeyondLastByte2' : [ 0x28, ['_LARGE_INTEGER']], 'ReadAheadOffset' : [ 0x30, ['array', 2, ['_LARGE_INTEGER']]], 'ReadAheadLength' : [ 0x40, ['array', 2, ['unsigned long']]], 'ReadAheadSpinLock' : [ 0x48, ['unsigned long']], 'PrivateLinks' : [ 0x4c, ['_LIST_ENTRY']], } ], '_RTL_HANDLE_TABLE' : [ 0x20, { 'MaximumNumberOfHandles' : [ 0x0, ['unsigned long']], 'SizeOfHandleTableEntry' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['array', 2, ['unsigned long']]], 'FreeHandles' : [ 0x10, ['pointer', ['_RTL_HANDLE_TABLE_ENTRY']]], 'CommittedHandles' : [ 0x14, ['pointer', ['_RTL_HANDLE_TABLE_ENTRY']]], 'UnCommittedHandles' : [ 0x18, ['pointer', ['_RTL_HANDLE_TABLE_ENTRY']]], 'MaxReservedHandles' : [ 0x1c, ['pointer', ['_RTL_HANDLE_TABLE_ENTRY']]], } ], '_POP_IDLE_HANDLER' : [ 0x20, { 'Latency' : [ 0x0, ['unsigned long']], 'TimeCheck' : [ 0x4, ['unsigned long']], 'DemoteLimit' : [ 0x8, ['unsigned long']], 'PromoteLimit' : [ 0xc, ['unsigned long']], 'PromoteCount' : [ 0x10, ['unsigned long']], 'Demote' : [ 0x14, ['unsigned char']], 'Promote' : [ 0x15, ['unsigned char']], 'PromotePercent' : [ 0x16, ['unsigned char']], 'DemotePercent' : [ 0x17, ['unsigned char']], 'State' : [ 0x18, ['unsigned char']], 'Spare' : [ 0x19, ['array', 3, ['unsigned char']]], 'IdleFunction' : [ 0x1c, ['pointer', ['void']]], } ], 'SYSTEM_POWER_CAPABILITIES' : [ 0x4c, { 'PowerButtonPresent' : [ 0x0, ['unsigned char']], 'SleepButtonPresent' : [ 0x1, ['unsigned char']], 'LidPresent' : [ 0x2, ['unsigned char']], 'SystemS1' : [ 0x3, ['unsigned char']], 'SystemS2' : [ 0x4, ['unsigned char']], 'SystemS3' : [ 0x5, ['unsigned char']], 'SystemS4' : [ 0x6, ['unsigned char']], 'SystemS5' : [ 0x7, ['unsigned char']], 'HiberFilePresent' : [ 0x8, ['unsigned char']], 'FullWake' : [ 0x9, ['unsigned char']], 'VideoDimPresent' : [ 0xa, ['unsigned char']], 'ApmPresent' : [ 0xb, ['unsigned char']], 'UpsPresent' : [ 0xc, ['unsigned char']], 'ThermalControl' : [ 0xd, ['unsigned char']], 'ProcessorThrottle' : [ 0xe, ['unsigned char']], 'ProcessorMinThrottle' : [ 0xf, ['unsigned char']], 'ProcessorMaxThrottle' : [ 0x10, ['unsigned char']], 'spare2' : [ 0x11, ['array', 4, ['unsigned char']]], 'DiskSpinDown' : [ 0x15, ['unsigned char']], 'spare3' : [ 0x16, ['array', 8, ['unsigned char']]], 'SystemBatteriesPresent' : [ 0x1e, ['unsigned char']], 'BatteriesAreShortTerm' : [ 0x1f, ['unsigned char']], 'BatteryScale' : [ 0x20, ['array', 3, ['BATTERY_REPORTING_SCALE']]], 'AcOnLineWake' : [ 0x38, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'SoftLidWake' : [ 0x3c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'RtcWake' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'MinDeviceWakeState' : [ 0x44, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DefaultLowLatencyWake' : [ 0x48, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], '_DEVOBJ_EXTENSION' : [ 0x2c, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'PowerFlags' : [ 0x8, ['unsigned long']], 'Dope' : [ 0xc, ['pointer', ['_DEVICE_OBJECT_POWER_EXTENSION']]], 'ExtensionFlags' : [ 0x10, ['unsigned long']], 'DeviceNode' : [ 0x14, ['pointer', ['void']]], 'AttachedTo' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'StartIoCount' : [ 0x1c, ['long']], 'StartIoKey' : [ 0x20, ['long']], 'StartIoFlags' : [ 0x24, ['unsigned long']], 'Vpb' : [ 0x28, ['pointer', ['_VPB']]], } ], '_FLOATING_SAVE_AREA' : [ 0x70, { 'ControlWord' : [ 0x0, ['unsigned long']], 'StatusWord' : [ 0x4, ['unsigned long']], 'TagWord' : [ 0x8, ['unsigned long']], 'ErrorOffset' : [ 0xc, ['unsigned long']], 'ErrorSelector' : [ 0x10, ['unsigned long']], 'DataOffset' : [ 0x14, ['unsigned long']], 'DataSelector' : [ 0x18, ['unsigned long']], 'RegisterArea' : [ 0x1c, ['array', 80, ['unsigned char']]], 'Cr0NpxState' : [ 0x6c, ['unsigned long']], } ], '_DBGKD_GET_VERSION64' : [ 0x28, { 'MajorVersion' : [ 0x0, ['unsigned short']], 'MinorVersion' : [ 0x2, ['unsigned short']], 'ProtocolVersion' : [ 0x4, ['unsigned short']], 'Flags' : [ 0x6, ['unsigned short']], 'MachineType' : [ 0x8, ['unsigned short']], 'MaxPacketType' : [ 0xa, ['unsigned char']], 'MaxStateChange' : [ 0xb, ['unsigned char']], 'MaxManipulate' : [ 0xc, ['unsigned char']], 'Simulation' : [ 0xd, ['unsigned char']], 'Unused' : [ 0xe, ['array', 1, ['unsigned short']]], 'KernBase' : [ 0x10, ['unsigned long long']], 'PsLoadedModuleList' : [ 0x18, ['unsigned long long']], 'DebuggerDataList' : [ 0x20, ['unsigned long long']], } ], '_MMVIEW' : [ 0x8, { 'Entry' : [ 0x0, ['unsigned long']], 'ControlArea' : [ 0x4, ['pointer', ['_CONTROL_AREA']]], } ], '_TEB' : [ 0xfb8, { 'NtTib' : [ 0x0, ['_NT_TIB']], 'EnvironmentPointer' : [ 0x1c, ['pointer', ['void']]], 'ClientId' : [ 0x20, ['_CLIENT_ID']], 'ActiveRpcHandle' : [ 0x28, ['pointer', ['void']]], 'ThreadLocalStoragePointer' : [ 0x2c, ['pointer', ['void']]], 'ProcessEnvironmentBlock' : [ 0x30, ['pointer', ['_PEB']]], 'LastErrorValue' : [ 0x34, ['unsigned long']], 'CountOfOwnedCriticalSections' : [ 0x38, ['unsigned long']], 'CsrClientThread' : [ 0x3c, ['pointer', ['void']]], 'Win32ThreadInfo' : [ 0x40, ['pointer', ['void']]], 'User32Reserved' : [ 0x44, ['array', 26, ['unsigned long']]], 'UserReserved' : [ 0xac, ['array', 5, ['unsigned long']]], 'WOW32Reserved' : [ 0xc0, ['pointer', ['void']]], 'CurrentLocale' : [ 0xc4, ['unsigned long']], 'FpSoftwareStatusRegister' : [ 0xc8, ['unsigned long']], 'SystemReserved1' : [ 0xcc, ['array', 54, ['pointer', ['void']]]], 'ExceptionCode' : [ 0x1a4, ['long']], 'ActivationContextStack' : [ 0x1a8, ['_ACTIVATION_CONTEXT_STACK']], 'SpareBytes1' : [ 0x1bc, ['array', 24, ['unsigned char']]], 'GdiTebBatch' : [ 0x1d4, ['_GDI_TEB_BATCH']], 'RealClientId' : [ 0x6b4, ['_CLIENT_ID']], 'GdiCachedProcessHandle' : [ 0x6bc, ['pointer', ['void']]], 'GdiClientPID' : [ 0x6c0, ['unsigned long']], 'GdiClientTID' : [ 0x6c4, ['unsigned long']], 'GdiThreadLocalInfo' : [ 0x6c8, ['pointer', ['void']]], 'Win32ClientInfo' : [ 0x6cc, ['array', 62, ['unsigned long']]], 'glDispatchTable' : [ 0x7c4, ['array', 233, ['pointer', ['void']]]], 'glReserved1' : [ 0xb68, ['array', 29, ['unsigned long']]], 'glReserved2' : [ 0xbdc, ['pointer', ['void']]], 'glSectionInfo' : [ 0xbe0, ['pointer', ['void']]], 'glSection' : [ 0xbe4, ['pointer', ['void']]], 'glTable' : [ 0xbe8, ['pointer', ['void']]], 'glCurrentRC' : [ 0xbec, ['pointer', ['void']]], 'glContext' : [ 0xbf0, ['pointer', ['void']]], 'LastStatusValue' : [ 0xbf4, ['unsigned long']], 'StaticUnicodeString' : [ 0xbf8, ['_UNICODE_STRING']], 'StaticUnicodeBuffer' : [ 0xc00, ['array', 261, ['unsigned short']]], 'DeallocationStack' : [ 0xe0c, ['pointer', ['void']]], 'TlsSlots' : [ 0xe10, ['array', 64, ['pointer', ['void']]]], 'TlsLinks' : [ 0xf10, ['_LIST_ENTRY']], 'Vdm' : [ 0xf18, ['pointer', ['void']]], 'ReservedForNtRpc' : [ 0xf1c, ['pointer', ['void']]], 'DbgSsReserved' : [ 0xf20, ['array', 2, ['pointer', ['void']]]], 'HardErrorMode' : [ 0xf28, ['unsigned long']], 'Instrumentation' : [ 0xf2c, ['array', 16, ['pointer', ['void']]]], 'WinSockData' : [ 0xf6c, ['pointer', ['void']]], 'GdiBatchCount' : [ 0xf70, ['unsigned long']], 'InDbgPrint' : [ 0xf74, ['unsigned char']], 'FreeStackOnTermination' : [ 0xf75, ['unsigned char']], 'HasFiberData' : [ 0xf76, ['unsigned char']], 'IdealProcessor' : [ 0xf77, ['unsigned char']], 'Spare3' : [ 0xf78, ['unsigned long']], 'ReservedForPerf' : [ 0xf7c, ['pointer', ['void']]], 'ReservedForOle' : [ 0xf80, ['pointer', ['void']]], 'WaitingOnLoaderLock' : [ 0xf84, ['unsigned long']], 'Wx86Thread' : [ 0xf88, ['_Wx86ThreadState']], 'TlsExpansionSlots' : [ 0xf94, ['pointer', ['pointer', ['void']]]], 'ImpersonationLocale' : [ 0xf98, ['unsigned long']], 'IsImpersonating' : [ 0xf9c, ['unsigned long']], 'NlsCache' : [ 0xfa0, ['pointer', ['void']]], 'pShimData' : [ 0xfa4, ['pointer', ['void']]], 'HeapVirtualAffinity' : [ 0xfa8, ['unsigned long']], 'CurrentTransactionHandle' : [ 0xfac, ['pointer', ['void']]], 'ActiveFrame' : [ 0xfb0, ['pointer', ['_TEB_ACTIVE_FRAME']]], 'FlsData' : [ 0xfb4, ['pointer', ['void']]], } ], 'PCI_SECONDARY_EXTENSION' : [ 0xc, { 'List' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'ExtensionType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1768116272: 'PciPdoExtensionType', 1768116273: 'PciFdoExtensionType', 1768116274: 'PciArb_Io', 1768116275: 'PciArb_Memory', 1768116276: 'PciArb_Interrupt', 1768116277: 'PciArb_BusNumber', 1768116278: 'PciTrans_Interrupt', 1768116279: 'PciInterface_BusHandler', 1768116280: 'PciInterface_IntRouteHandler', 1768116281: 'PciInterface_PciCb', 1768116282: 'PciInterface_LegacyDeviceDetection', 1768116283: 'PciInterface_PmeHandler', 1768116284: 'PciInterface_DevicePresent', 1768116285: 'PciInterface_NativeIde', 1768116286: 'PciInterface_Location', 1768116287: 'PciInterface_AgpTarget'})]], 'Destructor' : [ 0x8, ['pointer', ['void']]], } ], '__unnamed_1737' : [ 0x30, { 'type0' : [ 0x0, ['_PCI_HEADER_TYPE_0']], 'type1' : [ 0x0, ['_PCI_HEADER_TYPE_1']], 'type2' : [ 0x0, ['_PCI_HEADER_TYPE_2']], } ], '_PCI_COMMON_CONFIG' : [ 0x100, { 'VendorID' : [ 0x0, ['unsigned short']], 'DeviceID' : [ 0x2, ['unsigned short']], 'Command' : [ 0x4, ['unsigned short']], 'Status' : [ 0x6, ['unsigned short']], 'RevisionID' : [ 0x8, ['unsigned char']], 'ProgIf' : [ 0x9, ['unsigned char']], 'SubClass' : [ 0xa, ['unsigned char']], 'BaseClass' : [ 0xb, ['unsigned char']], 'CacheLineSize' : [ 0xc, ['unsigned char']], 'LatencyTimer' : [ 0xd, ['unsigned char']], 'HeaderType' : [ 0xe, ['unsigned char']], 'BIST' : [ 0xf, ['unsigned char']], 'u' : [ 0x10, ['__unnamed_1737']], 'DeviceSpecific' : [ 0x40, ['array', 192, ['unsigned char']]], } ], '_HEAP_FREE_ENTRY_EXTRA' : [ 0x4, { 'TagIndex' : [ 0x0, ['unsigned short']], 'FreeBackTraceIndex' : [ 0x2, ['unsigned short']], } ], '_X86_DBGKD_CONTROL_SET' : [ 0x10, { 'TraceFlag' : [ 0x0, ['unsigned long']], 'Dr7' : [ 0x4, ['unsigned long']], 'CurrentSymbolStart' : [ 0x8, ['unsigned long']], 'CurrentSymbolEnd' : [ 0xc, ['unsigned long']], } ], '_SECTION_IMAGE_INFORMATION' : [ 0x30, { 'TransferAddress' : [ 0x0, ['pointer', ['void']]], 'ZeroBits' : [ 0x4, ['unsigned long']], 'MaximumStackSize' : [ 0x8, ['unsigned long']], 'CommittedStackSize' : [ 0xc, ['unsigned long']], 'SubSystemType' : [ 0x10, ['unsigned long']], 'SubSystemMinorVersion' : [ 0x14, ['unsigned short']], 'SubSystemMajorVersion' : [ 0x16, ['unsigned short']], 'SubSystemVersion' : [ 0x14, ['unsigned long']], 'GpValue' : [ 0x18, ['unsigned long']], 'ImageCharacteristics' : [ 0x1c, ['unsigned short']], 'DllCharacteristics' : [ 0x1e, ['unsigned short']], 'Machine' : [ 0x20, ['unsigned short']], 'ImageContainsCode' : [ 0x22, ['unsigned char']], 'Spare1' : [ 0x23, ['unsigned char']], 'LoaderFlags' : [ 0x24, ['unsigned long']], 'Reserved' : [ 0x28, ['array', 2, ['unsigned long']]], } ], '_POOL_TRACKER_TABLE' : [ 0x1c, { 'Key' : [ 0x0, ['unsigned long']], 'NonPagedAllocs' : [ 0x4, ['unsigned long']], 'NonPagedFrees' : [ 0x8, ['unsigned long']], 'NonPagedBytes' : [ 0xc, ['unsigned long']], 'PagedAllocs' : [ 0x10, ['unsigned long']], 'PagedFrees' : [ 0x14, ['unsigned long']], 'PagedBytes' : [ 0x18, ['unsigned long']], } ], '_KNODE' : [ 0x30, { 'ProcessorMask' : [ 0x0, ['unsigned long']], 'Color' : [ 0x4, ['unsigned long']], 'MmShiftedColor' : [ 0x8, ['unsigned long']], 'FreeCount' : [ 0xc, ['array', 2, ['unsigned long']]], 'DeadStackList' : [ 0x18, ['_SLIST_HEADER']], 'PfnDereferenceSListHead' : [ 0x20, ['_SLIST_HEADER']], 'PfnDeferredList' : [ 0x28, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'Seed' : [ 0x2c, ['unsigned char']], 'NodeNumber' : [ 0x2d, ['unsigned char']], 'Flags' : [ 0x2e, ['_flags']], } ], '_PHYSICAL_MEMORY_DESCRIPTOR' : [ 0x10, { 'NumberOfRuns' : [ 0x0, ['unsigned long']], 'NumberOfPages' : [ 0x4, ['unsigned long']], 'Run' : [ 0x8, ['array', 1, ['_PHYSICAL_MEMORY_RUN']]], } ], '_SEGMENT_FLAGS' : [ 0x4, { 'TotalNumberOfPtes4132' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 10, native_type='unsigned long')]], 'ExtraSharedWowSubsections' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 32, native_type='unsigned long')]], } ], '_PI_BUS_EXTENSION' : [ 0x44, { 'Flags' : [ 0x0, ['unsigned long']], 'NumberCSNs' : [ 0x4, ['unsigned char']], 'ReadDataPort' : [ 0x8, ['pointer', ['unsigned char']]], 'DataPortMapped' : [ 0xc, ['unsigned char']], 'AddressPort' : [ 0x10, ['pointer', ['unsigned char']]], 'AddrPortMapped' : [ 0x14, ['unsigned char']], 'CommandPort' : [ 0x18, ['pointer', ['unsigned char']]], 'CmdPortMapped' : [ 0x1c, ['unsigned char']], 'NextSlotNumber' : [ 0x20, ['unsigned long']], 'DeviceList' : [ 0x24, ['_SINGLE_LIST_ENTRY']], 'CardList' : [ 0x28, ['_SINGLE_LIST_ENTRY']], 'PhysicalBusDevice' : [ 0x2c, ['pointer', ['_DEVICE_OBJECT']]], 'FunctionalBusDevice' : [ 0x30, ['pointer', ['_DEVICE_OBJECT']]], 'AttachedDevice' : [ 0x34, ['pointer', ['_DEVICE_OBJECT']]], 'BusNumber' : [ 0x38, ['unsigned long']], 'SystemPowerState' : [ 0x3c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DevicePowerState' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], } ], '_VI_DEADLOCK_THREAD' : [ 0x1c, { 'Thread' : [ 0x0, ['pointer', ['_KTHREAD']]], 'CurrentSpinNode' : [ 0x4, ['pointer', ['_VI_DEADLOCK_NODE']]], 'CurrentOtherNode' : [ 0x8, ['pointer', ['_VI_DEADLOCK_NODE']]], 'ListEntry' : [ 0xc, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0xc, ['_LIST_ENTRY']], 'NodeCount' : [ 0x14, ['unsigned long']], 'PagingCount' : [ 0x18, ['unsigned long']], } ], '_MMEXTEND_INFO' : [ 0x10, { 'CommittedSize' : [ 0x0, ['unsigned long long']], 'ReferenceCount' : [ 0x8, ['unsigned long']], } ], '_IMAGE_DEBUG_DIRECTORY' : [ 0x1c, { 'Characteristics' : [ 0x0, ['unsigned long']], 'TimeDateStamp' : [ 0x4, ['unsigned long']], 'MajorVersion' : [ 0x8, ['unsigned short']], 'MinorVersion' : [ 0xa, ['unsigned short']], 'Type' : [ 0xc, ['unsigned long']], 'SizeOfData' : [ 0x10, ['unsigned long']], 'AddressOfRawData' : [ 0x14, ['unsigned long']], 'PointerToRawData' : [ 0x18, ['unsigned long']], } ], '_PCI_INTERFACE' : [ 0x1c, { 'InterfaceType' : [ 0x0, ['pointer', ['_GUID']]], 'MinSize' : [ 0x4, ['unsigned short']], 'MinVersion' : [ 0x6, ['unsigned short']], 'MaxVersion' : [ 0x8, ['unsigned short']], 'Flags' : [ 0xa, ['unsigned short']], 'ReferenceCount' : [ 0xc, ['long']], 'Signature' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {1768116272: 'PciPdoExtensionType', 1768116273: 'PciFdoExtensionType', 1768116274: 'PciArb_Io', 1768116275: 'PciArb_Memory', 1768116276: 'PciArb_Interrupt', 1768116277: 'PciArb_BusNumber', 1768116278: 'PciTrans_Interrupt', 1768116279: 'PciInterface_BusHandler', 1768116280: 'PciInterface_IntRouteHandler', 1768116281: 'PciInterface_PciCb', 1768116282: 'PciInterface_LegacyDeviceDetection', 1768116283: 'PciInterface_PmeHandler', 1768116284: 'PciInterface_DevicePresent', 1768116285: 'PciInterface_NativeIde', 1768116286: 'PciInterface_Location', 1768116287: 'PciInterface_AgpTarget'})]], 'Constructor' : [ 0x14, ['pointer', ['void']]], 'Initializer' : [ 0x18, ['pointer', ['void']]], } ], '_MMVAD' : [ 0x28, { 'u1' : [ 0x0, ['__unnamed_151e']], 'LeftChild' : [ 0x4, ['pointer', ['_MMVAD']]], 'RightChild' : [ 0x8, ['pointer', ['_MMVAD']]], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], 'u' : [ 0x14, ['__unnamed_1521']], 'ControlArea' : [ 0x18, ['pointer', ['_CONTROL_AREA']]], 'FirstPrototypePte' : [ 0x1c, ['pointer', ['_MMPTE']]], 'LastContiguousPte' : [ 0x20, ['pointer', ['_MMPTE']]], 'u2' : [ 0x24, ['__unnamed_1524']], } ], '_POP_POWER_ACTION' : [ 0x40, { 'Updates' : [ 0x0, ['unsigned char']], 'State' : [ 0x1, ['unsigned char']], 'Shutdown' : [ 0x2, ['unsigned char']], 'Action' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject'})]], 'LightestState' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'Flags' : [ 0xc, ['unsigned long']], 'Status' : [ 0x10, ['long']], 'IrpMinor' : [ 0x14, ['unsigned char']], 'SystemState' : [ 0x18, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'NextSystemState' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'ShutdownBugCode' : [ 0x20, ['pointer', ['_POP_SHUTDOWN_BUG_CHECK']]], 'DevState' : [ 0x24, ['pointer', ['_POP_DEVICE_SYS_STATE']]], 'HiberContext' : [ 0x28, ['pointer', ['_POP_HIBER_CONTEXT']]], 'LastWakeState' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'WakeTime' : [ 0x30, ['unsigned long long']], 'SleepTime' : [ 0x38, ['unsigned long long']], } ], '_LPCP_MESSAGE' : [ 0x30, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'FreeEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Reserved0' : [ 0x4, ['unsigned long']], 'SenderPort' : [ 0x8, ['pointer', ['void']]], 'RepliedToThread' : [ 0xc, ['pointer', ['_ETHREAD']]], 'PortContext' : [ 0x10, ['pointer', ['void']]], 'Request' : [ 0x18, ['_PORT_MESSAGE']], } ], '_MMVAD_SHORT' : [ 0x18, { 'u1' : [ 0x0, ['__unnamed_151e']], 'LeftChild' : [ 0x4, ['pointer', ['_MMVAD']]], 'RightChild' : [ 0x8, ['pointer', ['_MMVAD']]], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], 'u' : [ 0x14, ['__unnamed_1521']], } ], '__unnamed_1782' : [ 0x2c, { 'InitialPrivilegeSet' : [ 0x0, ['_INITIAL_PRIVILEGE_SET']], 'PrivilegeSet' : [ 0x0, ['_PRIVILEGE_SET']], } ], '_ACCESS_STATE' : [ 0x74, { 'OperationID' : [ 0x0, ['_LUID']], 'SecurityEvaluated' : [ 0x8, ['unsigned char']], 'GenerateAudit' : [ 0x9, ['unsigned char']], 'GenerateOnClose' : [ 0xa, ['unsigned char']], 'PrivilegesAllocated' : [ 0xb, ['unsigned char']], 'Flags' : [ 0xc, ['unsigned long']], 'RemainingDesiredAccess' : [ 0x10, ['unsigned long']], 'PreviouslyGrantedAccess' : [ 0x14, ['unsigned long']], 'OriginalDesiredAccess' : [ 0x18, ['unsigned long']], 'SubjectSecurityContext' : [ 0x1c, ['_SECURITY_SUBJECT_CONTEXT']], 'SecurityDescriptor' : [ 0x2c, ['pointer', ['void']]], 'AuxData' : [ 0x30, ['pointer', ['void']]], 'Privileges' : [ 0x34, ['__unnamed_1782']], 'AuditPrivileges' : [ 0x60, ['unsigned char']], 'ObjectName' : [ 0x64, ['_UNICODE_STRING']], 'ObjectTypeName' : [ 0x6c, ['_UNICODE_STRING']], } ], '_PNP_DEVICE_EVENT_ENTRY' : [ 0x58, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Argument' : [ 0x8, ['unsigned long']], 'CallerEvent' : [ 0xc, ['pointer', ['_KEVENT']]], 'Callback' : [ 0x10, ['pointer', ['void']]], 'Context' : [ 0x14, ['pointer', ['void']]], 'VetoType' : [ 0x18, ['pointer', ['Enumeration', dict(target = 'long', choices = {0: 'PNP_VetoTypeUnknown', 1: 'PNP_VetoLegacyDevice', 2: 'PNP_VetoPendingClose', 3: 'PNP_VetoWindowsApp', 4: 'PNP_VetoWindowsService', 5: 'PNP_VetoOutstandingOpen', 6: 'PNP_VetoDevice', 7: 'PNP_VetoDriver', 8: 'PNP_VetoIllegalDeviceRequest', 9: 'PNP_VetoInsufficientPower', 10: 'PNP_VetoNonDisableable', 11: 'PNP_VetoLegacyDriver', 12: 'PNP_VetoInsufficientRights'})]]], 'VetoName' : [ 0x1c, ['pointer', ['_UNICODE_STRING']]], 'Data' : [ 0x20, ['_PLUGPLAY_EVENT_BLOCK']], } ], '_PRIVATE_CACHE_MAP_FLAGS' : [ 0x4, { 'DontUse' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'ReadAheadActive' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'ReadAheadEnabled' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'Available' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 32, native_type='unsigned long')]], } ], '_PNP_DEVICE_EVENT_LIST' : [ 0x4c, { 'Status' : [ 0x0, ['long']], 'EventQueueMutex' : [ 0x4, ['_KMUTANT']], 'Lock' : [ 0x24, ['_KGUARDED_MUTEX']], 'List' : [ 0x44, ['_LIST_ENTRY']], } ], '_KPROCESSOR_STATE' : [ 0x320, { 'ContextFrame' : [ 0x0, ['_CONTEXT']], 'SpecialRegisters' : [ 0x2cc, ['_KSPECIAL_REGISTERS']], } ], '_MMPTE_TRANSITION' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Owner' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_STRING' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x4, ['pointer', ['unsigned char']]], } ], '_MMVAD_FLAGS2' : [ 0x4, { 'FileOffset' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'SecNoChange' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'OneSecured' : [ 0x0, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'MultipleSecured' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'ReadOnly' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'LongVad' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'ExtendableFile' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'Inherit' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_flags' : [ 0x1, { 'Removable' : [ 0x0, ['unsigned char']], } ], '_CM_KEY_SECURITY_CACHE' : [ 0x28, { 'Cell' : [ 0x0, ['unsigned long']], 'ConvKey' : [ 0x4, ['unsigned long']], 'List' : [ 0x8, ['_LIST_ENTRY']], 'DescriptorLength' : [ 0x10, ['unsigned long']], 'Descriptor' : [ 0x14, ['_SECURITY_DESCRIPTOR_RELATIVE']], } ], '_PROCESSOR_POWER_POLICY_INFO' : [ 0x14, { 'TimeCheck' : [ 0x0, ['unsigned long']], 'DemoteLimit' : [ 0x4, ['unsigned long']], 'PromoteLimit' : [ 0x8, ['unsigned long']], 'DemotePercent' : [ 0xc, ['unsigned char']], 'PromotePercent' : [ 0xd, ['unsigned char']], 'Spare' : [ 0xe, ['array', 2, ['unsigned char']]], 'AllowDemotion' : [ 0x10, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'AllowPromotion' : [ 0x10, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reserved' : [ 0x10, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], } ], '_GUID' : [ 0x10, { 'Data1' : [ 0x0, ['unsigned long']], 'Data2' : [ 0x4, ['unsigned short']], 'Data3' : [ 0x6, ['unsigned short']], 'Data4' : [ 0x8, ['array', 8, ['unsigned char']]], } ], '_ARBITER_INSTANCE' : [ 0x9c, { 'Signature' : [ 0x0, ['unsigned long']], 'MutexEvent' : [ 0x4, ['pointer', ['_KEVENT']]], 'Name' : [ 0x8, ['pointer', ['unsigned short']]], 'ResourceType' : [ 0xc, ['long']], 'Allocation' : [ 0x10, ['pointer', ['_RTL_RANGE_LIST']]], 'PossibleAllocation' : [ 0x14, ['pointer', ['_RTL_RANGE_LIST']]], 'OrderingList' : [ 0x18, ['_ARBITER_ORDERING_LIST']], 'ReservedList' : [ 0x20, ['_ARBITER_ORDERING_LIST']], 'ReferenceCount' : [ 0x28, ['long']], 'Interface' : [ 0x2c, ['pointer', ['_ARBITER_INTERFACE']]], 'AllocationStackMaxSize' : [ 0x30, ['unsigned long']], 'AllocationStack' : [ 0x34, ['pointer', ['_ARBITER_ALLOCATION_STATE']]], 'UnpackRequirement' : [ 0x38, ['pointer', ['void']]], 'PackResource' : [ 0x3c, ['pointer', ['void']]], 'UnpackResource' : [ 0x40, ['pointer', ['void']]], 'ScoreRequirement' : [ 0x44, ['pointer', ['void']]], 'TestAllocation' : [ 0x48, ['pointer', ['void']]], 'RetestAllocation' : [ 0x4c, ['pointer', ['void']]], 'CommitAllocation' : [ 0x50, ['pointer', ['void']]], 'RollbackAllocation' : [ 0x54, ['pointer', ['void']]], 'BootAllocation' : [ 0x58, ['pointer', ['void']]], 'QueryArbitrate' : [ 0x5c, ['pointer', ['void']]], 'QueryConflict' : [ 0x60, ['pointer', ['void']]], 'AddReserved' : [ 0x64, ['pointer', ['void']]], 'StartArbiter' : [ 0x68, ['pointer', ['void']]], 'PreprocessEntry' : [ 0x6c, ['pointer', ['void']]], 'AllocateEntry' : [ 0x70, ['pointer', ['void']]], 'GetNextAllocationRange' : [ 0x74, ['pointer', ['void']]], 'FindSuitableRange' : [ 0x78, ['pointer', ['void']]], 'AddAllocation' : [ 0x7c, ['pointer', ['void']]], 'BacktrackAllocation' : [ 0x80, ['pointer', ['void']]], 'OverrideConflict' : [ 0x84, ['pointer', ['void']]], 'TransactionInProgress' : [ 0x88, ['unsigned char']], 'Extension' : [ 0x8c, ['pointer', ['void']]], 'BusDeviceObject' : [ 0x90, ['pointer', ['_DEVICE_OBJECT']]], 'ConflictCallbackContext' : [ 0x94, ['pointer', ['void']]], 'ConflictCallback' : [ 0x98, ['pointer', ['void']]], } ], '_BUS_HANDLER' : [ 0x6c, { 'Version' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'ConfigurationType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'Cmos', 1: 'EisaConfiguration', 2: 'Pos', 3: 'CbusConfiguration', 4: 'PCIConfiguration', 5: 'VMEConfiguration', 6: 'NuBusConfiguration', 7: 'PCMCIAConfiguration', 8: 'MPIConfiguration', 9: 'MPSAConfiguration', 10: 'PNPISAConfiguration', 11: 'SgiInternalConfiguration', 12: 'MaximumBusDataType', -1: 'ConfigurationSpaceUndefined'})]], 'BusNumber' : [ 0xc, ['unsigned long']], 'DeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'ParentHandler' : [ 0x14, ['pointer', ['_BUS_HANDLER']]], 'BusData' : [ 0x18, ['pointer', ['void']]], 'DeviceControlExtensionSize' : [ 0x1c, ['unsigned long']], 'BusAddresses' : [ 0x20, ['pointer', ['_SUPPORTED_RANGES']]], 'Reserved' : [ 0x24, ['array', 4, ['unsigned long']]], 'GetBusData' : [ 0x34, ['pointer', ['void']]], 'SetBusData' : [ 0x38, ['pointer', ['void']]], 'AdjustResourceList' : [ 0x3c, ['pointer', ['void']]], 'AssignSlotResources' : [ 0x40, ['pointer', ['void']]], 'GetInterruptVector' : [ 0x44, ['pointer', ['void']]], 'TranslateBusAddress' : [ 0x48, ['pointer', ['void']]], 'Spare1' : [ 0x4c, ['pointer', ['void']]], 'Spare2' : [ 0x50, ['pointer', ['void']]], 'Spare3' : [ 0x54, ['pointer', ['void']]], 'Spare4' : [ 0x58, ['pointer', ['void']]], 'Spare5' : [ 0x5c, ['pointer', ['void']]], 'Spare6' : [ 0x60, ['pointer', ['void']]], 'Spare7' : [ 0x64, ['pointer', ['void']]], 'Spare8' : [ 0x68, ['pointer', ['void']]], } ], '_PCI_MN_DISPATCH_TABLE' : [ 0x8, { 'DispatchStyle' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'IRP_COMPLETE', 1: 'IRP_DOWNWARD', 2: 'IRP_UPWARD', 3: 'IRP_DISPATCH'})]], 'DispatchFunction' : [ 0x4, ['pointer', ['void']]], } ], '_POP_DEVICE_SYS_STATE' : [ 0x620, { 'IrpMinor' : [ 0x0, ['unsigned char']], 'SystemState' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'Event' : [ 0x8, ['_KEVENT']], 'SpinLock' : [ 0x18, ['unsigned long']], 'Thread' : [ 0x1c, ['pointer', ['_KTHREAD']]], 'GetNewDeviceList' : [ 0x20, ['unsigned char']], 'Order' : [ 0x24, ['_PO_DEVICE_NOTIFY_ORDER']], 'Status' : [ 0x26c, ['long']], 'FailedDevice' : [ 0x270, ['pointer', ['_DEVICE_OBJECT']]], 'Waking' : [ 0x274, ['unsigned char']], 'Cancelled' : [ 0x275, ['unsigned char']], 'IgnoreErrors' : [ 0x276, ['unsigned char']], 'IgnoreNotImplemented' : [ 0x277, ['unsigned char']], 'WaitAny' : [ 0x278, ['unsigned char']], 'WaitAll' : [ 0x279, ['unsigned char']], 'PresentIrpQueue' : [ 0x27c, ['_LIST_ENTRY']], 'Head' : [ 0x284, ['_POP_DEVICE_POWER_IRP']], 'PowerIrpState' : [ 0x2b0, ['array', 20, ['_POP_DEVICE_POWER_IRP']]], } ], '_OBJECT_DUMP_CONTROL' : [ 0x8, { 'Stream' : [ 0x0, ['pointer', ['void']]], 'Detail' : [ 0x4, ['unsigned long']], } ], '_SECURITY_SUBJECT_CONTEXT' : [ 0x10, { 'ClientToken' : [ 0x0, ['pointer', ['void']]], 'ImpersonationLevel' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'PrimaryToken' : [ 0x8, ['pointer', ['void']]], 'ProcessAuditId' : [ 0xc, ['pointer', ['void']]], } ], '_HEAP_STOP_ON_TAG' : [ 0x4, { 'HeapAndTagIndex' : [ 0x0, ['unsigned long']], 'TagIndex' : [ 0x0, ['unsigned short']], 'HeapIndex' : [ 0x2, ['unsigned short']], } ], '_ACTIVATION_CONTEXT_STACK' : [ 0x14, { 'Flags' : [ 0x0, ['unsigned long']], 'NextCookieSequenceNumber' : [ 0x4, ['unsigned long']], 'ActiveFrame' : [ 0x8, ['pointer', ['_RTL_ACTIVATION_CONTEXT_STACK_FRAME']]], 'FrameListCache' : [ 0xc, ['_LIST_ENTRY']], } ], '_MMWSLE_HASH' : [ 0x8, { 'Key' : [ 0x0, ['pointer', ['void']]], 'Index' : [ 0x4, ['unsigned long']], } ], '_CM_NAME_CONTROL_BLOCK' : [ 0x10, { 'Compressed' : [ 0x0, ['unsigned char']], 'RefCount' : [ 0x2, ['unsigned short']], 'NameHash' : [ 0x4, ['_CM_NAME_HASH']], 'ConvKey' : [ 0x4, ['unsigned long']], 'NextHash' : [ 0x8, ['pointer', ['_CM_KEY_HASH']]], 'NameLength' : [ 0xc, ['unsigned short']], 'Name' : [ 0xe, ['array', 1, ['unsigned short']]], } ], '_HANDLE_TABLE_ENTRY' : [ 0x8, { 'Object' : [ 0x0, ['pointer', ['void']]], 'ObAttributes' : [ 0x0, ['unsigned long']], 'InfoTable' : [ 0x0, ['pointer', ['_HANDLE_TABLE_ENTRY_INFO']]], 'Value' : [ 0x0, ['unsigned long']], 'GrantedAccess' : [ 0x4, ['unsigned long']], 'GrantedAccessIndex' : [ 0x4, ['unsigned short']], 'CreatorBackTraceIndex' : [ 0x6, ['unsigned short']], 'NextFreeTableEntry' : [ 0x4, ['long']], } ], '_HEAP_USERDATA_HEADER' : [ 0x10, { 'SFreeListEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'SubSegment' : [ 0x0, ['pointer', ['_HEAP_SUBSEGMENT']]], 'HeapHandle' : [ 0x4, ['pointer', ['void']]], 'SizeIndex' : [ 0x8, ['unsigned long']], 'Signature' : [ 0xc, ['unsigned long']], } ], '_LPCP_PORT_OBJECT' : [ 0xa4, { 'ConnectionPort' : [ 0x0, ['pointer', ['_LPCP_PORT_OBJECT']]], 'ConnectedPort' : [ 0x4, ['pointer', ['_LPCP_PORT_OBJECT']]], 'MsgQueue' : [ 0x8, ['_LPCP_PORT_QUEUE']], 'Creator' : [ 0x18, ['_CLIENT_ID']], 'ClientSectionBase' : [ 0x20, ['pointer', ['void']]], 'ServerSectionBase' : [ 0x24, ['pointer', ['void']]], 'PortContext' : [ 0x28, ['pointer', ['void']]], 'ClientThread' : [ 0x2c, ['pointer', ['_ETHREAD']]], 'SecurityQos' : [ 0x30, ['_SECURITY_QUALITY_OF_SERVICE']], 'StaticSecurity' : [ 0x3c, ['_SECURITY_CLIENT_CONTEXT']], 'LpcReplyChainHead' : [ 0x78, ['_LIST_ENTRY']], 'LpcDataInfoChainHead' : [ 0x80, ['_LIST_ENTRY']], 'ServerProcess' : [ 0x88, ['pointer', ['_EPROCESS']]], 'MappingProcess' : [ 0x88, ['pointer', ['_EPROCESS']]], 'MaxMessageLength' : [ 0x8c, ['unsigned short']], 'MaxConnectionInfoLength' : [ 0x8e, ['unsigned short']], 'Flags' : [ 0x90, ['unsigned long']], 'WaitEvent' : [ 0x94, ['_KEVENT']], } ], 'PCI_POWER_STATE' : [ 0x40, { 'CurrentSystemState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'CurrentDeviceState' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'SystemWakeLevel' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DeviceWakeLevel' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'SystemStateMapping' : [ 0x10, ['array', -28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]]], 'WaitWakeIrp' : [ 0x2c, ['pointer', ['_IRP']]], 'SavedCancelRoutine' : [ 0x30, ['pointer', ['void']]], 'Paging' : [ 0x34, ['long']], 'Hibernate' : [ 0x38, ['long']], 'CrashDump' : [ 0x3c, ['long']], } ], '_POOL_HACKER' : [ 0x28, { 'Header' : [ 0x0, ['_POOL_HEADER']], 'Contents' : [ 0x8, ['array', 8, ['unsigned long']]], } ], '_CM_INDEX_HINT_BLOCK' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'HashKey' : [ 0x4, ['array', 1, ['unsigned long']]], } ], '__unnamed_1824' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'FileAttributes' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'EaLength' : [ 0xc, ['unsigned long']], } ], '__unnamed_1828' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'Parameters' : [ 0xc, ['pointer', ['_NAMED_PIPE_CREATE_PARAMETERS']]], } ], '__unnamed_182c' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'Parameters' : [ 0xc, ['pointer', ['_MAILSLOT_CREATE_PARAMETERS']]], } ], '__unnamed_182e' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'Key' : [ 0x4, ['unsigned long']], 'ByteOffset' : [ 0x8, ['_LARGE_INTEGER']], } ], '__unnamed_1832' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'FileName' : [ 0x4, ['pointer', ['_UNICODE_STRING']]], 'FileInformationClass' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileMaximumInformation'})]], 'FileIndex' : [ 0xc, ['unsigned long']], } ], '__unnamed_1834' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'CompletionFilter' : [ 0x4, ['unsigned long']], } ], '__unnamed_1836' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'FileInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileMaximumInformation'})]], } ], '__unnamed_1838' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'FileInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileMaximumInformation'})]], 'FileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], 'ReplaceIfExists' : [ 0xc, ['unsigned char']], 'AdvanceOnly' : [ 0xd, ['unsigned char']], 'ClusterCount' : [ 0xc, ['unsigned long']], 'DeleteHandle' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_183a' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'EaList' : [ 0x4, ['pointer', ['void']]], 'EaListLength' : [ 0x8, ['unsigned long']], 'EaIndex' : [ 0xc, ['unsigned long']], } ], '__unnamed_183c' : [ 0x4, { 'Length' : [ 0x0, ['unsigned long']], } ], '__unnamed_1840' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'FsInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileFsVolumeInformation', 2: 'FileFsLabelInformation', 3: 'FileFsSizeInformation', 4: 'FileFsDeviceInformation', 5: 'FileFsAttributeInformation', 6: 'FileFsControlInformation', 7: 'FileFsFullSizeInformation', 8: 'FileFsObjectIdInformation', 9: 'FileFsDriverPathInformation', 10: 'FileFsMaximumInformation'})]], } ], '__unnamed_1842' : [ 0x10, { 'OutputBufferLength' : [ 0x0, ['unsigned long']], 'InputBufferLength' : [ 0x4, ['unsigned long']], 'FsControlCode' : [ 0x8, ['unsigned long']], 'Type3InputBuffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_1844' : [ 0x10, { 'Length' : [ 0x0, ['pointer', ['_LARGE_INTEGER']]], 'Key' : [ 0x4, ['unsigned long']], 'ByteOffset' : [ 0x8, ['_LARGE_INTEGER']], } ], '__unnamed_1846' : [ 0x10, { 'OutputBufferLength' : [ 0x0, ['unsigned long']], 'InputBufferLength' : [ 0x4, ['unsigned long']], 'IoControlCode' : [ 0x8, ['unsigned long']], 'Type3InputBuffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_1848' : [ 0x8, { 'SecurityInformation' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], } ], '__unnamed_184a' : [ 0x8, { 'SecurityInformation' : [ 0x0, ['unsigned long']], 'SecurityDescriptor' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_184c' : [ 0x8, { 'Vpb' : [ 0x0, ['pointer', ['_VPB']]], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], } ], '__unnamed_1850' : [ 0x4, { 'Srb' : [ 0x0, ['pointer', ['_SCSI_REQUEST_BLOCK']]], } ], '__unnamed_1854' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'StartSid' : [ 0x4, ['pointer', ['void']]], 'SidList' : [ 0x8, ['pointer', ['_FILE_GET_QUOTA_INFORMATION']]], 'SidListLength' : [ 0xc, ['unsigned long']], } ], '__unnamed_1858' : [ 0x4, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'BusRelations', 1: 'EjectionRelations', 2: 'PowerRelations', 3: 'RemovalRelations', 4: 'TargetDeviceRelation', 5: 'SingleBusRelations'})]], } ], '__unnamed_185a' : [ 0x10, { 'InterfaceType' : [ 0x0, ['pointer', ['_GUID']]], 'Size' : [ 0x4, ['unsigned short']], 'Version' : [ 0x6, ['unsigned short']], 'Interface' : [ 0x8, ['pointer', ['_INTERFACE']]], 'InterfaceSpecificData' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_185e' : [ 0x4, { 'Capabilities' : [ 0x0, ['pointer', ['_DEVICE_CAPABILITIES']]], } ], '__unnamed_1860' : [ 0x4, { 'IoResourceRequirementList' : [ 0x0, ['pointer', ['_IO_RESOURCE_REQUIREMENTS_LIST']]], } ], '__unnamed_1862' : [ 0x10, { 'WhichSpace' : [ 0x0, ['unsigned long']], 'Buffer' : [ 0x4, ['pointer', ['void']]], 'Offset' : [ 0x8, ['unsigned long']], 'Length' : [ 0xc, ['unsigned long']], } ], '__unnamed_1864' : [ 0x1, { 'Lock' : [ 0x0, ['unsigned char']], } ], '__unnamed_1868' : [ 0x4, { 'IdType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'BusQueryDeviceID', 1: 'BusQueryHardwareIDs', 2: 'BusQueryCompatibleIDs', 3: 'BusQueryInstanceID', 4: 'BusQueryDeviceSerialNumber'})]], } ], '__unnamed_186c' : [ 0x8, { 'DeviceTextType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceTextDescription', 1: 'DeviceTextLocationInformation'})]], 'LocaleId' : [ 0x4, ['unsigned long']], } ], '__unnamed_1870' : [ 0x8, { 'InPath' : [ 0x0, ['unsigned char']], 'Reserved' : [ 0x1, ['array', 3, ['unsigned char']]], 'Type' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceUsageTypeUndefined', 1: 'DeviceUsageTypePaging', 2: 'DeviceUsageTypeHibernation', 3: 'DeviceUsageTypeDumpFile'})]], } ], '__unnamed_1872' : [ 0x4, { 'PowerState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], '__unnamed_1876' : [ 0x4, { 'PowerSequence' : [ 0x0, ['pointer', ['_POWER_SEQUENCE']]], } ], '__unnamed_187a' : [ 0x10, { 'SystemContext' : [ 0x0, ['unsigned long']], 'Type' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SystemPowerState', 1: 'DevicePowerState'})]], 'State' : [ 0x8, ['_POWER_STATE']], 'ShutdownType' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject'})]], } ], '__unnamed_187c' : [ 0x8, { 'AllocatedResources' : [ 0x0, ['pointer', ['_CM_RESOURCE_LIST']]], 'AllocatedResourcesTranslated' : [ 0x4, ['pointer', ['_CM_RESOURCE_LIST']]], } ], '__unnamed_187e' : [ 0x10, { 'ProviderId' : [ 0x0, ['unsigned long']], 'DataPath' : [ 0x4, ['pointer', ['void']]], 'BufferSize' : [ 0x8, ['unsigned long']], 'Buffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_1880' : [ 0x10, { 'Argument1' : [ 0x0, ['pointer', ['void']]], 'Argument2' : [ 0x4, ['pointer', ['void']]], 'Argument3' : [ 0x8, ['pointer', ['void']]], 'Argument4' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_1882' : [ 0x10, { 'Create' : [ 0x0, ['__unnamed_1824']], 'CreatePipe' : [ 0x0, ['__unnamed_1828']], 'CreateMailslot' : [ 0x0, ['__unnamed_182c']], 'Read' : [ 0x0, ['__unnamed_182e']], 'Write' : [ 0x0, ['__unnamed_182e']], 'QueryDirectory' : [ 0x0, ['__unnamed_1832']], 'NotifyDirectory' : [ 0x0, ['__unnamed_1834']], 'QueryFile' : [ 0x0, ['__unnamed_1836']], 'SetFile' : [ 0x0, ['__unnamed_1838']], 'QueryEa' : [ 0x0, ['__unnamed_183a']], 'SetEa' : [ 0x0, ['__unnamed_183c']], 'QueryVolume' : [ 0x0, ['__unnamed_1840']], 'SetVolume' : [ 0x0, ['__unnamed_1840']], 'FileSystemControl' : [ 0x0, ['__unnamed_1842']], 'LockControl' : [ 0x0, ['__unnamed_1844']], 'DeviceIoControl' : [ 0x0, ['__unnamed_1846']], 'QuerySecurity' : [ 0x0, ['__unnamed_1848']], 'SetSecurity' : [ 0x0, ['__unnamed_184a']], 'MountVolume' : [ 0x0, ['__unnamed_184c']], 'VerifyVolume' : [ 0x0, ['__unnamed_184c']], 'Scsi' : [ 0x0, ['__unnamed_1850']], 'QueryQuota' : [ 0x0, ['__unnamed_1854']], 'SetQuota' : [ 0x0, ['__unnamed_183c']], 'QueryDeviceRelations' : [ 0x0, ['__unnamed_1858']], 'QueryInterface' : [ 0x0, ['__unnamed_185a']], 'DeviceCapabilities' : [ 0x0, ['__unnamed_185e']], 'FilterResourceRequirements' : [ 0x0, ['__unnamed_1860']], 'ReadWriteConfig' : [ 0x0, ['__unnamed_1862']], 'SetLock' : [ 0x0, ['__unnamed_1864']], 'QueryId' : [ 0x0, ['__unnamed_1868']], 'QueryDeviceText' : [ 0x0, ['__unnamed_186c']], 'UsageNotification' : [ 0x0, ['__unnamed_1870']], 'WaitWake' : [ 0x0, ['__unnamed_1872']], 'PowerSequence' : [ 0x0, ['__unnamed_1876']], 'Power' : [ 0x0, ['__unnamed_187a']], 'StartDevice' : [ 0x0, ['__unnamed_187c']], 'WMI' : [ 0x0, ['__unnamed_187e']], 'Others' : [ 0x0, ['__unnamed_1880']], } ], '_IO_STACK_LOCATION' : [ 0x24, { 'MajorFunction' : [ 0x0, ['unsigned char']], 'MinorFunction' : [ 0x1, ['unsigned char']], 'Flags' : [ 0x2, ['unsigned char']], 'Control' : [ 0x3, ['unsigned char']], 'Parameters' : [ 0x4, ['__unnamed_1882']], 'DeviceObject' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], 'FileObject' : [ 0x18, ['pointer', ['_FILE_OBJECT']]], 'CompletionRoutine' : [ 0x1c, ['pointer', ['void']]], 'Context' : [ 0x20, ['pointer', ['void']]], } ], '__unnamed_1889' : [ 0x18, { 'Length' : [ 0x0, ['unsigned long']], 'Alignment' : [ 0x4, ['unsigned long']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], } ], '__unnamed_188b' : [ 0x8, { 'MinimumVector' : [ 0x0, ['unsigned long']], 'MaximumVector' : [ 0x4, ['unsigned long']], } ], '__unnamed_188d' : [ 0x8, { 'MinimumChannel' : [ 0x0, ['unsigned long']], 'MaximumChannel' : [ 0x4, ['unsigned long']], } ], '__unnamed_188f' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'MinBusNumber' : [ 0x4, ['unsigned long']], 'MaxBusNumber' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], } ], '__unnamed_1891' : [ 0xc, { 'Priority' : [ 0x0, ['unsigned long']], 'Reserved1' : [ 0x4, ['unsigned long']], 'Reserved2' : [ 0x8, ['unsigned long']], } ], '__unnamed_1893' : [ 0x18, { 'Port' : [ 0x0, ['__unnamed_1889']], 'Memory' : [ 0x0, ['__unnamed_1889']], 'Interrupt' : [ 0x0, ['__unnamed_188b']], 'Dma' : [ 0x0, ['__unnamed_188d']], 'Generic' : [ 0x0, ['__unnamed_1889']], 'DevicePrivate' : [ 0x0, ['__unnamed_15de']], 'BusNumber' : [ 0x0, ['__unnamed_188f']], 'ConfigData' : [ 0x0, ['__unnamed_1891']], } ], '_IO_RESOURCE_DESCRIPTOR' : [ 0x20, { 'Option' : [ 0x0, ['unsigned char']], 'Type' : [ 0x1, ['unsigned char']], 'ShareDisposition' : [ 0x2, ['unsigned char']], 'Spare1' : [ 0x3, ['unsigned char']], 'Flags' : [ 0x4, ['unsigned short']], 'Spare2' : [ 0x6, ['unsigned short']], 'u' : [ 0x8, ['__unnamed_1893']], } ], '_MI_VERIFIER_POOL_HEADER' : [ 0x4, { 'VerifierPoolEntry' : [ 0x0, ['pointer', ['_VI_POOL_ENTRY']]], } ], '_CM_KEY_BODY' : [ 0x44, { 'Type' : [ 0x0, ['unsigned long']], 'KeyControlBlock' : [ 0x4, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'NotifyBlock' : [ 0x8, ['pointer', ['_CM_NOTIFY_BLOCK']]], 'ProcessID' : [ 0xc, ['pointer', ['void']]], 'Callers' : [ 0x10, ['unsigned long']], 'CallerAddress' : [ 0x14, ['array', 10, ['pointer', ['void']]]], 'KeyBodyList' : [ 0x3c, ['_LIST_ENTRY']], } ], '__unnamed_18a2' : [ 0x4, { 'DataLength' : [ 0x0, ['short']], 'TotalLength' : [ 0x2, ['short']], } ], '__unnamed_18a4' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_18a2']], 'Length' : [ 0x0, ['unsigned long']], } ], '__unnamed_18a6' : [ 0x4, { 'Type' : [ 0x0, ['short']], 'DataInfoOffset' : [ 0x2, ['short']], } ], '__unnamed_18a8' : [ 0x4, { 's2' : [ 0x0, ['__unnamed_18a6']], 'ZeroInit' : [ 0x0, ['unsigned long']], } ], '_PORT_MESSAGE' : [ 0x18, { 'u1' : [ 0x0, ['__unnamed_18a4']], 'u2' : [ 0x4, ['__unnamed_18a8']], 'ClientId' : [ 0x8, ['_CLIENT_ID']], 'DoNotUseThisField' : [ 0x8, ['double']], 'MessageId' : [ 0x10, ['unsigned long']], 'ClientViewSize' : [ 0x14, ['unsigned long']], 'CallbackId' : [ 0x14, ['unsigned long']], } ], '_DBGKD_ANY_CONTROL_SET' : [ 0x1c, { 'X86ControlSet' : [ 0x0, ['_X86_DBGKD_CONTROL_SET']], 'AlphaControlSet' : [ 0x0, ['unsigned long']], 'IA64ControlSet' : [ 0x0, ['_IA64_DBGKD_CONTROL_SET']], 'Amd64ControlSet' : [ 0x0, ['_AMD64_DBGKD_CONTROL_SET']], } ], '_ARBITER_ORDERING_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned short']], 'Maximum' : [ 0x2, ['unsigned short']], 'Orderings' : [ 0x4, ['pointer', ['_ARBITER_ORDERING']]], } ], '_HBASE_BLOCK' : [ 0x1000, { 'Signature' : [ 0x0, ['unsigned long']], 'Sequence1' : [ 0x4, ['unsigned long']], 'Sequence2' : [ 0x8, ['unsigned long']], 'TimeStamp' : [ 0xc, ['_LARGE_INTEGER']], 'Major' : [ 0x14, ['unsigned long']], 'Minor' : [ 0x18, ['unsigned long']], 'Type' : [ 0x1c, ['unsigned long']], 'Format' : [ 0x20, ['unsigned long']], 'RootCell' : [ 0x24, ['unsigned long']], 'Length' : [ 0x28, ['unsigned long']], 'Cluster' : [ 0x2c, ['unsigned long']], 'FileName' : [ 0x30, ['array', 64, ['unsigned char']]], 'Reserved1' : [ 0x70, ['array', 99, ['unsigned long']]], 'CheckSum' : [ 0x1fc, ['unsigned long']], 'Reserved2' : [ 0x200, ['array', 894, ['unsigned long']]], 'BootType' : [ 0xff8, ['unsigned long']], 'BootRecover' : [ 0xffc, ['unsigned long']], } ], '_DUAL' : [ 0x13c, { 'Length' : [ 0x0, ['unsigned long']], 'Map' : [ 0x4, ['pointer', ['_HMAP_DIRECTORY']]], 'SmallDir' : [ 0x8, ['pointer', ['_HMAP_TABLE']]], 'Guard' : [ 0xc, ['unsigned long']], 'FreeDisplay' : [ 0x10, ['array', 24, ['_FREE_DISPLAY']]], 'FreeSummary' : [ 0x130, ['unsigned long']], 'FreeBins' : [ 0x134, ['_LIST_ENTRY']], } ], '_VI_POOL_ENTRY' : [ 0x10, { 'PageHeader' : [ 0x0, ['_VI_POOL_PAGE_HEADER']], 'InUse' : [ 0x0, ['_VI_POOL_ENTRY_INUSE']], 'NextFree' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_LPCP_PORT_QUEUE' : [ 0x10, { 'NonPagedPortQueue' : [ 0x0, ['pointer', ['_LPCP_NONPAGED_PORT_QUEUE']]], 'Semaphore' : [ 0x4, ['pointer', ['_KSEMAPHORE']]], 'ReceiveHead' : [ 0x8, ['_LIST_ENTRY']], } ], '_INITIAL_PRIVILEGE_SET' : [ 0x2c, { 'PrivilegeCount' : [ 0x0, ['unsigned long']], 'Control' : [ 0x4, ['unsigned long']], 'Privilege' : [ 0x8, ['array', 3, ['_LUID_AND_ATTRIBUTES']]], } ], '_POP_HIBER_CONTEXT' : [ 0xe0, { 'WriteToFile' : [ 0x0, ['unsigned char']], 'ReserveLoaderMemory' : [ 0x1, ['unsigned char']], 'ReserveFreeMemory' : [ 0x2, ['unsigned char']], 'VerifyOnWake' : [ 0x3, ['unsigned char']], 'Reset' : [ 0x4, ['unsigned char']], 'HiberFlags' : [ 0x5, ['unsigned char']], 'LinkFile' : [ 0x6, ['unsigned char']], 'LinkFileHandle' : [ 0x8, ['pointer', ['void']]], 'Lock' : [ 0xc, ['unsigned long']], 'MapFrozen' : [ 0x10, ['unsigned char']], 'MemoryMap' : [ 0x14, ['_RTL_BITMAP']], 'ClonedRanges' : [ 0x1c, ['_LIST_ENTRY']], 'ClonedRangeCount' : [ 0x24, ['unsigned long']], 'NextCloneRange' : [ 0x28, ['pointer', ['_LIST_ENTRY']]], 'NextPreserve' : [ 0x2c, ['unsigned long']], 'LoaderMdl' : [ 0x30, ['pointer', ['_MDL']]], 'Clones' : [ 0x34, ['pointer', ['_MDL']]], 'NextClone' : [ 0x38, ['pointer', ['unsigned char']]], 'NoClones' : [ 0x3c, ['unsigned long']], 'Spares' : [ 0x40, ['pointer', ['_MDL']]], 'PagesOut' : [ 0x48, ['unsigned long long']], 'IoPage' : [ 0x50, ['pointer', ['void']]], 'CurrentMcb' : [ 0x54, ['pointer', ['void']]], 'DumpStack' : [ 0x58, ['pointer', ['_DUMP_STACK_CONTEXT']]], 'WakeState' : [ 0x5c, ['pointer', ['_KPROCESSOR_STATE']]], 'NoRanges' : [ 0x60, ['unsigned long']], 'HiberVa' : [ 0x64, ['unsigned long']], 'HiberPte' : [ 0x68, ['_LARGE_INTEGER']], 'Status' : [ 0x70, ['long']], 'MemoryImage' : [ 0x74, ['pointer', ['PO_MEMORY_IMAGE']]], 'TableHead' : [ 0x78, ['pointer', ['_PO_MEMORY_RANGE_ARRAY']]], 'CompressionWorkspace' : [ 0x7c, ['pointer', ['unsigned char']]], 'CompressedWriteBuffer' : [ 0x80, ['pointer', ['unsigned char']]], 'PerformanceStats' : [ 0x84, ['pointer', ['unsigned long']]], 'CompressionBlock' : [ 0x88, ['pointer', ['void']]], 'DmaIO' : [ 0x8c, ['pointer', ['void']]], 'TemporaryHeap' : [ 0x90, ['pointer', ['void']]], 'PerfInfo' : [ 0x98, ['_PO_HIBER_PERF']], } ], '_TEB_ACTIVE_FRAME' : [ 0xc, { 'Flags' : [ 0x0, ['unsigned long']], 'Previous' : [ 0x4, ['pointer', ['_TEB_ACTIVE_FRAME']]], 'Context' : [ 0x8, ['pointer', ['_TEB_ACTIVE_FRAME_CONTEXT']]], } ], '_FILE_GET_QUOTA_INFORMATION' : [ 0x14, { 'NextEntryOffset' : [ 0x0, ['unsigned long']], 'SidLength' : [ 0x4, ['unsigned long']], 'Sid' : [ 0x8, ['_SID']], } ], '_MMADDRESS_LIST' : [ 0x8, { 'StartVpn' : [ 0x0, ['unsigned long']], 'EndVpn' : [ 0x4, ['unsigned long']], } ], '_OBJECT_NAME_INFORMATION' : [ 0x8, { 'Name' : [ 0x0, ['_UNICODE_STRING']], } ], '_SECURITY_QUALITY_OF_SERVICE' : [ 0xc, { 'Length' : [ 0x0, ['unsigned long']], 'ImpersonationLevel' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'ContextTrackingMode' : [ 0x8, ['unsigned char']], 'EffectiveOnly' : [ 0x9, ['unsigned char']], } ], '_DUMP_STACK_CONTEXT' : [ 0xb0, { 'Init' : [ 0x0, ['_DUMP_INITIALIZATION_CONTEXT']], 'PartitionOffset' : [ 0x70, ['_LARGE_INTEGER']], 'DumpPointers' : [ 0x78, ['pointer', ['void']]], 'PointersLength' : [ 0x7c, ['unsigned long']], 'ModulePrefix' : [ 0x80, ['pointer', ['unsigned short']]], 'DriverList' : [ 0x84, ['_LIST_ENTRY']], 'InitMsg' : [ 0x8c, ['_STRING']], 'ProgMsg' : [ 0x94, ['_STRING']], 'DoneMsg' : [ 0x9c, ['_STRING']], 'FileObject' : [ 0xa4, ['pointer', ['void']]], 'UsageType' : [ 0xa8, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceUsageTypeUndefined', 1: 'DeviceUsageTypePaging', 2: 'DeviceUsageTypeHibernation', 3: 'DeviceUsageTypeDumpFile'})]], } ], '_POP_SHUTDOWN_BUG_CHECK' : [ 0x14, { 'Code' : [ 0x0, ['unsigned long']], 'Parameter1' : [ 0x4, ['unsigned long']], 'Parameter2' : [ 0x8, ['unsigned long']], 'Parameter3' : [ 0xc, ['unsigned long']], 'Parameter4' : [ 0x10, ['unsigned long']], } ], '__unnamed_18e5' : [ 0x4, { 'DeviceNumber' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 5, native_type='unsigned long')]], 'FunctionNumber' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_18e7' : [ 0x4, { 'bits' : [ 0x0, ['__unnamed_18e5']], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_PCI_SLOT_NUMBER' : [ 0x4, { 'u' : [ 0x0, ['__unnamed_18e7']], } ], '_Wx86ThreadState' : [ 0xc, { 'CallBx86Eip' : [ 0x0, ['pointer', ['unsigned long']]], 'DeallocationCpu' : [ 0x4, ['pointer', ['void']]], 'UseKnownWx86Dll' : [ 0x8, ['unsigned char']], 'OleStubInvoked' : [ 0x9, ['unsigned char']], } ], '_CM_NOTIFY_BLOCK' : [ 0x2c, { 'HiveList' : [ 0x0, ['_LIST_ENTRY']], 'PostList' : [ 0x8, ['_LIST_ENTRY']], 'KeyControlBlock' : [ 0x10, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'KeyBody' : [ 0x14, ['pointer', ['_CM_KEY_BODY']]], 'Filter' : [ 0x18, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'WatchTree' : [ 0x18, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'NotifyPending' : [ 0x18, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'SubjectContext' : [ 0x1c, ['_SECURITY_SUBJECT_CONTEXT']], } ], '_SID' : [ 0xc, { 'Revision' : [ 0x0, ['unsigned char']], 'SubAuthorityCount' : [ 0x1, ['unsigned char']], 'IdentifierAuthority' : [ 0x2, ['_SID_IDENTIFIER_AUTHORITY']], 'SubAuthority' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '_RTL_HANDLE_TABLE_ENTRY' : [ 0x4, { 'Flags' : [ 0x0, ['unsigned long']], 'NextFree' : [ 0x0, ['pointer', ['_RTL_HANDLE_TABLE_ENTRY']]], } ], '_VI_POOL_ENTRY_INUSE' : [ 0x10, { 'VirtualAddress' : [ 0x0, ['pointer', ['void']]], 'CallingAddress' : [ 0x4, ['pointer', ['void']]], 'NumberOfBytes' : [ 0x8, ['unsigned long']], 'Tag' : [ 0xc, ['unsigned long']], } ], '_INTERFACE' : [ 0x10, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], } ], '_SUPPORTED_RANGES' : [ 0xa0, { 'Version' : [ 0x0, ['unsigned short']], 'Sorted' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], 'NoIO' : [ 0x4, ['unsigned long']], 'IO' : [ 0x8, ['_SUPPORTED_RANGE']], 'NoMemory' : [ 0x28, ['unsigned long']], 'Memory' : [ 0x30, ['_SUPPORTED_RANGE']], 'NoPrefetchMemory' : [ 0x50, ['unsigned long']], 'PrefetchMemory' : [ 0x58, ['_SUPPORTED_RANGE']], 'NoDma' : [ 0x78, ['unsigned long']], 'Dma' : [ 0x80, ['_SUPPORTED_RANGE']], } ], '_DRIVER_OBJECT' : [ 0xa8, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'Flags' : [ 0x8, ['unsigned long']], 'DriverStart' : [ 0xc, ['pointer', ['void']]], 'DriverSize' : [ 0x10, ['unsigned long']], 'DriverSection' : [ 0x14, ['pointer', ['void']]], 'DriverExtension' : [ 0x18, ['pointer', ['_DRIVER_EXTENSION']]], 'DriverName' : [ 0x1c, ['_UNICODE_STRING']], 'HardwareDatabase' : [ 0x24, ['pointer', ['_UNICODE_STRING']]], 'FastIoDispatch' : [ 0x28, ['pointer', ['_FAST_IO_DISPATCH']]], 'DriverInit' : [ 0x2c, ['pointer', ['void']]], 'DriverStartIo' : [ 0x30, ['pointer', ['void']]], 'DriverUnload' : [ 0x34, ['pointer', ['void']]], 'MajorFunction' : [ 0x38, ['array', 28, ['pointer', ['void']]]], } ], '_SID_IDENTIFIER_AUTHORITY' : [ 0x6, { 'Value' : [ 0x0, ['array', 6, ['unsigned char']]], } ], '_SECURITY_DESCRIPTOR_RELATIVE' : [ 0x14, { 'Revision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'Control' : [ 0x2, ['unsigned short']], 'Owner' : [ 0x4, ['unsigned long']], 'Group' : [ 0x8, ['unsigned long']], 'Sacl' : [ 0xc, ['unsigned long']], 'Dacl' : [ 0x10, ['unsigned long']], } ], '_DRIVER_EXTENSION' : [ 0x1c, { 'DriverObject' : [ 0x0, ['pointer', ['_DRIVER_OBJECT']]], 'AddDevice' : [ 0x4, ['pointer', ['void']]], 'Count' : [ 0x8, ['unsigned long']], 'ServiceKeyName' : [ 0xc, ['_UNICODE_STRING']], 'ClientDriverExtension' : [ 0x14, ['pointer', ['_IO_CLIENT_EXTENSION']]], 'FsFilterCallbacks' : [ 0x18, ['pointer', ['_FS_FILTER_CALLBACKS']]], } ], '_PM_SUPPORT' : [ 0x1, { 'Rsvd2' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'D1' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'D2' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'PMED0' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'PMED1' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'PMED2' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'PMED3Hot' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'PMED3Cold' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], } ], '_TEB_ACTIVE_FRAME_CONTEXT' : [ 0x8, { 'Flags' : [ 0x0, ['unsigned long']], 'FrameName' : [ 0x4, ['pointer', ['unsigned char']]], } ], '__unnamed_191a' : [ 0xc, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'AllocateFromCount' : [ 0x4, ['unsigned long']], 'AllocateFrom' : [ 0x8, ['pointer', ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '__unnamed_191c' : [ 0x4, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], } ], '__unnamed_1920' : [ 0x4, { 'AllocatedResources' : [ 0x0, ['pointer', ['pointer', ['_CM_PARTIAL_RESOURCE_LIST']]]], } ], '__unnamed_1922' : [ 0x10, { 'PhysicalDeviceObject' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], 'ConflictingResource' : [ 0x4, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'ConflictCount' : [ 0x8, ['pointer', ['unsigned long']]], 'Conflicts' : [ 0xc, ['pointer', ['pointer', ['_ARBITER_CONFLICT_INFO']]]], } ], '__unnamed_1924' : [ 0x4, { 'ReserveDevice' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], } ], '__unnamed_1926' : [ 0x10, { 'TestAllocation' : [ 0x0, ['__unnamed_191a']], 'RetestAllocation' : [ 0x0, ['__unnamed_191a']], 'BootAllocation' : [ 0x0, ['__unnamed_191c']], 'QueryAllocatedResources' : [ 0x0, ['__unnamed_1920']], 'QueryConflict' : [ 0x0, ['__unnamed_1922']], 'QueryArbitrate' : [ 0x0, ['__unnamed_191c']], 'AddReserved' : [ 0x0, ['__unnamed_1924']], } ], '_ARBITER_PARAMETERS' : [ 0x10, { 'Parameters' : [ 0x0, ['__unnamed_1926']], } ], '_HANDLE_TABLE_ENTRY_INFO' : [ 0x4, { 'AuditMask' : [ 0x0, ['unsigned long']], } ], '_POWER_SEQUENCE' : [ 0xc, { 'SequenceD1' : [ 0x0, ['unsigned long']], 'SequenceD2' : [ 0x4, ['unsigned long']], 'SequenceD3' : [ 0x8, ['unsigned long']], } ], '_IMAGE_DATA_DIRECTORY' : [ 0x8, { 'VirtualAddress' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], } ], '_CURDIR' : [ 0xc, { 'DosPath' : [ 0x0, ['_UNICODE_STRING']], 'Handle' : [ 0x8, ['pointer', ['void']]], } ], '_PO_HIBER_PERF' : [ 0x48, { 'IoTicks' : [ 0x0, ['unsigned long long']], 'InitTicks' : [ 0x8, ['unsigned long long']], 'CopyTicks' : [ 0x10, ['unsigned long long']], 'StartCount' : [ 0x18, ['unsigned long long']], 'ElapsedTime' : [ 0x20, ['unsigned long']], 'IoTime' : [ 0x24, ['unsigned long']], 'CopyTime' : [ 0x28, ['unsigned long']], 'InitTime' : [ 0x2c, ['unsigned long']], 'PagesWritten' : [ 0x30, ['unsigned long']], 'PagesProcessed' : [ 0x34, ['unsigned long']], 'BytesCopied' : [ 0x38, ['unsigned long']], 'DumpCount' : [ 0x3c, ['unsigned long']], 'FileRuns' : [ 0x40, ['unsigned long']], } ], '_GDI_TEB_BATCH' : [ 0x4e0, { 'Offset' : [ 0x0, ['unsigned long']], 'HDC' : [ 0x4, ['unsigned long']], 'Buffer' : [ 0x8, ['array', 310, ['unsigned long']]], } ], '_FREE_DISPLAY' : [ 0xc, { 'RealVectorSize' : [ 0x0, ['unsigned long']], 'Display' : [ 0x4, ['_RTL_BITMAP']], } ], 'PO_MEMORY_IMAGE' : [ 0xa8, { 'Signature' : [ 0x0, ['unsigned long']], 'Version' : [ 0x4, ['unsigned long']], 'CheckSum' : [ 0x8, ['unsigned long']], 'LengthSelf' : [ 0xc, ['unsigned long']], 'PageSelf' : [ 0x10, ['unsigned long']], 'PageSize' : [ 0x14, ['unsigned long']], 'ImageType' : [ 0x18, ['unsigned long']], 'SystemTime' : [ 0x20, ['_LARGE_INTEGER']], 'InterruptTime' : [ 0x28, ['unsigned long long']], 'FeatureFlags' : [ 0x30, ['unsigned long']], 'HiberFlags' : [ 0x34, ['unsigned char']], 'spare' : [ 0x35, ['array', 3, ['unsigned char']]], 'NoHiberPtes' : [ 0x38, ['unsigned long']], 'HiberVa' : [ 0x3c, ['unsigned long']], 'HiberPte' : [ 0x40, ['_LARGE_INTEGER']], 'NoFreePages' : [ 0x48, ['unsigned long']], 'FreeMapCheck' : [ 0x4c, ['unsigned long']], 'WakeCheck' : [ 0x50, ['unsigned long']], 'TotalPages' : [ 0x54, ['unsigned long']], 'FirstTablePage' : [ 0x58, ['unsigned long']], 'LastFilePage' : [ 0x5c, ['unsigned long']], 'PerfInfo' : [ 0x60, ['_PO_HIBER_PERF']], } ], 'BATTERY_REPORTING_SCALE' : [ 0x8, { 'Granularity' : [ 0x0, ['unsigned long']], 'Capacity' : [ 0x4, ['unsigned long']], } ], '_KDEVICE_QUEUE_ENTRY' : [ 0x10, { 'DeviceListEntry' : [ 0x0, ['_LIST_ENTRY']], 'SortKey' : [ 0x8, ['unsigned long']], 'Inserted' : [ 0xc, ['unsigned char']], } ], '_DEVICE_CAPABILITIES' : [ 0x40, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'DeviceD1' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DeviceD2' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'LockSupported' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'EjectSupported' : [ 0x4, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Removable' : [ 0x4, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'DockDevice' : [ 0x4, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'UniqueID' : [ 0x4, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'SilentInstall' : [ 0x4, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'RawDeviceOK' : [ 0x4, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'SurpriseRemovalOK' : [ 0x4, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'WakeFromD0' : [ 0x4, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'WakeFromD1' : [ 0x4, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'WakeFromD2' : [ 0x4, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'WakeFromD3' : [ 0x4, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'HardwareDisabled' : [ 0x4, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'NonDynamic' : [ 0x4, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'WarmEjectSupported' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'NoDisplayInUI' : [ 0x4, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'Reserved' : [ 0x4, ['BitField', dict(start_bit = 18, end_bit = 32, native_type='unsigned long')]], 'Address' : [ 0x8, ['unsigned long']], 'UINumber' : [ 0xc, ['unsigned long']], 'DeviceState' : [ 0x10, ['array', -28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]]], 'SystemWake' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DeviceWake' : [ 0x30, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'D1Latency' : [ 0x34, ['unsigned long']], 'D2Latency' : [ 0x38, ['unsigned long']], 'D3Latency' : [ 0x3c, ['unsigned long']], } ], '_VI_POOL_PAGE_HEADER' : [ 0xc, { 'NextPage' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'VerifierEntry' : [ 0x4, ['pointer', ['void']]], 'Signature' : [ 0x8, ['unsigned long']], } ], '_RTL_RANGE_LIST' : [ 0x14, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'Flags' : [ 0x8, ['unsigned long']], 'Count' : [ 0xc, ['unsigned long']], 'Stamp' : [ 0x10, ['unsigned long']], } ], '_RTL_CRITICAL_SECTION_DEBUG' : [ 0x20, { 'Type' : [ 0x0, ['unsigned short']], 'CreatorBackTraceIndex' : [ 0x2, ['unsigned short']], 'CriticalSection' : [ 0x4, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'ProcessLocksList' : [ 0x8, ['_LIST_ENTRY']], 'EntryCount' : [ 0x10, ['unsigned long']], 'ContentionCount' : [ 0x14, ['unsigned long']], 'Spare' : [ 0x18, ['array', 2, ['unsigned long']]], } ], '__unnamed_1949' : [ 0x14, { 'ClassGuid' : [ 0x0, ['_GUID']], 'SymbolicLinkName' : [ 0x10, ['array', 1, ['unsigned short']]], } ], '__unnamed_194b' : [ 0x2, { 'DeviceIds' : [ 0x0, ['array', 1, ['unsigned short']]], } ], '__unnamed_194d' : [ 0x2, { 'DeviceId' : [ 0x0, ['array', 1, ['unsigned short']]], } ], '__unnamed_194f' : [ 0x8, { 'NotificationStructure' : [ 0x0, ['pointer', ['void']]], 'DeviceIds' : [ 0x4, ['array', 1, ['unsigned short']]], } ], '__unnamed_1951' : [ 0x4, { 'Notification' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_1953' : [ 0x8, { 'NotificationCode' : [ 0x0, ['unsigned long']], 'NotificationData' : [ 0x4, ['unsigned long']], } ], '__unnamed_1955' : [ 0x8, { 'VetoType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PNP_VetoTypeUnknown', 1: 'PNP_VetoLegacyDevice', 2: 'PNP_VetoPendingClose', 3: 'PNP_VetoWindowsApp', 4: 'PNP_VetoWindowsService', 5: 'PNP_VetoOutstandingOpen', 6: 'PNP_VetoDevice', 7: 'PNP_VetoDriver', 8: 'PNP_VetoIllegalDeviceRequest', 9: 'PNP_VetoInsufficientPower', 10: 'PNP_VetoNonDisableable', 11: 'PNP_VetoLegacyDriver', 12: 'PNP_VetoInsufficientRights'})]], 'DeviceIdVetoNameBuffer' : [ 0x4, ['array', 1, ['unsigned short']]], } ], '__unnamed_1957' : [ 0x10, { 'BlockedDriverGuid' : [ 0x0, ['_GUID']], } ], '__unnamed_1959' : [ 0x2, { 'ParentId' : [ 0x0, ['array', 1, ['unsigned short']]], } ], '__unnamed_195b' : [ 0x14, { 'DeviceClass' : [ 0x0, ['__unnamed_1949']], 'TargetDevice' : [ 0x0, ['__unnamed_194b']], 'InstallDevice' : [ 0x0, ['__unnamed_194d']], 'CustomNotification' : [ 0x0, ['__unnamed_194f']], 'ProfileNotification' : [ 0x0, ['__unnamed_1951']], 'PowerNotification' : [ 0x0, ['__unnamed_1953']], 'VetoNotification' : [ 0x0, ['__unnamed_1955']], 'BlockedDriverNotification' : [ 0x0, ['__unnamed_1957']], 'InvalidIDNotification' : [ 0x0, ['__unnamed_1959']], } ], '_PLUGPLAY_EVENT_BLOCK' : [ 0x38, { 'EventGuid' : [ 0x0, ['_GUID']], 'EventCategory' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'HardwareProfileChangeEvent', 1: 'TargetDeviceChangeEvent', 2: 'DeviceClassChangeEvent', 3: 'CustomDeviceEvent', 4: 'DeviceInstallEvent', 5: 'DeviceArrivalEvent', 6: 'PowerEvent', 7: 'VetoEvent', 8: 'BlockedDriverEvent', 9: 'InvalidIDEvent', 10: 'MaxPlugEventCategory'})]], 'Result' : [ 0x14, ['pointer', ['unsigned long']]], 'Flags' : [ 0x18, ['unsigned long']], 'TotalSize' : [ 0x1c, ['unsigned long']], 'DeviceObject' : [ 0x20, ['pointer', ['void']]], 'u' : [ 0x24, ['__unnamed_195b']], } ], '_CACHED_CHILD_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'ValueList' : [ 0x4, ['unsigned long']], 'RealKcb' : [ 0x4, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], } ], '_PO_MEMORY_RANGE_ARRAY' : [ 0x10, { 'Range' : [ 0x0, ['_PO_MEMORY_RANGE_ARRAY_RANGE']], 'Link' : [ 0x0, ['_PO_MEMORY_RANGE_ARRAY_LINK']], } ], '__unnamed_1972' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned long']], 'CheckSum' : [ 0x4, ['unsigned long']], } ], '__unnamed_1974' : [ 0x10, { 'DiskId' : [ 0x0, ['_GUID']], } ], '__unnamed_1976' : [ 0x10, { 'Mbr' : [ 0x0, ['__unnamed_1972']], 'Gpt' : [ 0x0, ['__unnamed_1974']], } ], '_DUMP_INITIALIZATION_CONTEXT' : [ 0x70, { 'Length' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'MemoryBlock' : [ 0x8, ['pointer', ['void']]], 'CommonBuffer' : [ 0xc, ['array', 2, ['pointer', ['void']]]], 'PhysicalAddress' : [ 0x18, ['array', 2, ['_LARGE_INTEGER']]], 'StallRoutine' : [ 0x28, ['pointer', ['void']]], 'OpenRoutine' : [ 0x2c, ['pointer', ['void']]], 'WriteRoutine' : [ 0x30, ['pointer', ['void']]], 'FinishRoutine' : [ 0x34, ['pointer', ['void']]], 'AdapterObject' : [ 0x38, ['pointer', ['_ADAPTER_OBJECT']]], 'MappedRegisterBase' : [ 0x3c, ['pointer', ['void']]], 'PortConfiguration' : [ 0x40, ['pointer', ['void']]], 'CrashDump' : [ 0x44, ['unsigned char']], 'MaximumTransferSize' : [ 0x48, ['unsigned long']], 'CommonBufferSize' : [ 0x4c, ['unsigned long']], 'TargetAddress' : [ 0x50, ['pointer', ['void']]], 'WritePendingRoutine' : [ 0x54, ['pointer', ['void']]], 'PartitionStyle' : [ 0x58, ['unsigned long']], 'DiskInfo' : [ 0x5c, ['__unnamed_1976']], } ], '_IO_CLIENT_EXTENSION' : [ 0x8, { 'NextExtension' : [ 0x0, ['pointer', ['_IO_CLIENT_EXTENSION']]], 'ClientIdentificationAddress' : [ 0x4, ['pointer', ['void']]], } ], '_CM_NAME_HASH' : [ 0xc, { 'ConvKey' : [ 0x0, ['unsigned long']], 'NextHash' : [ 0x4, ['pointer', ['_CM_NAME_HASH']]], 'NameLength' : [ 0x8, ['unsigned short']], 'Name' : [ 0xa, ['array', 1, ['unsigned short']]], } ], '_ARBITER_ALLOCATION_STATE' : [ 0x38, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'CurrentMinimum' : [ 0x10, ['unsigned long long']], 'CurrentMaximum' : [ 0x18, ['unsigned long long']], 'Entry' : [ 0x20, ['pointer', ['_ARBITER_LIST_ENTRY']]], 'CurrentAlternative' : [ 0x24, ['pointer', ['_ARBITER_ALTERNATIVE']]], 'AlternativeCount' : [ 0x28, ['unsigned long']], 'Alternatives' : [ 0x2c, ['pointer', ['_ARBITER_ALTERNATIVE']]], 'Flags' : [ 0x30, ['unsigned short']], 'RangeAttributes' : [ 0x32, ['unsigned char']], 'RangeAvailableAttributes' : [ 0x33, ['unsigned char']], 'WorkSpace' : [ 0x34, ['unsigned long']], } ], '_PCI_HEADER_TYPE_0' : [ 0x30, { 'BaseAddresses' : [ 0x0, ['array', 6, ['unsigned long']]], 'CIS' : [ 0x18, ['unsigned long']], 'SubVendorID' : [ 0x1c, ['unsigned short']], 'SubSystemID' : [ 0x1e, ['unsigned short']], 'ROMBaseAddress' : [ 0x20, ['unsigned long']], 'CapabilitiesPtr' : [ 0x24, ['unsigned char']], 'Reserved1' : [ 0x25, ['array', 3, ['unsigned char']]], 'Reserved2' : [ 0x28, ['unsigned long']], 'InterruptLine' : [ 0x2c, ['unsigned char']], 'InterruptPin' : [ 0x2d, ['unsigned char']], 'MinimumGrant' : [ 0x2e, ['unsigned char']], 'MaximumLatency' : [ 0x2f, ['unsigned char']], } ], '_PO_DEVICE_NOTIFY_ORDER' : [ 0x248, { 'DevNodeSequence' : [ 0x0, ['unsigned long']], 'WarmEjectPdoPointer' : [ 0x4, ['pointer', ['pointer', ['_DEVICE_OBJECT']]]], 'OrderLevel' : [ 0x8, ['array', 8, ['_PO_NOTIFY_ORDER_LEVEL']]], } ], '_FS_FILTER_CALLBACKS' : [ 0x38, { 'SizeOfFsFilterCallbacks' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'PreAcquireForSectionSynchronization' : [ 0x8, ['pointer', ['void']]], 'PostAcquireForSectionSynchronization' : [ 0xc, ['pointer', ['void']]], 'PreReleaseForSectionSynchronization' : [ 0x10, ['pointer', ['void']]], 'PostReleaseForSectionSynchronization' : [ 0x14, ['pointer', ['void']]], 'PreAcquireForCcFlush' : [ 0x18, ['pointer', ['void']]], 'PostAcquireForCcFlush' : [ 0x1c, ['pointer', ['void']]], 'PreReleaseForCcFlush' : [ 0x20, ['pointer', ['void']]], 'PostReleaseForCcFlush' : [ 0x24, ['pointer', ['void']]], 'PreAcquireForModifiedPageWriter' : [ 0x28, ['pointer', ['void']]], 'PostAcquireForModifiedPageWriter' : [ 0x2c, ['pointer', ['void']]], 'PreReleaseForModifiedPageWriter' : [ 0x30, ['pointer', ['void']]], 'PostReleaseForModifiedPageWriter' : [ 0x34, ['pointer', ['void']]], } ], '_IA64_DBGKD_CONTROL_SET' : [ 0x14, { 'Continue' : [ 0x0, ['unsigned long']], 'CurrentSymbolStart' : [ 0x4, ['unsigned long long']], 'CurrentSymbolEnd' : [ 0xc, ['unsigned long long']], } ], '_PO_MEMORY_RANGE_ARRAY_RANGE' : [ 0x10, { 'PageNo' : [ 0x0, ['unsigned long']], 'StartPage' : [ 0x4, ['unsigned long']], 'EndPage' : [ 0x8, ['unsigned long']], 'CheckSum' : [ 0xc, ['unsigned long']], } ], '_u' : [ 0x50, { 'KeyNode' : [ 0x0, ['_CM_KEY_NODE']], 'KeyValue' : [ 0x0, ['_CM_KEY_VALUE']], 'KeySecurity' : [ 0x0, ['_CM_KEY_SECURITY']], 'KeyIndex' : [ 0x0, ['_CM_KEY_INDEX']], 'ValueData' : [ 0x0, ['_CM_BIG_DATA']], 'KeyList' : [ 0x0, ['array', 1, ['unsigned long']]], 'KeyString' : [ 0x0, ['array', 1, ['unsigned short']]], } ], '_ARBITER_CONFLICT_INFO' : [ 0x18, { 'OwningObject' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], 'Start' : [ 0x8, ['unsigned long long']], 'End' : [ 0x10, ['unsigned long long']], } ], '_PO_NOTIFY_ORDER_LEVEL' : [ 0x48, { 'LevelReady' : [ 0x0, ['_KEVENT']], 'DeviceCount' : [ 0x10, ['unsigned long']], 'ActiveCount' : [ 0x14, ['unsigned long']], 'WaitSleep' : [ 0x18, ['_LIST_ENTRY']], 'ReadySleep' : [ 0x20, ['_LIST_ENTRY']], 'Pending' : [ 0x28, ['_LIST_ENTRY']], 'Complete' : [ 0x30, ['_LIST_ENTRY']], 'ReadyS0' : [ 0x38, ['_LIST_ENTRY']], 'WaitS0' : [ 0x40, ['_LIST_ENTRY']], } ], '__unnamed_19a6' : [ 0x8, { 'Base' : [ 0x0, ['unsigned long']], 'Limit' : [ 0x4, ['unsigned long']], } ], '_PCI_HEADER_TYPE_2' : [ 0x30, { 'SocketRegistersBaseAddress' : [ 0x0, ['unsigned long']], 'CapabilitiesPtr' : [ 0x4, ['unsigned char']], 'Reserved' : [ 0x5, ['unsigned char']], 'SecondaryStatus' : [ 0x6, ['unsigned short']], 'PrimaryBus' : [ 0x8, ['unsigned char']], 'SecondaryBus' : [ 0x9, ['unsigned char']], 'SubordinateBus' : [ 0xa, ['unsigned char']], 'SecondaryLatency' : [ 0xb, ['unsigned char']], 'Range' : [ 0xc, ['array', 4, ['__unnamed_19a6']]], 'InterruptLine' : [ 0x2c, ['unsigned char']], 'InterruptPin' : [ 0x2d, ['unsigned char']], 'BridgeControl' : [ 0x2e, ['unsigned short']], } ], '_CM_KEY_VALUE' : [ 0x18, { 'Signature' : [ 0x0, ['unsigned short']], 'NameLength' : [ 0x2, ['unsigned short']], 'DataLength' : [ 0x4, ['unsigned long']], 'Data' : [ 0x8, ['unsigned long']], 'Type' : [ 0xc, ['unsigned long']], 'Flags' : [ 0x10, ['unsigned short']], 'Spare' : [ 0x12, ['unsigned short']], 'Name' : [ 0x14, ['array', 1, ['unsigned short']]], } ], '_AMD64_DBGKD_CONTROL_SET' : [ 0x1c, { 'TraceFlag' : [ 0x0, ['unsigned long']], 'Dr7' : [ 0x4, ['unsigned long long']], 'CurrentSymbolStart' : [ 0xc, ['unsigned long long']], 'CurrentSymbolEnd' : [ 0x14, ['unsigned long long']], } ], '_FS_FILTER_CALLBACK_DATA' : [ 0x24, { 'SizeOfFsFilterCallbackData' : [ 0x0, ['unsigned long']], 'Operation' : [ 0x4, ['unsigned char']], 'Reserved' : [ 0x5, ['unsigned char']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'FileObject' : [ 0xc, ['pointer', ['_FILE_OBJECT']]], 'Parameters' : [ 0x10, ['_FS_FILTER_PARAMETERS']], } ], '_PO_MEMORY_RANGE_ARRAY_LINK' : [ 0x10, { 'Next' : [ 0x0, ['pointer', ['_PO_MEMORY_RANGE_ARRAY']]], 'NextTable' : [ 0x4, ['unsigned long']], 'CheckSum' : [ 0x8, ['unsigned long']], 'EntryCount' : [ 0xc, ['unsigned long']], } ], '_FAST_IO_DISPATCH' : [ 0x70, { 'SizeOfFastIoDispatch' : [ 0x0, ['unsigned long']], 'FastIoCheckIfPossible' : [ 0x4, ['pointer', ['void']]], 'FastIoRead' : [ 0x8, ['pointer', ['void']]], 'FastIoWrite' : [ 0xc, ['pointer', ['void']]], 'FastIoQueryBasicInfo' : [ 0x10, ['pointer', ['void']]], 'FastIoQueryStandardInfo' : [ 0x14, ['pointer', ['void']]], 'FastIoLock' : [ 0x18, ['pointer', ['void']]], 'FastIoUnlockSingle' : [ 0x1c, ['pointer', ['void']]], 'FastIoUnlockAll' : [ 0x20, ['pointer', ['void']]], 'FastIoUnlockAllByKey' : [ 0x24, ['pointer', ['void']]], 'FastIoDeviceControl' : [ 0x28, ['pointer', ['void']]], 'AcquireFileForNtCreateSection' : [ 0x2c, ['pointer', ['void']]], 'ReleaseFileForNtCreateSection' : [ 0x30, ['pointer', ['void']]], 'FastIoDetachDevice' : [ 0x34, ['pointer', ['void']]], 'FastIoQueryNetworkOpenInfo' : [ 0x38, ['pointer', ['void']]], 'AcquireForModWrite' : [ 0x3c, ['pointer', ['void']]], 'MdlRead' : [ 0x40, ['pointer', ['void']]], 'MdlReadComplete' : [ 0x44, ['pointer', ['void']]], 'PrepareMdlWrite' : [ 0x48, ['pointer', ['void']]], 'MdlWriteComplete' : [ 0x4c, ['pointer', ['void']]], 'FastIoReadCompressed' : [ 0x50, ['pointer', ['void']]], 'FastIoWriteCompressed' : [ 0x54, ['pointer', ['void']]], 'MdlReadCompleteCompressed' : [ 0x58, ['pointer', ['void']]], 'MdlWriteCompleteCompressed' : [ 0x5c, ['pointer', ['void']]], 'FastIoQueryOpen' : [ 0x60, ['pointer', ['void']]], 'ReleaseForModWrite' : [ 0x64, ['pointer', ['void']]], 'AcquireForCcFlush' : [ 0x68, ['pointer', ['void']]], 'ReleaseForCcFlush' : [ 0x6c, ['pointer', ['void']]], } ], '_OBJECT_DIRECTORY_ENTRY' : [ 0x8, { 'ChainLink' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY_ENTRY']]], 'Object' : [ 0x4, ['pointer', ['void']]], } ], '_POP_DEVICE_POWER_IRP' : [ 0x2c, { 'Free' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Irp' : [ 0x4, ['pointer', ['_IRP']]], 'Notify' : [ 0x8, ['pointer', ['_PO_DEVICE_NOTIFY']]], 'Pending' : [ 0xc, ['_LIST_ENTRY']], 'Complete' : [ 0x14, ['_LIST_ENTRY']], 'Abort' : [ 0x1c, ['_LIST_ENTRY']], 'Failed' : [ 0x24, ['_LIST_ENTRY']], } ], '_FILE_BASIC_INFORMATION' : [ 0x28, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LastAccessTime' : [ 0x8, ['_LARGE_INTEGER']], 'LastWriteTime' : [ 0x10, ['_LARGE_INTEGER']], 'ChangeTime' : [ 0x18, ['_LARGE_INTEGER']], 'FileAttributes' : [ 0x20, ['unsigned long']], } ], '_RTL_RANGE' : [ 0x20, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'UserData' : [ 0x10, ['pointer', ['void']]], 'Owner' : [ 0x14, ['pointer', ['void']]], 'Attributes' : [ 0x18, ['unsigned char']], 'Flags' : [ 0x19, ['unsigned char']], } ], '_PCI_HEADER_TYPE_1' : [ 0x30, { 'BaseAddresses' : [ 0x0, ['array', 2, ['unsigned long']]], 'PrimaryBus' : [ 0x8, ['unsigned char']], 'SecondaryBus' : [ 0x9, ['unsigned char']], 'SubordinateBus' : [ 0xa, ['unsigned char']], 'SecondaryLatency' : [ 0xb, ['unsigned char']], 'IOBase' : [ 0xc, ['unsigned char']], 'IOLimit' : [ 0xd, ['unsigned char']], 'SecondaryStatus' : [ 0xe, ['unsigned short']], 'MemoryBase' : [ 0x10, ['unsigned short']], 'MemoryLimit' : [ 0x12, ['unsigned short']], 'PrefetchBase' : [ 0x14, ['unsigned short']], 'PrefetchLimit' : [ 0x16, ['unsigned short']], 'PrefetchBaseUpper32' : [ 0x18, ['unsigned long']], 'PrefetchLimitUpper32' : [ 0x1c, ['unsigned long']], 'IOBaseUpper16' : [ 0x20, ['unsigned short']], 'IOLimitUpper16' : [ 0x22, ['unsigned short']], 'CapabilitiesPtr' : [ 0x24, ['unsigned char']], 'Reserved1' : [ 0x25, ['array', 3, ['unsigned char']]], 'ROMBaseAddress' : [ 0x28, ['unsigned long']], 'InterruptLine' : [ 0x2c, ['unsigned char']], 'InterruptPin' : [ 0x2d, ['unsigned char']], 'BridgeControl' : [ 0x2e, ['unsigned short']], } ], '_PRIVILEGE_SET' : [ 0x14, { 'PrivilegeCount' : [ 0x0, ['unsigned long']], 'Control' : [ 0x4, ['unsigned long']], 'Privilege' : [ 0x8, ['array', 1, ['_LUID_AND_ATTRIBUTES']]], } ], '_SECURITY_CLIENT_CONTEXT' : [ 0x3c, { 'SecurityQos' : [ 0x0, ['_SECURITY_QUALITY_OF_SERVICE']], 'ClientToken' : [ 0xc, ['pointer', ['void']]], 'DirectlyAccessClientToken' : [ 0x10, ['unsigned char']], 'DirectAccessEffectiveOnly' : [ 0x11, ['unsigned char']], 'ServerIsRemote' : [ 0x12, ['unsigned char']], 'ClientTokenControl' : [ 0x14, ['_TOKEN_CONTROL']], } ], '_IO_SECURITY_CONTEXT' : [ 0x10, { 'SecurityQos' : [ 0x0, ['pointer', ['_SECURITY_QUALITY_OF_SERVICE']]], 'AccessState' : [ 0x4, ['pointer', ['_ACCESS_STATE']]], 'DesiredAccess' : [ 0x8, ['unsigned long']], 'FullCreateOptions' : [ 0xc, ['unsigned long']], } ], '_KSPECIAL_REGISTERS' : [ 0x54, { 'Cr0' : [ 0x0, ['unsigned long']], 'Cr2' : [ 0x4, ['unsigned long']], 'Cr3' : [ 0x8, ['unsigned long']], 'Cr4' : [ 0xc, ['unsigned long']], 'KernelDr0' : [ 0x10, ['unsigned long']], 'KernelDr1' : [ 0x14, ['unsigned long']], 'KernelDr2' : [ 0x18, ['unsigned long']], 'KernelDr3' : [ 0x1c, ['unsigned long']], 'KernelDr6' : [ 0x20, ['unsigned long']], 'KernelDr7' : [ 0x24, ['unsigned long']], 'Gdtr' : [ 0x28, ['_DESCRIPTOR']], 'Idtr' : [ 0x30, ['_DESCRIPTOR']], 'Tr' : [ 0x38, ['unsigned short']], 'Ldtr' : [ 0x3a, ['unsigned short']], 'Reserved' : [ 0x3c, ['array', 6, ['unsigned long']]], } ], '_RTL_ACTIVATION_CONTEXT_STACK_FRAME' : [ 0xc, { 'Previous' : [ 0x0, ['pointer', ['_RTL_ACTIVATION_CONTEXT_STACK_FRAME']]], 'ActivationContext' : [ 0x4, ['pointer', ['_ACTIVATION_CONTEXT']]], 'Flags' : [ 0x8, ['unsigned long']], } ], '_MAILSLOT_CREATE_PARAMETERS' : [ 0x18, { 'MailslotQuota' : [ 0x0, ['unsigned long']], 'MaximumMessageSize' : [ 0x4, ['unsigned long']], 'ReadTimeout' : [ 0x8, ['_LARGE_INTEGER']], 'TimeoutSpecified' : [ 0x10, ['unsigned char']], } ], '_NAMED_PIPE_CREATE_PARAMETERS' : [ 0x28, { 'NamedPipeType' : [ 0x0, ['unsigned long']], 'ReadMode' : [ 0x4, ['unsigned long']], 'CompletionMode' : [ 0x8, ['unsigned long']], 'MaximumInstances' : [ 0xc, ['unsigned long']], 'InboundQuota' : [ 0x10, ['unsigned long']], 'OutboundQuota' : [ 0x14, ['unsigned long']], 'DefaultTimeout' : [ 0x18, ['_LARGE_INTEGER']], 'TimeoutSpecified' : [ 0x20, ['unsigned char']], } ], '_CM_BIG_DATA' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned short']], 'Count' : [ 0x2, ['unsigned short']], 'List' : [ 0x4, ['unsigned long']], } ], '_SUPPORTED_RANGE' : [ 0x20, { 'Next' : [ 0x0, ['pointer', ['_SUPPORTED_RANGE']]], 'SystemAddressSpace' : [ 0x4, ['unsigned long']], 'SystemBase' : [ 0x8, ['long long']], 'Base' : [ 0x10, ['long long']], 'Limit' : [ 0x18, ['long long']], } ], '_CM_KEY_NODE' : [ 0x50, { 'Signature' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'LastWriteTime' : [ 0x4, ['_LARGE_INTEGER']], 'Spare' : [ 0xc, ['unsigned long']], 'Parent' : [ 0x10, ['unsigned long']], 'SubKeyCounts' : [ 0x14, ['array', 2, ['unsigned long']]], 'SubKeyLists' : [ 0x1c, ['array', 2, ['unsigned long']]], 'ValueList' : [ 0x24, ['_CHILD_LIST']], 'ChildHiveReference' : [ 0x1c, ['_CM_KEY_REFERENCE']], 'Security' : [ 0x2c, ['unsigned long']], 'Class' : [ 0x30, ['unsigned long']], 'MaxNameLen' : [ 0x34, ['unsigned long']], 'MaxClassLen' : [ 0x38, ['unsigned long']], 'MaxValueNameLen' : [ 0x3c, ['unsigned long']], 'MaxValueDataLen' : [ 0x40, ['unsigned long']], 'WorkVar' : [ 0x44, ['unsigned long']], 'NameLength' : [ 0x48, ['unsigned short']], 'ClassLength' : [ 0x4a, ['unsigned short']], 'Name' : [ 0x4c, ['array', 1, ['unsigned short']]], } ], '_ARBITER_ORDERING' : [ 0x10, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], } ], '_ARBITER_LIST_ENTRY' : [ 0x38, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'AlternativeCount' : [ 0x8, ['unsigned long']], 'Alternatives' : [ 0xc, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'PhysicalDeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'RequestSource' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'ArbiterRequestLegacyReported', 1: 'ArbiterRequestHalReported', 2: 'ArbiterRequestLegacyAssigned', 3: 'ArbiterRequestPnpDetected', 4: 'ArbiterRequestPnpEnumerated', -1: 'ArbiterRequestUndefined'})]], 'Flags' : [ 0x18, ['unsigned long']], 'WorkSpace' : [ 0x1c, ['long']], 'InterfaceType' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'SlotNumber' : [ 0x24, ['unsigned long']], 'BusNumber' : [ 0x28, ['unsigned long']], 'Assignment' : [ 0x2c, ['pointer', ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], 'SelectedAlternative' : [ 0x30, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'Result' : [ 0x34, ['Enumeration', dict(target = 'long', choices = {0: 'ArbiterResultSuccess', 1: 'ArbiterResultExternalConflict', 2: 'ArbiterResultNullRequest', -1: 'ArbiterResultUndefined'})]], } ], '_LPCP_NONPAGED_PORT_QUEUE' : [ 0x18, { 'Semaphore' : [ 0x0, ['_KSEMAPHORE']], 'BackPointer' : [ 0x14, ['pointer', ['_LPCP_PORT_OBJECT']]], } ], '_CM_KEY_INDEX' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned short']], 'Count' : [ 0x2, ['unsigned short']], 'List' : [ 0x4, ['array', 1, ['unsigned long']]], } ], '_FILE_NETWORK_OPEN_INFORMATION' : [ 0x38, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LastAccessTime' : [ 0x8, ['_LARGE_INTEGER']], 'LastWriteTime' : [ 0x10, ['_LARGE_INTEGER']], 'ChangeTime' : [ 0x18, ['_LARGE_INTEGER']], 'AllocationSize' : [ 0x20, ['_LARGE_INTEGER']], 'EndOfFile' : [ 0x28, ['_LARGE_INTEGER']], 'FileAttributes' : [ 0x30, ['unsigned long']], } ], '_CM_KEY_REFERENCE' : [ 0x8, { 'KeyCell' : [ 0x0, ['unsigned long']], 'KeyHive' : [ 0x4, ['pointer', ['_HHIVE']]], } ], '_ARBITER_ALTERNATIVE' : [ 0x30, { 'Minimum' : [ 0x0, ['unsigned long long']], 'Maximum' : [ 0x8, ['unsigned long long']], 'Length' : [ 0x10, ['unsigned long']], 'Alignment' : [ 0x14, ['unsigned long']], 'Priority' : [ 0x18, ['long']], 'Flags' : [ 0x1c, ['unsigned long']], 'Descriptor' : [ 0x20, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'Reserved' : [ 0x24, ['array', 3, ['unsigned long']]], } ], '_TOKEN_CONTROL' : [ 0x28, { 'TokenId' : [ 0x0, ['_LUID']], 'AuthenticationId' : [ 0x8, ['_LUID']], 'ModifiedId' : [ 0x10, ['_LUID']], 'TokenSource' : [ 0x18, ['_TOKEN_SOURCE']], } ], '__unnamed_1a34' : [ 0x8, { 'EndingOffset' : [ 0x0, ['pointer', ['_LARGE_INTEGER']]], 'ResourceToRelease' : [ 0x4, ['pointer', ['pointer', ['_ERESOURCE']]]], } ], '__unnamed_1a36' : [ 0x4, { 'ResourceToRelease' : [ 0x0, ['pointer', ['_ERESOURCE']]], } ], '__unnamed_1a3a' : [ 0x8, { 'SyncType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'SyncTypeOther', 1: 'SyncTypeCreateSection'})]], 'PageProtection' : [ 0x4, ['unsigned long']], } ], '__unnamed_1a3c' : [ 0x14, { 'Argument1' : [ 0x0, ['pointer', ['void']]], 'Argument2' : [ 0x4, ['pointer', ['void']]], 'Argument3' : [ 0x8, ['pointer', ['void']]], 'Argument4' : [ 0xc, ['pointer', ['void']]], 'Argument5' : [ 0x10, ['pointer', ['void']]], } ], '_FS_FILTER_PARAMETERS' : [ 0x14, { 'AcquireForModifiedPageWriter' : [ 0x0, ['__unnamed_1a34']], 'ReleaseForModifiedPageWriter' : [ 0x0, ['__unnamed_1a36']], 'AcquireForSectionSynchronization' : [ 0x0, ['__unnamed_1a3a']], 'Others' : [ 0x0, ['__unnamed_1a3c']], } ], '_COMPRESSED_DATA_INFO' : [ 0xc, { 'CompressionFormatAndEngine' : [ 0x0, ['unsigned short']], 'CompressionUnitShift' : [ 0x2, ['unsigned char']], 'ChunkShift' : [ 0x3, ['unsigned char']], 'ClusterShift' : [ 0x4, ['unsigned char']], 'Reserved' : [ 0x5, ['unsigned char']], 'NumberOfChunks' : [ 0x6, ['unsigned short']], 'CompressedChunkSizes' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '_FILE_STANDARD_INFORMATION' : [ 0x18, { 'AllocationSize' : [ 0x0, ['_LARGE_INTEGER']], 'EndOfFile' : [ 0x8, ['_LARGE_INTEGER']], 'NumberOfLinks' : [ 0x10, ['unsigned long']], 'DeletePending' : [ 0x14, ['unsigned char']], 'Directory' : [ 0x15, ['unsigned char']], } ], '_DESCRIPTOR' : [ 0x8, { 'Pad' : [ 0x0, ['unsigned short']], 'Limit' : [ 0x2, ['unsigned short']], 'Base' : [ 0x4, ['unsigned long']], } ], '_CHILD_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'List' : [ 0x4, ['unsigned long']], } ], '_CM_KEY_SECURITY' : [ 0x28, { 'Signature' : [ 0x0, ['unsigned short']], 'Reserved' : [ 0x2, ['unsigned short']], 'Flink' : [ 0x4, ['unsigned long']], 'Blink' : [ 0x8, ['unsigned long']], 'ReferenceCount' : [ 0xc, ['unsigned long']], 'DescriptorLength' : [ 0x10, ['unsigned long']], 'Descriptor' : [ 0x14, ['_SECURITY_DESCRIPTOR_RELATIVE']], } ], }
gpl-2.0
[ 343, 16779, 7530, 311, 63, 1313, 275, 469, 523, 283, 4924, 63, 7285, 772, 7, 520, 359, 378, 88, 709, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 1846, 2157, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 24, 12, 788, 2244, 1846, 1846, 2157, 199, 93, 2156, 523, 283, 4924, 63, 7285, 708, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 199, 93, 2156, 523, 2560, 9703, 63, 1960, 65, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 199, 93, 2156, 523, 2513, 3038, 4962, 63, 9596, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 272, 283, 85, 7, 520, 359, 378, 88, 16, 12, 14050, 9703, 63, 1960, 65, 2157, 272, 283, 23053, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 1846, 2157, 199, 93, 2156, 523, 2513, 4924, 63, 7285, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 3929, 297, 4044, 4924, 63, 7285, 4397, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 20, 12, 788, 3929, 297, 4044, 4924, 63, 7285, 4397, 199, 93, 2156, 523, 2513, 9438, 63, 12460, 63, 21178, 7, 520, 359, 378, 1949, 24, 12, 469, 272, 283, 10014, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 1173, 2567, 7, 520, 359, 378, 88, 20, 12, 4044, 9438, 63, 3817, 63, 7311, 2157, 272, 283, 7012, 2567, 7, 520, 359, 378, 88, 1085, 12, 4044, 9438, 63, 21008, 63, 7311, 2157, 199, 93, 2156, 523, 2560, 9703, 63, 4893, 66, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 199, 93, 2156, 523, 2513, 15806, 63, 9596, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 272, 283, 85, 7, 520, 359, 378, 88, 16, 12, 14050, 9703, 63, 4893, 66, 2157, 272, 283, 23053, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2809, 1846, 2157, 199, 93, 2156, 523, 2513, 44, 6685, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 199, 93, 2156, 523, 2513, 43, 3311, 9956, 7, 520, 359, 378, 11110, 16, 12, 469, 272, 283, 23094, 3353, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 3974, 2157, 272, 283, 21657, 3353, 7, 520, 359, 378, 88, 18, 12, 788, 2244, 3974, 2157, 272, 283, 5639, 4436, 7, 520, 359, 378, 88, 20, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 5765, 4436, 7, 520, 359, 378, 88, 24, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 21068, 4436, 7, 520, 359, 378, 1812, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 3259, 7, 520, 359, 378, 88, 709, 12, 788, 2244, 1495, 2157, 272, 283, 10285, 7, 520, 359, 378, 88, 845, 12, 788, 2244, 1495, 2157, 272, 283, 3425, 804, 7, 520, 359, 378, 88, 713, 12, 788, 2244, 3974, 2157, 272, 283, 1084, 7021, 7, 520, 359, 378, 88, 1079, 12, 788, 2244, 1846, 2157, 272, 283, 23214, 804, 7, 520, 359, 378, 88, 1085, 12, 788, 2244, 1495, 2157, 272, 283, 23214, 998, 7, 520, 359, 378, 88, 1167, 12, 788, 2244, 1495, 2157, 272, 283, 23214, 7801, 7, 520, 359, 378, 88, 17, 65, 12, 788, 2244, 3974, 2157, 272, 283, 10438, 2223, 7, 520, 359, 378, 88, 17, 67, 12, 4044, 43, 24341, 63, 6689, 2157, 272, 283, 14127, 10285, 7, 520, 359, 378, 88, 1153, 67, 12, 788, 1144, 297, 3193, 12, 788, 2244, 1846, 4397, 272, 283, 40, 279, 10285, 7, 520, 359, 378, 88, 1401, 67, 12, 788, 1144, 297, 3193, 12, 788, 2244, 1846, 4397, 272, 283, 48, 1195, 66, 18584, 16, 7, 520, 359, 378, 88, 19, 3776, 12, 788, 1144, 297, 20140, 12, 788, 2244, 1495, 4397, 272, 283, 6432, 3737, 7, 520, 359, 378, 88, 24456, 12, 788, 1144, 297, 3193, 12, 4044, 43, 5763, 568, 63, 4406, 63, 15125, 4397, 272, 283, 48, 1195, 66, 18584, 17, 7, 520, 359, 378, 88, 20537, 12, 788, 1144, 297, 1695, 12, 788, 2244, 1495, 4397, 272, 283, 46, 5326, 4436, 7, 520, 359, 378, 88, 20, 65, 16, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 10647, 2353, 7, 520, 359, 378, 88, 20, 65, 20, 12, 788, 2244, 1846, 2157, 272, 283, 14127, 1366, 7, 520, 359, 378, 88, 20, 65, 24, 12, 788, 2244, 1846, 2157, 272, 283, 1899, 1366, 7, 520, 359, 378, 88, 20, 645, 12, 788, 2244, 1846, 2157, 272, 283, 36, 2352, 1366, 7, 520, 359, 378, 88, 20, 66, 16, 12, 788, 2244, 1846, 2157, 272, 283, 7084, 36, 2352, 1366, 7, 520, 359, 378, 88, 20, 66, 20, 12, 788, 2244, 1846, 2157, 272, 283, 10647, 1366, 7, 520, 359, 378, 88, 20, 66, 24, 12, 788, 2244, 1846, 2157, 272, 283, 17977, 36, 2352, 12109, 7, 520, 359, 378, 88, 20, 3776, 12, 788, 2244, 1846, 2157, 272, 283, 3276, 4117, 7, 520, 359, 378, 88, 20, 67, 16, 12, 788, 2244, 1846, 2157, 272, 283, 7738, 11763, 7, 520, 359, 378, 88, 20, 67, 20, 12 ]
[ 16779, 7530, 311, 63, 1313, 275, 469, 523, 283, 4924, 63, 7285, 772, 7, 520, 359, 378, 88, 709, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 1846, 2157, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 24, 12, 788, 2244, 1846, 1846, 2157, 199, 93, 2156, 523, 283, 4924, 63, 7285, 708, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 199, 93, 2156, 523, 2560, 9703, 63, 1960, 65, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 199, 93, 2156, 523, 2513, 3038, 4962, 63, 9596, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2244, 1846, 2157, 272, 283, 85, 7, 520, 359, 378, 88, 16, 12, 14050, 9703, 63, 1960, 65, 2157, 272, 283, 23053, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 1846, 2157, 199, 93, 2156, 523, 2513, 4924, 63, 7285, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 38, 1073, 7, 520, 359, 378, 88, 16, 12, 788, 3929, 297, 4044, 4924, 63, 7285, 4397, 272, 283, 34, 1073, 7, 520, 359, 378, 88, 20, 12, 788, 3929, 297, 4044, 4924, 63, 7285, 4397, 199, 93, 2156, 523, 2513, 9438, 63, 12460, 63, 21178, 7, 520, 359, 378, 1949, 24, 12, 469, 272, 283, 10014, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 1173, 2567, 7, 520, 359, 378, 88, 20, 12, 4044, 9438, 63, 3817, 63, 7311, 2157, 272, 283, 7012, 2567, 7, 520, 359, 378, 88, 1085, 12, 4044, 9438, 63, 21008, 63, 7311, 2157, 199, 93, 2156, 523, 2560, 9703, 63, 4893, 66, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 199, 93, 2156, 523, 2513, 15806, 63, 9596, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 272, 283, 85, 7, 520, 359, 378, 88, 16, 12, 14050, 9703, 63, 4893, 66, 2157, 272, 283, 23053, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2809, 1846, 2157, 199, 93, 2156, 523, 2513, 44, 6685, 7, 520, 359, 378, 88, 24, 12, 469, 272, 283, 10281, 8416, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 1846, 2157, 272, 283, 11688, 8416, 7, 520, 359, 378, 88, 20, 12, 788, 2809, 2157, 199, 93, 2156, 523, 2513, 43, 3311, 9956, 7, 520, 359, 378, 11110, 16, 12, 469, 272, 283, 23094, 3353, 7, 520, 359, 378, 88, 16, 12, 788, 2244, 3974, 2157, 272, 283, 21657, 3353, 7, 520, 359, 378, 88, 18, 12, 788, 2244, 3974, 2157, 272, 283, 5639, 4436, 7, 520, 359, 378, 88, 20, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 5765, 4436, 7, 520, 359, 378, 88, 24, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 21068, 4436, 7, 520, 359, 378, 1812, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 3259, 7, 520, 359, 378, 88, 709, 12, 788, 2244, 1495, 2157, 272, 283, 10285, 7, 520, 359, 378, 88, 845, 12, 788, 2244, 1495, 2157, 272, 283, 3425, 804, 7, 520, 359, 378, 88, 713, 12, 788, 2244, 3974, 2157, 272, 283, 1084, 7021, 7, 520, 359, 378, 88, 1079, 12, 788, 2244, 1846, 2157, 272, 283, 23214, 804, 7, 520, 359, 378, 88, 1085, 12, 788, 2244, 1495, 2157, 272, 283, 23214, 998, 7, 520, 359, 378, 88, 1167, 12, 788, 2244, 1495, 2157, 272, 283, 23214, 7801, 7, 520, 359, 378, 88, 17, 65, 12, 788, 2244, 3974, 2157, 272, 283, 10438, 2223, 7, 520, 359, 378, 88, 17, 67, 12, 4044, 43, 24341, 63, 6689, 2157, 272, 283, 14127, 10285, 7, 520, 359, 378, 88, 1153, 67, 12, 788, 1144, 297, 3193, 12, 788, 2244, 1846, 4397, 272, 283, 40, 279, 10285, 7, 520, 359, 378, 88, 1401, 67, 12, 788, 1144, 297, 3193, 12, 788, 2244, 1846, 4397, 272, 283, 48, 1195, 66, 18584, 16, 7, 520, 359, 378, 88, 19, 3776, 12, 788, 1144, 297, 20140, 12, 788, 2244, 1495, 4397, 272, 283, 6432, 3737, 7, 520, 359, 378, 88, 24456, 12, 788, 1144, 297, 3193, 12, 4044, 43, 5763, 568, 63, 4406, 63, 15125, 4397, 272, 283, 48, 1195, 66, 18584, 17, 7, 520, 359, 378, 88, 20537, 12, 788, 1144, 297, 1695, 12, 788, 2244, 1495, 4397, 272, 283, 46, 5326, 4436, 7, 520, 359, 378, 88, 20, 65, 16, 12, 788, 3929, 297, 4044, 43, 16103, 4397, 272, 283, 10647, 2353, 7, 520, 359, 378, 88, 20, 65, 20, 12, 788, 2244, 1846, 2157, 272, 283, 14127, 1366, 7, 520, 359, 378, 88, 20, 65, 24, 12, 788, 2244, 1846, 2157, 272, 283, 1899, 1366, 7, 520, 359, 378, 88, 20, 645, 12, 788, 2244, 1846, 2157, 272, 283, 36, 2352, 1366, 7, 520, 359, 378, 88, 20, 66, 16, 12, 788, 2244, 1846, 2157, 272, 283, 7084, 36, 2352, 1366, 7, 520, 359, 378, 88, 20, 66, 20, 12, 788, 2244, 1846, 2157, 272, 283, 10647, 1366, 7, 520, 359, 378, 88, 20, 66, 24, 12, 788, 2244, 1846, 2157, 272, 283, 17977, 36, 2352, 12109, 7, 520, 359, 378, 88, 20, 3776, 12, 788, 2244, 1846, 2157, 272, 283, 3276, 4117, 7, 520, 359, 378, 88, 20, 67, 16, 12, 788, 2244, 1846, 2157, 272, 283, 7738, 11763, 7, 520, 359, 378, 88, 20, 67, 20, 12, 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,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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 ]
keen99/SickRage
lib/unidecode/x07c.py
252
4663
data = ( 'Ze ', # 0x00 'Xi ', # 0x01 'Guo ', # 0x02 'Yi ', # 0x03 'Hu ', # 0x04 'Chan ', # 0x05 'Kou ', # 0x06 'Cu ', # 0x07 'Ping ', # 0x08 'Chou ', # 0x09 'Ji ', # 0x0a 'Gui ', # 0x0b 'Su ', # 0x0c 'Lou ', # 0x0d 'Zha ', # 0x0e 'Lu ', # 0x0f 'Nian ', # 0x10 'Suo ', # 0x11 'Cuan ', # 0x12 'Sasara ', # 0x13 'Suo ', # 0x14 'Le ', # 0x15 'Duan ', # 0x16 'Yana ', # 0x17 'Xiao ', # 0x18 'Bo ', # 0x19 'Mi ', # 0x1a 'Si ', # 0x1b 'Dang ', # 0x1c 'Liao ', # 0x1d 'Dan ', # 0x1e 'Dian ', # 0x1f 'Fu ', # 0x20 'Jian ', # 0x21 'Min ', # 0x22 'Kui ', # 0x23 'Dai ', # 0x24 'Qiao ', # 0x25 'Deng ', # 0x26 'Huang ', # 0x27 'Sun ', # 0x28 'Lao ', # 0x29 'Zan ', # 0x2a 'Xiao ', # 0x2b 'Du ', # 0x2c 'Shi ', # 0x2d 'Zan ', # 0x2e '[?] ', # 0x2f 'Pai ', # 0x30 'Hata ', # 0x31 'Pai ', # 0x32 'Gan ', # 0x33 'Ju ', # 0x34 'Du ', # 0x35 'Lu ', # 0x36 'Yan ', # 0x37 'Bo ', # 0x38 'Dang ', # 0x39 'Sai ', # 0x3a 'Ke ', # 0x3b 'Long ', # 0x3c 'Qian ', # 0x3d 'Lian ', # 0x3e 'Bo ', # 0x3f 'Zhou ', # 0x40 'Lai ', # 0x41 '[?] ', # 0x42 'Lan ', # 0x43 'Kui ', # 0x44 'Yu ', # 0x45 'Yue ', # 0x46 'Hao ', # 0x47 'Zhen ', # 0x48 'Tai ', # 0x49 'Ti ', # 0x4a 'Mi ', # 0x4b 'Chou ', # 0x4c 'Ji ', # 0x4d '[?] ', # 0x4e 'Hata ', # 0x4f 'Teng ', # 0x50 'Zhuan ', # 0x51 'Zhou ', # 0x52 'Fan ', # 0x53 'Sou ', # 0x54 'Zhou ', # 0x55 'Kuji ', # 0x56 'Zhuo ', # 0x57 'Teng ', # 0x58 'Lu ', # 0x59 'Lu ', # 0x5a 'Jian ', # 0x5b 'Tuo ', # 0x5c 'Ying ', # 0x5d 'Yu ', # 0x5e 'Lai ', # 0x5f 'Long ', # 0x60 'Shinshi ', # 0x61 'Lian ', # 0x62 'Lan ', # 0x63 'Qian ', # 0x64 'Yue ', # 0x65 'Zhong ', # 0x66 'Qu ', # 0x67 'Lian ', # 0x68 'Bian ', # 0x69 'Duan ', # 0x6a 'Zuan ', # 0x6b 'Li ', # 0x6c 'Si ', # 0x6d 'Luo ', # 0x6e 'Ying ', # 0x6f 'Yue ', # 0x70 'Zhuo ', # 0x71 'Xu ', # 0x72 'Mi ', # 0x73 'Di ', # 0x74 'Fan ', # 0x75 'Shen ', # 0x76 'Zhe ', # 0x77 'Shen ', # 0x78 'Nu ', # 0x79 'Xie ', # 0x7a 'Lei ', # 0x7b 'Xian ', # 0x7c 'Zi ', # 0x7d 'Ni ', # 0x7e 'Cun ', # 0x7f '[?] ', # 0x80 'Qian ', # 0x81 'Kume ', # 0x82 'Bi ', # 0x83 'Ban ', # 0x84 'Wu ', # 0x85 'Sha ', # 0x86 'Kang ', # 0x87 'Rou ', # 0x88 'Fen ', # 0x89 'Bi ', # 0x8a 'Cui ', # 0x8b '[?] ', # 0x8c 'Li ', # 0x8d 'Chi ', # 0x8e 'Nukamiso ', # 0x8f 'Ro ', # 0x90 'Ba ', # 0x91 'Li ', # 0x92 'Gan ', # 0x93 'Ju ', # 0x94 'Po ', # 0x95 'Mo ', # 0x96 'Cu ', # 0x97 'Nian ', # 0x98 'Zhou ', # 0x99 'Li ', # 0x9a 'Su ', # 0x9b 'Tiao ', # 0x9c 'Li ', # 0x9d 'Qi ', # 0x9e 'Su ', # 0x9f 'Hong ', # 0xa0 'Tong ', # 0xa1 'Zi ', # 0xa2 'Ce ', # 0xa3 'Yue ', # 0xa4 'Zhou ', # 0xa5 'Lin ', # 0xa6 'Zhuang ', # 0xa7 'Bai ', # 0xa8 '[?] ', # 0xa9 'Fen ', # 0xaa 'Ji ', # 0xab '[?] ', # 0xac 'Sukumo ', # 0xad 'Liang ', # 0xae 'Xian ', # 0xaf 'Fu ', # 0xb0 'Liang ', # 0xb1 'Can ', # 0xb2 'Geng ', # 0xb3 'Li ', # 0xb4 'Yue ', # 0xb5 'Lu ', # 0xb6 'Ju ', # 0xb7 'Qi ', # 0xb8 'Cui ', # 0xb9 'Bai ', # 0xba 'Zhang ', # 0xbb 'Lin ', # 0xbc 'Zong ', # 0xbd 'Jing ', # 0xbe 'Guo ', # 0xbf 'Kouji ', # 0xc0 'San ', # 0xc1 'San ', # 0xc2 'Tang ', # 0xc3 'Bian ', # 0xc4 'Rou ', # 0xc5 'Mian ', # 0xc6 'Hou ', # 0xc7 'Xu ', # 0xc8 'Zong ', # 0xc9 'Hu ', # 0xca 'Jian ', # 0xcb 'Zan ', # 0xcc 'Ci ', # 0xcd 'Li ', # 0xce 'Xie ', # 0xcf 'Fu ', # 0xd0 'Ni ', # 0xd1 'Bei ', # 0xd2 'Gu ', # 0xd3 'Xiu ', # 0xd4 'Gao ', # 0xd5 'Tang ', # 0xd6 'Qiu ', # 0xd7 'Sukumo ', # 0xd8 'Cao ', # 0xd9 'Zhuang ', # 0xda 'Tang ', # 0xdb 'Mi ', # 0xdc 'San ', # 0xdd 'Fen ', # 0xde 'Zao ', # 0xdf 'Kang ', # 0xe0 'Jiang ', # 0xe1 'Mo ', # 0xe2 'San ', # 0xe3 'San ', # 0xe4 'Nuo ', # 0xe5 'Xi ', # 0xe6 'Liang ', # 0xe7 'Jiang ', # 0xe8 'Kuai ', # 0xe9 'Bo ', # 0xea 'Huan ', # 0xeb '[?] ', # 0xec 'Zong ', # 0xed 'Xian ', # 0xee 'Nuo ', # 0xef 'Tuan ', # 0xf0 'Nie ', # 0xf1 'Li ', # 0xf2 'Zuo ', # 0xf3 'Di ', # 0xf4 'Nie ', # 0xf5 'Tiao ', # 0xf6 'Lan ', # 0xf7 'Mi ', # 0xf8 'Jiao ', # 0xf9 'Jiu ', # 0xfa 'Xi ', # 0xfb 'Gong ', # 0xfc 'Zheng ', # 0xfd 'Jiu ', # 0xfe 'You ', # 0xff )
gpl-3.0
[ 576, 275, 334, 199, 7, 58, 69, 1656, 259, 327, 378, 88, 383, 199, 7, 14828, 1656, 259, 327, 378, 88, 614, 199, 7, 11548, 79, 1656, 259, 327, 378, 88, 996, 199, 7, 21001, 1656, 259, 327, 378, 88, 1644, 199, 7, 25542, 1656, 259, 327, 378, 88, 966, 199, 7, 27039, 1656, 259, 327, 378, 88, 1717, 199, 7, 43, 810, 1656, 259, 327, 378, 88, 1690, 199, 7, 35, 85, 1656, 259, 327, 378, 88, 1780, 199, 7, 22638, 1656, 259, 327, 378, 88, 2036, 199, 7, 6209, 85, 1656, 259, 327, 378, 88, 1643, 199, 7, 16911, 1656, 259, 327, 378, 88, 16, 65, 199, 7, 4324, 1656, 259, 327, 378, 88, 16, 66, 199, 7, 27032, 1656, 259, 327, 378, 88, 16, 67, 199, 7, 44, 810, 1656, 259, 327, 378, 88, 16, 68, 199, 7, 58, 2411, 1656, 259, 327, 378, 88, 16, 69, 199, 7, 18176, 1656, 259, 327, 378, 88, 16, 70, 199, 7, 46, 5653, 1656, 259, 327, 378, 88, 709, 199, 7, 51, 13780, 1656, 259, 327, 378, 88, 845, 199, 7, 35, 7856, 1656, 259, 327, 378, 88, 713, 199, 7, 51, 305, 17956, 1656, 259, 327, 378, 88, 969, 199, 7, 51, 13780, 1656, 259, 327, 378, 88, 1079, 199, 7, 2553, 1656, 259, 327, 378, 88, 1046, 199, 7, 36, 7856, 1656, 259, 327, 378, 88, 975, 199, 7, 57, 6738, 1656, 259, 327, 378, 88, 1196, 199, 7, 56, 18939, 1656, 259, 327, 378, 88, 1085, 199, 7, 2208, 1656, 259, 327, 378, 88, 1167, 199, 7, 14738, 1656, 259, 327, 378, 88, 17, 65, 199, 7, 18934, 1656, 259, 327, 378, 88, 17, 66, 199, 7, 36, 621, 1656, 259, 327, 378, 88, 17, 67, 199, 7, 44, 18939, 1656, 259, 327, 378, 88, 17, 68, 199, 7, 29336, 1656, 259, 327, 378, 88, 17, 69, 199, 7, 1341, 290, 1656, 259, 327, 378, 88, 17, 70, 199, 7, 19590, 1656, 259, 327, 378, 88, 1165, 199, 7, 42, 5653, 1656, 259, 327, 378, 88, 2025, 199, 7, 4649, 1656, 259, 327, 378, 88, 1081, 199, 7, 43, 1907, 1656, 259, 327, 378, 88, 1789, 199, 7, 36, 5789, 1656, 259, 327, 378, 88, 1194, 199, 7, 49, 18939, 1656, 259, 327, 378, 88, 821, 199, 7, 36, 7420, 1656, 259, 327, 378, 88, 1479, 199, 7, 25542, 621, 1656, 259, 327, 378, 88, 1465, 199, 7, 22546, 1656, 259, 327, 378, 88, 1651, 199, 7, 7833, 79, 1656, 259, 327, 378, 88, 1398, 199, 7, 58, 290, 1656, 259, 327, 378, 88, 18, 65, 199, 7, 56, 18939, 1656, 259, 327, 378, 88, 18, 66, 199, 7, 36, 85, 1656, 259, 327, 378, 88, 18, 67, 199, 7, 2662, 73, 1656, 259, 327, 378, 88, 18, 68, 199, 7, 58, 290, 1656, 259, 327, 378, 88, 18, 69, 199, 17892, 1656, 259, 327, 378, 88, 18, 70, 199, 7, 4232, 73, 1656, 259, 327, 378, 88, 1216, 199, 7, 40, 419, 1656, 259, 327, 378, 88, 2192, 199, 7, 4232, 73, 1656, 259, 327, 378, 88, 708, 199, 7, 39, 290, 1656, 259, 327, 378, 88, 1153, 199, 7, 24783, 1656, 259, 327, 378, 88, 1082, 199, 7, 36, 85, 1656, 259, 327, 378, 88, 1276, 199, 7, 18176, 1656, 259, 327, 378, 88, 1344, 199, 7, 26797, 1656, 259, 327, 378, 88, 1401, 199, 7, 2208, 1656, 259, 327, 378, 88, 1703, 199, 7, 36, 621, 1656, 259, 327, 378, 88, 1355, 199, 7, 51, 5789, 1656, 259, 327, 378, 88, 19, 65, 199, 7, 1136, 1656, 259, 327, 378, 88, 19, 66, 199, 7, 9551, 1656, 259, 327, 378, 88, 19, 67, 199, 7, 49, 5653, 1656, 259, 327, 378, 88, 19, 68, 199, 7, 44, 5653, 1656, 259, 327, 378, 88, 19, 69, 199, 7, 2208, 1656, 259, 327, 378, 88, 19, 70, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 2167, 199, 7, 44, 5789, 1656, 259, 327, 378, 88, 2953, 199, 17892, 1656, 259, 327, 378, 88, 2260, 199, 7, 44, 290, 1656, 259, 327, 378, 88, 2824, 199, 7, 43, 1907, 1656, 259, 327, 378, 88, 1602, 199, 7, 24388, 1656, 259, 327, 378, 88, 2322, 199, 7, 57, 310, 1656, 259, 327, 378, 88, 2466, 199, 7, 40, 8035, 1656, 259, 327, 378, 88, 2417, 199, 7, 12674, 287, 1656, 259, 327, 378, 88, 2006, 199, 7, 52, 5789, 1656, 259, 327, 378, 88, 1887, 199, 7, 22731, 1656, 259, 327, 378, 88, 20, 65, 199, 7, 14738, 1656, 259, 327, 378, 88, 20, 66, 199, 7, 6209, 85, 1656, 259, 327, 378, 88, 20, 67, 199, 7, 16911, 1656, 259, 327, 378, 88, 20, 68, 199, 17892, 1656, 259, 327, 378, 88, 20, 69, 199, 7, 40, 419, 1656, 259, 327, 378, 88, 20, 70, 199, 7, 52, 7420, 1656, 259, 327, 378, 88, 1400, 199, 7, 12674, 7856, 1656, 259, 327, 378, 88, 2869, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 2528, 199, 7, 29745, 1656, 259, 327, 378, 88, 2481, 199, 7, 51, 810, 1656, 259, 327, 378, 88, 1477, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 1229, 199, 7, 31487, 8047, 1656, 259, 327, 378, 88, 1367, 199, 7, 31183, 79, 1656, 259, 327, 378, 88, 1641, 199, 7, 52, 7420, 1656, 259, 327, 378, 88, 2010, 199, 7, 18176, 1656, 259, 327, 378, 88, 1427, 199, 7, 18176, 1656, 259, 327, 378, 88, 21, 65, 199, 7, 42, 5653, 1656, 259, 327, 378, 88, 21, 66, 199, 7, 52, 13780, 1656, 259, 327, 378, 88, 21, 67, 199, 7, 57, 316, 1656, 259, 327, 378, 88, 21, 68, 199, 7, 24388, 1656, 259, 327, 378, 88, 21, 69, 199, 7, 44, 5789, 1656, 259, 327, 378, 88, 21, 70, 199, 7, 9551, 1656, 259, 327, 378, 88, 2259, 199, 7, 2662, 262, 19377, 1656, 259, 327, 378, 88, 2976, 199, 7, 44, 5653, 1656, 259, 327, 378, 88, 2789, 199, 7, 44, 290, 1656, 259, 327, 378, 88, 2766, 199, 7, 49, 5653, 1656, 259, 327, 378, 88, 772, 199, 7, 57, 310, 1656, 259, 327, 378, 88, 2182, 199, 7 ]
[ 275, 334, 199, 7, 58, 69, 1656, 259, 327, 378, 88, 383, 199, 7, 14828, 1656, 259, 327, 378, 88, 614, 199, 7, 11548, 79, 1656, 259, 327, 378, 88, 996, 199, 7, 21001, 1656, 259, 327, 378, 88, 1644, 199, 7, 25542, 1656, 259, 327, 378, 88, 966, 199, 7, 27039, 1656, 259, 327, 378, 88, 1717, 199, 7, 43, 810, 1656, 259, 327, 378, 88, 1690, 199, 7, 35, 85, 1656, 259, 327, 378, 88, 1780, 199, 7, 22638, 1656, 259, 327, 378, 88, 2036, 199, 7, 6209, 85, 1656, 259, 327, 378, 88, 1643, 199, 7, 16911, 1656, 259, 327, 378, 88, 16, 65, 199, 7, 4324, 1656, 259, 327, 378, 88, 16, 66, 199, 7, 27032, 1656, 259, 327, 378, 88, 16, 67, 199, 7, 44, 810, 1656, 259, 327, 378, 88, 16, 68, 199, 7, 58, 2411, 1656, 259, 327, 378, 88, 16, 69, 199, 7, 18176, 1656, 259, 327, 378, 88, 16, 70, 199, 7, 46, 5653, 1656, 259, 327, 378, 88, 709, 199, 7, 51, 13780, 1656, 259, 327, 378, 88, 845, 199, 7, 35, 7856, 1656, 259, 327, 378, 88, 713, 199, 7, 51, 305, 17956, 1656, 259, 327, 378, 88, 969, 199, 7, 51, 13780, 1656, 259, 327, 378, 88, 1079, 199, 7, 2553, 1656, 259, 327, 378, 88, 1046, 199, 7, 36, 7856, 1656, 259, 327, 378, 88, 975, 199, 7, 57, 6738, 1656, 259, 327, 378, 88, 1196, 199, 7, 56, 18939, 1656, 259, 327, 378, 88, 1085, 199, 7, 2208, 1656, 259, 327, 378, 88, 1167, 199, 7, 14738, 1656, 259, 327, 378, 88, 17, 65, 199, 7, 18934, 1656, 259, 327, 378, 88, 17, 66, 199, 7, 36, 621, 1656, 259, 327, 378, 88, 17, 67, 199, 7, 44, 18939, 1656, 259, 327, 378, 88, 17, 68, 199, 7, 29336, 1656, 259, 327, 378, 88, 17, 69, 199, 7, 1341, 290, 1656, 259, 327, 378, 88, 17, 70, 199, 7, 19590, 1656, 259, 327, 378, 88, 1165, 199, 7, 42, 5653, 1656, 259, 327, 378, 88, 2025, 199, 7, 4649, 1656, 259, 327, 378, 88, 1081, 199, 7, 43, 1907, 1656, 259, 327, 378, 88, 1789, 199, 7, 36, 5789, 1656, 259, 327, 378, 88, 1194, 199, 7, 49, 18939, 1656, 259, 327, 378, 88, 821, 199, 7, 36, 7420, 1656, 259, 327, 378, 88, 1479, 199, 7, 25542, 621, 1656, 259, 327, 378, 88, 1465, 199, 7, 22546, 1656, 259, 327, 378, 88, 1651, 199, 7, 7833, 79, 1656, 259, 327, 378, 88, 1398, 199, 7, 58, 290, 1656, 259, 327, 378, 88, 18, 65, 199, 7, 56, 18939, 1656, 259, 327, 378, 88, 18, 66, 199, 7, 36, 85, 1656, 259, 327, 378, 88, 18, 67, 199, 7, 2662, 73, 1656, 259, 327, 378, 88, 18, 68, 199, 7, 58, 290, 1656, 259, 327, 378, 88, 18, 69, 199, 17892, 1656, 259, 327, 378, 88, 18, 70, 199, 7, 4232, 73, 1656, 259, 327, 378, 88, 1216, 199, 7, 40, 419, 1656, 259, 327, 378, 88, 2192, 199, 7, 4232, 73, 1656, 259, 327, 378, 88, 708, 199, 7, 39, 290, 1656, 259, 327, 378, 88, 1153, 199, 7, 24783, 1656, 259, 327, 378, 88, 1082, 199, 7, 36, 85, 1656, 259, 327, 378, 88, 1276, 199, 7, 18176, 1656, 259, 327, 378, 88, 1344, 199, 7, 26797, 1656, 259, 327, 378, 88, 1401, 199, 7, 2208, 1656, 259, 327, 378, 88, 1703, 199, 7, 36, 621, 1656, 259, 327, 378, 88, 1355, 199, 7, 51, 5789, 1656, 259, 327, 378, 88, 19, 65, 199, 7, 1136, 1656, 259, 327, 378, 88, 19, 66, 199, 7, 9551, 1656, 259, 327, 378, 88, 19, 67, 199, 7, 49, 5653, 1656, 259, 327, 378, 88, 19, 68, 199, 7, 44, 5653, 1656, 259, 327, 378, 88, 19, 69, 199, 7, 2208, 1656, 259, 327, 378, 88, 19, 70, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 2167, 199, 7, 44, 5789, 1656, 259, 327, 378, 88, 2953, 199, 17892, 1656, 259, 327, 378, 88, 2260, 199, 7, 44, 290, 1656, 259, 327, 378, 88, 2824, 199, 7, 43, 1907, 1656, 259, 327, 378, 88, 1602, 199, 7, 24388, 1656, 259, 327, 378, 88, 2322, 199, 7, 57, 310, 1656, 259, 327, 378, 88, 2466, 199, 7, 40, 8035, 1656, 259, 327, 378, 88, 2417, 199, 7, 12674, 287, 1656, 259, 327, 378, 88, 2006, 199, 7, 52, 5789, 1656, 259, 327, 378, 88, 1887, 199, 7, 22731, 1656, 259, 327, 378, 88, 20, 65, 199, 7, 14738, 1656, 259, 327, 378, 88, 20, 66, 199, 7, 6209, 85, 1656, 259, 327, 378, 88, 20, 67, 199, 7, 16911, 1656, 259, 327, 378, 88, 20, 68, 199, 17892, 1656, 259, 327, 378, 88, 20, 69, 199, 7, 40, 419, 1656, 259, 327, 378, 88, 20, 70, 199, 7, 52, 7420, 1656, 259, 327, 378, 88, 1400, 199, 7, 12674, 7856, 1656, 259, 327, 378, 88, 2869, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 2528, 199, 7, 29745, 1656, 259, 327, 378, 88, 2481, 199, 7, 51, 810, 1656, 259, 327, 378, 88, 1477, 199, 7, 58, 11586, 1656, 259, 327, 378, 88, 1229, 199, 7, 31487, 8047, 1656, 259, 327, 378, 88, 1367, 199, 7, 31183, 79, 1656, 259, 327, 378, 88, 1641, 199, 7, 52, 7420, 1656, 259, 327, 378, 88, 2010, 199, 7, 18176, 1656, 259, 327, 378, 88, 1427, 199, 7, 18176, 1656, 259, 327, 378, 88, 21, 65, 199, 7, 42, 5653, 1656, 259, 327, 378, 88, 21, 66, 199, 7, 52, 13780, 1656, 259, 327, 378, 88, 21, 67, 199, 7, 57, 316, 1656, 259, 327, 378, 88, 21, 68, 199, 7, 24388, 1656, 259, 327, 378, 88, 21, 69, 199, 7, 44, 5789, 1656, 259, 327, 378, 88, 21, 70, 199, 7, 9551, 1656, 259, 327, 378, 88, 2259, 199, 7, 2662, 262, 19377, 1656, 259, 327, 378, 88, 2976, 199, 7, 44, 5653, 1656, 259, 327, 378, 88, 2789, 199, 7, 44, 290, 1656, 259, 327, 378, 88, 2766, 199, 7, 49, 5653, 1656, 259, 327, 378, 88, 772, 199, 7, 57, 310, 1656, 259, 327, 378, 88, 2182, 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, 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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 ]
matthewwardrop/formulaic
benchmarks/plot.py
1
1418
import os import matplotlib.pyplot as plt import numpy as np import pandas as pd data = pd.read_csv(os.path.join(os.path.dirname(__file__), 'benchmarks.csv')).sort_values('mean') def grouped_barplot(df, cat, subcat, val, err, subcats=None, **kwargs): # based on https://stackoverflow.com/a/42033734 categories = df[cat].unique() x = np.arange(len(categories)) subcats = subcats or df[subcat].unique() offsets = (np.arange(len(subcats)) - np.arange(len(subcats)).mean()) / (len(subcats) + 1.) width = np.diff(offsets).mean() for i, gr in enumerate(subcats): dfg = df[df[subcat] == gr] plt.bar(x + offsets[i], dfg[val].values, width=width, label="{}".format(gr), yerr=dfg[err].values, capsize=6, **kwargs) plt.xlabel(cat) plt.ylabel(val) plt.xticks(x, categories) plt.legend(title=subcat, loc='center left', bbox_to_anchor=(1, 0.5)) def plot_benchmarks(toolings=None): plt.figure(dpi=120, figsize=(10, 5)) grouped_barplot(data, cat='formula', subcat='tooling', val='mean', err='stderr', subcats=toolings, log=True) plt.ylim(1e-2, None) plt.grid() plt.gca().set_axisbelow(True) plt.ylabel("Mean Time (s)") plt.xlabel("Formula") plt.tight_layout() plot_benchmarks(toolings=['formulaic', 'R', 'patsy', 'formulaic_sparse', 'R_sparse']) plt.savefig(os.path.join(os.path.dirname(__file__), 'benchmarks.png'))
mit
[ 646, 747, 199, 199, 646, 8027, 14, 13563, 465, 4488, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 421, 199, 576, 275, 6454, 14, 739, 63, 4737, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 11861, 83, 14, 4737, 11103, 3191, 63, 1459, 360, 3670, 358, 421, 199, 318, 16251, 63, 1700, 2798, 8, 1587, 12, 6230, 12, 1007, 3385, 12, 1139, 12, 2329, 12, 1007, 25729, 29, 403, 12, 1011, 958, 304, 272, 327, 4079, 641, 4178, 921, 23153, 14, 957, 15, 65, 15, 25102, 11062, 1082, 272, 9695, 275, 4051, 59, 3385, 1055, 3235, 342, 272, 671, 275, 980, 14, 5605, 8, 552, 8, 8906, 430, 272, 1007, 25729, 275, 1007, 25729, 503, 4051, 59, 954, 3385, 1055, 3235, 342, 272, 15340, 275, 334, 1590, 14, 5605, 8, 552, 8, 954, 25729, 430, 446, 980, 14, 5605, 8, 552, 8, 954, 25729, 4992, 3670, 1012, 1182, 334, 552, 8, 954, 25729, 9, 435, 413, 4959, 272, 3462, 275, 980, 14, 3028, 8, 14253, 680, 3670, 342, 272, 367, 284, 12, 7192, 315, 3874, 8, 954, 25729, 304, 267, 4051, 71, 275, 4051, 59, 1587, 59, 954, 3385, 61, 508, 7192, 61, 267, 4488, 14, 1700, 8, 88, 435, 15340, 59, 73, 467, 4051, 71, 59, 637, 1055, 1459, 12, 3462, 29, 2063, 12, 355, 1768, 628, 13536, 908, 8, 2587, 395, 612, 1508, 29, 1587, 71, 59, 1508, 1055, 1459, 12, 4021, 890, 29, 22, 12, 1011, 958, 9, 272, 4488, 14, 14168, 8, 3385, 9, 272, 4488, 14, 13849, 8, 637, 9, 272, 4488, 14, 26217, 8, 88, 12, 9695, 9, 272, 4488, 14, 10231, 8, 1213, 29, 954, 3385, 12, 4355, 534, 4218, 3602, 297, 12494, 63, 475, 63, 11498, 2687, 17, 12, 378, 14, 21, 430, 421, 199, 318, 5137, 63, 11861, 83, 8, 3557, 780, 29, 403, 304, 272, 4488, 14, 8941, 8, 23595, 29, 6708, 12, 6085, 890, 2687, 709, 12, 959, 430, 272, 16251, 63, 1700, 2798, 8, 576, 12, 6230, 534, 16798, 297, 1007, 3385, 534, 3557, 316, 297, 1139, 534, 3670, 297, 2329, 534, 3083, 297, 1007, 25729, 29, 3557, 780, 12, 943, 29, 549, 9, 272, 4488, 14, 18123, 8, 17, 69, 13, 18, 12, 488, 9, 272, 4488, 14, 3825, 342, 272, 4488, 14, 71, 696, 1252, 409, 63, 3127, 12843, 8, 549, 9, 272, 4488, 14, 13849, 480, 14825, 4703, 334, 83, 6320, 272, 4488, 14, 14168, 480, 28533, 531, 272, 4488, 14, 23787, 63, 4209, 342, 421, 199, 2798, 63, 11861, 83, 8, 3557, 780, 2968, 16798, 530, 297, 283, 50, 297, 283, 10853, 1786, 297, 283, 16798, 530, 63, 4421, 297, 283, 50, 63, 4421, 1105, 199, 6003, 14, 19556, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 11861, 83, 14, 4524, 1333, 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 ]
[ 747, 199, 199, 646, 8027, 14, 13563, 465, 4488, 199, 646, 2680, 465, 980, 199, 646, 10634, 465, 6454, 421, 199, 576, 275, 6454, 14, 739, 63, 4737, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 11861, 83, 14, 4737, 11103, 3191, 63, 1459, 360, 3670, 358, 421, 199, 318, 16251, 63, 1700, 2798, 8, 1587, 12, 6230, 12, 1007, 3385, 12, 1139, 12, 2329, 12, 1007, 25729, 29, 403, 12, 1011, 958, 304, 272, 327, 4079, 641, 4178, 921, 23153, 14, 957, 15, 65, 15, 25102, 11062, 1082, 272, 9695, 275, 4051, 59, 3385, 1055, 3235, 342, 272, 671, 275, 980, 14, 5605, 8, 552, 8, 8906, 430, 272, 1007, 25729, 275, 1007, 25729, 503, 4051, 59, 954, 3385, 1055, 3235, 342, 272, 15340, 275, 334, 1590, 14, 5605, 8, 552, 8, 954, 25729, 430, 446, 980, 14, 5605, 8, 552, 8, 954, 25729, 4992, 3670, 1012, 1182, 334, 552, 8, 954, 25729, 9, 435, 413, 4959, 272, 3462, 275, 980, 14, 3028, 8, 14253, 680, 3670, 342, 272, 367, 284, 12, 7192, 315, 3874, 8, 954, 25729, 304, 267, 4051, 71, 275, 4051, 59, 1587, 59, 954, 3385, 61, 508, 7192, 61, 267, 4488, 14, 1700, 8, 88, 435, 15340, 59, 73, 467, 4051, 71, 59, 637, 1055, 1459, 12, 3462, 29, 2063, 12, 355, 1768, 628, 13536, 908, 8, 2587, 395, 612, 1508, 29, 1587, 71, 59, 1508, 1055, 1459, 12, 4021, 890, 29, 22, 12, 1011, 958, 9, 272, 4488, 14, 14168, 8, 3385, 9, 272, 4488, 14, 13849, 8, 637, 9, 272, 4488, 14, 26217, 8, 88, 12, 9695, 9, 272, 4488, 14, 10231, 8, 1213, 29, 954, 3385, 12, 4355, 534, 4218, 3602, 297, 12494, 63, 475, 63, 11498, 2687, 17, 12, 378, 14, 21, 430, 421, 199, 318, 5137, 63, 11861, 83, 8, 3557, 780, 29, 403, 304, 272, 4488, 14, 8941, 8, 23595, 29, 6708, 12, 6085, 890, 2687, 709, 12, 959, 430, 272, 16251, 63, 1700, 2798, 8, 576, 12, 6230, 534, 16798, 297, 1007, 3385, 534, 3557, 316, 297, 1139, 534, 3670, 297, 2329, 534, 3083, 297, 1007, 25729, 29, 3557, 780, 12, 943, 29, 549, 9, 272, 4488, 14, 18123, 8, 17, 69, 13, 18, 12, 488, 9, 272, 4488, 14, 3825, 342, 272, 4488, 14, 71, 696, 1252, 409, 63, 3127, 12843, 8, 549, 9, 272, 4488, 14, 13849, 480, 14825, 4703, 334, 83, 6320, 272, 4488, 14, 14168, 480, 28533, 531, 272, 4488, 14, 23787, 63, 4209, 342, 421, 199, 2798, 63, 11861, 83, 8, 3557, 780, 2968, 16798, 530, 297, 283, 50, 297, 283, 10853, 1786, 297, 283, 16798, 530, 63, 4421, 297, 283, 50, 63, 4421, 1105, 199, 6003, 14, 19556, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 11861, 83, 14, 4524, 1333, 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, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
petercable/mi-instrument
mi/idk/platform/egg_generator.py
11
9991
#!/usr/bin/env python """ @file coi-services/mi.idk.platform/egg_generator.py @author Emily Hahn @brief Generate egg for a platform agent driver. """ __author__ = 'Emily Hahn' __license__ = 'Apache 2.0' from mi.core.log import get_logger ; log = get_logger() import string import re import os import sys import shutil from os.path import exists, dirname from shutil import copytree from mi.idk import prompt import mi.idk.egg_generator from mi.idk.egg_generator import DependencyList from mi.idk.exceptions import ValidationFailure from mi.idk.exceptions import InvalidParameters from mi.idk.config import Config from mi.idk.platform.driver_generator import DriverGenerator class DriverFileList(mi.idk.egg_generator.DriverFileList): """ Build list of files that are associated to a driver. It uses the DependencyList object to get all python files. Then it will look in the target module directory for additional files. """ def __init__(self, metadata, basedir, driver_file = None, driver_test_file = None): driver_generator = DriverGenerator(metadata) self.basedir = basedir if driver_file: self.driver_file = driver_file else: self.driver_file = driver_generator.driver_path() if driver_test_file: self.driver_test_file = driver_test_file else: self.driver_test_file = driver_generator.driver_test_path() self.driver_dependency = None self.test_dependency = None self.driver_dependency = DependencyList(self.driver_file, include_internal_init=True) self.test_dependency = DependencyList(self.driver_test_file, include_internal_init=True) class EggGenerator(mi.idk.egg_generator.EggGenerator): """ Generate driver egg """ def __init__(self, metadata): """ @brief Constructor @param metadata IDK Metadata object """ self.metadata = metadata self._bdir = None self._repodir = mi.idk.egg_generator.REPODIR sys.path.insert(0, self._repodir) log.debug(sys.path) if not self._tmp_dir(): raise InvalidParameters("missing tmp_dir configuration") if not self._repo_dir(): raise InvalidParameters("missing working_repo configuration") self.generator = DriverGenerator(self.metadata) log.debug("importing test module: %s", self._test_module()) test_import = __import__(self._test_module()) def template_dir(self): """ @brief path to the driver template dir @retval driver test code template path """ return os.path.join(Config().template_dir(), 'platform') def _build_name(self): return self.metadata.driver_name_versioned def _driver_dir(self): (driver_dir, driver_fname) = os.path.split(self.metadata.driver_path) return driver_dir def _setup_path(self): return os.path.join(self._build_dir(), 'setup.py' ) def _setup_template_path(self): return os.path.join(Config().template_dir(), 'platform', 'setup.tmpl' ) def _versioned_dir(self): return os.path.join(self._build_dir(), self._build_name()) def _generate_setup_file(self): if not os.path.exists(self._build_dir()): os.makedirs(self._build_dir()) if not os.path.exists(self._build_dir()): raise IDKException("failed to create build dir: %s" % self._build_dir()) setup_file = self._setup_path() setup_template = self._get_template(self._setup_template_path()) log.debug("setup.py template: %s" % self._setup_template_path()) log.debug("Create setup.py file: %s" % setup_file ) log.debug("setup.py template file: %s" % self._setup_template_path()) log.debug("setup.py template data: %s" % self._setup_template_data()) ofile = open(setup_file, 'w') code = setup_template.substitute(self._setup_template_data()) ofile.write(code) ofile.close() def _setup_template_data(self): return { 'name': self.metadata.driver_name_versioned, 'version': self.metadata.version, 'description': 'ooi platform agent driver', 'author': self.metadata.author, 'email': self.metadata.email, 'url': 'http://www.oceanobservatories.org', 'entry_point_group': self.metadata.entry_point_group, 'versioned_constructor': self.metadata.versioned_constructor, 'driver_path': self.metadata.driver_path, 'short_name': 'platform_' + self.metadata.driver_name } def _stage_files(self, files): """ Copy files from the original directory into two levels of versioned directories within a staging directory, and replace the mi namespace with the versioned driver name.mi to account for the new directory (only the lower versioned dir is included in the egg) @param files - a list of files to copy into the staging directory """ # make two levels of versioned file directories, i.e. # driverA_0_1 (= build_dir) # driverA_0_1 # then copy driverA files into the bottom versioned dir if not os.path.exists(self._build_dir()): os.makedirs(self._build_dir()) if not os.path.exists(self._versioned_dir()): os.makedirs(self._versioned_dir()) # we need to make sure an init file is in the versioned dir so # that find_packages() will look in here init_path = self._versioned_dir() + "/__init__.py" if not os.path.exists(init_path): init_file = open(init_path, "w") init_file.close() for filename in files: # get the paths to the source and destination files dest = os.path.join(self._versioned_dir(), filename) destdir = dirname(dest) source = os.path.join(self._repo_dir(), filename) log.debug(" Copy %s => %s" % (source, dest)) # make sure the destination directory exists, if it doesn't make it if not os.path.exists(destdir): os.makedirs(destdir) # copy the file shutil.copy(source, dest) # replace mi in the copied files with the versioned driver module.mi # this is necessary because the top namespace in the versioned files starts # with the versioned driver name directory, not mi driver_file = open(dest, "r") contents = driver_file.read() driver_file.close() new_contents = re.sub(r'(^import |^from |\'|= )mi\.|res/config/mi-logging|\'mi\'', self._mi_replace, contents, count=0, flags=re.MULTILINE) driver_file = open(dest, "w") driver_file.write(new_contents) driver_file.close() # need to add mi-logging.yml special because it is not in cloned repo, only in local repository milog = "res/config/mi-logging.yml" dest = os.path.join(self._versioned_dir(), milog) destdir = dirname(dest) source = os.path.join(Config().base_dir(), milog) log.debug(" Copy %s => %s" % (source, dest)) # make sure the destination directory exists, if it doesn't make it if not os.path.exists(destdir): os.makedirs(destdir) shutil.copy(source, dest) def _mi_replace(self, matchobj): """ This function is used in regex sub to replace mi with the versioned driver name followed by mi @param matchobj - the match object from re.sub """ if matchobj.group(0) == 'res/config/mi-logging': return self.metadata.driver_name_versioned + '/' + matchobj.group(0) elif matchobj.group(0) == '\'mi\'': return '\'' + self.metadata.driver_name_versioned + '.mi\'' else: return matchobj.group(1) + self.metadata.driver_name_versioned + '.mi.' def _build_egg(self, files): try: self._verify_ready() self._stage_files(files) self._generate_setup_file() cmd = "cd %s; python setup.py bdist_egg" % self._build_dir() log.info("CMD: %s" % cmd) os.system(cmd) # python filters out '__' from the egg name and turns it into '_', so if we have those in our # driver name need to fix the egg name egg_file = "%s/dist/platform_%s-%s-py2.7.egg" % (self._build_dir(), self.metadata.driver_name.replace('__', '_'), self.metadata.version) # Remove all pyc files from the egg. There was a jira case that suggested # including the compiled py files caused the drivers to run slower. # https://jira.oceanobservatories.org/tasks/browse/OOIION-1167 cmd = "zip %s -d \*.pyc" % egg_file log.info("CMD: %s" % cmd) os.system(cmd) except ValidationFailure, e: log.error("Failed egg verification: %s" % e ) return None log.debug("Egg file created: %s" % egg_file) return egg_file def save(self): driver_file = self.metadata.driver_dir() + '/' + DriverGenerator(self.metadata).driver_filename() driver_test_file = self.metadata.driver_dir() + '/test/' + DriverGenerator(self.metadata).driver_test_filename() filelist = DriverFileList(self.metadata, self._repo_dir(), driver_file, driver_test_file) return self._build_egg(filelist.files()) if __name__ == '__main__': pass
bsd-2-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 624, 199, 32, 493, 512, 73, 13, 5950, 15, 2664, 14, 344, 75, 14, 3246, 15, 5799, 63, 4679, 14, 647, 199, 32, 2502, 662, 77, 3444, 869, 65, 6164, 199, 32, 19127, 7958, 11393, 367, 282, 4298, 6631, 5253, 14, 199, 624, 199, 199, 363, 2502, 363, 275, 283, 37, 77, 3444, 869, 65, 6164, 7, 199, 363, 1682, 363, 275, 283, 28993, 499, 14, 16, 7, 199, 199, 504, 10684, 14, 1018, 14, 793, 492, 664, 63, 2921, 8700, 943, 275, 664, 63, 2921, 342, 199, 199, 646, 1059, 199, 646, 295, 199, 646, 747, 199, 646, 984, 199, 646, 5145, 199, 504, 747, 14, 515, 492, 3495, 12, 9017, 199, 504, 5145, 492, 1331, 2350, 199, 504, 10684, 14, 344, 75, 492, 8457, 199, 646, 10684, 14, 344, 75, 14, 5799, 63, 4679, 199, 504, 10684, 14, 344, 75, 14, 5799, 63, 4679, 492, 22922, 1296, 199, 199, 504, 10684, 14, 344, 75, 14, 3924, 492, 19381, 6782, 199, 504, 10684, 14, 344, 75, 14, 3924, 492, 6378, 5976, 199, 504, 10684, 14, 344, 75, 14, 888, 492, 4094, 199, 199, 504, 10684, 14, 344, 75, 14, 3246, 14, 3090, 63, 4679, 492, 19447, 7599, 199, 199, 533, 19447, 1173, 1296, 8, 2664, 14, 344, 75, 14, 5799, 63, 4679, 14, 6158, 1173, 1296, 304, 272, 408, 272, 6516, 769, 402, 1584, 626, 787, 4568, 370, 282, 5253, 14, 221, 2779, 4440, 314, 22922, 1296, 272, 909, 370, 664, 1006, 2366, 1584, 14, 221, 9442, 652, 911, 3648, 315, 314, 1347, 859, 2082, 272, 367, 4722, 1584, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3341, 12, 19380, 12, 5253, 63, 493, 275, 488, 12, 5253, 63, 396, 63, 493, 275, 488, 304, 267, 5253, 63, 4679, 275, 19447, 7599, 8, 2343, 9, 2728, 291, 14, 12484, 275, 19380, 398, 340, 5253, 63, 493, 26, 288, 291, 14, 3090, 63, 493, 275, 5253, 63, 493, 267, 587, 26, 288, 291, 14, 3090, 63, 493, 275, 5253, 63, 4679, 14, 3090, 63, 515, 342, 398, 340, 5253, 63, 396, 63, 493, 26, 288, 291, 14, 3090, 63, 396, 63, 493, 275, 5253, 63, 396, 63, 493, 267, 587, 26, 288, 291, 14, 3090, 63, 396, 63, 493, 275, 5253, 63, 4679, 14, 3090, 63, 396, 63, 515, 342, 398, 291, 14, 3090, 63, 8575, 275, 488, 267, 291, 14, 396, 63, 8575, 275, 488, 267, 291, 14, 3090, 63, 8575, 275, 22922, 1296, 8, 277, 14, 3090, 63, 493, 12, 2387, 63, 4672, 63, 826, 29, 549, 9, 267, 291, 14, 396, 63, 8575, 275, 22922, 1296, 8, 277, 14, 3090, 63, 396, 63, 493, 12, 2387, 63, 4672, 63, 826, 29, 549, 9, 199, 199, 533, 662, 2721, 7599, 8, 2664, 14, 344, 75, 14, 5799, 63, 4679, 14, 37, 2721, 7599, 304, 272, 408, 272, 7958, 5253, 11393, 272, 408, 2286, 347, 636, 826, 721, 277, 12, 3341, 304, 267, 408, 267, 768, 19127, 20297, 267, 768, 635, 3341, 2870, 43, 16160, 909, 267, 408, 267, 291, 14, 2343, 275, 3341, 267, 291, 423, 66, 694, 275, 488, 267, 291, 423, 3417, 694, 275, 10684, 14, 344, 75, 14, 5799, 63, 4679, 14, 20424, 3022, 267, 984, 14, 515, 14, 3176, 8, 16, 12, 291, 423, 3417, 694, 9, 267, 943, 14, 1757, 8, 1274, 14, 515, 9, 398, 340, 440, 291, 423, 2791, 63, 694, 837, 288, 746, 6378, 5976, 480, 4752, 3529, 63, 694, 2897, 531, 398, 340, 440, 291, 423, 3417, 63, 694, 837, 288, 746, 6378, 5976, 480, 4752, 6449, 63, 3417, 2897, 531, 398, 291, 14, 4679, 275, 19447, 7599, 8, 277, 14, 2343, 9, 267, 943, 14, 1757, 480, 646, 316, 511, 859, 26, 450, 83, 401, 291, 423, 396, 63, 578, 1012, 267, 511, 63, 646, 275, 636, 646, 721, 277, 423, 396, 63, 578, 1012, 339, 347, 1978, 63, 694, 8, 277, 304, 267, 408, 267, 768, 19127, 931, 370, 314, 5253, 1978, 2935, 267, 768, 18476, 5253, 511, 1233, 1978, 931, 267, 408, 267, 372, 747, 14, 515, 14, 904, 8, 2028, 1252, 1160, 63, 694, 1062, 283, 3246, 358, 339, 347, 485, 1506, 63, 354, 8, 277, 304, 267, 372, 291, 14, 2343, 14, 3090, 63, 354, 63, 24155, 339, 347, 485, 3090, 63, 694, 8, 277, 304, 267, 334, 3090, 63, 694, 12, 5253, 63, 5252, 9, 275, 747, 14, 515, 14, 1294, 8, 277, 14, 2343, 14, 3090, 63, 515, 9, 267, 372, 5253, 63, 694, 339, 347, 485, 2758, 63, 515, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 277, 423, 1506, 63, 694, 1062, 283, 2758, 14, 647, 7, 776, 339, 347, 485, 2758, 63, 1160, 63, 515, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 2028, 1252, 1160, 63, 694, 1062, 283, 3246, 297, 283, 2758, 14, 11510, 7, 776, 339, 347, 485, 24155, 63, 694, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 277, 423, 1506, 63, 694, 1062, 1169, 291, 423, 1506, 63, 354, 1012, 339, 347, 485, 4208, 63, 2758, 63, 493, 8, 277, 304, 267, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 423, 1506, 63, 694, 5109, 288, 747, 14, 8347, 8, 277, 423, 1506, 63, 694, 1012, 398, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 423, 1506, 63, 694, 5109, 288, 746, 2870, 43, 1726, 480, 4892, 370, 1218, 1900, 2935, 26, 450, 83, 2, 450, 291, 423, 1506, 63, 694, 1012, 398, 3272, 63, 493, 275, 291, 423, 2758, 63, 515, 342, 267, 3272, 63, 1160, 275, 291, 423, 362, 63, 1160, 8, 277, 423, 2758, 63, 1160, 63, 515, 1012, 398, 943, 14, 1757, 480, 2758, 14, 647, 1978, 26, 450, 83, 2, 450, 291, 423, 2758, 63, 1160, 63, 515, 1012, 267, 943, 14, 1757, 480, 2499, 3272, 14, 647, 570, 26, 450, 83, 2, 450, 3272, 63, 493, 776, 267, 943, 14, 1757, 480, 2758, 14, 647, 1978, 570, 26, 450, 83, 2, 450, 291, 423, 2758, 63, 1160, 63, 515, 1012, 267, 943, 14, 1757, 480, 2758, 14, 647, 1978, 666 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 624, 199, 32, 493, 512, 73, 13, 5950, 15, 2664, 14, 344, 75, 14, 3246, 15, 5799, 63, 4679, 14, 647, 199, 32, 2502, 662, 77, 3444, 869, 65, 6164, 199, 32, 19127, 7958, 11393, 367, 282, 4298, 6631, 5253, 14, 199, 624, 199, 199, 363, 2502, 363, 275, 283, 37, 77, 3444, 869, 65, 6164, 7, 199, 363, 1682, 363, 275, 283, 28993, 499, 14, 16, 7, 199, 199, 504, 10684, 14, 1018, 14, 793, 492, 664, 63, 2921, 8700, 943, 275, 664, 63, 2921, 342, 199, 199, 646, 1059, 199, 646, 295, 199, 646, 747, 199, 646, 984, 199, 646, 5145, 199, 504, 747, 14, 515, 492, 3495, 12, 9017, 199, 504, 5145, 492, 1331, 2350, 199, 504, 10684, 14, 344, 75, 492, 8457, 199, 646, 10684, 14, 344, 75, 14, 5799, 63, 4679, 199, 504, 10684, 14, 344, 75, 14, 5799, 63, 4679, 492, 22922, 1296, 199, 199, 504, 10684, 14, 344, 75, 14, 3924, 492, 19381, 6782, 199, 504, 10684, 14, 344, 75, 14, 3924, 492, 6378, 5976, 199, 504, 10684, 14, 344, 75, 14, 888, 492, 4094, 199, 199, 504, 10684, 14, 344, 75, 14, 3246, 14, 3090, 63, 4679, 492, 19447, 7599, 199, 199, 533, 19447, 1173, 1296, 8, 2664, 14, 344, 75, 14, 5799, 63, 4679, 14, 6158, 1173, 1296, 304, 272, 408, 272, 6516, 769, 402, 1584, 626, 787, 4568, 370, 282, 5253, 14, 221, 2779, 4440, 314, 22922, 1296, 272, 909, 370, 664, 1006, 2366, 1584, 14, 221, 9442, 652, 911, 3648, 315, 314, 1347, 859, 2082, 272, 367, 4722, 1584, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3341, 12, 19380, 12, 5253, 63, 493, 275, 488, 12, 5253, 63, 396, 63, 493, 275, 488, 304, 267, 5253, 63, 4679, 275, 19447, 7599, 8, 2343, 9, 2728, 291, 14, 12484, 275, 19380, 398, 340, 5253, 63, 493, 26, 288, 291, 14, 3090, 63, 493, 275, 5253, 63, 493, 267, 587, 26, 288, 291, 14, 3090, 63, 493, 275, 5253, 63, 4679, 14, 3090, 63, 515, 342, 398, 340, 5253, 63, 396, 63, 493, 26, 288, 291, 14, 3090, 63, 396, 63, 493, 275, 5253, 63, 396, 63, 493, 267, 587, 26, 288, 291, 14, 3090, 63, 396, 63, 493, 275, 5253, 63, 4679, 14, 3090, 63, 396, 63, 515, 342, 398, 291, 14, 3090, 63, 8575, 275, 488, 267, 291, 14, 396, 63, 8575, 275, 488, 267, 291, 14, 3090, 63, 8575, 275, 22922, 1296, 8, 277, 14, 3090, 63, 493, 12, 2387, 63, 4672, 63, 826, 29, 549, 9, 267, 291, 14, 396, 63, 8575, 275, 22922, 1296, 8, 277, 14, 3090, 63, 396, 63, 493, 12, 2387, 63, 4672, 63, 826, 29, 549, 9, 199, 199, 533, 662, 2721, 7599, 8, 2664, 14, 344, 75, 14, 5799, 63, 4679, 14, 37, 2721, 7599, 304, 272, 408, 272, 7958, 5253, 11393, 272, 408, 2286, 347, 636, 826, 721, 277, 12, 3341, 304, 267, 408, 267, 768, 19127, 20297, 267, 768, 635, 3341, 2870, 43, 16160, 909, 267, 408, 267, 291, 14, 2343, 275, 3341, 267, 291, 423, 66, 694, 275, 488, 267, 291, 423, 3417, 694, 275, 10684, 14, 344, 75, 14, 5799, 63, 4679, 14, 20424, 3022, 267, 984, 14, 515, 14, 3176, 8, 16, 12, 291, 423, 3417, 694, 9, 267, 943, 14, 1757, 8, 1274, 14, 515, 9, 398, 340, 440, 291, 423, 2791, 63, 694, 837, 288, 746, 6378, 5976, 480, 4752, 3529, 63, 694, 2897, 531, 398, 340, 440, 291, 423, 3417, 63, 694, 837, 288, 746, 6378, 5976, 480, 4752, 6449, 63, 3417, 2897, 531, 398, 291, 14, 4679, 275, 19447, 7599, 8, 277, 14, 2343, 9, 267, 943, 14, 1757, 480, 646, 316, 511, 859, 26, 450, 83, 401, 291, 423, 396, 63, 578, 1012, 267, 511, 63, 646, 275, 636, 646, 721, 277, 423, 396, 63, 578, 1012, 339, 347, 1978, 63, 694, 8, 277, 304, 267, 408, 267, 768, 19127, 931, 370, 314, 5253, 1978, 2935, 267, 768, 18476, 5253, 511, 1233, 1978, 931, 267, 408, 267, 372, 747, 14, 515, 14, 904, 8, 2028, 1252, 1160, 63, 694, 1062, 283, 3246, 358, 339, 347, 485, 1506, 63, 354, 8, 277, 304, 267, 372, 291, 14, 2343, 14, 3090, 63, 354, 63, 24155, 339, 347, 485, 3090, 63, 694, 8, 277, 304, 267, 334, 3090, 63, 694, 12, 5253, 63, 5252, 9, 275, 747, 14, 515, 14, 1294, 8, 277, 14, 2343, 14, 3090, 63, 515, 9, 267, 372, 5253, 63, 694, 339, 347, 485, 2758, 63, 515, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 277, 423, 1506, 63, 694, 1062, 283, 2758, 14, 647, 7, 776, 339, 347, 485, 2758, 63, 1160, 63, 515, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 2028, 1252, 1160, 63, 694, 1062, 283, 3246, 297, 283, 2758, 14, 11510, 7, 776, 339, 347, 485, 24155, 63, 694, 8, 277, 304, 267, 372, 747, 14, 515, 14, 904, 8, 277, 423, 1506, 63, 694, 1062, 1169, 291, 423, 1506, 63, 354, 1012, 339, 347, 485, 4208, 63, 2758, 63, 493, 8, 277, 304, 267, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 423, 1506, 63, 694, 5109, 288, 747, 14, 8347, 8, 277, 423, 1506, 63, 694, 1012, 398, 340, 440, 747, 14, 515, 14, 2444, 8, 277, 423, 1506, 63, 694, 5109, 288, 746, 2870, 43, 1726, 480, 4892, 370, 1218, 1900, 2935, 26, 450, 83, 2, 450, 291, 423, 1506, 63, 694, 1012, 398, 3272, 63, 493, 275, 291, 423, 2758, 63, 515, 342, 267, 3272, 63, 1160, 275, 291, 423, 362, 63, 1160, 8, 277, 423, 2758, 63, 1160, 63, 515, 1012, 398, 943, 14, 1757, 480, 2758, 14, 647, 1978, 26, 450, 83, 2, 450, 291, 423, 2758, 63, 1160, 63, 515, 1012, 267, 943, 14, 1757, 480, 2499, 3272, 14, 647, 570, 26, 450, 83, 2, 450, 3272, 63, 493, 776, 267, 943, 14, 1757, 480, 2758, 14, 647, 1978, 570, 26, 450, 83, 2, 450, 291, 423, 2758, 63, 1160, 63, 515, 1012, 267, 943, 14, 1757, 480, 2758, 14, 647, 1978, 666, 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,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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 from ansible.compat.tests import unittest, mock from ansible.plugins.cache import FactCache from ansible.plugins.cache.base import BaseCacheModule from ansible.plugins.cache.memory import CacheModule as MemoryCache HAVE_MEMCACHED = True try: import memcached except ImportError: HAVE_MEMCACHED = False else: # Use an else so that the only reason we skip this is for lack of # memcached, not errors importing the plugin from ansible.plugins.cache.memcached import CacheModule as MemcachedCache HAVE_REDIS = True try: import redis except ImportError: HAVE_REDIS = False else: from ansible.plugins.cache.redis import CacheModule as RedisCache class TestFactCache(unittest.TestCase): def setUp(self): with mock.patch('ansible.constants.CACHE_PLUGIN', 'memory'): self.cache = FactCache() def test_copy(self): self.cache['avocado'] = 'fruit' self.cache['daisy'] = 'flower' a_copy = self.cache.copy() self.assertEqual(type(a_copy), dict) self.assertEqual(a_copy, dict(avocado='fruit', daisy='flower')) class TestAbstractClass(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_subclass_error(self): class CacheModule1(BaseCacheModule): pass with self.assertRaises(TypeError): CacheModule1() class CacheModule2(BaseCacheModule): def get(self, key): super(CacheModule2, self).get(key) with self.assertRaises(TypeError): CacheModule2() def test_subclass_success(self): class CacheModule3(BaseCacheModule): def get(self, key): super(CacheModule3, self).get(key) def set(self, key, value): super(CacheModule3, self).set(key, value) def keys(self): super(CacheModule3, self).keys() def contains(self, key): super(CacheModule3, self).contains(key) def delete(self, key): super(CacheModule3, self).delete(key) def flush(self): super(CacheModule3, self).flush() def copy(self): super(CacheModule3, self).copy() self.assertIsInstance(CacheModule3(), CacheModule3) @unittest.skipUnless(HAVE_MEMCACHED, 'python-memcached module not installed') def test_memcached_cachemodule(self): self.assertIsInstance(MemcachedCache(), MemcachedCache) def test_memory_cachemodule(self): self.assertIsInstance(MemoryCache(), MemoryCache) @unittest.skipUnless(HAVE_REDIS, 'Redis pyhton module not installed') def test_redis_cachemodule(self): self.assertIsInstance(RedisCache(), RedisCache)
gpl-3.0
[ 3, 334, 67, 9, 6029, 13, 7806, 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, 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, 504, 3242, 14, 5819, 14, 2219, 492, 2882, 12, 1683, 199, 504, 3242, 14, 5265, 14, 1637, 492, 481, 2442, 4437, 199, 504, 3242, 14, 5265, 14, 1637, 14, 1095, 492, 3523, 4437, 2377, 199, 504, 3242, 14, 5265, 14, 1637, 14, 4844, 492, 11977, 2377, 465, 15825, 4437, 199, 199, 10767, 63, 10293, 3263, 22492, 275, 715, 199, 893, 26, 272, 492, 7573, 5245, 199, 2590, 3545, 26, 272, 25227, 63, 10293, 3263, 22492, 275, 756, 199, 2836, 26, 272, 327, 3645, 376, 587, 880, 626, 314, 1454, 4499, 781, 3372, 642, 365, 367, 29098, 402, 272, 327, 7573, 5245, 12, 440, 2552, 16306, 314, 3589, 272, 687, 3242, 14, 5265, 14, 1637, 14, 32567, 492, 11977, 2377, 465, 30465, 5245, 4437, 199, 199, 10767, 63, 907, 6178, 275, 715, 199, 893, 26, 272, 492, 16967, 199, 2590, 3545, 26, 272, 25227, 63, 907, 6178, 275, 756, 199, 2836, 26, 272, 687, 3242, 14, 5265, 14, 1637, 14, 15369, 492, 11977, 2377, 465, 25496, 4437, 421, 199, 533, 1379, 24704, 4437, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 543, 1683, 14, 2068, 360, 4853, 14, 5559, 14, 8677, 63, 19108, 297, 283, 4844, 735, 288, 291, 14, 1637, 275, 481, 2442, 4437, 342, 339, 347, 511, 63, 1574, 8, 277, 304, 267, 291, 14, 1637, 459, 1214, 679, 5129, 418, 275, 283, 4391, 4993, 7, 267, 291, 14, 1637, 459, 983, 19765, 418, 275, 283, 1659, 281, 7, 267, 282, 63, 1574, 275, 291, 14, 1637, 14, 1574, 342, 267, 291, 14, 629, 8, 466, 8, 65, 63, 1574, 395, 1211, 9, 267, 291, 14, 629, 8, 65, 63, 1574, 12, 1211, 8, 1214, 679, 5129, 534, 4391, 4993, 297, 12927, 19765, 534, 1659, 281, 1333, 421, 199, 533, 1379, 8458, 2543, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 986, 339, 347, 6766, 8, 277, 304, 267, 986, 339, 347, 511, 63, 6083, 63, 705, 8, 277, 304, 267, 1021, 11977, 2377, 17, 8, 1563, 4437, 2377, 304, 355, 986, 267, 543, 291, 14, 1855, 8, 4333, 304, 288, 11977, 2377, 17, 342, 398, 1021, 11977, 2377, 18, 8, 1563, 4437, 2377, 304, 288, 347, 664, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 18, 12, 291, 680, 362, 8, 498, 9, 398, 543, 291, 14, 1855, 8, 4333, 304, 288, 11977, 2377, 18, 342, 339, 347, 511, 63, 6083, 63, 3742, 8, 277, 304, 267, 1021, 11977, 2377, 19, 8, 1563, 4437, 2377, 304, 288, 347, 664, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 362, 8, 498, 9, 953, 347, 663, 8, 277, 12, 790, 12, 574, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 409, 8, 498, 12, 574, 9, 953, 347, 2883, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1612, 342, 953, 347, 3509, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 6134, 8, 498, 9, 953, 347, 3145, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1807, 8, 498, 9, 953, 347, 8976, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 4939, 342, 953, 347, 1331, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1574, 342, 398, 291, 14, 6926, 8, 4437, 2377, 19, 1062, 11977, 2377, 19, 9, 339, 768, 2796, 14, 11278, 8, 10767, 63, 10293, 3263, 22492, 12, 283, 1548, 13, 32567, 859, 440, 4903, 358, 272, 347, 511, 63, 32567, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 14169, 5245, 4437, 1062, 30465, 5245, 4437, 9, 339, 347, 511, 63, 4844, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 8628, 4437, 1062, 15825, 4437, 9, 339, 768, 2796, 14, 11278, 8, 10767, 63, 907, 6178, 12, 283, 29605, 1134, 517, 265, 859, 440, 4903, 358, 272, 347, 511, 63, 15369, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 29605, 4437, 1062, 25496, 4437, 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 ]
[ 334, 67, 9, 6029, 13, 7806, 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, 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, 504, 3242, 14, 5819, 14, 2219, 492, 2882, 12, 1683, 199, 504, 3242, 14, 5265, 14, 1637, 492, 481, 2442, 4437, 199, 504, 3242, 14, 5265, 14, 1637, 14, 1095, 492, 3523, 4437, 2377, 199, 504, 3242, 14, 5265, 14, 1637, 14, 4844, 492, 11977, 2377, 465, 15825, 4437, 199, 199, 10767, 63, 10293, 3263, 22492, 275, 715, 199, 893, 26, 272, 492, 7573, 5245, 199, 2590, 3545, 26, 272, 25227, 63, 10293, 3263, 22492, 275, 756, 199, 2836, 26, 272, 327, 3645, 376, 587, 880, 626, 314, 1454, 4499, 781, 3372, 642, 365, 367, 29098, 402, 272, 327, 7573, 5245, 12, 440, 2552, 16306, 314, 3589, 272, 687, 3242, 14, 5265, 14, 1637, 14, 32567, 492, 11977, 2377, 465, 30465, 5245, 4437, 199, 199, 10767, 63, 907, 6178, 275, 715, 199, 893, 26, 272, 492, 16967, 199, 2590, 3545, 26, 272, 25227, 63, 907, 6178, 275, 756, 199, 2836, 26, 272, 687, 3242, 14, 5265, 14, 1637, 14, 15369, 492, 11977, 2377, 465, 25496, 4437, 421, 199, 533, 1379, 24704, 4437, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 543, 1683, 14, 2068, 360, 4853, 14, 5559, 14, 8677, 63, 19108, 297, 283, 4844, 735, 288, 291, 14, 1637, 275, 481, 2442, 4437, 342, 339, 347, 511, 63, 1574, 8, 277, 304, 267, 291, 14, 1637, 459, 1214, 679, 5129, 418, 275, 283, 4391, 4993, 7, 267, 291, 14, 1637, 459, 983, 19765, 418, 275, 283, 1659, 281, 7, 267, 282, 63, 1574, 275, 291, 14, 1637, 14, 1574, 342, 267, 291, 14, 629, 8, 466, 8, 65, 63, 1574, 395, 1211, 9, 267, 291, 14, 629, 8, 65, 63, 1574, 12, 1211, 8, 1214, 679, 5129, 534, 4391, 4993, 297, 12927, 19765, 534, 1659, 281, 1333, 421, 199, 533, 1379, 8458, 2543, 8, 2796, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 986, 339, 347, 6766, 8, 277, 304, 267, 986, 339, 347, 511, 63, 6083, 63, 705, 8, 277, 304, 267, 1021, 11977, 2377, 17, 8, 1563, 4437, 2377, 304, 355, 986, 267, 543, 291, 14, 1855, 8, 4333, 304, 288, 11977, 2377, 17, 342, 398, 1021, 11977, 2377, 18, 8, 1563, 4437, 2377, 304, 288, 347, 664, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 18, 12, 291, 680, 362, 8, 498, 9, 398, 543, 291, 14, 1855, 8, 4333, 304, 288, 11977, 2377, 18, 342, 339, 347, 511, 63, 6083, 63, 3742, 8, 277, 304, 267, 1021, 11977, 2377, 19, 8, 1563, 4437, 2377, 304, 288, 347, 664, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 362, 8, 498, 9, 953, 347, 663, 8, 277, 12, 790, 12, 574, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 409, 8, 498, 12, 574, 9, 953, 347, 2883, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1612, 342, 953, 347, 3509, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 6134, 8, 498, 9, 953, 347, 3145, 8, 277, 12, 790, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1807, 8, 498, 9, 953, 347, 8976, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 4939, 342, 953, 347, 1331, 8, 277, 304, 355, 1613, 8, 4437, 2377, 19, 12, 291, 680, 1574, 342, 398, 291, 14, 6926, 8, 4437, 2377, 19, 1062, 11977, 2377, 19, 9, 339, 768, 2796, 14, 11278, 8, 10767, 63, 10293, 3263, 22492, 12, 283, 1548, 13, 32567, 859, 440, 4903, 358, 272, 347, 511, 63, 32567, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 14169, 5245, 4437, 1062, 30465, 5245, 4437, 9, 339, 347, 511, 63, 4844, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 8628, 4437, 1062, 15825, 4437, 9, 339, 768, 2796, 14, 11278, 8, 10767, 63, 907, 6178, 12, 283, 29605, 1134, 517, 265, 859, 440, 4903, 358, 272, 347, 511, 63, 15369, 63, 1637, 578, 8, 277, 304, 267, 291, 14, 6926, 8, 29605, 4437, 1062, 25496, 4437, 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, 32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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 ]
lgbouma/astrobase
astrobase/emailutils.py
2
7441
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # emailutils.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jun 2013 # License: MIT. See LICENSE.txt for complete text. '''This is a small utility module to send email using an SMTP server that requires logins. The email settings are stored in a file called .emailsettings that should be located in the ~/.astrobase/ directory in your home directory. This file should have permissions 0600 (so only you can read/write to it), and should contain the following info in a single row, separated by the | character:: <email user>|<email password>|<email server> Example:: exampleuser@email.com|correcthorsebatterystaple|mail.example.com NOTE: This assumes the email server uses STARTTLS encryption and listens on SMTP port 587. Most email servers support this. ''' from email.mime.text import MIMEText from email.utils import formatdate, make_msgid import smtplib import socket import os.path import os import stat import time from datetime import datetime ## EMAIL SETTINGS ## # get config from the astrobase.conf file import configparser # parse the configuration file to get the default database credentials CONF_FILE = os.path.abspath(os.path.expanduser('~/.astrobase/astrobase.conf')) if not os.path.exists(CONF_FILE): # make the ~/.astrobase directory and copy over the astrobase.conf file to # it. import shutil # make the ~/.astrobase directory if it doesn't exist confpath = os.path.expanduser('~/.astrobase') if not os.path.exists(confpath): os.makedirs(confpath) modpath = os.path.dirname(os.path.abspath(__file__)) # copy over the astrobase.conf file to ~/.astrobase if it doesn't exist if not os.path.exists(os.path.join(confpath,'astrobase.conf')): shutil.copy(os.path.join(modpath,'astrobase.conf'), confpath) CONF_FILE = os.path.abspath( os.path.expanduser('~/.astrobase/astrobase.conf') ) CONF = configparser.ConfigParser() CONF.read(CONF_FILE) # # Now, check the conf file for email credentials # # first, check if the .emailsettings file exists and has permissions 0600 SETTINGSFILE = os.path.join(os.path.expanduser('~/.astrobase'), CONF.get('email','credentials')) if os.path.exists(SETTINGSFILE): # check if this file is readable/writeable by user only fileperm = oct(os.stat(SETTINGSFILE)[stat.ST_MODE]) # if we're good, read the settings if fileperm == '0100600' or fileperm == '0o100600': EMAIL_USER, EMAIL_PASSWORD, EMAIL_SERVER = open( SETTINGSFILE ).read().strip('\n').split('|') else: raise OSError('the email settings file %s has bad permissions ' '(you need to chmod 600 this file) and ' 'is insecure, not reading...' % SETTINGSFILE) else: print('the email settings file: %s does not exist!' % SETTINGSFILE) EMAIL_USER, EMAIL_PASSWORD, EMAIL_SERVER = None, None, None EMAIL_TEMPLATE = '''\ This is an automated notification from {sender} on {hostname}. Time: {activity_time} Report: {activity_report} ''' def send_email(sender, subject, content, email_recipient_list, email_address_list, email_user=None, email_pass=None, email_server=None): '''This sends an email to addresses, informing them about events. The email account settings are retrieved from the settings file as described above. Parameters ---------- sender : str The name of the sender to use in the email header. subject : str Subject of the email. content : str Content of the email. email_recipient list : list of str This is a list of email recipient names of the form: `['Example Person 1', 'Example Person 1', ...]` email_recipient list : list of str This is a list of email recipient addresses of the form: `['example1@example.com', 'example2@example.org', ...]` email_user : str The username of the email server account that will send the emails. If this is None, the value of EMAIL_USER from the ~/.astrobase/.emailsettings file will be used. If that is None as well, this function won't work. email_pass : str The password of the email server account that will send the emails. If this is None, the value of EMAIL_PASS from the ~/.astrobase/.emailsettings file will be used. If that is None as well, this function won't work. email_server : str The address of the email server that will send the emails. If this is None, the value of EMAIL_USER from the ~/.astrobase/.emailsettings file will be used. If that is None as well, this function won't work. Returns ------- bool True if email sending succeeded. False if email sending failed. ''' if not email_user: email_user = EMAIL_USER if not email_pass: email_pass = EMAIL_PASSWORD if not email_server: email_server = EMAIL_SERVER if not email_server and email_user and email_pass: raise ValueError("no email server address and " "credentials available, can't continue") msg_text = EMAIL_TEMPLATE.format( sender=sender, hostname=socket.gethostname(), activity_time='%sZ' % datetime.utcnow().isoformat(), activity_report=content ) email_sender = '%s <%s>' % (sender, EMAIL_USER) # put together the recipient and email lists email_recipients = [('%s <%s>' % (x,y)) for (x,y) in zip(email_recipient_list, email_address_list)] # put together the rest of the message email_msg = MIMEText(msg_text) email_msg['From'] = email_sender email_msg['To'] = ', '.join(email_recipients) email_msg['Message-Id'] = make_msgid() email_msg['Subject'] = '[%s on %s] %s' % ( sender, socket.gethostname(), subject ) email_msg['Date'] = formatdate(time.time()) # start the email process try: server = smtplib.SMTP(EMAIL_SERVER, 587) server.ehlo() if server.has_extn('STARTTLS'): try: server.starttls() server.ehlo() server.login(EMAIL_USER, EMAIL_PASSWORD) send_response = ( server.sendmail(email_sender, email_address_list, email_msg.as_string()) ) except Exception as e: print('script email sending failed with error: %s' % e) send_response = None if send_response is not None: print('script email sent successfully') server.quit() return True else: server.quit() return False else: print('email server does not support STARTTLS,' ' bailing out...') server.quit() return False except Exception as e: print('sending email failed with error: %s' % e) returnval = False server.quit() return returnval
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 3031, 1208, 14, 647, 446, 644, 30030, 305, 699, 8554, 280, 334, 6603, 8554, 280, 32, 1810, 293, 14, 2700, 2855, 1860, 14, 8654, 9, 446, 1603, 324, 6171, 199, 3, 844, 26, 10697, 14, 1666, 5113, 14, 2424, 367, 4890, 1318, 14, 199, 199, 2344, 2765, 365, 282, 7425, 11420, 859, 370, 3222, 3031, 1808, 376, 19810, 1654, 626, 199, 6537, 4676, 83, 14, 710, 3031, 2202, 787, 5489, 315, 282, 570, 2797, 1275, 2123, 1751, 199, 9099, 1077, 506, 16180, 315, 314, 25975, 1810, 293, 1095, 15, 2082, 315, 2195, 5629, 199, 3619, 14, 961, 570, 1077, 1172, 3443, 378, 6683, 334, 1152, 1454, 1265, 883, 1586, 15, 952, 370, 199, 390, 395, 436, 1077, 1395, 314, 2569, 2256, 315, 282, 2849, 1962, 12, 11673, 701, 314, 1204, 199, 10856, 447, 398, 665, 2123, 922, 21521, 28, 2123, 2505, 21521, 28, 2123, 1654, 30, 199, 199, 9846, 447, 398, 2893, 751, 32, 2123, 14, 957, 92, 989, 2761, 273, 9050, 21113, 270, 439, 274, 92, 1198, 14, 2694, 14, 957, 199, 199, 19855, 26, 961, 15194, 314, 3031, 1654, 4440, 4384, 689, 1481, 5296, 14396, 436, 1212, 1597, 561, 641, 19810, 199, 719, 959, 1555, 14, 17536, 3031, 8037, 2291, 642, 14, 199, 199, 2344, 199, 199, 504, 3031, 14, 7626, 14, 505, 492, 603, 26567, 199, 504, 3031, 14, 1208, 492, 1475, 602, 12, 1852, 63, 15245, 199, 646, 30475, 199, 646, 2838, 199, 199, 646, 747, 14, 515, 199, 646, 747, 199, 646, 5672, 199, 199, 646, 900, 199, 504, 2197, 492, 2197, 199, 199, 309, 32320, 11543, 52, 3881, 925, 199, 199, 3, 664, 1101, 687, 314, 6073, 293, 1095, 14, 2190, 570, 199, 646, 21230, 199, 199, 3, 2198, 314, 2897, 570, 370, 664, 314, 849, 3050, 6235, 199, 3103, 63, 3817, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 15, 1810, 293, 1095, 14, 2190, 1333, 199, 199, 692, 440, 747, 14, 515, 14, 2444, 8, 3103, 63, 3817, 304, 272, 327, 1852, 314, 25975, 1810, 293, 1095, 2082, 436, 1331, 1806, 314, 6073, 293, 1095, 14, 2190, 570, 370, 272, 327, 652, 14, 272, 492, 5145, 339, 327, 1852, 314, 25975, 1810, 293, 1095, 2082, 340, 652, 3181, 1133, 2187, 272, 3743, 515, 275, 747, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 358, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 2190, 515, 304, 267, 747, 14, 8347, 8, 2190, 515, 9, 272, 3413, 515, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 3460, 493, 8964, 339, 327, 1331, 1806, 314, 6073, 293, 1095, 14, 2190, 570, 370, 25975, 1810, 293, 1095, 340, 652, 3181, 1133, 2187, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 736, 14, 515, 14, 904, 8, 2190, 515, 2584, 1810, 293, 1095, 14, 2190, 8109, 267, 5145, 14, 1574, 8, 736, 14, 515, 14, 904, 8, 1494, 515, 2584, 1810, 293, 1095, 14, 2190, 659, 490, 3743, 515, 9, 421, 199, 3103, 63, 3817, 275, 747, 14, 515, 14, 4832, 8, 272, 747, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 15, 1810, 293, 1095, 14, 2190, 358, 199, 9, 199, 3103, 275, 21230, 14, 15218, 342, 199, 3103, 14, 739, 8, 3103, 63, 3817, 9, 199, 199, 3, 199, 3, 7356, 12, 1104, 314, 3743, 570, 367, 3031, 6235, 199, 3, 199, 199, 3, 1642, 12, 1104, 340, 314, 1275, 2123, 1751, 570, 3495, 436, 965, 3443, 378, 6683, 199, 13931, 3817, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 659, 1169, 6392, 14, 362, 360, 2123, 1673, 6942, 1333, 199, 199, 692, 747, 14, 515, 14, 2444, 8, 13931, 3817, 304, 339, 327, 1104, 340, 642, 570, 365, 12701, 15, 952, 461, 701, 922, 1454, 272, 570, 8220, 275, 17162, 8, 736, 14, 3736, 8, 13931, 3817, 2788, 3736, 14, 840, 63, 6963, 566, 339, 327, 340, 781, 3984, 6954, 12, 1586, 314, 2202, 272, 340, 570, 8220, 508, 283, 16569, 6683, 7, 503, 570, 8220, 508, 283, 16, 79, 1960, 6683, 356, 267, 32320, 63, 3791, 12, 32320, 63, 9032, 12, 32320, 63, 6613, 275, 1551, 8, 288, 11543, 52, 3881, 3817, 267, 7092, 739, 1252, 1913, 2258, 78, 1959, 1294, 20137, 358, 339, 587, 26, 267, 746, 6440, 360, 1589, 3031, 2202, 570, 450, 83, 965, 4875, 3443, 283, 1993, 8189, 13297, 1929, 370, 30106, 11624, 642, 570, 9, 436, 283, 1993, 283, 374, 26097, 12, 440, 7664, 13698, 1993, 450, 11543, 52, 3881, 3817, 9, 199, 2836, 26, 272, 870, 360, 1589, 3031, 2202, 570, 26, 450, 83, 1630, 440, 2187, 11213, 450, 11543, 52, 3881, 3817, 9, 272, 32320, 63, 3791, 12, 32320, 63, 9032, 12, 32320, 63, 6613, 275, 488, 12, 488, 12, 488, 199, 199, 10089, 63, 7433, 275, 18087, 199, 2765, 365, 376, 6384, 23513, 6955, 687, 469, 8114, 93, 641, 469, 4269, 5565, 199, 199, 1366, 26, 469, 8240, 63, 521, 93, 199, 199, 7457, 26, 199, 199, 91, 8240, 63, 3070, 93, 199, 199, 2344, 421, 199, 318, 3222, 63, 2123, 8, 8114, 12, 2049, 5420, 12, 2049, 1564, 12, 2049, 3031, 63, 10043, 63, 513, 12, 2049, 3031, 63, 1562, 63, 513, 12, 2049, 3031, 63, 751, 29, 403, 12, 2049, 3031, 63, 1529, 29, 403, 12, 2049, 3031, 63, 1000, 29, 403, 304, 272, 1449, 2765, 16178, 376, 3031, 370, 7149, 12, 315, 964, 316, 3062, 3595, 4474, 14, 339, 710, 3031, 2933, 2202, 787, 12396, 687, 314, 2202, 570, 465, 11736, 272, 3432, 14, 339, 3897, 272, 4143, 339, 8904, 520, 620, 267, 710, 536, 402, 314, 8904, 370, 675, 315, 314, 3031, 1406, 14, 339, 5420, 520, 620, 267, 26793, 402, 314, 3031, 14, 339, 1564, 520, 620, 267, 6646, 402, 314, 3031, 14, 339, 3031, 63, 10043, 769, 520, 769, 402, 620, 267, 961, 365, 282, 769, 402, 3031, 10318, 1561, 402, 314, 1824, 26, 267, 658, 459, 9846, 8028, 413, 297, 283, 9846, 8028, 413, 297, 2263, 16090 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 3031, 1208, 14, 647, 446, 644, 30030, 305, 699, 8554, 280, 334, 6603, 8554, 280, 32, 1810, 293, 14, 2700, 2855, 1860, 14, 8654, 9, 446, 1603, 324, 6171, 199, 3, 844, 26, 10697, 14, 1666, 5113, 14, 2424, 367, 4890, 1318, 14, 199, 199, 2344, 2765, 365, 282, 7425, 11420, 859, 370, 3222, 3031, 1808, 376, 19810, 1654, 626, 199, 6537, 4676, 83, 14, 710, 3031, 2202, 787, 5489, 315, 282, 570, 2797, 1275, 2123, 1751, 199, 9099, 1077, 506, 16180, 315, 314, 25975, 1810, 293, 1095, 15, 2082, 315, 2195, 5629, 199, 3619, 14, 961, 570, 1077, 1172, 3443, 378, 6683, 334, 1152, 1454, 1265, 883, 1586, 15, 952, 370, 199, 390, 395, 436, 1077, 1395, 314, 2569, 2256, 315, 282, 2849, 1962, 12, 11673, 701, 314, 1204, 199, 10856, 447, 398, 665, 2123, 922, 21521, 28, 2123, 2505, 21521, 28, 2123, 1654, 30, 199, 199, 9846, 447, 398, 2893, 751, 32, 2123, 14, 957, 92, 989, 2761, 273, 9050, 21113, 270, 439, 274, 92, 1198, 14, 2694, 14, 957, 199, 199, 19855, 26, 961, 15194, 314, 3031, 1654, 4440, 4384, 689, 1481, 5296, 14396, 436, 1212, 1597, 561, 641, 19810, 199, 719, 959, 1555, 14, 17536, 3031, 8037, 2291, 642, 14, 199, 199, 2344, 199, 199, 504, 3031, 14, 7626, 14, 505, 492, 603, 26567, 199, 504, 3031, 14, 1208, 492, 1475, 602, 12, 1852, 63, 15245, 199, 646, 30475, 199, 646, 2838, 199, 199, 646, 747, 14, 515, 199, 646, 747, 199, 646, 5672, 199, 199, 646, 900, 199, 504, 2197, 492, 2197, 199, 199, 309, 32320, 11543, 52, 3881, 925, 199, 199, 3, 664, 1101, 687, 314, 6073, 293, 1095, 14, 2190, 570, 199, 646, 21230, 199, 199, 3, 2198, 314, 2897, 570, 370, 664, 314, 849, 3050, 6235, 199, 3103, 63, 3817, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 15, 1810, 293, 1095, 14, 2190, 1333, 199, 199, 692, 440, 747, 14, 515, 14, 2444, 8, 3103, 63, 3817, 304, 272, 327, 1852, 314, 25975, 1810, 293, 1095, 2082, 436, 1331, 1806, 314, 6073, 293, 1095, 14, 2190, 570, 370, 272, 327, 652, 14, 272, 492, 5145, 339, 327, 1852, 314, 25975, 1810, 293, 1095, 2082, 340, 652, 3181, 1133, 2187, 272, 3743, 515, 275, 747, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 358, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 2190, 515, 304, 267, 747, 14, 8347, 8, 2190, 515, 9, 272, 3413, 515, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 3460, 493, 8964, 339, 327, 1331, 1806, 314, 6073, 293, 1095, 14, 2190, 570, 370, 25975, 1810, 293, 1095, 340, 652, 3181, 1133, 2187, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 736, 14, 515, 14, 904, 8, 2190, 515, 2584, 1810, 293, 1095, 14, 2190, 8109, 267, 5145, 14, 1574, 8, 736, 14, 515, 14, 904, 8, 1494, 515, 2584, 1810, 293, 1095, 14, 2190, 659, 490, 3743, 515, 9, 421, 199, 3103, 63, 3817, 275, 747, 14, 515, 14, 4832, 8, 272, 747, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 15, 1810, 293, 1095, 14, 2190, 358, 199, 9, 199, 3103, 275, 21230, 14, 15218, 342, 199, 3103, 14, 739, 8, 3103, 63, 3817, 9, 199, 199, 3, 199, 3, 7356, 12, 1104, 314, 3743, 570, 367, 3031, 6235, 199, 3, 199, 199, 3, 1642, 12, 1104, 340, 314, 1275, 2123, 1751, 570, 3495, 436, 965, 3443, 378, 6683, 199, 13931, 3817, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 12131, 21114, 8083, 1810, 293, 1095, 659, 1169, 6392, 14, 362, 360, 2123, 1673, 6942, 1333, 199, 199, 692, 747, 14, 515, 14, 2444, 8, 13931, 3817, 304, 339, 327, 1104, 340, 642, 570, 365, 12701, 15, 952, 461, 701, 922, 1454, 272, 570, 8220, 275, 17162, 8, 736, 14, 3736, 8, 13931, 3817, 2788, 3736, 14, 840, 63, 6963, 566, 339, 327, 340, 781, 3984, 6954, 12, 1586, 314, 2202, 272, 340, 570, 8220, 508, 283, 16569, 6683, 7, 503, 570, 8220, 508, 283, 16, 79, 1960, 6683, 356, 267, 32320, 63, 3791, 12, 32320, 63, 9032, 12, 32320, 63, 6613, 275, 1551, 8, 288, 11543, 52, 3881, 3817, 267, 7092, 739, 1252, 1913, 2258, 78, 1959, 1294, 20137, 358, 339, 587, 26, 267, 746, 6440, 360, 1589, 3031, 2202, 570, 450, 83, 965, 4875, 3443, 283, 1993, 8189, 13297, 1929, 370, 30106, 11624, 642, 570, 9, 436, 283, 1993, 283, 374, 26097, 12, 440, 7664, 13698, 1993, 450, 11543, 52, 3881, 3817, 9, 199, 2836, 26, 272, 870, 360, 1589, 3031, 2202, 570, 26, 450, 83, 1630, 440, 2187, 11213, 450, 11543, 52, 3881, 3817, 9, 272, 32320, 63, 3791, 12, 32320, 63, 9032, 12, 32320, 63, 6613, 275, 488, 12, 488, 12, 488, 199, 199, 10089, 63, 7433, 275, 18087, 199, 2765, 365, 376, 6384, 23513, 6955, 687, 469, 8114, 93, 641, 469, 4269, 5565, 199, 199, 1366, 26, 469, 8240, 63, 521, 93, 199, 199, 7457, 26, 199, 199, 91, 8240, 63, 3070, 93, 199, 199, 2344, 421, 199, 318, 3222, 63, 2123, 8, 8114, 12, 2049, 5420, 12, 2049, 1564, 12, 2049, 3031, 63, 10043, 63, 513, 12, 2049, 3031, 63, 1562, 63, 513, 12, 2049, 3031, 63, 751, 29, 403, 12, 2049, 3031, 63, 1529, 29, 403, 12, 2049, 3031, 63, 1000, 29, 403, 304, 272, 1449, 2765, 16178, 376, 3031, 370, 7149, 12, 315, 964, 316, 3062, 3595, 4474, 14, 339, 710, 3031, 2933, 2202, 787, 12396, 687, 314, 2202, 570, 465, 11736, 272, 3432, 14, 339, 3897, 272, 4143, 339, 8904, 520, 620, 267, 710, 536, 402, 314, 8904, 370, 675, 315, 314, 3031, 1406, 14, 339, 5420, 520, 620, 267, 26793, 402, 314, 3031, 14, 339, 1564, 520, 620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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 ]
chonix/trinity
tools/perf/scripts/python/failed-syscalls-by-pid.py
11180
2058
# failed system call counts, by pid # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide failed system call totals, broken down by pid. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os import sys 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 syscall-counts-by-pid.py [comm|pid]\n"; for_comm = None for_pid = None if len(sys.argv) > 2: sys.exit(usage) if len(sys.argv) > 1: try: for_pid = int(sys.argv[1]) except: for_comm = sys.argv[1] syscalls = autodict() def trace_begin(): print "Press control+C to stop and show the summary" def trace_end(): print_error_totals() def raw_syscalls__sys_exit(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, id, ret): if (for_comm and common_comm != for_comm) or \ (for_pid and common_pid != for_pid ): return if ret < 0: try: syscalls[common_comm][common_pid][id][ret] += 1 except TypeError: syscalls[common_comm][common_pid][id][ret] = 1 def print_error_totals(): if for_comm is not None: print "\nsyscall errors for %s:\n\n" % (for_comm), else: print "\nsyscall errors:\n\n", print "%-30s %10s\n" % ("comm [pid]", "count"), print "%-30s %10s\n" % ("------------------------------", \ "----------"), comm_keys = syscalls.keys() for comm in comm_keys: pid_keys = syscalls[comm].keys() for pid in pid_keys: print "\n%s [%d]\n" % (comm, pid), id_keys = syscalls[comm][pid].keys() for id in id_keys: print " syscall: %-16s\n" % syscall_name(id), ret_keys = syscalls[comm][pid][id].keys() for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k), reverse = True): print " err = %-20s %10d\n" % (strerror(ret), val),
gpl-2.0
[ 3, 3405, 2656, 1240, 8242, 12, 701, 4422, 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, 28750, 2656, 13, 13062, 3405, 2656, 1240, 23576, 12, 10529, 3224, 701, 4422, 14, 199, 3, 982, 282, 359, 1404, 61, 1680, 365, 2013, 12, 1454, 19473, 2797, 701, 359, 1404, 61, 787, 9080, 14, 199, 199, 646, 747, 199, 646, 984, 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, 18901, 13, 6851, 13, 991, 13, 3150, 14, 647, 359, 1404, 92, 3150, 7272, 78, 11436, 199, 199, 509, 63, 1404, 275, 488, 199, 509, 63, 3150, 275, 488, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 499, 26, 199, 198, 1274, 14, 2224, 8, 3807, 9, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 413, 26, 199, 198, 893, 26, 507, 198, 509, 63, 3150, 275, 1109, 8, 1274, 14, 3020, 59, 17, 566, 199, 198, 2590, 26, 507, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 14507, 275, 27477, 342, 199, 199, 318, 3307, 63, 5037, 837, 199, 198, 1361, 298, 14414, 3304, 11, 35, 370, 3631, 436, 2498, 314, 6212, 2, 199, 199, 318, 3307, 63, 500, 837, 199, 198, 1361, 63, 705, 63, 17552, 342, 199, 199, 318, 3066, 63, 14507, 363, 1274, 63, 2224, 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, 2203, 304, 199, 198, 692, 334, 509, 63, 1404, 436, 2863, 63, 1404, 1137, 367, 63, 1404, 9, 503, 971, 21979, 334, 509, 63, 3150, 221, 436, 2863, 63, 3150, 221, 1137, 367, 63, 3150, 3461, 507, 198, 1107, 421, 198, 692, 2203, 665, 378, 26, 507, 198, 893, 26, 686, 198, 14507, 59, 2330, 63, 1404, 1527, 2330, 63, 3150, 1527, 344, 1527, 3292, 61, 847, 413, 507, 198, 2590, 3146, 26, 686, 198, 14507, 59, 2330, 63, 1404, 1527, 2330, 63, 3150, 1527, 344, 1527, 3292, 61, 275, 413, 199, 199, 318, 870, 63, 705, 63, 17552, 837, 272, 340, 367, 63, 1404, 365, 440, 488, 26, 6722, 870, 1867, 26605, 2552, 367, 450, 83, 3427, 78, 60, 78, 2, 450, 334, 509, 63, 1404, 395, 272, 587, 26, 6722, 870, 1867, 26605, 2552, 3427, 78, 60, 78, 401, 339, 870, 18301, 1216, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 1404, 359, 3150, 11472, 298, 835, 1288, 272, 870, 18301, 1216, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 777, 10965, 401, 971, 639, 298, 9460, 1288, 339, 1923, 63, 1612, 275, 19473, 14, 1612, 342, 272, 367, 1923, 315, 1923, 63, 1612, 26, 6722, 4422, 63, 1612, 275, 19473, 59, 1404, 1055, 1612, 342, 6722, 367, 4422, 315, 4422, 63, 1612, 26, 15075, 870, 1867, 78, 5, 83, 8978, 68, 7272, 78, 2, 450, 334, 1404, 12, 4422, 395, 15075, 1305, 63, 1612, 275, 19473, 59, 1404, 1527, 3150, 1055, 1612, 342, 15075, 367, 1305, 315, 1305, 63, 1612, 26, 24449, 870, 298, 221, 18901, 26, 19752, 975, 83, 60, 78, 2, 450, 18901, 63, 354, 8, 344, 395, 24449, 2203, 63, 1612, 275, 19473, 59, 1404, 1527, 3150, 1527, 344, 1055, 1612, 342, 24449, 367, 2203, 12, 1139, 315, 3355, 8, 14507, 59, 1404, 1527, 3150, 1527, 344, 1055, 4611, 1062, 790, 275, 2400, 8, 75, 12, 373, 304, 334, 86, 12, 1022, 395, 221, 3837, 275, 715, 304, 1871, 259, 870, 298, 259, 2329, 275, 19752, 1165, 83, 221, 450, 709, 68, 60, 78, 2, 450, 334, 20395, 8, 3292, 395, 1139, 395, 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 ]
[ 3405, 2656, 1240, 8242, 12, 701, 4422, 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, 28750, 2656, 13, 13062, 3405, 2656, 1240, 23576, 12, 10529, 3224, 701, 4422, 14, 199, 3, 982, 282, 359, 1404, 61, 1680, 365, 2013, 12, 1454, 19473, 2797, 701, 359, 1404, 61, 787, 9080, 14, 199, 199, 646, 747, 199, 646, 984, 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, 18901, 13, 6851, 13, 991, 13, 3150, 14, 647, 359, 1404, 92, 3150, 7272, 78, 11436, 199, 199, 509, 63, 1404, 275, 488, 199, 509, 63, 3150, 275, 488, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 499, 26, 199, 198, 1274, 14, 2224, 8, 3807, 9, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 690, 413, 26, 199, 198, 893, 26, 507, 198, 509, 63, 3150, 275, 1109, 8, 1274, 14, 3020, 59, 17, 566, 199, 198, 2590, 26, 507, 198, 509, 63, 1404, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 14507, 275, 27477, 342, 199, 199, 318, 3307, 63, 5037, 837, 199, 198, 1361, 298, 14414, 3304, 11, 35, 370, 3631, 436, 2498, 314, 6212, 2, 199, 199, 318, 3307, 63, 500, 837, 199, 198, 1361, 63, 705, 63, 17552, 342, 199, 199, 318, 3066, 63, 14507, 363, 1274, 63, 2224, 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, 2203, 304, 199, 198, 692, 334, 509, 63, 1404, 436, 2863, 63, 1404, 1137, 367, 63, 1404, 9, 503, 971, 21979, 334, 509, 63, 3150, 221, 436, 2863, 63, 3150, 221, 1137, 367, 63, 3150, 3461, 507, 198, 1107, 421, 198, 692, 2203, 665, 378, 26, 507, 198, 893, 26, 686, 198, 14507, 59, 2330, 63, 1404, 1527, 2330, 63, 3150, 1527, 344, 1527, 3292, 61, 847, 413, 507, 198, 2590, 3146, 26, 686, 198, 14507, 59, 2330, 63, 1404, 1527, 2330, 63, 3150, 1527, 344, 1527, 3292, 61, 275, 413, 199, 199, 318, 870, 63, 705, 63, 17552, 837, 272, 340, 367, 63, 1404, 365, 440, 488, 26, 6722, 870, 1867, 26605, 2552, 367, 450, 83, 3427, 78, 60, 78, 2, 450, 334, 509, 63, 1404, 395, 272, 587, 26, 6722, 870, 1867, 26605, 2552, 3427, 78, 60, 78, 401, 339, 870, 18301, 1216, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 1404, 359, 3150, 11472, 298, 835, 1288, 272, 870, 18301, 1216, 83, 221, 450, 709, 83, 60, 78, 2, 450, 1689, 777, 10965, 401, 971, 639, 298, 9460, 1288, 339, 1923, 63, 1612, 275, 19473, 14, 1612, 342, 272, 367, 1923, 315, 1923, 63, 1612, 26, 6722, 4422, 63, 1612, 275, 19473, 59, 1404, 1055, 1612, 342, 6722, 367, 4422, 315, 4422, 63, 1612, 26, 15075, 870, 1867, 78, 5, 83, 8978, 68, 7272, 78, 2, 450, 334, 1404, 12, 4422, 395, 15075, 1305, 63, 1612, 275, 19473, 59, 1404, 1527, 3150, 1055, 1612, 342, 15075, 367, 1305, 315, 1305, 63, 1612, 26, 24449, 870, 298, 221, 18901, 26, 19752, 975, 83, 60, 78, 2, 450, 18901, 63, 354, 8, 344, 395, 24449, 2203, 63, 1612, 275, 19473, 59, 1404, 1527, 3150, 1527, 344, 1055, 1612, 342, 24449, 367, 2203, 12, 1139, 315, 3355, 8, 14507, 59, 1404, 1527, 3150, 1527, 344, 1055, 4611, 1062, 790, 275, 2400, 8, 75, 12, 373, 304, 334, 86, 12, 1022, 395, 221, 3837, 275, 715, 304, 1871, 259, 870, 298, 259, 2329, 275, 19752, 1165, 83, 221, 450, 709, 68, 60, 78, 2, 450, 334, 20395, 8, 3292, 395, 1139, 395, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
inares/edx-platform
common/djangoapps/request_cache/__init__.py
51
1910
""" A cache that is cleared after every request. This module requires that :class:`request_cache.middleware.RequestCache` is installed in order to clear the cache after each request. """ import logging from urlparse import urlparse from django.conf import settings from django.test.client import RequestFactory from request_cache import middleware log = logging.getLogger(__name__) def get_cache(name): """ Return the request cache named ``name``. Arguments: name (str): The name of the request cache to load Returns: dict """ return middleware.RequestCache.get_request_cache(name) def get_request(): """ Return the current request. """ return middleware.RequestCache.get_current_request() def get_request_or_stub(): """ Return the current request or a stub request. If called outside the context of a request, construct a fake request that can be used to build an absolute URI. This is useful in cases where we need to pass in a request object but don't have an active request (for example, in test cases). """ request = get_request() if request is None: log.warning( "Could not retrieve the current request. " "A stub request will be created instead using settings.SITE_NAME. " "This should be used *only* in test cases, never in production!" ) # The settings SITE_NAME may contain a port number, so we need to # parse the full URL. full_url = "http://{site_name}".format(site_name=settings.SITE_NAME) parsed_url = urlparse(full_url) # Construct the fake request. This can be used to construct absolute # URIs to other paths. return RequestFactory( SERVER_NAME=parsed_url.hostname, SERVER_PORT=parsed_url.port or 80, ).get("/") else: return request
agpl-3.0
[ 624, 199, 33, 2581, 626, 365, 20518, 2410, 4036, 1056, 14, 199, 199, 2765, 859, 5074, 626, 520, 533, 1705, 1069, 63, 1637, 14, 5754, 14, 2017, 4437, 64, 199, 374, 4903, 315, 1865, 370, 5436, 314, 2581, 2410, 1924, 1056, 14, 199, 624, 199, 199, 646, 2050, 199, 504, 7097, 492, 7097, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 199, 504, 1056, 63, 1637, 492, 10816, 421, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 664, 63, 1637, 8, 354, 304, 272, 408, 272, 1432, 314, 1056, 2581, 4310, 1124, 354, 4345, 339, 7628, 26, 267, 536, 334, 495, 304, 710, 536, 402, 314, 1056, 2581, 370, 2248, 339, 1803, 26, 1211, 272, 408, 272, 372, 10816, 14, 2017, 4437, 14, 362, 63, 1069, 63, 1637, 8, 354, 9, 421, 199, 318, 664, 63, 1069, 837, 272, 408, 272, 1432, 314, 1453, 1056, 14, 272, 408, 272, 372, 10816, 14, 2017, 4437, 14, 362, 63, 1818, 63, 1069, 342, 421, 199, 318, 664, 63, 1069, 63, 269, 63, 5811, 837, 272, 408, 272, 1432, 314, 1453, 1056, 503, 282, 10098, 1056, 14, 339, 982, 2797, 9682, 314, 1067, 402, 282, 1056, 12, 6982, 282, 4026, 272, 1056, 626, 883, 506, 1202, 370, 1900, 376, 3679, 9022, 14, 339, 961, 365, 2997, 315, 5560, 2382, 781, 1929, 370, 986, 315, 282, 1056, 909, 272, 1325, 2793, 1133, 1172, 376, 4702, 1056, 334, 509, 2893, 12, 315, 511, 5560, 680, 272, 408, 272, 1056, 275, 664, 63, 1069, 342, 339, 340, 1056, 365, 488, 26, 267, 943, 14, 3764, 8, 288, 298, 6531, 440, 8044, 314, 1453, 1056, 14, 221, 298, 288, 298, 33, 10098, 1056, 911, 506, 2737, 3140, 1808, 2202, 14, 7917, 63, 2339, 14, 221, 298, 288, 298, 2765, 1077, 506, 1202, 627, 2118, 10, 315, 511, 5560, 12, 7078, 315, 9920, 9539, 267, 776, 398, 327, 710, 2202, 428, 4427, 63, 2339, 1443, 1395, 282, 1844, 1329, 12, 880, 781, 1929, 370, 267, 327, 2198, 314, 2615, 2851, 14, 267, 2615, 63, 633, 275, 298, 1014, 20193, 2124, 63, 354, 5469, 908, 8, 2124, 63, 354, 29, 1751, 14, 7917, 63, 2339, 9, 267, 4565, 63, 633, 275, 7097, 8, 2861, 63, 633, 9, 398, 327, 9215, 314, 4026, 1056, 14, 221, 961, 883, 506, 1202, 370, 6982, 3679, 267, 327, 30143, 370, 1163, 3792, 14, 267, 372, 18638, 8, 288, 23578, 63, 2339, 29, 6751, 63, 633, 14, 4269, 12, 288, 23578, 63, 3657, 29, 6751, 63, 633, 14, 719, 503, 5939, 12, 267, 7092, 362, 19031, 339, 587, 26, 267, 372, 1056, 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 ]
[ 199, 33, 2581, 626, 365, 20518, 2410, 4036, 1056, 14, 199, 199, 2765, 859, 5074, 626, 520, 533, 1705, 1069, 63, 1637, 14, 5754, 14, 2017, 4437, 64, 199, 374, 4903, 315, 1865, 370, 5436, 314, 2581, 2410, 1924, 1056, 14, 199, 624, 199, 199, 646, 2050, 199, 504, 7097, 492, 7097, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 199, 504, 1056, 63, 1637, 492, 10816, 421, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 664, 63, 1637, 8, 354, 304, 272, 408, 272, 1432, 314, 1056, 2581, 4310, 1124, 354, 4345, 339, 7628, 26, 267, 536, 334, 495, 304, 710, 536, 402, 314, 1056, 2581, 370, 2248, 339, 1803, 26, 1211, 272, 408, 272, 372, 10816, 14, 2017, 4437, 14, 362, 63, 1069, 63, 1637, 8, 354, 9, 421, 199, 318, 664, 63, 1069, 837, 272, 408, 272, 1432, 314, 1453, 1056, 14, 272, 408, 272, 372, 10816, 14, 2017, 4437, 14, 362, 63, 1818, 63, 1069, 342, 421, 199, 318, 664, 63, 1069, 63, 269, 63, 5811, 837, 272, 408, 272, 1432, 314, 1453, 1056, 503, 282, 10098, 1056, 14, 339, 982, 2797, 9682, 314, 1067, 402, 282, 1056, 12, 6982, 282, 4026, 272, 1056, 626, 883, 506, 1202, 370, 1900, 376, 3679, 9022, 14, 339, 961, 365, 2997, 315, 5560, 2382, 781, 1929, 370, 986, 315, 282, 1056, 909, 272, 1325, 2793, 1133, 1172, 376, 4702, 1056, 334, 509, 2893, 12, 315, 511, 5560, 680, 272, 408, 272, 1056, 275, 664, 63, 1069, 342, 339, 340, 1056, 365, 488, 26, 267, 943, 14, 3764, 8, 288, 298, 6531, 440, 8044, 314, 1453, 1056, 14, 221, 298, 288, 298, 33, 10098, 1056, 911, 506, 2737, 3140, 1808, 2202, 14, 7917, 63, 2339, 14, 221, 298, 288, 298, 2765, 1077, 506, 1202, 627, 2118, 10, 315, 511, 5560, 12, 7078, 315, 9920, 9539, 267, 776, 398, 327, 710, 2202, 428, 4427, 63, 2339, 1443, 1395, 282, 1844, 1329, 12, 880, 781, 1929, 370, 267, 327, 2198, 314, 2615, 2851, 14, 267, 2615, 63, 633, 275, 298, 1014, 20193, 2124, 63, 354, 5469, 908, 8, 2124, 63, 354, 29, 1751, 14, 7917, 63, 2339, 9, 267, 4565, 63, 633, 275, 7097, 8, 2861, 63, 633, 9, 398, 327, 9215, 314, 4026, 1056, 14, 221, 961, 883, 506, 1202, 370, 6982, 3679, 267, 327, 30143, 370, 1163, 3792, 14, 267, 372, 18638, 8, 288, 23578, 63, 2339, 29, 6751, 63, 633, 14, 4269, 12, 288, 23578, 63, 3657, 29, 6751, 63, 633, 14, 719, 503, 5939, 12, 267, 7092, 362, 19031, 339, 587, 26, 267, 372, 1056, 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, 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,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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 ]
bwilcox-1234/ChatScript
SRC/curl/curl-7.56.1/tests/http_pipe.py
41
14039
#!/usr/bin/python # Copyright 2012 Google 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 # # 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. # # Modified by Linus Nielsen Feltzing for inclusion in the libcurl test # framework # try: import socketserver except: import SocketServer as socketserver import argparse import re import select import socket import time import pprint import os INFO_MESSAGE = ''' This is a test server to test the libcurl pipelining functionality. It is a modified version if Google's HTTP pipelining test server. More information can be found here: https://dev.chromium.org/developers/design-documents/network-stack/http-pipelining Source code can be found here: https://code.google.com/archive/p/http-pipelining-test/ ''' MAX_REQUEST_SIZE = 1024 # bytes MIN_POLL_TIME = 0.01 # seconds. Minimum time to poll, in order to prevent # excessive looping because Python refuses to poll for # small timeouts. SEND_BUFFER_TIME = 0.5 # seconds TIMEOUT = 30 # seconds class Error(Exception): pass class RequestTooLargeError(Error): pass class ServeIndexError(Error): pass class UnexpectedMethodError(Error): pass class RequestParser(object): """Parses an input buffer looking for HTTP GET requests.""" global logfile LOOKING_FOR_GET = 1 READING_HEADERS = 2 HEADER_RE = re.compile('([^:]+):(.*)\n') REQUEST_RE = re.compile('([^ ]+) ([^ ]+) HTTP/(\d+)\.(\d+)\n') def __init__(self): """Initializer.""" self._buffer = "" self._pending_headers = {} self._pending_request = "" self._state = self.LOOKING_FOR_GET self._were_all_requests_http_1_1 = True self._valid_requests = [] def ParseAdditionalData(self, data): """Finds HTTP requests in |data|. Args: data: (String) Newly received input data from the socket. Returns: (List of Tuples) (String) The request path. (Map of String to String) The header name and value. Raises: RequestTooLargeError: If the request exceeds MAX_REQUEST_SIZE. UnexpectedMethodError: On a non-GET method. Error: On a programming error. """ logfile = open('log/server.input', 'a') logfile.write(data) logfile.close() self._buffer += data.replace('\r', '') should_continue_parsing = True while should_continue_parsing: if self._state == self.LOOKING_FOR_GET: should_continue_parsing = self._DoLookForGet() elif self._state == self.READING_HEADERS: should_continue_parsing = self._DoReadHeader() else: raise Error('Unexpected state: ' + self._state) if len(self._buffer) > MAX_REQUEST_SIZE: raise RequestTooLargeError( 'Request is at least %d bytes' % len(self._buffer)) valid_requests = self._valid_requests self._valid_requests = [] return valid_requests @property def were_all_requests_http_1_1(self): return self._were_all_requests_http_1_1 def _DoLookForGet(self): """Tries to parse an HTTTP request line. Returns: (Boolean) True if a request was found. Raises: UnexpectedMethodError: On a non-GET method. """ m = self.REQUEST_RE.match(self._buffer) if not m: return False method, path, http_major, http_minor = m.groups() if method != 'GET': raise UnexpectedMethodError('Unexpected method: ' + method) if path in ['/', '/index.htm', '/index.html']: raise ServeIndexError() if http_major != '1' or http_minor != '1': self._were_all_requests_http_1_1 = False # print method, path self._pending_request = path self._buffer = self._buffer[m.end():] self._state = self.READING_HEADERS return True def _DoReadHeader(self): """Tries to parse a HTTP header. Returns: (Boolean) True if it found the end of the request or a HTTP header. """ if self._buffer.startswith('\n'): self._buffer = self._buffer[1:] self._state = self.LOOKING_FOR_GET self._valid_requests.append((self._pending_request, self._pending_headers)) self._pending_headers = {} self._pending_request = "" return True m = self.HEADER_RE.match(self._buffer) if not m: return False header = m.group(1).lower() value = m.group(2).strip().lower() if header not in self._pending_headers: self._pending_headers[header] = value self._buffer = self._buffer[m.end():] return True class ResponseBuilder(object): """Builds HTTP responses for a list of accumulated requests.""" def __init__(self): """Initializer.""" self._max_pipeline_depth = 0 self._requested_paths = [] self._processed_end = False self._were_all_requests_http_1_1 = True def QueueRequests(self, requested_paths, were_all_requests_http_1_1): """Adds requests to the queue of requests. Args: requested_paths: (List of Strings) Requested paths. """ self._requested_paths.extend(requested_paths) self._were_all_requests_http_1_1 = were_all_requests_http_1_1 def Chunkify(self, data, chunksize): """ Divides a string into chunks """ return [hex(chunksize)[2:] + "\r\n" + data[i:i+chunksize] + "\r\n" for i in range(0, len(data), chunksize)] def BuildResponses(self): """Converts the queue of requests into responses. Returns: (String) Buffer containing all of the responses. """ result = "" self._max_pipeline_depth = max(self._max_pipeline_depth, len(self._requested_paths)) for path, headers in self._requested_paths: if path == '/verifiedserver': body = "WE ROOLZ: {}\r\n".format(os.getpid()); result += self._BuildResponse( '200 OK', ['Server: Apache', 'Content-Length: {}'.format(len(body)), 'Cache-Control: no-store'], body) elif path == '/alphabet.txt': body = 'abcdefghijklmnopqrstuvwxyz' result += self._BuildResponse( '200 OK', ['Server: Apache', 'Content-Length: 26', 'Cache-Control: no-store'], body) elif path == '/reverse.txt': body = 'zyxwvutsrqponmlkjihgfedcba' result += self._BuildResponse( '200 OK', ['Content-Length: 26', 'Cache-Control: no-store'], body) elif path == '/chunked.txt': body = ('7\r\nchunked\r\n' '8\r\nencoding\r\n' '2\r\nis\r\n' '3\r\nfun\r\n' '0\r\n\r\n') result += self._BuildResponse( '200 OK', ['Transfer-Encoding: chunked', 'Cache-Control: no-store'], body) elif path == '/cached.txt': body = 'azbycxdwevfugthsirjqkplomn' result += self._BuildResponse( '200 OK', ['Content-Length: 26', 'Cache-Control: max-age=60'], body) elif path == '/connection_close.txt': body = 'azbycxdwevfugthsirjqkplomn' result += self._BuildResponse( '200 OK', ['Content-Length: 26', 'Cache-Control: max-age=60', 'Connection: close'], body) self._processed_end = True elif path == '/1k.txt': body = '0123456789abcdef' * 64 result += self._BuildResponse( '200 OK', ['Server: Apache', 'Content-Length: 1024', 'Cache-Control: max-age=60'], body) elif path == '/10k.txt': body = '0123456789abcdef' * 640 result += self._BuildResponse( '200 OK', ['Server: Apache', 'Content-Length: 10240', 'Cache-Control: max-age=60'], body) elif path == '/100k.txt': body = '0123456789abcdef' * 6400 result += self._BuildResponse( '200 OK', ['Server: Apache', 'Content-Length: 102400', 'Cache-Control: max-age=60'], body) elif path == '/100k_chunked.txt': body = self.Chunkify('0123456789abcdef' * 6400, 20480) body.append('0\r\n\r\n') body = ''.join(body) result += self._BuildResponse( '200 OK', ['Transfer-Encoding: chunked', 'Cache-Control: no-store'], body) elif path == '/stats.txt': results = { 'max_pipeline_depth': self._max_pipeline_depth, 'were_all_requests_http_1_1': int(self._were_all_requests_http_1_1), } body = ','.join(['%s:%s' % (k, v) for k, v in results.items()]) result += self._BuildResponse( '200 OK', ['Content-Length: %s' % len(body), 'Cache-Control: no-store'], body) self._processed_end = True else: result += self._BuildResponse('404 Not Found', ['Content-Length: 7'], 'Go away') if self._processed_end: break self._requested_paths = [] return result def WriteError(self, status, error): """Returns an HTTP response for the specified error. Args: status: (String) Response code and descrtion (e.g. "404 Not Found") Returns: (String) Text of HTTP response. """ return self._BuildResponse( status, ['Connection: close', 'Content-Type: text/plain'], error) @property def processed_end(self): return self._processed_end def _BuildResponse(self, status, headers, body): """Builds an HTTP response. Args: status: (String) Response code and descrtion (e.g. "200 OK") headers: (List of Strings) Headers (e.g. "Connection: close") body: (String) Response body. Returns: (String) Text of HTTP response. """ return ('HTTP/1.1 %s\r\n' '%s\r\n' '\r\n' '%s' % (status, '\r\n'.join(headers), body)) class PipelineRequestHandler(socketserver.BaseRequestHandler): """Called on an incoming TCP connection.""" def _GetTimeUntilTimeout(self): return self._start_time + TIMEOUT - time.time() def _GetTimeUntilNextSend(self): if not self._last_queued_time: return TIMEOUT return self._last_queued_time + SEND_BUFFER_TIME - time.time() def handle(self): self._request_parser = RequestParser() self._response_builder = ResponseBuilder() self._last_queued_time = 0 self._num_queued = 0 self._num_written = 0 self._send_buffer = "" self._start_time = time.time() try: while not self._response_builder.processed_end or self._send_buffer: time_left = self._GetTimeUntilTimeout() time_until_next_send = self._GetTimeUntilNextSend() max_poll_time = min(time_left, time_until_next_send) + MIN_POLL_TIME rlist, wlist, xlist = [], [], [] fileno = self.request.fileno() if max_poll_time > 0: rlist.append(fileno) if self._send_buffer: wlist.append(fileno) rlist, wlist, xlist = select.select(rlist, wlist, xlist, max_poll_time) if self._GetTimeUntilTimeout() <= 0: return if self._GetTimeUntilNextSend() <= 0: self._send_buffer += self._response_builder.BuildResponses() self._num_written = self._num_queued self._last_queued_time = 0 if fileno in rlist: self.request.setblocking(False) new_data = self.request.recv(MAX_REQUEST_SIZE) self.request.setblocking(True) if not new_data: return new_requests = self._request_parser.ParseAdditionalData(new_data) self._response_builder.QueueRequests( new_requests, self._request_parser.were_all_requests_http_1_1) self._num_queued += len(new_requests) self._last_queued_time = time.time() elif fileno in wlist: num_bytes_sent = self.request.send(self._send_buffer[0:4096]) self._send_buffer = self._send_buffer[num_bytes_sent:] time.sleep(0.05) except RequestTooLargeError as e: self.request.send(self._response_builder.WriteError( '413 Request Entity Too Large', e)) raise except UnexpectedMethodError as e: self.request.send(self._response_builder.WriteError( '405 Method Not Allowed', e)) raise except ServeIndexError: self.request.send(self._response_builder.WriteError( '200 OK', INFO_MESSAGE)) except Exception as e: print(e) self.request.close() class PipelineServer(socketserver.ThreadingMixIn, socketserver.TCPServer): pass parser = argparse.ArgumentParser() parser.add_argument("--port", action="store", default=0, type=int, help="port to listen on") parser.add_argument("--verbose", action="store", default=0, type=int, help="verbose output") parser.add_argument("--pidfile", action="store", default=0, help="file name for the PID") parser.add_argument("--logfile", action="store", default=0, help="file name for the log") parser.add_argument("--srcdir", action="store", default=0, help="test directory") parser.add_argument("--id", action="store", default=0, help="server ID") parser.add_argument("--ipv4", action="store_true", default=0, help="IPv4 flag") args = parser.parse_args() if args.pidfile: pid = os.getpid() f = open(args.pidfile, 'w') f.write('{}'.format(pid)) f.close() server = PipelineServer(('0.0.0.0', args.port), PipelineRequestHandler) server.allow_reuse_address = True server.serve_forever()
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 199, 3, 1898, 6029, 4475, 3277, 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, 259, 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, 199, 3, 22016, 701, 29730, 527, 653, 14769, 2464, 481, 352, 3903, 316, 367, 20396, 315, 314, 1973, 17096, 511, 199, 3, 10059, 199, 3, 199, 893, 26, 272, 492, 2838, 1000, 199, 2590, 26, 272, 492, 17766, 3120, 465, 2838, 1000, 199, 646, 7534, 199, 646, 295, 199, 646, 3504, 199, 646, 2838, 199, 646, 900, 199, 646, 10933, 199, 646, 747, 199, 199, 4531, 63, 8272, 275, 1449, 199, 2765, 365, 282, 511, 1654, 370, 511, 314, 1973, 17096, 5200, 30176, 9330, 14, 199, 7940, 365, 282, 6042, 1015, 340, 4475, 1159, 3101, 5200, 30176, 511, 1654, 14, 16917, 199, 11697, 883, 506, 1911, 2348, 26, 199, 199, 2859, 921, 2374, 14, 13211, 14, 1308, 15, 23826, 15, 14748, 13, 12233, 15, 1200, 13, 2340, 15, 1014, 13, 4990, 30176, 199, 199, 2980, 1233, 883, 506, 1911, 2348, 26, 199, 199, 2859, 921, 600, 14, 3098, 14, 957, 15, 6404, 15, 80, 15, 1014, 13, 4990, 30176, 13, 396, 15, 199, 2344, 199, 4283, 63, 6780, 63, 4305, 275, 6619, 221, 327, 2783, 199, 4896, 63, 16428, 63, 4961, 275, 378, 14, 614, 221, 327, 4696, 14, 22466, 900, 370, 11271, 12, 315, 1865, 370, 7981, 1993, 327, 444, 823, 3398, 4438, 316, 2952, 2018, 2984, 5589, 370, 11271, 367, 1993, 327, 7425, 25870, 14, 199, 20469, 63, 10960, 63, 4961, 275, 378, 14, 21, 221, 327, 4696, 199, 8899, 275, 4233, 221, 327, 4696, 421, 199, 533, 4520, 8, 1726, 304, 523, 986, 421, 199, 533, 4784, 13749, 17149, 547, 8, 547, 304, 523, 986, 421, 199, 533, 3739, 432, 12129, 8, 547, 304, 523, 986, 421, 199, 533, 25345, 3767, 547, 8, 547, 304, 523, 986, 421, 199, 533, 4784, 2842, 8, 785, 304, 523, 408, 23400, 376, 1324, 3335, 10023, 367, 3101, 9576, 4145, 1041, 819, 2288, 17251, 819, 3412, 3593, 1206, 63, 2707, 63, 2970, 275, 413, 523, 16767, 1206, 63, 21178, 275, 499, 819, 13053, 540, 63, 907, 275, 295, 14, 2014, 360, 7059, 26, 2807, 304, 19276, 2862, 78, 358, 523, 31325, 63, 907, 275, 295, 14, 2014, 360, 7059, 1622, 8771, 334, 4735, 1622, 8771, 3101, 15, 2961, 68, 13439, 14, 2961, 68, 13439, 78, 358, 819, 347, 636, 826, 721, 277, 304, 272, 408, 27742, 1041, 272, 291, 423, 2738, 275, 3087, 272, 291, 423, 6455, 63, 2139, 275, 1052, 272, 291, 423, 6455, 63, 1069, 275, 3087, 272, 291, 423, 929, 275, 291, 14, 22591, 1206, 63, 2707, 63, 2970, 272, 291, 423, 1129, 264, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 275, 715, 272, 291, 423, 1078, 63, 6615, 275, 942, 819, 347, 6077, 8824, 1451, 8, 277, 12, 666, 304, 272, 408, 30344, 3101, 4145, 315, 1204, 576, 18257, 339, 3033, 26, 489, 666, 26, 334, 1558, 9, 7053, 590, 3086, 1324, 666, 687, 314, 2838, 14, 339, 1803, 26, 489, 334, 1296, 402, 11634, 83, 9, 267, 334, 1558, 9, 710, 1056, 931, 14, 267, 334, 2956, 402, 2624, 370, 2624, 9, 710, 1406, 536, 436, 574, 14, 339, 6218, 26, 489, 4784, 13749, 17149, 547, 26, 982, 314, 1056, 22338, 9141, 63, 6780, 63, 4305, 14, 489, 25345, 3767, 547, 26, 4068, 282, 2222, 13, 2970, 1083, 14, 489, 4520, 26, 4068, 282, 31768, 1125, 14, 272, 408, 272, 17251, 275, 1551, 360, 793, 15, 1000, 14, 1210, 297, 283, 65, 358, 272, 17251, 14, 952, 8, 576, 9, 272, 17251, 14, 1600, 342, 272, 291, 423, 2738, 847, 666, 14, 1814, 2258, 82, 297, 4074, 272, 1077, 63, 6958, 63, 11059, 275, 715, 272, 1830, 1077, 63, 6958, 63, 11059, 26, 489, 340, 291, 423, 929, 508, 291, 14, 22591, 1206, 63, 2707, 63, 2970, 26, 267, 1077, 63, 6958, 63, 11059, 275, 291, 423, 2585, 20926, 1858, 1002, 342, 489, 916, 291, 423, 929, 508, 291, 14, 5670, 1206, 63, 21178, 26, 267, 1077, 63, 6958, 63, 11059, 275, 291, 423, 2585, 3284, 2567, 342, 489, 587, 26, 267, 746, 4520, 360, 8708, 1174, 26, 283, 435, 291, 423, 929, 9, 272, 340, 822, 8, 277, 423, 2738, 9, 690, 9141, 63, 6780, 63, 4305, 26, 489, 746, 4784, 13749, 17149, 547, 8, 881, 283, 2017, 365, 737, 5210, 450, 68, 2783, 7, 450, 822, 8, 277, 423, 2738, 430, 272, 1686, 63, 6615, 275, 291, 423, 1078, 63, 6615, 272, 291, 423, 1078, 63, 6615, 275, 942, 272, 372, 1686, 63, 6615, 819, 768, 1829, 523, 347, 4898, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 8, 277, 304, 272, 372, 291, 423, 1129, 264, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 819, 347, 485, 2585, 20926, 1858, 1002, 8, 277, 304, 272, 408, 52, 1996, 370, 2198, 376, 869, 1481, 6495, 1056, 1004, 14, 339, 1803, 26, 489, 334, 4082, 9, 715, 340, 282, 1056, 1990, 1911, 14, 339, 6218, 26, 489, 25345, 3767, 547, 26, 4068, 282, 2222, 13, 2970, 1083, 14, 272, 408, 272, 333, 275, 291, 14, 6780, 63, 907, 14, 1431, 8, 277, 423, 2738, 9, 272, 340, 440, 333, 26, 489, 372, 756, 272, 1083, 12, 931, 12, 1455, 63, 8452, 12, 1455, 63, 11067, 275, 333, 14, 2634, 342, 339, 340, 1083, 1137, 283, 2970, 356, 489, 746, 25345, 3767 ]
[ 2647, 15, 1393, 15, 1548, 199, 199, 3, 1898, 6029, 4475, 3277, 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, 259, 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, 199, 3, 22016, 701, 29730, 527, 653, 14769, 2464, 481, 352, 3903, 316, 367, 20396, 315, 314, 1973, 17096, 511, 199, 3, 10059, 199, 3, 199, 893, 26, 272, 492, 2838, 1000, 199, 2590, 26, 272, 492, 17766, 3120, 465, 2838, 1000, 199, 646, 7534, 199, 646, 295, 199, 646, 3504, 199, 646, 2838, 199, 646, 900, 199, 646, 10933, 199, 646, 747, 199, 199, 4531, 63, 8272, 275, 1449, 199, 2765, 365, 282, 511, 1654, 370, 511, 314, 1973, 17096, 5200, 30176, 9330, 14, 199, 7940, 365, 282, 6042, 1015, 340, 4475, 1159, 3101, 5200, 30176, 511, 1654, 14, 16917, 199, 11697, 883, 506, 1911, 2348, 26, 199, 199, 2859, 921, 2374, 14, 13211, 14, 1308, 15, 23826, 15, 14748, 13, 12233, 15, 1200, 13, 2340, 15, 1014, 13, 4990, 30176, 199, 199, 2980, 1233, 883, 506, 1911, 2348, 26, 199, 199, 2859, 921, 600, 14, 3098, 14, 957, 15, 6404, 15, 80, 15, 1014, 13, 4990, 30176, 13, 396, 15, 199, 2344, 199, 4283, 63, 6780, 63, 4305, 275, 6619, 221, 327, 2783, 199, 4896, 63, 16428, 63, 4961, 275, 378, 14, 614, 221, 327, 4696, 14, 22466, 900, 370, 11271, 12, 315, 1865, 370, 7981, 1993, 327, 444, 823, 3398, 4438, 316, 2952, 2018, 2984, 5589, 370, 11271, 367, 1993, 327, 7425, 25870, 14, 199, 20469, 63, 10960, 63, 4961, 275, 378, 14, 21, 221, 327, 4696, 199, 8899, 275, 4233, 221, 327, 4696, 421, 199, 533, 4520, 8, 1726, 304, 523, 986, 421, 199, 533, 4784, 13749, 17149, 547, 8, 547, 304, 523, 986, 421, 199, 533, 3739, 432, 12129, 8, 547, 304, 523, 986, 421, 199, 533, 25345, 3767, 547, 8, 547, 304, 523, 986, 421, 199, 533, 4784, 2842, 8, 785, 304, 523, 408, 23400, 376, 1324, 3335, 10023, 367, 3101, 9576, 4145, 1041, 819, 2288, 17251, 819, 3412, 3593, 1206, 63, 2707, 63, 2970, 275, 413, 523, 16767, 1206, 63, 21178, 275, 499, 819, 13053, 540, 63, 907, 275, 295, 14, 2014, 360, 7059, 26, 2807, 304, 19276, 2862, 78, 358, 523, 31325, 63, 907, 275, 295, 14, 2014, 360, 7059, 1622, 8771, 334, 4735, 1622, 8771, 3101, 15, 2961, 68, 13439, 14, 2961, 68, 13439, 78, 358, 819, 347, 636, 826, 721, 277, 304, 272, 408, 27742, 1041, 272, 291, 423, 2738, 275, 3087, 272, 291, 423, 6455, 63, 2139, 275, 1052, 272, 291, 423, 6455, 63, 1069, 275, 3087, 272, 291, 423, 929, 275, 291, 14, 22591, 1206, 63, 2707, 63, 2970, 272, 291, 423, 1129, 264, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 275, 715, 272, 291, 423, 1078, 63, 6615, 275, 942, 819, 347, 6077, 8824, 1451, 8, 277, 12, 666, 304, 272, 408, 30344, 3101, 4145, 315, 1204, 576, 18257, 339, 3033, 26, 489, 666, 26, 334, 1558, 9, 7053, 590, 3086, 1324, 666, 687, 314, 2838, 14, 339, 1803, 26, 489, 334, 1296, 402, 11634, 83, 9, 267, 334, 1558, 9, 710, 1056, 931, 14, 267, 334, 2956, 402, 2624, 370, 2624, 9, 710, 1406, 536, 436, 574, 14, 339, 6218, 26, 489, 4784, 13749, 17149, 547, 26, 982, 314, 1056, 22338, 9141, 63, 6780, 63, 4305, 14, 489, 25345, 3767, 547, 26, 4068, 282, 2222, 13, 2970, 1083, 14, 489, 4520, 26, 4068, 282, 31768, 1125, 14, 272, 408, 272, 17251, 275, 1551, 360, 793, 15, 1000, 14, 1210, 297, 283, 65, 358, 272, 17251, 14, 952, 8, 576, 9, 272, 17251, 14, 1600, 342, 272, 291, 423, 2738, 847, 666, 14, 1814, 2258, 82, 297, 4074, 272, 1077, 63, 6958, 63, 11059, 275, 715, 272, 1830, 1077, 63, 6958, 63, 11059, 26, 489, 340, 291, 423, 929, 508, 291, 14, 22591, 1206, 63, 2707, 63, 2970, 26, 267, 1077, 63, 6958, 63, 11059, 275, 291, 423, 2585, 20926, 1858, 1002, 342, 489, 916, 291, 423, 929, 508, 291, 14, 5670, 1206, 63, 21178, 26, 267, 1077, 63, 6958, 63, 11059, 275, 291, 423, 2585, 3284, 2567, 342, 489, 587, 26, 267, 746, 4520, 360, 8708, 1174, 26, 283, 435, 291, 423, 929, 9, 272, 340, 822, 8, 277, 423, 2738, 9, 690, 9141, 63, 6780, 63, 4305, 26, 489, 746, 4784, 13749, 17149, 547, 8, 881, 283, 2017, 365, 737, 5210, 450, 68, 2783, 7, 450, 822, 8, 277, 423, 2738, 430, 272, 1686, 63, 6615, 275, 291, 423, 1078, 63, 6615, 272, 291, 423, 1078, 63, 6615, 275, 942, 272, 372, 1686, 63, 6615, 819, 768, 1829, 523, 347, 4898, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 8, 277, 304, 272, 372, 291, 423, 1129, 264, 63, 452, 63, 6615, 63, 1014, 63, 17, 63, 17, 819, 347, 485, 2585, 20926, 1858, 1002, 8, 277, 304, 272, 408, 52, 1996, 370, 2198, 376, 869, 1481, 6495, 1056, 1004, 14, 339, 1803, 26, 489, 334, 4082, 9, 715, 340, 282, 1056, 1990, 1911, 14, 339, 6218, 26, 489, 25345, 3767, 547, 26, 4068, 282, 2222, 13, 2970, 1083, 14, 272, 408, 272, 333, 275, 291, 14, 6780, 63, 907, 14, 1431, 8, 277, 423, 2738, 9, 272, 340, 440, 333, 26, 489, 372, 756, 272, 1083, 12, 931, 12, 1455, 63, 8452, 12, 1455, 63, 11067, 275, 333, 14, 2634, 342, 339, 340, 1083, 1137, 283, 2970, 356, 489, 746, 25345, 3767, 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,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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 ]
papouso/odoo
addons/fleet/fleet.py
266
46376
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, osv import time import datetime from openerp import tools from openerp.osv.orm import except_orm from openerp.tools.translate import _ from dateutil.relativedelta import relativedelta def str_to_datetime(strdate): return datetime.datetime.strptime(strdate, tools.DEFAULT_SERVER_DATE_FORMAT) class fleet_vehicle_cost(osv.Model): _name = 'fleet.vehicle.cost' _description = 'Cost related to a vehicle' _order = 'date desc, vehicle_id asc' def _get_odometer(self, cr, uid, ids, odometer_id, arg, context): res = dict.fromkeys(ids, False) for record in self.browse(cr,uid,ids,context=context): if record.odometer_id: res[record.id] = record.odometer_id.value return res def _set_odometer(self, cr, uid, id, name, value, args=None, context=None): if not value: raise except_orm(_('Operation not allowed!'), _('Emptying the odometer value of a vehicle is not allowed.')) date = self.browse(cr, uid, id, context=context).date if not(date): date = fields.date.context_today(self, cr, uid, context=context) vehicle_id = self.browse(cr, uid, id, context=context).vehicle_id data = {'value': value, 'date': date, 'vehicle_id': vehicle_id.id} odometer_id = self.pool.get('fleet.vehicle.odometer').create(cr, uid, data, context=context) return self.write(cr, uid, id, {'odometer_id': odometer_id}, context=context) _columns = { 'name': fields.related('vehicle_id', 'name', type="char", string='Name', store=True), 'vehicle_id': fields.many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this log'), 'cost_subtype_id': fields.many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost'), 'amount': fields.float('Total Price'), 'cost_type': fields.selection([('contract', 'Contract'), ('services','Services'), ('fuel','Fuel'), ('other','Other')], 'Category of the cost', help='For internal purpose only', required=True), 'parent_id': fields.many2one('fleet.vehicle.cost', 'Parent', help='Parent cost to this current cost'), 'cost_ids': fields.one2many('fleet.vehicle.cost', 'parent_id', 'Included Services'), 'odometer_id': fields.many2one('fleet.vehicle.odometer', 'Odometer', help='Odometer measure of the vehicle at the moment of this log'), 'odometer': fields.function(_get_odometer, fnct_inv=_set_odometer, type='float', string='Odometer Value', help='Odometer measure of the vehicle at the moment of this log'), 'odometer_unit': fields.related('vehicle_id', 'odometer_unit', type="char", string="Unit", readonly=True), 'date' :fields.date('Date',help='Date when the cost has been executed'), 'contract_id': fields.many2one('fleet.vehicle.log.contract', 'Contract', help='Contract attached to this cost'), 'auto_generated': fields.boolean('Automatically Generated', readonly=True, required=True), } _defaults ={ 'cost_type': 'other', } def create(self, cr, uid, data, context=None): #make sure that the data are consistent with values of parent and contract records given if 'parent_id' in data and data['parent_id']: parent = self.browse(cr, uid, data['parent_id'], context=context) data['vehicle_id'] = parent.vehicle_id.id data['date'] = parent.date data['cost_type'] = parent.cost_type if 'contract_id' in data and data['contract_id']: contract = self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, data['contract_id'], context=context) data['vehicle_id'] = contract.vehicle_id.id data['cost_subtype_id'] = contract.cost_subtype_id.id data['cost_type'] = contract.cost_type if 'odometer' in data and not data['odometer']: #if received value for odometer is 0, then remove it from the data as it would result to the creation of a #odometer log with 0, which is to be avoided del(data['odometer']) return super(fleet_vehicle_cost, self).create(cr, uid, data, context=context) class fleet_vehicle_tag(osv.Model): _name = 'fleet.vehicle.tag' _columns = { 'name': fields.char('Name', required=True, translate=True), } class fleet_vehicle_state(osv.Model): _name = 'fleet.vehicle.state' _order = 'sequence asc' _columns = { 'name': fields.char('Name', required=True), 'sequence': fields.integer('Sequence', help="Used to order the note stages") } _sql_constraints = [('fleet_state_name_unique','unique(name)', 'State name already exists')] class fleet_vehicle_model(osv.Model): def _model_name_get_fnc(self, cr, uid, ids, field_name, arg, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.modelname if record.brand_id.name: name = record.brand_id.name + ' / ' + name res[record.id] = name return res def on_change_brand(self, cr, uid, ids, model_id, context=None): if not model_id: return {'value': {'image_medium': False}} brand = self.pool.get('fleet.vehicle.model.brand').browse(cr, uid, model_id, context=context) return { 'value': { 'image_medium': brand.image, } } _name = 'fleet.vehicle.model' _description = 'Model of a vehicle' _order = 'name asc' _columns = { 'name': fields.function(_model_name_get_fnc, type="char", string='Name', store=True), 'modelname': fields.char('Model name', required=True), 'brand_id': fields.many2one('fleet.vehicle.model.brand', 'Model Brand', required=True, help='Brand of the vehicle'), 'vendors': fields.many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors'), 'image': fields.related('brand_id', 'image', type="binary", string="Logo"), 'image_medium': fields.related('brand_id', 'image_medium', type="binary", string="Logo (medium)"), 'image_small': fields.related('brand_id', 'image_small', type="binary", string="Logo (small)"), } class fleet_vehicle_model_brand(osv.Model): _name = 'fleet.vehicle.model.brand' _description = 'Brand model of the vehicle' _order = 'name asc' def _get_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context): result[obj.id] = tools.image_get_resized_images(obj.image) return result def _set_image(self, cr, uid, id, name, value, args, context=None): return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context) _columns = { 'name': fields.char('Brand Name', required=True), 'image': fields.binary("Logo", help="This field holds the image used as logo for the brand, limited to 1024x1024px."), 'image_medium': fields.function(_get_image, fnct_inv=_set_image, string="Medium-sized photo", type="binary", multi="_get_image", store = { 'fleet.vehicle.model.brand': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Medium-sized logo of the brand. It is automatically "\ "resized as a 128x128px image, with aspect ratio preserved. "\ "Use this field in form views or some kanban views."), 'image_small': fields.function(_get_image, fnct_inv=_set_image, string="Smal-sized photo", type="binary", multi="_get_image", store = { 'fleet.vehicle.model.brand': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Small-sized photo of the brand. It is automatically "\ "resized as a 64x64px image, with aspect ratio preserved. "\ "Use this field anywhere a small image is required."), } class fleet_vehicle(osv.Model): _inherit = 'mail.thread' def _vehicle_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): res[record.id] = record.model_id.brand_id.name + '/' + record.model_id.modelname + ' / ' + record.license_plate return res def return_action_to_open(self, cr, uid, ids, context=None): """ This opens the xml view specified in xml_id for the current vehicle """ if context is None: context = {} if context.get('xml_id'): res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet', context['xml_id'], context=context) res['context'] = context res['context'].update({'default_vehicle_id': ids[0]}) res['domain'] = [('vehicle_id','=', ids[0])] return res return False def act_show_log_cost(self, cr, uid, ids, context=None): """ This opens log view to view and add new log for this vehicle, groupby default to only show effective costs @return: the costs log view """ if context is None: context = {} res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet','fleet_vehicle_costs_act', context=context) res['context'] = context res['context'].update({ 'default_vehicle_id': ids[0], 'search_default_parent_false': True }) res['domain'] = [('vehicle_id','=', ids[0])] return res def _get_odometer(self, cr, uid, ids, odometer_id, arg, context): res = dict.fromkeys(ids, 0) for record in self.browse(cr,uid,ids,context=context): ids = self.pool.get('fleet.vehicle.odometer').search(cr, uid, [('vehicle_id', '=', record.id)], limit=1, order='value desc') if len(ids) > 0: res[record.id] = self.pool.get('fleet.vehicle.odometer').browse(cr, uid, ids[0], context=context).value return res def _set_odometer(self, cr, uid, id, name, value, args=None, context=None): if value: date = fields.date.context_today(self, cr, uid, context=context) data = {'value': value, 'date': date, 'vehicle_id': id} return self.pool.get('fleet.vehicle.odometer').create(cr, uid, data, context=context) def _search_get_overdue_contract_reminder(self, cr, uid, obj, name, args, context): res = [] for field, operator, value in args: assert operator in ('=', '!=', '<>') and value in (True, False), 'Operation not supported' if (operator == '=' and value == True) or (operator in ('<>', '!=') and value == False): search_operator = 'in' else: search_operator = 'not in' today = fields.date.context_today(self, cr, uid, context=context) cr.execute('select cost.vehicle_id, count(contract.id) as contract_number FROM fleet_vehicle_cost cost left join fleet_vehicle_log_contract contract on contract.cost_id = cost.id WHERE contract.expiration_date is not null AND contract.expiration_date < %s AND contract.state IN (\'open\', \'toclose\') GROUP BY cost.vehicle_id', (today,)) res_ids = [x[0] for x in cr.fetchall()] res.append(('id', search_operator, res_ids)) return res def _search_contract_renewal_due_soon(self, cr, uid, obj, name, args, context): res = [] for field, operator, value in args: assert operator in ('=', '!=', '<>') and value in (True, False), 'Operation not supported' if (operator == '=' and value == True) or (operator in ('<>', '!=') and value == False): search_operator = 'in' else: search_operator = 'not in' today = fields.date.context_today(self, cr, uid, context=context) datetime_today = datetime.datetime.strptime(today, tools.DEFAULT_SERVER_DATE_FORMAT) limit_date = str((datetime_today + relativedelta(days=+15)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)) cr.execute('select cost.vehicle_id, count(contract.id) as contract_number FROM fleet_vehicle_cost cost left join fleet_vehicle_log_contract contract on contract.cost_id = cost.id WHERE contract.expiration_date is not null AND contract.expiration_date > %s AND contract.expiration_date < %s AND contract.state IN (\'open\', \'toclose\') GROUP BY cost.vehicle_id', (today, limit_date)) res_ids = [x[0] for x in cr.fetchall()] res.append(('id', search_operator, res_ids)) return res def _get_contract_reminder_fnc(self, cr, uid, ids, field_names, unknow_none, context=None): res= {} for record in self.browse(cr, uid, ids, context=context): overdue = False due_soon = False total = 0 name = '' for element in record.log_contracts: if element.state in ('open', 'toclose') and element.expiration_date: current_date_str = fields.date.context_today(self, cr, uid, context=context) due_time_str = element.expiration_date current_date = str_to_datetime(current_date_str) due_time = str_to_datetime(due_time_str) diff_time = (due_time-current_date).days if diff_time < 0: overdue = True total += 1 if diff_time < 15 and diff_time >= 0: due_soon = True; total += 1 if overdue or due_soon: ids = self.pool.get('fleet.vehicle.log.contract').search(cr,uid,[('vehicle_id', '=', record.id), ('state', 'in', ('open', 'toclose'))], limit=1, order='expiration_date asc') if len(ids) > 0: #we display only the name of the oldest overdue/due soon contract name=(self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, ids[0], context=context).cost_subtype_id.name) res[record.id] = { 'contract_renewal_overdue': overdue, 'contract_renewal_due_soon': due_soon, 'contract_renewal_total': (total - 1), #we remove 1 from the real total for display purposes 'contract_renewal_name': name, } return res def _get_default_state(self, cr, uid, context): try: model, model_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'vehicle_state_active') except ValueError: model_id = False return model_id def _count_all(self, cr, uid, ids, field_name, arg, context=None): Odometer = self.pool['fleet.vehicle.odometer'] LogFuel = self.pool['fleet.vehicle.log.fuel'] LogService = self.pool['fleet.vehicle.log.services'] LogContract = self.pool['fleet.vehicle.log.contract'] Cost = self.pool['fleet.vehicle.cost'] return { vehicle_id: { 'odometer_count': Odometer.search_count(cr, uid, [('vehicle_id', '=', vehicle_id)], context=context), 'fuel_logs_count': LogFuel.search_count(cr, uid, [('vehicle_id', '=', vehicle_id)], context=context), 'service_count': LogService.search_count(cr, uid, [('vehicle_id', '=', vehicle_id)], context=context), 'contract_count': LogContract.search_count(cr, uid, [('vehicle_id', '=', vehicle_id)], context=context), 'cost_count': Cost.search_count(cr, uid, [('vehicle_id', '=', vehicle_id), ('parent_id', '=', False)], context=context) } for vehicle_id in ids } _name = 'fleet.vehicle' _description = 'Information on a vehicle' _order= 'license_plate asc' _columns = { 'name': fields.function(_vehicle_name_get_fnc, type="char", string='Name', store=True), 'company_id': fields.many2one('res.company', 'Company'), 'license_plate': fields.char('License Plate', required=True, help='License plate number of the vehicle (ie: plate number for a car)'), 'vin_sn': fields.char('Chassis Number', help='Unique number written on the vehicle motor (VIN/SN number)', copy=False), 'driver_id': fields.many2one('res.partner', 'Driver', help='Driver of the vehicle'), 'model_id': fields.many2one('fleet.vehicle.model', 'Model', required=True, help='Model of the vehicle'), 'log_fuel': fields.one2many('fleet.vehicle.log.fuel', 'vehicle_id', 'Fuel Logs'), 'log_services': fields.one2many('fleet.vehicle.log.services', 'vehicle_id', 'Services Logs'), 'log_contracts': fields.one2many('fleet.vehicle.log.contract', 'vehicle_id', 'Contracts'), 'cost_count': fields.function(_count_all, type='integer', string="Costs" , multi=True), 'contract_count': fields.function(_count_all, type='integer', string='Contracts', multi=True), 'service_count': fields.function(_count_all, type='integer', string='Services', multi=True), 'fuel_logs_count': fields.function(_count_all, type='integer', string='Fuel Logs', multi=True), 'odometer_count': fields.function(_count_all, type='integer', string='Odometer', multi=True), 'acquisition_date': fields.date('Acquisition Date', required=False, help='Date when the vehicle has been bought'), 'color': fields.char('Color', help='Color of the vehicle'), 'state_id': fields.many2one('fleet.vehicle.state', 'State', help='Current state of the vehicle', ondelete="set null"), 'location': fields.char('Location', help='Location of the vehicle (garage, ...)'), 'seats': fields.integer('Seats Number', help='Number of seats of the vehicle'), 'doors': fields.integer('Doors Number', help='Number of doors of the vehicle'), 'tag_ids' :fields.many2many('fleet.vehicle.tag', 'fleet_vehicle_vehicle_tag_rel', 'vehicle_tag_id','tag_id', 'Tags', copy=False), 'odometer': fields.function(_get_odometer, fnct_inv=_set_odometer, type='float', string='Last Odometer', help='Odometer measure of the vehicle at the moment of this log'), 'odometer_unit': fields.selection([('kilometers', 'Kilometers'),('miles','Miles')], 'Odometer Unit', help='Unit of the odometer ',required=True), 'transmission': fields.selection([('manual', 'Manual'), ('automatic', 'Automatic')], 'Transmission', help='Transmission Used by the vehicle'), 'fuel_type': fields.selection([('gasoline', 'Gasoline'), ('diesel', 'Diesel'), ('electric', 'Electric'), ('hybrid', 'Hybrid')], 'Fuel Type', help='Fuel Used by the vehicle'), 'horsepower': fields.integer('Horsepower'), 'horsepower_tax': fields.float('Horsepower Taxation'), 'power': fields.integer('Power', help='Power in kW of the vehicle'), 'co2': fields.float('CO2 Emissions', help='CO2 emissions of the vehicle'), 'image': fields.related('model_id', 'image', type="binary", string="Logo"), 'image_medium': fields.related('model_id', 'image_medium', type="binary", string="Logo (medium)"), 'image_small': fields.related('model_id', 'image_small', type="binary", string="Logo (small)"), 'contract_renewal_due_soon': fields.function(_get_contract_reminder_fnc, fnct_search=_search_contract_renewal_due_soon, type="boolean", string='Has Contracts to renew', multi='contract_info'), 'contract_renewal_overdue': fields.function(_get_contract_reminder_fnc, fnct_search=_search_get_overdue_contract_reminder, type="boolean", string='Has Contracts Overdued', multi='contract_info'), 'contract_renewal_name': fields.function(_get_contract_reminder_fnc, type="text", string='Name of contract to renew soon', multi='contract_info'), 'contract_renewal_total': fields.function(_get_contract_reminder_fnc, type="integer", string='Total of contracts due or overdue minus one', multi='contract_info'), 'car_value': fields.float('Car Value', help='Value of the bought vehicle'), } _defaults = { 'doors': 5, 'odometer_unit': 'kilometers', 'state_id': _get_default_state, } def on_change_model(self, cr, uid, ids, model_id, context=None): if not model_id: return {} model = self.pool.get('fleet.vehicle.model').browse(cr, uid, model_id, context=context) return { 'value': { 'image_medium': model.image, } } def create(self, cr, uid, data, context=None): context = dict(context or {}, mail_create_nolog=True) vehicle_id = super(fleet_vehicle, self).create(cr, uid, data, context=context) vehicle = self.browse(cr, uid, vehicle_id, context=context) self.message_post(cr, uid, [vehicle_id], body=_('%s %s has been added to the fleet!') % (vehicle.model_id.name,vehicle.license_plate), context=context) return vehicle_id def write(self, cr, uid, ids, vals, context=None): """ This function write an entry in the openchatter whenever we change important information on the vehicle like the model, the drive, the state of the vehicle or its license plate """ for vehicle in self.browse(cr, uid, ids, context): changes = [] if 'model_id' in vals and vehicle.model_id.id != vals['model_id']: value = self.pool.get('fleet.vehicle.model').browse(cr,uid,vals['model_id'],context=context).name oldmodel = vehicle.model_id.name or _('None') changes.append(_("Model: from '%s' to '%s'") %(oldmodel, value)) if 'driver_id' in vals and vehicle.driver_id.id != vals['driver_id']: value = self.pool.get('res.partner').browse(cr,uid,vals['driver_id'],context=context).name olddriver = (vehicle.driver_id.name) or _('None') changes.append(_("Driver: from '%s' to '%s'") %(olddriver, value)) if 'state_id' in vals and vehicle.state_id.id != vals['state_id']: value = self.pool.get('fleet.vehicle.state').browse(cr,uid,vals['state_id'],context=context).name oldstate = vehicle.state_id.name or _('None') changes.append(_("State: from '%s' to '%s'") %(oldstate, value)) if 'license_plate' in vals and vehicle.license_plate != vals['license_plate']: old_license_plate = vehicle.license_plate or _('None') changes.append(_("License Plate: from '%s' to '%s'") %(old_license_plate, vals['license_plate'])) if len(changes) > 0: self.message_post(cr, uid, [vehicle.id], body=", ".join(changes), context=context) vehicle_id = super(fleet_vehicle,self).write(cr, uid, ids, vals, context) return True class fleet_vehicle_odometer(osv.Model): _name='fleet.vehicle.odometer' _description='Odometer log for a vehicle' _order='date desc' def _vehicle_log_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.vehicle_id.name if not name: name = record.date elif record.date: name += ' / '+ record.date res[record.id] = name return res def on_change_vehicle(self, cr, uid, ids, vehicle_id, context=None): if not vehicle_id: return {} odometer_unit = self.pool.get('fleet.vehicle').browse(cr, uid, vehicle_id, context=context).odometer_unit return { 'value': { 'unit': odometer_unit, } } _columns = { 'name': fields.function(_vehicle_log_name_get_fnc, type="char", string='Name', store=True), 'date': fields.date('Date'), 'value': fields.float('Odometer Value', group_operator="max"), 'vehicle_id': fields.many2one('fleet.vehicle', 'Vehicle', required=True), 'unit': fields.related('vehicle_id', 'odometer_unit', type="char", string="Unit", readonly=True), } _defaults = { 'date': fields.date.context_today, } class fleet_vehicle_log_fuel(osv.Model): def on_change_vehicle(self, cr, uid, ids, vehicle_id, context=None): if not vehicle_id: return {} vehicle = self.pool.get('fleet.vehicle').browse(cr, uid, vehicle_id, context=context) odometer_unit = vehicle.odometer_unit driver = vehicle.driver_id.id return { 'value': { 'odometer_unit': odometer_unit, 'purchaser_id': driver, } } def on_change_liter(self, cr, uid, ids, liter, price_per_liter, amount, context=None): #need to cast in float because the value receveid from web client maybe an integer (Javascript and JSON do not #make any difference between 3.0 and 3). This cause a problem if you encode, for example, 2 liters at 1.5 per #liter => total is computed as 3.0, then trigger an onchange that recomputes price_per_liter as 3/2=1 (instead #of 3.0/2=1.5) #If there is no change in the result, we return an empty dict to prevent an infinite loop due to the 3 intertwine #onchange. And in order to verify that there is no change in the result, we have to limit the precision of the #computation to 2 decimal liter = float(liter) price_per_liter = float(price_per_liter) amount = float(amount) if liter > 0 and price_per_liter > 0 and round(liter*price_per_liter,2) != amount: return {'value' : {'amount' : round(liter * price_per_liter,2),}} elif amount > 0 and liter > 0 and round(amount/liter,2) != price_per_liter: return {'value' : {'price_per_liter' : round(amount / liter,2),}} elif amount > 0 and price_per_liter > 0 and round(amount/price_per_liter,2) != liter: return {'value' : {'liter' : round(amount / price_per_liter,2),}} else : return {} def on_change_price_per_liter(self, cr, uid, ids, liter, price_per_liter, amount, context=None): #need to cast in float because the value receveid from web client maybe an integer (Javascript and JSON do not #make any difference between 3.0 and 3). This cause a problem if you encode, for example, 2 liters at 1.5 per #liter => total is computed as 3.0, then trigger an onchange that recomputes price_per_liter as 3/2=1 (instead #of 3.0/2=1.5) #If there is no change in the result, we return an empty dict to prevent an infinite loop due to the 3 intertwine #onchange. And in order to verify that there is no change in the result, we have to limit the precision of the #computation to 2 decimal liter = float(liter) price_per_liter = float(price_per_liter) amount = float(amount) if liter > 0 and price_per_liter > 0 and round(liter*price_per_liter,2) != amount: return {'value' : {'amount' : round(liter * price_per_liter,2),}} elif amount > 0 and price_per_liter > 0 and round(amount/price_per_liter,2) != liter: return {'value' : {'liter' : round(amount / price_per_liter,2),}} elif amount > 0 and liter > 0 and round(amount/liter,2) != price_per_liter: return {'value' : {'price_per_liter' : round(amount / liter,2),}} else : return {} def on_change_amount(self, cr, uid, ids, liter, price_per_liter, amount, context=None): #need to cast in float because the value receveid from web client maybe an integer (Javascript and JSON do not #make any difference between 3.0 and 3). This cause a problem if you encode, for example, 2 liters at 1.5 per #liter => total is computed as 3.0, then trigger an onchange that recomputes price_per_liter as 3/2=1 (instead #of 3.0/2=1.5) #If there is no change in the result, we return an empty dict to prevent an infinite loop due to the 3 intertwine #onchange. And in order to verify that there is no change in the result, we have to limit the precision of the #computation to 2 decimal liter = float(liter) price_per_liter = float(price_per_liter) amount = float(amount) if amount > 0 and liter > 0 and round(amount/liter,2) != price_per_liter: return {'value': {'price_per_liter': round(amount / liter,2),}} elif amount > 0 and price_per_liter > 0 and round(amount/price_per_liter,2) != liter: return {'value': {'liter': round(amount / price_per_liter,2),}} elif liter > 0 and price_per_liter > 0 and round(liter*price_per_liter,2) != amount: return {'value': {'amount': round(liter * price_per_liter,2),}} else : return {} def _get_default_service_type(self, cr, uid, context): try: model, model_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'type_service_refueling') except ValueError: model_id = False return model_id _name = 'fleet.vehicle.log.fuel' _description = 'Fuel log for vehicles' _inherits = {'fleet.vehicle.cost': 'cost_id'} _columns = { 'liter': fields.float('Liter'), 'price_per_liter': fields.float('Price Per Liter'), 'purchaser_id': fields.many2one('res.partner', 'Purchaser', domain="['|',('customer','=',True),('employee','=',True)]"), 'inv_ref': fields.char('Invoice Reference', size=64), 'vendor_id': fields.many2one('res.partner', 'Supplier', domain="[('supplier','=',True)]"), 'notes': fields.text('Notes'), 'cost_id': fields.many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade'), 'cost_amount': fields.related('cost_id', 'amount', string='Amount', type='float', store=True), #we need to keep this field as a related with store=True because the graph view doesn't support (1) to address fields from inherited table and (2) fields that aren't stored in database } _defaults = { 'date': fields.date.context_today, 'cost_subtype_id': _get_default_service_type, 'cost_type': 'fuel', } class fleet_vehicle_log_services(osv.Model): def on_change_vehicle(self, cr, uid, ids, vehicle_id, context=None): if not vehicle_id: return {} vehicle = self.pool.get('fleet.vehicle').browse(cr, uid, vehicle_id, context=context) odometer_unit = vehicle.odometer_unit driver = vehicle.driver_id.id return { 'value': { 'odometer_unit': odometer_unit, 'purchaser_id': driver, } } def _get_default_service_type(self, cr, uid, context): try: model, model_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'type_service_service_8') except ValueError: model_id = False return model_id _inherits = {'fleet.vehicle.cost': 'cost_id'} _name = 'fleet.vehicle.log.services' _description = 'Services for vehicles' _columns = { 'purchaser_id': fields.many2one('res.partner', 'Purchaser', domain="['|',('customer','=',True),('employee','=',True)]"), 'inv_ref': fields.char('Invoice Reference'), 'vendor_id': fields.many2one('res.partner', 'Supplier', domain="[('supplier','=',True)]"), 'cost_amount': fields.related('cost_id', 'amount', string='Amount', type='float', store=True), #we need to keep this field as a related with store=True because the graph view doesn't support (1) to address fields from inherited table and (2) fields that aren't stored in database 'notes': fields.text('Notes'), 'cost_id': fields.many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade'), } _defaults = { 'date': fields.date.context_today, 'cost_subtype_id': _get_default_service_type, 'cost_type': 'services' } class fleet_service_type(osv.Model): _name = 'fleet.service.type' _description = 'Type of services available on a vehicle' _columns = { 'name': fields.char('Name', required=True, translate=True), 'category': fields.selection([('contract', 'Contract'), ('service', 'Service'), ('both', 'Both')], 'Category', required=True, help='Choose wheter the service refer to contracts, vehicle services or both'), } class fleet_vehicle_log_contract(osv.Model): def scheduler_manage_auto_costs(self, cr, uid, context=None): #This method is called by a cron task #It creates costs for contracts having the "recurring cost" field setted, depending on their frequency #For example, if a contract has a reccuring cost of 200 with a weekly frequency, this method creates a cost of 200 on the first day of each week, from the date of the last recurring costs in the database to today #If the contract has not yet any recurring costs in the database, the method generates the recurring costs from the start_date to today #The created costs are associated to a contract thanks to the many2one field contract_id #If the contract has no start_date, no cost will be created, even if the contract has recurring costs vehicle_cost_obj = self.pool.get('fleet.vehicle.cost') d = datetime.datetime.strptime(fields.date.context_today(self, cr, uid, context=context), tools.DEFAULT_SERVER_DATE_FORMAT).date() contract_ids = self.pool.get('fleet.vehicle.log.contract').search(cr, uid, [('state','!=','closed')], offset=0, limit=None, order=None,context=None, count=False) deltas = {'yearly': relativedelta(years=+1), 'monthly': relativedelta(months=+1), 'weekly': relativedelta(weeks=+1), 'daily': relativedelta(days=+1)} for contract in self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, contract_ids, context=context): if not contract.start_date or contract.cost_frequency == 'no': continue found = False last_cost_date = contract.start_date if contract.generated_cost_ids: last_autogenerated_cost_id = vehicle_cost_obj.search(cr, uid, ['&', ('contract_id','=',contract.id), ('auto_generated','=',True)], offset=0, limit=1, order='date desc',context=context, count=False) if last_autogenerated_cost_id: found = True last_cost_date = vehicle_cost_obj.browse(cr, uid, last_autogenerated_cost_id[0], context=context).date startdate = datetime.datetime.strptime(last_cost_date, tools.DEFAULT_SERVER_DATE_FORMAT).date() if found: startdate += deltas.get(contract.cost_frequency) while (startdate <= d) & (startdate <= datetime.datetime.strptime(contract.expiration_date, tools.DEFAULT_SERVER_DATE_FORMAT).date()): data = { 'amount': contract.cost_generated, 'date': startdate.strftime(tools.DEFAULT_SERVER_DATE_FORMAT), 'vehicle_id': contract.vehicle_id.id, 'cost_subtype_id': contract.cost_subtype_id.id, 'contract_id': contract.id, 'auto_generated': True } cost_id = self.pool.get('fleet.vehicle.cost').create(cr, uid, data, context=context) startdate += deltas.get(contract.cost_frequency) return True def scheduler_manage_contract_expiration(self, cr, uid, context=None): #This method is called by a cron task #It manages the state of a contract, possibly by posting a message on the vehicle concerned and updating its status datetime_today = datetime.datetime.strptime(fields.date.context_today(self, cr, uid, context=context), tools.DEFAULT_SERVER_DATE_FORMAT) limit_date = (datetime_today + relativedelta(days=+15)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) ids = self.search(cr, uid, ['&', ('state', '=', 'open'), ('expiration_date', '<', limit_date)], offset=0, limit=None, order=None, context=context, count=False) res = {} for contract in self.browse(cr, uid, ids, context=context): if contract.vehicle_id.id in res: res[contract.vehicle_id.id] += 1 else: res[contract.vehicle_id.id] = 1 for vehicle, value in res.items(): self.pool.get('fleet.vehicle').message_post(cr, uid, vehicle, body=_('%s contract(s) need(s) to be renewed and/or closed!') % (str(value)), context=context) return self.write(cr, uid, ids, {'state': 'toclose'}, context=context) def run_scheduler(self, cr, uid, context=None): self.scheduler_manage_auto_costs(cr, uid, context=context) self.scheduler_manage_contract_expiration(cr, uid, context=context) return True def _vehicle_contract_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.vehicle_id.name if record.cost_subtype_id.name: name += ' / '+ record.cost_subtype_id.name if record.date: name += ' / '+ record.date res[record.id] = name return res def on_change_vehicle(self, cr, uid, ids, vehicle_id, context=None): if not vehicle_id: return {} odometer_unit = self.pool.get('fleet.vehicle').browse(cr, uid, vehicle_id, context=context).odometer_unit return { 'value': { 'odometer_unit': odometer_unit, } } def compute_next_year_date(self, strdate): oneyear = datetime.timedelta(days=365) curdate = str_to_datetime(strdate) return datetime.datetime.strftime(curdate + oneyear, tools.DEFAULT_SERVER_DATE_FORMAT) def on_change_start_date(self, cr, uid, ids, strdate, enddate, context=None): if (strdate): return {'value': {'expiration_date': self.compute_next_year_date(strdate),}} return {} def get_days_left(self, cr, uid, ids, prop, unknow_none, context=None): """return a dict with as value for each contract an integer if contract is in an open state and is overdue, return 0 if contract is in a closed state, return -1 otherwise return the number of days before the contract expires """ res = {} for record in self.browse(cr, uid, ids, context=context): if (record.expiration_date and (record.state == 'open' or record.state == 'toclose')): today = str_to_datetime(time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)) renew_date = str_to_datetime(record.expiration_date) diff_time = (renew_date-today).days res[record.id] = diff_time > 0 and diff_time or 0 else: res[record.id] = -1 return res def act_renew_contract(self, cr, uid, ids, context=None): assert len(ids) == 1, "This operation should only be done for 1 single contract at a time, as it it suppose to open a window as result" for element in self.browse(cr, uid, ids, context=context): #compute end date startdate = str_to_datetime(element.start_date) enddate = str_to_datetime(element.expiration_date) diffdate = (enddate - startdate) default = { 'date': fields.date.context_today(self, cr, uid, context=context), 'start_date': datetime.datetime.strftime(str_to_datetime(element.expiration_date) + datetime.timedelta(days=1), tools.DEFAULT_SERVER_DATE_FORMAT), 'expiration_date': datetime.datetime.strftime(enddate + diffdate, tools.DEFAULT_SERVER_DATE_FORMAT), } newid = super(fleet_vehicle_log_contract, self).copy(cr, uid, element.id, default, context=context) mod, modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'fleet_vehicle_log_contract_form') return { 'name':_("Renew Contract"), 'view_mode': 'form', 'view_id': modid, 'view_type': 'tree,form', 'res_model': 'fleet.vehicle.log.contract', 'type': 'ir.actions.act_window', 'nodestroy': True, 'domain': '[]', 'res_id': newid, 'context': {'active_id':newid}, } def _get_default_contract_type(self, cr, uid, context=None): try: model, model_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'type_contract_leasing') except ValueError: model_id = False return model_id def on_change_indic_cost(self, cr, uid, ids, cost_ids, context=None): totalsum = 0.0 for element in cost_ids: if element and len(element) == 3 and isinstance(element[2], dict): totalsum += element[2].get('amount', 0.0) return { 'value': { 'sum_cost': totalsum, } } def _get_sum_cost(self, cr, uid, ids, field_name, arg, context=None): res = {} for contract in self.browse(cr, uid, ids, context=context): totalsum = 0 for cost in contract.cost_ids: totalsum += cost.amount res[contract.id] = totalsum return res _inherits = {'fleet.vehicle.cost': 'cost_id'} _name = 'fleet.vehicle.log.contract' _description = 'Contract information on a vehicle' _order='state desc,expiration_date' _columns = { 'name': fields.function(_vehicle_contract_name_get_fnc, type="text", string='Name', store=True), 'start_date': fields.date('Contract Start Date', help='Date when the coverage of the contract begins'), 'expiration_date': fields.date('Contract Expiration Date', help='Date when the coverage of the contract expirates (by default, one year after begin date)'), 'days_left': fields.function(get_days_left, type='integer', string='Warning Date'), 'insurer_id' :fields.many2one('res.partner', 'Supplier'), 'purchaser_id': fields.many2one('res.partner', 'Contractor', help='Person to which the contract is signed for'), 'ins_ref': fields.char('Contract Reference', size=64, copy=False), 'state': fields.selection([('open', 'In Progress'), ('toclose','To Close'), ('closed', 'Terminated')], 'Status', readonly=True, help='Choose wheter the contract is still valid or not', copy=False), 'notes': fields.text('Terms and Conditions', help='Write here all supplementary informations relative to this contract', copy=False), 'cost_generated': fields.float('Recurring Cost Amount', help="Costs paid at regular intervals, depending on the cost frequency. If the cost frequency is set to unique, the cost will be logged at the start date"), 'cost_frequency': fields.selection([('no','No'), ('daily', 'Daily'), ('weekly','Weekly'), ('monthly','Monthly'), ('yearly','Yearly')], 'Recurring Cost Frequency', help='Frequency of the recuring cost', required=True), 'generated_cost_ids': fields.one2many('fleet.vehicle.cost', 'contract_id', 'Generated Costs'), 'sum_cost': fields.function(_get_sum_cost, type='float', string='Indicative Costs Total'), 'cost_id': fields.many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade'), 'cost_amount': fields.related('cost_id', 'amount', string='Amount', type='float', store=True), #we need to keep this field as a related with store=True because the graph view doesn't support (1) to address fields from inherited table and (2) fields that aren't stored in database } _defaults = { 'purchaser_id': lambda self, cr, uid, ctx: self.pool.get('res.users').browse(cr, uid, uid, context=ctx).partner_id.id or False, 'date': fields.date.context_today, 'start_date': fields.date.context_today, 'state':'open', 'expiration_date': lambda self, cr, uid, ctx: self.compute_next_year_date(fields.date.context_today(self, cr, uid, context=ctx)), 'cost_frequency': 'no', 'cost_subtype_id': _get_default_contract_type, 'cost_type': 'contract', } def contract_close(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'closed'}, context=context) def contract_open(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'open'}, context=context) class fleet_contract_state(osv.Model): _name = 'fleet.contract.state' _description = 'Contains the different possible status of a leasing contract' _columns = { 'name':fields.char('Contract Status', required=True), }
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 646, 900, 199, 646, 2197, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 4795, 14, 1025, 492, 871, 63, 1025, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 22208, 14, 32300, 492, 20599, 199, 199, 318, 620, 63, 475, 63, 2083, 8, 495, 602, 304, 272, 372, 2197, 14, 2083, 14, 9866, 8, 495, 602, 12, 7249, 14, 3472, 63, 6613, 63, 5390, 63, 4807, 9, 199, 199, 533, 289, 274, 386, 63, 20073, 63, 6336, 8, 4795, 14, 1685, 304, 272, 485, 354, 275, 283, 21599, 386, 14, 20073, 14, 6336, 7, 272, 485, 1802, 275, 283, 15568, 4048, 370, 282, 27616, 7, 272, 485, 1648, 275, 283, 602, 4328, 12, 27616, 63, 344, 16635, 7, 339, 347, 485, 362, 63, 364, 1377, 351, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 312, 1117, 10011, 63, 344, 12, 1680, 12, 1067, 304, 267, 522, 275, 1211, 14, 19164, 8, 1580, 12, 756, 9, 267, 367, 2777, 315, 291, 14, 4570, 8, 1556, 12, 1535, 12, 1580, 12, 1100, 29, 1100, 304, 288, 340, 2777, 14, 364, 1377, 351, 63, 344, 26, 355, 522, 59, 3059, 14, 344, 61, 275, 2777, 14, 364, 1377, 351, 63, 344, 14, 585, 267, 372, 522, 339, 347, 485, 409, 63, 364, 1377, 351, 8, 277, 12, 2467, 12, 1747, 12, 1305, 12, 536, 12, 574, 12, 1249, 29, 403, 12, 1067, 29, 403, 304, 267, 340, 440, 574, 26, 288, 746, 871, 63, 1025, 6723, 6044, 440, 4370, 15659, 4018, 4699, 316, 314, 312, 1117, 10011, 574, 402, 282, 27616, 365, 440, 4370, 12459, 267, 1434, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 680, 602, 267, 340, 440, 8, 602, 304, 288, 1434, 275, 1504, 14, 602, 14, 1100, 63, 8136, 8, 277, 12, 2467, 12, 1747, 12, 1067, 29, 1100, 9, 267, 27616, 63, 344, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 680, 20073, 63, 344, 267, 666, 275, 791, 585, 356, 574, 12, 283, 602, 356, 1434, 12, 283, 20073, 63, 344, 356, 27616, 63, 344, 14, 344, 93, 267, 312, 1117, 10011, 63, 344, 275, 291, 14, 2293, 14, 362, 360, 21599, 386, 14, 20073, 14, 364, 1377, 351, 1959, 981, 8, 1556, 12, 1747, 12, 666, 12, 1067, 29, 1100, 9, 267, 372, 291, 14, 952, 8, 1556, 12, 1747, 12, 1305, 12, 791, 364, 1377, 351, 63, 344, 356, 312, 1117, 10011, 63, 344, 1386, 1067, 29, 1100, 9, 339, 485, 3406, 275, 469, 267, 283, 354, 356, 1504, 14, 2407, 360, 20073, 63, 344, 297, 283, 354, 297, 730, 628, 1560, 401, 1059, 534, 985, 297, 3877, 29, 549, 395, 267, 283, 20073, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 297, 283, 15169, 13438, 297, 1415, 29, 549, 12, 1720, 534, 15169, 13438, 406, 2247, 7439, 701, 642, 943, 659, 267, 283, 6336, 63, 10512, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 1364, 14, 466, 297, 283, 804, 297, 1720, 534, 15568, 730, 15932, 68, 543, 642, 7918, 659, 267, 283, 4606, 356, 1504, 14, 1609, 360, 7316, 20276, 659, 267, 283, 6336, 63, 466, 356, 1504, 14, 5592, 8318, 14624, 297, 283, 714, 6908, 659, 661, 5950, 1673, 15803, 659, 661, 70, 13086, 1673, 38, 13086, 659, 661, 1848, 1673, 8632, 2665, 283, 7841, 402, 314, 7918, 297, 1720, 534, 1858, 5007, 12016, 1454, 297, 1415, 29, 549, 395, 267, 283, 1708, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 14, 6336, 297, 283, 6652, 297, 1720, 534, 6652, 7918, 370, 642, 1453, 7918, 659, 267, 283, 6336, 63, 1580, 356, 1504, 14, 368, 18, 3479, 360, 21599, 386, 14, 20073, 14, 6336, 297, 283, 1708, 63, 344, 297, 283, 607, 3331, 21813, 659, 267, 283, 364, 1377, 351, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 14, 364, 1377, 351, 297, 283, 47, 1117, 10011, 297, 1720, 534, 47, 1117, 10011, 9775, 402, 314, 27616, 737, 314, 12427, 402, 642, 943, 659, 267, 283, 364, 1377, 351, 356, 1504, 14, 1593, 1547, 362, 63, 364, 1377, 351, 12, 4325, 319, 63, 5350, 3699, 409, 63, 364, 1377, 351, 12, 730, 534, 1609, 297, 1059, 534, 47, 1117, 10011, 1594, 297, 1720, 534, 47, 1117, 10011, 9775, 402, 314, 27616, 737, 314, 12427, 402, 642, 943, 659, 267, 283, 364, 1377, 351, 63, 3248, 356, 1504, 14, 2407, 360, 20073, 63, 344, 297, 283, 364, 1377, 351, 63, 3248, 297, 730, 628, 1560, 401, 1059, 628, 5072, 401, 6863, 29, 549, 395, 267, 283, 602, 7, 520, 955, 14, 602, 360, 2506, 297, 3437, 534, 2506, 1380, 314, 7918, 965, 2757, 7934, 659, 267, 283, 14624, 63, 344, 356, 1504, 14 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 646, 900, 199, 646, 2197, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 4795, 14, 1025, 492, 871, 63, 1025, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 22208, 14, 32300, 492, 20599, 199, 199, 318, 620, 63, 475, 63, 2083, 8, 495, 602, 304, 272, 372, 2197, 14, 2083, 14, 9866, 8, 495, 602, 12, 7249, 14, 3472, 63, 6613, 63, 5390, 63, 4807, 9, 199, 199, 533, 289, 274, 386, 63, 20073, 63, 6336, 8, 4795, 14, 1685, 304, 272, 485, 354, 275, 283, 21599, 386, 14, 20073, 14, 6336, 7, 272, 485, 1802, 275, 283, 15568, 4048, 370, 282, 27616, 7, 272, 485, 1648, 275, 283, 602, 4328, 12, 27616, 63, 344, 16635, 7, 339, 347, 485, 362, 63, 364, 1377, 351, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 312, 1117, 10011, 63, 344, 12, 1680, 12, 1067, 304, 267, 522, 275, 1211, 14, 19164, 8, 1580, 12, 756, 9, 267, 367, 2777, 315, 291, 14, 4570, 8, 1556, 12, 1535, 12, 1580, 12, 1100, 29, 1100, 304, 288, 340, 2777, 14, 364, 1377, 351, 63, 344, 26, 355, 522, 59, 3059, 14, 344, 61, 275, 2777, 14, 364, 1377, 351, 63, 344, 14, 585, 267, 372, 522, 339, 347, 485, 409, 63, 364, 1377, 351, 8, 277, 12, 2467, 12, 1747, 12, 1305, 12, 536, 12, 574, 12, 1249, 29, 403, 12, 1067, 29, 403, 304, 267, 340, 440, 574, 26, 288, 746, 871, 63, 1025, 6723, 6044, 440, 4370, 15659, 4018, 4699, 316, 314, 312, 1117, 10011, 574, 402, 282, 27616, 365, 440, 4370, 12459, 267, 1434, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 680, 602, 267, 340, 440, 8, 602, 304, 288, 1434, 275, 1504, 14, 602, 14, 1100, 63, 8136, 8, 277, 12, 2467, 12, 1747, 12, 1067, 29, 1100, 9, 267, 27616, 63, 344, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 680, 20073, 63, 344, 267, 666, 275, 791, 585, 356, 574, 12, 283, 602, 356, 1434, 12, 283, 20073, 63, 344, 356, 27616, 63, 344, 14, 344, 93, 267, 312, 1117, 10011, 63, 344, 275, 291, 14, 2293, 14, 362, 360, 21599, 386, 14, 20073, 14, 364, 1377, 351, 1959, 981, 8, 1556, 12, 1747, 12, 666, 12, 1067, 29, 1100, 9, 267, 372, 291, 14, 952, 8, 1556, 12, 1747, 12, 1305, 12, 791, 364, 1377, 351, 63, 344, 356, 312, 1117, 10011, 63, 344, 1386, 1067, 29, 1100, 9, 339, 485, 3406, 275, 469, 267, 283, 354, 356, 1504, 14, 2407, 360, 20073, 63, 344, 297, 283, 354, 297, 730, 628, 1560, 401, 1059, 534, 985, 297, 3877, 29, 549, 395, 267, 283, 20073, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 297, 283, 15169, 13438, 297, 1415, 29, 549, 12, 1720, 534, 15169, 13438, 406, 2247, 7439, 701, 642, 943, 659, 267, 283, 6336, 63, 10512, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 1364, 14, 466, 297, 283, 804, 297, 1720, 534, 15568, 730, 15932, 68, 543, 642, 7918, 659, 267, 283, 4606, 356, 1504, 14, 1609, 360, 7316, 20276, 659, 267, 283, 6336, 63, 466, 356, 1504, 14, 5592, 8318, 14624, 297, 283, 714, 6908, 659, 661, 5950, 1673, 15803, 659, 661, 70, 13086, 1673, 38, 13086, 659, 661, 1848, 1673, 8632, 2665, 283, 7841, 402, 314, 7918, 297, 1720, 534, 1858, 5007, 12016, 1454, 297, 1415, 29, 549, 395, 267, 283, 1708, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 14, 6336, 297, 283, 6652, 297, 1720, 534, 6652, 7918, 370, 642, 1453, 7918, 659, 267, 283, 6336, 63, 1580, 356, 1504, 14, 368, 18, 3479, 360, 21599, 386, 14, 20073, 14, 6336, 297, 283, 1708, 63, 344, 297, 283, 607, 3331, 21813, 659, 267, 283, 364, 1377, 351, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 21599, 386, 14, 20073, 14, 364, 1377, 351, 297, 283, 47, 1117, 10011, 297, 1720, 534, 47, 1117, 10011, 9775, 402, 314, 27616, 737, 314, 12427, 402, 642, 943, 659, 267, 283, 364, 1377, 351, 356, 1504, 14, 1593, 1547, 362, 63, 364, 1377, 351, 12, 4325, 319, 63, 5350, 3699, 409, 63, 364, 1377, 351, 12, 730, 534, 1609, 297, 1059, 534, 47, 1117, 10011, 1594, 297, 1720, 534, 47, 1117, 10011, 9775, 402, 314, 27616, 737, 314, 12427, 402, 642, 943, 659, 267, 283, 364, 1377, 351, 63, 3248, 356, 1504, 14, 2407, 360, 20073, 63, 344, 297, 283, 364, 1377, 351, 63, 3248, 297, 730, 628, 1560, 401, 1059, 628, 5072, 401, 6863, 29, 549, 395, 267, 283, 602, 7, 520, 955, 14, 602, 360, 2506, 297, 3437, 534, 2506, 1380, 314, 7918, 965, 2757, 7934, 659, 267, 283, 14624, 63, 344, 356, 1504, 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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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 ]
mashaoze/esp-idf
tools/esp_app_trace/pylibelf/util/__init__.py
14
1040
from .. import * from ..types import * from ..constants import * from ctypes import * import os def _class(elf): return ord(elf_getident(elf, None).contents[EI_CLASS]) def is32(elf): return _class(elf) == ELFCLASS32 def is64(elf): return _class(elf) == ELFCLASS64 def select(elf, fname): if is32(elf): return globals()['elf32_' + fname] else: return globals()['elf64_' + fname] def section_name(elfP, secP): shstrndx = c_size_t() r = elf_getshstrndx(elfP, byref(shstrndx)) shdr = select(elfP, 'getshdr')(secP) return elf_strptr(elfP, shstrndx, shdr.contents.sh_name) def section_type(elfP, secP): return select(elfP, 'getshdr')(secP).contents.sh_type def section_link(elfP, secP): return select(elfP, 'getshdr')(secP).contents.sh_link def section_hdr(elfP, secP): return select(elfP, 'getshdr')(secP).contents def open_elf(fname): fd = os.open(fname, os.O_RDONLY) return elf_begin(fd, ELF_C_READ, None) def sym_name(elf, scn, sym): return elf_strptr(elf, section_link(elf, scn), sym.st_name)
apache-2.0
[ 504, 2508, 492, 627, 199, 504, 2508, 1313, 492, 627, 199, 504, 2508, 5559, 492, 627, 199, 504, 5577, 492, 627, 199, 646, 747, 199, 199, 318, 485, 533, 8, 25371, 304, 221, 372, 6206, 8, 25371, 63, 303, 280, 1326, 8, 25371, 12, 488, 680, 4407, 59, 37, 41, 63, 6885, 566, 199, 199, 318, 365, 708, 8, 25371, 304, 257, 372, 485, 533, 8, 25371, 9, 508, 662, 15965, 6885, 708, 221, 199, 318, 365, 772, 8, 25371, 304, 257, 372, 485, 533, 8, 25371, 9, 508, 662, 15965, 6885, 772, 9948, 199, 318, 3504, 8, 25371, 12, 6748, 304, 523, 340, 365, 708, 8, 25371, 304, 272, 372, 7992, 12047, 25371, 708, 8650, 435, 6748, 61, 523, 587, 26, 272, 372, 7992, 12047, 25371, 772, 8650, 435, 6748, 61, 199, 199, 318, 3420, 63, 354, 8, 25371, 48, 12, 6513, 48, 304, 523, 1033, 495, 31818, 275, 286, 63, 890, 63, 84, 342, 523, 519, 275, 325, 276, 63, 362, 609, 495, 31818, 8, 25371, 48, 12, 15968, 8, 609, 495, 31818, 430, 523, 1033, 5012, 275, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 9, 523, 372, 325, 276, 63, 495, 4695, 8, 25371, 48, 12, 1033, 495, 31818, 12, 1033, 5012, 14, 4407, 14, 609, 63, 354, 9, 199, 199, 318, 3420, 63, 466, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 14, 609, 63, 466, 199, 199, 318, 3420, 63, 1073, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 14, 609, 63, 1073, 199, 199, 318, 3420, 63, 11244, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 199, 199, 318, 1551, 63, 25371, 8, 5252, 304, 523, 6111, 275, 747, 14, 1490, 8, 5252, 12, 747, 14, 47, 63, 15543, 10452, 9, 523, 372, 325, 276, 63, 5037, 8, 2592, 12, 662, 15965, 63, 35, 63, 5670, 12, 488, 9, 199, 199, 318, 4678, 63, 354, 8, 25371, 12, 4061, 78, 12, 4678, 304, 523, 372, 325, 276, 63, 495, 4695, 8, 25371, 12, 3420, 63, 1073, 8, 25371, 12, 4061, 78, 395, 4678, 14, 270, 63, 354, 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 ]
[ 2508, 492, 627, 199, 504, 2508, 1313, 492, 627, 199, 504, 2508, 5559, 492, 627, 199, 504, 5577, 492, 627, 199, 646, 747, 199, 199, 318, 485, 533, 8, 25371, 304, 221, 372, 6206, 8, 25371, 63, 303, 280, 1326, 8, 25371, 12, 488, 680, 4407, 59, 37, 41, 63, 6885, 566, 199, 199, 318, 365, 708, 8, 25371, 304, 257, 372, 485, 533, 8, 25371, 9, 508, 662, 15965, 6885, 708, 221, 199, 318, 365, 772, 8, 25371, 304, 257, 372, 485, 533, 8, 25371, 9, 508, 662, 15965, 6885, 772, 9948, 199, 318, 3504, 8, 25371, 12, 6748, 304, 523, 340, 365, 708, 8, 25371, 304, 272, 372, 7992, 12047, 25371, 708, 8650, 435, 6748, 61, 523, 587, 26, 272, 372, 7992, 12047, 25371, 772, 8650, 435, 6748, 61, 199, 199, 318, 3420, 63, 354, 8, 25371, 48, 12, 6513, 48, 304, 523, 1033, 495, 31818, 275, 286, 63, 890, 63, 84, 342, 523, 519, 275, 325, 276, 63, 362, 609, 495, 31818, 8, 25371, 48, 12, 15968, 8, 609, 495, 31818, 430, 523, 1033, 5012, 275, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 9, 523, 372, 325, 276, 63, 495, 4695, 8, 25371, 48, 12, 1033, 495, 31818, 12, 1033, 5012, 14, 4407, 14, 609, 63, 354, 9, 199, 199, 318, 3420, 63, 466, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 14, 609, 63, 466, 199, 199, 318, 3420, 63, 1073, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 14, 609, 63, 1073, 199, 199, 318, 3420, 63, 11244, 8, 25371, 48, 12, 6513, 48, 304, 523, 372, 3504, 8, 25371, 48, 12, 283, 362, 609, 5012, 7533, 3321, 48, 680, 4407, 199, 199, 318, 1551, 63, 25371, 8, 5252, 304, 523, 6111, 275, 747, 14, 1490, 8, 5252, 12, 747, 14, 47, 63, 15543, 10452, 9, 523, 372, 325, 276, 63, 5037, 8, 2592, 12, 662, 15965, 63, 35, 63, 5670, 12, 488, 9, 199, 199, 318, 4678, 63, 354, 8, 25371, 12, 4061, 78, 12, 4678, 304, 523, 372, 325, 276, 63, 495, 4695, 8, 25371, 12, 3420, 63, 1073, 8, 25371, 12, 4061, 78, 395, 4678, 14, 270, 63, 354, 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, 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, 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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 ]
iovisor/bcc
examples/networking/simulation.py
3
5257
import os import subprocess import pyroute2 from pyroute2 import IPRoute, NetNS, IPDB, NSPopen class Simulation(object): """ Helper class for controlling multiple namespaces. Inherit from this class and setup your namespaces. """ def __init__(self, ipdb): self.ipdb = ipdb self.ipdbs = {} self.namespaces = [] self.processes = [] self.released = False # helper function to add additional ifc to namespace # if called directly outside Simulation class, "ifc_base_name" should be # different from "name", the "ifc_base_name" and "name" are the same for # the first ifc created by namespace def _ns_add_ifc(self, name, ns_ifc, ifc_base_name=None, in_ifc=None, out_ifc=None, ipaddr=None, macaddr=None, fn=None, cmd=None, action="ok", disable_ipv6=False): if name in self.ipdbs: ns_ipdb = self.ipdbs[name] else: try: nl=NetNS(name) self.namespaces.append(nl) except KeyboardInterrupt: # remove the namespace if it has been created pyroute2.netns.remove(name) raise ns_ipdb = IPDB(nl) self.ipdbs[nl.netns] = ns_ipdb if disable_ipv6: cmd1 = ["sysctl", "-q", "-w", "net.ipv6.conf.default.disable_ipv6=1"] nsp = NSPopen(ns_ipdb.nl.netns, cmd1) nsp.wait(); nsp.release() try: ns_ipdb.interfaces.lo.up().commit() except pyroute2.ipdb.exceptions.CommitException: print("Warning, commit for lo failed, operstate may be unknown") if in_ifc: in_ifname = in_ifc.ifname with in_ifc as v: # move half of veth into namespace v.net_ns_fd = ns_ipdb.nl.netns else: # delete the potentially leaf-over veth interfaces ipr = IPRoute() for i in ipr.link_lookup(ifname='%sa' % ifc_base_name): ipr.link("del", index=i) ipr.close() try: out_ifc = self.ipdb.create(ifname="%sa" % ifc_base_name, kind="veth", peer="%sb" % ifc_base_name).commit() in_ifc = self.ipdb.interfaces[out_ifc.peer] in_ifname = in_ifc.ifname with in_ifc as v: v.net_ns_fd = ns_ipdb.nl.netns except KeyboardInterrupt: # explicitly remove the interface out_ifname = "%sa" % ifc_base_name if out_ifname in self.ipdb.interfaces: self.ipdb.interfaces[out_ifname].remove().commit() raise if out_ifc: out_ifc.up().commit() try: # this is a workaround for fc31 and possible other disto's. # when interface 'lo' is already up, do another 'up().commit()' # has issues in fc31. # the workaround may become permanent if we upgrade pyroute2 # in all machines. if 'state' in ns_ipdb.interfaces.lo.keys(): if ns_ipdb.interfaces.lo['state'] != 'up': ns_ipdb.interfaces.lo.up().commit() else: ns_ipdb.interfaces.lo.up().commit() except pyroute2.ipdb.exceptions.CommitException: print("Warning, commit for lo failed, operstate may be unknown") ns_ipdb.initdb() in_ifc = ns_ipdb.interfaces[in_ifname] with in_ifc as v: v.ifname = ns_ifc if ipaddr: v.add_ip("%s" % ipaddr) if macaddr: v.address = macaddr v.up() if disable_ipv6: cmd1 = ["sysctl", "-q", "-w", "net.ipv6.conf.%s.disable_ipv6=1" % out_ifc.ifname] subprocess.call(cmd1) if fn and out_ifc: self.ipdb.nl.tc("add", "ingress", out_ifc["index"], "ffff:") self.ipdb.nl.tc("add-filter", "bpf", out_ifc["index"], ":1", fd=fn.fd, name=fn.name, parent="ffff:", action=action, classid=1) if cmd: self.processes.append(NSPopen(ns_ipdb.nl.netns, cmd)) return (ns_ipdb, out_ifc, in_ifc) # helper function to create a namespace and a veth connecting it def _create_ns(self, name, in_ifc=None, out_ifc=None, ipaddr=None, macaddr=None, fn=None, cmd=None, action="ok", disable_ipv6=False): (ns_ipdb, out_ifc, in_ifc) = self._ns_add_ifc(name, "eth0", name, in_ifc, out_ifc, ipaddr, macaddr, fn, cmd, action, disable_ipv6) return (ns_ipdb, out_ifc, in_ifc) def release(self): if self.released: return self.released = True for p in self.processes: if p.released: continue try: p.kill() p.wait() except: pass finally: p.release() for name, db in self.ipdbs.items(): db.release() for ns in self.namespaces: ns.remove()
apache-2.0
[ 646, 747, 199, 646, 3873, 199, 646, 1134, 4449, 18, 199, 504, 1134, 4449, 18, 492, 473, 3311, 810, 266, 12, 5365, 2709, 12, 3531, 2846, 12, 653, 5763, 1490, 199, 199, 533, 10751, 5332, 8, 785, 304, 272, 408, 272, 11642, 1021, 367, 30350, 3663, 10747, 14, 27502, 687, 272, 642, 1021, 436, 3272, 2195, 10747, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 3384, 697, 304, 267, 291, 14, 711, 697, 275, 3384, 697, 267, 291, 14, 711, 30764, 275, 1052, 267, 291, 14, 9247, 275, 942, 267, 291, 14, 11816, 275, 942, 267, 291, 14, 26267, 275, 756, 339, 327, 5922, 805, 370, 1050, 4722, 340, 67, 370, 3231, 272, 327, 340, 2797, 5370, 9682, 10751, 5332, 1021, 12, 298, 25040, 63, 1095, 63, 354, 2, 1077, 506, 272, 327, 3365, 687, 298, 354, 401, 314, 298, 25040, 63, 1095, 63, 354, 2, 436, 298, 354, 2, 787, 314, 2011, 367, 272, 327, 314, 1642, 340, 67, 2737, 701, 3231, 272, 347, 485, 561, 63, 525, 63, 25040, 8, 277, 12, 536, 12, 700, 63, 25040, 12, 340, 67, 63, 1095, 63, 354, 29, 403, 12, 315, 63, 25040, 29, 403, 12, 490, 734, 63, 25040, 29, 403, 12, 21249, 29, 403, 12, 4497, 2697, 29, 403, 12, 4325, 29, 403, 12, 2088, 29, 403, 12, 490, 1595, 628, 745, 401, 3507, 63, 4774, 22, 29, 797, 304, 267, 340, 536, 315, 291, 14, 711, 30764, 26, 288, 700, 63, 711, 697, 275, 291, 14, 711, 30764, 59, 354, 61, 267, 587, 26, 288, 862, 26, 355, 12992, 29, 2480, 2709, 8, 354, 9, 355, 291, 14, 9247, 14, 740, 8, 7530, 9, 288, 871, 13483, 26, 355, 327, 2813, 314, 3231, 340, 652, 965, 2757, 2737, 355, 1134, 4449, 18, 14, 846, 561, 14, 2168, 8, 354, 9, 355, 746, 288, 700, 63, 711, 697, 275, 3531, 2846, 8, 7530, 9, 288, 291, 14, 711, 30764, 59, 7530, 14, 846, 561, 61, 275, 700, 63, 711, 697, 288, 340, 3507, 63, 4774, 22, 26, 355, 2088, 17, 275, 2097, 1274, 8077, 401, 3905, 81, 401, 3905, 87, 401, 2432, 298, 846, 14, 4774, 22, 14, 2190, 14, 885, 14, 5993, 63, 4774, 22, 29, 17, 937, 355, 302, 681, 275, 653, 5763, 1490, 8, 561, 63, 711, 697, 14, 7530, 14, 846, 561, 12, 2088, 17, 9, 355, 302, 681, 14, 2573, 7303, 302, 681, 14, 3221, 342, 288, 862, 26, 355, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 288, 871, 1134, 4449, 18, 14, 711, 697, 14, 3924, 14, 11421, 1726, 26, 355, 870, 480, 3849, 12, 5532, 367, 560, 3405, 12, 1758, 929, 1443, 506, 5809, 531, 267, 340, 315, 63, 25040, 26, 288, 315, 63, 30702, 275, 315, 63, 25040, 14, 30702, 288, 543, 315, 63, 25040, 465, 373, 26, 355, 327, 4057, 12995, 402, 11199, 273, 1901, 3231, 355, 373, 14, 846, 63, 561, 63, 2592, 275, 700, 63, 711, 697, 14, 7530, 14, 846, 561, 267, 587, 26, 288, 327, 3145, 314, 18994, 11747, 13, 1883, 11199, 273, 8386, 288, 284, 2700, 275, 473, 3311, 810, 266, 342, 288, 367, 284, 315, 284, 2700, 14, 1073, 63, 3892, 8, 30702, 9569, 2231, 7, 450, 340, 67, 63, 1095, 63, 354, 304, 284, 2700, 14, 1073, 480, 2264, 401, 1478, 29, 73, 9, 288, 284, 2700, 14, 1600, 342, 288, 862, 26, 355, 734, 63, 25040, 275, 291, 14, 711, 697, 14, 981, 8, 30702, 5961, 2231, 2, 450, 340, 67, 63, 1095, 63, 354, 12, 4928, 628, 432, 273, 401, 5644, 9104, 5961, 9264, 2, 450, 340, 67, 63, 1095, 63, 354, 680, 3543, 342, 355, 315, 63, 25040, 275, 291, 14, 711, 697, 14, 7436, 59, 548, 63, 25040, 14, 7866, 61, 355, 315, 63, 30702, 275, 315, 63, 25040, 14, 30702, 355, 543, 315, 63, 25040, 465, 373, 26, 490, 373, 14, 846, 63, 561, 63, 2592, 275, 700, 63, 711, 697, 14, 7530, 14, 846, 561, 288, 871, 13483, 26, 355, 327, 7662, 2813, 314, 3217, 355, 734, 63, 30702, 275, 2071, 2231, 2, 450, 340, 67, 63, 1095, 63, 354, 355, 340, 734, 63, 30702, 315, 291, 14, 711, 697, 14, 7436, 26, 291, 14, 711, 697, 14, 7436, 59, 548, 63, 30702, 1055, 2168, 1252, 3543, 342, 355, 746, 398, 340, 734, 63, 25040, 26, 734, 63, 25040, 14, 384, 1252, 3543, 342, 267, 862, 26, 288, 327, 642, 365, 282, 18092, 367, 10821, 2192, 436, 3962, 1163, 2917, 79, 1159, 14, 288, 327, 1380, 3217, 283, 320, 7, 365, 2575, 1536, 12, 886, 4573, 283, 384, 1252, 3543, 11716, 288, 327, 965, 10876, 315, 10821, 2192, 14, 288, 327, 314, 18092, 1443, 8649, 19860, 340, 781, 10754, 1134, 4449, 18, 288, 327, 315, 1006, 20601, 14, 288, 340, 283, 929, 7, 315, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 1612, 837, 355, 340, 700, 63, 711, 697, 14, 7436, 14, 320, 459, 929, 418, 1137, 283, 384, 356, 490, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 288, 587, 26, 355, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 267, 871, 1134, 4449, 18, 14, 711, 697, 14, 3924, 14, 11421, 1726, 26, 288, 870, 480, 3849, 12, 5532, 367, 560, 3405, 12, 1758, 929, 1443, 506, 5809, 531, 267, 700, 63, 711, 697, 14, 826, 697, 342, 267, 315, 63, 25040, 275, 700, 63, 711, 697, 14, 7436, 59, 262, 63, 30702, 61, 267, 543, 315, 63, 25040, 465, 373, 26, 288, 373, 14, 30702, 275, 700, 63, 25040, 288, 340, 21249, 26, 373, 14, 525, 63, 711, 3647, 83, 2, 450, 21249, 9, 288, 340, 4497, 2697, 26, 373, 14, 1562, 275, 4497, 2697, 288, 373, 14, 384, 342, 267, 340, 3507, 63, 4774, 22, 26, 288, 2088, 17, 275, 2097, 1274, 8077, 401, 3905, 81, 401, 3905, 87, 401, 673, 298, 846, 14, 4774, 22, 14, 2190, 4111, 83, 14, 5993, 63, 4774, 22, 29, 17, 2, 450, 734, 63, 25040, 14, 30702, 61, 288, 3873, 14, 1250, 8, 1760, 17, 9, 267, 340, 4325, 436 ]
[ 747, 199, 646, 3873, 199, 646, 1134, 4449, 18, 199, 504, 1134, 4449, 18, 492, 473, 3311, 810, 266, 12, 5365, 2709, 12, 3531, 2846, 12, 653, 5763, 1490, 199, 199, 533, 10751, 5332, 8, 785, 304, 272, 408, 272, 11642, 1021, 367, 30350, 3663, 10747, 14, 27502, 687, 272, 642, 1021, 436, 3272, 2195, 10747, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 3384, 697, 304, 267, 291, 14, 711, 697, 275, 3384, 697, 267, 291, 14, 711, 30764, 275, 1052, 267, 291, 14, 9247, 275, 942, 267, 291, 14, 11816, 275, 942, 267, 291, 14, 26267, 275, 756, 339, 327, 5922, 805, 370, 1050, 4722, 340, 67, 370, 3231, 272, 327, 340, 2797, 5370, 9682, 10751, 5332, 1021, 12, 298, 25040, 63, 1095, 63, 354, 2, 1077, 506, 272, 327, 3365, 687, 298, 354, 401, 314, 298, 25040, 63, 1095, 63, 354, 2, 436, 298, 354, 2, 787, 314, 2011, 367, 272, 327, 314, 1642, 340, 67, 2737, 701, 3231, 272, 347, 485, 561, 63, 525, 63, 25040, 8, 277, 12, 536, 12, 700, 63, 25040, 12, 340, 67, 63, 1095, 63, 354, 29, 403, 12, 315, 63, 25040, 29, 403, 12, 490, 734, 63, 25040, 29, 403, 12, 21249, 29, 403, 12, 4497, 2697, 29, 403, 12, 4325, 29, 403, 12, 2088, 29, 403, 12, 490, 1595, 628, 745, 401, 3507, 63, 4774, 22, 29, 797, 304, 267, 340, 536, 315, 291, 14, 711, 30764, 26, 288, 700, 63, 711, 697, 275, 291, 14, 711, 30764, 59, 354, 61, 267, 587, 26, 288, 862, 26, 355, 12992, 29, 2480, 2709, 8, 354, 9, 355, 291, 14, 9247, 14, 740, 8, 7530, 9, 288, 871, 13483, 26, 355, 327, 2813, 314, 3231, 340, 652, 965, 2757, 2737, 355, 1134, 4449, 18, 14, 846, 561, 14, 2168, 8, 354, 9, 355, 746, 288, 700, 63, 711, 697, 275, 3531, 2846, 8, 7530, 9, 288, 291, 14, 711, 30764, 59, 7530, 14, 846, 561, 61, 275, 700, 63, 711, 697, 288, 340, 3507, 63, 4774, 22, 26, 355, 2088, 17, 275, 2097, 1274, 8077, 401, 3905, 81, 401, 3905, 87, 401, 2432, 298, 846, 14, 4774, 22, 14, 2190, 14, 885, 14, 5993, 63, 4774, 22, 29, 17, 937, 355, 302, 681, 275, 653, 5763, 1490, 8, 561, 63, 711, 697, 14, 7530, 14, 846, 561, 12, 2088, 17, 9, 355, 302, 681, 14, 2573, 7303, 302, 681, 14, 3221, 342, 288, 862, 26, 355, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 288, 871, 1134, 4449, 18, 14, 711, 697, 14, 3924, 14, 11421, 1726, 26, 355, 870, 480, 3849, 12, 5532, 367, 560, 3405, 12, 1758, 929, 1443, 506, 5809, 531, 267, 340, 315, 63, 25040, 26, 288, 315, 63, 30702, 275, 315, 63, 25040, 14, 30702, 288, 543, 315, 63, 25040, 465, 373, 26, 355, 327, 4057, 12995, 402, 11199, 273, 1901, 3231, 355, 373, 14, 846, 63, 561, 63, 2592, 275, 700, 63, 711, 697, 14, 7530, 14, 846, 561, 267, 587, 26, 288, 327, 3145, 314, 18994, 11747, 13, 1883, 11199, 273, 8386, 288, 284, 2700, 275, 473, 3311, 810, 266, 342, 288, 367, 284, 315, 284, 2700, 14, 1073, 63, 3892, 8, 30702, 9569, 2231, 7, 450, 340, 67, 63, 1095, 63, 354, 304, 284, 2700, 14, 1073, 480, 2264, 401, 1478, 29, 73, 9, 288, 284, 2700, 14, 1600, 342, 288, 862, 26, 355, 734, 63, 25040, 275, 291, 14, 711, 697, 14, 981, 8, 30702, 5961, 2231, 2, 450, 340, 67, 63, 1095, 63, 354, 12, 4928, 628, 432, 273, 401, 5644, 9104, 5961, 9264, 2, 450, 340, 67, 63, 1095, 63, 354, 680, 3543, 342, 355, 315, 63, 25040, 275, 291, 14, 711, 697, 14, 7436, 59, 548, 63, 25040, 14, 7866, 61, 355, 315, 63, 30702, 275, 315, 63, 25040, 14, 30702, 355, 543, 315, 63, 25040, 465, 373, 26, 490, 373, 14, 846, 63, 561, 63, 2592, 275, 700, 63, 711, 697, 14, 7530, 14, 846, 561, 288, 871, 13483, 26, 355, 327, 7662, 2813, 314, 3217, 355, 734, 63, 30702, 275, 2071, 2231, 2, 450, 340, 67, 63, 1095, 63, 354, 355, 340, 734, 63, 30702, 315, 291, 14, 711, 697, 14, 7436, 26, 291, 14, 711, 697, 14, 7436, 59, 548, 63, 30702, 1055, 2168, 1252, 3543, 342, 355, 746, 398, 340, 734, 63, 25040, 26, 734, 63, 25040, 14, 384, 1252, 3543, 342, 267, 862, 26, 288, 327, 642, 365, 282, 18092, 367, 10821, 2192, 436, 3962, 1163, 2917, 79, 1159, 14, 288, 327, 1380, 3217, 283, 320, 7, 365, 2575, 1536, 12, 886, 4573, 283, 384, 1252, 3543, 11716, 288, 327, 965, 10876, 315, 10821, 2192, 14, 288, 327, 314, 18092, 1443, 8649, 19860, 340, 781, 10754, 1134, 4449, 18, 288, 327, 315, 1006, 20601, 14, 288, 340, 283, 929, 7, 315, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 1612, 837, 355, 340, 700, 63, 711, 697, 14, 7436, 14, 320, 459, 929, 418, 1137, 283, 384, 356, 490, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 288, 587, 26, 355, 700, 63, 711, 697, 14, 7436, 14, 320, 14, 384, 1252, 3543, 342, 267, 871, 1134, 4449, 18, 14, 711, 697, 14, 3924, 14, 11421, 1726, 26, 288, 870, 480, 3849, 12, 5532, 367, 560, 3405, 12, 1758, 929, 1443, 506, 5809, 531, 267, 700, 63, 711, 697, 14, 826, 697, 342, 267, 315, 63, 25040, 275, 700, 63, 711, 697, 14, 7436, 59, 262, 63, 30702, 61, 267, 543, 315, 63, 25040, 465, 373, 26, 288, 373, 14, 30702, 275, 700, 63, 25040, 288, 340, 21249, 26, 373, 14, 525, 63, 711, 3647, 83, 2, 450, 21249, 9, 288, 340, 4497, 2697, 26, 373, 14, 1562, 275, 4497, 2697, 288, 373, 14, 384, 342, 267, 340, 3507, 63, 4774, 22, 26, 288, 2088, 17, 275, 2097, 1274, 8077, 401, 3905, 81, 401, 3905, 87, 401, 673, 298, 846, 14, 4774, 22, 14, 2190, 4111, 83, 14, 5993, 63, 4774, 22, 29, 17, 2, 450, 734, 63, 25040, 14, 30702, 61, 288, 3873, 14, 1250, 8, 1760, 17, 9, 267, 340, 4325, 436, 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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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 ]
cessationoftime/nixops
nixops/resources/azure_gateway_connection.py
6
8968
# -*- coding: utf-8 -*- # Automatic provisioning of Azure virtual network gateway connections. import os import azure from nixops.util import attr_property from nixops.azure_common import ResourceDefinition, ResourceState, ResId, normalize_location from azure.mgmt.network import * class AzureGatewayConnectionDefinition(ResourceDefinition): """Definition of an Azure Virtual Network Gateway Connection""" @classmethod def get_type(cls): return "azure-gateway-connection" @classmethod def get_resource_type(cls): return "azureGatewayConnections" def __init__(self, xml): ResourceDefinition.__init__(self, xml) self.connection_name = self.get_option_value(xml, 'name', str) self.copy_option(xml, 'resourceGroup', 'resource') self.copy_location(xml) self.copy_tags(xml) self.copy_option(xml, 'virtualNetworkGateway1', 'res-id', optional = True) self.copy_option(xml, 'virtualNetworkGateway2', 'res-id', optional = True) self.copy_option(xml, 'localNetworkGateway2', 'res-id', optional = True) self.copy_option(xml, 'connectionType', str) self.copy_option(xml, 'routingWeight', int) self.copy_option(xml, 'sharedKey', str, optional = True) def show_type(self): return "{0} [{1}]".format(self.get_type(), self.location) class AzureGatewayConnectionState(ResourceState): """State of an Azure Virtual Network Gateway Connection""" connection_name = attr_property("azure.name", None) resource_group = attr_property("azure.resourceGroup", None) location = attr_property("azure.location", None) tags = attr_property("azure.tags", {}, 'json') virtual_network_gateway1 = attr_property("azure.virtualNetworkGateway1", None) virtual_network_gateway2 = attr_property("azure.virtualNetworkGateway2", None) local_network_gateway2 = attr_property("azure.localNetworkGateway2", None) connection_type = attr_property("azure.connectionType", None) routing_weight = attr_property("azure.routingWeight", None, int) shared_key = attr_property("azure.sharedKey", None) @classmethod def get_type(cls): return "azure-gateway-connection" def show_type(self): s = super(AzureGatewayConnectionState, self).show_type() if self.state == self.UP: s = "{0} [{1}]".format(s, self.location) return s @property def resource_id(self): return self.connection_name @property def full_name(self): return "Azure virtual network gateway connection '{0}'".format(self.resource_id) def get_resource(self): try: return self.nrpc().virtual_network_gateway_connections.get( self.resource_group, self.resource_id).virtual_network_gateway_connection except azure.common.AzureMissingResourceHttpError: return None def destroy_resource(self): self.nrpc().virtual_network_gateway_connections.delete(self.resource_group, self.resource_id) defn_properties = [ 'location', 'tags', 'virtual_network_gateway1', 'virtual_network_gateway2', 'local_network_gateway2', 'connection_type', 'routing_weight', 'shared_key' ] def get_resource_url(self): return ("https://management.azure.com/subscriptions/{0}" "/resourceGroups/{1}/providers/Microsoft.Network" "/connections/{2}?api-version=2015-05-01-preview" .format(quote(self.subscription_id), quote(self.resource_group), quote(self.connection_name))) def mk_request(self, method): http_request = Request() http_request.url = self.get_resource_url() http_request.method = method http_request.headers['Content-Type'] = 'application/json' return http_request def _create_or_update(self, defn): info = { 'location': defn.location, 'tags': defn.tags, 'properties': { 'connectionType': defn.connection_type, 'routingWeight': defn.routing_weight, 'sharedKey': defn.shared_key, } } if defn.virtual_network_gateway1: info['properties']['virtualNetworkGateway1'] = { 'id': defn.virtual_network_gateway1 } if defn.virtual_network_gateway2: info['properties']['virtualNetworkGateway2'] = { 'id': defn.virtual_network_gateway2 } if defn.local_network_gateway2: info['properties']['localNetworkGateway2'] = { 'id': defn.local_network_gateway2 } http_request = self.mk_request('PUT') http_request.data = json.dumps(info) http_request.headers['Content-Length'] = len(http_request.data) response = self.nrpc().send_request(http_request) if response.status_code not in [200, 201]: raise AzureHttpError(response.content, response.status_code) self.state = self.UP self.copy_properties(defn) self.get_settled_resource() def create(self, defn, check, allow_reboot, allow_recreate): self.no_subscription_id_change(defn) self.no_location_change(defn) self.no_property_change(defn, 'resource_group') self.no_property_change(defn, 'connection_type') self.no_property_change(defn, 'virtual_network_gateway1') self.no_property_change(defn, 'virtual_network_gateway2') self.no_property_change(defn, 'local_network_gateway2') self.copy_mgmt_credentials(defn) self.connection_name = defn.connection_name self.resource_group = defn.resource_group if check: connection = self.get_settled_resource() if not connection: self.warn_missing_resource() elif self.state == self.UP: self.warn_if_failed(connection) self.handle_changed_property('location', normalize_location(connection.location), can_fix = False) self.handle_changed_property('tags', connection.tags) self.handle_changed_property('connection_type', connection.connection_type, can_fix = False) self.handle_changed_property('routing_weight', connection.routing_weight) # check key only if the user wants to manage it if defn.shared_key: self.handle_changed_property('shared_key', connection.shared_key) self.handle_changed_property('virtual_network_gateway1', connection.virtual_network_gateway1 and connection.virtual_network_gateway1.id, can_fix = False) self.handle_changed_property('virtual_network_gateway2', connection.virtual_network_gateway2 and connection.virtual_network_gateway2.id, can_fix = False) self.handle_changed_property('local_network_gateway2', connection.local_network_gateway2 and connection.local_network_gateway2.id, can_fix = False) else: self.warn_not_supposed_to_exist() self.confirm_destroy() if self.state != self.UP: if self.get_settled_resource(): raise Exception("tried creating a virtual network gateway connection that already exists; " "please run 'deploy --check' to fix this") self.log("creating {0}...".format(self.full_name)) self._create_or_update(defn) if self.properties_changed(defn): self.log("updating properties of {0}...".format(self.full_name)) self.get_settled_resource_assert_exists() self._create_or_update(defn) def create_after(self, resources, defn): from nixops.resources.azure_resource_group import AzureResourceGroupState from nixops.resources.azure_local_network_gateway import AzureLocalNetworkGatewayState from nixops.resources.azure_virtual_network_gateway import AzureVirtualNetworkGatewayState return {r for r in resources if isinstance(r, AzureResourceGroupState) or isinstance(r, AzureLocalNetworkGatewayState) or isinstance(r, AzureVirtualNetworkGatewayState) }
lgpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 9195, 3889, 20118, 402, 15474, 5791, 2784, 10391, 6947, 14, 199, 199, 646, 747, 199, 646, 13601, 199, 199, 504, 23146, 1483, 14, 1974, 492, 1921, 63, 1829, 199, 504, 23146, 1483, 14, 9078, 63, 2330, 492, 7337, 10701, 12, 7337, 2223, 12, 3591, 1304, 12, 7666, 63, 1985, 199, 199, 504, 13601, 14, 9752, 14, 1200, 492, 627, 199, 199, 533, 15474, 12455, 3225, 10701, 8, 4031, 10701, 304, 272, 408, 10701, 402, 376, 15474, 13311, 7220, 27166, 8113, 624, 339, 768, 3744, 272, 347, 664, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 13, 7019, 13, 2105, 2, 339, 768, 3744, 272, 347, 664, 63, 1927, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 12455, 22122, 2, 339, 347, 636, 826, 721, 277, 12, 2748, 304, 267, 7337, 10701, 855, 826, 721, 277, 12, 2748, 9, 398, 291, 14, 2105, 63, 354, 275, 291, 14, 362, 63, 1422, 63, 585, 8, 1652, 12, 283, 354, 297, 620, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 1927, 2448, 297, 283, 1927, 358, 267, 291, 14, 1574, 63, 1985, 8, 1652, 9, 267, 291, 14, 1574, 63, 2969, 8, 1652, 9, 398, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2065, 31971, 17, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2065, 31971, 18, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 1832, 31971, 18, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2105, 804, 297, 620, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 9492, 16359, 297, 1109, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 5555, 1197, 297, 620, 12, 2716, 275, 715, 9, 339, 347, 2498, 63, 466, 8, 277, 304, 267, 372, 5310, 16, 93, 8910, 17, 11049, 1674, 908, 8, 277, 14, 362, 63, 466, 1062, 291, 14, 1985, 9, 421, 199, 533, 15474, 12455, 3225, 2223, 8, 4031, 2223, 304, 272, 408, 2223, 402, 376, 15474, 13311, 7220, 27166, 8113, 624, 339, 1950, 63, 354, 275, 1921, 63, 1829, 480, 9078, 14, 354, 401, 488, 9, 272, 2073, 63, 923, 275, 1921, 63, 1829, 480, 9078, 14, 1927, 2448, 401, 488, 9, 272, 2909, 275, 1921, 63, 1829, 480, 9078, 14, 1985, 401, 488, 9, 272, 3762, 275, 1921, 63, 1829, 480, 9078, 14, 2969, 401, 5479, 283, 1001, 358, 339, 5791, 63, 1200, 63, 7019, 17, 275, 1921, 63, 1829, 480, 9078, 14, 2065, 31971, 17, 401, 488, 9, 272, 5791, 63, 1200, 63, 7019, 18, 275, 1921, 63, 1829, 480, 9078, 14, 2065, 31971, 18, 401, 488, 9, 272, 2257, 63, 1200, 63, 7019, 18, 275, 1921, 63, 1829, 480, 9078, 14, 1832, 31971, 18, 401, 488, 9, 272, 1950, 63, 466, 275, 1921, 63, 1829, 480, 9078, 14, 2105, 804, 401, 488, 9, 272, 14870, 63, 3463, 275, 1921, 63, 1829, 480, 9078, 14, 9492, 16359, 401, 488, 12, 1109, 9, 272, 5709, 63, 498, 275, 1921, 63, 1829, 480, 9078, 14, 5555, 1197, 401, 488, 9, 339, 768, 3744, 272, 347, 664, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 13, 7019, 13, 2105, 2, 339, 347, 2498, 63, 466, 8, 277, 304, 267, 308, 275, 1613, 8, 22386, 12455, 3225, 2223, 12, 291, 680, 2384, 63, 466, 342, 267, 340, 291, 14, 929, 508, 291, 14, 2160, 26, 308, 275, 5310, 16, 93, 8910, 17, 11049, 1674, 908, 8, 83, 12, 291, 14, 1985, 9, 267, 372, 308, 339, 768, 1829, 272, 347, 2073, 63, 344, 8, 277, 304, 267, 372, 291, 14, 2105, 63, 354, 339, 768, 1829, 272, 347, 2615, 63, 354, 8, 277, 304, 267, 372, 298, 22386, 5791, 2784, 10391, 1950, 5041, 16, 30366, 908, 8, 277, 14, 1927, 63, 344, 9, 339, 347, 664, 63, 1927, 8, 277, 304, 267, 862, 26, 288, 372, 291, 14, 78, 4354, 1252, 2065, 63, 1200, 63, 7019, 63, 7995, 14, 362, 8, 1993, 291, 14, 1927, 63, 923, 12, 1993, 291, 14, 1927, 63, 344, 680, 2065, 63, 1200, 63, 7019, 63, 2105, 267, 871, 13601, 14, 2330, 14, 22386, 7718, 4031, 5779, 547, 26, 288, 372, 488, 339, 347, 11972, 63, 1927, 8, 277, 304, 267, 291, 14, 78, 4354, 1252, 2065, 63, 1200, 63, 7019, 63, 7995, 14, 1807, 8, 277, 14, 1927, 63, 923, 12, 18295, 291, 14, 1927, 63, 344, 9, 339, 347, 78, 63, 3282, 275, 359, 283, 1985, 297, 283, 2969, 297, 283, 2065, 63, 1200, 63, 7019, 17, 297, 717, 283, 2065, 63, 1200, 63, 7019, 18, 297, 283, 1832, 63, 1200, 63, 7019, 18, 297, 717, 283, 2105, 63, 466, 297, 283, 9492, 63, 3463, 297, 283, 5555, 63, 498, 7, 1622, 339, 347, 664, 63, 1927, 63, 633, 8, 277, 304, 267, 372, 1689, 2859, 921, 8110, 14, 9078, 14, 957, 15, 13233, 5321, 16, 7063, 2049, 3286, 26952, 5321, 17, 5995, 9710, 15, 12940, 14, 4491, 2, 2049, 3286, 7995, 5321, 18, 93, 31, 1246, 13, 1023, 29, 7806, 13, 1717, 13, 614, 13, 7780, 2, 2049, 1275, 908, 8, 3513, 8, 277, 14, 6645, 63, 344, 395, 2432, 6313, 8, 277, 14, 1927, 63, 923, 395, 2432, 6313, 8, 277, 14, 2105, 63, 354, 1724, 339, 347, 9199, 63, 1069, 8, 277, 12, 1083, 304, 267, 1455, 63, 1069, 275, 4784, 342, 267, 1455, 63, 1069, 14, 633, 275, 291, 14, 362, 63, 1927, 63, 633, 342, 267, 1455, 63, 1069, 14, 765, 275, 1083, 267, 1455, 63, 1069, 14, 2139, 459, 2714, 13, 804, 418, 275, 283, 3578, 15, 1001, 7, 267, 372, 1455, 63, 1069, 339, 347, 485, 981, 63, 269, 63, 873, 8, 277, 12, 347, 78, 304, 267, 2256, 275, 469, 288, 283, 1985, 356, 347, 78, 14, 1985, 12, 288, 283, 2969, 356, 347, 78, 14, 2969, 12, 288, 283, 3282, 356, 469, 355, 283, 2105, 804, 356, 347, 78, 14, 2105, 63, 466, 12 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 9195, 3889, 20118, 402, 15474, 5791, 2784, 10391, 6947, 14, 199, 199, 646, 747, 199, 646, 13601, 199, 199, 504, 23146, 1483, 14, 1974, 492, 1921, 63, 1829, 199, 504, 23146, 1483, 14, 9078, 63, 2330, 492, 7337, 10701, 12, 7337, 2223, 12, 3591, 1304, 12, 7666, 63, 1985, 199, 199, 504, 13601, 14, 9752, 14, 1200, 492, 627, 199, 199, 533, 15474, 12455, 3225, 10701, 8, 4031, 10701, 304, 272, 408, 10701, 402, 376, 15474, 13311, 7220, 27166, 8113, 624, 339, 768, 3744, 272, 347, 664, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 13, 7019, 13, 2105, 2, 339, 768, 3744, 272, 347, 664, 63, 1927, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 12455, 22122, 2, 339, 347, 636, 826, 721, 277, 12, 2748, 304, 267, 7337, 10701, 855, 826, 721, 277, 12, 2748, 9, 398, 291, 14, 2105, 63, 354, 275, 291, 14, 362, 63, 1422, 63, 585, 8, 1652, 12, 283, 354, 297, 620, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 1927, 2448, 297, 283, 1927, 358, 267, 291, 14, 1574, 63, 1985, 8, 1652, 9, 267, 291, 14, 1574, 63, 2969, 8, 1652, 9, 398, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2065, 31971, 17, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2065, 31971, 18, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 1832, 31971, 18, 297, 283, 470, 13, 344, 297, 2716, 275, 715, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 2105, 804, 297, 620, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 9492, 16359, 297, 1109, 9, 267, 291, 14, 1574, 63, 1422, 8, 1652, 12, 283, 5555, 1197, 297, 620, 12, 2716, 275, 715, 9, 339, 347, 2498, 63, 466, 8, 277, 304, 267, 372, 5310, 16, 93, 8910, 17, 11049, 1674, 908, 8, 277, 14, 362, 63, 466, 1062, 291, 14, 1985, 9, 421, 199, 533, 15474, 12455, 3225, 2223, 8, 4031, 2223, 304, 272, 408, 2223, 402, 376, 15474, 13311, 7220, 27166, 8113, 624, 339, 1950, 63, 354, 275, 1921, 63, 1829, 480, 9078, 14, 354, 401, 488, 9, 272, 2073, 63, 923, 275, 1921, 63, 1829, 480, 9078, 14, 1927, 2448, 401, 488, 9, 272, 2909, 275, 1921, 63, 1829, 480, 9078, 14, 1985, 401, 488, 9, 272, 3762, 275, 1921, 63, 1829, 480, 9078, 14, 2969, 401, 5479, 283, 1001, 358, 339, 5791, 63, 1200, 63, 7019, 17, 275, 1921, 63, 1829, 480, 9078, 14, 2065, 31971, 17, 401, 488, 9, 272, 5791, 63, 1200, 63, 7019, 18, 275, 1921, 63, 1829, 480, 9078, 14, 2065, 31971, 18, 401, 488, 9, 272, 2257, 63, 1200, 63, 7019, 18, 275, 1921, 63, 1829, 480, 9078, 14, 1832, 31971, 18, 401, 488, 9, 272, 1950, 63, 466, 275, 1921, 63, 1829, 480, 9078, 14, 2105, 804, 401, 488, 9, 272, 14870, 63, 3463, 275, 1921, 63, 1829, 480, 9078, 14, 9492, 16359, 401, 488, 12, 1109, 9, 272, 5709, 63, 498, 275, 1921, 63, 1829, 480, 9078, 14, 5555, 1197, 401, 488, 9, 339, 768, 3744, 272, 347, 664, 63, 466, 8, 1886, 304, 267, 372, 298, 9078, 13, 7019, 13, 2105, 2, 339, 347, 2498, 63, 466, 8, 277, 304, 267, 308, 275, 1613, 8, 22386, 12455, 3225, 2223, 12, 291, 680, 2384, 63, 466, 342, 267, 340, 291, 14, 929, 508, 291, 14, 2160, 26, 308, 275, 5310, 16, 93, 8910, 17, 11049, 1674, 908, 8, 83, 12, 291, 14, 1985, 9, 267, 372, 308, 339, 768, 1829, 272, 347, 2073, 63, 344, 8, 277, 304, 267, 372, 291, 14, 2105, 63, 354, 339, 768, 1829, 272, 347, 2615, 63, 354, 8, 277, 304, 267, 372, 298, 22386, 5791, 2784, 10391, 1950, 5041, 16, 30366, 908, 8, 277, 14, 1927, 63, 344, 9, 339, 347, 664, 63, 1927, 8, 277, 304, 267, 862, 26, 288, 372, 291, 14, 78, 4354, 1252, 2065, 63, 1200, 63, 7019, 63, 7995, 14, 362, 8, 1993, 291, 14, 1927, 63, 923, 12, 1993, 291, 14, 1927, 63, 344, 680, 2065, 63, 1200, 63, 7019, 63, 2105, 267, 871, 13601, 14, 2330, 14, 22386, 7718, 4031, 5779, 547, 26, 288, 372, 488, 339, 347, 11972, 63, 1927, 8, 277, 304, 267, 291, 14, 78, 4354, 1252, 2065, 63, 1200, 63, 7019, 63, 7995, 14, 1807, 8, 277, 14, 1927, 63, 923, 12, 18295, 291, 14, 1927, 63, 344, 9, 339, 347, 78, 63, 3282, 275, 359, 283, 1985, 297, 283, 2969, 297, 283, 2065, 63, 1200, 63, 7019, 17, 297, 717, 283, 2065, 63, 1200, 63, 7019, 18, 297, 283, 1832, 63, 1200, 63, 7019, 18, 297, 717, 283, 2105, 63, 466, 297, 283, 9492, 63, 3463, 297, 283, 5555, 63, 498, 7, 1622, 339, 347, 664, 63, 1927, 63, 633, 8, 277, 304, 267, 372, 1689, 2859, 921, 8110, 14, 9078, 14, 957, 15, 13233, 5321, 16, 7063, 2049, 3286, 26952, 5321, 17, 5995, 9710, 15, 12940, 14, 4491, 2, 2049, 3286, 7995, 5321, 18, 93, 31, 1246, 13, 1023, 29, 7806, 13, 1717, 13, 614, 13, 7780, 2, 2049, 1275, 908, 8, 3513, 8, 277, 14, 6645, 63, 344, 395, 2432, 6313, 8, 277, 14, 1927, 63, 923, 395, 2432, 6313, 8, 277, 14, 2105, 63, 354, 1724, 339, 347, 9199, 63, 1069, 8, 277, 12, 1083, 304, 267, 1455, 63, 1069, 275, 4784, 342, 267, 1455, 63, 1069, 14, 633, 275, 291, 14, 362, 63, 1927, 63, 633, 342, 267, 1455, 63, 1069, 14, 765, 275, 1083, 267, 1455, 63, 1069, 14, 2139, 459, 2714, 13, 804, 418, 275, 283, 3578, 15, 1001, 7, 267, 372, 1455, 63, 1069, 339, 347, 485, 981, 63, 269, 63, 873, 8, 277, 12, 347, 78, 304, 267, 2256, 275, 469, 288, 283, 1985, 356, 347, 78, 14, 1985, 12, 288, 283, 2969, 356, 347, 78, 14, 2969, 12, 288, 283, 3282, 356, 469, 355, 283, 2105, 804, 356, 347, 78, 14, 2105, 63, 466, 12, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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://0install.net/0compile.html import os, __main__ import shutil from zeroinstall import SafeException from zeroinstall.zerostore import manifest from support import BuildEnv, ensure_dir, lookup def do_include_deps(args): """include-deps""" buildenv = BuildEnv() depdir = os.path.realpath('dependencies') ensure_dir(depdir) dirs_to_copy = [] sels = buildenv.get_selections() for needed_iface in sels.selections: impl = buildenv.chosen_impl(needed_iface) assert impl if impl.local_path is not None: raise SafeException("Can't export '%s' as it's a local implementation (not supported yet; sorry)" % impl) if not impl.id.startswith('package:'): dirs_to_copy.append(lookup(impl)) copied = 0 for cached in dirs_to_copy: required_digest = os.path.basename(cached) target_impl_dir = os.path.join(depdir, required_digest) if not os.path.isdir(target_impl_dir): if required_digest.startswith('sha1='): shutil.copytree(cached, target_impl_dir) else: manifest_data = file(os.path.join(cached, '.manifest')).read() manifest.copy_tree_with_verify(cached, depdir, manifest_data, required_digest) copied += 1 print "Copied %d dependencies to %s (%d already there)" % (copied, depdir, len(dirs_to_copy) - copied) __main__.commands.append(do_include_deps)
lgpl-2.1
[ 3, 1898, 334, 35, 9, 10219, 12, 27864, 7005, 265, 1005, 199, 3, 1666, 1455, 921, 16, 3174, 14, 846, 15, 16, 2014, 14, 1360, 199, 199, 646, 747, 12, 636, 973, 363, 199, 646, 5145, 199, 199, 504, 4697, 3174, 492, 14969, 1726, 199, 504, 4697, 3174, 14, 2282, 941, 720, 492, 7712, 199, 199, 504, 2291, 492, 6516, 7744, 12, 4868, 63, 694, 12, 4237, 199, 199, 318, 886, 63, 2613, 63, 5846, 8, 589, 304, 199, 198, 624, 2613, 13, 5846, 624, 199, 198, 464, 382, 848, 86, 275, 6516, 7744, 342, 421, 198, 2601, 694, 275, 747, 14, 515, 14, 11091, 360, 5714, 358, 199, 198, 7505, 63, 694, 8, 2601, 694, 9, 421, 198, 3220, 63, 475, 63, 1574, 275, 942, 421, 198, 261, 478, 275, 1032, 382, 848, 86, 14, 362, 63, 5592, 83, 342, 199, 198, 509, 4346, 63, 11166, 315, 542, 478, 14, 5592, 83, 26, 507, 198, 5472, 275, 1032, 382, 848, 86, 14, 29671, 63, 5472, 8, 11368, 63, 11166, 9, 507, 198, 479, 11512, 507, 198, 692, 11512, 14, 1832, 63, 515, 365, 440, 488, 26, 686, 198, 3730, 14969, 1726, 480, 6049, 1133, 4843, 1543, 83, 7, 465, 652, 1159, 282, 2257, 4514, 334, 1397, 3748, 5966, 27, 308, 21342, 2924, 450, 11512, 9, 507, 198, 692, 440, 11512, 14, 344, 14, 2460, 360, 2491, 23117, 686, 198, 3220, 63, 475, 63, 1574, 14, 740, 8, 3892, 8, 5472, 430, 8299, 198, 23581, 275, 378, 199, 198, 509, 6328, 315, 7606, 63, 475, 63, 1574, 26, 507, 198, 2427, 63, 5671, 275, 747, 14, 515, 14, 4846, 8, 5245, 9, 507, 198, 1375, 63, 5472, 63, 694, 275, 747, 14, 515, 14, 904, 8, 2601, 694, 12, 1415, 63, 5671, 9, 507, 198, 692, 440, 747, 14, 515, 14, 6027, 8, 1375, 63, 5472, 63, 694, 304, 686, 198, 692, 1415, 63, 5671, 14, 2460, 360, 4835, 17, 534, 304, 1585, 198, 20938, 14, 29296, 8, 5245, 12, 1347, 63, 5472, 63, 694, 9, 686, 198, 2836, 26, 1585, 198, 6418, 63, 576, 275, 570, 8, 736, 14, 515, 14, 904, 8, 5245, 12, 1987, 6418, 11103, 739, 342, 1585, 198, 6418, 14, 1574, 63, 2350, 63, 1045, 63, 4712, 8, 5245, 12, 2657, 694, 12, 7712, 63, 576, 12, 1415, 63, 5671, 9, 686, 198, 23581, 847, 413, 421, 198, 1361, 298, 18268, 5299, 450, 68, 5124, 370, 450, 83, 4366, 68, 2575, 2337, 2924, 450, 334, 23581, 12, 2657, 694, 12, 822, 8, 3220, 63, 475, 63, 1574, 9, 446, 8876, 9, 199, 199, 363, 973, 4343, 4405, 14, 740, 8, 1117, 63, 2613, 63, 5846, 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 ]
[ 1898, 334, 35, 9, 10219, 12, 27864, 7005, 265, 1005, 199, 3, 1666, 1455, 921, 16, 3174, 14, 846, 15, 16, 2014, 14, 1360, 199, 199, 646, 747, 12, 636, 973, 363, 199, 646, 5145, 199, 199, 504, 4697, 3174, 492, 14969, 1726, 199, 504, 4697, 3174, 14, 2282, 941, 720, 492, 7712, 199, 199, 504, 2291, 492, 6516, 7744, 12, 4868, 63, 694, 12, 4237, 199, 199, 318, 886, 63, 2613, 63, 5846, 8, 589, 304, 199, 198, 624, 2613, 13, 5846, 624, 199, 198, 464, 382, 848, 86, 275, 6516, 7744, 342, 421, 198, 2601, 694, 275, 747, 14, 515, 14, 11091, 360, 5714, 358, 199, 198, 7505, 63, 694, 8, 2601, 694, 9, 421, 198, 3220, 63, 475, 63, 1574, 275, 942, 421, 198, 261, 478, 275, 1032, 382, 848, 86, 14, 362, 63, 5592, 83, 342, 199, 198, 509, 4346, 63, 11166, 315, 542, 478, 14, 5592, 83, 26, 507, 198, 5472, 275, 1032, 382, 848, 86, 14, 29671, 63, 5472, 8, 11368, 63, 11166, 9, 507, 198, 479, 11512, 507, 198, 692, 11512, 14, 1832, 63, 515, 365, 440, 488, 26, 686, 198, 3730, 14969, 1726, 480, 6049, 1133, 4843, 1543, 83, 7, 465, 652, 1159, 282, 2257, 4514, 334, 1397, 3748, 5966, 27, 308, 21342, 2924, 450, 11512, 9, 507, 198, 692, 440, 11512, 14, 344, 14, 2460, 360, 2491, 23117, 686, 198, 3220, 63, 475, 63, 1574, 14, 740, 8, 3892, 8, 5472, 430, 8299, 198, 23581, 275, 378, 199, 198, 509, 6328, 315, 7606, 63, 475, 63, 1574, 26, 507, 198, 2427, 63, 5671, 275, 747, 14, 515, 14, 4846, 8, 5245, 9, 507, 198, 1375, 63, 5472, 63, 694, 275, 747, 14, 515, 14, 904, 8, 2601, 694, 12, 1415, 63, 5671, 9, 507, 198, 692, 440, 747, 14, 515, 14, 6027, 8, 1375, 63, 5472, 63, 694, 304, 686, 198, 692, 1415, 63, 5671, 14, 2460, 360, 4835, 17, 534, 304, 1585, 198, 20938, 14, 29296, 8, 5245, 12, 1347, 63, 5472, 63, 694, 9, 686, 198, 2836, 26, 1585, 198, 6418, 63, 576, 275, 570, 8, 736, 14, 515, 14, 904, 8, 5245, 12, 1987, 6418, 11103, 739, 342, 1585, 198, 6418, 14, 1574, 63, 2350, 63, 1045, 63, 4712, 8, 5245, 12, 2657, 694, 12, 7712, 63, 576, 12, 1415, 63, 5671, 9, 686, 198, 23581, 847, 413, 421, 198, 1361, 298, 18268, 5299, 450, 68, 5124, 370, 450, 83, 4366, 68, 2575, 2337, 2924, 450, 334, 23581, 12, 2657, 694, 12, 822, 8, 3220, 63, 475, 63, 1574, 9, 446, 8876, 9, 199, 199, 363, 973, 4343, 4405, 14, 740, 8, 1117, 63, 2613, 63, 5846, 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, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
40223108/w18
static/Brython3.1.3-20150514-095342/Lib/unittest/test/test_result.py
788
19069
import io import sys import textwrap from test import support import traceback import unittest class Test_TestResult(unittest.TestCase): # Note: there are not separate tests for TestResult.wasSuccessful(), # TestResult.errors, TestResult.failures, TestResult.testsRun or # TestResult.shouldStop because these only have meaning in terms of # other TestResult methods. # # Accordingly, tests for the aforenamed attributes are incorporated # in with the tests for the defining methods. ################################################################ def test_init(self): result = unittest.TestResult() self.assertTrue(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 0) self.assertEqual(result.shouldStop, False) self.assertIsNone(result._stdout_buffer) self.assertIsNone(result._stderr_buffer) # "This method can be called to signal that the set of tests being # run should be aborted by setting the TestResult's shouldStop # attribute to True." def test_stop(self): result = unittest.TestResult() result.stop() self.assertEqual(result.shouldStop, True) # "Called when the test case test is about to be run. The default # implementation simply increments the instance's testsRun counter." def test_startTest(self): class Foo(unittest.TestCase): def test_1(self): pass test = Foo('test_1') result = unittest.TestResult() result.startTest(test) self.assertTrue(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) result.stopTest(test) # "Called after the test case test has been executed, regardless of # the outcome. The default implementation does nothing." def test_stopTest(self): class Foo(unittest.TestCase): def test_1(self): pass test = Foo('test_1') result = unittest.TestResult() result.startTest(test) self.assertTrue(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) result.stopTest(test) # Same tests as above; make sure nothing has changed self.assertTrue(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) # "Called before and after tests are run. The default implementation does nothing." def test_startTestRun_stopTestRun(self): result = unittest.TestResult() result.startTestRun() result.stopTestRun() # "addSuccess(test)" # ... # "Called when the test case test succeeds" # ... # "wasSuccessful() - Returns True if all tests run so far have passed, # otherwise returns False" # ... # "testsRun - The total number of tests run so far." # ... # "errors - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test which raised an # unexpected exception. Contains formatted # tracebacks instead of sys.exc_info() results." # ... # "failures - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test where a failure was # explicitly signalled using the TestCase.fail*() or TestCase.assert*() # methods. Contains formatted tracebacks instead # of sys.exc_info() results." def test_addSuccess(self): class Foo(unittest.TestCase): def test_1(self): pass test = Foo('test_1') result = unittest.TestResult() result.startTest(test) result.addSuccess(test) result.stopTest(test) self.assertTrue(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) # "addFailure(test, err)" # ... # "Called when the test case test signals a failure. err is a tuple of # the form returned by sys.exc_info(): (type, value, traceback)" # ... # "wasSuccessful() - Returns True if all tests run so far have passed, # otherwise returns False" # ... # "testsRun - The total number of tests run so far." # ... # "errors - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test which raised an # unexpected exception. Contains formatted # tracebacks instead of sys.exc_info() results." # ... # "failures - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test where a failure was # explicitly signalled using the TestCase.fail*() or TestCase.assert*() # methods. Contains formatted tracebacks instead # of sys.exc_info() results." def test_addFailure(self): class Foo(unittest.TestCase): def test_1(self): pass test = Foo('test_1') try: test.fail("foo") except: exc_info_tuple = sys.exc_info() result = unittest.TestResult() result.startTest(test) result.addFailure(test, exc_info_tuple) result.stopTest(test) self.assertFalse(result.wasSuccessful()) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 1) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) test_case, formatted_exc = result.failures[0] self.assertTrue(test_case is test) self.assertIsInstance(formatted_exc, str) # "addError(test, err)" # ... # "Called when the test case test raises an unexpected exception err # is a tuple of the form returned by sys.exc_info(): # (type, value, traceback)" # ... # "wasSuccessful() - Returns True if all tests run so far have passed, # otherwise returns False" # ... # "testsRun - The total number of tests run so far." # ... # "errors - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test which raised an # unexpected exception. Contains formatted # tracebacks instead of sys.exc_info() results." # ... # "failures - A list containing 2-tuples of TestCase instances and # formatted tracebacks. Each tuple represents a test where a failure was # explicitly signalled using the TestCase.fail*() or TestCase.assert*() # methods. Contains formatted tracebacks instead # of sys.exc_info() results." def test_addError(self): class Foo(unittest.TestCase): def test_1(self): pass test = Foo('test_1') try: raise TypeError() except: exc_info_tuple = sys.exc_info() result = unittest.TestResult() result.startTest(test) result.addError(test, exc_info_tuple) result.stopTest(test) self.assertFalse(result.wasSuccessful()) self.assertEqual(len(result.errors), 1) self.assertEqual(len(result.failures), 0) self.assertEqual(result.testsRun, 1) self.assertEqual(result.shouldStop, False) test_case, formatted_exc = result.errors[0] self.assertTrue(test_case is test) self.assertIsInstance(formatted_exc, str) def testGetDescriptionWithoutDocstring(self): result = unittest.TextTestResult(None, True, 1) self.assertEqual( result.getDescription(self), 'testGetDescriptionWithoutDocstring (' + __name__ + '.Test_TestResult)') @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def testGetDescriptionWithOneLineDocstring(self): """Tests getDescription() for a method with a docstring.""" result = unittest.TextTestResult(None, True, 1) self.assertEqual( result.getDescription(self), ('testGetDescriptionWithOneLineDocstring ' '(' + __name__ + '.Test_TestResult)\n' 'Tests getDescription() for a method with a docstring.')) @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def testGetDescriptionWithMultiLineDocstring(self): """Tests getDescription() for a method with a longer docstring. The second line of the docstring. """ result = unittest.TextTestResult(None, True, 1) self.assertEqual( result.getDescription(self), ('testGetDescriptionWithMultiLineDocstring ' '(' + __name__ + '.Test_TestResult)\n' 'Tests getDescription() for a method with a longer ' 'docstring.')) def testStackFrameTrimming(self): class Frame(object): class tb_frame(object): f_globals = {} result = unittest.TestResult() self.assertFalse(result._is_relevant_tb_level(Frame)) Frame.tb_frame.f_globals['__unittest'] = True self.assertTrue(result._is_relevant_tb_level(Frame)) def testFailFast(self): result = unittest.TestResult() result._exc_info_to_string = lambda *_: '' result.failfast = True result.addError(None, None) self.assertTrue(result.shouldStop) result = unittest.TestResult() result._exc_info_to_string = lambda *_: '' result.failfast = True result.addFailure(None, None) self.assertTrue(result.shouldStop) result = unittest.TestResult() result._exc_info_to_string = lambda *_: '' result.failfast = True result.addUnexpectedSuccess(None) self.assertTrue(result.shouldStop) def testFailFastSetByRunner(self): runner = unittest.TextTestRunner(stream=io.StringIO(), failfast=True) def test(result): self.assertTrue(result.failfast) result = runner.run(test) classDict = dict(unittest.TestResult.__dict__) for m in ('addSkip', 'addExpectedFailure', 'addUnexpectedSuccess', '__init__'): del classDict[m] def __init__(self, stream=None, descriptions=None, verbosity=None): self.failures = [] self.errors = [] self.testsRun = 0 self.shouldStop = False self.buffer = False classDict['__init__'] = __init__ OldResult = type('OldResult', (object,), classDict) class Test_OldTestResult(unittest.TestCase): def assertOldResultWarning(self, test, failures): with support.check_warnings(("TestResult has no add.+ method,", RuntimeWarning)): result = OldResult() test.run(result) self.assertEqual(len(result.failures), failures) def testOldTestResult(self): class Test(unittest.TestCase): def testSkip(self): self.skipTest('foobar') @unittest.expectedFailure def testExpectedFail(self): raise TypeError @unittest.expectedFailure def testUnexpectedSuccess(self): pass for test_name, should_pass in (('testSkip', True), ('testExpectedFail', True), ('testUnexpectedSuccess', False)): test = Test(test_name) self.assertOldResultWarning(test, int(not should_pass)) def testOldTestTesultSetup(self): class Test(unittest.TestCase): def setUp(self): self.skipTest('no reason') def testFoo(self): pass self.assertOldResultWarning(Test('testFoo'), 0) def testOldTestResultClass(self): @unittest.skip('no reason') class Test(unittest.TestCase): def testFoo(self): pass self.assertOldResultWarning(Test('testFoo'), 0) def testOldResultWithRunner(self): class Test(unittest.TestCase): def testFoo(self): pass runner = unittest.TextTestRunner(resultclass=OldResult, stream=io.StringIO()) # This will raise an exception if TextTestRunner can't handle old # test result objects runner.run(Test('testFoo')) class MockTraceback(object): @staticmethod def format_exception(*_): return ['A traceback'] def restore_traceback(): unittest.result.traceback = traceback class TestOutputBuffering(unittest.TestCase): def setUp(self): self._real_out = sys.stdout self._real_err = sys.stderr def tearDown(self): sys.stdout = self._real_out sys.stderr = self._real_err def testBufferOutputOff(self): real_out = self._real_out real_err = self._real_err result = unittest.TestResult() self.assertFalse(result.buffer) self.assertIs(real_out, sys.stdout) self.assertIs(real_err, sys.stderr) result.startTest(self) self.assertIs(real_out, sys.stdout) self.assertIs(real_err, sys.stderr) def testBufferOutputStartTestAddSuccess(self): real_out = self._real_out real_err = self._real_err result = unittest.TestResult() self.assertFalse(result.buffer) result.buffer = True self.assertIs(real_out, sys.stdout) self.assertIs(real_err, sys.stderr) result.startTest(self) self.assertIsNot(real_out, sys.stdout) self.assertIsNot(real_err, sys.stderr) self.assertIsInstance(sys.stdout, io.StringIO) self.assertIsInstance(sys.stderr, io.StringIO) self.assertIsNot(sys.stdout, sys.stderr) out_stream = sys.stdout err_stream = sys.stderr result._original_stdout = io.StringIO() result._original_stderr = io.StringIO() print('foo') print('bar', file=sys.stderr) self.assertEqual(out_stream.getvalue(), 'foo\n') self.assertEqual(err_stream.getvalue(), 'bar\n') self.assertEqual(result._original_stdout.getvalue(), '') self.assertEqual(result._original_stderr.getvalue(), '') result.addSuccess(self) result.stopTest(self) self.assertIs(sys.stdout, result._original_stdout) self.assertIs(sys.stderr, result._original_stderr) self.assertEqual(result._original_stdout.getvalue(), '') self.assertEqual(result._original_stderr.getvalue(), '') self.assertEqual(out_stream.getvalue(), '') self.assertEqual(err_stream.getvalue(), '') def getStartedResult(self): result = unittest.TestResult() result.buffer = True result.startTest(self) return result def testBufferOutputAddErrorOrFailure(self): unittest.result.traceback = MockTraceback self.addCleanup(restore_traceback) for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._original_stdout = io.StringIO() result._original_stderr = io.StringIO() print('foo', file=sys.stdout) if include_error: print('bar', file=sys.stderr) addFunction = getattr(result, add_attr) addFunction(self, (None, None, None)) result.stopTest(self) result_list = getattr(result, message_attr) self.assertEqual(len(result_list), 1) test, message = result_list[0] expectedOutMessage = textwrap.dedent(""" Stdout: foo """) expectedErrMessage = '' if include_error: expectedErrMessage = textwrap.dedent(""" Stderr: bar """) expectedFullMessage = 'A traceback%s%s' % (expectedOutMessage, expectedErrMessage) self.assertIs(test, self) self.assertEqual(result._original_stdout.getvalue(), expectedOutMessage) self.assertEqual(result._original_stderr.getvalue(), expectedErrMessage) self.assertMultiLineEqual(message, expectedFullMessage) def testBufferSetupClass(self): result = unittest.TestResult() result.buffer = True class Foo(unittest.TestCase): @classmethod def setUpClass(cls): 1/0 def test_foo(self): pass suite = unittest.TestSuite([Foo('test_foo')]) suite(result) self.assertEqual(len(result.errors), 1) def testBufferTearDownClass(self): result = unittest.TestResult() result.buffer = True class Foo(unittest.TestCase): @classmethod def tearDownClass(cls): 1/0 def test_foo(self): pass suite = unittest.TestSuite([Foo('test_foo')]) suite(result) self.assertEqual(len(result.errors), 1) def testBufferSetUpModule(self): result = unittest.TestResult() result.buffer = True class Foo(unittest.TestCase): def test_foo(self): pass class Module(object): @staticmethod def setUpModule(): 1/0 Foo.__module__ = 'Module' sys.modules['Module'] = Module self.addCleanup(sys.modules.pop, 'Module') suite = unittest.TestSuite([Foo('test_foo')]) suite(result) self.assertEqual(len(result.errors), 1) def testBufferTearDownModule(self): result = unittest.TestResult() result.buffer = True class Foo(unittest.TestCase): def test_foo(self): pass class Module(object): @staticmethod def tearDownModule(): 1/0 Foo.__module__ = 'Module' sys.modules['Module'] = Module self.addCleanup(sys.modules.pop, 'Module') suite = unittest.TestSuite([Foo('test_foo')]) suite(result) self.assertEqual(len(result.errors), 1) if __name__ == '__main__': unittest.main()
gpl-3.0
[ 646, 5890, 199, 646, 984, 199, 646, 13390, 199, 199, 504, 511, 492, 2291, 199, 199, 646, 5190, 199, 646, 2882, 421, 199, 533, 1379, 63, 13120, 8, 2796, 14, 1746, 304, 272, 327, 3390, 26, 2337, 787, 440, 7396, 2295, 367, 23795, 14, 10274, 20839, 1062, 272, 327, 23795, 14, 2550, 12, 23795, 14, 9968, 12, 23795, 14, 30680, 503, 272, 327, 23795, 14, 5626, 6293, 2952, 3520, 1454, 1172, 11150, 315, 2895, 402, 272, 327, 1163, 23795, 3102, 14, 272, 327, 272, 327, 31970, 590, 12, 2295, 367, 314, 282, 1707, 4579, 3004, 787, 30147, 972, 272, 327, 315, 543, 314, 2295, 367, 314, 12669, 3102, 14, 272, 15779, 339, 347, 511, 63, 826, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 267, 291, 14, 7702, 8, 1099, 423, 2703, 63, 2738, 9, 267, 291, 14, 7702, 8, 1099, 423, 3083, 63, 2738, 9, 339, 327, 298, 2765, 1083, 883, 506, 2797, 370, 4673, 626, 314, 663, 402, 2295, 3769, 272, 327, 1255, 1077, 506, 26815, 701, 4260, 314, 23795, 1159, 1077, 6293, 272, 327, 2225, 370, 715, 2122, 272, 347, 511, 63, 2379, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 2379, 342, 398, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 715, 9, 339, 327, 298, 10474, 1380, 314, 511, 1930, 511, 365, 3595, 370, 506, 1255, 14, 710, 849, 272, 327, 4514, 9329, 10035, 1470, 314, 1256, 1159, 2295, 2540, 7055, 2122, 272, 347, 511, 63, 29344, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 398, 754, 14, 2379, 774, 8, 396, 9, 339, 327, 298, 10474, 2410, 314, 511, 1930, 511, 965, 2757, 7934, 12, 15270, 402, 272, 327, 314, 15955, 14, 710, 849, 4514, 1630, 6548, 2122, 272, 347, 511, 63, 2379, 774, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 398, 754, 14, 2379, 774, 8, 396, 9, 398, 327, 14766, 2295, 465, 3432, 27, 1852, 3238, 6548, 965, 2896, 267, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 339, 327, 298, 10474, 2544, 436, 2410, 2295, 787, 1255, 14, 710, 849, 4514, 1630, 6548, 2122, 272, 347, 511, 63, 928, 21228, 63, 2379, 21228, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 267, 754, 14, 928, 21228, 342, 267, 754, 14, 2379, 21228, 342, 339, 327, 298, 525, 8300, 8, 396, 2924, 272, 327, 2263, 272, 327, 298, 10474, 1380, 314, 511, 1930, 511, 24611, 2, 272, 327, 2263, 272, 327, 298, 10274, 20839, 342, 446, 1803, 715, 340, 1006, 2295, 1255, 880, 12474, 1172, 3032, 12, 272, 327, 4257, 2529, 756, 2, 272, 327, 2263, 272, 327, 298, 30680, 446, 710, 3141, 1329, 402, 2295, 1255, 880, 12474, 2122, 272, 327, 2263, 272, 327, 298, 2550, 446, 437, 769, 3035, 499, 13, 11760, 402, 7640, 4454, 436, 272, 327, 7871, 5190, 83, 14, 7048, 2008, 8469, 282, 511, 1314, 4915, 376, 272, 327, 10537, 1919, 14, 22493, 7871, 272, 327, 5190, 83, 3140, 402, 984, 14, 2804, 63, 815, 342, 2058, 2122, 272, 327, 2263, 272, 327, 298, 9968, 446, 437, 769, 3035, 499, 13, 11760, 402, 7640, 4454, 436, 272, 327, 7871, 5190, 83, 14, 7048, 2008, 8469, 282, 511, 2382, 282, 5988, 1990, 272, 327, 7662, 2070, 1843, 1808, 314, 7640, 14, 1633, 10, 342, 503, 7640, 14, 479, 10, 342, 272, 327, 3102, 14, 22493, 7871, 5190, 83, 3140, 272, 327, 402, 984, 14, 2804, 63, 815, 342, 2058, 2122, 272, 347, 511, 63, 525, 8300, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 267, 754, 14, 525, 8300, 8, 396, 9, 267, 754, 14, 2379, 774, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 339, 327, 298, 525, 6782, 8, 396, 12, 2329, 2924, 272, 327, 2263, 272, 327, 298, 10474, 1380, 314, 511, 1930, 511, 10166, 282, 5988, 14, 2329 ]
[ 5890, 199, 646, 984, 199, 646, 13390, 199, 199, 504, 511, 492, 2291, 199, 199, 646, 5190, 199, 646, 2882, 421, 199, 533, 1379, 63, 13120, 8, 2796, 14, 1746, 304, 272, 327, 3390, 26, 2337, 787, 440, 7396, 2295, 367, 23795, 14, 10274, 20839, 1062, 272, 327, 23795, 14, 2550, 12, 23795, 14, 9968, 12, 23795, 14, 30680, 503, 272, 327, 23795, 14, 5626, 6293, 2952, 3520, 1454, 1172, 11150, 315, 2895, 402, 272, 327, 1163, 23795, 3102, 14, 272, 327, 272, 327, 31970, 590, 12, 2295, 367, 314, 282, 1707, 4579, 3004, 787, 30147, 972, 272, 327, 315, 543, 314, 2295, 367, 314, 12669, 3102, 14, 272, 15779, 339, 347, 511, 63, 826, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 267, 291, 14, 7702, 8, 1099, 423, 2703, 63, 2738, 9, 267, 291, 14, 7702, 8, 1099, 423, 3083, 63, 2738, 9, 339, 327, 298, 2765, 1083, 883, 506, 2797, 370, 4673, 626, 314, 663, 402, 2295, 3769, 272, 327, 1255, 1077, 506, 26815, 701, 4260, 314, 23795, 1159, 1077, 6293, 272, 327, 2225, 370, 715, 2122, 272, 347, 511, 63, 2379, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 2379, 342, 398, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 715, 9, 339, 327, 298, 10474, 1380, 314, 511, 1930, 511, 365, 3595, 370, 506, 1255, 14, 710, 849, 272, 327, 4514, 9329, 10035, 1470, 314, 1256, 1159, 2295, 2540, 7055, 2122, 272, 347, 511, 63, 29344, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 398, 754, 14, 2379, 774, 8, 396, 9, 339, 327, 298, 10474, 2410, 314, 511, 1930, 511, 965, 2757, 7934, 12, 15270, 402, 272, 327, 314, 15955, 14, 710, 849, 4514, 1630, 6548, 2122, 272, 347, 511, 63, 2379, 774, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 398, 754, 14, 2379, 774, 8, 396, 9, 398, 327, 14766, 2295, 465, 3432, 27, 1852, 3238, 6548, 965, 2896, 267, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 339, 327, 298, 10474, 2544, 436, 2410, 2295, 787, 1255, 14, 710, 849, 4514, 1630, 6548, 2122, 272, 347, 511, 63, 928, 21228, 63, 2379, 21228, 8, 277, 304, 267, 754, 275, 2882, 14, 13120, 342, 267, 754, 14, 928, 21228, 342, 267, 754, 14, 2379, 21228, 342, 339, 327, 298, 525, 8300, 8, 396, 2924, 272, 327, 2263, 272, 327, 298, 10474, 1380, 314, 511, 1930, 511, 24611, 2, 272, 327, 2263, 272, 327, 298, 10274, 20839, 342, 446, 1803, 715, 340, 1006, 2295, 1255, 880, 12474, 1172, 3032, 12, 272, 327, 4257, 2529, 756, 2, 272, 327, 2263, 272, 327, 298, 30680, 446, 710, 3141, 1329, 402, 2295, 1255, 880, 12474, 2122, 272, 327, 2263, 272, 327, 298, 2550, 446, 437, 769, 3035, 499, 13, 11760, 402, 7640, 4454, 436, 272, 327, 7871, 5190, 83, 14, 7048, 2008, 8469, 282, 511, 1314, 4915, 376, 272, 327, 10537, 1919, 14, 22493, 7871, 272, 327, 5190, 83, 3140, 402, 984, 14, 2804, 63, 815, 342, 2058, 2122, 272, 327, 2263, 272, 327, 298, 9968, 446, 437, 769, 3035, 499, 13, 11760, 402, 7640, 4454, 436, 272, 327, 7871, 5190, 83, 14, 7048, 2008, 8469, 282, 511, 2382, 282, 5988, 1990, 272, 327, 7662, 2070, 1843, 1808, 314, 7640, 14, 1633, 10, 342, 503, 7640, 14, 479, 10, 342, 272, 327, 3102, 14, 22493, 7871, 5190, 83, 3140, 272, 327, 402, 984, 14, 2804, 63, 815, 342, 2058, 2122, 272, 347, 511, 63, 525, 8300, 8, 277, 304, 267, 1021, 8024, 8, 2796, 14, 1746, 304, 288, 347, 511, 63, 17, 8, 277, 304, 355, 986, 398, 511, 275, 8024, 360, 396, 63, 17, 358, 398, 754, 275, 2882, 14, 13120, 342, 398, 754, 14, 29344, 8, 396, 9, 267, 754, 14, 525, 8300, 8, 396, 9, 267, 754, 14, 2379, 774, 8, 396, 9, 398, 291, 14, 1815, 8, 1099, 14, 10274, 20839, 1012, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 2550, 395, 378, 9, 267, 291, 14, 629, 8, 552, 8, 1099, 14, 9968, 395, 378, 9, 267, 291, 14, 629, 8, 1099, 14, 30680, 12, 413, 9, 267, 291, 14, 629, 8, 1099, 14, 5626, 6293, 12, 756, 9, 339, 327, 298, 525, 6782, 8, 396, 12, 2329, 2924, 272, 327, 2263, 272, 327, 298, 10474, 1380, 314, 511, 1930, 511, 10166, 282, 5988, 14, 2329, 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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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 ]
ejpbruel/servo
tests/wpt/css-tests/tools/wptserve/wptserve/ranges.py
329
3003
from utils import HTTPException class RangeParser(object): def __call__(self, header, file_size): prefix = "bytes=" if not header.startswith(prefix): raise HTTPException(416, message="Unrecognised range type %s" % (header,)) parts = header[len(prefix):].split(",") ranges = [] for item in parts: components = item.split("-") if len(components) != 2: raise HTTPException(416, "Bad range specifier %s" % (item)) data = [] for component in components: if component == "": data.append(None) else: try: data.append(int(component)) except ValueError: raise HTTPException(416, "Bad range specifier %s" % (item)) try: ranges.append(Range(data[0], data[1], file_size)) except ValueError: raise HTTPException(416, "Bad range specifier %s" % (item)) return self.coalesce_ranges(ranges, file_size) def coalesce_ranges(self, ranges, file_size): rv = [] target = None for current in reversed(sorted(ranges)): if target is None: target = current else: new = target.coalesce(current) target = new[0] if len(new) > 1: rv.append(new[1]) rv.append(target) return rv[::-1] class Range(object): def __init__(self, lower, upper, file_size): self.file_size = file_size self.lower, self.upper = self._abs(lower, upper) if self.lower >= self.upper or self.lower >= self.file_size: raise ValueError def __repr__(self): return "<Range %s-%s>" % (self.lower, self.upper) def __lt__(self, other): return self.lower < other.lower def __gt__(self, other): return self.lower > other.lower def __eq__(self, other): return self.lower == other.lower and self.upper == other.upper def _abs(self, lower, upper): if lower is None and upper is None: lower, upper = 0, self.file_size elif lower is None: lower, upper = max(0, self.file_size - upper), self.file_size elif upper is None: lower, upper = lower, self.file_size else: lower, upper = lower, min(self.file_size, upper + 1) return lower, upper def coalesce(self, other): assert self.file_size == other.file_size if (self.upper < other.lower or self.lower > other.upper): return sorted([self, other]) else: return [Range(min(self.lower, other.lower), max(self.upper, other.upper) - 1, self.file_size)] def header_value(self): return "bytes %i-%i/%i" % (self.lower, self.upper - 1, self.file_size)
mpl-2.0
[ 504, 3778, 492, 28185, 421, 199, 533, 13114, 2842, 8, 785, 304, 272, 347, 636, 1250, 721, 277, 12, 1406, 12, 570, 63, 890, 304, 267, 2403, 275, 298, 2394, 628, 267, 340, 440, 1406, 14, 2460, 8, 1861, 304, 288, 746, 28185, 8, 25209, 12, 1245, 628, 1358, 29324, 9096, 1425, 730, 450, 83, 2, 450, 334, 1291, 4641, 398, 4184, 275, 1406, 59, 552, 8, 1861, 304, 1055, 1294, 20324, 267, 12271, 275, 942, 267, 367, 1242, 315, 4184, 26, 288, 7323, 275, 1242, 14, 1294, 6096, 531, 288, 340, 822, 8, 4608, 9, 1137, 499, 26, 355, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 288, 666, 275, 942, 288, 367, 3931, 315, 7323, 26, 355, 340, 3931, 508, 10812, 490, 666, 14, 740, 8, 403, 9, 355, 587, 26, 490, 862, 26, 717, 666, 14, 740, 8, 442, 8, 3173, 430, 490, 871, 1722, 26, 717, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 288, 862, 26, 355, 12271, 14, 740, 8, 4709, 8, 576, 59, 16, 467, 666, 59, 17, 467, 570, 63, 890, 430, 288, 871, 1722, 26, 355, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 398, 372, 291, 14, 331, 29944, 63, 8404, 8, 8404, 12, 570, 63, 890, 9, 339, 347, 512, 29944, 63, 8404, 8, 277, 12, 12271, 12, 570, 63, 890, 304, 267, 4336, 275, 942, 267, 1347, 275, 488, 267, 367, 1453, 315, 10822, 8, 5917, 8, 8404, 2298, 288, 340, 1347, 365, 488, 26, 355, 1347, 275, 1453, 288, 587, 26, 355, 892, 275, 1347, 14, 331, 29944, 8, 1818, 9, 355, 1347, 275, 892, 59, 16, 61, 355, 340, 822, 8, 1222, 9, 690, 413, 26, 490, 4336, 14, 740, 8, 1222, 59, 17, 566, 267, 4336, 14, 740, 8, 1375, 9, 398, 372, 4336, 14172, 17, 61, 421, 199, 533, 13114, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 5117, 12, 7008, 12, 570, 63, 890, 304, 267, 291, 14, 493, 63, 890, 275, 570, 63, 890, 267, 291, 14, 2325, 12, 291, 14, 4142, 275, 291, 423, 2101, 8, 2325, 12, 7008, 9, 267, 340, 291, 14, 2325, 2356, 291, 14, 4142, 503, 291, 14, 2325, 2356, 291, 14, 493, 63, 890, 26, 288, 746, 1722, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 3886, 4709, 450, 83, 3295, 83, 4335, 450, 334, 277, 14, 2325, 12, 291, 14, 4142, 9, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 665, 1163, 14, 2325, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 690, 1163, 14, 2325, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 508, 1163, 14, 2325, 436, 291, 14, 4142, 508, 1163, 14, 4142, 339, 347, 485, 2101, 8, 277, 12, 5117, 12, 7008, 304, 267, 340, 5117, 365, 488, 436, 7008, 365, 488, 26, 288, 5117, 12, 7008, 275, 378, 12, 291, 14, 493, 63, 890, 267, 916, 5117, 365, 488, 26, 288, 5117, 12, 7008, 275, 1390, 8, 16, 12, 291, 14, 493, 63, 890, 446, 7008, 395, 291, 14, 493, 63, 890, 267, 916, 7008, 365, 488, 26, 288, 5117, 12, 7008, 275, 5117, 12, 291, 14, 493, 63, 890, 267, 587, 26, 288, 5117, 12, 7008, 275, 5117, 12, 1748, 8, 277, 14, 493, 63, 890, 12, 7008, 435, 413, 9, 398, 372, 5117, 12, 7008, 339, 347, 512, 29944, 8, 277, 12, 1163, 304, 267, 702, 291, 14, 493, 63, 890, 508, 1163, 14, 493, 63, 890, 398, 340, 334, 277, 14, 4142, 665, 1163, 14, 2325, 503, 291, 14, 2325, 690, 1163, 14, 4142, 304, 288, 372, 3355, 779, 277, 12, 1163, 566, 267, 587, 26, 288, 372, 359, 4709, 8, 827, 8, 277, 14, 2325, 12, 1163, 14, 2325, 395, 2079, 1390, 8, 277, 14, 4142, 12, 1163, 14, 4142, 9, 446, 413, 12, 2079, 291, 14, 493, 63, 890, 1874, 339, 347, 1406, 63, 585, 8, 277, 304, 267, 372, 298, 2394, 450, 73, 3295, 73, 3149, 73, 2, 450, 334, 277, 14, 2325, 12, 291, 14, 4142, 446, 413, 12, 291, 14, 493, 63, 890, 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 ]
[ 3778, 492, 28185, 421, 199, 533, 13114, 2842, 8, 785, 304, 272, 347, 636, 1250, 721, 277, 12, 1406, 12, 570, 63, 890, 304, 267, 2403, 275, 298, 2394, 628, 267, 340, 440, 1406, 14, 2460, 8, 1861, 304, 288, 746, 28185, 8, 25209, 12, 1245, 628, 1358, 29324, 9096, 1425, 730, 450, 83, 2, 450, 334, 1291, 4641, 398, 4184, 275, 1406, 59, 552, 8, 1861, 304, 1055, 1294, 20324, 267, 12271, 275, 942, 267, 367, 1242, 315, 4184, 26, 288, 7323, 275, 1242, 14, 1294, 6096, 531, 288, 340, 822, 8, 4608, 9, 1137, 499, 26, 355, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 288, 666, 275, 942, 288, 367, 3931, 315, 7323, 26, 355, 340, 3931, 508, 10812, 490, 666, 14, 740, 8, 403, 9, 355, 587, 26, 490, 862, 26, 717, 666, 14, 740, 8, 442, 8, 3173, 430, 490, 871, 1722, 26, 717, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 288, 862, 26, 355, 12271, 14, 740, 8, 4709, 8, 576, 59, 16, 467, 666, 59, 17, 467, 570, 63, 890, 430, 288, 871, 1722, 26, 355, 746, 28185, 8, 25209, 12, 298, 5725, 1425, 16628, 450, 83, 2, 450, 334, 1053, 430, 398, 372, 291, 14, 331, 29944, 63, 8404, 8, 8404, 12, 570, 63, 890, 9, 339, 347, 512, 29944, 63, 8404, 8, 277, 12, 12271, 12, 570, 63, 890, 304, 267, 4336, 275, 942, 267, 1347, 275, 488, 267, 367, 1453, 315, 10822, 8, 5917, 8, 8404, 2298, 288, 340, 1347, 365, 488, 26, 355, 1347, 275, 1453, 288, 587, 26, 355, 892, 275, 1347, 14, 331, 29944, 8, 1818, 9, 355, 1347, 275, 892, 59, 16, 61, 355, 340, 822, 8, 1222, 9, 690, 413, 26, 490, 4336, 14, 740, 8, 1222, 59, 17, 566, 267, 4336, 14, 740, 8, 1375, 9, 398, 372, 4336, 14172, 17, 61, 421, 199, 533, 13114, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 5117, 12, 7008, 12, 570, 63, 890, 304, 267, 291, 14, 493, 63, 890, 275, 570, 63, 890, 267, 291, 14, 2325, 12, 291, 14, 4142, 275, 291, 423, 2101, 8, 2325, 12, 7008, 9, 267, 340, 291, 14, 2325, 2356, 291, 14, 4142, 503, 291, 14, 2325, 2356, 291, 14, 493, 63, 890, 26, 288, 746, 1722, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 3886, 4709, 450, 83, 3295, 83, 4335, 450, 334, 277, 14, 2325, 12, 291, 14, 4142, 9, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 665, 1163, 14, 2325, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 690, 1163, 14, 2325, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2325, 508, 1163, 14, 2325, 436, 291, 14, 4142, 508, 1163, 14, 4142, 339, 347, 485, 2101, 8, 277, 12, 5117, 12, 7008, 304, 267, 340, 5117, 365, 488, 436, 7008, 365, 488, 26, 288, 5117, 12, 7008, 275, 378, 12, 291, 14, 493, 63, 890, 267, 916, 5117, 365, 488, 26, 288, 5117, 12, 7008, 275, 1390, 8, 16, 12, 291, 14, 493, 63, 890, 446, 7008, 395, 291, 14, 493, 63, 890, 267, 916, 7008, 365, 488, 26, 288, 5117, 12, 7008, 275, 5117, 12, 291, 14, 493, 63, 890, 267, 587, 26, 288, 5117, 12, 7008, 275, 5117, 12, 1748, 8, 277, 14, 493, 63, 890, 12, 7008, 435, 413, 9, 398, 372, 5117, 12, 7008, 339, 347, 512, 29944, 8, 277, 12, 1163, 304, 267, 702, 291, 14, 493, 63, 890, 508, 1163, 14, 493, 63, 890, 398, 340, 334, 277, 14, 4142, 665, 1163, 14, 2325, 503, 291, 14, 2325, 690, 1163, 14, 4142, 304, 288, 372, 3355, 779, 277, 12, 1163, 566, 267, 587, 26, 288, 372, 359, 4709, 8, 827, 8, 277, 14, 2325, 12, 1163, 14, 2325, 395, 2079, 1390, 8, 277, 14, 4142, 12, 1163, 14, 4142, 9, 446, 413, 12, 2079, 291, 14, 493, 63, 890, 1874, 339, 347, 1406, 63, 585, 8, 277, 304, 267, 372, 298, 2394, 450, 73, 3295, 73, 3149, 73, 2, 450, 334, 277, 14, 2325, 12, 291, 14, 4142, 446, 413, 12, 291, 14, 493, 63, 890, 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, 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, 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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 ]
UKPLab/semeval2017-scienceie
code/skip-thoughts/TomKenter-siamese-cbow-faf752ef6a99/docClassify.py
1
3459
#! /usr/bin/python import sys,cPickle as pkl,numpy as np from keras.layers import Dense, Dropout from keras.models import Sequential from keras.utils.np_utils import to_categorical import stack5 as st_learn # SAMPLE USAGE # ./docClassify.py vectors_docs_siamese.pkl def build_nn(input_dim, output_dim,hidden_dim=100): nn_classifier = Sequential() nn_classifier.add(Dense(hidden_dim, input_dim=input_dim, activation='tanh')) nn_classifier.add(Dropout(0.5)) #nn_classifier.add(Dense(100, activation='tanh')) nn_classifier.add(Dense(output_dim=output_dim, activation='softmax')) nn_classifier.compile(optimizer='adagrad', loss='categorical_crossentropy', metrics=['accuracy']) return nn_classifier f=open(sys.argv[1],"rb") classes = pkl.load(f) vectors = pkl.load(f) vecs_and_indices = [(i,v) for (i,v) in enumerate(vectors) if type(v)==type(vectors[0])] vecs = np.vstack([x[-1] for x in vecs_and_indices]) print vecs.shape relevant_classes = [] my_classes = {} class_index = 0 for (i,v) in vecs_and_indices: if classes[i] not in my_classes: my_classes[classes[i]] = class_index class_index += 1 c = my_classes[classes[i]] relevant_classes.append(c) relevant_classes = np.array(relevant_classes) nclasses = class_index perm=np.random.permutation(len(relevant_classes)) #np.random.rand(perm,1) training_ratio = 0.99 train_n = int( len(relevant_classes)*training_ratio ) train_x,test_x = vecs[perm][:train_n,:],vecs[perm][train_n:,:] train_y,test_y = relevant_classes[perm][:train_n],relevant_classes[perm][train_n:] blend_train, blend_test, baseClassifiers = st_learn.stack_multiclass(train_x, train_y, test_x, filename_x = "A", filename_y = "B", n_folds=10) # TEST_Z is your test file TEST_Z = test_x base_predictions = [] for bc in baseClassifiers: base_predictions.append(bc.predict_proba(TEST_Z)[:,:-1]) # the base classifiers classify first test_for_MetaClassifier = np.c_[base_predictions[0], base_predictions[1], base_predictions[2], base_predictions[3], base_predictions[4]] Y_train_1hot = to_categorical(train_y,nclasses) Y_test_1hot = to_categorical(test_y,nclasses) hiddenDim = 20 mymodel,test_predict = st_learn.model_withValidation(blend_train, Y_train_1hot, blend_test, Y_test_1hot, hiddenDim=hiddenDim, filename_x = "C", filename_y = "D") #print "\n=======CHECK" # then the Meta Classifier combines the predictions of the base classifiers print mymodel.predict_proba(test_for_MetaClassifier,verbose=0) #[:20,:] #print test_predict[:20]; sys.exit(1) f=open("docClassifer.pkl","wb") pkl.dump(baseClassifiers,f) pkl.dump(mymodel,f) pkl.dump(my_classes,f) f.close() if False: print len(vectors),len(vecs),len(relevant_classes),train_x.shape,train_y.shape,test_x.shape print to_categorical([1,2,3,0],4) classifier = build_nn(train_x.shape[1], nclasses,hidden_dim=500) classifier.fit(train_x, to_categorical(train_y, nclasses), verbose=True, nb_epoch=5) test_predict = classifier.predict_classes(test_x) print test_predict class0 = np.zeros((len(test_y),)) class1 = np.zeros((len(test_y),))+1 class2 = np.zeros((len(test_y),))+2 print "\nPREDICTION",sum(test_predict==test_y)*1.0/len(test_y) for c in [class0,class1,class2]: print "Majority",sum(c==test_y)*1.0/len(test_y)
apache-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1548, 199, 199, 646, 984, 12, 67, 12755, 465, 3803, 76, 12, 4714, 465, 980, 199, 504, 11708, 14, 4359, 492, 20847, 12, 18110, 548, 199, 504, 11708, 14, 992, 492, 3240, 9092, 199, 504, 11708, 14, 1208, 14, 1590, 63, 1208, 492, 370, 63, 16810, 199, 646, 3464, 21, 465, 410, 63, 4643, 199, 199, 3, 428, 10818, 19635, 2962, 199, 3, 16605, 1301, 30722, 1399, 14, 647, 11102, 63, 4757, 63, 338, 313, 261, 14, 23947, 199, 199, 318, 1900, 63, 4411, 8, 1210, 63, 3572, 12, 1072, 63, 3572, 12, 5642, 63, 3572, 29, 1960, 304, 272, 11542, 63, 14720, 275, 3240, 9092, 342, 272, 11542, 63, 14720, 14, 525, 8, 15327, 8, 5642, 63, 3572, 12, 1324, 63, 3572, 29, 1210, 63, 3572, 12, 10361, 534, 21468, 1333, 272, 11542, 63, 14720, 14, 525, 8, 30662, 8, 16, 14, 21, 430, 272, 327, 4411, 63, 14720, 14, 525, 8, 15327, 8, 1960, 12, 10361, 534, 21468, 1333, 272, 11542, 63, 14720, 14, 525, 8, 15327, 8, 1199, 63, 3572, 29, 1199, 63, 3572, 12, 10361, 534, 16395, 1333, 339, 11542, 63, 14720, 14, 2014, 8, 12290, 534, 350, 27707, 297, 2079, 5621, 534, 16810, 63, 20363, 1150, 7537, 297, 2079, 7186, 2968, 13374, 1105, 272, 372, 11542, 63, 14720, 4388, 199, 70, 29, 1490, 8, 1274, 14, 3020, 59, 17, 20007, 4848, 531, 199, 2888, 275, 3803, 76, 14, 912, 8, 70, 9, 199, 12280, 275, 3803, 76, 14, 912, 8, 70, 9, 199, 199, 25130, 63, 460, 63, 4108, 275, 3842, 73, 12, 86, 9, 367, 334, 73, 12, 86, 9, 315, 3874, 8, 12280, 9, 340, 730, 8, 86, 12694, 466, 8, 12280, 59, 16, 12457, 199, 25130, 275, 980, 14, 20221, 779, 88, 1988, 17, 61, 367, 671, 315, 10782, 83, 63, 460, 63, 4108, 566, 199, 1361, 10782, 83, 14, 1392, 199, 21906, 63, 2888, 275, 942, 199, 1662, 63, 2888, 275, 1052, 199, 533, 63, 1080, 275, 378, 199, 509, 334, 73, 12, 86, 9, 315, 10782, 83, 63, 460, 63, 4108, 26, 523, 340, 3992, 59, 73, 61, 440, 315, 3002, 63, 2888, 26, 199, 198, 1662, 63, 2888, 59, 2888, 59, 73, 2677, 275, 1021, 63, 1080, 199, 198, 533, 63, 1080, 847, 413, 523, 286, 275, 3002, 63, 2888, 59, 2888, 59, 73, 2677, 523, 12082, 63, 2888, 14, 740, 8, 67, 9, 199, 21906, 63, 2888, 275, 980, 14, 1144, 8, 21906, 63, 2888, 9, 199, 199, 78, 2888, 275, 1021, 63, 1080, 199, 8220, 29, 1590, 14, 2355, 14, 23832, 8, 552, 8, 21906, 63, 2888, 430, 199, 3, 1590, 14, 2355, 14, 3759, 8, 8220, 12, 17, 9, 199, 7588, 63, 6884, 275, 378, 14, 1020, 199, 2834, 63, 78, 275, 1109, 8, 822, 8, 21906, 63, 2888, 3342, 7588, 63, 6884, 776, 199, 199, 2834, 63, 88, 12, 396, 63, 88, 275, 10782, 83, 59, 8220, 19663, 2834, 63, 78, 12, 8429, 25130, 59, 8220, 1527, 2834, 63, 78, 11941, 2938, 199, 2834, 63, 89, 12, 396, 63, 89, 275, 12082, 63, 2888, 59, 8220, 19663, 2834, 63, 78, 467, 21906, 63, 2888, 59, 8220, 1527, 2834, 63, 78, 2938, 421, 199, 27163, 63, 2834, 12, 330, 12944, 63, 396, 12, 1300, 30722, 6069, 275, 410, 63, 4643, 14, 2340, 63, 30016, 8, 2834, 63, 88, 12, 3560, 63, 89, 12, 511, 63, 88, 12, 1788, 63, 88, 275, 298, 33, 401, 1788, 63, 89, 275, 298, 34, 401, 302, 63, 23437, 29, 709, 9, 199, 199, 3, 7393, 63, 58, 365, 2195, 511, 570, 199, 2864, 63, 58, 275, 511, 63, 88, 199, 1095, 63, 9869, 275, 942, 199, 509, 16604, 315, 1300, 30722, 6069, 26, 199, 198, 1095, 63, 9869, 14, 740, 8, 3776, 14, 6892, 63, 14417, 8, 2864, 63, 58, 24517, 6809, 17, 566, 199, 3, 314, 1300, 19137, 28837, 1642, 199, 396, 63, 509, 63, 3396, 8508, 275, 980, 14, 67, 9925, 1095, 63, 9869, 59, 16, 467, 1300, 63, 9869, 59, 17, 467, 1300, 63, 9869, 59, 18, 467, 1300, 63, 9869, 59, 19, 467, 1300, 63, 9869, 59, 20, 2677, 421, 199, 57, 63, 2834, 63, 17, 8885, 275, 370, 63, 16810, 8, 2834, 63, 89, 12, 78, 2888, 9, 199, 57, 63, 396, 63, 17, 8885, 275, 370, 63, 16810, 8, 396, 63, 89, 12, 78, 2888, 9, 199, 199, 5642, 19156, 275, 3388, 199, 1662, 1238, 12, 396, 63, 6892, 275, 410, 63, 4643, 14, 1238, 63, 1045, 13816, 8, 27163, 63, 2834, 12, 1488, 63, 2834, 63, 17, 8885, 12, 4318, 330, 12944, 63, 396, 12, 1488, 63, 396, 63, 17, 8885, 12, 4318, 8752, 19156, 29, 5642, 19156, 12, 4318, 1788, 63, 88, 275, 298, 35, 401, 4318, 1788, 63, 89, 275, 298, 36, 531, 199, 199, 3, 1361, 1867, 78, 18673, 8936, 2, 199, 3, 2066, 314, 6288, 8465, 5541, 5300, 3746, 314, 7914, 402, 314, 1300, 19137, 199, 1361, 3002, 1238, 14, 6892, 63, 14417, 8, 396, 63, 509, 63, 3396, 8508, 12, 3832, 29, 16, 9, 327, 1491, 1165, 21063, 199, 3, 1361, 511, 63, 6892, 1491, 1165, 11566, 984, 14, 2224, 8, 17, 9, 199, 70, 29, 1490, 480, 1301, 30722, 2412, 14, 23947, 2266, 6603, 531, 199, 23947, 14, 2724, 8, 1095, 30722, 6069, 12, 70, 9, 199, 23947, 14, 2724, 8, 1662, 1238, 12, 70, 9, 199, 23947, 14, 2724, 8, 1662, 63, 2888, 12, 70, 9, 199, 70, 14, 1600, 342, 199, 199, 692, 756, 26, 819, 870, 822, 8, 12280, 395, 552, 8, 25130, 395, 552, 8, 21906, 63, 2888, 395, 2834, 63, 88, 14, 1392, 12, 2834, 63, 89, 14, 1392, 12, 396, 63, 88, 14, 1392, 523, 870, 370, 63, 16810, 779, 17, 12, 18, 12, 19, 12, 16, 467, 20, 9, 8330, 12429, 275, 1900, 63, 4411, 8, 2834, 63, 88, 14, 1392, 59, 17, 467, 302, 2888, 12, 5642, 63, 3572, 29, 5783, 9, 523, 12429, 14, 3269, 8, 2834, 63, 88, 12, 370, 63, 16810, 8, 2834, 63, 89, 12, 302, 2888, 395, 3376, 29, 549, 12, 8526, 63, 7367, 29, 21, 9, 523, 511, 63, 6892, 275 ]
[ 1182, 2647, 15, 1393, 15, 1548, 199, 199, 646, 984, 12, 67, 12755, 465, 3803, 76, 12, 4714, 465, 980, 199, 504, 11708, 14, 4359, 492, 20847, 12, 18110, 548, 199, 504, 11708, 14, 992, 492, 3240, 9092, 199, 504, 11708, 14, 1208, 14, 1590, 63, 1208, 492, 370, 63, 16810, 199, 646, 3464, 21, 465, 410, 63, 4643, 199, 199, 3, 428, 10818, 19635, 2962, 199, 3, 16605, 1301, 30722, 1399, 14, 647, 11102, 63, 4757, 63, 338, 313, 261, 14, 23947, 199, 199, 318, 1900, 63, 4411, 8, 1210, 63, 3572, 12, 1072, 63, 3572, 12, 5642, 63, 3572, 29, 1960, 304, 272, 11542, 63, 14720, 275, 3240, 9092, 342, 272, 11542, 63, 14720, 14, 525, 8, 15327, 8, 5642, 63, 3572, 12, 1324, 63, 3572, 29, 1210, 63, 3572, 12, 10361, 534, 21468, 1333, 272, 11542, 63, 14720, 14, 525, 8, 30662, 8, 16, 14, 21, 430, 272, 327, 4411, 63, 14720, 14, 525, 8, 15327, 8, 1960, 12, 10361, 534, 21468, 1333, 272, 11542, 63, 14720, 14, 525, 8, 15327, 8, 1199, 63, 3572, 29, 1199, 63, 3572, 12, 10361, 534, 16395, 1333, 339, 11542, 63, 14720, 14, 2014, 8, 12290, 534, 350, 27707, 297, 2079, 5621, 534, 16810, 63, 20363, 1150, 7537, 297, 2079, 7186, 2968, 13374, 1105, 272, 372, 11542, 63, 14720, 4388, 199, 70, 29, 1490, 8, 1274, 14, 3020, 59, 17, 20007, 4848, 531, 199, 2888, 275, 3803, 76, 14, 912, 8, 70, 9, 199, 12280, 275, 3803, 76, 14, 912, 8, 70, 9, 199, 199, 25130, 63, 460, 63, 4108, 275, 3842, 73, 12, 86, 9, 367, 334, 73, 12, 86, 9, 315, 3874, 8, 12280, 9, 340, 730, 8, 86, 12694, 466, 8, 12280, 59, 16, 12457, 199, 25130, 275, 980, 14, 20221, 779, 88, 1988, 17, 61, 367, 671, 315, 10782, 83, 63, 460, 63, 4108, 566, 199, 1361, 10782, 83, 14, 1392, 199, 21906, 63, 2888, 275, 942, 199, 1662, 63, 2888, 275, 1052, 199, 533, 63, 1080, 275, 378, 199, 509, 334, 73, 12, 86, 9, 315, 10782, 83, 63, 460, 63, 4108, 26, 523, 340, 3992, 59, 73, 61, 440, 315, 3002, 63, 2888, 26, 199, 198, 1662, 63, 2888, 59, 2888, 59, 73, 2677, 275, 1021, 63, 1080, 199, 198, 533, 63, 1080, 847, 413, 523, 286, 275, 3002, 63, 2888, 59, 2888, 59, 73, 2677, 523, 12082, 63, 2888, 14, 740, 8, 67, 9, 199, 21906, 63, 2888, 275, 980, 14, 1144, 8, 21906, 63, 2888, 9, 199, 199, 78, 2888, 275, 1021, 63, 1080, 199, 8220, 29, 1590, 14, 2355, 14, 23832, 8, 552, 8, 21906, 63, 2888, 430, 199, 3, 1590, 14, 2355, 14, 3759, 8, 8220, 12, 17, 9, 199, 7588, 63, 6884, 275, 378, 14, 1020, 199, 2834, 63, 78, 275, 1109, 8, 822, 8, 21906, 63, 2888, 3342, 7588, 63, 6884, 776, 199, 199, 2834, 63, 88, 12, 396, 63, 88, 275, 10782, 83, 59, 8220, 19663, 2834, 63, 78, 12, 8429, 25130, 59, 8220, 1527, 2834, 63, 78, 11941, 2938, 199, 2834, 63, 89, 12, 396, 63, 89, 275, 12082, 63, 2888, 59, 8220, 19663, 2834, 63, 78, 467, 21906, 63, 2888, 59, 8220, 1527, 2834, 63, 78, 2938, 421, 199, 27163, 63, 2834, 12, 330, 12944, 63, 396, 12, 1300, 30722, 6069, 275, 410, 63, 4643, 14, 2340, 63, 30016, 8, 2834, 63, 88, 12, 3560, 63, 89, 12, 511, 63, 88, 12, 1788, 63, 88, 275, 298, 33, 401, 1788, 63, 89, 275, 298, 34, 401, 302, 63, 23437, 29, 709, 9, 199, 199, 3, 7393, 63, 58, 365, 2195, 511, 570, 199, 2864, 63, 58, 275, 511, 63, 88, 199, 1095, 63, 9869, 275, 942, 199, 509, 16604, 315, 1300, 30722, 6069, 26, 199, 198, 1095, 63, 9869, 14, 740, 8, 3776, 14, 6892, 63, 14417, 8, 2864, 63, 58, 24517, 6809, 17, 566, 199, 3, 314, 1300, 19137, 28837, 1642, 199, 396, 63, 509, 63, 3396, 8508, 275, 980, 14, 67, 9925, 1095, 63, 9869, 59, 16, 467, 1300, 63, 9869, 59, 17, 467, 1300, 63, 9869, 59, 18, 467, 1300, 63, 9869, 59, 19, 467, 1300, 63, 9869, 59, 20, 2677, 421, 199, 57, 63, 2834, 63, 17, 8885, 275, 370, 63, 16810, 8, 2834, 63, 89, 12, 78, 2888, 9, 199, 57, 63, 396, 63, 17, 8885, 275, 370, 63, 16810, 8, 396, 63, 89, 12, 78, 2888, 9, 199, 199, 5642, 19156, 275, 3388, 199, 1662, 1238, 12, 396, 63, 6892, 275, 410, 63, 4643, 14, 1238, 63, 1045, 13816, 8, 27163, 63, 2834, 12, 1488, 63, 2834, 63, 17, 8885, 12, 4318, 330, 12944, 63, 396, 12, 1488, 63, 396, 63, 17, 8885, 12, 4318, 8752, 19156, 29, 5642, 19156, 12, 4318, 1788, 63, 88, 275, 298, 35, 401, 4318, 1788, 63, 89, 275, 298, 36, 531, 199, 199, 3, 1361, 1867, 78, 18673, 8936, 2, 199, 3, 2066, 314, 6288, 8465, 5541, 5300, 3746, 314, 7914, 402, 314, 1300, 19137, 199, 1361, 3002, 1238, 14, 6892, 63, 14417, 8, 396, 63, 509, 63, 3396, 8508, 12, 3832, 29, 16, 9, 327, 1491, 1165, 21063, 199, 3, 1361, 511, 63, 6892, 1491, 1165, 11566, 984, 14, 2224, 8, 17, 9, 199, 70, 29, 1490, 480, 1301, 30722, 2412, 14, 23947, 2266, 6603, 531, 199, 23947, 14, 2724, 8, 1095, 30722, 6069, 12, 70, 9, 199, 23947, 14, 2724, 8, 1662, 1238, 12, 70, 9, 199, 23947, 14, 2724, 8, 1662, 63, 2888, 12, 70, 9, 199, 70, 14, 1600, 342, 199, 199, 692, 756, 26, 819, 870, 822, 8, 12280, 395, 552, 8, 25130, 395, 552, 8, 21906, 63, 2888, 395, 2834, 63, 88, 14, 1392, 12, 2834, 63, 89, 14, 1392, 12, 396, 63, 88, 14, 1392, 523, 870, 370, 63, 16810, 779, 17, 12, 18, 12, 19, 12, 16, 467, 20, 9, 8330, 12429, 275, 1900, 63, 4411, 8, 2834, 63, 88, 14, 1392, 59, 17, 467, 302, 2888, 12, 5642, 63, 3572, 29, 5783, 9, 523, 12429, 14, 3269, 8, 2834, 63, 88, 12, 370, 63, 16810, 8, 2834, 63, 89, 12, 302, 2888, 395, 3376, 29, 549, 12, 8526, 63, 7367, 29, 21, 9, 523, 511, 63, 6892, 275, 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, 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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 ]
LordHighfixxer/lrdhifxr-cogs
apitoolsoz/apitoolsoz.py
1
5904
import discord from discord.ext import commands from .utils import checks import aiohttp import json import logging import time import os log = logging.getLogger('red.apitoolsoz') class ApitoolsOz: """Steam and SteamSpy related commands""" def __init__(self, bot): self.bot = bot @commands.group(pass_context=True, name='apitoolsoz', aliases=['api']) async def apitoolsoz(self, ctx): if ctx.invoked_subcommand is None: await self.bot.send_cmd_help(ctx) # Parsing functions def _parse_headers(self, answer): headers = {} public_headers = {} if answer is not None and answer.content.strip() != 'pass': for line in answer.content.splitlines(): header = line.strip().split('=') public_header = False if len(header) == 2: # check for env vars if '$ENV' in header[1]: varname = header[1][header[1].index('$ENV') + 5:-1] try: header[1] = os.environ[varname] public_header = 'secret' except: public_header = 'ENV var parsing failed' headers[header[0]] = header[1] public_headers[header[0]] = public_header or header[1] return {'headers': headers, 'public_headers': public_headers} def _parse_body(self, answer): body = {} if answer is not None and answer.content.strip() != 'pass': for line in answer.content.splitlines(): body_item = line.strip().split('=') if len(body_item) == 2: body[body_item[0]] = body_item[1] return body @checks.is_owner() @apitoolsoz.command(pass_context=True, name='get') async def _get(self, ctx, url, w_headers=False): """Performs a GET request to selected URL""" url = url.strip() if w_headers: await self.bot.say('Set headers by typing them in a `name=value` format, one on each line, or `pass`') answer = await self.bot.wait_for_message(timeout=50, author=ctx.message.author) parsed = self._parse_headers(answer) headers = parsed['headers'] public_headers = parsed['public_headers'] await self.bot.say( 'Headers are set to:\n```json\n{}```'.format(json.dumps(public_headers, indent=4, sort_keys=True))) else: headers = {} t1 = time.perf_counter() async with aiohttp.get(url, headers=headers) as r: t2 = time.perf_counter() data = await r.text() status = r.status try: parsed = json.loads(data) except: parsed = json.loads('{}') @checks.is_owner() @apitoolsoz.command(pass_context=True, name='post', aliases=['put']) async def _post(self, ctx, *, url): """Performs POST or PUT request to selected URL""" await self.bot.say('Set headers by typing them in a `name=value` format, one on each line, or `pass`') answer = await self.bot.wait_for_message(timeout=50, author=ctx.message.author) parsed = self._parse_headers(answer) headers = parsed['headers'] public_headers = parsed['public_headers'] await self.bot.say('Headers are set to:\n```json\n{}```\nSet body typing in in a `name=value` one on each line or `pass`\nNested objects are not supported' .format(json.dumps(public_headers, indent=4, sort_keys=True))) answer = await self.bot.wait_for_message(timeout=50, author=ctx.message.author) body = self._parse_body(answer) await self.bot.say('Body is set to:\n```json\n{}```'.format(json.dumps(body, indent=4, sort_keys=True))) url = url.strip() method = ctx.invoked_with if method == 'post': t1 = time.perf_counter() async with aiohttp.post(url, headers=headers, data=json.dumps(body)) as r: t2 = time.perf_counter() data = await r.text() status = r.status if method == 'put': if 'Content-Type' not in headers: headers['Content-Type'] = 'application/json' t1 = time.perf_counter() async with aiohttp.put(url, headers=headers, data=json.dumps(body)) as r: t2 = time.perf_counter() data = await r.text() status = r.status try: parsed = json.loads(data) except: parsed = json.loads('{}') color = status == 200 and 0x2ecc71 or status >= 400 and 0xe74c3c embed = discord.Embed(title='Results for **{}** {}'.format(method.upper(), url), color=color, description='```json\n{}```'.format(len(data) < 700 and json.dumps(parsed, indent=4, sort_keys=True) or json.dumps(parsed, indent=4, sort_keys=True)[:700] + '\n\n...\n\n')) embed.add_field(name='Status', value=status) embed.add_field(name='Time', value='{}ms'.format(str((t2-t1) * 1000)[:3])) await self.bot.say(embed=embed) def setup(bot): bot.add_cog(ApitoolsOz(bot))
gpl-3.0
[ 646, 4339, 2181, 202, 199, 504, 4339, 2181, 14, 832, 492, 3718, 202, 199, 504, 1275, 1208, 492, 5920, 202, 199, 646, 30274, 202, 199, 646, 2022, 202, 199, 646, 2050, 202, 199, 646, 900, 202, 199, 646, 747, 2999, 199, 793, 275, 2050, 14, 5572, 360, 581, 14, 439, 390, 21943, 1152, 90, 358, 8065, 199, 533, 13450, 390, 5998, 47, 90, 26, 1128, 408, 51, 5969, 436, 428, 5969, 51, 647, 4048, 3718, 624, 1128, 347, 636, 826, 721, 277, 12, 5888, 304, 1039, 291, 14, 3018, 275, 5888, 2958, 768, 4405, 14, 923, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 439, 390, 21943, 1152, 90, 297, 5481, 2968, 1246, 1105, 1128, 5316, 347, 2771, 390, 21943, 1152, 90, 8, 277, 12, 4027, 304, 4341, 340, 4027, 14, 5350, 7620, 63, 954, 1531, 365, 488, 26, 1675, 5517, 291, 14, 3018, 14, 2254, 63, 1760, 63, 3437, 8, 3799, 9, 18801, 327, 28747, 3423, 1128, 347, 485, 1122, 63, 2139, 8, 277, 12, 6385, 304, 1039, 2323, 275, 1052, 1039, 4575, 63, 2139, 275, 1052, 4341, 340, 6385, 365, 440, 488, 436, 6385, 14, 1317, 14, 1913, 342, 1137, 283, 1529, 356, 1675, 367, 1004, 315, 6385, 14, 1317, 14, 7644, 837, 2628, 1406, 275, 1004, 14, 1913, 1252, 1294, 23917, 2628, 4575, 63, 1291, 275, 756, 24216, 340, 822, 8, 1291, 9, 508, 499, 26, 2999, 490, 327, 1104, 367, 2589, 6802, 4906, 340, 4505, 9984, 7, 315, 1406, 59, 17, 2189, 8282, 22071, 275, 1406, 59, 17, 1527, 1291, 59, 17, 1055, 1080, 14676, 9984, 358, 435, 959, 6809, 17, 61, 8282, 862, 26, 15372, 1406, 59, 17, 61, 275, 747, 14, 2314, 59, 16043, 61, 15372, 4575, 63, 1291, 275, 283, 4731, 7, 8282, 871, 26, 15372, 4575, 63, 1291, 275, 283, 9984, 2729, 6057, 3405, 7, 2999, 490, 2323, 59, 1291, 59, 16, 2677, 275, 1406, 59, 17, 61, 4906, 4575, 63, 2139, 59, 1291, 59, 16, 2677, 275, 4575, 63, 1291, 503, 1406, 59, 17, 61, 4341, 372, 791, 2139, 356, 2323, 12, 283, 3455, 63, 2139, 356, 4575, 63, 2139, 93, 2958, 347, 485, 1122, 63, 2030, 8, 277, 12, 6385, 304, 1039, 2396, 275, 1052, 1039, 340, 6385, 365, 440, 488, 436, 6385, 14, 1317, 14, 1913, 342, 1137, 283, 1529, 356, 1675, 367, 1004, 315, 6385, 14, 1317, 14, 7644, 837, 2628, 2396, 63, 1053, 275, 1004, 14, 1913, 1252, 1294, 23917, 2628, 340, 822, 8, 2030, 63, 1053, 9, 508, 499, 26, 4906, 2396, 59, 2030, 63, 1053, 59, 16, 2677, 275, 2396, 63, 1053, 59, 17, 61, 4341, 372, 2396, 18801, 768, 8625, 14, 374, 63, 4597, 342, 1128, 768, 439, 390, 21943, 1152, 90, 14, 1531, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 362, 358, 1128, 5316, 347, 485, 362, 8, 277, 12, 4027, 12, 1166, 12, 336, 63, 2139, 29, 797, 304, 1039, 408, 2623, 3351, 282, 9576, 1056, 370, 4895, 2851, 624, 4341, 1166, 275, 1166, 14, 1913, 342, 4341, 340, 336, 63, 2139, 26, 1675, 5517, 291, 14, 3018, 14, 19787, 360, 1084, 2323, 701, 14090, 3062, 315, 282, 658, 354, 29, 585, 64, 1475, 12, 1373, 641, 1924, 1004, 12, 503, 658, 1529, 64, 358, 11556, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 11556, 4565, 275, 291, 423, 1122, 63, 2139, 8, 5934, 9, 1675, 2323, 275, 4565, 459, 2139, 418, 1675, 4575, 63, 2139, 275, 4565, 459, 3455, 63, 2139, 418, 11556, 5517, 291, 14, 3018, 14, 19787, 8, 2628, 283, 9883, 787, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 32323, 1370, 908, 8, 1001, 14, 4180, 8, 3455, 63, 2139, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 587, 26, 1675, 2323, 275, 1052, 4341, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 1039, 5316, 543, 30274, 14, 362, 8, 633, 12, 2323, 29, 2139, 9, 465, 519, 26, 1675, 307, 18, 275, 900, 14, 9452, 63, 5337, 342, 1675, 666, 275, 5517, 519, 14, 505, 342, 1675, 2004, 275, 519, 14, 1205, 4341, 862, 26, 1675, 4565, 275, 2022, 14, 3640, 8, 576, 9, 1039, 871, 26, 1675, 4565, 275, 2022, 14, 3640, 17519, 358, 8065, 268, 2958, 768, 8625, 14, 374, 63, 4597, 342, 1128, 768, 439, 390, 21943, 1152, 90, 14, 1531, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 1932, 297, 5481, 2968, 524, 1105, 1128, 5316, 347, 485, 1932, 8, 277, 12, 4027, 12, 9889, 1166, 304, 1039, 408, 2623, 3351, 8761, 503, 18337, 1056, 370, 4895, 2851, 624, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 1084, 2323, 701, 14090, 3062, 315, 282, 658, 354, 29, 585, 64, 1475, 12, 1373, 641, 1924, 1004, 12, 503, 658, 1529, 64, 358, 4341, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 4341, 4565, 275, 291, 423, 1122, 63, 2139, 8, 5934, 9, 1039, 2323, 275, 4565, 459, 2139, 418, 1039, 4575, 63, 2139, 275, 4565, 459, 3455, 63, 2139, 418, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 9883, 787, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 1040, 25502, 78, 1084, 2396, 14090, 315, 315, 282, 658, 354, 29, 585, 64, 1373, 641, 1924, 1004, 503, 658, 1529, 25502, 78, 13029, 2251, 787, 440, 3748, 7, 202, 2574, 1275, 908, 8, 1001, 14, 4180, 8, 3455, 63, 2139, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 4341, 2396, 275, 291, 423, 1122, 63, 2030, 8, 5934, 9, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 8173, 365, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 32323, 1370, 908, 8, 1001, 14, 4180, 8, 2030, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 1166, 275, 1166, 14, 1913, 342, 1039, 1083, 275, 4027, 14, 5350, 7620, 63, 1045, 4341 ]
[ 4339, 2181, 202, 199, 504, 4339, 2181, 14, 832, 492, 3718, 202, 199, 504, 1275, 1208, 492, 5920, 202, 199, 646, 30274, 202, 199, 646, 2022, 202, 199, 646, 2050, 202, 199, 646, 900, 202, 199, 646, 747, 2999, 199, 793, 275, 2050, 14, 5572, 360, 581, 14, 439, 390, 21943, 1152, 90, 358, 8065, 199, 533, 13450, 390, 5998, 47, 90, 26, 1128, 408, 51, 5969, 436, 428, 5969, 51, 647, 4048, 3718, 624, 1128, 347, 636, 826, 721, 277, 12, 5888, 304, 1039, 291, 14, 3018, 275, 5888, 2958, 768, 4405, 14, 923, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 439, 390, 21943, 1152, 90, 297, 5481, 2968, 1246, 1105, 1128, 5316, 347, 2771, 390, 21943, 1152, 90, 8, 277, 12, 4027, 304, 4341, 340, 4027, 14, 5350, 7620, 63, 954, 1531, 365, 488, 26, 1675, 5517, 291, 14, 3018, 14, 2254, 63, 1760, 63, 3437, 8, 3799, 9, 18801, 327, 28747, 3423, 1128, 347, 485, 1122, 63, 2139, 8, 277, 12, 6385, 304, 1039, 2323, 275, 1052, 1039, 4575, 63, 2139, 275, 1052, 4341, 340, 6385, 365, 440, 488, 436, 6385, 14, 1317, 14, 1913, 342, 1137, 283, 1529, 356, 1675, 367, 1004, 315, 6385, 14, 1317, 14, 7644, 837, 2628, 1406, 275, 1004, 14, 1913, 1252, 1294, 23917, 2628, 4575, 63, 1291, 275, 756, 24216, 340, 822, 8, 1291, 9, 508, 499, 26, 2999, 490, 327, 1104, 367, 2589, 6802, 4906, 340, 4505, 9984, 7, 315, 1406, 59, 17, 2189, 8282, 22071, 275, 1406, 59, 17, 1527, 1291, 59, 17, 1055, 1080, 14676, 9984, 358, 435, 959, 6809, 17, 61, 8282, 862, 26, 15372, 1406, 59, 17, 61, 275, 747, 14, 2314, 59, 16043, 61, 15372, 4575, 63, 1291, 275, 283, 4731, 7, 8282, 871, 26, 15372, 4575, 63, 1291, 275, 283, 9984, 2729, 6057, 3405, 7, 2999, 490, 2323, 59, 1291, 59, 16, 2677, 275, 1406, 59, 17, 61, 4906, 4575, 63, 2139, 59, 1291, 59, 16, 2677, 275, 4575, 63, 1291, 503, 1406, 59, 17, 61, 4341, 372, 791, 2139, 356, 2323, 12, 283, 3455, 63, 2139, 356, 4575, 63, 2139, 93, 2958, 347, 485, 1122, 63, 2030, 8, 277, 12, 6385, 304, 1039, 2396, 275, 1052, 1039, 340, 6385, 365, 440, 488, 436, 6385, 14, 1317, 14, 1913, 342, 1137, 283, 1529, 356, 1675, 367, 1004, 315, 6385, 14, 1317, 14, 7644, 837, 2628, 2396, 63, 1053, 275, 1004, 14, 1913, 1252, 1294, 23917, 2628, 340, 822, 8, 2030, 63, 1053, 9, 508, 499, 26, 4906, 2396, 59, 2030, 63, 1053, 59, 16, 2677, 275, 2396, 63, 1053, 59, 17, 61, 4341, 372, 2396, 18801, 768, 8625, 14, 374, 63, 4597, 342, 1128, 768, 439, 390, 21943, 1152, 90, 14, 1531, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 362, 358, 1128, 5316, 347, 485, 362, 8, 277, 12, 4027, 12, 1166, 12, 336, 63, 2139, 29, 797, 304, 1039, 408, 2623, 3351, 282, 9576, 1056, 370, 4895, 2851, 624, 4341, 1166, 275, 1166, 14, 1913, 342, 4341, 340, 336, 63, 2139, 26, 1675, 5517, 291, 14, 3018, 14, 19787, 360, 1084, 2323, 701, 14090, 3062, 315, 282, 658, 354, 29, 585, 64, 1475, 12, 1373, 641, 1924, 1004, 12, 503, 658, 1529, 64, 358, 11556, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 11556, 4565, 275, 291, 423, 1122, 63, 2139, 8, 5934, 9, 1675, 2323, 275, 4565, 459, 2139, 418, 1675, 4575, 63, 2139, 275, 4565, 459, 3455, 63, 2139, 418, 11556, 5517, 291, 14, 3018, 14, 19787, 8, 2628, 283, 9883, 787, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 32323, 1370, 908, 8, 1001, 14, 4180, 8, 3455, 63, 2139, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 587, 26, 1675, 2323, 275, 1052, 4341, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 1039, 5316, 543, 30274, 14, 362, 8, 633, 12, 2323, 29, 2139, 9, 465, 519, 26, 1675, 307, 18, 275, 900, 14, 9452, 63, 5337, 342, 1675, 666, 275, 5517, 519, 14, 505, 342, 1675, 2004, 275, 519, 14, 1205, 4341, 862, 26, 1675, 4565, 275, 2022, 14, 3640, 8, 576, 9, 1039, 871, 26, 1675, 4565, 275, 2022, 14, 3640, 17519, 358, 8065, 268, 2958, 768, 8625, 14, 374, 63, 4597, 342, 1128, 768, 439, 390, 21943, 1152, 90, 14, 1531, 8, 1529, 63, 1100, 29, 549, 12, 536, 534, 1932, 297, 5481, 2968, 524, 1105, 1128, 5316, 347, 485, 1932, 8, 277, 12, 4027, 12, 9889, 1166, 304, 1039, 408, 2623, 3351, 8761, 503, 18337, 1056, 370, 4895, 2851, 624, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 1084, 2323, 701, 14090, 3062, 315, 282, 658, 354, 29, 585, 64, 1475, 12, 1373, 641, 1924, 1004, 12, 503, 658, 1529, 64, 358, 4341, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 4341, 4565, 275, 291, 423, 1122, 63, 2139, 8, 5934, 9, 1039, 2323, 275, 4565, 459, 2139, 418, 1039, 4575, 63, 2139, 275, 4565, 459, 3455, 63, 2139, 418, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 9883, 787, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 1040, 25502, 78, 1084, 2396, 14090, 315, 315, 282, 658, 354, 29, 585, 64, 1373, 641, 1924, 1004, 503, 658, 1529, 25502, 78, 13029, 2251, 787, 440, 3748, 7, 202, 2574, 1275, 908, 8, 1001, 14, 4180, 8, 3455, 63, 2139, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 6385, 275, 5517, 291, 14, 3018, 14, 2573, 63, 509, 63, 1188, 8, 2593, 29, 1400, 12, 4132, 29, 3799, 14, 1188, 14, 2502, 9, 4341, 2396, 275, 291, 423, 1122, 63, 2030, 8, 5934, 9, 4341, 5517, 291, 14, 3018, 14, 19787, 360, 8173, 365, 663, 370, 3427, 78, 32323, 1001, 60, 78, 2440, 32323, 1370, 908, 8, 1001, 14, 4180, 8, 2030, 12, 4363, 29, 20, 12, 4069, 63, 1612, 29, 549, 1724, 4341, 1166, 275, 1166, 14, 1913, 342, 1039, 1083, 275, 4027, 14, 5350, 7620, 63, 1045, 4341, 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, 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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 ]
apollo13/ansible
lib/ansible/plugins/inventory/generator.py
14
5548
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' name: generator plugin_type: inventory version_added: "2.6" short_description: Uses Jinja2 to construct hosts and groups from patterns description: - Uses a YAML configuration file with a valid YAML or C(.config) extension to define var expressions and group conditionals - Create a template pattern that describes each host, and then use independent configuration layers - Every element of every layer is combined to create a host for every layer combination - Parent groups can be defined with reference to hosts and other groups using the same template variables options: plugin: description: token that ensures this is a source file for the 'generator' plugin. required: True choices: ['generator'] hosts: description: - The C(name) key is a template used to generate hostnames based on the C(layers) option. Each variable in the name is expanded to create a cartesian product of all possible layer combinations. - The C(parents) are a list of parent groups that the host belongs to. Each C(parent) item contains a C(name) key, again expanded from the template, and an optional C(parents) key that lists its parents. - Parents can also contain C(vars), which is a dictionary of vars that is then always set for that variable. This can provide easy access to the group name. E.g set an C(application) variable that is set to the value of the C(application) layer name. layers: description: - A dictionary of layers, with the key being the layer name, used as a variable name in the C(host) C(name) and C(parents) keys. Each layer value is a list of possible values for that layer. ''' EXAMPLES = ''' # inventory.config file in YAML format # remember to enable this inventory plugin in the ansible.cfg before using # View the output using `ansible-inventory -i inventory.config --list` plugin: generator strict: False hosts: name: "{{ operation }}_{{ application }}_{{ environment }}_runner" parents: - name: "{{ operation }}_{{ application }}_{{ environment }}" parents: - name: "{{ operation }}_{{ application }}" parents: - name: "{{ operation }}" - name: "{{ application }}" - name: "{{ application }}_{{ environment }}" parents: - name: "{{ application }}" vars: application: "{{ application }}" - name: "{{ environment }}" vars: environment: "{{ environment }}" - name: runner layers: operation: - build - launch environment: - dev - test - prod application: - web - api ''' import os from itertools import product from ansible import constants as C from ansible.errors import AnsibleParserError from ansible.plugins.inventory import BaseInventoryPlugin class InventoryModule(BaseInventoryPlugin): """ constructs groups and vars using Jinja2 template expressions """ NAME = 'generator' def __init__(self): super(InventoryModule, self).__init__() def verify_file(self, path): valid = False if super(InventoryModule, self).verify_file(path): file_name, ext = os.path.splitext(path) if not ext or ext in ['.config'] + C.YAML_FILENAME_EXTENSIONS: valid = True return valid def template(self, pattern, variables): self.templar.available_variables = variables return self.templar.do_template(pattern) def add_parents(self, inventory, child, parents, template_vars): for parent in parents: try: groupname = self.template(parent['name'], template_vars) except (AttributeError, ValueError): raise AnsibleParserError("Element %s has a parent with no name element" % child['name']) if groupname not in inventory.groups: inventory.add_group(groupname) group = inventory.groups[groupname] for (k, v) in parent.get('vars', {}).items(): group.set_variable(k, self.template(v, template_vars)) inventory.add_child(groupname, child) self.add_parents(inventory, groupname, parent.get('parents', []), template_vars) def parse(self, inventory, loader, path, cache=False): ''' parses the inventory file ''' super(InventoryModule, self).parse(inventory, loader, path, cache=cache) config = self._read_config_data(path) template_inputs = product(*config['layers'].values()) for item in template_inputs: template_vars = dict() for i, key in enumerate(config['layers'].keys()): template_vars[key] = item[i] host = self.template(config['hosts']['name'], template_vars) inventory.add_host(host) self.add_parents(inventory, host, config['hosts'].get('parents', []), template_vars)
gpl-3.0
[ 3, 1898, 334, 67, 9, 9708, 2622, 7290, 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, 8948, 275, 1449, 272, 536, 26, 4306, 272, 3589, 63, 466, 26, 8200, 272, 1015, 63, 3270, 26, 298, 18, 14, 22, 2, 272, 3974, 63, 1802, 26, 14911, 17300, 18, 370, 6982, 7057, 436, 4652, 687, 7970, 272, 1369, 26, 267, 446, 14911, 282, 18916, 2897, 570, 543, 282, 1686, 18916, 503, 445, 13417, 888, 9, 3329, 370, 5627, 2729, 8455, 436, 1572, 29265, 267, 446, 2790, 282, 1978, 3851, 626, 23369, 1924, 1591, 12, 436, 2066, 675, 12717, 2897, 9393, 267, 446, 18414, 1819, 402, 4036, 4045, 365, 12149, 370, 1218, 282, 1591, 367, 4036, 4045, 14665, 267, 446, 16396, 4652, 883, 506, 3247, 543, 3659, 370, 7057, 436, 1163, 4652, 1808, 314, 2011, 1978, 2860, 272, 1511, 26, 489, 3589, 26, 268, 1369, 26, 1526, 626, 15620, 642, 365, 282, 1350, 570, 367, 314, 283, 4679, 7, 3589, 14, 268, 1415, 26, 715, 268, 3415, 26, 788, 4679, 418, 489, 7057, 26, 267, 1369, 26, 881, 446, 710, 445, 8, 354, 9, 790, 365, 282, 1978, 1202, 370, 3550, 288, 1591, 1247, 4079, 641, 314, 445, 8, 4359, 9, 945, 14, 7048, 1750, 315, 314, 536, 365, 11507, 370, 1218, 282, 288, 9590, 19157, 3336, 402, 1006, 3962, 4045, 15821, 14, 881, 446, 710, 445, 8, 8859, 9, 787, 282, 769, 402, 1676, 4652, 626, 314, 1591, 15006, 370, 14, 7048, 445, 8, 1708, 9, 1242, 288, 3509, 282, 445, 8, 354, 9, 790, 12, 4020, 11507, 687, 314, 1978, 12, 436, 376, 2716, 445, 8, 8859, 9, 790, 288, 626, 5548, 2399, 8623, 14, 881, 446, 16396, 83, 883, 2597, 1395, 445, 8, 2936, 395, 1314, 365, 282, 2600, 402, 6802, 626, 288, 365, 2066, 3544, 663, 367, 626, 1750, 14, 961, 883, 5647, 8837, 2879, 370, 314, 1572, 536, 14, 662, 14, 71, 288, 663, 376, 445, 8, 3578, 9, 1750, 626, 365, 663, 370, 314, 574, 402, 314, 445, 8, 3578, 9, 4045, 536, 14, 489, 9393, 26, 267, 1369, 26, 881, 446, 437, 2600, 402, 9393, 12, 543, 314, 790, 3769, 314, 4045, 536, 12, 1202, 465, 282, 1750, 536, 315, 314, 445, 8, 1102, 9, 288, 445, 8, 354, 9, 436, 445, 8, 8859, 9, 2883, 14, 7048, 4045, 574, 365, 282, 769, 402, 3962, 1338, 367, 626, 4045, 14, 199, 2344, 199, 199, 8918, 275, 1449, 272, 327, 8200, 14, 888, 570, 315, 18916, 1475, 272, 327, 21027, 370, 4756, 642, 8200, 3589, 315, 314, 3242, 14, 4128, 2544, 1808, 272, 327, 10935, 314, 1072, 1808, 658, 4853, 13, 7212, 446, 73, 8200, 14, 888, 1553, 513, 64, 272, 3589, 26, 4306, 272, 7478, 26, 756, 272, 7057, 26, 267, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 3586, 63, 3638, 3734, 3586, 63, 5933, 2, 267, 8623, 26, 881, 446, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 3586, 63, 3638, 3734, 7820, 288, 8623, 26, 1598, 446, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 7820, 355, 8623, 26, 2116, 446, 536, 26, 7370, 3439, 7820, 2116, 446, 536, 26, 7370, 4223, 7820, 1598, 446, 536, 26, 7370, 4223, 3586, 63, 3638, 3734, 7820, 355, 8623, 26, 2116, 446, 536, 26, 7370, 4223, 7820, 490, 6802, 26, 1993, 4223, 26, 7370, 4223, 7820, 2116, 446, 536, 26, 7370, 3734, 7820, 490, 6802, 26, 1993, 3734, 26, 7370, 3734, 7820, 881, 446, 536, 26, 7876, 272, 9393, 26, 267, 3439, 26, 288, 446, 1900, 288, 446, 10623, 267, 3734, 26, 288, 446, 4866, 288, 446, 511, 288, 446, 12441, 267, 4223, 26, 288, 446, 3330, 288, 446, 2986, 199, 2344, 199, 199, 646, 747, 199, 199, 504, 7975, 492, 3336, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 3242, 14, 2550, 492, 31775, 199, 504, 3242, 14, 5265, 14, 7212, 492, 3523, 19304, 5061, 421, 199, 533, 19337, 2377, 8, 1563, 19304, 5061, 304, 272, 408, 21638, 4652, 436, 6802, 1808, 17300, 18, 1978, 8455, 408, 339, 13637, 275, 283, 4679, 7, 339, 347, 636, 826, 721, 277, 304, 398, 1613, 8, 19304, 2377, 12, 291, 2843, 826, 4533, 339, 347, 4911, 63, 493, 8, 277, 12, 931, 304, 398, 1686, 275, 756, 267, 340, 1613, 8, 19304, 2377, 12, 291, 680, 4712, 63, 493, 8, 515, 304, 288, 570, 63, 354, 12, 1599, 275, 747, 14, 515, 14, 7973, 8, 515, 9, 953, 340, 440, 1599, 503, 1599, 315, 18953, 888, 418, 435, 445, 14, 23103, 63, 15440, 63, 18451, 26, 355, 1686, 275, 715, 398, 372, 1686, 339, 347, 1978, 8, 277, 12, 3851, 12, 2860, 304, 267, 291, 14, 26718, 14, 4561, 63, 3669, 275, 2860, 267, 372, 291, 14, 26718, 14, 1117, 63, 1160, 8, 3401, 9, 339, 347, 1050, 63, 8859, 8, 277, 12, 8200, 12, 1982, 12, 8623, 12, 1978, 63, 2936, 304, 267, 367, 1676, 315, 8623, 26, 288, 862, 26, 355, 1572, 354, 275, 291, 14, 1160, 8, 1708, 459, 354, 995, 1978, 63, 2936, 9, 288, 871, 334, 10227, 12, 1722, 304, 355, 746, 31775, 480, 2162, 450, 83, 965, 282, 1676, 543, 949, 536, 1819, 2, 450, 1982, 459, 354, 1105, 288, 340, 1572, 354, 440, 315, 8200, 14, 2634, 26, 355, 8200, 14, 525, 63, 923, 8, 923, 354, 9, 288, 1572, 275, 8200, 14, 2634, 59, 923, 354, 61, 288, 367, 334, 75, 12, 373, 9, 315, 1676, 14, 362, 360, 2936, 297, 13056, 1744, 837, 355, 1572, 14, 409, 63, 1975, 8, 75, 12, 291, 14, 1160, 8, 86, 12, 1978, 63, 2936, 430, 288, 8200, 14, 525, 63, 1739, 8, 923, 354, 12, 1982, 9, 288, 291, 14, 525, 63, 8859, 8, 7212, 12, 1572, 354, 12, 1676, 14, 362, 360, 8859, 297, 14431, 1978, 63, 2936, 9, 339, 347, 2198, 8, 277, 12, 8200, 12, 5077, 12, 931, 12, 2581 ]
[ 1898, 334, 67, 9, 9708, 2622, 7290, 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, 8948, 275, 1449, 272, 536, 26, 4306, 272, 3589, 63, 466, 26, 8200, 272, 1015, 63, 3270, 26, 298, 18, 14, 22, 2, 272, 3974, 63, 1802, 26, 14911, 17300, 18, 370, 6982, 7057, 436, 4652, 687, 7970, 272, 1369, 26, 267, 446, 14911, 282, 18916, 2897, 570, 543, 282, 1686, 18916, 503, 445, 13417, 888, 9, 3329, 370, 5627, 2729, 8455, 436, 1572, 29265, 267, 446, 2790, 282, 1978, 3851, 626, 23369, 1924, 1591, 12, 436, 2066, 675, 12717, 2897, 9393, 267, 446, 18414, 1819, 402, 4036, 4045, 365, 12149, 370, 1218, 282, 1591, 367, 4036, 4045, 14665, 267, 446, 16396, 4652, 883, 506, 3247, 543, 3659, 370, 7057, 436, 1163, 4652, 1808, 314, 2011, 1978, 2860, 272, 1511, 26, 489, 3589, 26, 268, 1369, 26, 1526, 626, 15620, 642, 365, 282, 1350, 570, 367, 314, 283, 4679, 7, 3589, 14, 268, 1415, 26, 715, 268, 3415, 26, 788, 4679, 418, 489, 7057, 26, 267, 1369, 26, 881, 446, 710, 445, 8, 354, 9, 790, 365, 282, 1978, 1202, 370, 3550, 288, 1591, 1247, 4079, 641, 314, 445, 8, 4359, 9, 945, 14, 7048, 1750, 315, 314, 536, 365, 11507, 370, 1218, 282, 288, 9590, 19157, 3336, 402, 1006, 3962, 4045, 15821, 14, 881, 446, 710, 445, 8, 8859, 9, 787, 282, 769, 402, 1676, 4652, 626, 314, 1591, 15006, 370, 14, 7048, 445, 8, 1708, 9, 1242, 288, 3509, 282, 445, 8, 354, 9, 790, 12, 4020, 11507, 687, 314, 1978, 12, 436, 376, 2716, 445, 8, 8859, 9, 790, 288, 626, 5548, 2399, 8623, 14, 881, 446, 16396, 83, 883, 2597, 1395, 445, 8, 2936, 395, 1314, 365, 282, 2600, 402, 6802, 626, 288, 365, 2066, 3544, 663, 367, 626, 1750, 14, 961, 883, 5647, 8837, 2879, 370, 314, 1572, 536, 14, 662, 14, 71, 288, 663, 376, 445, 8, 3578, 9, 1750, 626, 365, 663, 370, 314, 574, 402, 314, 445, 8, 3578, 9, 4045, 536, 14, 489, 9393, 26, 267, 1369, 26, 881, 446, 437, 2600, 402, 9393, 12, 543, 314, 790, 3769, 314, 4045, 536, 12, 1202, 465, 282, 1750, 536, 315, 314, 445, 8, 1102, 9, 288, 445, 8, 354, 9, 436, 445, 8, 8859, 9, 2883, 14, 7048, 4045, 574, 365, 282, 769, 402, 3962, 1338, 367, 626, 4045, 14, 199, 2344, 199, 199, 8918, 275, 1449, 272, 327, 8200, 14, 888, 570, 315, 18916, 1475, 272, 327, 21027, 370, 4756, 642, 8200, 3589, 315, 314, 3242, 14, 4128, 2544, 1808, 272, 327, 10935, 314, 1072, 1808, 658, 4853, 13, 7212, 446, 73, 8200, 14, 888, 1553, 513, 64, 272, 3589, 26, 4306, 272, 7478, 26, 756, 272, 7057, 26, 267, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 3586, 63, 3638, 3734, 3586, 63, 5933, 2, 267, 8623, 26, 881, 446, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 3586, 63, 3638, 3734, 7820, 288, 8623, 26, 1598, 446, 536, 26, 7370, 3439, 3586, 63, 3638, 4223, 7820, 355, 8623, 26, 2116, 446, 536, 26, 7370, 3439, 7820, 2116, 446, 536, 26, 7370, 4223, 7820, 1598, 446, 536, 26, 7370, 4223, 3586, 63, 3638, 3734, 7820, 355, 8623, 26, 2116, 446, 536, 26, 7370, 4223, 7820, 490, 6802, 26, 1993, 4223, 26, 7370, 4223, 7820, 2116, 446, 536, 26, 7370, 3734, 7820, 490, 6802, 26, 1993, 3734, 26, 7370, 3734, 7820, 881, 446, 536, 26, 7876, 272, 9393, 26, 267, 3439, 26, 288, 446, 1900, 288, 446, 10623, 267, 3734, 26, 288, 446, 4866, 288, 446, 511, 288, 446, 12441, 267, 4223, 26, 288, 446, 3330, 288, 446, 2986, 199, 2344, 199, 199, 646, 747, 199, 199, 504, 7975, 492, 3336, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 3242, 14, 2550, 492, 31775, 199, 504, 3242, 14, 5265, 14, 7212, 492, 3523, 19304, 5061, 421, 199, 533, 19337, 2377, 8, 1563, 19304, 5061, 304, 272, 408, 21638, 4652, 436, 6802, 1808, 17300, 18, 1978, 8455, 408, 339, 13637, 275, 283, 4679, 7, 339, 347, 636, 826, 721, 277, 304, 398, 1613, 8, 19304, 2377, 12, 291, 2843, 826, 4533, 339, 347, 4911, 63, 493, 8, 277, 12, 931, 304, 398, 1686, 275, 756, 267, 340, 1613, 8, 19304, 2377, 12, 291, 680, 4712, 63, 493, 8, 515, 304, 288, 570, 63, 354, 12, 1599, 275, 747, 14, 515, 14, 7973, 8, 515, 9, 953, 340, 440, 1599, 503, 1599, 315, 18953, 888, 418, 435, 445, 14, 23103, 63, 15440, 63, 18451, 26, 355, 1686, 275, 715, 398, 372, 1686, 339, 347, 1978, 8, 277, 12, 3851, 12, 2860, 304, 267, 291, 14, 26718, 14, 4561, 63, 3669, 275, 2860, 267, 372, 291, 14, 26718, 14, 1117, 63, 1160, 8, 3401, 9, 339, 347, 1050, 63, 8859, 8, 277, 12, 8200, 12, 1982, 12, 8623, 12, 1978, 63, 2936, 304, 267, 367, 1676, 315, 8623, 26, 288, 862, 26, 355, 1572, 354, 275, 291, 14, 1160, 8, 1708, 459, 354, 995, 1978, 63, 2936, 9, 288, 871, 334, 10227, 12, 1722, 304, 355, 746, 31775, 480, 2162, 450, 83, 965, 282, 1676, 543, 949, 536, 1819, 2, 450, 1982, 459, 354, 1105, 288, 340, 1572, 354, 440, 315, 8200, 14, 2634, 26, 355, 8200, 14, 525, 63, 923, 8, 923, 354, 9, 288, 1572, 275, 8200, 14, 2634, 59, 923, 354, 61, 288, 367, 334, 75, 12, 373, 9, 315, 1676, 14, 362, 360, 2936, 297, 13056, 1744, 837, 355, 1572, 14, 409, 63, 1975, 8, 75, 12, 291, 14, 1160, 8, 86, 12, 1978, 63, 2936, 430, 288, 8200, 14, 525, 63, 1739, 8, 923, 354, 12, 1982, 9, 288, 291, 14, 525, 63, 8859, 8, 7212, 12, 1572, 354, 12, 1676, 14, 362, 360, 8859, 297, 14431, 1978, 63, 2936, 9, 339, 347, 2198, 8, 277, 12, 8200, 12, 5077, 12, 931, 12, 2581, 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, 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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 ]
ashhher3/scikit-learn
examples/text/document_clustering.py
31
8036
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of standard numpy arrays. Two feature extraction methods can be used in this example: - TfidfVectorizer uses a in-memory vocabulary (a python dict) to map the most frequent words to features indices and hence compute a word occurrence frequency (sparse) matrix. The word frequencies are then reweighted using the Inverse Document Frequency (IDF) vector collected feature-wise over the corpus. - HashingVectorizer hashes word occurrences to a fixed dimensional space, possibly with collisions. The word count vectors are then normalized to each have l2-norm equal to one (projected to the euclidean unit-ball) which seems to be important for k-means to work in high dimensional space. HashingVectorizer does not provide IDF weighting as this is a stateless model (the fit method does nothing). When IDF weighting is needed it can be added by pipelining its output to a TfidfTransformer instance. Two algorithms are demoed: ordinary k-means and its more scalable cousin minibatch k-means. It can be noted that k-means (and minibatch k-means) are very sensitive to feature scaling and that in this case the IDF weighting helps improve the quality of the clustering by quite a lot as measured against the "ground truth" provided by the class label assignments of the 20 newsgroups dataset. This improvement is not visible in the Silhouette Coefficient which is small for both as this measure seem to suffer from the phenomenon called "Concentration of Measure" or "Curse of Dimensionality" for high dimensional datasets such as text data. Other measures such as V-measure and Adjusted Rand Index are information theoretic based evaluation scores: as they are only based on cluster assignments rather than distances, hence not affected by the curse of dimensionality. Note: as k-means is optimizing a non-convex objective function, it will likely end up in a local optimum. Several runs with independent random init might be necessary to get a good convergence. """ # Author: Peter Prettenhofer <peter.prettenhofer@gmail.com> # Lars Buitinck <L.J.Buitinck@uva.nl> # License: BSD 3 clause from __future__ import print_function from sklearn.datasets import fetch_20newsgroups from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import HashingVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from sklearn import metrics from sklearn.cluster import KMeans, MiniBatchKMeans import logging from optparse import OptionParser import sys from time import time import numpy as np # Display progress logs on stdout logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') # parse commandline arguments op = OptionParser() op.add_option("--lsa", dest="n_components", type="int", help="Preprocess documents with latent semantic analysis.") op.add_option("--no-minibatch", action="store_false", dest="minibatch", default=True, help="Use ordinary k-means algorithm (in batch mode).") op.add_option("--no-idf", action="store_false", dest="use_idf", default=True, help="Disable Inverse Document Frequency feature weighting.") op.add_option("--use-hashing", action="store_true", default=False, help="Use a hashing feature vectorizer") op.add_option("--n-features", type=int, default=10000, help="Maximum number of features (dimensions)" " to extract from text.") op.add_option("--verbose", action="store_true", dest="verbose", default=False, help="Print progress reports inside k-means algorithm.") print(__doc__) op.print_help() (opts, args) = op.parse_args() if len(args) > 0: op.error("this script takes no arguments.") sys.exit(1) ############################################################################### # Load some categories from the training set categories = [ 'alt.atheism', 'talk.religion.misc', 'comp.graphics', 'sci.space', ] # Uncomment the following to do the analysis on all the categories #categories = None print("Loading 20 newsgroups dataset for categories:") print(categories) dataset = fetch_20newsgroups(subset='all', categories=categories, shuffle=True, random_state=42) print("%d documents" % len(dataset.data)) print("%d categories" % len(dataset.target_names)) print() labels = dataset.target true_k = np.unique(labels).shape[0] print("Extracting features from the training dataset using a sparse vectorizer") t0 = time() if opts.use_hashing: if opts.use_idf: # Perform an IDF normalization on the output of HashingVectorizer hasher = HashingVectorizer(n_features=opts.n_features, stop_words='english', non_negative=True, norm=None, binary=False) vectorizer = make_pipeline(hasher, TfidfTransformer()) else: vectorizer = HashingVectorizer(n_features=opts.n_features, stop_words='english', non_negative=False, norm='l2', binary=False) else: vectorizer = TfidfVectorizer(max_df=0.5, max_features=opts.n_features, min_df=2, stop_words='english', use_idf=opts.use_idf) X = vectorizer.fit_transform(dataset.data) print("done in %fs" % (time() - t0)) print("n_samples: %d, n_features: %d" % X.shape) print() if opts.n_components: print("Performing dimensionality reduction using LSA") t0 = time() # Vectorizer results are normalized, which makes KMeans behave as # spherical k-means for better results. Since LSA/SVD results are # not normalized, we have to redo the normalization. svd = TruncatedSVD(opts.n_components) lsa = make_pipeline(svd, Normalizer(copy=False)) X = lsa.fit_transform(X) print("done in %fs" % (time() - t0)) explained_variance = svd.explained_variance_ratio_.sum() print("Explained variance of the SVD step: {}%".format( int(explained_variance * 100))) print() ############################################################################### # Do the actual clustering if opts.minibatch: km = MiniBatchKMeans(n_clusters=true_k, init='k-means++', n_init=1, init_size=1000, batch_size=1000, verbose=opts.verbose) else: km = KMeans(n_clusters=true_k, init='k-means++', max_iter=100, n_init=1, verbose=opts.verbose) print("Clustering sparse data with %s" % km) t0 = time() km.fit(X) print("done in %0.3fs" % (time() - t0)) print() print("Homogeneity: %0.3f" % metrics.homogeneity_score(labels, km.labels_)) print("Completeness: %0.3f" % metrics.completeness_score(labels, km.labels_)) print("V-measure: %0.3f" % metrics.v_measure_score(labels, km.labels_)) print("Adjusted Rand-Index: %.3f" % metrics.adjusted_rand_score(labels, km.labels_)) print("Silhouette Coefficient: %0.3f" % metrics.silhouette_score(X, km.labels_, sample_size=1000)) print() if not (opts.n_components or opts.use_hashing): print("Top terms per cluster:") order_centroids = km.cluster_centers_.argsort()[:, ::-1] terms = vectorizer.get_feature_names() for i in range(true_k): print("Cluster %d:" % i, end='') for ind in order_centroids[i, :10]: print(' %s' % terms[ind], end='') print()
bsd-3-clause
[ 624, 199, 2486, 18673, 199, 31174, 1318, 8247, 1808, 1022, 13, 11579, 199, 2486, 18673, 199, 199, 2765, 365, 376, 2893, 21207, 4212, 314, 6276, 6065, 13, 4643, 883, 506, 1202, 370, 4350, 199, 12233, 701, 17398, 1808, 282, 330, 643, 13, 1618, 13, 3148, 18140, 14, 961, 2893, 4440, 199, 65, 7026, 14, 4421, 3634, 370, 3877, 314, 4534, 3140, 402, 4465, 2680, 6572, 14, 199, 199, 11467, 3878, 19967, 3102, 883, 506, 1202, 315, 642, 2893, 26, 819, 446, 377, 23274, 26165, 4440, 282, 315, 13, 4844, 17515, 334, 65, 2366, 1211, 9, 370, 2341, 314, 4750, 272, 28914, 5932, 370, 4534, 4918, 436, 19407, 4526, 282, 4349, 23101, 272, 9857, 334, 4421, 9, 3634, 14, 710, 4349, 22411, 787, 2066, 295, 13522, 1808, 272, 314, 1010, 2077, 7543, 481, 6056, 334, 998, 38, 9, 5477, 13736, 3878, 13, 2605, 1806, 272, 314, 16831, 14, 819, 446, 16101, 316, 26165, 14647, 4349, 22099, 370, 282, 6317, 28341, 4601, 12, 272, 12570, 543, 30063, 14, 710, 4349, 2338, 11102, 787, 2066, 9657, 370, 272, 1924, 1172, 634, 18, 13, 4791, 4472, 370, 1373, 334, 25554, 370, 314, 325, 24941, 4137, 13, 8571, 9, 1314, 272, 12237, 370, 506, 11012, 367, 1022, 13, 11579, 370, 1736, 315, 4721, 28341, 4601, 14, 339, 16101, 316, 26165, 1630, 440, 5647, 2870, 38, 5401, 316, 465, 642, 365, 282, 1174, 2003, 272, 1402, 334, 1589, 5542, 1083, 1630, 6548, 680, 3979, 2870, 38, 5401, 316, 365, 4346, 652, 883, 272, 506, 3483, 701, 5200, 30176, 2399, 1072, 370, 282, 377, 23274, 19761, 1256, 14, 199, 199, 11467, 18036, 787, 14779, 379, 26, 24801, 1022, 13, 11579, 436, 2399, 1655, 5269, 461, 512, 527, 262, 199, 827, 21454, 1022, 13, 11579, 14, 199, 199, 7940, 883, 506, 949, 471, 626, 1022, 13, 11579, 334, 460, 30829, 1022, 13, 11579, 9, 787, 7437, 18423, 370, 199, 4445, 13690, 436, 626, 315, 642, 1930, 314, 2870, 38, 5401, 316, 22577, 19053, 314, 199, 9161, 402, 314, 19454, 701, 18794, 282, 13918, 465, 27396, 6169, 314, 298, 3928, 16865, 2, 199, 16929, 701, 314, 1021, 1768, 18121, 402, 314, 3388, 19497, 2634, 4789, 14, 199, 199, 2765, 19053, 434, 365, 440, 8917, 315, 314, 428, 382, 526, 310, 14586, 1849, 21069, 1314, 365, 7425, 199, 509, 3865, 465, 642, 9775, 17021, 370, 18741, 1260, 687, 314, 3945, 287, 1377, 2865, 2797, 199, 2, 714, 19722, 402, 22933, 2, 503, 298, 35, 1394, 402, 25291, 6712, 2, 367, 4721, 28341, 199, 12281, 4066, 465, 1318, 666, 14, 5439, 17616, 1482, 4066, 465, 812, 13, 9580, 436, 4431, 74, 7274, 820, 460, 199, 2681, 787, 2556, 314, 720, 764, 4079, 11735, 9342, 26, 465, 2985, 787, 1454, 4079, 199, 265, 4350, 18121, 7830, 2419, 15108, 12, 19407, 440, 16955, 701, 314, 1094, 261, 199, 1618, 6240, 6712, 14, 199, 199, 7443, 26, 465, 1022, 13, 11579, 365, 5323, 9147, 282, 2222, 13, 388, 26221, 20632, 805, 12, 652, 911, 12060, 199, 500, 1536, 315, 282, 2257, 5323, 453, 14, 3240, 422, 279, 7858, 543, 12717, 2196, 4205, 5594, 506, 199, 17927, 370, 664, 282, 6954, 21346, 14, 199, 199, 624, 199, 199, 3, 6529, 26, 22912, 510, 3292, 724, 526, 2412, 665, 321, 351, 14, 657, 4075, 526, 2412, 32, 6799, 14, 957, 30, 199, 3, 260, 491, 4291, 4779, 390, 262, 346, 665, 44, 14, 42, 14, 1713, 390, 262, 346, 32, 85, 3042, 14, 7530, 30, 199, 3, 844, 26, 6289, 650, 8502, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 6357, 14, 12281, 492, 5267, 63, 1165, 13224, 2634, 199, 504, 6357, 14, 31384, 492, 25594, 3153, 4985, 36, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 16101, 316, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 19761, 199, 504, 6357, 14, 7379, 492, 1852, 63, 7379, 199, 504, 6357, 14, 21402, 492, 11514, 1793, 199, 504, 6357, 492, 7186, 199, 199, 504, 6357, 14, 4201, 492, 1804, 21190, 12, 24954, 8842, 43, 21190, 199, 199, 646, 2050, 199, 504, 8691, 492, 13491, 199, 646, 984, 199, 504, 900, 492, 900, 199, 199, 646, 2680, 465, 980, 421, 199, 3, 12175, 6696, 9610, 641, 3839, 199, 4806, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 12, 490, 1475, 29342, 18331, 9, 83, 2818, 20056, 9, 83, 2818, 1188, 9, 83, 358, 199, 199, 3, 2198, 28279, 2368, 199, 411, 275, 13491, 342, 199, 411, 14, 525, 63, 1422, 6739, 31288, 401, 1598, 2053, 628, 78, 63, 4608, 401, 730, 628, 442, 401, 1598, 1720, 628, 26539, 8247, 543, 2465, 343, 32451, 11284, 2685, 199, 411, 14, 525, 63, 1422, 6739, 889, 13, 827, 21454, 401, 1598, 1595, 628, 1617, 63, 3910, 401, 2053, 628, 827, 21454, 401, 849, 29, 549, 12, 1598, 1720, 628, 6119, 24801, 1022, 13, 11579, 5563, 334, 262, 3522, 818, 26744, 199, 411, 14, 525, 63, 1422, 6739, 889, 13, 24003, 401, 1598, 1595, 628, 1617, 63, 3910, 401, 2053, 628, 1180, 63, 24003, 401, 849, 29, 549, 12, 1598, 1720, 628, 13707, 1010, 2077, 7543, 481, 6056, 3878, 5401, 316, 2685, 199, 411, 14, 525, 63, 1422, 6739, 1180, 13, 2227, 316, 401, 1598, 1595, 628, 1617, 63, 2052, 401, 849, 29, 797, 12, 1598, 1720, 628, 6119, 282, 25223, 3878, 5477, 1793, 531, 199, 411, 14, 525, 63, 1422, 6739, 78, 13, 3179, 401, 730, 29, 442, 12, 849, 29, 9943, 12, 1598, 1720, 628, 10915, 1329, 402, 4534, 334, 13320, 2924, 673, 298, 370, 5536, 687, 1318, 2685, 199, 411, 14, 525, 63, 1422, 6739, 3832, 401, 1598, 1595, 628, 1617, 63, 2052, 401, 2053, 628, 3832, 401, 849, 29, 797, 12, 1598, 1720, 628, 5375, 6696, 13924, 6272, 1022, 13, 11579, 5563, 2685, 199, 199, 1361, 3460, 1301, 3368, 199, 411, 14, 1361, 63, 3437, 342, 199, 199, 8, 3291, 12, 1249, 9, 275, 1687, 14, 1122, 63, 589, 342, 199, 692, 822, 8, 589, 9, 690, 378, 26, 272, 1687, 14, 705, 480, 3749, 2884, 6181, 949, 2368, 2685, 272, 984, 14, 2224, 8, 17, 9 ]
[ 199, 2486, 18673, 199, 31174, 1318, 8247, 1808, 1022, 13, 11579, 199, 2486, 18673, 199, 199, 2765, 365, 376, 2893, 21207, 4212, 314, 6276, 6065, 13, 4643, 883, 506, 1202, 370, 4350, 199, 12233, 701, 17398, 1808, 282, 330, 643, 13, 1618, 13, 3148, 18140, 14, 961, 2893, 4440, 199, 65, 7026, 14, 4421, 3634, 370, 3877, 314, 4534, 3140, 402, 4465, 2680, 6572, 14, 199, 199, 11467, 3878, 19967, 3102, 883, 506, 1202, 315, 642, 2893, 26, 819, 446, 377, 23274, 26165, 4440, 282, 315, 13, 4844, 17515, 334, 65, 2366, 1211, 9, 370, 2341, 314, 4750, 272, 28914, 5932, 370, 4534, 4918, 436, 19407, 4526, 282, 4349, 23101, 272, 9857, 334, 4421, 9, 3634, 14, 710, 4349, 22411, 787, 2066, 295, 13522, 1808, 272, 314, 1010, 2077, 7543, 481, 6056, 334, 998, 38, 9, 5477, 13736, 3878, 13, 2605, 1806, 272, 314, 16831, 14, 819, 446, 16101, 316, 26165, 14647, 4349, 22099, 370, 282, 6317, 28341, 4601, 12, 272, 12570, 543, 30063, 14, 710, 4349, 2338, 11102, 787, 2066, 9657, 370, 272, 1924, 1172, 634, 18, 13, 4791, 4472, 370, 1373, 334, 25554, 370, 314, 325, 24941, 4137, 13, 8571, 9, 1314, 272, 12237, 370, 506, 11012, 367, 1022, 13, 11579, 370, 1736, 315, 4721, 28341, 4601, 14, 339, 16101, 316, 26165, 1630, 440, 5647, 2870, 38, 5401, 316, 465, 642, 365, 282, 1174, 2003, 272, 1402, 334, 1589, 5542, 1083, 1630, 6548, 680, 3979, 2870, 38, 5401, 316, 365, 4346, 652, 883, 272, 506, 3483, 701, 5200, 30176, 2399, 1072, 370, 282, 377, 23274, 19761, 1256, 14, 199, 199, 11467, 18036, 787, 14779, 379, 26, 24801, 1022, 13, 11579, 436, 2399, 1655, 5269, 461, 512, 527, 262, 199, 827, 21454, 1022, 13, 11579, 14, 199, 199, 7940, 883, 506, 949, 471, 626, 1022, 13, 11579, 334, 460, 30829, 1022, 13, 11579, 9, 787, 7437, 18423, 370, 199, 4445, 13690, 436, 626, 315, 642, 1930, 314, 2870, 38, 5401, 316, 22577, 19053, 314, 199, 9161, 402, 314, 19454, 701, 18794, 282, 13918, 465, 27396, 6169, 314, 298, 3928, 16865, 2, 199, 16929, 701, 314, 1021, 1768, 18121, 402, 314, 3388, 19497, 2634, 4789, 14, 199, 199, 2765, 19053, 434, 365, 440, 8917, 315, 314, 428, 382, 526, 310, 14586, 1849, 21069, 1314, 365, 7425, 199, 509, 3865, 465, 642, 9775, 17021, 370, 18741, 1260, 687, 314, 3945, 287, 1377, 2865, 2797, 199, 2, 714, 19722, 402, 22933, 2, 503, 298, 35, 1394, 402, 25291, 6712, 2, 367, 4721, 28341, 199, 12281, 4066, 465, 1318, 666, 14, 5439, 17616, 1482, 4066, 465, 812, 13, 9580, 436, 4431, 74, 7274, 820, 460, 199, 2681, 787, 2556, 314, 720, 764, 4079, 11735, 9342, 26, 465, 2985, 787, 1454, 4079, 199, 265, 4350, 18121, 7830, 2419, 15108, 12, 19407, 440, 16955, 701, 314, 1094, 261, 199, 1618, 6240, 6712, 14, 199, 199, 7443, 26, 465, 1022, 13, 11579, 365, 5323, 9147, 282, 2222, 13, 388, 26221, 20632, 805, 12, 652, 911, 12060, 199, 500, 1536, 315, 282, 2257, 5323, 453, 14, 3240, 422, 279, 7858, 543, 12717, 2196, 4205, 5594, 506, 199, 17927, 370, 664, 282, 6954, 21346, 14, 199, 199, 624, 199, 199, 3, 6529, 26, 22912, 510, 3292, 724, 526, 2412, 665, 321, 351, 14, 657, 4075, 526, 2412, 32, 6799, 14, 957, 30, 199, 3, 260, 491, 4291, 4779, 390, 262, 346, 665, 44, 14, 42, 14, 1713, 390, 262, 346, 32, 85, 3042, 14, 7530, 30, 199, 3, 844, 26, 6289, 650, 8502, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 6357, 14, 12281, 492, 5267, 63, 1165, 13224, 2634, 199, 504, 6357, 14, 31384, 492, 25594, 3153, 4985, 36, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 16101, 316, 26165, 199, 504, 6357, 14, 4445, 63, 24020, 14, 505, 492, 377, 23274, 19761, 199, 504, 6357, 14, 7379, 492, 1852, 63, 7379, 199, 504, 6357, 14, 21402, 492, 11514, 1793, 199, 504, 6357, 492, 7186, 199, 199, 504, 6357, 14, 4201, 492, 1804, 21190, 12, 24954, 8842, 43, 21190, 199, 199, 646, 2050, 199, 504, 8691, 492, 13491, 199, 646, 984, 199, 504, 900, 492, 900, 199, 199, 646, 2680, 465, 980, 421, 199, 3, 12175, 6696, 9610, 641, 3839, 199, 4806, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 12, 490, 1475, 29342, 18331, 9, 83, 2818, 20056, 9, 83, 2818, 1188, 9, 83, 358, 199, 199, 3, 2198, 28279, 2368, 199, 411, 275, 13491, 342, 199, 411, 14, 525, 63, 1422, 6739, 31288, 401, 1598, 2053, 628, 78, 63, 4608, 401, 730, 628, 442, 401, 1598, 1720, 628, 26539, 8247, 543, 2465, 343, 32451, 11284, 2685, 199, 411, 14, 525, 63, 1422, 6739, 889, 13, 827, 21454, 401, 1598, 1595, 628, 1617, 63, 3910, 401, 2053, 628, 827, 21454, 401, 849, 29, 549, 12, 1598, 1720, 628, 6119, 24801, 1022, 13, 11579, 5563, 334, 262, 3522, 818, 26744, 199, 411, 14, 525, 63, 1422, 6739, 889, 13, 24003, 401, 1598, 1595, 628, 1617, 63, 3910, 401, 2053, 628, 1180, 63, 24003, 401, 849, 29, 549, 12, 1598, 1720, 628, 13707, 1010, 2077, 7543, 481, 6056, 3878, 5401, 316, 2685, 199, 411, 14, 525, 63, 1422, 6739, 1180, 13, 2227, 316, 401, 1598, 1595, 628, 1617, 63, 2052, 401, 849, 29, 797, 12, 1598, 1720, 628, 6119, 282, 25223, 3878, 5477, 1793, 531, 199, 411, 14, 525, 63, 1422, 6739, 78, 13, 3179, 401, 730, 29, 442, 12, 849, 29, 9943, 12, 1598, 1720, 628, 10915, 1329, 402, 4534, 334, 13320, 2924, 673, 298, 370, 5536, 687, 1318, 2685, 199, 411, 14, 525, 63, 1422, 6739, 3832, 401, 1598, 1595, 628, 1617, 63, 2052, 401, 2053, 628, 3832, 401, 849, 29, 797, 12, 1598, 1720, 628, 5375, 6696, 13924, 6272, 1022, 13, 11579, 5563, 2685, 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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 ]
WindCanDie/spark
python/pyspark/tests/test_readwrite.py
11
24007
# # 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 os import shutil import sys import tempfile import unittest from array import array from pyspark.testing.utils import ReusedPySparkTestCase, SPARK_HOME class InputFormatTests(ReusedPySparkTestCase): @classmethod def setUpClass(cls): ReusedPySparkTestCase.setUpClass() cls.tempdir = tempfile.NamedTemporaryFile(delete=False) os.unlink(cls.tempdir.name) cls.sc._jvm.WriteInputFormatTestDataGenerator.generateData(cls.tempdir.name, cls.sc._jsc) @classmethod def tearDownClass(cls): ReusedPySparkTestCase.tearDownClass() shutil.rmtree(cls.tempdir.name) @unittest.skipIf(sys.version >= "3", "serialize array of byte") def test_sequencefiles(self): basepath = self.tempdir.name ints = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfint/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text").collect()) ei = [(1, u'aa'), (1, u'aa'), (2, u'aa'), (2, u'bb'), (2, u'bb'), (3, u'cc')] self.assertEqual(ints, ei) doubles = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfdouble/", "org.apache.hadoop.io.DoubleWritable", "org.apache.hadoop.io.Text").collect()) ed = [(1.0, u'aa'), (1.0, u'aa'), (2.0, u'aa'), (2.0, u'bb'), (2.0, u'bb'), (3.0, u'cc')] self.assertEqual(doubles, ed) bytes = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfbytes/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.BytesWritable").collect()) ebs = [(1, bytearray('aa', 'utf-8')), (1, bytearray('aa', 'utf-8')), (2, bytearray('aa', 'utf-8')), (2, bytearray('bb', 'utf-8')), (2, bytearray('bb', 'utf-8')), (3, bytearray('cc', 'utf-8'))] self.assertEqual(bytes, ebs) text = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sftext/", "org.apache.hadoop.io.Text", "org.apache.hadoop.io.Text").collect()) et = [(u'1', u'aa'), (u'1', u'aa'), (u'2', u'aa'), (u'2', u'bb'), (u'2', u'bb'), (u'3', u'cc')] self.assertEqual(text, et) bools = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfbool/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.BooleanWritable").collect()) eb = [(1, False), (1, True), (2, False), (2, False), (2, True), (3, True)] self.assertEqual(bools, eb) nulls = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfnull/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.BooleanWritable").collect()) en = [(1, None), (1, None), (2, None), (2, None), (2, None), (3, None)] self.assertEqual(nulls, en) maps = self.sc.sequenceFile(basepath + "/sftestdata/sfmap/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.MapWritable").collect() em = [(1, {}), (1, {3.0: u'bb'}), (2, {1.0: u'aa'}), (2, {1.0: u'cc'}), (3, {2.0: u'dd'})] for v in maps: self.assertTrue(v in em) # arrays get pickled to tuples by default tuples = sorted(self.sc.sequenceFile( basepath + "/sftestdata/sfarray/", "org.apache.hadoop.io.IntWritable", "org.apache.spark.api.python.DoubleArrayWritable").collect()) et = [(1, ()), (2, (3.0, 4.0, 5.0)), (3, (4.0, 5.0, 6.0))] self.assertEqual(tuples, et) # with custom converters, primitive arrays can stay as arrays arrays = sorted(self.sc.sequenceFile( basepath + "/sftestdata/sfarray/", "org.apache.hadoop.io.IntWritable", "org.apache.spark.api.python.DoubleArrayWritable", valueConverter="org.apache.spark.api.python.WritableToDoubleArrayConverter").collect()) ea = [(1, array('d')), (2, array('d', [3.0, 4.0, 5.0])), (3, array('d', [4.0, 5.0, 6.0]))] self.assertEqual(arrays, ea) clazz = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfclass/", "org.apache.hadoop.io.Text", "org.apache.spark.api.python.TestWritable").collect()) cname = u'org.apache.spark.api.python.TestWritable' ec = [(u'1', {u'__class__': cname, u'double': 1.0, u'int': 1, u'str': u'test1'}), (u'2', {u'__class__': cname, u'double': 2.3, u'int': 2, u'str': u'test2'}), (u'3', {u'__class__': cname, u'double': 3.1, u'int': 3, u'str': u'test3'}), (u'4', {u'__class__': cname, u'double': 4.2, u'int': 4, u'str': u'test4'}), (u'5', {u'__class__': cname, u'double': 5.5, u'int': 5, u'str': u'test56'})] self.assertEqual(clazz, ec) unbatched_clazz = sorted(self.sc.sequenceFile(basepath + "/sftestdata/sfclass/", "org.apache.hadoop.io.Text", "org.apache.spark.api.python.TestWritable", ).collect()) self.assertEqual(unbatched_clazz, ec) def test_oldhadoop(self): basepath = self.tempdir.name ints = sorted(self.sc.hadoopFile(basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapred.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text").collect()) ei = [(1, u'aa'), (1, u'aa'), (2, u'aa'), (2, u'bb'), (2, u'bb'), (3, u'cc')] self.assertEqual(ints, ei) hellopath = os.path.join(SPARK_HOME, "python/test_support/hello/hello.txt") oldconf = {"mapreduce.input.fileinputformat.inputdir": hellopath} hello = self.sc.hadoopRDD("org.apache.hadoop.mapred.TextInputFormat", "org.apache.hadoop.io.LongWritable", "org.apache.hadoop.io.Text", conf=oldconf).collect() result = [(0, u'Hello World!')] self.assertEqual(hello, result) def test_newhadoop(self): basepath = self.tempdir.name ints = sorted(self.sc.newAPIHadoopFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text").collect()) ei = [(1, u'aa'), (1, u'aa'), (2, u'aa'), (2, u'bb'), (2, u'bb'), (3, u'cc')] self.assertEqual(ints, ei) hellopath = os.path.join(SPARK_HOME, "python/test_support/hello/hello.txt") newconf = {"mapreduce.input.fileinputformat.inputdir": hellopath} hello = self.sc.newAPIHadoopRDD("org.apache.hadoop.mapreduce.lib.input.TextInputFormat", "org.apache.hadoop.io.LongWritable", "org.apache.hadoop.io.Text", conf=newconf).collect() result = [(0, u'Hello World!')] self.assertEqual(hello, result) def test_newolderror(self): basepath = self.tempdir.name self.assertRaises(Exception, lambda: self.sc.hadoopFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text")) self.assertRaises(Exception, lambda: self.sc.newAPIHadoopFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapred.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text")) def test_bad_inputs(self): basepath = self.tempdir.name self.assertRaises(Exception, lambda: self.sc.sequenceFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.io.NotValidWritable", "org.apache.hadoop.io.Text")) self.assertRaises(Exception, lambda: self.sc.hadoopFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapred.NotValidInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text")) self.assertRaises(Exception, lambda: self.sc.newAPIHadoopFile( basepath + "/sftestdata/sfint/", "org.apache.hadoop.mapreduce.lib.input.NotValidInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text")) def test_converters(self): # use of custom converters basepath = self.tempdir.name maps = sorted(self.sc.sequenceFile( basepath + "/sftestdata/sfmap/", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.MapWritable", keyConverter="org.apache.spark.api.python.TestInputKeyConverter", valueConverter="org.apache.spark.api.python.TestInputValueConverter").collect()) em = [(u'\x01', []), (u'\x01', [3.0]), (u'\x02', [1.0]), (u'\x02', [1.0]), (u'\x03', [2.0])] self.assertEqual(maps, em) def test_binary_files(self): path = os.path.join(self.tempdir.name, "binaryfiles") os.mkdir(path) data = b"short binary data" with open(os.path.join(path, "part-0000"), 'wb') as f: f.write(data) [(p, d)] = self.sc.binaryFiles(path).collect() self.assertTrue(p.endswith("part-0000")) self.assertEqual(d, data) def test_binary_records(self): path = os.path.join(self.tempdir.name, "binaryrecords") os.mkdir(path) with open(os.path.join(path, "part-0000"), 'w') as f: for i in range(100): f.write('%04d' % i) result = self.sc.binaryRecords(path, 4).map(int).collect() self.assertEqual(list(range(100)), result) class OutputFormatTests(ReusedPySparkTestCase): def setUp(self): self.tempdir = tempfile.NamedTemporaryFile(delete=False) os.unlink(self.tempdir.name) def tearDown(self): shutil.rmtree(self.tempdir.name, ignore_errors=True) @unittest.skipIf(sys.version >= "3", "serialize array of byte") def test_sequencefiles(self): basepath = self.tempdir.name ei = [(1, u'aa'), (1, u'aa'), (2, u'aa'), (2, u'bb'), (2, u'bb'), (3, u'cc')] self.sc.parallelize(ei).saveAsSequenceFile(basepath + "/sfint/") ints = sorted(self.sc.sequenceFile(basepath + "/sfint/").collect()) self.assertEqual(ints, ei) ed = [(1.0, u'aa'), (1.0, u'aa'), (2.0, u'aa'), (2.0, u'bb'), (2.0, u'bb'), (3.0, u'cc')] self.sc.parallelize(ed).saveAsSequenceFile(basepath + "/sfdouble/") doubles = sorted(self.sc.sequenceFile(basepath + "/sfdouble/").collect()) self.assertEqual(doubles, ed) ebs = [(1, bytearray(b'\x00\x07spam\x08')), (2, bytearray(b'\x00\x07spam\x08'))] self.sc.parallelize(ebs).saveAsSequenceFile(basepath + "/sfbytes/") bytes = sorted(self.sc.sequenceFile(basepath + "/sfbytes/").collect()) self.assertEqual(bytes, ebs) et = [(u'1', u'aa'), (u'2', u'bb'), (u'3', u'cc')] self.sc.parallelize(et).saveAsSequenceFile(basepath + "/sftext/") text = sorted(self.sc.sequenceFile(basepath + "/sftext/").collect()) self.assertEqual(text, et) eb = [(1, False), (1, True), (2, False), (2, False), (2, True), (3, True)] self.sc.parallelize(eb).saveAsSequenceFile(basepath + "/sfbool/") bools = sorted(self.sc.sequenceFile(basepath + "/sfbool/").collect()) self.assertEqual(bools, eb) en = [(1, None), (1, None), (2, None), (2, None), (2, None), (3, None)] self.sc.parallelize(en).saveAsSequenceFile(basepath + "/sfnull/") nulls = sorted(self.sc.sequenceFile(basepath + "/sfnull/").collect()) self.assertEqual(nulls, en) em = [(1, {}), (1, {3.0: u'bb'}), (2, {1.0: u'aa'}), (2, {1.0: u'cc'}), (3, {2.0: u'dd'})] self.sc.parallelize(em).saveAsSequenceFile(basepath + "/sfmap/") maps = self.sc.sequenceFile(basepath + "/sfmap/").collect() for v in maps: self.assertTrue(v, em) def test_oldhadoop(self): basepath = self.tempdir.name dict_data = [(1, {}), (1, {"row1": 1.0}), (2, {"row2": 2.0})] self.sc.parallelize(dict_data).saveAsHadoopFile( basepath + "/oldhadoop/", "org.apache.hadoop.mapred.SequenceFileOutputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.MapWritable") result = self.sc.hadoopFile( basepath + "/oldhadoop/", "org.apache.hadoop.mapred.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.MapWritable").collect() for v in result: self.assertTrue(v, dict_data) conf = { "mapred.output.format.class": "org.apache.hadoop.mapred.SequenceFileOutputFormat", "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable", "mapreduce.job.output.value.class": "org.apache.hadoop.io.MapWritable", "mapreduce.output.fileoutputformat.outputdir": basepath + "/olddataset/" } self.sc.parallelize(dict_data).saveAsHadoopDataset(conf) input_conf = {"mapreduce.input.fileinputformat.inputdir": basepath + "/olddataset/"} result = self.sc.hadoopRDD( "org.apache.hadoop.mapred.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.MapWritable", conf=input_conf).collect() for v in result: self.assertTrue(v, dict_data) def test_newhadoop(self): basepath = self.tempdir.name data = [(1, ""), (1, "a"), (2, "bcdf")] self.sc.parallelize(data).saveAsNewAPIHadoopFile( basepath + "/newhadoop/", "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text") result = sorted(self.sc.newAPIHadoopFile( basepath + "/newhadoop/", "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text").collect()) self.assertEqual(result, data) conf = { "mapreduce.job.outputformat.class": "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable", "mapreduce.job.output.value.class": "org.apache.hadoop.io.Text", "mapreduce.output.fileoutputformat.outputdir": basepath + "/newdataset/" } self.sc.parallelize(data).saveAsNewAPIHadoopDataset(conf) input_conf = {"mapreduce.input.fileinputformat.inputdir": basepath + "/newdataset/"} new_dataset = sorted(self.sc.newAPIHadoopRDD( "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.hadoop.io.Text", conf=input_conf).collect()) self.assertEqual(new_dataset, data) @unittest.skipIf(sys.version >= "3", "serialize of array") def test_newhadoop_with_array(self): basepath = self.tempdir.name # use custom ArrayWritable types and converters to handle arrays array_data = [(1, array('d')), (1, array('d', [1.0, 2.0, 3.0])), (2, array('d', [3.0, 4.0, 5.0]))] self.sc.parallelize(array_data).saveAsNewAPIHadoopFile( basepath + "/newhadoop/", "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.spark.api.python.DoubleArrayWritable", valueConverter="org.apache.spark.api.python.DoubleArrayToWritableConverter") result = sorted(self.sc.newAPIHadoopFile( basepath + "/newhadoop/", "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.spark.api.python.DoubleArrayWritable", valueConverter="org.apache.spark.api.python.WritableToDoubleArrayConverter").collect()) self.assertEqual(result, array_data) conf = { "mapreduce.job.outputformat.class": "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable", "mapreduce.job.output.value.class": "org.apache.spark.api.python.DoubleArrayWritable", "mapreduce.output.fileoutputformat.outputdir": basepath + "/newdataset/" } self.sc.parallelize(array_data).saveAsNewAPIHadoopDataset( conf, valueConverter="org.apache.spark.api.python.DoubleArrayToWritableConverter") input_conf = {"mapreduce.input.fileinputformat.inputdir": basepath + "/newdataset/"} new_dataset = sorted(self.sc.newAPIHadoopRDD( "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat", "org.apache.hadoop.io.IntWritable", "org.apache.spark.api.python.DoubleArrayWritable", valueConverter="org.apache.spark.api.python.WritableToDoubleArrayConverter", conf=input_conf).collect()) self.assertEqual(new_dataset, array_data) def test_newolderror(self): basepath = self.tempdir.name rdd = self.sc.parallelize(range(1, 4)).map(lambda x: (x, "a" * x)) self.assertRaises(Exception, lambda: rdd.saveAsHadoopFile( basepath + "/newolderror/saveAsHadoopFile/", "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat")) self.assertRaises(Exception, lambda: rdd.saveAsNewAPIHadoopFile( basepath + "/newolderror/saveAsNewAPIHadoopFile/", "org.apache.hadoop.mapred.SequenceFileOutputFormat")) def test_bad_inputs(self): basepath = self.tempdir.name rdd = self.sc.parallelize(range(1, 4)).map(lambda x: (x, "a" * x)) self.assertRaises(Exception, lambda: rdd.saveAsHadoopFile( basepath + "/badinputs/saveAsHadoopFile/", "org.apache.hadoop.mapred.NotValidOutputFormat")) self.assertRaises(Exception, lambda: rdd.saveAsNewAPIHadoopFile( basepath + "/badinputs/saveAsNewAPIHadoopFile/", "org.apache.hadoop.mapreduce.lib.output.NotValidOutputFormat")) def test_converters(self): # use of custom converters basepath = self.tempdir.name data = [(1, {3.0: u'bb'}), (2, {1.0: u'aa'}), (3, {2.0: u'dd'})] self.sc.parallelize(data).saveAsNewAPIHadoopFile( basepath + "/converters/", "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", keyConverter="org.apache.spark.api.python.TestOutputKeyConverter", valueConverter="org.apache.spark.api.python.TestOutputValueConverter") converted = sorted(self.sc.sequenceFile(basepath + "/converters/").collect()) expected = [(u'1', 3.0), (u'2', 1.0), (u'3', 2.0)] self.assertEqual(converted, expected) def test_reserialization(self): basepath = self.tempdir.name x = range(1, 5) y = range(1001, 1005) data = list(zip(x, y)) rdd = self.sc.parallelize(x).zip(self.sc.parallelize(y)) rdd.saveAsSequenceFile(basepath + "/reserialize/sequence") result1 = sorted(self.sc.sequenceFile(basepath + "/reserialize/sequence").collect()) self.assertEqual(result1, data) rdd.saveAsHadoopFile( basepath + "/reserialize/hadoop", "org.apache.hadoop.mapred.SequenceFileOutputFormat") result2 = sorted(self.sc.sequenceFile(basepath + "/reserialize/hadoop").collect()) self.assertEqual(result2, data) rdd.saveAsNewAPIHadoopFile( basepath + "/reserialize/newhadoop", "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat") result3 = sorted(self.sc.sequenceFile(basepath + "/reserialize/newhadoop").collect()) self.assertEqual(result3, data) conf4 = { "mapred.output.format.class": "org.apache.hadoop.mapred.SequenceFileOutputFormat", "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable", "mapreduce.job.output.value.class": "org.apache.hadoop.io.IntWritable", "mapreduce.output.fileoutputformat.outputdir": basepath + "/reserialize/dataset"} rdd.saveAsHadoopDataset(conf4) result4 = sorted(self.sc.sequenceFile(basepath + "/reserialize/dataset").collect()) self.assertEqual(result4, data) conf5 = {"mapreduce.job.outputformat.class": "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat", "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable", "mapreduce.job.output.value.class": "org.apache.hadoop.io.IntWritable", "mapreduce.output.fileoutputformat.outputdir": basepath + "/reserialize/newdataset" } rdd.saveAsNewAPIHadoopDataset(conf5) result5 = sorted(self.sc.sequenceFile(basepath + "/reserialize/newdataset").collect()) self.assertEqual(result5, data) def test_malformed_RDD(self): basepath = self.tempdir.name # non-batch-serialized RDD[[(K, V)]] should be rejected data = [[(1, "a")], [(2, "aa")], [(3, "aaa")]] rdd = self.sc.parallelize(data, len(data)) self.assertRaises(Exception, lambda: rdd.saveAsSequenceFile( basepath + "/malformed/sequence")) if __name__ == "__main__": from pyspark.tests.test_readwrite import * try: import xmlrunner testRunner = xmlrunner.XMLTestRunner(output='target/test-reports') except ImportError: testRunner = None unittest.main(testRunner=testRunner, verbosity=2)
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 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, 646, 747, 199, 646, 5145, 199, 646, 984, 199, 646, 5549, 199, 646, 2882, 199, 504, 1625, 492, 1625, 199, 199, 504, 15847, 14, 4776, 14, 1208, 492, 799, 2972, 2713, 27110, 1746, 12, 428, 28535, 63, 9524, 421, 199, 533, 6924, 3484, 2925, 8, 497, 2972, 2713, 27110, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 799, 2972, 2713, 27110, 1746, 14, 27777, 342, 267, 843, 14, 11567, 275, 5549, 14, 19320, 8, 1807, 29, 797, 9, 267, 747, 14, 7162, 8, 1886, 14, 11567, 14, 354, 9, 267, 843, 14, 551, 423, 15813, 14, 3534, 3205, 3484, 16550, 7599, 14, 4208, 1451, 8, 1886, 14, 11567, 14, 354, 12, 843, 14, 551, 423, 74, 551, 9, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 799, 2972, 2713, 27110, 1746, 14, 12336, 2543, 342, 267, 5145, 14, 9242, 8, 1886, 14, 11567, 14, 354, 9, 339, 768, 2796, 14, 15118, 8, 1274, 14, 1023, 2356, 298, 19, 401, 298, 3549, 1625, 402, 3696, 531, 272, 347, 511, 63, 4041, 1725, 8, 277, 304, 267, 1300, 515, 275, 291, 14, 11567, 14, 354, 267, 14526, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 442, 10665, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 20654, 275, 3842, 17, 12, 399, 7, 2158, 659, 334, 17, 12, 399, 7, 2158, 659, 334, 18, 12, 399, 7, 2158, 659, 334, 18, 12, 399, 7, 2501, 659, 334, 18, 12, 399, 7, 2501, 659, 334, 19, 12, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 13141, 12, 20654, 9, 398, 4270, 83, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 3157, 10665, 6343, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 7281, 4966, 1224, 401, 6343, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 3988, 275, 3842, 17, 14, 16, 12, 399, 7, 2158, 659, 334, 17, 14, 16, 12, 399, 7, 2158, 659, 334, 18, 14, 16, 12, 399, 7, 2158, 659, 334, 18, 14, 16, 12, 399, 7, 2501, 659, 334, 18, 14, 16, 12, 399, 7, 2501, 659, 334, 19, 14, 16, 12, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 3157, 83, 12, 3988, 9, 398, 2783, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2394, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 5571, 4966, 1224, 3471, 7112, 1012, 267, 325, 1533, 275, 3842, 17, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 17, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2501, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2501, 297, 283, 1624, 13, 24, 3855, 2049, 334, 19, 12, 11640, 360, 2055, 297, 283, 1624, 13, 24, 27738, 267, 291, 14, 629, 8, 2394, 12, 325, 1533, 9, 398, 1318, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 505, 10665, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 401, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 10844, 275, 3842, 85, 7, 17, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 17, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2501, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2501, 659, 1598, 334, 85, 7, 19, 297, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 505, 12, 10844, 9, 398, 1234, 1446, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2245, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 4082, 4966, 1224, 3471, 7112, 1012, 267, 26669, 275, 3842, 17, 12, 756, 395, 334, 17, 12, 715, 395, 334, 18, 12, 756, 395, 334, 18, 12, 756, 395, 334, 18, 12, 715, 395, 334, 19, 12, 715, 1874, 267, 291, 14, 629, 8, 656, 1446, 12, 26669, 9, 398, 302, 13072, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2307, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 4082, 4966, 1224, 3471, 7112, 1012, 267, 655, 275, 3842, 17, 12, 488, 395, 334, 17, 12, 488, 395, 334, 18, 12, 488, 395, 334, 18, 12, 488, 395 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 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, 646, 747, 199, 646, 5145, 199, 646, 984, 199, 646, 5549, 199, 646, 2882, 199, 504, 1625, 492, 1625, 199, 199, 504, 15847, 14, 4776, 14, 1208, 492, 799, 2972, 2713, 27110, 1746, 12, 428, 28535, 63, 9524, 421, 199, 533, 6924, 3484, 2925, 8, 497, 2972, 2713, 27110, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 799, 2972, 2713, 27110, 1746, 14, 27777, 342, 267, 843, 14, 11567, 275, 5549, 14, 19320, 8, 1807, 29, 797, 9, 267, 747, 14, 7162, 8, 1886, 14, 11567, 14, 354, 9, 267, 843, 14, 551, 423, 15813, 14, 3534, 3205, 3484, 16550, 7599, 14, 4208, 1451, 8, 1886, 14, 11567, 14, 354, 12, 843, 14, 551, 423, 74, 551, 9, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 799, 2972, 2713, 27110, 1746, 14, 12336, 2543, 342, 267, 5145, 14, 9242, 8, 1886, 14, 11567, 14, 354, 9, 339, 768, 2796, 14, 15118, 8, 1274, 14, 1023, 2356, 298, 19, 401, 298, 3549, 1625, 402, 3696, 531, 272, 347, 511, 63, 4041, 1725, 8, 277, 304, 267, 1300, 515, 275, 291, 14, 11567, 14, 354, 267, 14526, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 442, 10665, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 20654, 275, 3842, 17, 12, 399, 7, 2158, 659, 334, 17, 12, 399, 7, 2158, 659, 334, 18, 12, 399, 7, 2158, 659, 334, 18, 12, 399, 7, 2501, 659, 334, 18, 12, 399, 7, 2501, 659, 334, 19, 12, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 13141, 12, 20654, 9, 398, 4270, 83, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 3157, 10665, 6343, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 7281, 4966, 1224, 401, 6343, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 3988, 275, 3842, 17, 14, 16, 12, 399, 7, 2158, 659, 334, 17, 14, 16, 12, 399, 7, 2158, 659, 334, 18, 14, 16, 12, 399, 7, 2158, 659, 334, 18, 14, 16, 12, 399, 7, 2501, 659, 334, 18, 14, 16, 12, 399, 7, 2501, 659, 334, 19, 14, 16, 12, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 3157, 83, 12, 3988, 9, 398, 2783, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2394, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 5571, 4966, 1224, 3471, 7112, 1012, 267, 325, 1533, 275, 3842, 17, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 17, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2158, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2501, 297, 283, 1624, 13, 24, 3855, 2049, 334, 18, 12, 11640, 360, 2501, 297, 283, 1624, 13, 24, 3855, 2049, 334, 19, 12, 11640, 360, 2055, 297, 283, 1624, 13, 24, 27738, 267, 291, 14, 629, 8, 2394, 12, 325, 1533, 9, 398, 1318, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 505, 10665, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 401, 5644, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 1872, 3471, 7112, 1012, 267, 10844, 275, 3842, 85, 7, 17, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 17, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2158, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2501, 659, 1598, 334, 85, 7, 18, 297, 399, 7, 2501, 659, 1598, 334, 85, 7, 19, 297, 399, 7, 2055, 5440, 267, 291, 14, 629, 8, 505, 12, 10844, 9, 398, 1234, 1446, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2245, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 4082, 4966, 1224, 3471, 7112, 1012, 267, 26669, 275, 3842, 17, 12, 756, 395, 334, 17, 12, 715, 395, 334, 18, 12, 756, 395, 334, 18, 12, 756, 395, 334, 18, 12, 715, 395, 334, 19, 12, 715, 1874, 267, 291, 14, 629, 8, 656, 1446, 12, 26669, 9, 398, 302, 13072, 275, 3355, 8, 277, 14, 551, 14, 4041, 1173, 8, 1095, 515, 435, 3286, 7646, 18481, 15, 7646, 2307, 10665, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 3241, 4966, 1224, 401, 4490, 298, 1308, 14, 3796, 14, 15449, 14, 2308, 14, 4082, 4966, 1224, 3471, 7112, 1012, 267, 655, 275, 3842, 17, 12, 488, 395, 334, 17, 12, 488, 395, 334, 18, 12, 488, 395, 334, 18, 12, 488, 395, 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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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 ]
hsuchifeng/cuda-convnet2
python_util/data.py
180
7803
# Copyright 2014 Google 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. import numpy as n from numpy.random import randn, rand, random_integers import os from threading import Thread from util import * BATCH_META_FILE = "batches.meta" class DataLoaderThread(Thread): def __init__(self, path, tgt): Thread.__init__(self) self.path = path self.tgt = tgt def run(self): self.tgt += [unpickle(self.path)] class DataProvider: BATCH_REGEX = re.compile('^data_batch_(\d+)(\.\d+)?$') def __init__(self, data_dir, batch_range=None, init_epoch=1, init_batchnum=None, dp_params={}, test=False): if batch_range == None: batch_range = DataProvider.get_batch_nums(data_dir) if init_batchnum is None or init_batchnum not in batch_range: init_batchnum = batch_range[0] self.data_dir = data_dir self.batch_range = batch_range self.curr_epoch = init_epoch self.curr_batchnum = init_batchnum self.dp_params = dp_params self.batch_meta = self.get_batch_meta(data_dir) self.data_dic = None self.test = test self.batch_idx = batch_range.index(init_batchnum) def get_next_batch(self): if self.data_dic is None or len(self.batch_range) > 1: self.data_dic = self.get_batch(self.curr_batchnum) epoch, batchnum = self.curr_epoch, self.curr_batchnum self.advance_batch() return epoch, batchnum, self.data_dic def get_batch(self, batch_num): fname = self.get_data_file_name(batch_num) if os.path.isdir(fname): # batch in sub-batches sub_batches = sorted(os.listdir(fname), key=alphanum_key) #print sub_batches num_sub_batches = len(sub_batches) tgts = [[] for i in xrange(num_sub_batches)] threads = [DataLoaderThread(os.path.join(fname, s), tgt) for (s, tgt) in zip(sub_batches, tgts)] for thread in threads: thread.start() for thread in threads: thread.join() return [t[0] for t in tgts] return unpickle(self.get_data_file_name(batch_num)) def get_data_dims(self,idx=0): return self.batch_meta['num_vis'] if idx == 0 else 1 def advance_batch(self): self.batch_idx = self.get_next_batch_idx() self.curr_batchnum = self.batch_range[self.batch_idx] if self.batch_idx == 0: # we wrapped self.curr_epoch += 1 def get_next_batch_idx(self): return (self.batch_idx + 1) % len(self.batch_range) def get_next_batch_num(self): return self.batch_range[self.get_next_batch_idx()] # get filename of current batch def get_data_file_name(self, batchnum=None): if batchnum is None: batchnum = self.curr_batchnum return os.path.join(self.data_dir, 'data_batch_%d' % batchnum) @classmethod def get_instance(cls, data_dir, batch_range=None, init_epoch=1, init_batchnum=None, type="default", dp_params={}, test=False): # why the fuck can't i reference DataProvider in the original definition? #cls.dp_classes['default'] = DataProvider type = type or DataProvider.get_batch_meta(data_dir)['dp_type'] # allow data to decide data provider if type.startswith("dummy-"): name = "-".join(type.split('-')[:-1]) + "-n" if name not in dp_types: raise DataProviderException("No such data provider: %s" % type) _class = dp_classes[name] dims = int(type.split('-')[-1]) return _class(dims) elif type in dp_types: _class = dp_classes[type] return _class(data_dir, batch_range, init_epoch, init_batchnum, dp_params, test) raise DataProviderException("No such data provider: %s" % type) @classmethod def register_data_provider(cls, name, desc, _class): if name in dp_types: raise DataProviderException("Data provider %s already registered" % name) dp_types[name] = desc dp_classes[name] = _class @staticmethod def get_batch_meta(data_dir): return unpickle(os.path.join(data_dir, BATCH_META_FILE)) @staticmethod def get_batch_filenames(srcdir): return sorted([f for f in os.listdir(srcdir) if DataProvider.BATCH_REGEX.match(f)], key=alphanum_key) @staticmethod def get_batch_nums(srcdir): names = DataProvider.get_batch_filenames(srcdir) return sorted(list(set(int(DataProvider.BATCH_REGEX.match(n).group(1)) for n in names))) @staticmethod def get_num_batches(srcdir): return len(DataProvider.get_batch_nums(srcdir)) class DummyDataProvider(DataProvider): def __init__(self, data_dim): #self.data_dim = data_dim self.batch_range = [1] self.batch_meta = {'num_vis': data_dim, 'data_in_rows':True} self.curr_epoch = 1 self.curr_batchnum = 1 self.batch_idx = 0 def get_next_batch(self): epoch, batchnum = self.curr_epoch, self.curr_batchnum self.advance_batch() data = rand(512, self.get_data_dims()).astype(n.single) return self.curr_epoch, self.curr_batchnum, {'data':data} class LabeledDataProvider(DataProvider): def __init__(self, data_dir, batch_range=None, init_epoch=1, init_batchnum=None, dp_params={}, test=False): DataProvider.__init__(self, data_dir, batch_range, init_epoch, init_batchnum, dp_params, test) def get_num_classes(self): return len(self.batch_meta['label_names']) class LabeledDummyDataProvider(DummyDataProvider): def __init__(self, data_dim, num_classes=10, num_cases=7): #self.data_dim = data_dim self.batch_range = [1] self.batch_meta = {'num_vis': data_dim, 'label_names': [str(x) for x in range(num_classes)], 'data_in_rows':True} self.num_cases = num_cases self.num_classes = num_classes self.curr_epoch = 1 self.curr_batchnum = 1 self.batch_idx=0 self.data = None def get_num_classes(self): return self.num_classes def get_next_batch(self): epoch, batchnum = self.curr_epoch, self.curr_batchnum self.advance_batch() if self.data is None: data = rand(self.num_cases, self.get_data_dims()).astype(n.single) # <--changed to rand labels = n.require(n.c_[random_integers(0,self.num_classes-1,self.num_cases)], requirements='C', dtype=n.single) self.data, self.labels = data, labels else: data, labels = self.data, self.labels # print data.shape, labels.shape return self.curr_epoch, self.curr_batchnum, [data.T, labels.T ] dp_types = {"dummy-n": "Dummy data provider for n-dimensional data", "dummy-labeled-n": "Labeled dummy data provider for n-dimensional data"} dp_classes = {"dummy-n": DummyDataProvider, "dummy-labeled-n": LabeledDummyDataProvider} class DataProviderException(Exception): pass
apache-2.0
[ 3, 1898, 6927, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 221, 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, 221, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 221, 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, 302, 199, 504, 2680, 14, 2355, 492, 10261, 78, 12, 10261, 12, 2196, 63, 23931, 199, 646, 747, 199, 504, 5796, 492, 11086, 199, 504, 4884, 492, 627, 199, 199, 20813, 63, 10614, 63, 3817, 275, 298, 14896, 14, 2024, 2, 199, 199, 533, 3918, 5455, 4436, 8, 4436, 304, 272, 347, 636, 826, 721, 277, 12, 931, 12, 11967, 304, 267, 11086, 855, 826, 721, 277, 9, 267, 291, 14, 515, 275, 931, 267, 291, 14, 15328, 275, 11967, 272, 347, 1255, 8, 277, 304, 267, 291, 14, 15328, 847, 359, 324, 8092, 8, 277, 14, 515, 1874, 268, 199, 533, 3918, 6663, 26, 272, 699, 8078, 63, 10710, 275, 295, 14, 2014, 9097, 576, 63, 2912, 2531, 60, 68, 27860, 3134, 68, 19544, 9988, 272, 347, 636, 826, 721, 277, 12, 666, 63, 694, 12, 3522, 63, 1842, 29, 403, 12, 4205, 63, 7367, 29, 17, 12, 4205, 63, 2912, 1507, 29, 403, 12, 12392, 63, 1162, 10324, 511, 29, 797, 304, 267, 340, 3522, 63, 1842, 508, 488, 26, 288, 3522, 63, 1842, 275, 3918, 6663, 14, 362, 63, 2912, 63, 16084, 8, 576, 63, 694, 9, 267, 340, 4205, 63, 2912, 1507, 365, 488, 503, 4205, 63, 2912, 1507, 440, 315, 3522, 63, 1842, 26, 288, 4205, 63, 2912, 1507, 275, 3522, 63, 1842, 59, 16, 61, 398, 291, 14, 576, 63, 694, 275, 666, 63, 694, 267, 291, 14, 2912, 63, 1842, 275, 3522, 63, 1842, 267, 291, 14, 9808, 63, 7367, 275, 4205, 63, 7367, 267, 291, 14, 9808, 63, 2912, 1507, 275, 4205, 63, 2912, 1507, 267, 291, 14, 5780, 63, 1162, 275, 12392, 63, 1162, 267, 291, 14, 2912, 63, 2024, 275, 291, 14, 362, 63, 2912, 63, 2024, 8, 576, 63, 694, 9, 267, 291, 14, 576, 63, 5000, 275, 488, 267, 291, 14, 396, 275, 511, 267, 291, 14, 2912, 63, 2996, 275, 3522, 63, 1842, 14, 1080, 8, 826, 63, 2912, 1507, 9, 339, 347, 664, 63, 2184, 63, 2912, 8, 277, 304, 267, 340, 291, 14, 576, 63, 5000, 365, 488, 503, 822, 8, 277, 14, 2912, 63, 1842, 9, 690, 413, 26, 288, 291, 14, 576, 63, 5000, 275, 291, 14, 362, 63, 2912, 8, 277, 14, 9808, 63, 2912, 1507, 9, 267, 9463, 12, 3522, 1507, 275, 291, 14, 9808, 63, 7367, 12, 291, 14, 9808, 63, 2912, 1507, 267, 291, 14, 21195, 63, 2912, 342, 398, 372, 9463, 12, 3522, 1507, 12, 291, 14, 576, 63, 5000, 15567, 347, 664, 63, 2912, 8, 277, 12, 3522, 63, 1507, 304, 267, 6748, 275, 291, 14, 362, 63, 576, 63, 493, 63, 354, 8, 2912, 63, 1507, 9, 267, 340, 747, 14, 515, 14, 6027, 8, 5252, 304, 327, 3522, 315, 1007, 13, 14896, 288, 1007, 63, 14896, 275, 3355, 8, 736, 14, 7374, 8, 5252, 395, 790, 29, 10305, 290, 453, 63, 498, 9, 288, 327, 1361, 1007, 63, 14896, 288, 1967, 63, 954, 63, 14896, 275, 822, 8, 954, 63, 14896, 9, 288, 22387, 1086, 275, 3474, 61, 367, 284, 315, 4945, 8, 1507, 63, 954, 63, 14896, 1874, 288, 7183, 275, 359, 1451, 5455, 4436, 8, 736, 14, 515, 14, 904, 8, 5252, 12, 308, 395, 11967, 9, 367, 334, 83, 12, 11967, 9, 315, 3482, 8, 954, 63, 14896, 12, 22387, 1086, 1874, 288, 367, 2462, 315, 7183, 26, 355, 2462, 14, 928, 342, 288, 367, 2462, 315, 7183, 26, 355, 2462, 14, 904, 342, 7846, 372, 359, 84, 59, 16, 61, 367, 307, 315, 22387, 1086, 61, 267, 372, 625, 8092, 8, 277, 14, 362, 63, 576, 63, 493, 63, 354, 8, 2912, 63, 1507, 430, 2286, 347, 664, 63, 576, 63, 5380, 8, 277, 12, 2996, 29, 16, 304, 267, 372, 291, 14, 2912, 63, 2024, 459, 1507, 63, 5068, 418, 340, 4280, 508, 378, 587, 413, 2286, 347, 18695, 63, 2912, 8, 277, 304, 267, 291, 14, 2912, 63, 2996, 275, 291, 14, 362, 63, 2184, 63, 2912, 63, 2996, 342, 267, 291, 14, 9808, 63, 2912, 1507, 275, 291, 14, 2912, 63, 1842, 59, 277, 14, 2912, 63, 2996, 61, 267, 340, 291, 14, 2912, 63, 2996, 508, 378, 26, 327, 781, 8072, 288, 291, 14, 9808, 63, 7367, 847, 413, 15567, 347, 664, 63, 2184, 63, 2912, 63, 2996, 8, 277, 304, 267, 372, 334, 277, 14, 2912, 63, 2996, 435, 413, 9, 450, 822, 8, 277, 14, 2912, 63, 1842, 9, 2286, 347, 664, 63, 2184, 63, 2912, 63, 1507, 8, 277, 304, 267, 372, 291, 14, 2912, 63, 1842, 59, 277, 14, 362, 63, 2184, 63, 2912, 63, 2996, 5106, 2286, 327, 664, 1788, 402, 1453, 3522, 272, 347, 664, 63, 576, 63, 493, 63, 354, 8, 277, 12, 3522, 1507, 29, 403, 304, 267, 340, 3522, 1507, 365, 488, 26, 288, 3522, 1507, 275, 291, 14, 9808, 63, 2912, 1507, 267, 372, 747, 14, 515, 14, 904, 8, 277, 14, 576, 63, 694, 12, 283, 576, 63, 2912, 4970, 68, 7, 450, 3522, 1507, 9, 2286, 768, 3744, 272, 347, 664, 63, 842, 8, 1886, 12, 666, 63, 694, 12, 3522, 63, 1842, 29, 403, 12, 4205, 63, 7367, 29, 17, 12, 4205, 63, 2912, 1507, 29, 403, 12, 730, 628, 885, 401, 12392, 63, 1162, 10324, 511, 29, 797 ]
[ 1898, 6927, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 221, 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, 221, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 221, 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, 302, 199, 504, 2680, 14, 2355, 492, 10261, 78, 12, 10261, 12, 2196, 63, 23931, 199, 646, 747, 199, 504, 5796, 492, 11086, 199, 504, 4884, 492, 627, 199, 199, 20813, 63, 10614, 63, 3817, 275, 298, 14896, 14, 2024, 2, 199, 199, 533, 3918, 5455, 4436, 8, 4436, 304, 272, 347, 636, 826, 721, 277, 12, 931, 12, 11967, 304, 267, 11086, 855, 826, 721, 277, 9, 267, 291, 14, 515, 275, 931, 267, 291, 14, 15328, 275, 11967, 272, 347, 1255, 8, 277, 304, 267, 291, 14, 15328, 847, 359, 324, 8092, 8, 277, 14, 515, 1874, 268, 199, 533, 3918, 6663, 26, 272, 699, 8078, 63, 10710, 275, 295, 14, 2014, 9097, 576, 63, 2912, 2531, 60, 68, 27860, 3134, 68, 19544, 9988, 272, 347, 636, 826, 721, 277, 12, 666, 63, 694, 12, 3522, 63, 1842, 29, 403, 12, 4205, 63, 7367, 29, 17, 12, 4205, 63, 2912, 1507, 29, 403, 12, 12392, 63, 1162, 10324, 511, 29, 797, 304, 267, 340, 3522, 63, 1842, 508, 488, 26, 288, 3522, 63, 1842, 275, 3918, 6663, 14, 362, 63, 2912, 63, 16084, 8, 576, 63, 694, 9, 267, 340, 4205, 63, 2912, 1507, 365, 488, 503, 4205, 63, 2912, 1507, 440, 315, 3522, 63, 1842, 26, 288, 4205, 63, 2912, 1507, 275, 3522, 63, 1842, 59, 16, 61, 398, 291, 14, 576, 63, 694, 275, 666, 63, 694, 267, 291, 14, 2912, 63, 1842, 275, 3522, 63, 1842, 267, 291, 14, 9808, 63, 7367, 275, 4205, 63, 7367, 267, 291, 14, 9808, 63, 2912, 1507, 275, 4205, 63, 2912, 1507, 267, 291, 14, 5780, 63, 1162, 275, 12392, 63, 1162, 267, 291, 14, 2912, 63, 2024, 275, 291, 14, 362, 63, 2912, 63, 2024, 8, 576, 63, 694, 9, 267, 291, 14, 576, 63, 5000, 275, 488, 267, 291, 14, 396, 275, 511, 267, 291, 14, 2912, 63, 2996, 275, 3522, 63, 1842, 14, 1080, 8, 826, 63, 2912, 1507, 9, 339, 347, 664, 63, 2184, 63, 2912, 8, 277, 304, 267, 340, 291, 14, 576, 63, 5000, 365, 488, 503, 822, 8, 277, 14, 2912, 63, 1842, 9, 690, 413, 26, 288, 291, 14, 576, 63, 5000, 275, 291, 14, 362, 63, 2912, 8, 277, 14, 9808, 63, 2912, 1507, 9, 267, 9463, 12, 3522, 1507, 275, 291, 14, 9808, 63, 7367, 12, 291, 14, 9808, 63, 2912, 1507, 267, 291, 14, 21195, 63, 2912, 342, 398, 372, 9463, 12, 3522, 1507, 12, 291, 14, 576, 63, 5000, 15567, 347, 664, 63, 2912, 8, 277, 12, 3522, 63, 1507, 304, 267, 6748, 275, 291, 14, 362, 63, 576, 63, 493, 63, 354, 8, 2912, 63, 1507, 9, 267, 340, 747, 14, 515, 14, 6027, 8, 5252, 304, 327, 3522, 315, 1007, 13, 14896, 288, 1007, 63, 14896, 275, 3355, 8, 736, 14, 7374, 8, 5252, 395, 790, 29, 10305, 290, 453, 63, 498, 9, 288, 327, 1361, 1007, 63, 14896, 288, 1967, 63, 954, 63, 14896, 275, 822, 8, 954, 63, 14896, 9, 288, 22387, 1086, 275, 3474, 61, 367, 284, 315, 4945, 8, 1507, 63, 954, 63, 14896, 1874, 288, 7183, 275, 359, 1451, 5455, 4436, 8, 736, 14, 515, 14, 904, 8, 5252, 12, 308, 395, 11967, 9, 367, 334, 83, 12, 11967, 9, 315, 3482, 8, 954, 63, 14896, 12, 22387, 1086, 1874, 288, 367, 2462, 315, 7183, 26, 355, 2462, 14, 928, 342, 288, 367, 2462, 315, 7183, 26, 355, 2462, 14, 904, 342, 7846, 372, 359, 84, 59, 16, 61, 367, 307, 315, 22387, 1086, 61, 267, 372, 625, 8092, 8, 277, 14, 362, 63, 576, 63, 493, 63, 354, 8, 2912, 63, 1507, 430, 2286, 347, 664, 63, 576, 63, 5380, 8, 277, 12, 2996, 29, 16, 304, 267, 372, 291, 14, 2912, 63, 2024, 459, 1507, 63, 5068, 418, 340, 4280, 508, 378, 587, 413, 2286, 347, 18695, 63, 2912, 8, 277, 304, 267, 291, 14, 2912, 63, 2996, 275, 291, 14, 362, 63, 2184, 63, 2912, 63, 2996, 342, 267, 291, 14, 9808, 63, 2912, 1507, 275, 291, 14, 2912, 63, 1842, 59, 277, 14, 2912, 63, 2996, 61, 267, 340, 291, 14, 2912, 63, 2996, 508, 378, 26, 327, 781, 8072, 288, 291, 14, 9808, 63, 7367, 847, 413, 15567, 347, 664, 63, 2184, 63, 2912, 63, 2996, 8, 277, 304, 267, 372, 334, 277, 14, 2912, 63, 2996, 435, 413, 9, 450, 822, 8, 277, 14, 2912, 63, 1842, 9, 2286, 347, 664, 63, 2184, 63, 2912, 63, 1507, 8, 277, 304, 267, 372, 291, 14, 2912, 63, 1842, 59, 277, 14, 362, 63, 2184, 63, 2912, 63, 2996, 5106, 2286, 327, 664, 1788, 402, 1453, 3522, 272, 347, 664, 63, 576, 63, 493, 63, 354, 8, 277, 12, 3522, 1507, 29, 403, 304, 267, 340, 3522, 1507, 365, 488, 26, 288, 3522, 1507, 275, 291, 14, 9808, 63, 2912, 1507, 267, 372, 747, 14, 515, 14, 904, 8, 277, 14, 576, 63, 694, 12, 283, 576, 63, 2912, 4970, 68, 7, 450, 3522, 1507, 9, 2286, 768, 3744, 272, 347, 664, 63, 842, 8, 1886, 12, 666, 63, 694, 12, 3522, 63, 1842, 29, 403, 12, 4205, 63, 7367, 29, 17, 12, 4205, 63, 2912, 1507, 29, 403, 12, 730, 628, 885, 401, 12392, 63, 1162, 10324, 511, 29, 797, 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,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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 ]
Foxboron/Frank
app/jobs/__init__.py
1
1066
#!/usr/bin/env python from abc import ABCMeta, abstractmethod from pkgutil import iter_modules from os.path import dirname, basename # import_module wasn't added until 2.7 try: from importlib import import_module except ImportError: def import_module(name): __import__(name) class AbstractJob(object): __metaclass__ = ABCMeta @abstractmethod def get(self): pass @classmethod def load(cls): paths = [dirname(__file__)] prefix = '%s.' % (basename(paths[0]),) for _, name, is_pkg in iter_modules(paths, prefix): if not is_pkg: import_module(name) return AbstractJob.__subclasses__() def __str__(self): return '[name={}, interval={}, timeout={}, start_date={}]'.format( self.__class__.__name__.lower(), getattr(self, 'interval', None), getattr(self, 'timeout', None), getattr(self, 'start_date', None)) def load_jobs(): return dict([(cls.__name__.lower(), cls) for cls in AbstractJob.load()])
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 504, 13022, 492, 29565, 12, 9006, 765, 199, 504, 28728, 492, 2740, 63, 3112, 199, 504, 747, 14, 515, 492, 9017, 12, 9593, 199, 199, 3, 492, 63, 578, 17373, 1133, 3483, 5133, 499, 14, 23, 199, 893, 26, 272, 687, 14802, 492, 492, 63, 578, 199, 2590, 3545, 26, 272, 347, 492, 63, 578, 8, 354, 304, 267, 636, 646, 721, 354, 9, 421, 199, 533, 11836, 6694, 8, 785, 304, 272, 636, 6577, 363, 275, 29565, 339, 768, 10315, 272, 347, 664, 8, 277, 304, 267, 986, 339, 768, 3744, 272, 347, 2248, 8, 1886, 304, 267, 3792, 275, 359, 3475, 3460, 493, 363, 1874, 267, 2403, 275, 1543, 83, 3530, 450, 334, 4846, 8, 3771, 59, 16, 2522, 9, 267, 367, 5501, 536, 12, 365, 63, 4600, 315, 2740, 63, 3112, 8, 3771, 12, 2403, 304, 288, 340, 440, 365, 63, 4600, 26, 355, 492, 63, 578, 8, 354, 9, 267, 372, 11836, 6694, 855, 19094, 4533, 339, 347, 636, 495, 721, 277, 304, 267, 372, 6730, 354, 10324, 6252, 10324, 2653, 10324, 1343, 63, 602, 7622, 61, 1370, 908, 8, 288, 291, 855, 533, 4914, 354, 4343, 2325, 1062, 288, 2519, 8, 277, 12, 283, 4284, 297, 488, 395, 288, 2519, 8, 277, 12, 283, 2593, 297, 488, 395, 288, 2519, 8, 277, 12, 283, 928, 63, 602, 297, 488, 430, 421, 199, 318, 2248, 63, 6920, 837, 272, 372, 1211, 7694, 1886, 855, 354, 4343, 2325, 1062, 843, 9, 367, 843, 315, 11836, 6694, 14, 912, 9383, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 504, 13022, 492, 29565, 12, 9006, 765, 199, 504, 28728, 492, 2740, 63, 3112, 199, 504, 747, 14, 515, 492, 9017, 12, 9593, 199, 199, 3, 492, 63, 578, 17373, 1133, 3483, 5133, 499, 14, 23, 199, 893, 26, 272, 687, 14802, 492, 492, 63, 578, 199, 2590, 3545, 26, 272, 347, 492, 63, 578, 8, 354, 304, 267, 636, 646, 721, 354, 9, 421, 199, 533, 11836, 6694, 8, 785, 304, 272, 636, 6577, 363, 275, 29565, 339, 768, 10315, 272, 347, 664, 8, 277, 304, 267, 986, 339, 768, 3744, 272, 347, 2248, 8, 1886, 304, 267, 3792, 275, 359, 3475, 3460, 493, 363, 1874, 267, 2403, 275, 1543, 83, 3530, 450, 334, 4846, 8, 3771, 59, 16, 2522, 9, 267, 367, 5501, 536, 12, 365, 63, 4600, 315, 2740, 63, 3112, 8, 3771, 12, 2403, 304, 288, 340, 440, 365, 63, 4600, 26, 355, 492, 63, 578, 8, 354, 9, 267, 372, 11836, 6694, 855, 19094, 4533, 339, 347, 636, 495, 721, 277, 304, 267, 372, 6730, 354, 10324, 6252, 10324, 2653, 10324, 1343, 63, 602, 7622, 61, 1370, 908, 8, 288, 291, 855, 533, 4914, 354, 4343, 2325, 1062, 288, 2519, 8, 277, 12, 283, 4284, 297, 488, 395, 288, 2519, 8, 277, 12, 283, 2593, 297, 488, 395, 288, 2519, 8, 277, 12, 283, 928, 63, 602, 297, 488, 430, 421, 199, 318, 2248, 63, 6920, 837, 272, 372, 1211, 7694, 1886, 855, 354, 4343, 2325, 1062, 843, 9, 367, 843, 315, 11836, 6694, 14, 912, 9383, 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, 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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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 ]
GDGND/evm
allauth/socialaccount/providers/soundcloud/provider.py
75
1141
from allauth.socialaccount import providers from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class SoundCloudAccount(ProviderAccount): def get_profile_url(self): return self.account.extra_data.get('permalink_url') def get_avatar_url(self): return self.account.extra_data.get('avatar_url') def to_str(self): dflt = super(SoundCloudAccount, self).to_str() full_name = self.account.extra_data.get('full_name') username = self.account.extra_data.get('username') return full_name or username or dflt class SoundCloudProvider(OAuth2Provider): id = 'soundcloud' name = 'SoundCloud' package = 'allauth.socialaccount.providers.soundcloud' account_class = SoundCloudAccount def extract_uid(self, data): return str(data['id']) def extract_common_fields(self, data): return dict(name=data.get('full_name'), username=data.get('username'), email=data.get('email')) providers.registry.register(SoundCloudProvider)
mit
[ 504, 741, 416, 762, 14, 31932, 492, 18032, 199, 504, 741, 416, 762, 14, 31932, 14, 9710, 14, 1095, 492, 18489, 6009, 199, 504, 741, 416, 762, 14, 31932, 14, 9710, 14, 6126, 18, 14, 3780, 492, 11715, 18, 6663, 421, 199, 533, 428, 1034, 9089, 6009, 8, 6663, 6009, 304, 272, 347, 664, 63, 2913, 63, 633, 8, 277, 304, 267, 372, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 529, 2174, 2292, 63, 633, 358, 339, 347, 664, 63, 14584, 63, 633, 8, 277, 304, 267, 372, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 14584, 63, 633, 358, 339, 347, 370, 63, 495, 8, 277, 304, 267, 366, 26057, 275, 1613, 8, 18670, 9089, 6009, 12, 291, 680, 475, 63, 495, 342, 267, 2615, 63, 354, 275, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 2861, 63, 354, 358, 267, 3434, 275, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 2473, 358, 267, 372, 2615, 63, 354, 503, 3434, 503, 366, 26057, 421, 199, 533, 428, 1034, 9089, 6663, 8, 12906, 18, 6663, 304, 272, 1305, 275, 283, 14990, 4091, 7, 272, 536, 275, 283, 18670, 9089, 7, 272, 2559, 275, 283, 29339, 762, 14, 31932, 14, 9710, 14, 14990, 4091, 7, 272, 2933, 63, 533, 275, 428, 1034, 9089, 6009, 2378, 347, 5536, 63, 1535, 8, 277, 12, 666, 304, 267, 372, 620, 8, 576, 459, 344, 1105, 339, 347, 5536, 63, 2330, 63, 955, 8, 277, 12, 666, 304, 267, 372, 1211, 8, 354, 29, 576, 14, 362, 360, 2861, 63, 354, 659, 490, 3434, 29, 576, 14, 362, 360, 2473, 659, 490, 3031, 29, 576, 14, 362, 360, 2123, 1333, 421, 199, 9710, 14, 5189, 14, 2683, 8, 18670, 9089, 6663, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 741, 416, 762, 14, 31932, 492, 18032, 199, 504, 741, 416, 762, 14, 31932, 14, 9710, 14, 1095, 492, 18489, 6009, 199, 504, 741, 416, 762, 14, 31932, 14, 9710, 14, 6126, 18, 14, 3780, 492, 11715, 18, 6663, 421, 199, 533, 428, 1034, 9089, 6009, 8, 6663, 6009, 304, 272, 347, 664, 63, 2913, 63, 633, 8, 277, 304, 267, 372, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 529, 2174, 2292, 63, 633, 358, 339, 347, 664, 63, 14584, 63, 633, 8, 277, 304, 267, 372, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 14584, 63, 633, 358, 339, 347, 370, 63, 495, 8, 277, 304, 267, 366, 26057, 275, 1613, 8, 18670, 9089, 6009, 12, 291, 680, 475, 63, 495, 342, 267, 2615, 63, 354, 275, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 2861, 63, 354, 358, 267, 3434, 275, 291, 14, 2048, 14, 2911, 63, 576, 14, 362, 360, 2473, 358, 267, 372, 2615, 63, 354, 503, 3434, 503, 366, 26057, 421, 199, 533, 428, 1034, 9089, 6663, 8, 12906, 18, 6663, 304, 272, 1305, 275, 283, 14990, 4091, 7, 272, 536, 275, 283, 18670, 9089, 7, 272, 2559, 275, 283, 29339, 762, 14, 31932, 14, 9710, 14, 14990, 4091, 7, 272, 2933, 63, 533, 275, 428, 1034, 9089, 6009, 2378, 347, 5536, 63, 1535, 8, 277, 12, 666, 304, 267, 372, 620, 8, 576, 459, 344, 1105, 339, 347, 5536, 63, 2330, 63, 955, 8, 277, 12, 666, 304, 267, 372, 1211, 8, 354, 29, 576, 14, 362, 360, 2861, 63, 354, 659, 490, 3434, 29, 576, 14, 362, 360, 2473, 659, 490, 3031, 29, 576, 14, 362, 360, 2123, 1333, 421, 199, 9710, 14, 5189, 14, 2683, 8, 18670, 9089, 6663, 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, 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, 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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 ]
MartinDelzant/scikit-learn
benchmarks/bench_tree.py
297
3617
""" To run this, you'll need to have installed. * scikit-learn Does two benchmarks First, we fix a training set, increase the number of samples to classify and plot number of classified samples as a function of time. In the second benchmark, we increase the number of dimensions of the training set, classify a sample and plot the time taken as a function of the number of dimensions. """ import numpy as np import pylab as pl import gc from datetime import datetime # to store the results scikit_classifier_results = [] scikit_regressor_results = [] mu_second = 0.0 + 10 ** 6 # number of microseconds in a second def bench_scikit_tree_classifier(X, Y): """Benchmark with scikit-learn decision tree classifier""" from sklearn.tree import DecisionTreeClassifier gc.collect() # start time tstart = datetime.now() clf = DecisionTreeClassifier() clf.fit(X, Y).predict(X) delta = (datetime.now() - tstart) # stop time scikit_classifier_results.append( delta.seconds + delta.microseconds / mu_second) def bench_scikit_tree_regressor(X, Y): """Benchmark with scikit-learn decision tree regressor""" from sklearn.tree import DecisionTreeRegressor gc.collect() # start time tstart = datetime.now() clf = DecisionTreeRegressor() clf.fit(X, Y).predict(X) delta = (datetime.now() - tstart) # stop time scikit_regressor_results.append( delta.seconds + delta.microseconds / mu_second) if __name__ == '__main__': print('============================================') print('Warning: this is going to take a looong time') print('============================================') n = 10 step = 10000 n_samples = 10000 dim = 10 n_classes = 10 for i in range(n): print('============================================') print('Entering iteration %s of %s' % (i, n)) print('============================================') n_samples += step X = np.random.randn(n_samples, dim) Y = np.random.randint(0, n_classes, (n_samples,)) bench_scikit_tree_classifier(X, Y) Y = np.random.randn(n_samples) bench_scikit_tree_regressor(X, Y) xx = range(0, n * step, step) pl.figure('scikit-learn tree benchmark results') pl.subplot(211) pl.title('Learning with varying number of samples') pl.plot(xx, scikit_classifier_results, 'g-', label='classification') pl.plot(xx, scikit_regressor_results, 'r-', label='regression') pl.legend(loc='upper left') pl.xlabel('number of samples') pl.ylabel('Time (s)') scikit_classifier_results = [] scikit_regressor_results = [] n = 10 step = 500 start_dim = 500 n_classes = 10 dim = start_dim for i in range(0, n): print('============================================') print('Entering iteration %s of %s' % (i, n)) print('============================================') dim += step X = np.random.randn(100, dim) Y = np.random.randint(0, n_classes, (100,)) bench_scikit_tree_classifier(X, Y) Y = np.random.randn(100) bench_scikit_tree_regressor(X, Y) xx = np.arange(start_dim, start_dim + n * step, step) pl.subplot(212) pl.title('Learning in high dimensional spaces') pl.plot(xx, scikit_classifier_results, 'g-', label='classification') pl.plot(xx, scikit_regressor_results, 'r-', label='regression') pl.legend(loc='upper left') pl.xlabel('number of dimensions') pl.ylabel('Time (s)') pl.axis('tight') pl.show()
bsd-3-clause
[ 624, 199, 1378, 1255, 642, 12, 1265, 7171, 1929, 370, 1172, 4903, 14, 819, 627, 6276, 6065, 13, 4643, 199, 199, 6586, 2877, 12338, 83, 199, 199, 7147, 12, 781, 5325, 282, 6093, 663, 12, 19781, 314, 1329, 402, 199, 3356, 370, 28837, 436, 5137, 1329, 402, 11534, 1290, 5845, 465, 282, 199, 1593, 402, 900, 14, 199, 199, 607, 314, 3499, 12338, 12, 781, 19781, 314, 1329, 402, 7365, 402, 314, 199, 7588, 663, 12, 28837, 282, 2690, 436, 5137, 314, 900, 9394, 465, 282, 805, 199, 1618, 314, 1329, 402, 7365, 14, 199, 624, 199, 646, 2680, 465, 980, 199, 646, 19199, 465, 1620, 199, 646, 9486, 199, 504, 2197, 492, 2197, 199, 199, 3, 370, 3877, 314, 2058, 199, 551, 3258, 390, 63, 14720, 63, 2604, 275, 942, 199, 551, 3258, 390, 63, 1135, 11686, 63, 2604, 275, 942, 199, 199, 6553, 63, 4375, 275, 378, 14, 16, 435, 1616, 1011, 1227, 221, 327, 1329, 402, 21574, 315, 282, 3499, 421, 199, 318, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 304, 272, 408, 18644, 543, 6276, 6065, 13, 4643, 14692, 3123, 12429, 624, 339, 687, 6357, 14, 2350, 492, 1487, 24116, 8508, 339, 9486, 14, 7112, 342, 339, 327, 1343, 900, 272, 29921, 275, 2197, 14, 2131, 342, 272, 6975, 275, 1487, 24116, 8508, 342, 272, 6975, 14, 3269, 8, 56, 12, 1488, 680, 6892, 8, 56, 9, 272, 5762, 275, 334, 2083, 14, 2131, 342, 446, 29921, 9, 272, 327, 3631, 900, 339, 6276, 6065, 63, 14720, 63, 2604, 14, 740, 8, 267, 5762, 14, 4515, 435, 5762, 14, 18144, 1182, 8504, 63, 4375, 9, 421, 199, 318, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 304, 272, 408, 18644, 543, 6276, 6065, 13, 4643, 14692, 3123, 1295, 11686, 624, 339, 687, 6357, 14, 2350, 492, 1487, 24116, 15155, 339, 9486, 14, 7112, 342, 339, 327, 1343, 900, 272, 29921, 275, 2197, 14, 2131, 342, 272, 6975, 275, 1487, 24116, 15155, 342, 272, 6975, 14, 3269, 8, 56, 12, 1488, 680, 6892, 8, 56, 9, 272, 5762, 275, 334, 2083, 14, 2131, 342, 446, 29921, 9, 272, 327, 3631, 900, 339, 6276, 6065, 63, 1135, 11686, 63, 2604, 14, 740, 8, 267, 5762, 14, 4515, 435, 5762, 14, 18144, 1182, 8504, 63, 4375, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 339, 870, 360, 2486, 5769, 358, 272, 870, 360, 3849, 26, 642, 365, 9995, 370, 5452, 282, 560, 79, 951, 900, 358, 272, 870, 360, 2486, 5769, 358, 339, 302, 275, 1616, 272, 3650, 275, 11630, 272, 302, 63, 3356, 275, 11630, 272, 8134, 275, 1616, 272, 302, 63, 2888, 275, 1616, 272, 367, 284, 315, 1425, 8, 78, 304, 267, 870, 360, 2486, 5769, 358, 267, 870, 360, 8468, 316, 8494, 450, 83, 402, 450, 83, 7, 450, 334, 73, 12, 302, 430, 267, 870, 360, 2486, 5769, 358, 267, 302, 63, 3356, 847, 3650, 267, 1323, 275, 980, 14, 2355, 14, 10843, 8, 78, 63, 3356, 12, 8134, 9, 267, 1488, 275, 980, 14, 2355, 14, 8393, 8, 16, 12, 302, 63, 2888, 12, 334, 78, 63, 3356, 4641, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 9, 267, 1488, 275, 980, 14, 2355, 14, 10843, 8, 78, 63, 3356, 9, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 9, 339, 19379, 275, 1425, 8, 16, 12, 302, 627, 3650, 12, 3650, 9, 272, 1620, 14, 8941, 360, 551, 3258, 390, 13, 4643, 3123, 12338, 2058, 358, 272, 1620, 14, 13334, 8, 12832, 9, 272, 1620, 14, 1213, 360, 25519, 543, 17083, 316, 1329, 402, 5845, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 14720, 63, 2604, 12, 283, 71, 14382, 1768, 534, 14368, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 1135, 11686, 63, 2604, 12, 283, 82, 14382, 1768, 534, 12513, 358, 272, 1620, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 1620, 14, 14168, 360, 1955, 402, 5845, 358, 272, 1620, 14, 13849, 360, 1366, 334, 83, 5942, 339, 6276, 6065, 63, 14720, 63, 2604, 275, 942, 272, 6276, 6065, 63, 1135, 11686, 63, 2604, 275, 942, 272, 302, 275, 1616, 272, 3650, 275, 6891, 272, 1343, 63, 3572, 275, 6891, 272, 302, 63, 2888, 275, 1616, 339, 8134, 275, 1343, 63, 3572, 272, 367, 284, 315, 1425, 8, 16, 12, 302, 304, 267, 870, 360, 2486, 5769, 358, 267, 870, 360, 8468, 316, 8494, 450, 83, 402, 450, 83, 7, 450, 334, 73, 12, 302, 430, 267, 870, 360, 2486, 5769, 358, 267, 8134, 847, 3650, 267, 1323, 275, 980, 14, 2355, 14, 10843, 8, 1960, 12, 8134, 9, 267, 1488, 275, 980, 14, 2355, 14, 8393, 8, 16, 12, 302, 63, 2888, 12, 334, 1960, 4641, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 9, 267, 1488, 275, 980, 14, 2355, 14, 10843, 8, 1960, 9, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 9, 339, 19379, 275, 980, 14, 5605, 8, 928, 63, 3572, 12, 1343, 63, 3572, 435, 302, 627, 3650, 12, 3650, 9, 272, 1620, 14, 13334, 8, 11722, 9, 272, 1620, 14, 1213, 360, 25519, 315, 4721, 28341, 7883, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 14720, 63, 2604, 12, 283, 71, 14382, 1768, 534, 14368, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 1135, 11686, 63, 2604, 12, 283, 82, 14382, 1768, 534, 12513, 358, 272, 1620, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 1620, 14, 14168, 360, 1955, 402, 7365, 358, 272, 1620, 14, 13849, 360, 1366, 334, 83, 5942, 272, 1620, 14, 3127, 360, 23787, 358, 272, 1620, 14, 2384, 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 ]
[ 199, 1378, 1255, 642, 12, 1265, 7171, 1929, 370, 1172, 4903, 14, 819, 627, 6276, 6065, 13, 4643, 199, 199, 6586, 2877, 12338, 83, 199, 199, 7147, 12, 781, 5325, 282, 6093, 663, 12, 19781, 314, 1329, 402, 199, 3356, 370, 28837, 436, 5137, 1329, 402, 11534, 1290, 5845, 465, 282, 199, 1593, 402, 900, 14, 199, 199, 607, 314, 3499, 12338, 12, 781, 19781, 314, 1329, 402, 7365, 402, 314, 199, 7588, 663, 12, 28837, 282, 2690, 436, 5137, 314, 900, 9394, 465, 282, 805, 199, 1618, 314, 1329, 402, 7365, 14, 199, 624, 199, 646, 2680, 465, 980, 199, 646, 19199, 465, 1620, 199, 646, 9486, 199, 504, 2197, 492, 2197, 199, 199, 3, 370, 3877, 314, 2058, 199, 551, 3258, 390, 63, 14720, 63, 2604, 275, 942, 199, 551, 3258, 390, 63, 1135, 11686, 63, 2604, 275, 942, 199, 199, 6553, 63, 4375, 275, 378, 14, 16, 435, 1616, 1011, 1227, 221, 327, 1329, 402, 21574, 315, 282, 3499, 421, 199, 318, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 304, 272, 408, 18644, 543, 6276, 6065, 13, 4643, 14692, 3123, 12429, 624, 339, 687, 6357, 14, 2350, 492, 1487, 24116, 8508, 339, 9486, 14, 7112, 342, 339, 327, 1343, 900, 272, 29921, 275, 2197, 14, 2131, 342, 272, 6975, 275, 1487, 24116, 8508, 342, 272, 6975, 14, 3269, 8, 56, 12, 1488, 680, 6892, 8, 56, 9, 272, 5762, 275, 334, 2083, 14, 2131, 342, 446, 29921, 9, 272, 327, 3631, 900, 339, 6276, 6065, 63, 14720, 63, 2604, 14, 740, 8, 267, 5762, 14, 4515, 435, 5762, 14, 18144, 1182, 8504, 63, 4375, 9, 421, 199, 318, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 304, 272, 408, 18644, 543, 6276, 6065, 13, 4643, 14692, 3123, 1295, 11686, 624, 339, 687, 6357, 14, 2350, 492, 1487, 24116, 15155, 339, 9486, 14, 7112, 342, 339, 327, 1343, 900, 272, 29921, 275, 2197, 14, 2131, 342, 272, 6975, 275, 1487, 24116, 15155, 342, 272, 6975, 14, 3269, 8, 56, 12, 1488, 680, 6892, 8, 56, 9, 272, 5762, 275, 334, 2083, 14, 2131, 342, 446, 29921, 9, 272, 327, 3631, 900, 339, 6276, 6065, 63, 1135, 11686, 63, 2604, 14, 740, 8, 267, 5762, 14, 4515, 435, 5762, 14, 18144, 1182, 8504, 63, 4375, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 339, 870, 360, 2486, 5769, 358, 272, 870, 360, 3849, 26, 642, 365, 9995, 370, 5452, 282, 560, 79, 951, 900, 358, 272, 870, 360, 2486, 5769, 358, 339, 302, 275, 1616, 272, 3650, 275, 11630, 272, 302, 63, 3356, 275, 11630, 272, 8134, 275, 1616, 272, 302, 63, 2888, 275, 1616, 272, 367, 284, 315, 1425, 8, 78, 304, 267, 870, 360, 2486, 5769, 358, 267, 870, 360, 8468, 316, 8494, 450, 83, 402, 450, 83, 7, 450, 334, 73, 12, 302, 430, 267, 870, 360, 2486, 5769, 358, 267, 302, 63, 3356, 847, 3650, 267, 1323, 275, 980, 14, 2355, 14, 10843, 8, 78, 63, 3356, 12, 8134, 9, 267, 1488, 275, 980, 14, 2355, 14, 8393, 8, 16, 12, 302, 63, 2888, 12, 334, 78, 63, 3356, 4641, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 9, 267, 1488, 275, 980, 14, 2355, 14, 10843, 8, 78, 63, 3356, 9, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 9, 339, 19379, 275, 1425, 8, 16, 12, 302, 627, 3650, 12, 3650, 9, 272, 1620, 14, 8941, 360, 551, 3258, 390, 13, 4643, 3123, 12338, 2058, 358, 272, 1620, 14, 13334, 8, 12832, 9, 272, 1620, 14, 1213, 360, 25519, 543, 17083, 316, 1329, 402, 5845, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 14720, 63, 2604, 12, 283, 71, 14382, 1768, 534, 14368, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 1135, 11686, 63, 2604, 12, 283, 82, 14382, 1768, 534, 12513, 358, 272, 1620, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 1620, 14, 14168, 360, 1955, 402, 5845, 358, 272, 1620, 14, 13849, 360, 1366, 334, 83, 5942, 339, 6276, 6065, 63, 14720, 63, 2604, 275, 942, 272, 6276, 6065, 63, 1135, 11686, 63, 2604, 275, 942, 272, 302, 275, 1616, 272, 3650, 275, 6891, 272, 1343, 63, 3572, 275, 6891, 272, 302, 63, 2888, 275, 1616, 339, 8134, 275, 1343, 63, 3572, 272, 367, 284, 315, 1425, 8, 16, 12, 302, 304, 267, 870, 360, 2486, 5769, 358, 267, 870, 360, 8468, 316, 8494, 450, 83, 402, 450, 83, 7, 450, 334, 73, 12, 302, 430, 267, 870, 360, 2486, 5769, 358, 267, 8134, 847, 3650, 267, 1323, 275, 980, 14, 2355, 14, 10843, 8, 1960, 12, 8134, 9, 267, 1488, 275, 980, 14, 2355, 14, 8393, 8, 16, 12, 302, 63, 2888, 12, 334, 1960, 4641, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 14720, 8, 56, 12, 1488, 9, 267, 1488, 275, 980, 14, 2355, 14, 10843, 8, 1960, 9, 267, 26456, 63, 551, 3258, 390, 63, 2350, 63, 1135, 11686, 8, 56, 12, 1488, 9, 339, 19379, 275, 980, 14, 5605, 8, 928, 63, 3572, 12, 1343, 63, 3572, 435, 302, 627, 3650, 12, 3650, 9, 272, 1620, 14, 13334, 8, 11722, 9, 272, 1620, 14, 1213, 360, 25519, 315, 4721, 28341, 7883, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 14720, 63, 2604, 12, 283, 71, 14382, 1768, 534, 14368, 358, 272, 1620, 14, 2798, 8, 2154, 12, 6276, 6065, 63, 1135, 11686, 63, 2604, 12, 283, 82, 14382, 1768, 534, 12513, 358, 272, 1620, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 1620, 14, 14168, 360, 1955, 402, 7365, 358, 272, 1620, 14, 13849, 360, 1366, 334, 83, 5942, 272, 1620, 14, 3127, 360, 23787, 358, 272, 1620, 14, 2384, 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, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
josuebrunel/myemacs
python-libs/rope/contrib/changestack.py
115
1392
"""For performing many refactorings as a single command `changestack` module can be used to perform many refactorings on top of each other as one bigger command. It can be used like:: stack = ChangeStack(project, 'my big command') #.. stack.push(refactoring1.get_changes()) #.. stack.push(refactoring2.get_changes()) #.. stack.push(refactoringX.get_changes()) stack.pop_all() changes = stack.merged() Now `changes` can be previewed or performed as before. """ from rope.base import change class ChangeStack(object): def __init__(self, project, description='merged changes'): self.project = project self.description = description self.stack = [] def push(self, changes): self.stack.append(changes) self.project.do(changes) def pop_all(self): for i in range(len(self.stack)): self.project.history.undo(drop=True) def merged(self): result = change.ChangeSet(self.description) for changes in self.stack: for c in self._basic_changes(changes): result.add_change(c) return result def _basic_changes(self, changes): if isinstance(changes, change.ChangeSet): for child in changes.changes: for atom in self._basic_changes(child): yield atom else: yield changes
gpl-3.0
[ 624, 1858, 19203, 5002, 24200, 780, 465, 282, 2849, 1414, 199, 199, 64, 1461, 2340, 64, 859, 883, 506, 1202, 370, 5147, 5002, 24200, 780, 641, 2746, 199, 1618, 1924, 1163, 465, 1373, 29416, 1414, 14, 221, 2779, 883, 506, 1202, 2839, 447, 819, 3464, 275, 7743, 4851, 8, 1715, 12, 283, 1662, 7282, 1414, 358, 819, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 17, 14, 362, 63, 6627, 1012, 523, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 18, 14, 362, 63, 6627, 1012, 523, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 56, 14, 362, 63, 6627, 1012, 819, 3464, 14, 1935, 63, 452, 342, 523, 4493, 275, 3464, 14, 15269, 342, 199, 199, 14351, 658, 6627, 64, 883, 506, 19653, 379, 503, 10585, 465, 2544, 14, 199, 624, 199, 199, 504, 882, 321, 14, 1095, 492, 1570, 421, 199, 533, 7743, 4851, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 2199, 12, 1369, 534, 15269, 4493, 735, 267, 291, 14, 1715, 275, 2199, 267, 291, 14, 1802, 275, 1369, 267, 291, 14, 2340, 275, 942, 339, 347, 6675, 8, 277, 12, 4493, 304, 267, 291, 14, 2340, 14, 740, 8, 6627, 9, 267, 291, 14, 1715, 14, 1117, 8, 6627, 9, 339, 347, 4560, 63, 452, 8, 277, 304, 267, 367, 284, 315, 1425, 8, 552, 8, 277, 14, 2340, 2298, 288, 291, 14, 1715, 14, 5570, 14, 11833, 8, 4824, 29, 549, 9, 339, 347, 9545, 8, 277, 304, 267, 754, 275, 1570, 14, 4001, 1084, 8, 277, 14, 1802, 9, 267, 367, 4493, 315, 291, 14, 2340, 26, 288, 367, 286, 315, 291, 423, 4316, 63, 6627, 8, 6627, 304, 355, 754, 14, 525, 63, 1461, 8, 67, 9, 267, 372, 754, 339, 347, 485, 4316, 63, 6627, 8, 277, 12, 4493, 304, 267, 340, 1228, 8, 6627, 12, 1570, 14, 4001, 1084, 304, 288, 367, 1982, 315, 4493, 14, 6627, 26, 355, 367, 6222, 315, 291, 423, 4316, 63, 6627, 8, 1739, 304, 490, 1995, 6222, 267, 587, 26, 288, 1995, 4493, 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 ]
[ 1858, 19203, 5002, 24200, 780, 465, 282, 2849, 1414, 199, 199, 64, 1461, 2340, 64, 859, 883, 506, 1202, 370, 5147, 5002, 24200, 780, 641, 2746, 199, 1618, 1924, 1163, 465, 1373, 29416, 1414, 14, 221, 2779, 883, 506, 1202, 2839, 447, 819, 3464, 275, 7743, 4851, 8, 1715, 12, 283, 1662, 7282, 1414, 358, 819, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 17, 14, 362, 63, 6627, 1012, 523, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 18, 14, 362, 63, 6627, 1012, 523, 327, 703, 523, 3464, 14, 5335, 8, 264, 4778, 316, 56, 14, 362, 63, 6627, 1012, 819, 3464, 14, 1935, 63, 452, 342, 523, 4493, 275, 3464, 14, 15269, 342, 199, 199, 14351, 658, 6627, 64, 883, 506, 19653, 379, 503, 10585, 465, 2544, 14, 199, 624, 199, 199, 504, 882, 321, 14, 1095, 492, 1570, 421, 199, 533, 7743, 4851, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 2199, 12, 1369, 534, 15269, 4493, 735, 267, 291, 14, 1715, 275, 2199, 267, 291, 14, 1802, 275, 1369, 267, 291, 14, 2340, 275, 942, 339, 347, 6675, 8, 277, 12, 4493, 304, 267, 291, 14, 2340, 14, 740, 8, 6627, 9, 267, 291, 14, 1715, 14, 1117, 8, 6627, 9, 339, 347, 4560, 63, 452, 8, 277, 304, 267, 367, 284, 315, 1425, 8, 552, 8, 277, 14, 2340, 2298, 288, 291, 14, 1715, 14, 5570, 14, 11833, 8, 4824, 29, 549, 9, 339, 347, 9545, 8, 277, 304, 267, 754, 275, 1570, 14, 4001, 1084, 8, 277, 14, 1802, 9, 267, 367, 4493, 315, 291, 14, 2340, 26, 288, 367, 286, 315, 291, 423, 4316, 63, 6627, 8, 6627, 304, 355, 754, 14, 525, 63, 1461, 8, 67, 9, 267, 372, 754, 339, 347, 485, 4316, 63, 6627, 8, 277, 12, 4493, 304, 267, 340, 1228, 8, 6627, 12, 1570, 14, 4001, 1084, 304, 288, 367, 1982, 315, 4493, 14, 6627, 26, 355, 367, 6222, 315, 291, 423, 4316, 63, 6627, 8, 1739, 304, 490, 1995, 6222, 267, 587, 26, 288, 1995, 4493, 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, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
shubhdev/openedx
lms/djangoapps/student_profile/test/test_views.py
34
3367
# -*- coding: utf-8 -*- """ Tests for student profile views. """ from django.conf import settings from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import RequestFactory from util.testing import UrlResetMixin from student.tests.factories import UserFactory from student_profile.views import learner_profile_context class LearnerProfileViewTest(UrlResetMixin, TestCase): """ Tests for the student profile view. """ USERNAME = "username" PASSWORD = "password" CONTEXT_DATA = [ 'default_public_account_fields', 'accounts_api_url', 'preferences_api_url', 'account_settings_page_url', 'has_preferences_access', 'own_profile', 'country_options', 'language_options', 'account_settings_data', 'preferences_data', ] def setUp(self): super(LearnerProfileViewTest, self).setUp() self.user = UserFactory.create(username=self.USERNAME, password=self.PASSWORD) self.client.login(username=self.USERNAME, password=self.PASSWORD) def test_context(self): """ Verify learner profile page context data. """ request = RequestFactory().get('/url') context = learner_profile_context(self.user, self.USERNAME, self.user.is_staff, request.build_absolute_uri) self.assertEqual( context['data']['default_public_account_fields'], settings.ACCOUNT_VISIBILITY_CONFIGURATION['public_fields'] ) self.assertEqual( context['data']['accounts_api_url'], reverse("accounts_api", kwargs={'username': self.user.username}) ) self.assertEqual( context['data']['preferences_api_url'], reverse('preferences_api', kwargs={'username': self.user.username}) ) self.assertEqual( context['data']['profile_image_upload_url'], reverse("profile_image_upload", kwargs={'username': self.user.username}) ) self.assertEqual( context['data']['profile_image_remove_url'], reverse('profile_image_remove', kwargs={'username': self.user.username}) ) self.assertEqual( context['data']['profile_image_max_bytes'], settings.PROFILE_IMAGE_MAX_BYTES ) self.assertEqual( context['data']['profile_image_min_bytes'], settings.PROFILE_IMAGE_MIN_BYTES ) self.assertEqual(context['data']['account_settings_page_url'], reverse('account_settings')) for attribute in self.CONTEXT_DATA: self.assertIn(attribute, context['data']) def test_view(self): """ Verify learner profile page view. """ profile_path = reverse('learner_profile', kwargs={'username': self.USERNAME}) response = self.client.get(path=profile_path) for attribute in self.CONTEXT_DATA: self.assertIn(attribute, response.content) def test_undefined_profile_page(self): """ Verify that a 404 is returned for a non-existent profile page. """ profile_path = reverse('learner_profile', kwargs={'username': "no_such_user"}) response = self.client.get(path=profile_path) self.assertEqual(404, response.status_code)
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 6496, 367, 6474, 4690, 6858, 14, 408, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 199, 504, 4884, 14, 4776, 492, 20503, 9637, 4256, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 199, 504, 6474, 63, 2913, 14, 4196, 492, 22876, 63, 2913, 63, 1100, 421, 199, 533, 7005, 1060, 281, 5736, 2768, 774, 8, 6417, 9637, 4256, 12, 7640, 304, 272, 408, 6496, 367, 314, 6474, 4690, 2455, 14, 408, 339, 13044, 2339, 275, 298, 2473, 2, 272, 21705, 5172, 275, 298, 2060, 2, 272, 1868, 3876, 63, 3998, 275, 359, 267, 283, 885, 63, 3455, 63, 2048, 63, 955, 297, 267, 283, 8370, 63, 1246, 63, 633, 297, 267, 283, 18063, 63, 1246, 63, 633, 297, 267, 283, 2048, 63, 1751, 63, 1606, 63, 633, 297, 267, 283, 1989, 63, 18063, 63, 2732, 297, 267, 283, 944, 63, 2913, 297, 267, 283, 6063, 63, 1419, 297, 267, 283, 3671, 63, 1419, 297, 267, 283, 2048, 63, 1751, 63, 576, 297, 267, 283, 18063, 63, 576, 297, 272, 1622, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 21424, 281, 5736, 2768, 774, 12, 291, 680, 5996, 342, 267, 291, 14, 751, 275, 16047, 14, 981, 8, 2473, 29, 277, 14, 11958, 12, 2505, 29, 277, 14, 9032, 9, 267, 291, 14, 1258, 14, 2886, 8, 2473, 29, 277, 14, 11958, 12, 2505, 29, 277, 14, 9032, 9, 339, 347, 511, 63, 1100, 8, 277, 304, 267, 408, 267, 7635, 22876, 4690, 2034, 1067, 666, 14, 267, 408, 267, 1056, 275, 18638, 1252, 362, 2336, 633, 358, 398, 1067, 275, 22876, 63, 2913, 63, 1100, 8, 277, 14, 751, 12, 291, 14, 11958, 12, 291, 14, 751, 14, 374, 63, 7018, 12, 1056, 14, 1506, 63, 6116, 63, 2302, 9, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 885, 63, 3455, 63, 2048, 63, 955, 995, 288, 2202, 14, 18928, 63, 11793, 9002, 63, 22212, 459, 3455, 63, 955, 418, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 8370, 63, 1246, 63, 633, 995, 288, 3837, 480, 8370, 63, 1246, 401, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 18063, 63, 1246, 63, 633, 995, 288, 3837, 360, 18063, 63, 1246, 297, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 5064, 63, 633, 995, 288, 3837, 480, 2913, 63, 1569, 63, 5064, 401, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 2168, 63, 633, 995, 288, 3837, 360, 2913, 63, 1569, 63, 2168, 297, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 988, 63, 2394, 995, 288, 2202, 14, 16632, 63, 9438, 63, 4283, 63, 20352, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 827, 63, 2394, 995, 288, 2202, 14, 16632, 63, 9438, 63, 4896, 63, 20352, 267, 776, 398, 291, 14, 629, 8, 1100, 459, 576, 2545, 2048, 63, 1751, 63, 1606, 63, 633, 995, 3837, 360, 2048, 63, 1751, 1333, 398, 367, 2225, 315, 291, 14, 9059, 63, 3998, 26, 288, 291, 14, 4080, 8, 3215, 12, 1067, 459, 576, 1105, 339, 347, 511, 63, 1345, 8, 277, 304, 267, 408, 267, 7635, 22876, 4690, 2034, 2455, 14, 267, 408, 267, 4690, 63, 515, 275, 3837, 360, 29144, 63, 2913, 297, 2074, 3713, 2473, 356, 291, 14, 11958, 1552, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 515, 29, 2913, 63, 515, 9, 398, 367, 2225, 315, 291, 14, 9059, 63, 3998, 26, 288, 291, 14, 4080, 8, 3215, 12, 1177, 14, 1317, 9, 339, 347, 511, 63, 10705, 63, 2913, 63, 1606, 8, 277, 304, 267, 408, 267, 7635, 626, 282, 7901, 365, 2138, 367, 282, 2222, 13, 15025, 4690, 2034, 14, 267, 408, 267, 4690, 63, 515, 275, 3837, 360, 29144, 63, 2913, 297, 2074, 3713, 2473, 356, 298, 889, 63, 10180, 63, 751, 5984, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 515, 29, 2913, 63, 515, 9, 267, 291, 14, 629, 8, 5188, 12, 1177, 14, 1205, 63, 600, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 6496, 367, 6474, 4690, 6858, 14, 408, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 396, 14, 1258, 492, 18638, 199, 199, 504, 4884, 14, 4776, 492, 20503, 9637, 4256, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 199, 504, 6474, 63, 2913, 14, 4196, 492, 22876, 63, 2913, 63, 1100, 421, 199, 533, 7005, 1060, 281, 5736, 2768, 774, 8, 6417, 9637, 4256, 12, 7640, 304, 272, 408, 6496, 367, 314, 6474, 4690, 2455, 14, 408, 339, 13044, 2339, 275, 298, 2473, 2, 272, 21705, 5172, 275, 298, 2060, 2, 272, 1868, 3876, 63, 3998, 275, 359, 267, 283, 885, 63, 3455, 63, 2048, 63, 955, 297, 267, 283, 8370, 63, 1246, 63, 633, 297, 267, 283, 18063, 63, 1246, 63, 633, 297, 267, 283, 2048, 63, 1751, 63, 1606, 63, 633, 297, 267, 283, 1989, 63, 18063, 63, 2732, 297, 267, 283, 944, 63, 2913, 297, 267, 283, 6063, 63, 1419, 297, 267, 283, 3671, 63, 1419, 297, 267, 283, 2048, 63, 1751, 63, 576, 297, 267, 283, 18063, 63, 576, 297, 272, 1622, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 21424, 281, 5736, 2768, 774, 12, 291, 680, 5996, 342, 267, 291, 14, 751, 275, 16047, 14, 981, 8, 2473, 29, 277, 14, 11958, 12, 2505, 29, 277, 14, 9032, 9, 267, 291, 14, 1258, 14, 2886, 8, 2473, 29, 277, 14, 11958, 12, 2505, 29, 277, 14, 9032, 9, 339, 347, 511, 63, 1100, 8, 277, 304, 267, 408, 267, 7635, 22876, 4690, 2034, 1067, 666, 14, 267, 408, 267, 1056, 275, 18638, 1252, 362, 2336, 633, 358, 398, 1067, 275, 22876, 63, 2913, 63, 1100, 8, 277, 14, 751, 12, 291, 14, 11958, 12, 291, 14, 751, 14, 374, 63, 7018, 12, 1056, 14, 1506, 63, 6116, 63, 2302, 9, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 885, 63, 3455, 63, 2048, 63, 955, 995, 288, 2202, 14, 18928, 63, 11793, 9002, 63, 22212, 459, 3455, 63, 955, 418, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 8370, 63, 1246, 63, 633, 995, 288, 3837, 480, 8370, 63, 1246, 401, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 18063, 63, 1246, 63, 633, 995, 288, 3837, 360, 18063, 63, 1246, 297, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 5064, 63, 633, 995, 288, 3837, 480, 2913, 63, 1569, 63, 5064, 401, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 2168, 63, 633, 995, 288, 3837, 360, 2913, 63, 1569, 63, 2168, 297, 2074, 3713, 2473, 356, 291, 14, 751, 14, 2473, 1552, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 988, 63, 2394, 995, 288, 2202, 14, 16632, 63, 9438, 63, 4283, 63, 20352, 267, 776, 398, 291, 14, 629, 8, 288, 1067, 459, 576, 2545, 2913, 63, 1569, 63, 827, 63, 2394, 995, 288, 2202, 14, 16632, 63, 9438, 63, 4896, 63, 20352, 267, 776, 398, 291, 14, 629, 8, 1100, 459, 576, 2545, 2048, 63, 1751, 63, 1606, 63, 633, 995, 3837, 360, 2048, 63, 1751, 1333, 398, 367, 2225, 315, 291, 14, 9059, 63, 3998, 26, 288, 291, 14, 4080, 8, 3215, 12, 1067, 459, 576, 1105, 339, 347, 511, 63, 1345, 8, 277, 304, 267, 408, 267, 7635, 22876, 4690, 2034, 2455, 14, 267, 408, 267, 4690, 63, 515, 275, 3837, 360, 29144, 63, 2913, 297, 2074, 3713, 2473, 356, 291, 14, 11958, 1552, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 515, 29, 2913, 63, 515, 9, 398, 367, 2225, 315, 291, 14, 9059, 63, 3998, 26, 288, 291, 14, 4080, 8, 3215, 12, 1177, 14, 1317, 9, 339, 347, 511, 63, 10705, 63, 2913, 63, 1606, 8, 277, 304, 267, 408, 267, 7635, 626, 282, 7901, 365, 2138, 367, 282, 2222, 13, 15025, 4690, 2034, 14, 267, 408, 267, 4690, 63, 515, 275, 3837, 360, 29144, 63, 2913, 297, 2074, 3713, 2473, 356, 298, 889, 63, 10180, 63, 751, 5984, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 515, 29, 2913, 63, 515, 9, 267, 291, 14, 629, 8, 5188, 12, 1177, 14, 1205, 63, 600, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
p4datasystems/CarnotKEdist
dist/Lib/test/test_grammar.py
72
32702
# Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. from test.test_support import run_unittest, check_syntax_error, \ check_py3k_warnings import unittest import sys # testing import * from sys import * class TokenTests(unittest.TestCase): def testBackslash(self): # Backslash means line continuation: x = 1 \ + 1 self.assertEqual(x, 2, 'backslash for line continuation') # Backslash does not means continuation in comments :\ x = 0 self.assertEqual(x, 0, 'backslash ending comment') def testPlainIntegers(self): self.assertEqual(0xff, 255) self.assertEqual(0377, 255) self.assertEqual(2147483647, 017777777777) # "0x" is not a valid literal self.assertRaises(SyntaxError, eval, "0x") from sys import maxint if maxint == 2147483647: self.assertEqual(-2147483647-1, -020000000000) # XXX -2147483648 self.assertTrue(037777777777 > 0) self.assertTrue(0xffffffff > 0) for s in '2147483648', '040000000000', '0x100000000': try: x = eval(s) except OverflowError: self.fail("OverflowError on huge integer literal %r" % s) elif maxint == 9223372036854775807: self.assertEqual(-9223372036854775807-1, -01000000000000000000000) self.assertTrue(01777777777777777777777 > 0) self.assertTrue(0xffffffffffffffff > 0) for s in '9223372036854775808', '02000000000000000000000', \ '0x10000000000000000': try: x = eval(s) except OverflowError: self.fail("OverflowError on huge integer literal %r" % s) else: self.fail('Weird maxint value %r' % maxint) def testLongIntegers(self): x = 0L x = 0l x = 0xffffffffffffffffL x = 0xffffffffffffffffl x = 077777777777777777L x = 077777777777777777l x = 123456789012345678901234567890L x = 123456789012345678901234567890l def testFloats(self): x = 3.14 x = 314. x = 0.314 # XXX x = 000.314 x = .314 x = 3e14 x = 3E14 x = 3e-14 x = 3e+14 x = 3.e14 x = .3e14 x = 3.1e4 def testStringLiterals(self): x = ''; y = ""; self.assertTrue(len(x) == 0 and x == y) x = '\''; y = "'"; self.assertTrue(len(x) == 1 and x == y and ord(x) == 39) x = '"'; y = "\""; self.assertTrue(len(x) == 1 and x == y and ord(x) == 34) x = "doesn't \"shrink\" does it" y = 'doesn\'t "shrink" does it' self.assertTrue(len(x) == 24 and x == y) x = "does \"shrink\" doesn't it" y = 'does "shrink" doesn\'t it' self.assertTrue(len(x) == 24 and x == y) x = """ The "quick" brown fox jumps over the 'lazy' dog. """ y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' self.assertEqual(x, y) y = ''' The "quick" brown fox jumps over the 'lazy' dog. ''' self.assertEqual(x, y) y = "\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the 'lazy' dog.\n\ " self.assertEqual(x, y) y = '\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the \'lazy\' dog.\n\ ' self.assertEqual(x, y) class GrammarTests(unittest.TestCase): # single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE # XXX can't test in a script -- this rule is only used when interactive # file_input: (NEWLINE | stmt)* ENDMARKER # Being tested as this very moment this very module # expr_input: testlist NEWLINE # XXX Hard to test -- used only in calls to input() def testEvalInput(self): # testlist ENDMARKER x = eval('1, 0 or 1') def testFuncdef(self): ### 'def' NAME parameters ':' suite ### parameters: '(' [varargslist] ')' ### varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] ### | ('**'|'*' '*') NAME) ### | fpdef ['=' test] (',' fpdef ['=' test])* [','] ### fpdef: NAME | '(' fplist ')' ### fplist: fpdef (',' fpdef)* [','] ### arglist: (argument ',')* (argument | *' test [',' '**' test] | '**' test) ### argument: [test '='] test # Really [keyword '='] test def f1(): pass f1() f1(*()) f1(*(), **{}) def f2(one_argument): pass def f3(two, arguments): pass # Silence Py3k warning exec('def f4(two, (compound, (argument, list))): pass') exec('def f5((compound, first), two): pass') self.assertEqual(f2.func_code.co_varnames, ('one_argument',)) self.assertEqual(f3.func_code.co_varnames, ('two', 'arguments')) if sys.platform.startswith('java'): self.assertEqual(f4.func_code.co_varnames, ('two', '(compound, (argument, list))', 'compound', 'argument', 'list',)) self.assertEqual(f5.func_code.co_varnames, ('(compound, first)', 'two', 'compound', 'first')) else: self.assertEqual(f4.func_code.co_varnames, ('two', '.1', 'compound', 'argument', 'list')) self.assertEqual(f5.func_code.co_varnames, ('.0', 'two', 'compound', 'first')) def a1(one_arg,): pass def a2(two, args,): pass def v0(*rest): pass def v1(a, *rest): pass def v2(a, b, *rest): pass # Silence Py3k warning exec('def v3(a, (b, c), *rest): return a, b, c, rest') f1() f2(1) f2(1,) f3(1, 2) f3(1, 2,) f4(1, (2, (3, 4))) v0() v0(1) v0(1,) v0(1,2) v0(1,2,3,4,5,6,7,8,9,0) v1(1) v1(1,) v1(1,2) v1(1,2,3) v1(1,2,3,4,5,6,7,8,9,0) v2(1,2) v2(1,2,3) v2(1,2,3,4) v2(1,2,3,4,5,6,7,8,9,0) v3(1,(2,3)) v3(1,(2,3),4) v3(1,(2,3),4,5,6,7,8,9,0) # ceval unpacks the formal arguments into the first argcount names; # thus, the names nested inside tuples must appear after these names. if sys.platform.startswith('java'): self.assertEqual(v3.func_code.co_varnames, ('a', '(b, c)', 'rest', 'b', 'c')) else: self.assertEqual(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c')) self.assertEqual(v3(1, (2, 3), 4), (1, 2, 3, (4,))) def d01(a=1): pass d01() d01(1) d01(*(1,)) d01(**{'a':2}) def d11(a, b=1): pass d11(1) d11(1, 2) d11(1, **{'b':2}) def d21(a, b, c=1): pass d21(1, 2) d21(1, 2, 3) d21(*(1, 2, 3)) d21(1, *(2, 3)) d21(1, 2, *(3,)) d21(1, 2, **{'c':3}) def d02(a=1, b=2): pass d02() d02(1) d02(1, 2) d02(*(1, 2)) d02(1, *(2,)) d02(1, **{'b':2}) d02(**{'a': 1, 'b': 2}) def d12(a, b=1, c=2): pass d12(1) d12(1, 2) d12(1, 2, 3) def d22(a, b, c=1, d=2): pass d22(1, 2) d22(1, 2, 3) d22(1, 2, 3, 4) def d01v(a=1, *rest): pass d01v() d01v(1) d01v(1, 2) d01v(*(1, 2, 3, 4)) d01v(*(1,)) d01v(**{'a':2}) def d11v(a, b=1, *rest): pass d11v(1) d11v(1, 2) d11v(1, 2, 3) def d21v(a, b, c=1, *rest): pass d21v(1, 2) d21v(1, 2, 3) d21v(1, 2, 3, 4) d21v(*(1, 2, 3, 4)) d21v(1, 2, **{'c': 3}) def d02v(a=1, b=2, *rest): pass d02v() d02v(1) d02v(1, 2) d02v(1, 2, 3) d02v(1, *(2, 3, 4)) d02v(**{'a': 1, 'b': 2}) def d12v(a, b=1, c=2, *rest): pass d12v(1) d12v(1, 2) d12v(1, 2, 3) d12v(1, 2, 3, 4) d12v(*(1, 2, 3, 4)) d12v(1, 2, *(3, 4, 5)) d12v(1, *(2,), **{'c': 3}) def d22v(a, b, c=1, d=2, *rest): pass d22v(1, 2) d22v(1, 2, 3) d22v(1, 2, 3, 4) d22v(1, 2, 3, 4, 5) d22v(*(1, 2, 3, 4)) d22v(1, 2, *(3, 4, 5)) d22v(1, *(2, 3), **{'d': 4}) # Silence Py3k warning exec('def d31v((x)): pass') exec('def d32v((x,)): pass') d31v(1) d32v((1,)) # keyword arguments after *arglist def f(*args, **kwargs): return args, kwargs self.assertEqual(f(1, x=2, *[3, 4], y=5), ((1, 3, 4), {'x':2, 'y':5})) self.assertRaises(SyntaxError, eval, "f(1, *(2,3), 4)") self.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)") # Check ast errors in *args and *kwargs check_syntax_error(self, "f(*g(1=2))") check_syntax_error(self, "f(**g(1=2))") def testLambdef(self): ### lambdef: 'lambda' [varargslist] ':' test l1 = lambda : 0 self.assertEqual(l1(), 0) l2 = lambda : a[d] # XXX just testing the expression l3 = lambda : [2 < x for x in [-1, 3, 0L]] self.assertEqual(l3(), [0, 1, 0]) l4 = lambda x = lambda y = lambda z=1 : z : y() : x() self.assertEqual(l4(), 1) l5 = lambda x, y, z=2: x + y + z self.assertEqual(l5(1, 2), 5) self.assertEqual(l5(1, 2, 3), 6) check_syntax_error(self, "lambda x: x = 2") check_syntax_error(self, "lambda (None,): None") ### stmt: simple_stmt | compound_stmt # Tested below def testSimpleStmt(self): ### simple_stmt: small_stmt (';' small_stmt)* [';'] x = 1; pass; del x def foo(): # verify statements that end with semi-colons x = 1; pass; del x; foo() ### small_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt # Tested below def testExprStmt(self): # (exprlist '=')* exprlist 1 1, 2, 3 x = 1 x = 1, 2, 3 x = y = z = 1, 2, 3 x, y, z = 1, 2, 3 abc = a, b, c = x, y, z = xyz = 1, 2, (3, 4) check_syntax_error(self, "x + 1 = 1") check_syntax_error(self, "a + 1 = b + 2") def testPrintStmt(self): # 'print' (test ',')* [test] import StringIO # Can't test printing to real stdout without comparing output # which is not available in unittest. save_stdout = sys.stdout sys.stdout = StringIO.StringIO() print 1, 2, 3 print 1, 2, 3, print print 0 or 1, 0 or 1, print 0 or 1 # 'print' '>>' test ',' print >> sys.stdout, 1, 2, 3 print >> sys.stdout, 1, 2, 3, print >> sys.stdout print >> sys.stdout, 0 or 1, 0 or 1, print >> sys.stdout, 0 or 1 # test printing to an instance class Gulp: def write(self, msg): pass gulp = Gulp() print >> gulp, 1, 2, 3 print >> gulp, 1, 2, 3, print >> gulp print >> gulp, 0 or 1, 0 or 1, print >> gulp, 0 or 1 # test print >> None def driver(): oldstdout = sys.stdout sys.stdout = Gulp() try: tellme(Gulp()) tellme() finally: sys.stdout = oldstdout # we should see this once def tellme(file=sys.stdout): print >> file, 'hello world' driver() # we should not see this at all def tellme(file=None): print >> file, 'goodbye universe' driver() self.assertEqual(sys.stdout.getvalue(), '''\ 1 2 3 1 2 3 1 1 1 1 2 3 1 2 3 1 1 1 hello world ''') sys.stdout = save_stdout # syntax errors check_syntax_error(self, 'print ,') check_syntax_error(self, 'print >> x,') def testDelStmt(self): # 'del' exprlist abc = [1,2,3] x, y, z = abc xyz = x, y, z del abc del x, y, (z, xyz) def testPassStmt(self): # 'pass' pass # flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt # Tested below def testBreakStmt(self): # 'break' while 1: break def testContinueStmt(self): # 'continue' i = 1 while i: i = 0; continue msg = "" while not msg: msg = "ok" try: continue msg = "continue failed to continue inside try" except: msg = "continue inside try called except block" if msg != "ok": self.fail(msg) msg = "" while not msg: msg = "finally block not called" try: continue finally: msg = "ok" if msg != "ok": self.fail(msg) def test_break_continue_loop(self): # This test warrants an explanation. It is a test specifically for SF bugs # #463359 and #462937. The bug is that a 'break' statement executed or # exception raised inside a try/except inside a loop, *after* a continue # statement has been executed in that loop, will cause the wrong number of # arguments to be popped off the stack and the instruction pointer reset to # a very small number (usually 0.) Because of this, the following test # *must* written as a function, and the tracking vars *must* be function # arguments with default values. Otherwise, the test will loop and loop. def test_inner(extra_burning_oil = 1, count=0): big_hippo = 2 while big_hippo: count += 1 try: if extra_burning_oil and big_hippo == 1: extra_burning_oil -= 1 break big_hippo -= 1 continue except: raise if count > 2 or big_hippo != 1: self.fail("continue then break in try/except in loop broken!") test_inner() def testReturn(self): # 'return' [testlist] def g1(): return def g2(): return 1 g1() x = g2() check_syntax_error(self, "class foo:return 1") def testYield(self): check_syntax_error(self, "class foo:yield 1") def testRaise(self): # 'raise' test [',' test] try: raise RuntimeError, 'just testing' except RuntimeError: pass try: raise KeyboardInterrupt except KeyboardInterrupt: pass def testImport(self): # 'import' dotted_as_names import sys import time, sys # 'from' dotted_name 'import' ('*' | '(' import_as_names ')' | import_as_names) from time import time from time import (time) # not testable inside a function, but already done at top of the module # from sys import * from sys import path, argv from sys import (path, argv) from sys import (path, argv,) def testGlobal(self): # 'global' NAME (',' NAME)* global a global a, b global one, two, three, four, five, six, seven, eight, nine, ten def testExec(self): # 'exec' expr ['in' expr [',' expr]] z = None del z exec 'z=1+1\n' if z != 2: self.fail('exec \'z=1+1\'\\n') del z exec 'z=1+1' if z != 2: self.fail('exec \'z=1+1\'') z = None del z import types if hasattr(types, "UnicodeType"): exec r"""if 1: exec u'z=1+1\n' if z != 2: self.fail('exec u\'z=1+1\'\\n') del z exec u'z=1+1' if z != 2: self.fail('exec u\'z=1+1\'')""" g = {} exec 'z = 1' in g if '__builtins__' in g: del g['__builtins__'] if g != {'z': 1}: self.fail('exec \'z = 1\' in g') g = {} l = {} exec 'global a; a = 1; b = 2' in g, l if '__builtins__' in g: del g['__builtins__'] if '__builtins__' in l: del l['__builtins__'] if (g, l) != ({'a':1}, {'b':2}): self.fail('exec ... in g (%s), l (%s)' %(g,l)) def testAssert(self): # assertTruestmt: 'assert' test [',' test] assert 1 assert 1, 1 assert lambda x:x assert 1, lambda x:x+1 try: assert True except AssertionError as e: self.fail("'assert True' should not have raised an AssertionError") try: assert True, 'this should always pass' except AssertionError as e: self.fail("'assert True, msg' should not have " "raised an AssertionError") # these tests fail if python is run with -O, so check __debug__ @unittest.skipUnless(__debug__, "Won't work if __debug__ is False") def testAssert2(self): try: assert 0, "msg" except AssertionError, e: self.assertEqual(e.args[0], "msg") else: self.fail("AssertionError not raised by assert 0") try: assert False except AssertionError as e: self.assertEqual(len(e.args), 0) else: self.fail("AssertionError not raised by 'assert False'") ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef # Tested below def testIf(self): # 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] if 1: pass if 1: pass else: pass if 0: pass elif 0: pass if 0: pass elif 0: pass elif 0: pass elif 0: pass else: pass def testWhile(self): # 'while' test ':' suite ['else' ':' suite] while 0: pass while 0: pass else: pass # Issue1920: "while 0" is optimized away, # ensure that the "else" clause is still present. x = 0 while 0: x = 1 else: x = 2 self.assertEqual(x, 2) def testFor(self): # 'for' exprlist 'in' exprlist ':' suite ['else' ':' suite] for i in 1, 2, 3: pass for i, j, k in (): pass else: pass class Squares: def __init__(self, max): self.max = max self.sofar = [] def __len__(self): return len(self.sofar) def __getitem__(self, i): if not 0 <= i < self.max: raise IndexError n = len(self.sofar) while n <= i: self.sofar.append(n*n) n = n+1 return self.sofar[i] n = 0 for x in Squares(10): n = n+x if n != 285: self.fail('for over growing sequence') result = [] for x, in [(1,), (2,), (3,)]: result.append(x) self.assertEqual(result, [1, 2, 3]) def testTry(self): ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] ### | 'try' ':' suite 'finally' ':' suite ### except_clause: 'except' [expr [('as' | ',') expr]] try: 1/0 except ZeroDivisionError: pass else: pass try: 1/0 except EOFError: pass except TypeError as msg: pass except RuntimeError, msg: pass except: pass else: pass try: 1/0 except (EOFError, TypeError, ZeroDivisionError): pass try: 1/0 except (EOFError, TypeError, ZeroDivisionError), msg: pass try: pass finally: pass def testSuite(self): # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT if 1: pass if 1: pass if 1: # # # pass pass # pass # def testTest(self): ### and_test ('or' and_test)* ### and_test: not_test ('and' not_test)* ### not_test: 'not' not_test | comparison if not 1: pass if 1 and 1: pass if 1 or 1: pass if not not not 1: pass if not 1 and 1 and 1: pass if 1 and 1 or 1 and 1 and 1 or not 1 and 1: pass def testComparison(self): ### comparison: expr (comp_op expr)* ### comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' if 1: pass x = (1 == 1) if 1 == 1: pass if 1 != 1: pass if 1 < 1: pass if 1 > 1: pass if 1 <= 1: pass if 1 >= 1: pass if 1 is 1: pass if 1 is not 1: pass if 1 in (): pass if 1 not in (): pass if 1 < 1 > 1 == 1 >= 1 <= 1 != 1 in 1 not in 1 is 1 is not 1: pass # Silence Py3k warning if eval('1 <> 1'): pass if eval('1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1'): pass def testBinaryMaskOps(self): x = 1 & 1 x = 1 ^ 1 x = 1 | 1 def testShiftOps(self): x = 1 << 1 x = 1 >> 1 x = 1 << 1 >> 1 def testAdditiveOps(self): x = 1 x = 1 + 1 x = 1 - 1 - 1 x = 1 - 1 + 1 - 1 + 1 def testMultiplicativeOps(self): x = 1 * 1 x = 1 / 1 x = 1 % 1 x = 1 / 1 * 1 % 1 def testUnaryOps(self): x = +1 x = -1 x = ~1 x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 x = -1*1/1 + 1*1 - ---1*1 def testSelectors(self): ### trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME ### subscript: expr | [expr] ':' [expr] import sys, time c = sys.path[0] x = time.time() x = sys.modules['time'].time() a = '01234' c = a[0] c = a[-1] s = a[0:5] s = a[:5] s = a[0:] s = a[:] s = a[-5:] s = a[:-1] s = a[-4:-3] # A rough test of SF bug 1333982. http://python.org/sf/1333982 # The testing here is fairly incomplete. # Test cases should include: commas with 1 and 2 colons d = {} d[1] = 1 d[1,] = 2 d[1,2] = 3 d[1,2,3] = 4 L = list(d) L.sort() self.assertEqual(str(L), '[1, (1,), (1, 2), (1, 2, 3)]') def testAtoms(self): ### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING ### dictorsetmaker: (test ':' test (',' test ':' test)* [',']) | (test (',' test)* [',']) x = (1) x = (1 or 2 or 3) x = (1 or 2 or 3, 2, 3) x = [] x = [1] x = [1 or 2 or 3] x = [1 or 2 or 3, 2, 3] x = [] x = {} x = {'one': 1} x = {'one': 1,} x = {'one' or 'two': 1 or 2} x = {'one': 1, 'two': 2} x = {'one': 1, 'two': 2,} x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6} x = {'one'} x = {'one', 1,} x = {'one', 'two', 'three'} x = {2, 3, 4,} # Silence Py3k warning x = eval('`x`') x = eval('`1 or 2 or 3`') self.assertEqual(eval('`1,2`'), '(1, 2)') x = x x = 'x' x = 123 ### exprlist: expr (',' expr)* [','] ### testlist: test (',' test)* [','] # These have been exercised enough above def testClassdef(self): # 'class' NAME ['(' [testlist] ')'] ':' suite class B: pass class B2(): pass class C1(B): pass class C2(B): pass class D(C1, C2, B): pass class C: def meth1(self): pass def meth2(self, arg): pass def meth3(self, a1, a2): pass # decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE # decorators: decorator+ # decorated: decorators (classdef | funcdef) def class_decorator(x): x.decorated = True return x @class_decorator class G: pass self.assertEqual(G.decorated, True) def testDictcomps(self): # dictorsetmaker: ( (test ':' test (comp_for | # (',' test ':' test)* [','])) | # (test (comp_for | (',' test)* [','])) ) nums = [1, 2, 3] self.assertEqual({i:i+1 for i in nums}, {1: 2, 2: 3, 3: 4}) def testListcomps(self): # list comprehension tests nums = [1, 2, 3, 4, 5] strs = ["Apple", "Banana", "Coconut"] spcs = [" Apple", " Banana ", "Coco nut "] self.assertEqual([s.strip() for s in spcs], ['Apple', 'Banana', 'Coco nut']) self.assertEqual([3 * x for x in nums], [3, 6, 9, 12, 15]) self.assertEqual([x for x in nums if x > 2], [3, 4, 5]) self.assertEqual([(i, s) for i in nums for s in strs], [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')]) self.assertEqual([(i, s) for i in nums for s in [f for f in strs if "n" in f]], [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')]) self.assertEqual([(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)], [[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]]) def test_in_func(l): return [None < x < 3 for x in l if x > 2] self.assertEqual(test_in_func(nums), [False, False, False]) def test_nested_front(): self.assertEqual([[y for y in [x, x + 1]] for x in [1,3,5]], [[1, 2], [3, 4], [5, 6]]) test_nested_front() check_syntax_error(self, "[i, s for i in nums for s in strs]") check_syntax_error(self, "[x if y]") suppliers = [ (1, "Boeing"), (2, "Ford"), (3, "Macdonalds") ] parts = [ (10, "Airliner"), (20, "Engine"), (30, "Cheeseburger") ] suppart = [ (1, 10), (1, 20), (2, 20), (3, 30) ] x = [ (sname, pname) for (sno, sname) in suppliers for (pno, pname) in parts for (sp_sno, sp_pno) in suppart if sno == sp_sno and pno == sp_pno ] self.assertEqual(x, [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')]) def testGenexps(self): # generator expression tests g = ([x for x in range(10)] for x in range(1)) self.assertEqual(g.next(), [x for x in range(10)]) try: g.next() self.fail('should produce StopIteration exception') except StopIteration: pass a = 1 try: g = (a for d in a) g.next() self.fail('should produce TypeError') except TypeError: pass self.assertEqual(list((x, y) for x in 'abcd' for y in 'abcd'), [(x, y) for x in 'abcd' for y in 'abcd']) self.assertEqual(list((x, y) for x in 'ab' for y in 'xy'), [(x, y) for x in 'ab' for y in 'xy']) a = [x for x in range(10)] b = (x for x in (y for y in a)) self.assertEqual(sum(b), sum([x for x in range(10)])) self.assertEqual(sum(x**2 for x in range(10)), sum([x**2 for x in range(10)])) self.assertEqual(sum(x*x for x in range(10) if x%2), sum([x*x for x in range(10) if x%2])) self.assertEqual(sum(x for x in (y for y in range(10))), sum([x for x in range(10)])) self.assertEqual(sum(x for x in (y for y in (z for z in range(10)))), sum([x for x in range(10)])) self.assertEqual(sum(x for x in [y for y in (z for z in range(10))]), sum([x for x in range(10)])) self.assertEqual(sum(x for x in (y for y in (z for z in range(10) if True)) if True), sum([x for x in range(10)])) self.assertEqual(sum(x for x in (y for y in (z for z in range(10) if True) if False) if True), 0) check_syntax_error(self, "foo(x for x in range(10), 100)") check_syntax_error(self, "foo(100, x for x in range(10))") def testComprehensionSpecials(self): # test for outmost iterable precomputation x = 10; g = (i for i in range(x)); x = 5 self.assertEqual(len(list(g)), 10) # This should hold, since we're only precomputing outmost iterable. x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) x = 5; t = True; self.assertEqual([(i,j) for i in range(10) for j in range(5)], list(g)) # Grammar allows multiple adjacent 'if's in listcomps and genexps, # even though it's silly. Make sure it works (ifelse broke this.) self.assertEqual([ x for x in range(10) if x % 2 if x % 3 ], [1, 5, 7]) self.assertEqual(list(x for x in range(10) if x % 2 if x % 3), [1, 5, 7]) # verify unpacking single element tuples in listcomp/genexp. self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) def test_with_statement(self): class manager(object): def __enter__(self): return (1, 2) def __exit__(self, *args): pass with manager(): pass with manager() as x: pass with manager() as (x, y): pass with manager(), manager(): pass with manager() as x, manager() as y: pass with manager() as x, manager(): pass def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): "helper to check that evaluation of expressions is done correctly" print x return ret self.assertEqual([ x() for x in lambda: True, lambda: False if x() ], [True]) self.assertEqual([ x() for x in (lambda: True, lambda: False) if x() ], [True]) self.assertEqual([ x(False) for x in (lambda x: False if x else True, lambda x: True if x else False) if x(False) ], [True]) self.assertEqual((5 if 1 else _checkeval("check 1", 0)), 5) self.assertEqual((_checkeval("check 2", 0) if 0 else 5), 5) self.assertEqual((5 and 6 if 0 else 1), 1) self.assertEqual(((5 and 6) if 0 else 1), 1) self.assertEqual((5 and (6 if 1 else 1)), 6) self.assertEqual((0 or _checkeval("check 3", 2) if 0 else 3), 3) self.assertEqual((1 or _checkeval("check 4", 2) if 1 else _checkeval("check 5", 3)), 1) self.assertEqual((0 or 5 if 1 else _checkeval("check 6", 3)), 5) self.assertEqual((not 5 if 1 else 1), False) self.assertEqual((not 5 if 0 else 1), 1) self.assertEqual((6 + 1 if 1 else 2), 7) self.assertEqual((6 - 1 if 1 else 2), 5) self.assertEqual((6 * 2 if 1 else 4), 12) self.assertEqual((6 / 2 if 1 else 3), 3) self.assertEqual((6 < 4 if 0 else 2), 2) def test_paren_evaluation(self): self.assertEqual(16 // (4 // 2), 8) self.assertEqual((16 // 4) // 2, 2) self.assertEqual(16 // 4 // 2, 2) self.assertTrue(False is (2 is 3)) self.assertFalse((False is 2) is 3) self.assertFalse(False is 2 is 3) def test_main(): with check_py3k_warnings( ("backquote not supported", SyntaxWarning), ("tuple parameter unpacking has been removed", SyntaxWarning), ("parenthesized argument names are invalid", SyntaxWarning), ("classic int division", DeprecationWarning), (".+ not supported in 3.x", DeprecationWarning)): run_unittest(TokenTests, GrammarTests) if __name__ == '__main__': test_main()
apache-2.0
[ 3, 2018, 511, 663, 1553, 1777, 413, 12, 12528, 14, 199, 3, 961, 2951, 2295, 3775, 314, 1798, 11479, 3062, 1006, 14, 199, 199, 504, 511, 14, 396, 63, 4058, 492, 1255, 63, 2796, 12, 1104, 63, 7093, 63, 705, 12, 971, 2892, 1104, 63, 647, 19, 75, 63, 5451, 199, 646, 2882, 199, 646, 984, 199, 3, 5343, 492, 627, 199, 504, 984, 492, 627, 421, 199, 533, 8767, 2925, 8, 2796, 14, 1746, 304, 339, 347, 511, 4540, 7001, 8, 277, 304, 267, 327, 10257, 7001, 4910, 1004, 16015, 26, 267, 671, 275, 413, 971, 267, 435, 413, 267, 291, 14, 629, 8, 88, 12, 499, 12, 283, 21509, 367, 1004, 16015, 358, 398, 327, 10257, 7001, 1630, 440, 4910, 16015, 315, 6786, 520, 60, 267, 671, 275, 378, 267, 291, 14, 629, 8, 88, 12, 378, 12, 283, 21509, 13401, 3721, 358, 339, 347, 511, 20711, 2674, 83, 8, 277, 304, 267, 291, 14, 629, 8, 16, 3581, 12, 5450, 9, 267, 291, 14, 629, 8, 1644, 1138, 12, 5450, 9, 267, 291, 14, 629, 8, 22519, 8557, 12, 378, 8881, 16713, 16713, 9, 267, 327, 298, 16, 88, 2, 365, 440, 282, 1686, 8785, 267, 291, 14, 1855, 8, 9294, 12, 3468, 12, 298, 16, 88, 531, 267, 687, 984, 492, 1390, 442, 267, 340, 1390, 442, 508, 21237, 16809, 8557, 26, 288, 291, 14, 629, 2801, 22519, 8557, 13, 17, 12, 446, 996, 20625, 9, 288, 327, 5787, 446, 22519, 10552, 288, 291, 14, 1815, 8, 1644, 16713, 16713, 1138, 690, 378, 9, 288, 291, 14, 1815, 8, 16, 21870, 690, 378, 9, 288, 367, 308, 315, 283, 22519, 10552, 297, 283, 966, 20625, 297, 283, 16, 88, 17, 3607, 356, 355, 862, 26, 490, 671, 275, 3468, 8, 83, 9, 355, 871, 23870, 26, 490, 291, 14, 1633, 480, 21821, 641, 27791, 3000, 8785, 450, 82, 2, 450, 308, 9, 267, 916, 1390, 442, 508, 1749, 1081, 32417, 11369, 26, 288, 291, 14, 629, 2801, 23861, 32417, 11369, 13, 17, 12, 446, 614, 9409, 5345, 9, 288, 291, 14, 1815, 8, 614, 16713, 16713, 16713, 16713, 1138, 11956, 690, 378, 9, 288, 291, 14, 1815, 8, 16, 3581, 15798, 12596, 690, 378, 9, 288, 367, 308, 315, 283, 23861, 32417, 11292, 297, 283, 996, 9409, 5345, 297, 971, 2151, 283, 16, 88, 17, 9409, 356, 355, 862, 26, 490, 671, 275, 3468, 8, 83, 9, 355, 871, 23870, 26, 490, 291, 14, 1633, 480, 21821, 641, 27791, 3000, 8785, 450, 82, 2, 450, 308, 9, 267, 587, 26, 288, 291, 14, 1633, 360, 6004, 5428, 1390, 442, 574, 450, 82, 7, 450, 1390, 442, 9, 339, 347, 511, 9551, 2674, 83, 8, 277, 304, 267, 671, 275, 378, 44, 267, 671, 275, 378, 76, 267, 671, 275, 378, 3581, 15798, 12596, 44, 267, 671, 275, 378, 3581, 15798, 12596, 76, 267, 671, 275, 378, 16713, 16713, 16713, 1138, 11956, 44, 267, 671, 275, 378, 16713, 16713, 16713, 1138, 11956, 76, 267, 671, 275, 32695, 25588, 16, 44, 267, 671, 275, 32695, 25588, 16, 76, 339, 347, 511, 5136, 83, 8, 277, 304, 267, 671, 275, 650, 14, 1079, 267, 671, 275, 29182, 14, 267, 671, 275, 378, 14, 8988, 267, 327, 5787, 671, 275, 21551, 14, 8988, 267, 671, 275, 1275, 8988, 267, 671, 275, 650, 69, 1079, 267, 671, 275, 650, 37, 1079, 267, 671, 275, 650, 69, 13, 1079, 267, 671, 275, 650, 69, 11, 1079, 267, 671, 275, 650, 14, 69, 1079, 267, 671, 275, 1275, 19, 69, 1079, 267, 671, 275, 650, 14, 17, 69, 20, 339, 347, 511, 1558, 44, 1661, 2551, 8, 277, 304, 267, 671, 275, 2125, 27, 612, 275, 3087, 27, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 378, 436, 671, 508, 612, 9, 267, 671, 275, 1557, 891, 27, 612, 275, 3546, 11436, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 413, 436, 671, 508, 612, 436, 6206, 8, 88, 9, 508, 10551, 9, 267, 671, 275, 14788, 27, 612, 275, 1867, 341, 27, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 413, 436, 671, 508, 612, 436, 6206, 8, 88, 9, 508, 8177, 9, 267, 671, 275, 298, 30977, 1133, 8441, 23733, 4451, 1630, 652, 2, 267, 612, 275, 283, 30977, 3985, 84, 298, 23733, 2, 1630, 652, 7, 267, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 5504, 436, 671, 508, 612, 9, 267, 671, 275, 298, 9105, 8441, 23733, 4451, 3181, 1133, 652, 2, 267, 612, 275, 283, 9105, 298, 23733, 2, 3181, 3985, 84, 652, 7, 267, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 5504, 436, 671, 508, 612, 9, 267, 671, 275, 408, 199, 1918, 298, 13239, 2, 199, 27133, 7090, 88, 199, 11126, 83, 1806, 199, 1589, 283, 6395, 7, 23454, 14, 199, 624, 267, 612, 275, 1557, 13705, 298, 13239, 3212, 78, 27133, 7090, 88, 60, 78, 11126, 83, 1806, 60, 19323, 8891, 6395, 3985, 23454, 3134, 78, 7, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1449, 199, 1918, 298, 13239, 2, 199, 27133, 7090, 88, 199, 11126, 83, 1806, 199, 1589, 283, 6395, 7, 23454, 14, 199, 2344, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1867, 78, 60, 199, 1918, 8441, 13239, 13356, 78, 60, 199, 27133, 7090, 88, 60, 78, 60, 199, 11126, 83, 1806, 60, 78, 60, 199, 1589, 283, 6395, 7, 23454, 3134, 78, 60, 199, 2, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1557, 78, 60, 199, 1918, 8441, 13239, 13356, 78, 60, 199, 27133, 7090, 88, 60, 78, 60, 199, 11126, 83, 1806, 60, 78, 60, 199, 1589, 8891, 6395, 3985, 23454, 3134, 78, 60, 199, 7, 267, 291, 14, 629, 8, 88, 12, 612, 9, 421, 199, 533, 10268, 9992, 2925, 8, 2796, 14, 1746, 304, 339, 327, 2849, 63, 1210, 26, 18689, 6174, 1204, 3486, 63, 9649, 1204, 16487, 63, 9649, 18689, 6174, 272, 327, 5787, 883, 1133, 511, 315, 282, 2884, 1553, 642, 2332, 365, 1454, 1202, 1380, 12777, 339, 327, 570, 63, 1210, 26, 334, 28758, 1204, 12284, 3342, 7729 ]
[ 2018, 511, 663, 1553, 1777, 413, 12, 12528, 14, 199, 3, 961, 2951, 2295, 3775, 314, 1798, 11479, 3062, 1006, 14, 199, 199, 504, 511, 14, 396, 63, 4058, 492, 1255, 63, 2796, 12, 1104, 63, 7093, 63, 705, 12, 971, 2892, 1104, 63, 647, 19, 75, 63, 5451, 199, 646, 2882, 199, 646, 984, 199, 3, 5343, 492, 627, 199, 504, 984, 492, 627, 421, 199, 533, 8767, 2925, 8, 2796, 14, 1746, 304, 339, 347, 511, 4540, 7001, 8, 277, 304, 267, 327, 10257, 7001, 4910, 1004, 16015, 26, 267, 671, 275, 413, 971, 267, 435, 413, 267, 291, 14, 629, 8, 88, 12, 499, 12, 283, 21509, 367, 1004, 16015, 358, 398, 327, 10257, 7001, 1630, 440, 4910, 16015, 315, 6786, 520, 60, 267, 671, 275, 378, 267, 291, 14, 629, 8, 88, 12, 378, 12, 283, 21509, 13401, 3721, 358, 339, 347, 511, 20711, 2674, 83, 8, 277, 304, 267, 291, 14, 629, 8, 16, 3581, 12, 5450, 9, 267, 291, 14, 629, 8, 1644, 1138, 12, 5450, 9, 267, 291, 14, 629, 8, 22519, 8557, 12, 378, 8881, 16713, 16713, 9, 267, 327, 298, 16, 88, 2, 365, 440, 282, 1686, 8785, 267, 291, 14, 1855, 8, 9294, 12, 3468, 12, 298, 16, 88, 531, 267, 687, 984, 492, 1390, 442, 267, 340, 1390, 442, 508, 21237, 16809, 8557, 26, 288, 291, 14, 629, 2801, 22519, 8557, 13, 17, 12, 446, 996, 20625, 9, 288, 327, 5787, 446, 22519, 10552, 288, 291, 14, 1815, 8, 1644, 16713, 16713, 1138, 690, 378, 9, 288, 291, 14, 1815, 8, 16, 21870, 690, 378, 9, 288, 367, 308, 315, 283, 22519, 10552, 297, 283, 966, 20625, 297, 283, 16, 88, 17, 3607, 356, 355, 862, 26, 490, 671, 275, 3468, 8, 83, 9, 355, 871, 23870, 26, 490, 291, 14, 1633, 480, 21821, 641, 27791, 3000, 8785, 450, 82, 2, 450, 308, 9, 267, 916, 1390, 442, 508, 1749, 1081, 32417, 11369, 26, 288, 291, 14, 629, 2801, 23861, 32417, 11369, 13, 17, 12, 446, 614, 9409, 5345, 9, 288, 291, 14, 1815, 8, 614, 16713, 16713, 16713, 16713, 1138, 11956, 690, 378, 9, 288, 291, 14, 1815, 8, 16, 3581, 15798, 12596, 690, 378, 9, 288, 367, 308, 315, 283, 23861, 32417, 11292, 297, 283, 996, 9409, 5345, 297, 971, 2151, 283, 16, 88, 17, 9409, 356, 355, 862, 26, 490, 671, 275, 3468, 8, 83, 9, 355, 871, 23870, 26, 490, 291, 14, 1633, 480, 21821, 641, 27791, 3000, 8785, 450, 82, 2, 450, 308, 9, 267, 587, 26, 288, 291, 14, 1633, 360, 6004, 5428, 1390, 442, 574, 450, 82, 7, 450, 1390, 442, 9, 339, 347, 511, 9551, 2674, 83, 8, 277, 304, 267, 671, 275, 378, 44, 267, 671, 275, 378, 76, 267, 671, 275, 378, 3581, 15798, 12596, 44, 267, 671, 275, 378, 3581, 15798, 12596, 76, 267, 671, 275, 378, 16713, 16713, 16713, 1138, 11956, 44, 267, 671, 275, 378, 16713, 16713, 16713, 1138, 11956, 76, 267, 671, 275, 32695, 25588, 16, 44, 267, 671, 275, 32695, 25588, 16, 76, 339, 347, 511, 5136, 83, 8, 277, 304, 267, 671, 275, 650, 14, 1079, 267, 671, 275, 29182, 14, 267, 671, 275, 378, 14, 8988, 267, 327, 5787, 671, 275, 21551, 14, 8988, 267, 671, 275, 1275, 8988, 267, 671, 275, 650, 69, 1079, 267, 671, 275, 650, 37, 1079, 267, 671, 275, 650, 69, 13, 1079, 267, 671, 275, 650, 69, 11, 1079, 267, 671, 275, 650, 14, 69, 1079, 267, 671, 275, 1275, 19, 69, 1079, 267, 671, 275, 650, 14, 17, 69, 20, 339, 347, 511, 1558, 44, 1661, 2551, 8, 277, 304, 267, 671, 275, 2125, 27, 612, 275, 3087, 27, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 378, 436, 671, 508, 612, 9, 267, 671, 275, 1557, 891, 27, 612, 275, 3546, 11436, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 413, 436, 671, 508, 612, 436, 6206, 8, 88, 9, 508, 10551, 9, 267, 671, 275, 14788, 27, 612, 275, 1867, 341, 27, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 413, 436, 671, 508, 612, 436, 6206, 8, 88, 9, 508, 8177, 9, 267, 671, 275, 298, 30977, 1133, 8441, 23733, 4451, 1630, 652, 2, 267, 612, 275, 283, 30977, 3985, 84, 298, 23733, 2, 1630, 652, 7, 267, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 5504, 436, 671, 508, 612, 9, 267, 671, 275, 298, 9105, 8441, 23733, 4451, 3181, 1133, 652, 2, 267, 612, 275, 283, 9105, 298, 23733, 2, 3181, 3985, 84, 652, 7, 267, 291, 14, 1815, 8, 552, 8, 88, 9, 508, 5504, 436, 671, 508, 612, 9, 267, 671, 275, 408, 199, 1918, 298, 13239, 2, 199, 27133, 7090, 88, 199, 11126, 83, 1806, 199, 1589, 283, 6395, 7, 23454, 14, 199, 624, 267, 612, 275, 1557, 13705, 298, 13239, 3212, 78, 27133, 7090, 88, 60, 78, 11126, 83, 1806, 60, 19323, 8891, 6395, 3985, 23454, 3134, 78, 7, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1449, 199, 1918, 298, 13239, 2, 199, 27133, 7090, 88, 199, 11126, 83, 1806, 199, 1589, 283, 6395, 7, 23454, 14, 199, 2344, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1867, 78, 60, 199, 1918, 8441, 13239, 13356, 78, 60, 199, 27133, 7090, 88, 60, 78, 60, 199, 11126, 83, 1806, 60, 78, 60, 199, 1589, 283, 6395, 7, 23454, 3134, 78, 60, 199, 2, 267, 291, 14, 629, 8, 88, 12, 612, 9, 267, 612, 275, 1557, 78, 60, 199, 1918, 8441, 13239, 13356, 78, 60, 199, 27133, 7090, 88, 60, 78, 60, 199, 11126, 83, 1806, 60, 78, 60, 199, 1589, 8891, 6395, 3985, 23454, 3134, 78, 60, 199, 7, 267, 291, 14, 629, 8, 88, 12, 612, 9, 421, 199, 533, 10268, 9992, 2925, 8, 2796, 14, 1746, 304, 339, 327, 2849, 63, 1210, 26, 18689, 6174, 1204, 3486, 63, 9649, 1204, 16487, 63, 9649, 18689, 6174, 272, 327, 5787, 883, 1133, 511, 315, 282, 2884, 1553, 642, 2332, 365, 1454, 1202, 1380, 12777, 339, 327, 570, 63, 1210, 26, 334, 28758, 1204, 12284, 3342, 7729, 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,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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 ]
Nixonite/Movie-Spoiler-Twitter-Bot
fetchSpoilers.py
1
1933
import urllib2 from BeautifulSoup import BeautifulSoup import sqlite3 import time spoilerSite = 'http://www.spollywood.com/' #maybe move to main.py def sqlStart(): return sqlite3.connect('moviespoilerbot.db') def sqlConnection(sqlconn): return sqlconn.cursor() def sqlClose(conn): conn.close() def weirdTextFix(str): str = str.replace("&amp;","&")#replace stuff with ampersand sign str = str.replace("&#39;","''")#replace stuff with 2 single quotes (necessary for sql insertion) str = str.replace("(","") str = str.replace(")","") return str def getSite(): return urllib2.urlopen(spoilerSite).read() def getTheDamnText(soupstuff): text = str(soupstuff) text = text[text.index('>')+1:text.index('</')] return text def parsePage(html_page): soup = BeautifulSoup(html_page) title = soup.findAll(attrs={'class' : 'title-text'}) spoiler = soup.findAll(attrs={'class':'spoiler-text'}) title = getTheDamnText(title) spoiler = getTheDamnText(spoiler) title = weirdTextFix(title) spoiler = weirdTextFix(spoiler) return (title,spoiler) def insertToDB(title,spoiler,conn): validAscii = True try: title.decode('ascii') spoiler.decode('ascii') except UnicodeDecodeError: return False if(len(spoiler)<=140):#to be tweetable c = sqlConnection(conn) tablename = "table_"+title[0] c.execute("create table if not exists "+tablename+"(ID INTEGER PRIMARY KEY, TITLE text, SPOILER text)") conn.commit() c.execute("select 1 from "+tablename+" where TITLE=:title",{"title":title}) conn.commit() if c.fetchone() is None: c.execute("insert into "+tablename+" (TITLE,SPOILER) values (:title,:spoiler)",{"title":title,"spoiler":spoiler}) print title print spoiler conn.commit() return True return False def fetchSpoilers(): conn = sqlStart() counter = 0 while counter<5: time.sleep(0.3) t,s = parsePage(getSite()) if insertToDB(t,s,conn): counter +=1 sqlClose(conn)
gpl-2.0
[ 646, 4011, 18, 199, 504, 17132, 492, 17132, 199, 646, 11723, 19, 199, 646, 900, 199, 199, 22522, 3566, 8972, 275, 283, 1014, 921, 1544, 14, 681, 393, 590, 22736, 14, 957, 4805, 327, 11853, 4057, 370, 2446, 14, 647, 199, 199, 318, 3875, 3162, 837, 199, 198, 1107, 11723, 19, 14, 2242, 360, 20888, 555, 3566, 3018, 14, 697, 358, 507, 199, 318, 3875, 3225, 8, 3009, 1631, 304, 199, 198, 1107, 3875, 1631, 14, 3937, 342, 199, 199, 318, 3875, 4724, 8, 1631, 304, 199, 198, 1631, 14, 1600, 342, 199, 199, 318, 22965, 1872, 11985, 8, 495, 304, 199, 198, 495, 275, 620, 14, 1814, 22077, 5282, 27, 2266, 6, 531, 3, 1814, 8292, 543, 15204, 1192, 460, 2070, 199, 198, 495, 275, 620, 14, 1814, 480, 7997, 1355, 27, 2266, 891, 531, 3, 1814, 8292, 543, 499, 2849, 9344, 334, 17927, 367, 3875, 22470, 9, 199, 198, 495, 275, 620, 14, 1814, 480, 11854, 7230, 199, 198, 495, 275, 620, 14, 1814, 480, 4186, 7230, 199, 198, 1107, 620, 199, 199, 318, 664, 8972, 837, 199, 198, 1107, 4011, 18, 14, 10890, 8, 22522, 3566, 8972, 680, 739, 342, 507, 199, 318, 664, 1918, 36, 455, 78, 1872, 8, 9317, 14573, 304, 199, 198, 505, 275, 620, 8, 9317, 14573, 9, 199, 198, 505, 275, 1318, 59, 505, 14, 1080, 28781, 11, 17, 26, 505, 14, 1080, 14264, 5440, 199, 198, 1107, 1318, 507, 199, 318, 2198, 3276, 8, 1360, 63, 1606, 304, 199, 198, 9317, 275, 17132, 8, 1360, 63, 1606, 9, 199, 198, 1213, 275, 9108, 14, 32651, 8, 3288, 3713, 533, 7, 520, 283, 1213, 13, 505, 3071, 199, 198, 22522, 3566, 275, 9108, 14, 32651, 8, 3288, 3713, 533, 5242, 22522, 3566, 13, 505, 3071, 199, 198, 1213, 275, 664, 1918, 36, 455, 78, 1872, 8, 1213, 9, 199, 198, 22522, 3566, 275, 664, 1918, 36, 455, 78, 1872, 8, 22522, 3566, 9, 199, 198, 1213, 275, 22965, 1872, 11985, 8, 1213, 9, 199, 198, 22522, 3566, 275, 22965, 1872, 11985, 8, 22522, 3566, 9, 199, 198, 1107, 334, 1213, 12, 22522, 3566, 9, 507, 199, 318, 5518, 1378, 2846, 8, 1213, 12, 22522, 3566, 12, 1631, 304, 199, 198, 1078, 11129, 275, 715, 199, 198, 893, 26, 507, 198, 1213, 14, 2708, 360, 4371, 358, 507, 198, 22522, 3566, 14, 2708, 360, 4371, 358, 199, 198, 2590, 18965, 26, 507, 198, 1107, 756, 8299, 198, 692, 8, 552, 8, 22522, 3566, 9, 12932, 10037, 304, 3, 475, 506, 21217, 461, 507, 198, 67, 275, 3875, 3225, 8, 1631, 9, 507, 198, 10983, 275, 298, 1224, 63, 7709, 1213, 59, 16, 61, 507, 198, 67, 14, 2526, 480, 981, 1817, 340, 440, 3495, 7210, 10983, 5207, 8, 998, 17086, 19770, 9301, 12, 377, 16507, 1318, 12, 428, 1512, 1193, 540, 1318, 6320, 507, 198, 1631, 14, 3543, 342, 507, 198, 67, 14, 2526, 480, 2416, 413, 687, 7210, 10983, 5207, 2382, 377, 16507, 29, 26, 1213, 401, 6641, 1213, 582, 1213, 1552, 507, 198, 1631, 14, 3543, 342, 507, 198, 692, 286, 14, 11591, 342, 365, 488, 26, 1585, 198, 67, 14, 2526, 480, 3176, 1901, 7210, 10983, 5207, 334, 19091, 12, 51, 1512, 1193, 540, 9, 1338, 18479, 1213, 12, 26, 22522, 3566, 4186, 6641, 1213, 582, 1213, 4589, 22522, 3566, 582, 22522, 3566, 1552, 1585, 198, 1361, 2538, 1585, 198, 1361, 25664, 3566, 1585, 198, 1631, 14, 3543, 342, 1585, 198, 1107, 715, 199, 198, 1107, 756, 507, 199, 318, 5267, 51, 555, 441, 2393, 837, 199, 198, 1631, 275, 3875, 3162, 342, 199, 198, 5337, 275, 378, 199, 198, 6710, 7055, 28, 21, 26, 507, 198, 521, 14, 4532, 8, 16, 14, 19, 9, 507, 198, 84, 12, 83, 275, 2198, 3276, 8, 362, 8972, 1012, 507, 198, 692, 5518, 1378, 2846, 8, 84, 12, 83, 12, 1631, 304, 686, 198, 5337, 847, 17, 199, 198, 3009, 4724, 8, 1631, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 4011, 18, 199, 504, 17132, 492, 17132, 199, 646, 11723, 19, 199, 646, 900, 199, 199, 22522, 3566, 8972, 275, 283, 1014, 921, 1544, 14, 681, 393, 590, 22736, 14, 957, 4805, 327, 11853, 4057, 370, 2446, 14, 647, 199, 199, 318, 3875, 3162, 837, 199, 198, 1107, 11723, 19, 14, 2242, 360, 20888, 555, 3566, 3018, 14, 697, 358, 507, 199, 318, 3875, 3225, 8, 3009, 1631, 304, 199, 198, 1107, 3875, 1631, 14, 3937, 342, 199, 199, 318, 3875, 4724, 8, 1631, 304, 199, 198, 1631, 14, 1600, 342, 199, 199, 318, 22965, 1872, 11985, 8, 495, 304, 199, 198, 495, 275, 620, 14, 1814, 22077, 5282, 27, 2266, 6, 531, 3, 1814, 8292, 543, 15204, 1192, 460, 2070, 199, 198, 495, 275, 620, 14, 1814, 480, 7997, 1355, 27, 2266, 891, 531, 3, 1814, 8292, 543, 499, 2849, 9344, 334, 17927, 367, 3875, 22470, 9, 199, 198, 495, 275, 620, 14, 1814, 480, 11854, 7230, 199, 198, 495, 275, 620, 14, 1814, 480, 4186, 7230, 199, 198, 1107, 620, 199, 199, 318, 664, 8972, 837, 199, 198, 1107, 4011, 18, 14, 10890, 8, 22522, 3566, 8972, 680, 739, 342, 507, 199, 318, 664, 1918, 36, 455, 78, 1872, 8, 9317, 14573, 304, 199, 198, 505, 275, 620, 8, 9317, 14573, 9, 199, 198, 505, 275, 1318, 59, 505, 14, 1080, 28781, 11, 17, 26, 505, 14, 1080, 14264, 5440, 199, 198, 1107, 1318, 507, 199, 318, 2198, 3276, 8, 1360, 63, 1606, 304, 199, 198, 9317, 275, 17132, 8, 1360, 63, 1606, 9, 199, 198, 1213, 275, 9108, 14, 32651, 8, 3288, 3713, 533, 7, 520, 283, 1213, 13, 505, 3071, 199, 198, 22522, 3566, 275, 9108, 14, 32651, 8, 3288, 3713, 533, 5242, 22522, 3566, 13, 505, 3071, 199, 198, 1213, 275, 664, 1918, 36, 455, 78, 1872, 8, 1213, 9, 199, 198, 22522, 3566, 275, 664, 1918, 36, 455, 78, 1872, 8, 22522, 3566, 9, 199, 198, 1213, 275, 22965, 1872, 11985, 8, 1213, 9, 199, 198, 22522, 3566, 275, 22965, 1872, 11985, 8, 22522, 3566, 9, 199, 198, 1107, 334, 1213, 12, 22522, 3566, 9, 507, 199, 318, 5518, 1378, 2846, 8, 1213, 12, 22522, 3566, 12, 1631, 304, 199, 198, 1078, 11129, 275, 715, 199, 198, 893, 26, 507, 198, 1213, 14, 2708, 360, 4371, 358, 507, 198, 22522, 3566, 14, 2708, 360, 4371, 358, 199, 198, 2590, 18965, 26, 507, 198, 1107, 756, 8299, 198, 692, 8, 552, 8, 22522, 3566, 9, 12932, 10037, 304, 3, 475, 506, 21217, 461, 507, 198, 67, 275, 3875, 3225, 8, 1631, 9, 507, 198, 10983, 275, 298, 1224, 63, 7709, 1213, 59, 16, 61, 507, 198, 67, 14, 2526, 480, 981, 1817, 340, 440, 3495, 7210, 10983, 5207, 8, 998, 17086, 19770, 9301, 12, 377, 16507, 1318, 12, 428, 1512, 1193, 540, 1318, 6320, 507, 198, 1631, 14, 3543, 342, 507, 198, 67, 14, 2526, 480, 2416, 413, 687, 7210, 10983, 5207, 2382, 377, 16507, 29, 26, 1213, 401, 6641, 1213, 582, 1213, 1552, 507, 198, 1631, 14, 3543, 342, 507, 198, 692, 286, 14, 11591, 342, 365, 488, 26, 1585, 198, 67, 14, 2526, 480, 3176, 1901, 7210, 10983, 5207, 334, 19091, 12, 51, 1512, 1193, 540, 9, 1338, 18479, 1213, 12, 26, 22522, 3566, 4186, 6641, 1213, 582, 1213, 4589, 22522, 3566, 582, 22522, 3566, 1552, 1585, 198, 1361, 2538, 1585, 198, 1361, 25664, 3566, 1585, 198, 1631, 14, 3543, 342, 1585, 198, 1107, 715, 199, 198, 1107, 756, 507, 199, 318, 5267, 51, 555, 441, 2393, 837, 199, 198, 1631, 275, 3875, 3162, 342, 199, 198, 5337, 275, 378, 199, 198, 6710, 7055, 28, 21, 26, 507, 198, 521, 14, 4532, 8, 16, 14, 19, 9, 507, 198, 84, 12, 83, 275, 2198, 3276, 8, 362, 8972, 1012, 507, 198, 692, 5518, 1378, 2846, 8, 84, 12, 83, 12, 1631, 304, 686, 198, 5337, 847, 17, 199, 198, 3009, 4724, 8, 1631, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
sam-m888/gprime
gprime/filters/rules/person/_multiplemarriages.py
1
1773
# # gPrime - A web-based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # #------------------------------------------------------------------------- # # Standard Python modules # #------------------------------------------------------------------------- from ....const import LOCALE as glocale _ = glocale.translation.gettext #------------------------------------------------------------------------- # # Gprime modules # #------------------------------------------------------------------------- from .. import Rule #------------------------------------------------------------------------- # "People with multiple marriage records" #------------------------------------------------------------------------- class MultipleMarriages(Rule): """People with multiple marriage records""" name = _('People with multiple marriage records') description = _("Matches people who have more than one spouse") category = _('Family filters') def apply(self,db,person): return len(person.get_family_handle_list()) > 1
gpl-2.0
[ 3, 199, 3, 486, 4562, 278, 446, 437, 3330, 13, 6788, 15599, 2548, 89, 2240, 199, 3, 199, 3, 1898, 334, 35, 9, 14790, 13, 7968, 221, 7529, 27075, 653, 14, 2900, 316, 10670, 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, 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, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8026, 11236, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 11315, 13, 10067, 8217, 14, 199, 3, 199, 199, 25812, 199, 3, 199, 3, 9739, 2018, 4621, 199, 3, 199, 25812, 199, 504, 29222, 1297, 492, 20639, 37, 465, 486, 5508, 199, 63, 275, 486, 5508, 14, 6893, 14, 5152, 199, 199, 25812, 199, 3, 199, 3, 598, 12446, 4621, 199, 3, 199, 25812, 199, 504, 2508, 492, 11949, 199, 199, 25812, 199, 3, 298, 8070, 7939, 543, 3663, 7557, 25220, 5767, 2, 199, 25812, 199, 533, 14326, 10570, 322, 7441, 8, 5065, 304, 272, 408, 8070, 7939, 543, 3663, 7557, 25220, 5767, 624, 339, 536, 263, 275, 4018, 8070, 7939, 543, 3663, 7557, 25220, 5767, 358, 272, 1369, 275, 3824, 12962, 13135, 3963, 1172, 1655, 2419, 1373, 25664, 1180, 531, 272, 4637, 259, 275, 4018, 16345, 4766, 358, 339, 347, 4838, 8, 277, 12, 697, 12, 5484, 304, 267, 372, 822, 8, 5484, 14, 362, 63, 6606, 63, 2479, 63, 513, 1012, 690, 413, 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 ]
[ 199, 3, 486, 4562, 278, 446, 437, 3330, 13, 6788, 15599, 2548, 89, 2240, 199, 3, 199, 3, 1898, 334, 35, 9, 14790, 13, 7968, 221, 7529, 27075, 653, 14, 2900, 316, 10670, 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, 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, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8026, 11236, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 11315, 13, 10067, 8217, 14, 199, 3, 199, 199, 25812, 199, 3, 199, 3, 9739, 2018, 4621, 199, 3, 199, 25812, 199, 504, 29222, 1297, 492, 20639, 37, 465, 486, 5508, 199, 63, 275, 486, 5508, 14, 6893, 14, 5152, 199, 199, 25812, 199, 3, 199, 3, 598, 12446, 4621, 199, 3, 199, 25812, 199, 504, 2508, 492, 11949, 199, 199, 25812, 199, 3, 298, 8070, 7939, 543, 3663, 7557, 25220, 5767, 2, 199, 25812, 199, 533, 14326, 10570, 322, 7441, 8, 5065, 304, 272, 408, 8070, 7939, 543, 3663, 7557, 25220, 5767, 624, 339, 536, 263, 275, 4018, 8070, 7939, 543, 3663, 7557, 25220, 5767, 358, 272, 1369, 275, 3824, 12962, 13135, 3963, 1172, 1655, 2419, 1373, 25664, 1180, 531, 272, 4637, 259, 275, 4018, 16345, 4766, 358, 339, 347, 4838, 8, 277, 12, 697, 12, 5484, 304, 267, 372, 822, 8, 5484, 14, 362, 63, 6606, 63, 2479, 63, 513, 1012, 690, 413, 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, 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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utf-8 -*- # # Copyright (C) 2019 by YOUR NAME HERE # # This file is part of RoboComp # # RoboComp 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. # # RoboComp 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 RoboComp. If not, see <http://www.gnu.org/licenses/>. import sys, Ice, os from PySide2 import QtWidgets, QtCore ROBOCOMP = '' try: ROBOCOMP = os.environ['ROBOCOMP'] except KeyError: print '$ROBOCOMP environment variable not set, using the default value /opt/robocomp' ROBOCOMP = '/opt/robocomp' preStr = "-I/opt/robocomp/interfaces/ -I"+ROBOCOMP+"/interfaces/ --all /opt/robocomp/interfaces/" Ice.loadSlice(preStr+"CommonBehavior.ice") import RoboCompCommonBehavior additionalPathStr = '' icePaths = [ '/opt/robocomp/interfaces' ] try: SLICE_PATH = os.environ['SLICE_PATH'].split(':') for p in SLICE_PATH: icePaths.append(p) additionalPathStr += ' -I' + p + ' ' icePaths.append('/opt/robocomp/interfaces') except: print 'SLICE_PATH environment variable was not exported. Using only the default paths' pass ice_IMUPub = False for p in icePaths: if os.path.isfile(p+'/IMUPub.ice'): preStr = "-I/opt/robocomp/interfaces/ -I"+ROBOCOMP+"/interfaces/ " + additionalPathStr + " --all "+p+'/' wholeStr = preStr+"IMUPub.ice" Ice.loadSlice(wholeStr) ice_IMUPub = True break if not ice_IMUPub: print 'Couln\'t load IMUPub' sys.exit(-1) from RoboCompIMUPub import * ice_IMUPub = False for p in icePaths: if os.path.isfile(p+'/IMUPub.ice'): preStr = "-I/opt/robocomp/interfaces/ -I"+ROBOCOMP+"/interfaces/ " + additionalPathStr + " --all "+p+'/' wholeStr = preStr+"IMUPub.ice" Ice.loadSlice(wholeStr) ice_IMUPub = True break if not ice_IMUPub: print 'Couln\'t load IMUPub' sys.exit(-1) from RoboCompIMUPub import * from imuI import * class GenericWorker(QtCore.QObject): kill = QtCore.Signal() def __init__(self, mprx): super(GenericWorker, self).__init__() self.imupub_proxy = mprx["IMUPubPub"] self.mutex = QtCore.QMutex(QtCore.QMutex.Recursive) self.Period = 30 self.timer = QtCore.QTimer(self) @QtCore.Slot() def killYourSelf(self): rDebug("Killing myself") self.kill.emit() # \brief Change compute period # @param per Period in ms @QtCore.Slot(int) def setPeriod(self, p): print "Period changed", p Period = p timer.start(Period)
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 334, 35, 9, 20312, 701, 1488, 11237, 13637, 869, 28106, 199, 3, 199, 3, 259, 961, 570, 365, 1777, 402, 6848, 656, 2404, 199, 3, 199, 3, 259, 6848, 656, 2404, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 6848, 656, 2404, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 6848, 656, 2404, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 984, 12, 473, 301, 12, 747, 199, 504, 1611, 15414, 18, 492, 17113, 12, 10565, 199, 199, 1092, 3973, 6790, 275, 2125, 199, 893, 26, 199, 198, 1092, 3973, 6790, 275, 747, 14, 2314, 459, 1092, 3973, 6790, 418, 199, 2590, 4067, 26, 199, 198, 1361, 4505, 1092, 3973, 6790, 3734, 1750, 440, 663, 12, 1808, 314, 849, 574, 1182, 2992, 15, 293, 656, 863, 7, 199, 198, 1092, 3973, 6790, 275, 1994, 2992, 15, 293, 656, 863, 7, 199, 199, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 1553, 452, 1182, 2992, 15, 293, 656, 863, 15, 7436, 6687, 199, 41, 301, 14, 912, 14034, 8, 657, 2848, 5207, 7844, 25361, 14, 1885, 531, 199, 646, 6848, 656, 2404, 7844, 25361, 199, 199, 8460, 2042, 2848, 275, 2125, 199, 1885, 11804, 275, 359, 1994, 2992, 15, 293, 656, 863, 15, 7436, 7, 1622, 199, 893, 26, 199, 198, 51, 2507, 37, 63, 3243, 275, 747, 14, 2314, 459, 51, 2507, 37, 63, 3243, 2278, 1294, 11633, 199, 198, 509, 299, 315, 428, 2507, 37, 63, 3243, 26, 507, 198, 1885, 11804, 14, 740, 8, 80, 9, 507, 198, 8460, 2042, 2848, 847, 283, 446, 41, 7, 435, 299, 435, 283, 283, 199, 198, 1885, 11804, 14, 740, 2336, 2992, 15, 293, 656, 863, 15, 7436, 358, 199, 2590, 26, 199, 198, 1361, 283, 51, 2507, 37, 63, 3243, 3734, 1750, 1990, 440, 16629, 14, 11719, 1454, 314, 849, 3792, 7, 199, 198, 1529, 199, 199, 1885, 63, 1469, 2160, 456, 275, 756, 199, 509, 299, 315, 284, 301, 11804, 26, 199, 198, 692, 747, 14, 515, 14, 6292, 8, 80, 23164, 1469, 2160, 456, 14, 1885, 735, 507, 198, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 298, 435, 4722, 2042, 2848, 435, 298, 1553, 452, 7210, 80, 4786, 4805, 507, 198, 21224, 2848, 275, 876, 2848, 5207, 1469, 2160, 456, 14, 1885, 2, 507, 198, 41, 301, 14, 912, 14034, 8, 21224, 2848, 9, 507, 198, 1885, 63, 1469, 2160, 456, 275, 715, 507, 198, 4785, 199, 692, 440, 284, 301, 63, 1469, 2160, 456, 26, 199, 198, 1361, 283, 967, 348, 78, 3985, 84, 2248, 18211, 2160, 456, 7, 199, 198, 1274, 14, 2224, 2801, 17, 9, 199, 504, 6848, 656, 2404, 1469, 2160, 456, 492, 627, 199, 1885, 63, 1469, 2160, 456, 275, 756, 199, 509, 299, 315, 284, 301, 11804, 26, 199, 198, 692, 747, 14, 515, 14, 6292, 8, 80, 23164, 1469, 2160, 456, 14, 1885, 735, 507, 198, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 298, 435, 4722, 2042, 2848, 435, 298, 1553, 452, 7210, 80, 4786, 4805, 507, 198, 21224, 2848, 275, 876, 2848, 5207, 1469, 2160, 456, 14, 1885, 2, 507, 198, 41, 301, 14, 912, 14034, 8, 21224, 2848, 9, 507, 198, 1885, 63, 1469, 2160, 456, 275, 715, 507, 198, 4785, 199, 692, 440, 284, 301, 63, 1469, 2160, 456, 26, 199, 198, 1361, 283, 967, 348, 78, 3985, 84, 2248, 18211, 2160, 456, 7, 199, 198, 1274, 14, 2224, 2801, 17, 9, 199, 504, 6848, 656, 2404, 1469, 2160, 456, 492, 627, 421, 199, 504, 3416, 85, 41, 492, 627, 421, 199, 533, 8307, 12678, 8, 10901, 14, 32260, 304, 421, 198, 8997, 275, 10565, 14, 11274, 342, 421, 198, 318, 636, 826, 721, 277, 12, 6118, 6872, 304, 507, 198, 4792, 8, 9417, 12678, 12, 291, 2843, 826, 4533, 421, 507, 198, 277, 14, 1017, 384, 456, 63, 3280, 275, 6118, 6872, 905, 1469, 2160, 456, 18060, 937, 6319, 507, 198, 277, 14, 19078, 275, 10565, 14, 49, 45, 18173, 8, 10901, 14, 49, 45, 18173, 14, 25122, 9, 507, 198, 277, 14, 15518, 275, 4233, 507, 198, 277, 14, 7414, 275, 10565, 14, 49, 7929, 8, 277, 9, 4388, 198, 32, 10901, 14, 15183, 342, 199, 198, 318, 14561, 14398, 12887, 8, 277, 304, 507, 198, 82, 7084, 480, 43, 12687, 3002, 277, 531, 507, 198, 277, 14, 8997, 14, 8159, 342, 421, 198, 3, 971, 19127, 7743, 4526, 6247, 199, 198, 3, 768, 635, 1126, 16532, 315, 6605, 199, 198, 32, 10901, 14, 15183, 8, 442, 9, 199, 198, 318, 663, 15518, 8, 277, 12, 299, 304, 507, 198, 1361, 298, 15518, 2896, 401, 299, 507, 198, 15518, 275, 299, 507, 198, 7414, 14, 928, 8, 15518, 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 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 334, 35, 9, 20312, 701, 1488, 11237, 13637, 869, 28106, 199, 3, 199, 3, 259, 961, 570, 365, 1777, 402, 6848, 656, 2404, 199, 3, 199, 3, 259, 6848, 656, 2404, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 6848, 656, 2404, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 6848, 656, 2404, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 984, 12, 473, 301, 12, 747, 199, 504, 1611, 15414, 18, 492, 17113, 12, 10565, 199, 199, 1092, 3973, 6790, 275, 2125, 199, 893, 26, 199, 198, 1092, 3973, 6790, 275, 747, 14, 2314, 459, 1092, 3973, 6790, 418, 199, 2590, 4067, 26, 199, 198, 1361, 4505, 1092, 3973, 6790, 3734, 1750, 440, 663, 12, 1808, 314, 849, 574, 1182, 2992, 15, 293, 656, 863, 7, 199, 198, 1092, 3973, 6790, 275, 1994, 2992, 15, 293, 656, 863, 7, 199, 199, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 1553, 452, 1182, 2992, 15, 293, 656, 863, 15, 7436, 6687, 199, 41, 301, 14, 912, 14034, 8, 657, 2848, 5207, 7844, 25361, 14, 1885, 531, 199, 646, 6848, 656, 2404, 7844, 25361, 199, 199, 8460, 2042, 2848, 275, 2125, 199, 1885, 11804, 275, 359, 1994, 2992, 15, 293, 656, 863, 15, 7436, 7, 1622, 199, 893, 26, 199, 198, 51, 2507, 37, 63, 3243, 275, 747, 14, 2314, 459, 51, 2507, 37, 63, 3243, 2278, 1294, 11633, 199, 198, 509, 299, 315, 428, 2507, 37, 63, 3243, 26, 507, 198, 1885, 11804, 14, 740, 8, 80, 9, 507, 198, 8460, 2042, 2848, 847, 283, 446, 41, 7, 435, 299, 435, 283, 283, 199, 198, 1885, 11804, 14, 740, 2336, 2992, 15, 293, 656, 863, 15, 7436, 358, 199, 2590, 26, 199, 198, 1361, 283, 51, 2507, 37, 63, 3243, 3734, 1750, 1990, 440, 16629, 14, 11719, 1454, 314, 849, 3792, 7, 199, 198, 1529, 199, 199, 1885, 63, 1469, 2160, 456, 275, 756, 199, 509, 299, 315, 284, 301, 11804, 26, 199, 198, 692, 747, 14, 515, 14, 6292, 8, 80, 23164, 1469, 2160, 456, 14, 1885, 735, 507, 198, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 298, 435, 4722, 2042, 2848, 435, 298, 1553, 452, 7210, 80, 4786, 4805, 507, 198, 21224, 2848, 275, 876, 2848, 5207, 1469, 2160, 456, 14, 1885, 2, 507, 198, 41, 301, 14, 912, 14034, 8, 21224, 2848, 9, 507, 198, 1885, 63, 1469, 2160, 456, 275, 715, 507, 198, 4785, 199, 692, 440, 284, 301, 63, 1469, 2160, 456, 26, 199, 198, 1361, 283, 967, 348, 78, 3985, 84, 2248, 18211, 2160, 456, 7, 199, 198, 1274, 14, 2224, 2801, 17, 9, 199, 504, 6848, 656, 2404, 1469, 2160, 456, 492, 627, 199, 1885, 63, 1469, 2160, 456, 275, 756, 199, 509, 299, 315, 284, 301, 11804, 26, 199, 198, 692, 747, 14, 515, 14, 6292, 8, 80, 23164, 1469, 2160, 456, 14, 1885, 735, 507, 198, 657, 2848, 275, 3905, 41, 15, 2992, 15, 293, 656, 863, 15, 7436, 15, 446, 41, 7709, 1092, 3973, 6790, 24792, 7436, 15, 298, 435, 4722, 2042, 2848, 435, 298, 1553, 452, 7210, 80, 4786, 4805, 507, 198, 21224, 2848, 275, 876, 2848, 5207, 1469, 2160, 456, 14, 1885, 2, 507, 198, 41, 301, 14, 912, 14034, 8, 21224, 2848, 9, 507, 198, 1885, 63, 1469, 2160, 456, 275, 715, 507, 198, 4785, 199, 692, 440, 284, 301, 63, 1469, 2160, 456, 26, 199, 198, 1361, 283, 967, 348, 78, 3985, 84, 2248, 18211, 2160, 456, 7, 199, 198, 1274, 14, 2224, 2801, 17, 9, 199, 504, 6848, 656, 2404, 1469, 2160, 456, 492, 627, 421, 199, 504, 3416, 85, 41, 492, 627, 421, 199, 533, 8307, 12678, 8, 10901, 14, 32260, 304, 421, 198, 8997, 275, 10565, 14, 11274, 342, 421, 198, 318, 636, 826, 721, 277, 12, 6118, 6872, 304, 507, 198, 4792, 8, 9417, 12678, 12, 291, 2843, 826, 4533, 421, 507, 198, 277, 14, 1017, 384, 456, 63, 3280, 275, 6118, 6872, 905, 1469, 2160, 456, 18060, 937, 6319, 507, 198, 277, 14, 19078, 275, 10565, 14, 49, 45, 18173, 8, 10901, 14, 49, 45, 18173, 14, 25122, 9, 507, 198, 277, 14, 15518, 275, 4233, 507, 198, 277, 14, 7414, 275, 10565, 14, 49, 7929, 8, 277, 9, 4388, 198, 32, 10901, 14, 15183, 342, 199, 198, 318, 14561, 14398, 12887, 8, 277, 304, 507, 198, 82, 7084, 480, 43, 12687, 3002, 277, 531, 507, 198, 277, 14, 8997, 14, 8159, 342, 421, 198, 3, 971, 19127, 7743, 4526, 6247, 199, 198, 3, 768, 635, 1126, 16532, 315, 6605, 199, 198, 32, 10901, 14, 15183, 8, 442, 9, 199, 198, 318, 663, 15518, 8, 277, 12, 299, 304, 507, 198, 1361, 298, 15518, 2896, 401, 299, 507, 198, 15518, 275, 299, 507, 198, 7414, 14, 928, 8, 15518, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
prasannav7/ggrc-core
src/ggrc/models/program.py
3
3053
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from ggrc.models.context import HasOwnContext from ggrc.models.mixins import deferred, BusinessObject, Timeboxed, CustomAttributable from ggrc.models.object_document import Documentable from ggrc.models.object_owner import Ownable from ggrc.models.object_person import Personable, ObjectPerson from ggrc.models.person import Person from ggrc.models.reflection import AttributeInfo from ggrc.models.relationship import Relatable from ggrc.models.track_object_state import HasObjectState, track_state_for_class class Program(HasObjectState, CustomAttributable, Documentable, Personable, Relatable, HasOwnContext, Timeboxed, Ownable, BusinessObject, db.Model): __tablename__ = 'programs' KINDS = ['Directive'] KINDS_HIDDEN = ['Company Controls Policy'] private = db.Column(db.Boolean, default=False, nullable=False) kind = deferred(db.Column(db.String), 'Program') audits = db.relationship( 'Audit', backref='program', cascade='all, delete-orphan') _publish_attrs = [ 'kind', 'audits', 'private', ] _include_links = [] _aliases = { "url": "Program URL", "owners": None, "program_owner": { "display_name": "Manager", "mandatory": True, "type": AttributeInfo.Type.USER_ROLE, "filter_by": "_filter_by_program_owner", }, "program_editor": { "display_name": "Editor", "type": AttributeInfo.Type.USER_ROLE, "filter_by": "_filter_by_program_editor", }, "program_reader": { "display_name": "Reader", "type": AttributeInfo.Type.USER_ROLE, "filter_by": "_filter_by_program_reader", }, "program_mapped": { "display_name": "No Access", "type": AttributeInfo.Type.USER_ROLE, "filter_by": "_filter_by_program_mapped", }, } @classmethod def _filter_by_program_owner(cls, predicate): return cls._filter_by_role("ProgramOwner", predicate) @classmethod def _filter_by_program_editor(cls, predicate): return cls._filter_by_role("ProgramEditor", predicate) @classmethod def _filter_by_program_reader(cls, predicate): return cls._filter_by_role("ProgramReader", predicate) @classmethod def _filter_by_program_mapped(cls, predicate): return ObjectPerson.query.join(Person).filter( (ObjectPerson.personable_type == "Program") & (ObjectPerson.personable_id == cls.id) & (predicate(Person.email) | predicate(Person.name)) ).exists() @classmethod def eager_query(cls): from sqlalchemy import orm query = super(Program, cls).eager_query() return cls.eager_inclusions(query, Program._include_links).options( orm.subqueryload('audits')) track_state_for_class(Program)
apache-2.0
[ 3, 1898, 334, 35, 9, 6171, 4475, 3277, 2020, 11462, 12, 436, 8417, 665, 3239, 10610, 570, 30, 199, 3, 3909, 1334, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 665, 3239, 5113, 570, 30, 199, 3, 18208, 4885, 26, 366, 17204, 32, 264, 30283, 3690, 76, 2101, 14, 957, 199, 3, 16593, 8368, 379, 4885, 26, 366, 17204, 32, 264, 30283, 3690, 76, 2101, 14, 957, 199, 199, 504, 486, 71, 1195, 492, 1592, 199, 504, 486, 71, 1195, 14, 992, 14, 1100, 492, 13481, 28492, 2998, 199, 504, 486, 71, 1195, 14, 992, 14, 30192, 492, 12309, 12, 23813, 1692, 12, 4703, 1977, 379, 12, 8388, 17937, 2964, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 3554, 492, 7543, 461, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 4597, 492, 593, 3501, 461, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 5484, 492, 8028, 461, 12, 6935, 7344, 199, 504, 486, 71, 1195, 14, 992, 14, 5484, 492, 8028, 199, 504, 486, 71, 1195, 14, 992, 14, 14906, 492, 3882, 2354, 199, 504, 486, 71, 1195, 14, 992, 14, 11704, 492, 9781, 15511, 199, 504, 486, 71, 1195, 14, 992, 14, 3885, 63, 785, 63, 929, 492, 13481, 1692, 2223, 12, 4426, 63, 929, 63, 509, 63, 533, 421, 199, 533, 18841, 8, 6362, 1692, 2223, 12, 8388, 17937, 2964, 12, 7543, 461, 12, 1598, 8028, 461, 12, 9781, 15511, 12, 13481, 28492, 2998, 12, 4703, 1977, 379, 12, 1598, 593, 3501, 461, 12, 23813, 1692, 12, 1592, 14, 1685, 304, 523, 636, 10983, 363, 275, 283, 28464, 7, 819, 1804, 568, 3177, 275, 788, 29489, 418, 523, 1804, 568, 3177, 63, 40, 22436, 275, 788, 16063, 29001, 18141, 418, 819, 5726, 275, 1592, 14, 4547, 8, 697, 14, 4082, 12, 849, 29, 797, 12, 7854, 29, 797, 9, 523, 4928, 275, 12309, 8, 697, 14, 4547, 8, 697, 14, 1558, 395, 283, 9184, 358, 819, 10576, 15256, 275, 1592, 14, 11704, 8, 489, 283, 23601, 297, 23412, 534, 6815, 297, 22809, 534, 452, 12, 3145, 13, 22161, 358, 819, 485, 4763, 63, 3288, 275, 359, 489, 283, 5091, 297, 489, 283, 3844, 15256, 297, 489, 283, 4239, 297, 523, 1622, 523, 485, 2613, 63, 4614, 275, 942, 523, 485, 8602, 275, 469, 489, 298, 633, 582, 298, 9184, 2851, 401, 489, 298, 27169, 582, 488, 12, 489, 298, 6815, 63, 4597, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 2988, 401, 881, 298, 19900, 582, 715, 12, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 4597, 401, 489, 1660, 489, 298, 6815, 63, 7515, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 10423, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 7515, 401, 489, 1660, 489, 298, 6815, 63, 5503, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 5929, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 5503, 401, 489, 1660, 489, 298, 6815, 63, 11663, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 1944, 11003, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 11663, 401, 489, 1660, 523, 789, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 4597, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 14919, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 7515, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 10423, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 5503, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 5929, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 11663, 8, 1886, 12, 11944, 304, 272, 372, 6935, 7344, 14, 1131, 14, 904, 8, 7344, 680, 1541, 8, 489, 334, 1692, 7344, 14, 5484, 461, 63, 466, 508, 298, 9184, 531, 1253, 489, 334, 1692, 7344, 14, 5484, 461, 63, 344, 508, 843, 14, 344, 9, 1253, 489, 334, 14463, 8, 7344, 14, 2123, 9, 1204, 11944, 8, 7344, 14, 354, 430, 272, 7092, 2444, 342, 819, 768, 3744, 523, 347, 21719, 63, 1131, 8, 1886, 304, 272, 687, 8335, 492, 9813, 339, 1827, 275, 1613, 8, 9184, 12, 843, 680, 10283, 63, 1131, 342, 272, 372, 843, 14, 10283, 63, 262, 18540, 8, 1131, 12, 18841, 423, 2613, 63, 4614, 680, 1419, 8, 267, 9813, 14, 23912, 912, 360, 3844, 15256, 1333, 199, 199, 3885, 63, 929, 63, 509, 63, 533, 8, 9184, 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 ]
[ 1898, 334, 35, 9, 6171, 4475, 3277, 2020, 11462, 12, 436, 8417, 665, 3239, 10610, 570, 30, 199, 3, 3909, 1334, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 665, 3239, 5113, 570, 30, 199, 3, 18208, 4885, 26, 366, 17204, 32, 264, 30283, 3690, 76, 2101, 14, 957, 199, 3, 16593, 8368, 379, 4885, 26, 366, 17204, 32, 264, 30283, 3690, 76, 2101, 14, 957, 199, 199, 504, 486, 71, 1195, 492, 1592, 199, 504, 486, 71, 1195, 14, 992, 14, 1100, 492, 13481, 28492, 2998, 199, 504, 486, 71, 1195, 14, 992, 14, 30192, 492, 12309, 12, 23813, 1692, 12, 4703, 1977, 379, 12, 8388, 17937, 2964, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 3554, 492, 7543, 461, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 4597, 492, 593, 3501, 461, 199, 504, 486, 71, 1195, 14, 992, 14, 785, 63, 5484, 492, 8028, 461, 12, 6935, 7344, 199, 504, 486, 71, 1195, 14, 992, 14, 5484, 492, 8028, 199, 504, 486, 71, 1195, 14, 992, 14, 14906, 492, 3882, 2354, 199, 504, 486, 71, 1195, 14, 992, 14, 11704, 492, 9781, 15511, 199, 504, 486, 71, 1195, 14, 992, 14, 3885, 63, 785, 63, 929, 492, 13481, 1692, 2223, 12, 4426, 63, 929, 63, 509, 63, 533, 421, 199, 533, 18841, 8, 6362, 1692, 2223, 12, 8388, 17937, 2964, 12, 7543, 461, 12, 1598, 8028, 461, 12, 9781, 15511, 12, 13481, 28492, 2998, 12, 4703, 1977, 379, 12, 1598, 593, 3501, 461, 12, 23813, 1692, 12, 1592, 14, 1685, 304, 523, 636, 10983, 363, 275, 283, 28464, 7, 819, 1804, 568, 3177, 275, 788, 29489, 418, 523, 1804, 568, 3177, 63, 40, 22436, 275, 788, 16063, 29001, 18141, 418, 819, 5726, 275, 1592, 14, 4547, 8, 697, 14, 4082, 12, 849, 29, 797, 12, 7854, 29, 797, 9, 523, 4928, 275, 12309, 8, 697, 14, 4547, 8, 697, 14, 1558, 395, 283, 9184, 358, 819, 10576, 15256, 275, 1592, 14, 11704, 8, 489, 283, 23601, 297, 23412, 534, 6815, 297, 22809, 534, 452, 12, 3145, 13, 22161, 358, 819, 485, 4763, 63, 3288, 275, 359, 489, 283, 5091, 297, 489, 283, 3844, 15256, 297, 489, 283, 4239, 297, 523, 1622, 523, 485, 2613, 63, 4614, 275, 942, 523, 485, 8602, 275, 469, 489, 298, 633, 582, 298, 9184, 2851, 401, 489, 298, 27169, 582, 488, 12, 489, 298, 6815, 63, 4597, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 2988, 401, 881, 298, 19900, 582, 715, 12, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 4597, 401, 489, 1660, 489, 298, 6815, 63, 7515, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 10423, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 7515, 401, 489, 1660, 489, 298, 6815, 63, 5503, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 5929, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 5503, 401, 489, 1660, 489, 298, 6815, 63, 11663, 582, 469, 881, 298, 2918, 63, 354, 582, 298, 1944, 11003, 401, 881, 298, 466, 582, 3882, 2354, 14, 804, 14, 3791, 63, 15468, 12, 881, 298, 1541, 63, 991, 582, 2668, 1541, 63, 991, 63, 6815, 63, 11663, 401, 489, 1660, 523, 789, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 4597, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 14919, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 7515, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 10423, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 5503, 8, 1886, 12, 11944, 304, 272, 372, 843, 423, 1541, 63, 991, 63, 3756, 480, 9184, 5929, 401, 11944, 9, 819, 768, 3744, 523, 347, 485, 1541, 63, 991, 63, 6815, 63, 11663, 8, 1886, 12, 11944, 304, 272, 372, 6935, 7344, 14, 1131, 14, 904, 8, 7344, 680, 1541, 8, 489, 334, 1692, 7344, 14, 5484, 461, 63, 466, 508, 298, 9184, 531, 1253, 489, 334, 1692, 7344, 14, 5484, 461, 63, 344, 508, 843, 14, 344, 9, 1253, 489, 334, 14463, 8, 7344, 14, 2123, 9, 1204, 11944, 8, 7344, 14, 354, 430, 272, 7092, 2444, 342, 819, 768, 3744, 523, 347, 21719, 63, 1131, 8, 1886, 304, 272, 687, 8335, 492, 9813, 339, 1827, 275, 1613, 8, 9184, 12, 843, 680, 10283, 63, 1131, 342, 272, 372, 843, 14, 10283, 63, 262, 18540, 8, 1131, 12, 18841, 423, 2613, 63, 4614, 680, 1419, 8, 267, 9813, 14, 23912, 912, 360, 3844, 15256, 1333, 199, 199, 3885, 63, 929, 63, 509, 63, 533, 8, 9184, 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, 32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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 ]
katstalk/android_external_chromium_org
tools/perf/measurements/memory_multi_tab.py
23
1619
# Copyright 2013 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. """Multi tab memory test. This test is a multi tab test, but we're interested in measurements for the entire test rather than each single page. """ from metrics import memory from telemetry.page import page_measurement class MemoryMultiTab(page_measurement.PageMeasurement): def __init__(self, *args, **kwargs): super(MemoryMultiTab, self).__init__(*args, **kwargs) self._memory_metric = None # _first_tab is used to make memory measurements self._first_tab = None def DidStartBrowser(self, browser): self._memory_metric = memory.MemoryMetric(browser) def CustomizeBrowserOptions(self, options): memory.MemoryMetric.CustomizeBrowserOptions(options) # Since this is a memory benchmark, we want to sample memory histograms at # a high frequency. options.AppendExtraBrowserArgs('--memory-metrics') def TabForPage(self, page, browser): return browser.tabs.New() def DidNavigateToPage(self, page, tab): # Start measurement on the first tab. if not self._first_tab: self._memory_metric.Start(page, tab) self._first_tab = tab def MeasurePage(self, page, tab, results): # Finalize measurement on the last tab. if len(tab.browser.tabs) == len(page.page_set.pages): self._memory_metric.Stop(page, self._first_tab) self._memory_metric.AddResults(self._first_tab, results) def DidRunTest(self, browser, results): self._memory_metric.AddSummaryResults(results)
bsd-3-clause
[ 3, 1898, 6171, 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, 624, 3947, 5174, 4402, 511, 14, 199, 199, 2765, 511, 365, 282, 3510, 5174, 511, 12, 1325, 781, 3984, 22201, 315, 32619, 367, 199, 1589, 8039, 511, 7830, 2419, 1924, 2849, 2034, 14, 199, 624, 421, 199, 504, 7186, 492, 4402, 199, 504, 17298, 14, 1606, 492, 2034, 63, 17912, 199, 199, 533, 15825, 3947, 7690, 8, 1606, 63, 17912, 14, 3276, 18611, 434, 304, 523, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 272, 1613, 8, 8628, 3947, 7690, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 272, 291, 423, 4844, 63, 5165, 275, 488, 272, 327, 485, 2246, 63, 2902, 365, 1202, 370, 1852, 4402, 32619, 272, 291, 423, 2246, 63, 2902, 275, 488, 819, 347, 29503, 3162, 11930, 8, 277, 12, 7042, 304, 272, 291, 423, 4844, 63, 5165, 275, 4402, 14, 8628, 11119, 8, 5750, 9, 819, 347, 8388, 794, 11930, 4558, 8, 277, 12, 1511, 304, 272, 4402, 14, 8628, 11119, 14, 7223, 794, 11930, 4558, 8, 1419, 9, 272, 327, 9336, 642, 365, 282, 4402, 12338, 12, 781, 2934, 370, 2690, 4402, 394, 22137, 737, 272, 327, 282, 4721, 9857, 14, 272, 1511, 14, 8310, 7426, 11930, 6213, 4517, 4844, 13, 6759, 358, 819, 347, 23159, 1858, 3276, 8, 277, 12, 2034, 12, 7042, 304, 272, 372, 7042, 14, 8741, 14, 4665, 342, 819, 347, 29503, 31914, 1378, 3276, 8, 277, 12, 2034, 12, 5174, 304, 272, 327, 7707, 18216, 641, 314, 1642, 5174, 14, 272, 340, 440, 291, 423, 2246, 63, 2902, 26, 489, 291, 423, 4844, 63, 5165, 14, 3162, 8, 1606, 12, 5174, 9, 489, 291, 423, 2246, 63, 2902, 275, 5174, 819, 347, 22933, 3276, 8, 277, 12, 2034, 12, 5174, 12, 2058, 304, 272, 327, 21789, 794, 18216, 641, 314, 2061, 5174, 14, 272, 340, 822, 8, 2902, 14, 5750, 14, 8741, 9, 508, 822, 8, 1606, 14, 1606, 63, 409, 14, 5856, 304, 489, 291, 423, 4844, 63, 5165, 14, 6293, 8, 1606, 12, 291, 423, 2246, 63, 2902, 9, 489, 291, 423, 4844, 63, 5165, 14, 1123, 6579, 8, 277, 423, 2246, 63, 2902, 12, 2058, 9, 819, 347, 29503, 2540, 774, 8, 277, 12, 7042, 12, 2058, 304, 272, 291, 423, 4844, 63, 5165, 14, 1123, 10407, 6579, 8, 2604, 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 ]
[ 1898, 6171, 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, 624, 3947, 5174, 4402, 511, 14, 199, 199, 2765, 511, 365, 282, 3510, 5174, 511, 12, 1325, 781, 3984, 22201, 315, 32619, 367, 199, 1589, 8039, 511, 7830, 2419, 1924, 2849, 2034, 14, 199, 624, 421, 199, 504, 7186, 492, 4402, 199, 504, 17298, 14, 1606, 492, 2034, 63, 17912, 199, 199, 533, 15825, 3947, 7690, 8, 1606, 63, 17912, 14, 3276, 18611, 434, 304, 523, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 272, 1613, 8, 8628, 3947, 7690, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 272, 291, 423, 4844, 63, 5165, 275, 488, 272, 327, 485, 2246, 63, 2902, 365, 1202, 370, 1852, 4402, 32619, 272, 291, 423, 2246, 63, 2902, 275, 488, 819, 347, 29503, 3162, 11930, 8, 277, 12, 7042, 304, 272, 291, 423, 4844, 63, 5165, 275, 4402, 14, 8628, 11119, 8, 5750, 9, 819, 347, 8388, 794, 11930, 4558, 8, 277, 12, 1511, 304, 272, 4402, 14, 8628, 11119, 14, 7223, 794, 11930, 4558, 8, 1419, 9, 272, 327, 9336, 642, 365, 282, 4402, 12338, 12, 781, 2934, 370, 2690, 4402, 394, 22137, 737, 272, 327, 282, 4721, 9857, 14, 272, 1511, 14, 8310, 7426, 11930, 6213, 4517, 4844, 13, 6759, 358, 819, 347, 23159, 1858, 3276, 8, 277, 12, 2034, 12, 7042, 304, 272, 372, 7042, 14, 8741, 14, 4665, 342, 819, 347, 29503, 31914, 1378, 3276, 8, 277, 12, 2034, 12, 5174, 304, 272, 327, 7707, 18216, 641, 314, 1642, 5174, 14, 272, 340, 440, 291, 423, 2246, 63, 2902, 26, 489, 291, 423, 4844, 63, 5165, 14, 3162, 8, 1606, 12, 5174, 9, 489, 291, 423, 2246, 63, 2902, 275, 5174, 819, 347, 22933, 3276, 8, 277, 12, 2034, 12, 5174, 12, 2058, 304, 272, 327, 21789, 794, 18216, 641, 314, 2061, 5174, 14, 272, 340, 822, 8, 2902, 14, 5750, 14, 8741, 9, 508, 822, 8, 1606, 14, 1606, 63, 409, 14, 5856, 304, 489, 291, 423, 4844, 63, 5165, 14, 6293, 8, 1606, 12, 291, 423, 2246, 63, 2902, 9, 489, 291, 423, 4844, 63, 5165, 14, 1123, 6579, 8, 277, 423, 2246, 63, 2902, 12, 2058, 9, 819, 347, 29503, 2540, 774, 8, 277, 12, 7042, 12, 2058, 304, 272, 291, 423, 4844, 63, 5165, 14, 1123, 10407, 6579, 8, 2604, 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, 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, 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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 ]
luzfcb/cookiecutter-django
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py
1
2441
import pytest from django.contrib.auth.models import AnonymousUser from django.http.response import Http404 from django.test import RequestFactory from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory from {{ cookiecutter.project_slug }}.users.views import ( UserRedirectView, UserUpdateView, user_detail_view, ) pytestmark = pytest.mark.django_db class TestUserUpdateView: """ TODO: extracting view initialization code as class-scoped fixture would be great if only pytest-django supported non-function-scoped fixture db access -- this is a work-in-progress for now: https://github.com/pytest-dev/pytest-django/pull/258 """ def test_get_success_url(self, user: User, rf: RequestFactory): view = UserUpdateView() request = rf.get("/fake-url/") request.user = user view.request = request assert view.get_success_url() == f"/users/{user.username}/" def test_get_object(self, user: User, rf: RequestFactory): view = UserUpdateView() request = rf.get("/fake-url/") request.user = user view.request = request assert view.get_object() == user class TestUserRedirectView: def test_get_redirect_url(self, user: User, rf: RequestFactory): view = UserRedirectView() request = rf.get("/fake-url") request.user = user view.request = request assert view.get_redirect_url() == f"/users/{user.username}/" class TestUserDetailView: def test_authenticated(self, user: User, rf: RequestFactory): request = rf.get("/fake-url/") request.user = UserFactory() response = user_detail_view(request, username=user.username) assert response.status_code == 200 def test_not_authenticated(self, user: User, rf: RequestFactory): request = rf.get("/fake-url/") request.user = AnonymousUser() response = user_detail_view(request, username=user.username) assert response.status_code == 302 assert response.url == "/accounts/login/?next=/fake-url/" def test_case_sensitivity(self, rf: RequestFactory): request = rf.get("/fake-url/") request.user = UserFactory(username="UserName") with pytest.raises(Http404): user_detail_view(request, username="username")
bsd-3-clause
[ 646, 4613, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 29952, 199, 504, 1639, 14, 1014, 14, 1310, 492, 4760, 5188, 199, 504, 1639, 14, 396, 492, 18638, 199, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 992, 492, 2876, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 2219, 14, 15406, 492, 16047, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 4196, 492, 334, 272, 2876, 7071, 2768, 12, 272, 2876, 4152, 2768, 12, 272, 922, 63, 5506, 63, 1345, 12, 199, 9, 199, 199, 4462, 1657, 275, 4613, 14, 1657, 14, 1176, 63, 697, 421, 199, 533, 1379, 1899, 4152, 2768, 26, 272, 408, 272, 3254, 26, 267, 30137, 2455, 11097, 1233, 465, 1021, 13, 23254, 10949, 267, 3955, 506, 27254, 340, 1454, 4613, 13, 1176, 3748, 2222, 13, 1593, 13, 23254, 267, 10949, 1592, 2879, 1553, 642, 365, 282, 1736, 13, 262, 13, 5734, 367, 3063, 26, 267, 4178, 921, 5031, 14, 957, 15, 4462, 13, 2374, 15, 4462, 13, 1176, 15, 9302, 15, 12234, 272, 408, 339, 347, 511, 63, 362, 63, 3742, 63, 633, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 4152, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 3742, 63, 633, 342, 508, 289, 15313, 3707, 5321, 751, 14, 2473, 5995, 2, 339, 347, 511, 63, 362, 63, 785, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 4152, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 785, 342, 508, 922, 421, 199, 533, 1379, 1899, 7071, 2768, 26, 272, 347, 511, 63, 362, 63, 4876, 63, 633, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 7071, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 531, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 4876, 63, 633, 342, 508, 289, 15313, 3707, 5321, 751, 14, 2473, 5995, 2, 421, 199, 533, 1379, 1899, 28539, 26, 272, 347, 511, 63, 12177, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 16047, 342, 398, 1177, 275, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 29, 751, 14, 2473, 9, 398, 702, 1177, 14, 1205, 63, 600, 508, 1926, 339, 347, 511, 63, 1397, 63, 12177, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 29952, 342, 398, 1177, 275, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 29, 751, 14, 2473, 9, 398, 702, 1177, 14, 1205, 63, 600, 508, 11485, 267, 702, 1177, 14, 633, 508, 3286, 8370, 15, 2886, 10197, 2184, 13043, 3183, 13, 633, 6687, 339, 347, 511, 63, 2546, 63, 2464, 20635, 8, 277, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 16047, 8, 2473, 628, 25108, 531, 398, 543, 4613, 14, 3536, 8, 5779, 5188, 304, 288, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 628, 2473, 531, 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 ]
[ 4613, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 29952, 199, 504, 1639, 14, 1014, 14, 1310, 492, 4760, 5188, 199, 504, 1639, 14, 396, 492, 18638, 199, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 992, 492, 2876, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 2219, 14, 15406, 492, 16047, 199, 504, 8448, 512, 745, 73, 825, 18404, 14, 1715, 63, 5464, 3586, 14, 3707, 14, 4196, 492, 334, 272, 2876, 7071, 2768, 12, 272, 2876, 4152, 2768, 12, 272, 922, 63, 5506, 63, 1345, 12, 199, 9, 199, 199, 4462, 1657, 275, 4613, 14, 1657, 14, 1176, 63, 697, 421, 199, 533, 1379, 1899, 4152, 2768, 26, 272, 408, 272, 3254, 26, 267, 30137, 2455, 11097, 1233, 465, 1021, 13, 23254, 10949, 267, 3955, 506, 27254, 340, 1454, 4613, 13, 1176, 3748, 2222, 13, 1593, 13, 23254, 267, 10949, 1592, 2879, 1553, 642, 365, 282, 1736, 13, 262, 13, 5734, 367, 3063, 26, 267, 4178, 921, 5031, 14, 957, 15, 4462, 13, 2374, 15, 4462, 13, 1176, 15, 9302, 15, 12234, 272, 408, 339, 347, 511, 63, 362, 63, 3742, 63, 633, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 4152, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 3742, 63, 633, 342, 508, 289, 15313, 3707, 5321, 751, 14, 2473, 5995, 2, 339, 347, 511, 63, 362, 63, 785, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 4152, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 785, 342, 508, 922, 421, 199, 533, 1379, 1899, 7071, 2768, 26, 272, 347, 511, 63, 362, 63, 4876, 63, 633, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 2455, 275, 2876, 7071, 2768, 342, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 531, 267, 1056, 14, 751, 275, 922, 398, 2455, 14, 1069, 275, 1056, 398, 702, 2455, 14, 362, 63, 4876, 63, 633, 342, 508, 289, 15313, 3707, 5321, 751, 14, 2473, 5995, 2, 421, 199, 533, 1379, 1899, 28539, 26, 272, 347, 511, 63, 12177, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 16047, 342, 398, 1177, 275, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 29, 751, 14, 2473, 9, 398, 702, 1177, 14, 1205, 63, 600, 508, 1926, 339, 347, 511, 63, 1397, 63, 12177, 8, 277, 12, 922, 26, 2876, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 29952, 342, 398, 1177, 275, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 29, 751, 14, 2473, 9, 398, 702, 1177, 14, 1205, 63, 600, 508, 11485, 267, 702, 1177, 14, 633, 508, 3286, 8370, 15, 2886, 10197, 2184, 13043, 3183, 13, 633, 6687, 339, 347, 511, 63, 2546, 63, 2464, 20635, 8, 277, 12, 17781, 26, 18638, 304, 267, 1056, 275, 17781, 14, 362, 4769, 3183, 13, 633, 13589, 267, 1056, 14, 751, 275, 16047, 8, 2473, 628, 25108, 531, 398, 543, 4613, 14, 3536, 8, 5779, 5188, 304, 288, 922, 63, 5506, 63, 1345, 8, 1069, 12, 3434, 628, 2473, 531, 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, 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, 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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 ]
bdfoster/blumate
blumate/components/sensor/thinkingcleaner.py
1
3570
"""Support for ThinkingCleaner.""" import logging from datetime import timedelta import blumate.util as util from blumate.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['https://github.com/TheRealLink/pythinkingcleaner' '/archive/v0.0.2.zip' '#pythinkingcleaner==0.0.2'] MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100) SENSOR_TYPES = { 'battery': ['Battery', '%', 'mdi:battery'], 'state': ['State', None, None], 'capacity': ['Capacity', None, None], } STATES = { 'st_base': 'On homebase: Not Charging', 'st_base_recon': 'On homebase: Reconditioning Charging', 'st_base_full': 'On homebase: Full Charging', 'st_base_trickle': 'On homebase: Trickle Charging', 'st_base_wait': 'On homebase: Waiting', 'st_plug': 'Plugged in: Not Charging', 'st_plug_recon': 'Plugged in: Reconditioning Charging', 'st_plug_full': 'Plugged in: Full Charging', 'st_plug_trickle': 'Plugged in: Trickle Charging', 'st_plug_wait': 'Plugged in: Waiting', 'st_stopped': 'Stopped', 'st_clean': 'Cleaning', 'st_cleanstop': 'Stopped with cleaning', 'st_clean_spot': 'Spot cleaning', 'st_clean_max': 'Max cleaning', 'st_delayed': 'Delayed cleaning will start soon', 'st_dock': 'Searching Homebase', 'st_pickup': 'Roomba picked up', 'st_remote': 'Remote control driving', 'st_wait': 'Waiting for command', 'st_off': 'Off', 'st_error': 'Error', 'st_locate': 'Find me!', 'st_unknown': 'Unknown state', } def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the ThinkingCleaner platform.""" from pythinkingcleaner import Discovery discovery = Discovery() devices = discovery.discover() @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS) def update_devices(): """Update all devices.""" for device_object in devices: device_object.update() dev = [] for device in devices: for type_name in SENSOR_TYPES.keys(): dev.append(ThinkingCleanerSensor(device, type_name, update_devices)) add_devices(dev) class ThinkingCleanerSensor(Entity): """ThinkingCleaner Sensor.""" def __init__(self, tc_object, sensor_type, update_devices): """Initialize the ThinkingCleaner.""" self.type = sensor_type self._tc_object = tc_object self._update_devices = update_devices self._unit_of_measurement = SENSOR_TYPES[sensor_type][1] self._state = None @property def name(self): """Return the name of the sensor.""" return self._tc_object.name + ' ' + SENSOR_TYPES[self.type][0] @property def icon(self): """Icon to use in the frontend, if any.""" return SENSOR_TYPES[self.type][2] @property def state(self): """Return the state of the device.""" return self._state @property def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement def update(self): """Update the sensor.""" self._update_devices() if self.type == 'battery': self._state = self._tc_object.battery elif self.type == 'state': self._state = STATES[self._tc_object.status] elif self.type == 'capacity': self._state = self._tc_object.capacity
mit
[ 624, 11532, 367, 3868, 2292, 316, 6580, 281, 1041, 199, 646, 2050, 199, 504, 2197, 492, 6871, 199, 199, 646, 6826, 453, 323, 14, 1974, 465, 4884, 199, 504, 6826, 453, 323, 14, 7546, 14, 4502, 492, 17680, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 29168, 20967, 275, 788, 2859, 921, 5031, 14, 957, 15, 1918, 10099, 3834, 15, 647, 29727, 316, 3118, 281, 7, 355, 1994, 6404, 15, 86, 16, 14, 16, 14, 18, 14, 3065, 7, 355, 3943, 647, 29727, 316, 3118, 281, 389, 16, 14, 16, 14, 18, 418, 199, 199, 4896, 63, 4961, 63, 34, 29056, 63, 5153, 5622, 275, 6871, 8, 4515, 29, 709, 9, 199, 4896, 63, 4961, 63, 34, 29056, 63, 2707, 25927, 63, 5153, 5622, 275, 6871, 8, 19579, 4515, 29, 1960, 9, 199, 199, 24151, 63, 7893, 275, 469, 272, 283, 21113, 356, 788, 34, 13891, 297, 1543, 297, 283, 20208, 26, 21113, 995, 272, 283, 929, 356, 788, 2223, 297, 488, 12, 488, 467, 272, 283, 10457, 356, 788, 22688, 297, 488, 12, 488, 467, 199, 93, 199, 199, 23162, 275, 469, 272, 283, 270, 63, 1095, 356, 283, 3314, 5629, 1095, 26, 2832, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 25981, 356, 283, 3314, 5629, 1095, 26, 799, 5394, 316, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 2861, 356, 283, 3314, 5629, 1095, 26, 16579, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 599, 346, 274, 356, 283, 3314, 5629, 1095, 26, 12480, 346, 274, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 2573, 356, 283, 3314, 5629, 1095, 26, 13144, 316, 297, 272, 283, 270, 63, 13963, 356, 283, 19173, 3046, 315, 26, 2832, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 25981, 356, 283, 19173, 3046, 315, 26, 799, 5394, 316, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 2861, 356, 283, 19173, 3046, 315, 26, 16579, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 599, 346, 274, 356, 283, 19173, 3046, 315, 26, 12480, 346, 274, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 2573, 356, 283, 19173, 3046, 315, 26, 13144, 316, 297, 272, 283, 270, 63, 14661, 356, 283, 28500, 297, 272, 283, 270, 63, 3118, 356, 283, 6580, 316, 297, 272, 283, 270, 63, 3118, 2379, 356, 283, 28500, 543, 29579, 297, 272, 283, 270, 63, 3118, 63, 15185, 356, 283, 5058, 357, 29579, 297, 272, 283, 270, 63, 3118, 63, 988, 356, 283, 4261, 29579, 297, 272, 283, 270, 63, 21830, 356, 283, 10796, 379, 29579, 911, 1343, 18930, 297, 272, 283, 270, 63, 21103, 356, 283, 5278, 316, 14621, 1095, 297, 272, 283, 270, 63, 4510, 384, 356, 283, 25779, 2470, 29438, 1536, 297, 272, 283, 270, 63, 3846, 356, 283, 6713, 3304, 20921, 4007, 297, 272, 283, 270, 63, 2573, 356, 283, 19189, 367, 1414, 297, 272, 283, 270, 63, 1997, 356, 283, 5195, 297, 272, 283, 270, 63, 705, 356, 283, 547, 297, 272, 283, 270, 63, 6280, 356, 283, 6591, 562, 12389, 272, 283, 270, 63, 5187, 356, 283, 5912, 1174, 297, 199, 93, 421, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 314, 3868, 2292, 316, 6580, 281, 4298, 1041, 272, 687, 1134, 29727, 316, 3118, 281, 492, 5289, 6913, 339, 13172, 275, 5289, 6913, 342, 272, 7256, 275, 13172, 14, 18861, 342, 339, 768, 1974, 14, 26192, 8, 4896, 63, 4961, 63, 34, 29056, 63, 5153, 5622, 12, 15861, 63, 4961, 63, 34, 29056, 63, 2707, 25927, 63, 5153, 5622, 9, 272, 347, 1678, 63, 6410, 837, 267, 408, 4152, 1006, 7256, 1041, 267, 367, 2243, 63, 785, 315, 7256, 26, 288, 2243, 63, 785, 14, 873, 342, 339, 4866, 275, 942, 272, 367, 2243, 315, 7256, 26, 267, 367, 730, 63, 354, 315, 428, 17850, 63, 7893, 14, 1612, 837, 288, 4866, 14, 740, 8, 2719, 2292, 316, 6580, 281, 10160, 8, 1782, 12, 730, 63, 354, 12, 6163, 1678, 63, 6410, 430, 339, 1050, 63, 6410, 8, 2374, 9, 421, 199, 533, 3868, 2292, 316, 6580, 281, 10160, 8, 7302, 304, 272, 408, 2719, 2292, 316, 6580, 281, 18474, 1041, 339, 347, 636, 826, 721, 277, 12, 14415, 63, 785, 12, 8778, 63, 466, 12, 1678, 63, 6410, 304, 267, 408, 9345, 314, 3868, 2292, 316, 6580, 281, 1041, 267, 291, 14, 466, 275, 8778, 63, 466, 398, 291, 423, 3641, 63, 785, 275, 14415, 63, 785, 267, 291, 423, 873, 63, 6410, 275, 1678, 63, 6410, 267, 291, 423, 3248, 63, 1618, 63, 17912, 275, 428, 17850, 63, 7893, 59, 8956, 63, 466, 1527, 17, 61, 267, 291, 423, 929, 275, 488, 339, 768, 1829, 272, 347, 536, 8, 277, 304, 267, 408, 1767, 314, 536, 402, 314, 8778, 1041, 267, 372, 291, 423, 3641, 63, 785, 14, 354, 435, 283, 283, 435, 428, 17850, 63, 7893, 59, 277, 14, 466, 1527, 16, 61, 339, 768, 1829, 272, 347, 7016, 8, 277, 304, 267, 408, 8954, 370, 675, 315, 314, 22523, 12, 340, 1263, 1041, 267, 372, 428, 17850, 63, 7893, 59, 277, 14, 466, 1527, 18, 61, 339, 768, 1829, 272, 347, 1174, 8, 277, 304, 267, 408, 1767, 314, 1174, 402, 314, 2243, 1041, 267, 372, 291, 423, 929, 339, 768, 1829, 272, 347, 4137, 63, 1618, 63, 17912, 8, 277, 304, 267, 408, 1767, 314, 4137, 402, 18216, 402, 642, 4642, 12, 340, 1263, 1041, 267, 372, 291, 423, 3248, 63, 1618, 63, 17912, 339, 347, 1678, 8, 277, 304, 267, 408, 4152, 314, 8778, 1041, 267, 291, 423, 873, 63, 6410, 342, 398, 340, 291, 14, 466, 508, 283, 21113, 356, 288, 291, 423, 929, 275, 291, 423, 3641, 63, 785, 14, 21113, 267, 916, 291, 14, 466, 508, 283, 929, 356, 288, 291, 423, 929, 275, 13146, 654, 59, 277, 423, 3641, 63, 785, 14, 1205, 61, 267, 916, 291, 14, 466, 508, 283, 10457, 356, 288, 291, 423, 929, 275, 291, 423, 3641, 63, 785, 14, 10457, 199, 32768, 32768, 32768, 32768 ]
[ 11532, 367, 3868, 2292, 316, 6580, 281, 1041, 199, 646, 2050, 199, 504, 2197, 492, 6871, 199, 199, 646, 6826, 453, 323, 14, 1974, 465, 4884, 199, 504, 6826, 453, 323, 14, 7546, 14, 4502, 492, 17680, 199, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 29168, 20967, 275, 788, 2859, 921, 5031, 14, 957, 15, 1918, 10099, 3834, 15, 647, 29727, 316, 3118, 281, 7, 355, 1994, 6404, 15, 86, 16, 14, 16, 14, 18, 14, 3065, 7, 355, 3943, 647, 29727, 316, 3118, 281, 389, 16, 14, 16, 14, 18, 418, 199, 199, 4896, 63, 4961, 63, 34, 29056, 63, 5153, 5622, 275, 6871, 8, 4515, 29, 709, 9, 199, 4896, 63, 4961, 63, 34, 29056, 63, 2707, 25927, 63, 5153, 5622, 275, 6871, 8, 19579, 4515, 29, 1960, 9, 199, 199, 24151, 63, 7893, 275, 469, 272, 283, 21113, 356, 788, 34, 13891, 297, 1543, 297, 283, 20208, 26, 21113, 995, 272, 283, 929, 356, 788, 2223, 297, 488, 12, 488, 467, 272, 283, 10457, 356, 788, 22688, 297, 488, 12, 488, 467, 199, 93, 199, 199, 23162, 275, 469, 272, 283, 270, 63, 1095, 356, 283, 3314, 5629, 1095, 26, 2832, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 25981, 356, 283, 3314, 5629, 1095, 26, 799, 5394, 316, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 2861, 356, 283, 3314, 5629, 1095, 26, 16579, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 599, 346, 274, 356, 283, 3314, 5629, 1095, 26, 12480, 346, 274, 2799, 1273, 316, 297, 272, 283, 270, 63, 1095, 63, 2573, 356, 283, 3314, 5629, 1095, 26, 13144, 316, 297, 272, 283, 270, 63, 13963, 356, 283, 19173, 3046, 315, 26, 2832, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 25981, 356, 283, 19173, 3046, 315, 26, 799, 5394, 316, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 2861, 356, 283, 19173, 3046, 315, 26, 16579, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 599, 346, 274, 356, 283, 19173, 3046, 315, 26, 12480, 346, 274, 2799, 1273, 316, 297, 272, 283, 270, 63, 13963, 63, 2573, 356, 283, 19173, 3046, 315, 26, 13144, 316, 297, 272, 283, 270, 63, 14661, 356, 283, 28500, 297, 272, 283, 270, 63, 3118, 356, 283, 6580, 316, 297, 272, 283, 270, 63, 3118, 2379, 356, 283, 28500, 543, 29579, 297, 272, 283, 270, 63, 3118, 63, 15185, 356, 283, 5058, 357, 29579, 297, 272, 283, 270, 63, 3118, 63, 988, 356, 283, 4261, 29579, 297, 272, 283, 270, 63, 21830, 356, 283, 10796, 379, 29579, 911, 1343, 18930, 297, 272, 283, 270, 63, 21103, 356, 283, 5278, 316, 14621, 1095, 297, 272, 283, 270, 63, 4510, 384, 356, 283, 25779, 2470, 29438, 1536, 297, 272, 283, 270, 63, 3846, 356, 283, 6713, 3304, 20921, 4007, 297, 272, 283, 270, 63, 2573, 356, 283, 19189, 367, 1414, 297, 272, 283, 270, 63, 1997, 356, 283, 5195, 297, 272, 283, 270, 63, 705, 356, 283, 547, 297, 272, 283, 270, 63, 6280, 356, 283, 6591, 562, 12389, 272, 283, 270, 63, 5187, 356, 283, 5912, 1174, 297, 199, 93, 421, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 314, 3868, 2292, 316, 6580, 281, 4298, 1041, 272, 687, 1134, 29727, 316, 3118, 281, 492, 5289, 6913, 339, 13172, 275, 5289, 6913, 342, 272, 7256, 275, 13172, 14, 18861, 342, 339, 768, 1974, 14, 26192, 8, 4896, 63, 4961, 63, 34, 29056, 63, 5153, 5622, 12, 15861, 63, 4961, 63, 34, 29056, 63, 2707, 25927, 63, 5153, 5622, 9, 272, 347, 1678, 63, 6410, 837, 267, 408, 4152, 1006, 7256, 1041, 267, 367, 2243, 63, 785, 315, 7256, 26, 288, 2243, 63, 785, 14, 873, 342, 339, 4866, 275, 942, 272, 367, 2243, 315, 7256, 26, 267, 367, 730, 63, 354, 315, 428, 17850, 63, 7893, 14, 1612, 837, 288, 4866, 14, 740, 8, 2719, 2292, 316, 6580, 281, 10160, 8, 1782, 12, 730, 63, 354, 12, 6163, 1678, 63, 6410, 430, 339, 1050, 63, 6410, 8, 2374, 9, 421, 199, 533, 3868, 2292, 316, 6580, 281, 10160, 8, 7302, 304, 272, 408, 2719, 2292, 316, 6580, 281, 18474, 1041, 339, 347, 636, 826, 721, 277, 12, 14415, 63, 785, 12, 8778, 63, 466, 12, 1678, 63, 6410, 304, 267, 408, 9345, 314, 3868, 2292, 316, 6580, 281, 1041, 267, 291, 14, 466, 275, 8778, 63, 466, 398, 291, 423, 3641, 63, 785, 275, 14415, 63, 785, 267, 291, 423, 873, 63, 6410, 275, 1678, 63, 6410, 267, 291, 423, 3248, 63, 1618, 63, 17912, 275, 428, 17850, 63, 7893, 59, 8956, 63, 466, 1527, 17, 61, 267, 291, 423, 929, 275, 488, 339, 768, 1829, 272, 347, 536, 8, 277, 304, 267, 408, 1767, 314, 536, 402, 314, 8778, 1041, 267, 372, 291, 423, 3641, 63, 785, 14, 354, 435, 283, 283, 435, 428, 17850, 63, 7893, 59, 277, 14, 466, 1527, 16, 61, 339, 768, 1829, 272, 347, 7016, 8, 277, 304, 267, 408, 8954, 370, 675, 315, 314, 22523, 12, 340, 1263, 1041, 267, 372, 428, 17850, 63, 7893, 59, 277, 14, 466, 1527, 18, 61, 339, 768, 1829, 272, 347, 1174, 8, 277, 304, 267, 408, 1767, 314, 1174, 402, 314, 2243, 1041, 267, 372, 291, 423, 929, 339, 768, 1829, 272, 347, 4137, 63, 1618, 63, 17912, 8, 277, 304, 267, 408, 1767, 314, 4137, 402, 18216, 402, 642, 4642, 12, 340, 1263, 1041, 267, 372, 291, 423, 3248, 63, 1618, 63, 17912, 339, 347, 1678, 8, 277, 304, 267, 408, 4152, 314, 8778, 1041, 267, 291, 423, 873, 63, 6410, 342, 398, 340, 291, 14, 466, 508, 283, 21113, 356, 288, 291, 423, 929, 275, 291, 423, 3641, 63, 785, 14, 21113, 267, 916, 291, 14, 466, 508, 283, 929, 356, 288, 291, 423, 929, 275, 13146, 654, 59, 277, 423, 3641, 63, 785, 14, 1205, 61, 267, 916, 291, 14, 466, 508, 283, 10457, 356, 288, 291, 423, 929, 275, 291, 423, 3641, 63, 785, 14, 10457, 199, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
TakayukiSakai/tensorflow
tensorflow/models/embedding/word2vec_test.py
3
2255
# Copyright 2015 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 word2vec module.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import tensorflow as tf from tensorflow.models.embedding import word2vec flags = tf.app.flags FLAGS = flags.FLAGS class Word2VecTest(tf.test.TestCase): def setUp(self): FLAGS.train_data = os.path.join(self.get_temp_dir() + "test-text.txt") FLAGS.eval_data = os.path.join(self.get_temp_dir() + "eval-text.txt") FLAGS.save_path = self.get_temp_dir() with open(FLAGS.train_data, "w") as f: f.write( """alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought alice 'without pictures or conversations?' So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White rabbit with pink eyes ran close by her.\n""") with open(FLAGS.eval_data, "w") as f: f.write("alice she rabbit once\n") def testWord2Vec(self): FLAGS.batch_size = 5 FLAGS.num_neg_samples = 10 FLAGS.epochs_to_train = 1 FLAGS.min_count = 0 word2vec.main([]) if __name__ == "__main__": tf.test.main()
apache-2.0
[ 3, 1898, 6900, 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, 2925, 367, 4349, 18, 6046, 859, 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, 747, 199, 199, 646, 3228, 465, 2833, 199, 199, 504, 3228, 14, 992, 14, 14275, 492, 4349, 18, 6046, 199, 199, 2469, 275, 2833, 14, 571, 14, 2469, 199, 199, 4831, 275, 3285, 14, 4831, 421, 199, 533, 14644, 18, 14373, 774, 8, 3249, 14, 396, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 12846, 14, 2834, 63, 576, 275, 747, 14, 515, 14, 904, 8, 277, 14, 362, 63, 808, 63, 694, 342, 435, 298, 396, 13, 505, 14, 2424, 531, 272, 12846, 14, 2579, 63, 576, 275, 747, 14, 515, 14, 904, 8, 277, 14, 362, 63, 808, 63, 694, 342, 435, 298, 2579, 13, 505, 14, 2424, 531, 272, 12846, 14, 2117, 63, 515, 275, 291, 14, 362, 63, 808, 63, 694, 342, 272, 543, 1551, 8, 4831, 14, 2834, 63, 576, 12, 298, 87, 531, 465, 289, 26, 489, 289, 14, 952, 8, 881, 408, 19179, 1990, 9608, 370, 664, 7437, 3367, 581, 402, 13867, 1337, 701, 14737, 308, 1429, 641, 881, 314, 16297, 12, 436, 402, 9445, 6548, 370, 886, 26, 5403, 503, 13373, 21920, 10530, 299, 1024, 1915, 881, 1901, 314, 6719, 14737, 308, 1429, 1990, 7664, 12, 1325, 652, 10530, 949, 6682, 22004, 503, 881, 3818, 83, 1298, 315, 652, 12, 283, 460, 4052, 365, 314, 675, 402, 282, 6719, 2584, 32463, 741, 1885, 881, 283, 7395, 6682, 22004, 503, 3818, 83, 1298, 14069, 2002, 21920, 1990, 11201, 316, 315, 14737, 5705, 881, 25169, 334, 305, 5521, 465, 21920, 4293, 12, 367, 314, 18469, 5382, 6326, 14737, 23109, 7437, 308, 18387, 647, 881, 436, 410, 31596, 395, 3775, 314, 299, 274, 5457, 402, 10663, 282, 12927, 19765, 13, 4429, 3955, 506, 881, 25235, 314, 29616, 402, 10232, 1536, 436, 12433, 314, 366, 5789, 338, 397, 12, 1380, 308, 1181, 848, 590, 881, 282, 2816, 1175, 29773, 2075, 543, 299, 2292, 325, 5066, 21471, 4002, 701, 14737, 3134, 78, 6141, 489, 543, 1551, 8, 4831, 14, 2579, 63, 576, 12, 298, 87, 531, 465, 289, 26, 267, 289, 14, 952, 480, 19179, 21920, 29773, 2075, 5403, 60, 78, 531, 819, 347, 511, 10155, 18, 14373, 8, 277, 304, 272, 12846, 14, 2912, 63, 890, 275, 959, 272, 12846, 14, 1507, 63, 8705, 63, 3356, 275, 1616, 272, 12846, 14, 13161, 63, 475, 63, 2834, 275, 413, 272, 12846, 14, 827, 63, 835, 275, 378, 272, 4349, 18, 6046, 14, 973, 4157, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 2833, 14, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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, 2925, 367, 4349, 18, 6046, 859, 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, 747, 199, 199, 646, 3228, 465, 2833, 199, 199, 504, 3228, 14, 992, 14, 14275, 492, 4349, 18, 6046, 199, 199, 2469, 275, 2833, 14, 571, 14, 2469, 199, 199, 4831, 275, 3285, 14, 4831, 421, 199, 533, 14644, 18, 14373, 774, 8, 3249, 14, 396, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 12846, 14, 2834, 63, 576, 275, 747, 14, 515, 14, 904, 8, 277, 14, 362, 63, 808, 63, 694, 342, 435, 298, 396, 13, 505, 14, 2424, 531, 272, 12846, 14, 2579, 63, 576, 275, 747, 14, 515, 14, 904, 8, 277, 14, 362, 63, 808, 63, 694, 342, 435, 298, 2579, 13, 505, 14, 2424, 531, 272, 12846, 14, 2117, 63, 515, 275, 291, 14, 362, 63, 808, 63, 694, 342, 272, 543, 1551, 8, 4831, 14, 2834, 63, 576, 12, 298, 87, 531, 465, 289, 26, 489, 289, 14, 952, 8, 881, 408, 19179, 1990, 9608, 370, 664, 7437, 3367, 581, 402, 13867, 1337, 701, 14737, 308, 1429, 641, 881, 314, 16297, 12, 436, 402, 9445, 6548, 370, 886, 26, 5403, 503, 13373, 21920, 10530, 299, 1024, 1915, 881, 1901, 314, 6719, 14737, 308, 1429, 1990, 7664, 12, 1325, 652, 10530, 949, 6682, 22004, 503, 881, 3818, 83, 1298, 315, 652, 12, 283, 460, 4052, 365, 314, 675, 402, 282, 6719, 2584, 32463, 741, 1885, 881, 283, 7395, 6682, 22004, 503, 3818, 83, 1298, 14069, 2002, 21920, 1990, 11201, 316, 315, 14737, 5705, 881, 25169, 334, 305, 5521, 465, 21920, 4293, 12, 367, 314, 18469, 5382, 6326, 14737, 23109, 7437, 308, 18387, 647, 881, 436, 410, 31596, 395, 3775, 314, 299, 274, 5457, 402, 10663, 282, 12927, 19765, 13, 4429, 3955, 506, 881, 25235, 314, 29616, 402, 10232, 1536, 436, 12433, 314, 366, 5789, 338, 397, 12, 1380, 308, 1181, 848, 590, 881, 282, 2816, 1175, 29773, 2075, 543, 299, 2292, 325, 5066, 21471, 4002, 701, 14737, 3134, 78, 6141, 489, 543, 1551, 8, 4831, 14, 2579, 63, 576, 12, 298, 87, 531, 465, 289, 26, 267, 289, 14, 952, 480, 19179, 21920, 29773, 2075, 5403, 60, 78, 531, 819, 347, 511, 10155, 18, 14373, 8, 277, 304, 272, 12846, 14, 2912, 63, 890, 275, 959, 272, 12846, 14, 1507, 63, 8705, 63, 3356, 275, 1616, 272, 12846, 14, 13161, 63, 475, 63, 2834, 275, 413, 272, 12846, 14, 827, 63, 835, 275, 378, 272, 4349, 18, 6046, 14, 973, 4157, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 2833, 14, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
sharad/calibre
setup/installer/osx/app/sign.py
1
2568
#!/usr/bin/env python # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' import subprocess, os, sys, plistlib from contextlib import contextmanager from glob import glob @contextmanager def current_dir(path): cwd = os.getcwd() os.chdir(path) yield path os.chdir(cwd) def codesign(items): if isinstance(items, basestring): items = [items] subprocess.check_call(['codesign', '-s', 'Kovid Goyal'] + list(items)) def files_in(folder): for record in os.walk(folder): for f in record[-1]: yield os.path.join(record[0], f) def expand_dirs(items): items = set(items) dirs = set(x for x in items if os.path.isdir(x)) items.difference_update(dirs) for x in dirs: items.update(set(files_in(x))) return items def get_executable(info_path): return plistlib.readPlist(info_path)['CFBundleExecutable'] def sign_app(appdir): appdir = os.path.abspath(appdir) key = open(os.path.expanduser('~/key')).read().strip() subprocess.check_call(['security', 'unlock-keychain', '-p', key]) with current_dir(os.path.join(appdir, 'Contents')): executables = {get_executable('Info.plist')} # Sign the sub application bundles sub_apps = glob('*.app') for sa in sub_apps: exe = get_executable(sa + '/Contents/Info.plist') if exe in executables: raise ValueError('Multiple app bundles share the same executable: %s' % exe) executables.add(exe) codesign(sub_apps) # Sign everything in MacOS except the main executables of the various # app bundles which will be signed automatically by codesign when # signing the app bundles with current_dir('MacOS'): items = set(os.listdir('.')) - executables codesign(expand_dirs(items)) # Sign everything in Frameworks with current_dir('Frameworks'): fw = set(glob('*.framework')) codesign(fw) items = set(os.listdir('.')) - fw codesign(expand_dirs(items)) # Now sign the main app codesign(appdir) # Verify the signature subprocess.check_call(['codesign', '--deep', '--verify', '-v', appdir]) subprocess.check_call('spctl --verbose=4 --assess --type execute'.split() + [appdir]) return 0 if __name__ == '__main__': sign_app(sys.argv[-1])
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 6695, 26, 493, 2991, 29, 1624, 13, 24, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 4629, 12, 3679, 63, 646, 12, 717, 870, 63, 1593, 9, 199, 199, 363, 1682, 363, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 7280, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 737, 20817, 5017, 1939, 31876, 14, 846, 3524, 199, 199, 646, 3873, 12, 747, 12, 984, 12, 14459, 773, 199, 504, 15502, 492, 27608, 199, 504, 5739, 492, 5739, 199, 199, 32, 14237, 199, 318, 1453, 63, 694, 8, 515, 304, 272, 8288, 275, 747, 14, 9458, 342, 272, 747, 14, 8563, 8, 515, 9, 272, 1995, 931, 272, 747, 14, 8563, 8, 6525, 9, 199, 199, 318, 1233, 1037, 8, 1744, 304, 272, 340, 1228, 8, 1744, 12, 7116, 304, 267, 2974, 275, 359, 1744, 61, 272, 3873, 14, 1074, 63, 1250, 2941, 600, 1037, 297, 2475, 83, 297, 283, 31305, 5017, 3971, 31876, 418, 435, 769, 8, 1744, 430, 199, 199, 318, 1584, 63, 262, 8, 3741, 304, 272, 367, 2777, 315, 747, 14, 7757, 8, 3741, 304, 267, 367, 289, 315, 2777, 1988, 17, 2189, 288, 1995, 747, 14, 515, 14, 904, 8, 3059, 59, 16, 467, 289, 9, 199, 199, 318, 6544, 63, 3220, 8, 1744, 304, 272, 2974, 275, 663, 8, 1744, 9, 272, 7606, 275, 663, 8, 88, 367, 671, 315, 2974, 340, 747, 14, 515, 14, 6027, 8, 88, 430, 272, 2974, 14, 9196, 63, 873, 8, 3220, 9, 272, 367, 671, 315, 7606, 26, 267, 2974, 14, 873, 8, 409, 8, 1725, 63, 262, 8, 88, 1724, 272, 372, 2974, 199, 199, 318, 664, 63, 5904, 8, 815, 63, 515, 304, 272, 372, 14459, 773, 14, 739, 21073, 8, 815, 63, 515, 11820, 5487, 12320, 18039, 418, 199, 199, 318, 2070, 63, 571, 8, 571, 694, 304, 272, 1145, 694, 275, 747, 14, 515, 14, 4832, 8, 571, 694, 9, 272, 790, 275, 1551, 8, 736, 14, 515, 14, 12131, 21114, 15, 498, 11103, 739, 1252, 1913, 342, 272, 3873, 14, 1074, 63, 1250, 2941, 4416, 297, 283, 17966, 13, 498, 4429, 297, 2475, 80, 297, 790, 566, 272, 543, 1453, 63, 694, 8, 736, 14, 515, 14, 904, 8, 571, 694, 12, 283, 11383, 8109, 267, 31172, 275, 469, 362, 63, 5904, 360, 2354, 14, 10265, 21004, 398, 327, 6632, 314, 1007, 4223, 27206, 267, 1007, 63, 5181, 275, 5739, 360, 4856, 571, 358, 267, 367, 2937, 315, 1007, 63, 5181, 26, 288, 14778, 275, 664, 63, 5904, 8, 2231, 435, 1994, 11383, 15, 2354, 14, 10265, 358, 288, 340, 14778, 315, 31172, 26, 355, 746, 1722, 360, 8433, 1145, 27206, 8663, 314, 2011, 7286, 26, 450, 83, 7, 450, 14778, 9, 288, 31172, 14, 525, 8, 5803, 9, 267, 1233, 1037, 8, 954, 63, 5181, 9, 398, 327, 6632, 8137, 315, 10444, 3100, 871, 314, 2446, 31172, 402, 314, 7750, 267, 327, 1145, 27206, 1314, 911, 506, 10514, 5847, 701, 1233, 1037, 1380, 267, 327, 18057, 314, 1145, 27206, 267, 543, 1453, 63, 694, 360, 3399, 3100, 735, 288, 2974, 275, 663, 8, 736, 14, 7374, 24535, 446, 31172, 288, 1233, 1037, 8, 4441, 63, 3220, 8, 1744, 430, 398, 327, 6632, 8137, 315, 11726, 12243, 267, 543, 1453, 63, 694, 360, 30052, 735, 288, 13908, 275, 663, 8, 6463, 360, 4856, 4857, 1333, 288, 1233, 1037, 8, 8835, 9, 288, 2974, 275, 663, 8, 736, 14, 7374, 24535, 446, 13908, 288, 1233, 1037, 8, 4441, 63, 3220, 8, 1744, 430, 339, 327, 7356, 2070, 314, 2446, 1145, 272, 1233, 1037, 8, 571, 694, 9, 272, 327, 7635, 314, 4955, 272, 3873, 14, 1074, 63, 1250, 2941, 600, 1037, 297, 2850, 16131, 297, 2850, 4712, 297, 2475, 86, 297, 1145, 694, 566, 272, 3873, 14, 1074, 63, 1250, 360, 681, 8077, 1553, 3832, 29, 20, 1553, 305, 5480, 1553, 466, 5341, 1370, 1294, 342, 435, 359, 571, 694, 566, 339, 372, 378, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2070, 63, 571, 8, 1274, 14, 3020, 1988, 17, 566, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 6695, 26, 493, 2991, 29, 1624, 13, 24, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 4629, 12, 3679, 63, 646, 12, 717, 870, 63, 1593, 9, 199, 199, 363, 1682, 363, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 7280, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 737, 20817, 5017, 1939, 31876, 14, 846, 3524, 199, 199, 646, 3873, 12, 747, 12, 984, 12, 14459, 773, 199, 504, 15502, 492, 27608, 199, 504, 5739, 492, 5739, 199, 199, 32, 14237, 199, 318, 1453, 63, 694, 8, 515, 304, 272, 8288, 275, 747, 14, 9458, 342, 272, 747, 14, 8563, 8, 515, 9, 272, 1995, 931, 272, 747, 14, 8563, 8, 6525, 9, 199, 199, 318, 1233, 1037, 8, 1744, 304, 272, 340, 1228, 8, 1744, 12, 7116, 304, 267, 2974, 275, 359, 1744, 61, 272, 3873, 14, 1074, 63, 1250, 2941, 600, 1037, 297, 2475, 83, 297, 283, 31305, 5017, 3971, 31876, 418, 435, 769, 8, 1744, 430, 199, 199, 318, 1584, 63, 262, 8, 3741, 304, 272, 367, 2777, 315, 747, 14, 7757, 8, 3741, 304, 267, 367, 289, 315, 2777, 1988, 17, 2189, 288, 1995, 747, 14, 515, 14, 904, 8, 3059, 59, 16, 467, 289, 9, 199, 199, 318, 6544, 63, 3220, 8, 1744, 304, 272, 2974, 275, 663, 8, 1744, 9, 272, 7606, 275, 663, 8, 88, 367, 671, 315, 2974, 340, 747, 14, 515, 14, 6027, 8, 88, 430, 272, 2974, 14, 9196, 63, 873, 8, 3220, 9, 272, 367, 671, 315, 7606, 26, 267, 2974, 14, 873, 8, 409, 8, 1725, 63, 262, 8, 88, 1724, 272, 372, 2974, 199, 199, 318, 664, 63, 5904, 8, 815, 63, 515, 304, 272, 372, 14459, 773, 14, 739, 21073, 8, 815, 63, 515, 11820, 5487, 12320, 18039, 418, 199, 199, 318, 2070, 63, 571, 8, 571, 694, 304, 272, 1145, 694, 275, 747, 14, 515, 14, 4832, 8, 571, 694, 9, 272, 790, 275, 1551, 8, 736, 14, 515, 14, 12131, 21114, 15, 498, 11103, 739, 1252, 1913, 342, 272, 3873, 14, 1074, 63, 1250, 2941, 4416, 297, 283, 17966, 13, 498, 4429, 297, 2475, 80, 297, 790, 566, 272, 543, 1453, 63, 694, 8, 736, 14, 515, 14, 904, 8, 571, 694, 12, 283, 11383, 8109, 267, 31172, 275, 469, 362, 63, 5904, 360, 2354, 14, 10265, 21004, 398, 327, 6632, 314, 1007, 4223, 27206, 267, 1007, 63, 5181, 275, 5739, 360, 4856, 571, 358, 267, 367, 2937, 315, 1007, 63, 5181, 26, 288, 14778, 275, 664, 63, 5904, 8, 2231, 435, 1994, 11383, 15, 2354, 14, 10265, 358, 288, 340, 14778, 315, 31172, 26, 355, 746, 1722, 360, 8433, 1145, 27206, 8663, 314, 2011, 7286, 26, 450, 83, 7, 450, 14778, 9, 288, 31172, 14, 525, 8, 5803, 9, 267, 1233, 1037, 8, 954, 63, 5181, 9, 398, 327, 6632, 8137, 315, 10444, 3100, 871, 314, 2446, 31172, 402, 314, 7750, 267, 327, 1145, 27206, 1314, 911, 506, 10514, 5847, 701, 1233, 1037, 1380, 267, 327, 18057, 314, 1145, 27206, 267, 543, 1453, 63, 694, 360, 3399, 3100, 735, 288, 2974, 275, 663, 8, 736, 14, 7374, 24535, 446, 31172, 288, 1233, 1037, 8, 4441, 63, 3220, 8, 1744, 430, 398, 327, 6632, 8137, 315, 11726, 12243, 267, 543, 1453, 63, 694, 360, 30052, 735, 288, 13908, 275, 663, 8, 6463, 360, 4856, 4857, 1333, 288, 1233, 1037, 8, 8835, 9, 288, 2974, 275, 663, 8, 736, 14, 7374, 24535, 446, 13908, 288, 1233, 1037, 8, 4441, 63, 3220, 8, 1744, 430, 339, 327, 7356, 2070, 314, 2446, 1145, 272, 1233, 1037, 8, 571, 694, 9, 272, 327, 7635, 314, 4955, 272, 3873, 14, 1074, 63, 1250, 2941, 600, 1037, 297, 2850, 16131, 297, 2850, 4712, 297, 2475, 86, 297, 1145, 694, 566, 272, 3873, 14, 1074, 63, 1250, 360, 681, 8077, 1553, 3832, 29, 20, 1553, 305, 5480, 1553, 466, 5341, 1370, 1294, 342, 435, 359, 571, 694, 566, 339, 372, 378, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2070, 63, 571, 8, 1274, 14, 3020, 1988, 17, 566, 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, 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,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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 ]
dezelin/scons
scons-local/SCons/Tool/cyglink.py
29
2819
"""SCons.Tool.cyglink Customization of gnulink for Cygwin (http://www.cygwin.com/) There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ import SCons.Action import SCons.Util import gnulink def shlib_generator(target, source, env, for_signature): cmd = SCons.Util.CLVar(['$SHLINK']) dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) cmd.extend(['$SHLINKFLAGS', '$__RPATH']) implib = env.FindIxes(target, 'IMPLIBPREFIX', 'IMPLIBSUFFIX') if implib: cmd.extend([ '-Wl,--out-implib='+implib.get_string(for_signature), '-Wl,--export-all-symbols', '-Wl,--enable-auto-import', '-Wl,--whole-archive', '$SOURCES', '-Wl,--no-whole-archive', '$_LIBDIRFLAGS', '$_LIBFLAGS' ]) else: cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) return [cmd] def shlib_emitter(target, source, env): dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') no_import_lib = env.get('no_import_lib', 0) if not dll or len(target) > 1: raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) # Remove any "lib" after the prefix pre = env.subst('$SHLIBPREFIX') if dll.name[len(pre):len(pre)+3] == 'lib': dll.name = pre + dll.name[len(pre)+3:] orig_target = target target = [env.fs.File(dll)] target[0].attributes.shared = 1 # Append an import lib target if not no_import_lib: # Create list of target libraries as strings target_strings = env.ReplaceIxes(orig_target[0], 'SHLIBPREFIX', 'SHLIBSUFFIX', 'IMPLIBPREFIX', 'IMPLIBSUFFIX') implib_target = env.fs.File(target_strings) implib_target.attributes.shared = 1 target.append(implib_target) return (target, source) shlib_action = SCons.Action.Action(shlib_generator, generator=1) def generate(env): """Add Builders and construction variables for cyglink to an Environment.""" gnulink.generate(env) env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,-no-undefined') env['SHLINKCOM'] = shlib_action env['LDMODULECOM'] = shlib_action env.Append(SHLIBEMITTER = [shlib_emitter]) env['SHLIBPREFIX'] = 'cyg' env['SHLIBSUFFIX'] = '.dll' env['IMPLIBPREFIX'] = 'lib' env['IMPLIBSUFFIX'] = '.dll.a' def exists(env): return gnulink.exists(env) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
mit
[ 624, 18521, 14, 5157, 14, 15076, 1073, 199, 199, 7223, 2072, 402, 19964, 348, 2292, 367, 445, 18313, 334, 1014, 921, 1544, 14, 16680, 14, 957, 24793, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 624, 199, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 9562, 199, 199, 646, 19964, 348, 2292, 199, 199, 318, 1033, 773, 63, 4679, 8, 1375, 12, 1350, 12, 2589, 12, 367, 63, 5233, 304, 272, 2088, 275, 8218, 14, 9562, 14, 1981, 5894, 2941, 4, 3234, 7916, 1105, 18407, 17112, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 358, 272, 340, 17112, 26, 2088, 14, 2880, 24829, 79, 297, 17112, 566, 339, 2088, 14, 2880, 2941, 4, 3234, 30388, 297, 4505, 363, 50, 3243, 1105, 339, 1742, 773, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 26312, 2100, 6351, 297, 283, 26312, 2100, 12273, 358, 272, 340, 1742, 773, 26, 267, 2088, 14, 2880, 779, 288, 2475, 16239, 28925, 548, 13, 3236, 773, 22078, 3236, 773, 14, 362, 63, 875, 8, 509, 63, 5233, 395, 288, 2475, 16239, 28925, 3790, 13, 452, 13, 7450, 297, 288, 2475, 16239, 28925, 4296, 13, 2495, 13, 646, 297, 288, 2475, 16239, 28925, 21224, 13, 6404, 297, 4505, 25744, 297, 288, 2475, 16239, 28925, 889, 13, 21224, 13, 6404, 297, 4505, 63, 5617, 3022, 4831, 297, 4505, 63, 5617, 4831, 7, 288, 4794, 272, 587, 26, 267, 2088, 14, 2880, 2941, 4, 25744, 297, 4505, 63, 5617, 3022, 4831, 297, 4505, 63, 5617, 4831, 1105, 2286, 372, 359, 1760, 61, 199, 199, 318, 1033, 773, 63, 8159, 351, 8, 1375, 12, 1350, 12, 2589, 304, 272, 17112, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 358, 272, 949, 63, 646, 63, 773, 275, 2589, 14, 362, 360, 889, 63, 646, 63, 773, 297, 378, 9, 339, 340, 440, 17112, 503, 822, 8, 1375, 9, 690, 413, 26, 267, 746, 8218, 14, 9298, 14, 1899, 547, 480, 33, 5709, 3555, 1077, 1172, 8840, 1373, 1347, 543, 314, 4739, 26, 450, 83, 2, 450, 2589, 14, 16747, 21506, 3234, 5617, 12273, 2237, 2286, 327, 5852, 1263, 298, 773, 2, 2410, 314, 2403, 272, 876, 275, 2589, 14, 16747, 14676, 3234, 5617, 6351, 358, 272, 340, 17112, 14, 354, 59, 552, 8, 657, 304, 552, 8, 657, 6393, 19, 61, 508, 283, 773, 356, 267, 17112, 14, 354, 275, 876, 435, 17112, 14, 354, 59, 552, 8, 657, 6393, 19, 2938, 339, 2306, 63, 1375, 275, 1347, 272, 1347, 275, 359, 1813, 14, 2319, 14, 1173, 8, 9259, 1874, 272, 1347, 59, 16, 1055, 2987, 14, 5555, 275, 413, 339, 327, 18726, 376, 492, 1973, 1347, 272, 340, 440, 949, 63, 646, 63, 773, 26, 267, 327, 2790, 769, 402, 1347, 8363, 465, 3326, 267, 1347, 63, 5465, 275, 2589, 14, 11328, 41, 12908, 8, 2981, 63, 1375, 59, 16, 467, 1460, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 297, 1460, 283, 26312, 2100, 6351, 297, 283, 26312, 2100, 12273, 358, 2728, 1742, 773, 63, 1375, 275, 2589, 14, 2319, 14, 1173, 8, 1375, 63, 5465, 9, 267, 1742, 773, 63, 1375, 14, 2987, 14, 5555, 275, 413, 267, 1347, 14, 740, 8, 3236, 773, 63, 1375, 9, 339, 372, 334, 1375, 12, 1350, 9, 2079, 199, 199, 609, 773, 63, 1287, 275, 8218, 14, 3310, 14, 3310, 8, 609, 773, 63, 4679, 12, 4306, 29, 17, 9, 199, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 19286, 83, 436, 14538, 2860, 367, 286, 5016, 1073, 370, 376, 9711, 1041, 272, 19964, 348, 2292, 14, 4208, 8, 1813, 9, 339, 2589, 459, 30388, 418, 257, 275, 8218, 14, 9562, 14, 1981, 5894, 3654, 16239, 3057, 889, 13, 10705, 358, 339, 2589, 459, 3234, 7916, 11265, 418, 275, 1033, 773, 63, 1287, 272, 2589, 459, 6533, 10001, 11265, 418, 275, 1033, 773, 63, 1287, 272, 2589, 14, 8310, 8, 3234, 5617, 12660, 1157, 275, 359, 609, 773, 63, 8159, 351, 566, 339, 2589, 459, 3234, 5617, 6351, 418, 260, 275, 283, 15076, 7, 272, 2589, 459, 3234, 5617, 12273, 418, 260, 275, 1987, 9259, 7, 339, 2589, 459, 26312, 2100, 6351, 418, 263, 275, 283, 773, 7, 272, 2589, 459, 26312, 2100, 12273, 418, 263, 275, 1987, 9259, 14, 65, 7, 199, 199, 318, 3495, 8, 1813, 304, 272, 372, 19964, 348, 2292, 14, 2444, 8, 1813, 9, 421, 199, 3, 10111, 17198, 26, 199, 3, 5174, 13, 2063, 26, 20, 199, 3, 4363, 13, 8741, 13, 632, 26, 20613, 199, 3, 9599, 26, 199, 3, 6695, 26, 663, 26414, 20849, 29, 20, 20105, 29, 20, 26, 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 ]
[ 18521, 14, 5157, 14, 15076, 1073, 199, 199, 7223, 2072, 402, 19964, 348, 2292, 367, 445, 18313, 334, 1014, 921, 1544, 14, 16680, 14, 957, 24793, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 624, 199, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 9562, 199, 199, 646, 19964, 348, 2292, 199, 199, 318, 1033, 773, 63, 4679, 8, 1375, 12, 1350, 12, 2589, 12, 367, 63, 5233, 304, 272, 2088, 275, 8218, 14, 9562, 14, 1981, 5894, 2941, 4, 3234, 7916, 1105, 18407, 17112, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 358, 272, 340, 17112, 26, 2088, 14, 2880, 24829, 79, 297, 17112, 566, 339, 2088, 14, 2880, 2941, 4, 3234, 30388, 297, 4505, 363, 50, 3243, 1105, 339, 1742, 773, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 26312, 2100, 6351, 297, 283, 26312, 2100, 12273, 358, 272, 340, 1742, 773, 26, 267, 2088, 14, 2880, 779, 288, 2475, 16239, 28925, 548, 13, 3236, 773, 22078, 3236, 773, 14, 362, 63, 875, 8, 509, 63, 5233, 395, 288, 2475, 16239, 28925, 3790, 13, 452, 13, 7450, 297, 288, 2475, 16239, 28925, 4296, 13, 2495, 13, 646, 297, 288, 2475, 16239, 28925, 21224, 13, 6404, 297, 4505, 25744, 297, 288, 2475, 16239, 28925, 889, 13, 21224, 13, 6404, 297, 4505, 63, 5617, 3022, 4831, 297, 4505, 63, 5617, 4831, 7, 288, 4794, 272, 587, 26, 267, 2088, 14, 2880, 2941, 4, 25744, 297, 4505, 63, 5617, 3022, 4831, 297, 4505, 63, 5617, 4831, 1105, 2286, 372, 359, 1760, 61, 199, 199, 318, 1033, 773, 63, 8159, 351, 8, 1375, 12, 1350, 12, 2589, 304, 272, 17112, 275, 2589, 14, 6591, 41, 12908, 8, 1375, 12, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 358, 272, 949, 63, 646, 63, 773, 275, 2589, 14, 362, 360, 889, 63, 646, 63, 773, 297, 378, 9, 339, 340, 440, 17112, 503, 822, 8, 1375, 9, 690, 413, 26, 267, 746, 8218, 14, 9298, 14, 1899, 547, 480, 33, 5709, 3555, 1077, 1172, 8840, 1373, 1347, 543, 314, 4739, 26, 450, 83, 2, 450, 2589, 14, 16747, 21506, 3234, 5617, 12273, 2237, 2286, 327, 5852, 1263, 298, 773, 2, 2410, 314, 2403, 272, 876, 275, 2589, 14, 16747, 14676, 3234, 5617, 6351, 358, 272, 340, 17112, 14, 354, 59, 552, 8, 657, 304, 552, 8, 657, 6393, 19, 61, 508, 283, 773, 356, 267, 17112, 14, 354, 275, 876, 435, 17112, 14, 354, 59, 552, 8, 657, 6393, 19, 2938, 339, 2306, 63, 1375, 275, 1347, 272, 1347, 275, 359, 1813, 14, 2319, 14, 1173, 8, 9259, 1874, 272, 1347, 59, 16, 1055, 2987, 14, 5555, 275, 413, 339, 327, 18726, 376, 492, 1973, 1347, 272, 340, 440, 949, 63, 646, 63, 773, 26, 267, 327, 2790, 769, 402, 1347, 8363, 465, 3326, 267, 1347, 63, 5465, 275, 2589, 14, 11328, 41, 12908, 8, 2981, 63, 1375, 59, 16, 467, 1460, 283, 3234, 5617, 6351, 297, 283, 3234, 5617, 12273, 297, 1460, 283, 26312, 2100, 6351, 297, 283, 26312, 2100, 12273, 358, 2728, 1742, 773, 63, 1375, 275, 2589, 14, 2319, 14, 1173, 8, 1375, 63, 5465, 9, 267, 1742, 773, 63, 1375, 14, 2987, 14, 5555, 275, 413, 267, 1347, 14, 740, 8, 3236, 773, 63, 1375, 9, 339, 372, 334, 1375, 12, 1350, 9, 2079, 199, 199, 609, 773, 63, 1287, 275, 8218, 14, 3310, 14, 3310, 8, 609, 773, 63, 4679, 12, 4306, 29, 17, 9, 199, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 19286, 83, 436, 14538, 2860, 367, 286, 5016, 1073, 370, 376, 9711, 1041, 272, 19964, 348, 2292, 14, 4208, 8, 1813, 9, 339, 2589, 459, 30388, 418, 257, 275, 8218, 14, 9562, 14, 1981, 5894, 3654, 16239, 3057, 889, 13, 10705, 358, 339, 2589, 459, 3234, 7916, 11265, 418, 275, 1033, 773, 63, 1287, 272, 2589, 459, 6533, 10001, 11265, 418, 275, 1033, 773, 63, 1287, 272, 2589, 14, 8310, 8, 3234, 5617, 12660, 1157, 275, 359, 609, 773, 63, 8159, 351, 566, 339, 2589, 459, 3234, 5617, 6351, 418, 260, 275, 283, 15076, 7, 272, 2589, 459, 3234, 5617, 12273, 418, 260, 275, 1987, 9259, 7, 339, 2589, 459, 26312, 2100, 6351, 418, 263, 275, 283, 773, 7, 272, 2589, 459, 26312, 2100, 12273, 418, 263, 275, 1987, 9259, 14, 65, 7, 199, 199, 318, 3495, 8, 1813, 304, 272, 372, 19964, 348, 2292, 14, 2444, 8, 1813, 9, 421, 199, 3, 10111, 17198, 26, 199, 3, 5174, 13, 2063, 26, 20, 199, 3, 4363, 13, 8741, 13, 632, 26, 20613, 199, 3, 9599, 26, 199, 3, 6695, 26, 663, 26414, 20849, 29, 20, 20105, 29, 20, 26, 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, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
rdeheele/odoo
addons/hr_payroll/__openerp__.py
52
2616
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # d$ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'Payroll', 'version': '1.0', 'category': 'Human Resources', 'sequence': 38, 'description': """ Generic Payroll system. ======================= * Employee Details * Employee Contracts * Passport based Contract * Allowances/Deductions * Allow to configure Basic/Gross/Net Salary * Employee Payslip * Monthly Payroll Register * Integrated with Holiday Management """, 'author': 'OpenERP SA', 'website': 'https://www.odoo.com/page/employees', 'images': [ 'images/hr_company_contributions.jpeg', 'images/hr_salary_heads.jpeg', 'images/hr_salary_structure.jpeg', 'images/hr_employee_payslip.jpeg' ], 'depends': [ 'hr', 'hr_contract', 'hr_holidays', 'decimal_precision', 'report', ], 'data': [ 'security/hr_security.xml', 'wizard/hr_payroll_payslips_by_employees.xml', 'hr_payroll_view.xml', 'hr_payroll_workflow.xml', 'hr_payroll_sequence.xml', 'hr_payroll_report.xml', 'hr_payroll_data.xml', 'security/ir.model.access.csv', 'wizard/hr_payroll_contribution_register_report.xml', 'res_config_view.xml', 'views/report_contributionregister.xml', 'views/report_payslip.xml', 'views/report_payslipdetails.xml', ], 'test': [ 'test/payslip.yml', ], 'demo': ['hr_payroll_demo.xml'], 'installable': True, 'auto_install': False, 'application': False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 13, 1837, 2803, 26, 1624, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 8664, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 2900, 5924, 5702, 199, 3, 259, 366, 4, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 91, 272, 283, 354, 356, 283, 10517, 2827, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 3710, 356, 283, 31355, 26250, 297, 272, 283, 4041, 356, 10448, 12, 272, 283, 1802, 356, 408, 199, 9417, 15911, 2827, 2656, 14, 199, 1280, 18673, 339, 627, 24089, 15621, 272, 627, 24089, 1448, 1239, 3021, 272, 627, 8325, 719, 4079, 1448, 6908, 272, 627, 9812, 13236, 15, 36, 8654, 2452, 272, 627, 9812, 370, 7908, 10082, 15, 39, 3685, 15, 2480, 428, 279, 695, 272, 627, 24089, 510, 5758, 3587, 272, 627, 28835, 590, 15911, 2827, 11828, 272, 627, 8883, 2587, 972, 543, 869, 23711, 2977, 8259, 272, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 7360, 356, 283, 2859, 921, 1544, 14, 22058, 14, 957, 15, 1606, 15, 24561, 297, 272, 283, 4782, 356, 359, 267, 283, 4782, 15, 6271, 63, 4627, 63, 388, 26675, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 22025, 63, 17033, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 22025, 63, 6976, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 10103, 63, 25854, 14, 14230, 7, 272, 2156, 272, 283, 8912, 356, 359, 267, 283, 6271, 297, 267, 283, 6271, 63, 14624, 297, 267, 283, 6271, 63, 26131, 297, 267, 283, 6355, 63, 6833, 297, 267, 283, 3070, 297, 272, 2156, 272, 283, 576, 356, 359, 267, 283, 4416, 15, 6271, 63, 4416, 14, 1652, 297, 267, 283, 9819, 15, 6271, 63, 5989, 2827, 63, 387, 588, 317, 1190, 63, 991, 63, 24561, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 1345, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 8856, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 4041, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 3070, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 576, 14, 1652, 297, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 9819, 15, 6271, 63, 5989, 2827, 63, 388, 15980, 63, 2683, 63, 3070, 14, 1652, 297, 267, 283, 470, 63, 888, 63, 1345, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 388, 15980, 2683, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 25854, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 25854, 5087, 14, 1652, 297, 272, 2156, 272, 283, 396, 356, 359, 267, 283, 396, 15, 25854, 14, 11714, 297, 272, 2156, 272, 283, 8768, 356, 788, 6271, 63, 5989, 2827, 63, 8768, 14, 1652, 995, 272, 283, 21762, 356, 715, 12, 272, 283, 2495, 63, 3174, 356, 756, 12, 272, 283, 3578, 356, 756, 12, 199, 93, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 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 ]
[ 13, 1837, 2803, 26, 1624, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 8664, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 2900, 5924, 5702, 199, 3, 259, 366, 4, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 91, 272, 283, 354, 356, 283, 10517, 2827, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 3710, 356, 283, 31355, 26250, 297, 272, 283, 4041, 356, 10448, 12, 272, 283, 1802, 356, 408, 199, 9417, 15911, 2827, 2656, 14, 199, 1280, 18673, 339, 627, 24089, 15621, 272, 627, 24089, 1448, 1239, 3021, 272, 627, 8325, 719, 4079, 1448, 6908, 272, 627, 9812, 13236, 15, 36, 8654, 2452, 272, 627, 9812, 370, 7908, 10082, 15, 39, 3685, 15, 2480, 428, 279, 695, 272, 627, 24089, 510, 5758, 3587, 272, 627, 28835, 590, 15911, 2827, 11828, 272, 627, 8883, 2587, 972, 543, 869, 23711, 2977, 8259, 272, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 7360, 356, 283, 2859, 921, 1544, 14, 22058, 14, 957, 15, 1606, 15, 24561, 297, 272, 283, 4782, 356, 359, 267, 283, 4782, 15, 6271, 63, 4627, 63, 388, 26675, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 22025, 63, 17033, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 22025, 63, 6976, 14, 14230, 297, 267, 283, 4782, 15, 6271, 63, 10103, 63, 25854, 14, 14230, 7, 272, 2156, 272, 283, 8912, 356, 359, 267, 283, 6271, 297, 267, 283, 6271, 63, 14624, 297, 267, 283, 6271, 63, 26131, 297, 267, 283, 6355, 63, 6833, 297, 267, 283, 3070, 297, 272, 2156, 272, 283, 576, 356, 359, 267, 283, 4416, 15, 6271, 63, 4416, 14, 1652, 297, 267, 283, 9819, 15, 6271, 63, 5989, 2827, 63, 387, 588, 317, 1190, 63, 991, 63, 24561, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 1345, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 8856, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 4041, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 3070, 14, 1652, 297, 267, 283, 6271, 63, 5989, 2827, 63, 576, 14, 1652, 297, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 9819, 15, 6271, 63, 5989, 2827, 63, 388, 15980, 63, 2683, 63, 3070, 14, 1652, 297, 267, 283, 470, 63, 888, 63, 1345, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 388, 15980, 2683, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 25854, 14, 1652, 297, 267, 283, 4196, 15, 3070, 63, 25854, 5087, 14, 1652, 297, 272, 2156, 272, 283, 396, 356, 359, 267, 283, 396, 15, 25854, 14, 11714, 297, 272, 2156, 272, 283, 8768, 356, 788, 6271, 63, 5989, 2827, 63, 8768, 14, 1652, 995, 272, 283, 21762, 356, 715, 12, 272, 283, 2495, 63, 3174, 356, 756, 12, 272, 283, 3578, 356, 756, 12, 199, 93, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 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herrypy/tutorial/tut08_generators_and_yield.py
2
1195
""" Bonus Tutorial: Using generators to return result bodies Instead of returning a complete result string, you can use the yield statement to return one result part after another. This may be convenient in situations where using a template package like CherryPy or Cheetah would be overkill, and messy string concatenation too uncool. ;-) """ import cherrypy class GeneratorDemo: def header(self): return "<html><body><h2>Generators rule!</h2>" def footer(self): return "</body></html>" def index(self): # Let's make up a list of users for presentation purposes users = ['Remi', 'Carlos', 'Hendrik', 'Lorenzo Lamas'] # Every yield line adds one part to the total result body. yield self.header() yield "<h3>List of users:</h3>" for user in users: yield "%s<br/>" % user yield self.footer() index.exposed = True cherrypy.tree.mount(GeneratorDemo()) if __name__ == '__main__': import os.path cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) cherrypy.server.quickstart() cherrypy.engine.start()
gpl-2.0
[ 624, 199, 34, 265, 527, 377, 15888, 26, 11719, 16952, 370, 372, 754, 1234, 18245, 199, 199, 13962, 13558, 402, 8152, 282, 4890, 754, 1059, 12, 1265, 883, 675, 314, 1995, 199, 6242, 370, 372, 1373, 754, 1777, 2410, 4573, 14, 961, 1443, 506, 22700, 199, 262, 24325, 2382, 1808, 282, 1978, 2559, 2839, 30992, 27794, 503, 445, 426, 1841, 72, 199, 2027, 854, 506, 1806, 8997, 12, 436, 15634, 89, 1059, 28207, 4634, 625, 18499, 14, 8700, 13, 9, 199, 624, 199, 199, 646, 13397, 421, 199, 533, 15042, 21493, 26, 2286, 347, 1406, 8, 277, 304, 267, 372, 3886, 1360, 2535, 2030, 2535, 72, 18, 30, 3139, 2750, 2332, 28718, 72, 18, 4335, 2286, 347, 14178, 8, 277, 304, 267, 372, 15683, 2030, 2957, 1360, 4335, 2286, 347, 1478, 8, 277, 304, 267, 327, 12230, 1159, 1852, 1536, 282, 769, 402, 4390, 367, 3451, 425, 12901, 267, 4390, 275, 788, 497, 2664, 297, 283, 16034, 11560, 297, 283, 40, 500, 25844, 297, 283, 44, 720, 15291, 79, 491, 455, 305, 418, 2728, 327, 18414, 1995, 1004, 9584, 1373, 1777, 370, 314, 3141, 754, 2396, 14, 267, 1995, 291, 14, 1291, 342, 267, 1995, 3886, 72, 19, 30, 1296, 402, 4390, 9919, 72, 19, 4335, 2728, 367, 922, 315, 4390, 26, 288, 1995, 2071, 83, 28, 3289, 25552, 450, 922, 10631, 1995, 291, 14, 12781, 342, 272, 1478, 14, 26717, 275, 715, 199, 199, 23438, 14, 2350, 14, 3956, 8, 7599, 21493, 1012, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 492, 747, 14, 515, 272, 13397, 14, 888, 14, 873, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 23561, 14, 2190, 1333, 272, 13397, 14, 1000, 14, 28957, 342, 272, 13397, 14, 3908, 14, 928, 342, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 34, 265, 527, 377, 15888, 26, 11719, 16952, 370, 372, 754, 1234, 18245, 199, 199, 13962, 13558, 402, 8152, 282, 4890, 754, 1059, 12, 1265, 883, 675, 314, 1995, 199, 6242, 370, 372, 1373, 754, 1777, 2410, 4573, 14, 961, 1443, 506, 22700, 199, 262, 24325, 2382, 1808, 282, 1978, 2559, 2839, 30992, 27794, 503, 445, 426, 1841, 72, 199, 2027, 854, 506, 1806, 8997, 12, 436, 15634, 89, 1059, 28207, 4634, 625, 18499, 14, 8700, 13, 9, 199, 624, 199, 199, 646, 13397, 421, 199, 533, 15042, 21493, 26, 2286, 347, 1406, 8, 277, 304, 267, 372, 3886, 1360, 2535, 2030, 2535, 72, 18, 30, 3139, 2750, 2332, 28718, 72, 18, 4335, 2286, 347, 14178, 8, 277, 304, 267, 372, 15683, 2030, 2957, 1360, 4335, 2286, 347, 1478, 8, 277, 304, 267, 327, 12230, 1159, 1852, 1536, 282, 769, 402, 4390, 367, 3451, 425, 12901, 267, 4390, 275, 788, 497, 2664, 297, 283, 16034, 11560, 297, 283, 40, 500, 25844, 297, 283, 44, 720, 15291, 79, 491, 455, 305, 418, 2728, 327, 18414, 1995, 1004, 9584, 1373, 1777, 370, 314, 3141, 754, 2396, 14, 267, 1995, 291, 14, 1291, 342, 267, 1995, 3886, 72, 19, 30, 1296, 402, 4390, 9919, 72, 19, 4335, 2728, 367, 922, 315, 4390, 26, 288, 1995, 2071, 83, 28, 3289, 25552, 450, 922, 10631, 1995, 291, 14, 12781, 342, 272, 1478, 14, 26717, 275, 715, 199, 199, 23438, 14, 2350, 14, 3956, 8, 7599, 21493, 1012, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 492, 747, 14, 515, 272, 13397, 14, 888, 14, 873, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 23561, 14, 2190, 1333, 272, 13397, 14, 1000, 14, 28957, 342, 272, 13397, 14, 3908, 14, 928, 342, 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, 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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 ]
samkuehn/suds
suds/bindings/multiref.py
209
4181
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) 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. # # 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 Library Lesser General Public License for more details at # ( http://www.gnu.org/licenses/lgpl.html ). # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # written by: Jeff Ortel ( jortel@redhat.com ) """ Provides classes for handling soap multirefs. """ from logging import getLogger from suds import * from suds.sax.element import Element log = getLogger(__name__) soapenc = (None, 'http://schemas.xmlsoap.org/soap/encoding/') class MultiRef: """ Resolves and replaces multirefs. @ivar nodes: A list of non-multiref nodes. @type nodes: list @ivar catalog: A dictionary of multiref nodes by id. @type catalog: dict """ def __init__(self): self.nodes = [] self.catalog = {} def process(self, body): """ Process the specified soap envelope body and replace I{multiref} node references with the contents of the referenced node. @param body: A soap envelope body node. @type body: L{Element} @return: The processed I{body} @rtype: L{Element} """ self.nodes = [] self.catalog = {} self.build_catalog(body) self.update(body) body.children = self.nodes return body def update(self, node): """ Update the specified I{node} by replacing the I{multiref} references with the contents of the referenced nodes and remove the I{href} attribute. @param node: A node to update. @type node: L{Element} @return: The updated node @rtype: L{Element} """ self.replace_references(node) for c in node.children: self.update(c) return node def replace_references(self, node): """ Replacing the I{multiref} references with the contents of the referenced nodes and remove the I{href} attribute. Warning: since the I{ref} is not cloned, @param node: A node to update. @type node: L{Element} """ href = node.getAttribute('href') if href is None: return id = href.getValue() ref = self.catalog.get(id) if ref is None: log.error('soap multiref: %s, not-resolved', id) return node.append(ref.children) node.setText(ref.getText()) for a in ref.attributes: if a.name != 'id': node.append(a) node.remove(href) def build_catalog(self, body): """ Create the I{catalog} of multiref nodes by id and the list of non-multiref nodes. @param body: A soap envelope body node. @type body: L{Element} """ for child in body.children: if self.soaproot(child): self.nodes.append(child) id = child.get('id') if id is None: continue key = '#%s' % id self.catalog[key] = child def soaproot(self, node): """ Get whether the specified I{node} is a soap encoded root. This is determined by examining @soapenc:root='1'. The node is considered to be a root when the attribute is not specified. @param node: A node to evaluate. @type node: L{Element} @return: True if a soap encoded root. @rtype: bool """ root = node.getAttribute('root', ns=soapenc) if root is None: return True else: return ( root.value == '1' )
lgpl-3.0
[ 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 334, 44, 12006, 9, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 221, 199, 3, 844, 12, 503, 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, 11243, 6401, 1696, 1684, 844, 367, 1655, 2436, 737, 199, 3, 334, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 9783, 1168, 14, 1360, 7092, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 3, 5313, 701, 26, 1603, 3609, 4236, 14146, 334, 1335, 269, 14146, 32, 17164, 14, 957, 776, 199, 199, 624, 199, 17473, 3992, 367, 7252, 880, 439, 3510, 7655, 14, 199, 624, 199, 199, 504, 2050, 492, 28138, 199, 504, 30713, 492, 627, 199, 504, 30713, 14, 14338, 14, 2108, 492, 6566, 199, 199, 793, 275, 28138, 3460, 354, 3368, 199, 199, 21818, 10945, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21818, 15, 2991, 6217, 199, 199, 533, 6879, 2891, 26, 272, 408, 272, 3591, 393, 2310, 436, 19058, 3510, 7655, 14, 272, 768, 7725, 3380, 26, 437, 769, 402, 2222, 13, 3029, 1121, 3380, 14, 272, 768, 466, 3380, 26, 769, 272, 768, 7725, 10594, 26, 437, 2600, 402, 3510, 1121, 3380, 701, 1305, 14, 272, 768, 466, 10594, 26, 1211, 5591, 408, 2286, 347, 636, 826, 721, 277, 304, 267, 291, 14, 2415, 275, 942, 267, 291, 14, 7959, 275, 1052, 2286, 347, 2112, 8, 277, 12, 2396, 304, 267, 408, 267, 7132, 314, 2013, 880, 439, 24631, 2396, 436, 3350, 473, 91, 3029, 1121, 93, 1031, 267, 6941, 543, 314, 4072, 402, 314, 11812, 1031, 14, 267, 768, 635, 2396, 26, 437, 880, 439, 24631, 2396, 1031, 14, 267, 768, 466, 2396, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 710, 7686, 473, 91, 2030, 93, 267, 768, 4500, 26, 491, 91, 2162, 93, 267, 408, 267, 291, 14, 2415, 275, 942, 267, 291, 14, 7959, 275, 1052, 267, 291, 14, 1506, 63, 7959, 8, 2030, 9, 267, 291, 14, 873, 8, 2030, 9, 267, 2396, 14, 3223, 275, 291, 14, 2415, 267, 372, 2396, 2286, 347, 1678, 8, 277, 12, 1031, 304, 267, 408, 267, 6162, 314, 2013, 473, 91, 932, 93, 701, 15810, 314, 473, 91, 3029, 1121, 93, 6941, 543, 267, 314, 4072, 402, 314, 11812, 3380, 436, 2813, 314, 473, 91, 6399, 93, 2225, 14, 267, 768, 635, 1031, 26, 437, 1031, 370, 1678, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 710, 4588, 1031, 267, 768, 4500, 26, 491, 91, 2162, 93, 267, 408, 267, 291, 14, 1814, 63, 12635, 8, 932, 9, 267, 367, 286, 315, 1031, 14, 3223, 26, 288, 291, 14, 873, 8, 67, 9, 267, 372, 1031, 15567, 347, 3350, 63, 12635, 8, 277, 12, 1031, 304, 267, 408, 267, 16000, 13121, 314, 473, 91, 3029, 1121, 93, 6941, 543, 314, 4072, 402, 314, 4960, 11812, 3380, 436, 2813, 314, 473, 91, 6399, 93, 2225, 14, 221, 15902, 26, 221, 3967, 267, 314, 473, 91, 1121, 93, 365, 440, 26210, 12, 4960, 768, 635, 1031, 26, 437, 1031, 370, 1678, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 408, 267, 4369, 275, 1031, 14, 12956, 360, 6399, 358, 267, 340, 4369, 365, 488, 26, 288, 372, 267, 1305, 275, 4369, 14, 17186, 342, 267, 2984, 275, 291, 14, 7959, 14, 362, 8, 344, 9, 267, 340, 2984, 365, 488, 26, 288, 943, 14, 705, 360, 21818, 3510, 1121, 26, 450, 83, 12, 440, 13, 13697, 297, 1305, 9, 288, 372, 267, 1031, 14, 740, 8, 1121, 14, 3223, 9, 267, 1031, 14, 8341, 8, 1121, 14, 25506, 1012, 267, 367, 282, 315, 2984, 14, 2987, 26, 288, 340, 282, 14, 354, 1137, 283, 344, 356, 355, 1031, 14, 740, 8, 65, 9, 267, 1031, 14, 2168, 8, 6399, 9, 15567, 347, 1900, 63, 7959, 8, 277, 12, 2396, 304, 267, 408, 267, 2790, 314, 473, 91, 7959, 93, 402, 3510, 1121, 3380, 701, 1305, 436, 314, 769, 402, 267, 2222, 13, 3029, 1121, 3380, 14, 267, 768, 635, 2396, 26, 437, 880, 439, 24631, 2396, 1031, 14, 267, 768, 466, 2396, 26, 491, 91, 2162, 93, 267, 408, 267, 367, 1982, 315, 2396, 14, 3223, 26, 288, 340, 291, 14, 21818, 1231, 8, 1739, 304, 355, 291, 14, 2415, 14, 740, 8, 1739, 9, 288, 1305, 275, 1982, 14, 362, 360, 344, 358, 288, 340, 1305, 365, 488, 26, 1980, 288, 790, 275, 3943, 5, 83, 7, 450, 1305, 288, 291, 14, 7959, 59, 498, 61, 275, 1982, 339, 347, 880, 439, 1231, 8, 277, 12, 1031, 304, 267, 408, 267, 2372, 3775, 314, 2013, 473, 91, 932, 93, 365, 282, 880, 439, 5737, 1738, 14, 267, 961, 365, 12037, 701, 15735, 7969, 768, 21818, 10945, 26, 1231, 534, 17, 1370, 267, 710, 1031, 365, 8652, 370, 506, 282, 1738, 1380, 314, 2225, 267, 365, 440, 2013, 14, 267, 768, 635, 1031, 26, 437, 1031, 370, 9352, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 715, 340, 282, 880, 439, 5737, 1738, 14, 267, 768, 4500, 26, 2155, 267, 408, 267, 1738, 275, 1031, 14, 12956, 360, 1231, 297, 700, 29, 21818, 10945, 9, 267, 340, 1738, 365, 488, 26, 288, 372, 715, 267, 587, 26, 288, 372, 334, 1738, 14, 585, 508, 283, 17, 7, 776, 268, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 334, 44, 12006, 9, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 221, 199, 3, 844, 12, 503, 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, 11243, 6401, 1696, 1684, 844, 367, 1655, 2436, 737, 199, 3, 334, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 9783, 1168, 14, 1360, 7092, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 3, 5313, 701, 26, 1603, 3609, 4236, 14146, 334, 1335, 269, 14146, 32, 17164, 14, 957, 776, 199, 199, 624, 199, 17473, 3992, 367, 7252, 880, 439, 3510, 7655, 14, 199, 624, 199, 199, 504, 2050, 492, 28138, 199, 504, 30713, 492, 627, 199, 504, 30713, 14, 14338, 14, 2108, 492, 6566, 199, 199, 793, 275, 28138, 3460, 354, 3368, 199, 199, 21818, 10945, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21818, 15, 2991, 6217, 199, 199, 533, 6879, 2891, 26, 272, 408, 272, 3591, 393, 2310, 436, 19058, 3510, 7655, 14, 272, 768, 7725, 3380, 26, 437, 769, 402, 2222, 13, 3029, 1121, 3380, 14, 272, 768, 466, 3380, 26, 769, 272, 768, 7725, 10594, 26, 437, 2600, 402, 3510, 1121, 3380, 701, 1305, 14, 272, 768, 466, 10594, 26, 1211, 5591, 408, 2286, 347, 636, 826, 721, 277, 304, 267, 291, 14, 2415, 275, 942, 267, 291, 14, 7959, 275, 1052, 2286, 347, 2112, 8, 277, 12, 2396, 304, 267, 408, 267, 7132, 314, 2013, 880, 439, 24631, 2396, 436, 3350, 473, 91, 3029, 1121, 93, 1031, 267, 6941, 543, 314, 4072, 402, 314, 11812, 1031, 14, 267, 768, 635, 2396, 26, 437, 880, 439, 24631, 2396, 1031, 14, 267, 768, 466, 2396, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 710, 7686, 473, 91, 2030, 93, 267, 768, 4500, 26, 491, 91, 2162, 93, 267, 408, 267, 291, 14, 2415, 275, 942, 267, 291, 14, 7959, 275, 1052, 267, 291, 14, 1506, 63, 7959, 8, 2030, 9, 267, 291, 14, 873, 8, 2030, 9, 267, 2396, 14, 3223, 275, 291, 14, 2415, 267, 372, 2396, 2286, 347, 1678, 8, 277, 12, 1031, 304, 267, 408, 267, 6162, 314, 2013, 473, 91, 932, 93, 701, 15810, 314, 473, 91, 3029, 1121, 93, 6941, 543, 267, 314, 4072, 402, 314, 11812, 3380, 436, 2813, 314, 473, 91, 6399, 93, 2225, 14, 267, 768, 635, 1031, 26, 437, 1031, 370, 1678, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 710, 4588, 1031, 267, 768, 4500, 26, 491, 91, 2162, 93, 267, 408, 267, 291, 14, 1814, 63, 12635, 8, 932, 9, 267, 367, 286, 315, 1031, 14, 3223, 26, 288, 291, 14, 873, 8, 67, 9, 267, 372, 1031, 15567, 347, 3350, 63, 12635, 8, 277, 12, 1031, 304, 267, 408, 267, 16000, 13121, 314, 473, 91, 3029, 1121, 93, 6941, 543, 314, 4072, 402, 314, 4960, 11812, 3380, 436, 2813, 314, 473, 91, 6399, 93, 2225, 14, 221, 15902, 26, 221, 3967, 267, 314, 473, 91, 1121, 93, 365, 440, 26210, 12, 4960, 768, 635, 1031, 26, 437, 1031, 370, 1678, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 408, 267, 4369, 275, 1031, 14, 12956, 360, 6399, 358, 267, 340, 4369, 365, 488, 26, 288, 372, 267, 1305, 275, 4369, 14, 17186, 342, 267, 2984, 275, 291, 14, 7959, 14, 362, 8, 344, 9, 267, 340, 2984, 365, 488, 26, 288, 943, 14, 705, 360, 21818, 3510, 1121, 26, 450, 83, 12, 440, 13, 13697, 297, 1305, 9, 288, 372, 267, 1031, 14, 740, 8, 1121, 14, 3223, 9, 267, 1031, 14, 8341, 8, 1121, 14, 25506, 1012, 267, 367, 282, 315, 2984, 14, 2987, 26, 288, 340, 282, 14, 354, 1137, 283, 344, 356, 355, 1031, 14, 740, 8, 65, 9, 267, 1031, 14, 2168, 8, 6399, 9, 15567, 347, 1900, 63, 7959, 8, 277, 12, 2396, 304, 267, 408, 267, 2790, 314, 473, 91, 7959, 93, 402, 3510, 1121, 3380, 701, 1305, 436, 314, 769, 402, 267, 2222, 13, 3029, 1121, 3380, 14, 267, 768, 635, 2396, 26, 437, 880, 439, 24631, 2396, 1031, 14, 267, 768, 466, 2396, 26, 491, 91, 2162, 93, 267, 408, 267, 367, 1982, 315, 2396, 14, 3223, 26, 288, 340, 291, 14, 21818, 1231, 8, 1739, 304, 355, 291, 14, 2415, 14, 740, 8, 1739, 9, 288, 1305, 275, 1982, 14, 362, 360, 344, 358, 288, 340, 1305, 365, 488, 26, 1980, 288, 790, 275, 3943, 5, 83, 7, 450, 1305, 288, 291, 14, 7959, 59, 498, 61, 275, 1982, 339, 347, 880, 439, 1231, 8, 277, 12, 1031, 304, 267, 408, 267, 2372, 3775, 314, 2013, 473, 91, 932, 93, 365, 282, 880, 439, 5737, 1738, 14, 267, 961, 365, 12037, 701, 15735, 7969, 768, 21818, 10945, 26, 1231, 534, 17, 1370, 267, 710, 1031, 365, 8652, 370, 506, 282, 1738, 1380, 314, 2225, 267, 365, 440, 2013, 14, 267, 768, 635, 1031, 26, 437, 1031, 370, 9352, 14, 267, 768, 466, 1031, 26, 491, 91, 2162, 93, 267, 768, 1107, 26, 715, 340, 282, 880, 439, 5737, 1738, 14, 267, 768, 4500, 26, 2155, 267, 408, 267, 1738, 275, 1031, 14, 12956, 360, 1231, 297, 700, 29, 21818, 10945, 9, 267, 340, 1738, 365, 488, 26, 288, 372, 715, 267, 587, 26, 288, 372, 334, 1738, 14, 585, 508, 283, 17, 7, 776, 268, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 0, 0, 0, 0, 0, 0 ]
mwmuni/LIGGGHTS_GUI
OpenGL/raw/GLX/AMD/gpu_association.py
8
1094
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GLX import _types as _cs # End users want this... from OpenGL.raw.GLX._types import * from OpenGL.raw.GLX import _errors from OpenGL.constant import Constant as _C import ctypes _EXTENSION_NAME = 'GLX_AMD_gpu_association' def _f( function ): return _p.createFunction( function,_p.PLATFORM.GLX,'GLX_AMD_gpu_association',error_checker=_errors._error_checker) GLX_GPU_CLOCK_AMD=_C('GLX_GPU_CLOCK_AMD',0x21A4) GLX_GPU_FASTEST_TARGET_GPUS_AMD=_C('GLX_GPU_FASTEST_TARGET_GPUS_AMD',0x21A2) GLX_GPU_NUM_PIPES_AMD=_C('GLX_GPU_NUM_PIPES_AMD',0x21A5) GLX_GPU_NUM_RB_AMD=_C('GLX_GPU_NUM_RB_AMD',0x21A7) GLX_GPU_NUM_SIMD_AMD=_C('GLX_GPU_NUM_SIMD_AMD',0x21A6) GLX_GPU_NUM_SPI_AMD=_C('GLX_GPU_NUM_SPI_AMD',0x21A8) GLX_GPU_OPENGL_VERSION_STRING_AMD=_C('GLX_GPU_OPENGL_VERSION_STRING_AMD',0x1F02) GLX_GPU_RAM_AMD=_C('GLX_GPU_RAM_AMD',0x21A3) GLX_GPU_RENDERER_STRING_AMD=_C('GLX_GPU_RENDERER_STRING_AMD',0x1F01) GLX_GPU_VENDOR_AMD=_C('GLX_GPU_VENDOR_AMD',0x1F00)
gpl-3.0
[ 2344, 23570, 16741, 701, 2748, 63, 4208, 2884, 12, 886, 440, 5283, 1, 2344, 199, 504, 24374, 492, 4298, 465, 485, 80, 12, 6572, 199, 3, 5495, 10152, 4440, 642, 199, 504, 24374, 14, 1773, 14, 17620, 492, 485, 1313, 465, 485, 1259, 199, 3, 9599, 4390, 2934, 642, 1396, 199, 504, 24374, 14, 1773, 14, 17620, 423, 1313, 492, 627, 199, 504, 24374, 14, 1773, 14, 17620, 492, 485, 2550, 199, 504, 24374, 14, 4083, 492, 19991, 465, 485, 35, 199, 199, 646, 5577, 199, 63, 15498, 63, 2339, 275, 283, 17620, 63, 22909, 63, 6477, 63, 20252, 7, 199, 318, 485, 70, 8, 805, 3461, 272, 372, 485, 80, 14, 981, 3481, 8, 805, 16987, 80, 14, 17805, 14, 17620, 2584, 17620, 63, 22909, 63, 6477, 63, 20252, 297, 705, 63, 6743, 3699, 2550, 423, 705, 63, 6743, 9, 199, 17620, 63, 20769, 63, 30690, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 30690, 63, 22909, 297, 16, 88, 2025, 33, 20, 9, 199, 17620, 63, 20769, 63, 24661, 1719, 63, 9268, 63, 8225, 1668, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 24661, 1719, 63, 9268, 63, 8225, 1668, 63, 22909, 297, 16, 88, 2025, 33, 18, 9, 199, 17620, 63, 20769, 63, 7125, 63, 48, 1772, 654, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 48, 1772, 654, 63, 22909, 297, 16, 88, 2025, 33, 21, 9, 199, 17620, 63, 20769, 63, 7125, 63, 16567, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 16567, 63, 22909, 297, 16, 88, 2025, 33, 23, 9, 199, 17620, 63, 20769, 63, 7125, 63, 25435, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 25435, 63, 22909, 297, 16, 88, 2025, 33, 22, 9, 199, 17620, 63, 20769, 63, 7125, 63, 20495, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 20495, 63, 22909, 297, 16, 88, 2025, 33, 24, 9, 199, 17620, 63, 20769, 63, 9935, 2226, 63, 4612, 63, 5353, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 9935, 2226, 63, 4612, 63, 5353, 63, 22909, 297, 16, 88, 17, 38, 996, 9, 199, 17620, 63, 20769, 63, 30839, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 30839, 63, 22909, 297, 16, 88, 2025, 33, 19, 9, 199, 17620, 63, 20769, 63, 31587, 540, 63, 5353, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 31587, 540, 63, 5353, 63, 22909, 297, 16, 88, 17, 38, 614, 9, 199, 17620, 63, 20769, 63, 27839, 726, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 27839, 726, 63, 22909, 297, 16, 88, 17, 38, 383, 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 ]
[ 23570, 16741, 701, 2748, 63, 4208, 2884, 12, 886, 440, 5283, 1, 2344, 199, 504, 24374, 492, 4298, 465, 485, 80, 12, 6572, 199, 3, 5495, 10152, 4440, 642, 199, 504, 24374, 14, 1773, 14, 17620, 492, 485, 1313, 465, 485, 1259, 199, 3, 9599, 4390, 2934, 642, 1396, 199, 504, 24374, 14, 1773, 14, 17620, 423, 1313, 492, 627, 199, 504, 24374, 14, 1773, 14, 17620, 492, 485, 2550, 199, 504, 24374, 14, 4083, 492, 19991, 465, 485, 35, 199, 199, 646, 5577, 199, 63, 15498, 63, 2339, 275, 283, 17620, 63, 22909, 63, 6477, 63, 20252, 7, 199, 318, 485, 70, 8, 805, 3461, 272, 372, 485, 80, 14, 981, 3481, 8, 805, 16987, 80, 14, 17805, 14, 17620, 2584, 17620, 63, 22909, 63, 6477, 63, 20252, 297, 705, 63, 6743, 3699, 2550, 423, 705, 63, 6743, 9, 199, 17620, 63, 20769, 63, 30690, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 30690, 63, 22909, 297, 16, 88, 2025, 33, 20, 9, 199, 17620, 63, 20769, 63, 24661, 1719, 63, 9268, 63, 8225, 1668, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 24661, 1719, 63, 9268, 63, 8225, 1668, 63, 22909, 297, 16, 88, 2025, 33, 18, 9, 199, 17620, 63, 20769, 63, 7125, 63, 48, 1772, 654, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 48, 1772, 654, 63, 22909, 297, 16, 88, 2025, 33, 21, 9, 199, 17620, 63, 20769, 63, 7125, 63, 16567, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 16567, 63, 22909, 297, 16, 88, 2025, 33, 23, 9, 199, 17620, 63, 20769, 63, 7125, 63, 25435, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 25435, 63, 22909, 297, 16, 88, 2025, 33, 22, 9, 199, 17620, 63, 20769, 63, 7125, 63, 20495, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 7125, 63, 20495, 63, 22909, 297, 16, 88, 2025, 33, 24, 9, 199, 17620, 63, 20769, 63, 9935, 2226, 63, 4612, 63, 5353, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 9935, 2226, 63, 4612, 63, 5353, 63, 22909, 297, 16, 88, 17, 38, 996, 9, 199, 17620, 63, 20769, 63, 30839, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 30839, 63, 22909, 297, 16, 88, 2025, 33, 19, 9, 199, 17620, 63, 20769, 63, 31587, 540, 63, 5353, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 31587, 540, 63, 5353, 63, 22909, 297, 16, 88, 17, 38, 614, 9, 199, 17620, 63, 20769, 63, 27839, 726, 63, 22909, 3699, 35, 360, 17620, 63, 20769, 63, 27839, 726, 63, 22909, 297, 16, 88, 17, 38, 383, 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, 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,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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 ]
meduz/NeuroTools
examples/matlab_vs_python/smallnet_acml.py
3
4164
# Created by Eugene M. Izhikevich, 2003 Modified by S. Fusi 2007 # Ported to Python by Eilif Muller, 2008. # # Notes: # # Requires matplotlib,ipython,numpy>=1.0.3 # On a debian/ubuntu based system: # $ apt-get install python-matplotlib python-numpy ipython # # Start ipython with threaded plotting support: # $ ipython -pylab # # At the resulting prompt, run the file by: # In [1]: execfile('smallnet.py') # Modules required import numpy import numpy.random as random import acml_rng # Bug fix for numpy version 1.0.4 numpy.lib.function_base.any = numpy.any # For measuring performance import time t1 = time.time() # Excitatory and inhibitory neuron counts Ne = 1000 Ni = 4 N = Ne+Ni # Synaptic couplings Je = 250.0/Ne Ji = 0.0 # reset depolarization (mV) reset = 0.0 # refractory period (ms) refr = 2.5 # Synaptic couplings (mV) S = numpy.zeros((N,N)) S[:,:Ne] = Je*random.uniform(size=(N,Ne)) S[:,:Ni] = -Ji*random.uniform(size=(N,Ni)) # Connectivity S[:,:Ne][random.uniform(size=(N,Ne))-0.9<=0.0]=0.0 S[:,Ne:][random.uniform(size=(N,Ni))-0.9<=0.0]=0.0 # (mV/ms) (lambda is a python keyword) leak = 5.0 dt = 0.05 sdt = numpy.sqrt(dt) # Statistics of the background external current mb = 3.0; sb = 4.0 mue = mb; sigmae=sb sigmai = 0.0 # State variable v, initial value of 0 v = numpy.zeros(N) # Refractory period state variable r = numpy.zeros(N) # Spike timings in a list firings = [] spikes = [[]]*N print 'mu(nu=5Hz)=%f' % (mb+Ne*Je*.015-leak,) print 'mu(nu=100Hz)=%f' % (mb+Ne*Je*.1-leak,) # total duration of the simulation (ms) duration = 400.0 t = numpy.arange(0.0,400.0,dt) vt = numpy.zeros_like(t) t2 = time.time() print 'Elapsed time is ', str(t2-t1), ' seconds.' t1 = time.time() for i,ti in enumerate(t): # time for a strong external input if ti>150.0: mue = 6.5 sigmae = 7.5 # time to restore the initial statistics of the external current if ti>300.0: mue = mb sigmae = sb Iext = acml_rng.normal(1.0,N) Iext[:Ne]*=sigmae Iext[Ne:]*=sigmai # Which neurons fired? fired = numpy.nonzero(v>=20.0)[0] if len(fired)>0: # Save mean firing rate of the excitatory neurons v[fired] = reset r[fired] = refr # Append spikes to the spike list for n in fired: # Spikes are stored by a (neuron, time) pair # For easy plotting later firings.append((n,ti)) # and as a list for each neuron spikes[n].append(ti) aux = v-dt*(leak-mue)+numpy.sum(S[:,fired],1)+sdt*Iext else: aux = v-dt*(leak-mue)+sdt*Iext; # Neurons not in the refractory period nr = numpy.nonzero(r<=0)[0] # Bound voltages above 0.0 v[nr] = numpy.where(aux[nr]>=0.0,aux[nr],0.0) # Progress refractory variable nr = numpy.nonzero(r>0)[0] r[nr]-=dt # record the voltage trace of the zeroeth neuron vt[i] = v[0] t2 = time.time() print 'Elapsed time is ', str(t2-t1), ' seconds.' # ------------------------------------------------------------------------- # Plot everything # ------------------------------------------------------------------------- def myplot(): global firings t1 = time.time() figure() # Membrane potential trace of the zeroeth neuron subplot(3,1,1) vt[vt>=20.0]=65.0 plot(t,vt) ylabel(r'$V-V_{rest}\ \left[\rm{mV}\right]$') # Raster plot of the spikes of the network subplot(3,1,2) myfirings = array(firings) myfirings_100 = myfirings[myfirings[:,0]<min(100,Ne)] plot(myfirings_100[:,1],myfirings_100[:,0],'.') axis([0, duration, 0, min(100,Ne)]) ylabel('Neuron index') # Mean firing rate of the excitatory population as a function of time subplot(3,1,3) # 1 ms resultion of rate histogram dx = 1.0 x = arange(0,duration,dx) myfirings_Ne = myfirings[myfirings[:,0]<Ne] mean_fe,x = numpy.histogram(myfirings_Ne[:,1],x) plot(x,mean_fe/dx/Ne*1000.0,ls='steps') ylabel('Hz') xlabel('time [ms]') t2 = time.time() print 'Finished. Elapsed', str(t2-t1), ' seconds.' #myplot()
gpl-2.0
[ 3, 18208, 701, 662, 1518, 6349, 603, 14, 473, 3951, 7455, 433, 335, 12, 13004, 22016, 701, 428, 14, 481, 85, 338, 10219, 199, 3, 510, 1376, 370, 2018, 701, 662, 73, 853, 22578, 1435, 12, 9079, 14, 199, 3, 199, 3, 8144, 26, 199, 3, 199, 3, 15127, 8027, 12, 22691, 12, 4714, 8119, 17, 14, 16, 14, 19, 199, 3, 4068, 282, 477, 9662, 15, 21151, 4079, 2656, 26, 199, 3, 2672, 20932, 13, 362, 3907, 2366, 13, 16440, 2366, 13, 4714, 284, 1548, 199, 3, 199, 3, 7707, 284, 1548, 543, 25396, 25174, 2291, 26, 199, 3, 2672, 284, 1548, 446, 32538, 199, 3, 199, 3, 2854, 314, 9183, 8457, 12, 1255, 314, 570, 701, 26, 199, 3, 1010, 359, 17, 2189, 22711, 360, 7241, 846, 14, 647, 358, 199, 199, 3, 18167, 1415, 199, 646, 2680, 199, 646, 2680, 14, 2355, 465, 2196, 199, 646, 1066, 757, 63, 12686, 199, 3, 21605, 5325, 367, 2680, 1015, 413, 14, 16, 14, 20, 199, 4714, 14, 773, 14, 1593, 63, 1095, 14, 1629, 275, 2680, 14, 1629, 199, 199, 3, 2104, 17616, 4039, 10238, 199, 646, 900, 199, 84, 17, 275, 900, 14, 521, 342, 199, 199, 3, 1316, 14422, 8658, 436, 315, 20215, 390, 1089, 20242, 8242, 199, 4698, 275, 5198, 755, 199, 20959, 275, 841, 199, 46, 275, 5612, 11, 20959, 199, 199, 3, 29988, 439, 764, 512, 384, 24910, 199, 27888, 275, 16074, 14, 16, 15, 4698, 221, 199, 16911, 275, 378, 14, 16, 199, 199, 3, 5305, 477, 19830, 2072, 334, 25489, 9, 199, 3958, 275, 378, 14, 16, 199, 199, 3, 2984, 345, 1076, 6247, 334, 706, 9, 199, 1121, 82, 275, 499, 14, 21, 9948, 199, 3, 29988, 439, 764, 512, 384, 24910, 334, 25489, 9, 199, 51, 275, 2680, 14, 4250, 1332, 46, 12, 46, 430, 199, 51, 3981, 26, 4698, 61, 275, 1603, 69, 10, 2355, 14, 8830, 8, 890, 2687, 46, 12, 4698, 430, 199, 51, 3981, 26, 20959, 61, 275, 446, 16911, 10, 2355, 14, 8830, 8, 890, 2687, 46, 12, 20959, 430, 199, 199, 3, 1448, 13498, 199, 51, 3981, 26, 4698, 1527, 2355, 14, 8830, 8, 890, 2687, 46, 12, 4698, 430, 13, 16, 14, 25, 12932, 16, 14, 16, 10404, 16, 14, 16, 199, 51, 3981, 4698, 26, 1527, 2355, 14, 8830, 8, 890, 2687, 46, 12, 20959, 430, 13, 16, 14, 25, 12932, 16, 14, 16, 10404, 16, 14, 16, 199, 199, 3, 334, 25489, 15, 706, 9, 334, 2734, 365, 282, 2366, 4252, 9, 199, 28212, 275, 959, 14, 16, 199, 3583, 275, 378, 14, 1717, 199, 83, 3583, 275, 2680, 14, 5079, 8, 3583, 9, 199, 199, 3, 28365, 402, 314, 8020, 5957, 1453, 199, 887, 275, 650, 14, 16, 27, 20088, 275, 841, 14, 16, 199, 77, 310, 275, 21187, 27, 10819, 69, 29, 9264, 199, 199, 9412, 73, 275, 378, 14, 16, 199, 199, 3, 8511, 1750, 373, 12, 2536, 574, 402, 378, 199, 86, 275, 2680, 14, 4250, 8, 46, 9, 199, 199, 3, 15397, 345, 1076, 6247, 1174, 1750, 199, 82, 275, 2680, 14, 4250, 8, 46, 9, 199, 199, 3, 428, 1038, 415, 221, 27337, 315, 282, 769, 199, 1795, 780, 275, 942, 199, 32757, 397, 275, 3474, 2677, 10, 46, 421, 199, 1361, 283, 6553, 8, 4850, 29, 21, 13026, 9, 2458, 70, 7, 450, 334, 887, 11, 4698, 10, 27888, 4856, 11164, 13, 28212, 4258, 199, 1361, 283, 6553, 8, 4850, 29, 1960, 13026, 9, 2458, 70, 7, 450, 334, 887, 11, 4698, 10, 27888, 4856, 17, 13, 28212, 4258, 199, 199, 3, 3141, 7373, 402, 314, 17625, 334, 706, 9, 199, 5553, 275, 8290, 14, 16, 199, 84, 275, 2680, 14, 5605, 8, 16, 14, 16, 12, 5303, 14, 16, 12, 3583, 9, 199, 5941, 275, 2680, 14, 4250, 63, 2930, 8, 84, 9, 199, 199, 84, 18, 275, 900, 14, 521, 342, 199, 1361, 283, 37, 9982, 900, 365, 1656, 620, 8, 84, 18, 13, 84, 17, 395, 283, 4696, 3530, 199, 199, 84, 17, 275, 900, 14, 521, 342, 199, 199, 509, 284, 12, 280, 315, 3874, 8, 84, 304, 272, 327, 900, 367, 282, 16925, 5957, 1324, 272, 340, 3367, 30, 8251, 14, 16, 26, 267, 333, 310, 275, 1227, 14, 21, 267, 10819, 69, 275, 1520, 14, 21, 339, 327, 900, 370, 9066, 314, 2536, 11076, 402, 314, 5957, 1453, 272, 340, 3367, 30, 5863, 14, 16, 26, 267, 333, 310, 275, 21187, 267, 10819, 69, 275, 20088, 339, 473, 832, 275, 1066, 757, 63, 12686, 14, 3302, 8, 17, 14, 16, 12, 46, 9, 272, 473, 832, 1491, 4698, 3672, 29, 9412, 69, 272, 473, 832, 59, 4698, 2938, 10, 29, 9412, 73, 339, 327, 26058, 1279, 32073, 31974, 31, 272, 31974, 275, 2680, 14, 10262, 8, 86, 8119, 1165, 14, 16, 2788, 16, 61, 339, 340, 822, 8, 329, 581, 13032, 16, 26, 398, 327, 11063, 4615, 289, 16648, 6634, 402, 314, 3178, 390, 8658, 1279, 32073, 398, 373, 59, 329, 581, 61, 275, 5305, 267, 519, 59, 329, 581, 61, 275, 2984, 82, 398, 327, 18726, 19441, 9246, 370, 314, 19441, 415, 769, 267, 367, 302, 315, 31974, 26, 288, 327, 428, 1038, 9246, 787, 5489, 701, 282, 334, 32054, 12, 900, 9, 4092, 288, 327, 2104, 8837, 25174, 2945, 288, 289, 723, 780, 14, 740, 1332, 78, 12, 280, 430, 288, 327, 436, 465, 282, 769, 367, 1924, 20242, 288, 19441, 9246, 59, 78, 1055, 740, 8, 280, 9, 13857, 11593, 275, 373, 13, 3583, 5830, 28212, 13, 77, 310, 6393, 4714, 14, 1838, 8, 51, 3981, 329, 581, 467, 17, 6393, 83, 3583, 10, 41, 832, 339, 587, 26, 267, 11593, 275, 373, 13, 3583, 5830, 28212, 13, 77, 310, 6393, 83, 3583, 10, 41, 832, 27, 339, 327, 5612, 32073, 440, 315, 314, 2984, 345, 1076, 6247, 272, 14762, 275, 2680, 14, 10262, 8, 82, 12932, 16, 2788, 16, 61, 272, 327, 21972, 5236, 84, 7441, 3432, 378, 14, 16, 272, 373, 59, 7865, 61, 275, 2680, 14, 4509, 8, 10962, 59, 7865, 61, 8119, 16, 14, 16, 12, 10962, 59, 7865, 467, 16, 14, 16, 9, 339 ]
[ 18208, 701, 662, 1518, 6349, 603, 14, 473, 3951, 7455, 433, 335, 12, 13004, 22016, 701, 428, 14, 481, 85, 338, 10219, 199, 3, 510, 1376, 370, 2018, 701, 662, 73, 853, 22578, 1435, 12, 9079, 14, 199, 3, 199, 3, 8144, 26, 199, 3, 199, 3, 15127, 8027, 12, 22691, 12, 4714, 8119, 17, 14, 16, 14, 19, 199, 3, 4068, 282, 477, 9662, 15, 21151, 4079, 2656, 26, 199, 3, 2672, 20932, 13, 362, 3907, 2366, 13, 16440, 2366, 13, 4714, 284, 1548, 199, 3, 199, 3, 7707, 284, 1548, 543, 25396, 25174, 2291, 26, 199, 3, 2672, 284, 1548, 446, 32538, 199, 3, 199, 3, 2854, 314, 9183, 8457, 12, 1255, 314, 570, 701, 26, 199, 3, 1010, 359, 17, 2189, 22711, 360, 7241, 846, 14, 647, 358, 199, 199, 3, 18167, 1415, 199, 646, 2680, 199, 646, 2680, 14, 2355, 465, 2196, 199, 646, 1066, 757, 63, 12686, 199, 3, 21605, 5325, 367, 2680, 1015, 413, 14, 16, 14, 20, 199, 4714, 14, 773, 14, 1593, 63, 1095, 14, 1629, 275, 2680, 14, 1629, 199, 199, 3, 2104, 17616, 4039, 10238, 199, 646, 900, 199, 84, 17, 275, 900, 14, 521, 342, 199, 199, 3, 1316, 14422, 8658, 436, 315, 20215, 390, 1089, 20242, 8242, 199, 4698, 275, 5198, 755, 199, 20959, 275, 841, 199, 46, 275, 5612, 11, 20959, 199, 199, 3, 29988, 439, 764, 512, 384, 24910, 199, 27888, 275, 16074, 14, 16, 15, 4698, 221, 199, 16911, 275, 378, 14, 16, 199, 199, 3, 5305, 477, 19830, 2072, 334, 25489, 9, 199, 3958, 275, 378, 14, 16, 199, 199, 3, 2984, 345, 1076, 6247, 334, 706, 9, 199, 1121, 82, 275, 499, 14, 21, 9948, 199, 3, 29988, 439, 764, 512, 384, 24910, 334, 25489, 9, 199, 51, 275, 2680, 14, 4250, 1332, 46, 12, 46, 430, 199, 51, 3981, 26, 4698, 61, 275, 1603, 69, 10, 2355, 14, 8830, 8, 890, 2687, 46, 12, 4698, 430, 199, 51, 3981, 26, 20959, 61, 275, 446, 16911, 10, 2355, 14, 8830, 8, 890, 2687, 46, 12, 20959, 430, 199, 199, 3, 1448, 13498, 199, 51, 3981, 26, 4698, 1527, 2355, 14, 8830, 8, 890, 2687, 46, 12, 4698, 430, 13, 16, 14, 25, 12932, 16, 14, 16, 10404, 16, 14, 16, 199, 51, 3981, 4698, 26, 1527, 2355, 14, 8830, 8, 890, 2687, 46, 12, 20959, 430, 13, 16, 14, 25, 12932, 16, 14, 16, 10404, 16, 14, 16, 199, 199, 3, 334, 25489, 15, 706, 9, 334, 2734, 365, 282, 2366, 4252, 9, 199, 28212, 275, 959, 14, 16, 199, 3583, 275, 378, 14, 1717, 199, 83, 3583, 275, 2680, 14, 5079, 8, 3583, 9, 199, 199, 3, 28365, 402, 314, 8020, 5957, 1453, 199, 887, 275, 650, 14, 16, 27, 20088, 275, 841, 14, 16, 199, 77, 310, 275, 21187, 27, 10819, 69, 29, 9264, 199, 199, 9412, 73, 275, 378, 14, 16, 199, 199, 3, 8511, 1750, 373, 12, 2536, 574, 402, 378, 199, 86, 275, 2680, 14, 4250, 8, 46, 9, 199, 199, 3, 15397, 345, 1076, 6247, 1174, 1750, 199, 82, 275, 2680, 14, 4250, 8, 46, 9, 199, 199, 3, 428, 1038, 415, 221, 27337, 315, 282, 769, 199, 1795, 780, 275, 942, 199, 32757, 397, 275, 3474, 2677, 10, 46, 421, 199, 1361, 283, 6553, 8, 4850, 29, 21, 13026, 9, 2458, 70, 7, 450, 334, 887, 11, 4698, 10, 27888, 4856, 11164, 13, 28212, 4258, 199, 1361, 283, 6553, 8, 4850, 29, 1960, 13026, 9, 2458, 70, 7, 450, 334, 887, 11, 4698, 10, 27888, 4856, 17, 13, 28212, 4258, 199, 199, 3, 3141, 7373, 402, 314, 17625, 334, 706, 9, 199, 5553, 275, 8290, 14, 16, 199, 84, 275, 2680, 14, 5605, 8, 16, 14, 16, 12, 5303, 14, 16, 12, 3583, 9, 199, 5941, 275, 2680, 14, 4250, 63, 2930, 8, 84, 9, 199, 199, 84, 18, 275, 900, 14, 521, 342, 199, 1361, 283, 37, 9982, 900, 365, 1656, 620, 8, 84, 18, 13, 84, 17, 395, 283, 4696, 3530, 199, 199, 84, 17, 275, 900, 14, 521, 342, 199, 199, 509, 284, 12, 280, 315, 3874, 8, 84, 304, 272, 327, 900, 367, 282, 16925, 5957, 1324, 272, 340, 3367, 30, 8251, 14, 16, 26, 267, 333, 310, 275, 1227, 14, 21, 267, 10819, 69, 275, 1520, 14, 21, 339, 327, 900, 370, 9066, 314, 2536, 11076, 402, 314, 5957, 1453, 272, 340, 3367, 30, 5863, 14, 16, 26, 267, 333, 310, 275, 21187, 267, 10819, 69, 275, 20088, 339, 473, 832, 275, 1066, 757, 63, 12686, 14, 3302, 8, 17, 14, 16, 12, 46, 9, 272, 473, 832, 1491, 4698, 3672, 29, 9412, 69, 272, 473, 832, 59, 4698, 2938, 10, 29, 9412, 73, 339, 327, 26058, 1279, 32073, 31974, 31, 272, 31974, 275, 2680, 14, 10262, 8, 86, 8119, 1165, 14, 16, 2788, 16, 61, 339, 340, 822, 8, 329, 581, 13032, 16, 26, 398, 327, 11063, 4615, 289, 16648, 6634, 402, 314, 3178, 390, 8658, 1279, 32073, 398, 373, 59, 329, 581, 61, 275, 5305, 267, 519, 59, 329, 581, 61, 275, 2984, 82, 398, 327, 18726, 19441, 9246, 370, 314, 19441, 415, 769, 267, 367, 302, 315, 31974, 26, 288, 327, 428, 1038, 9246, 787, 5489, 701, 282, 334, 32054, 12, 900, 9, 4092, 288, 327, 2104, 8837, 25174, 2945, 288, 289, 723, 780, 14, 740, 1332, 78, 12, 280, 430, 288, 327, 436, 465, 282, 769, 367, 1924, 20242, 288, 19441, 9246, 59, 78, 1055, 740, 8, 280, 9, 13857, 11593, 275, 373, 13, 3583, 5830, 28212, 13, 77, 310, 6393, 4714, 14, 1838, 8, 51, 3981, 329, 581, 467, 17, 6393, 83, 3583, 10, 41, 832, 339, 587, 26, 267, 11593, 275, 373, 13, 3583, 5830, 28212, 13, 77, 310, 6393, 83, 3583, 10, 41, 832, 27, 339, 327, 5612, 32073, 440, 315, 314, 2984, 345, 1076, 6247, 272, 14762, 275, 2680, 14, 10262, 8, 82, 12932, 16, 2788, 16, 61, 272, 327, 21972, 5236, 84, 7441, 3432, 378, 14, 16, 272, 373, 59, 7865, 61, 275, 2680, 14, 4509, 8, 10962, 59, 7865, 61, 8119, 16, 14, 16, 12, 10962, 59, 7865, 467, 16, 14, 16, 9, 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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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 ]
SCgeeker/OpenSesame
setup_shared.py
2
1444
#!/usr/bin/env python #-*- coding:utf-8 -*- """ This file is part of OpenSesame. OpenSesame 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. OpenSesame 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 OpenSesame. If not, see <http://www.gnu.org/licenses/>. --- desc: Contains setup settings that are shared between the various platform-specific setup scripts. --- """ # List of included plug-ins included_plugins = [ 'advanced_delay', 'external_script', 'fixation_dot', 'form_base', 'form_text_input', 'form_consent', 'form_text_display', 'form_multiple_choice', 'joystick', 'notepad', 'parallel', 'port_reader', 'repeat_cycle', 'reset_feedback', 'srbox', 'text_display', 'text_input', 'touch_response', 'quest_staircase_init', 'quest_staircase_next', ] # List of included extensions included_extensions = [ 'automatic_backup', 'help', 'plugin_manager', 'quick_switcher', 'toolbar_menu', 'update_checker', 'qprogedit_preferences', 'dock_manager', 'psychopy_monitor_center', ]
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 13, 1837, 2803, 26, 1624, 13, 24, 1882, 199, 199, 624, 199, 2765, 570, 365, 1777, 402, 3232, 51, 397, 313, 14, 199, 199, 4299, 51, 397, 313, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 1589, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 199, 4299, 51, 397, 313, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 7911, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 17732, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 199, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 21632, 543, 3232, 51, 397, 313, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 2595, 199, 3257, 26, 199, 198, 6906, 3272, 2202, 626, 787, 5709, 3382, 314, 7750, 199, 198, 3246, 13, 6100, 3272, 10554, 14, 199, 2595, 199, 624, 199, 199, 3, 3820, 402, 5120, 14202, 13, 3617, 199, 12409, 63, 5265, 275, 359, 199, 198, 7, 14652, 63, 5814, 297, 199, 198, 7, 5159, 63, 1579, 297, 199, 198, 7, 970, 425, 63, 3287, 297, 199, 198, 7, 964, 63, 1095, 297, 199, 198, 7, 964, 63, 505, 63, 1210, 297, 199, 198, 7, 964, 63, 388, 1150, 297, 199, 198, 7, 964, 63, 505, 63, 2918, 297, 199, 198, 7, 964, 63, 6048, 63, 5095, 297, 199, 198, 7, 26729, 18043, 297, 199, 198, 7, 889, 2852, 350, 297, 199, 198, 7, 11887, 297, 199, 198, 7, 719, 63, 5503, 297, 199, 198, 3984, 321, 292, 63, 7612, 297, 199, 198, 3984, 409, 63, 13485, 297, 199, 198, 1159, 82, 1977, 297, 199, 198, 1133, 832, 63, 2918, 297, 199, 198, 1133, 832, 63, 1210, 297, 199, 198, 1133, 13087, 63, 1310, 297, 199, 198, 7, 613, 63, 1207, 723, 2546, 63, 826, 297, 199, 198, 7, 613, 63, 1207, 723, 2546, 63, 2184, 297, 199, 198, 61, 199, 199, 3, 3820, 402, 5120, 5478, 199, 12409, 63, 5359, 275, 359, 199, 198, 7, 23292, 63, 5751, 297, 199, 198, 7, 3437, 297, 199, 198, 7, 2718, 63, 2609, 297, 199, 198, 7, 13239, 63, 5656, 281, 297, 199, 198, 1133, 21943, 1700, 63, 4470, 297, 199, 198, 7, 873, 63, 6743, 297, 199, 198, 7, 81, 496, 303, 1741, 63, 18063, 297, 199, 198, 5121, 766, 63, 2609, 297, 199, 198, 7, 17799, 335, 927, 63, 7157, 63, 4218, 297, 199, 198, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 3, 13, 1837, 2803, 26, 1624, 13, 24, 1882, 199, 199, 624, 199, 2765, 570, 365, 1777, 402, 3232, 51, 397, 313, 14, 199, 199, 4299, 51, 397, 313, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 1589, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 199, 4299, 51, 397, 313, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 7911, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 17732, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 199, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 21632, 543, 3232, 51, 397, 313, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 2595, 199, 3257, 26, 199, 198, 6906, 3272, 2202, 626, 787, 5709, 3382, 314, 7750, 199, 198, 3246, 13, 6100, 3272, 10554, 14, 199, 2595, 199, 624, 199, 199, 3, 3820, 402, 5120, 14202, 13, 3617, 199, 12409, 63, 5265, 275, 359, 199, 198, 7, 14652, 63, 5814, 297, 199, 198, 7, 5159, 63, 1579, 297, 199, 198, 7, 970, 425, 63, 3287, 297, 199, 198, 7, 964, 63, 1095, 297, 199, 198, 7, 964, 63, 505, 63, 1210, 297, 199, 198, 7, 964, 63, 388, 1150, 297, 199, 198, 7, 964, 63, 505, 63, 2918, 297, 199, 198, 7, 964, 63, 6048, 63, 5095, 297, 199, 198, 7, 26729, 18043, 297, 199, 198, 7, 889, 2852, 350, 297, 199, 198, 7, 11887, 297, 199, 198, 7, 719, 63, 5503, 297, 199, 198, 3984, 321, 292, 63, 7612, 297, 199, 198, 3984, 409, 63, 13485, 297, 199, 198, 1159, 82, 1977, 297, 199, 198, 1133, 832, 63, 2918, 297, 199, 198, 1133, 832, 63, 1210, 297, 199, 198, 1133, 13087, 63, 1310, 297, 199, 198, 7, 613, 63, 1207, 723, 2546, 63, 826, 297, 199, 198, 7, 613, 63, 1207, 723, 2546, 63, 2184, 297, 199, 198, 61, 199, 199, 3, 3820, 402, 5120, 5478, 199, 12409, 63, 5359, 275, 359, 199, 198, 7, 23292, 63, 5751, 297, 199, 198, 7, 3437, 297, 199, 198, 7, 2718, 63, 2609, 297, 199, 198, 7, 13239, 63, 5656, 281, 297, 199, 198, 1133, 21943, 1700, 63, 4470, 297, 199, 198, 7, 873, 63, 6743, 297, 199, 198, 7, 81, 496, 303, 1741, 63, 18063, 297, 199, 198, 5121, 766, 63, 2609, 297, 199, 198, 7, 17799, 335, 927, 63, 7157, 63, 4218, 297, 199, 198, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
yewang15215/django
tests/postgres_tests/test_array.py
7
30141
import decimal import json import unittest import uuid from django import forms from django.core import exceptions, serializers, validators from django.core.exceptions import FieldError from django.core.management import call_command from django.db import IntegrityError, connection, models from django.test import TransactionTestCase, override_settings from django.test.utils import isolate_apps from django.utils import timezone from . import PostgreSQLTestCase from .models import ( ArrayFieldSubclass, CharArrayModel, DateTimeArrayModel, IntegerArrayModel, NestedIntegerArrayModel, NullableIntegerArrayModel, OtherTypesArrayModel, PostgreSQLModel, Tag, ) try: from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.forms import ( SimpleArrayField, SplitArrayField, SplitArrayWidget, ) except ImportError: pass class TestSaveLoad(PostgreSQLTestCase): def test_integer(self): instance = IntegerArrayModel(field=[1, 2, 3]) instance.save() loaded = IntegerArrayModel.objects.get() self.assertEqual(instance.field, loaded.field) def test_char(self): instance = CharArrayModel(field=['hello', 'goodbye']) instance.save() loaded = CharArrayModel.objects.get() self.assertEqual(instance.field, loaded.field) def test_dates(self): instance = DateTimeArrayModel( datetimes=[timezone.now()], dates=[timezone.now().date()], times=[timezone.now().time()], ) instance.save() loaded = DateTimeArrayModel.objects.get() self.assertEqual(instance.datetimes, loaded.datetimes) self.assertEqual(instance.dates, loaded.dates) self.assertEqual(instance.times, loaded.times) def test_tuples(self): instance = IntegerArrayModel(field=(1,)) instance.save() loaded = IntegerArrayModel.objects.get() self.assertSequenceEqual(instance.field, loaded.field) def test_integers_passed_as_strings(self): # This checks that get_prep_value is deferred properly instance = IntegerArrayModel(field=['1']) instance.save() loaded = IntegerArrayModel.objects.get() self.assertEqual(loaded.field, [1]) def test_default_null(self): instance = NullableIntegerArrayModel() instance.save() loaded = NullableIntegerArrayModel.objects.get(pk=instance.pk) self.assertIsNone(loaded.field) self.assertEqual(instance.field, loaded.field) def test_null_handling(self): instance = NullableIntegerArrayModel(field=None) instance.save() loaded = NullableIntegerArrayModel.objects.get() self.assertEqual(instance.field, loaded.field) instance = IntegerArrayModel(field=None) with self.assertRaises(IntegrityError): instance.save() def test_nested(self): instance = NestedIntegerArrayModel(field=[[1, 2], [3, 4]]) instance.save() loaded = NestedIntegerArrayModel.objects.get() self.assertEqual(instance.field, loaded.field) def test_other_array_types(self): instance = OtherTypesArrayModel( ips=['192.168.0.1', '::1'], uuids=[uuid.uuid4()], decimals=[decimal.Decimal(1.25), 1.75], tags=[Tag(1), Tag(2), Tag(3)], ) instance.save() loaded = OtherTypesArrayModel.objects.get() self.assertEqual(instance.ips, loaded.ips) self.assertEqual(instance.uuids, loaded.uuids) self.assertEqual(instance.decimals, loaded.decimals) self.assertEqual(instance.tags, loaded.tags) def test_null_from_db_value_handling(self): instance = OtherTypesArrayModel.objects.create( ips=['192.168.0.1', '::1'], uuids=[uuid.uuid4()], decimals=[decimal.Decimal(1.25), 1.75], tags=None, ) instance.refresh_from_db() self.assertIsNone(instance.tags) def test_model_set_on_base_field(self): instance = IntegerArrayModel() field = instance._meta.get_field('field') self.assertEqual(field.model, IntegerArrayModel) self.assertEqual(field.base_field.model, IntegerArrayModel) class TestQuerying(PostgreSQLTestCase): def setUp(self): self.objs = [ NullableIntegerArrayModel.objects.create(field=[1]), NullableIntegerArrayModel.objects.create(field=[2]), NullableIntegerArrayModel.objects.create(field=[2, 3]), NullableIntegerArrayModel.objects.create(field=[20, 30, 40]), NullableIntegerArrayModel.objects.create(field=None), ] def test_exact(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__exact=[1]), self.objs[:1] ) def test_exact_charfield(self): instance = CharArrayModel.objects.create(field=['text']) self.assertSequenceEqual( CharArrayModel.objects.filter(field=['text']), [instance] ) def test_exact_nested(self): instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]]) self.assertSequenceEqual( NestedIntegerArrayModel.objects.filter(field=[[1, 2], [3, 4]]), [instance] ) def test_isnull(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__isnull=True), self.objs[-1:] ) def test_gt(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__gt=[0]), self.objs[:4] ) def test_lt(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__lt=[2]), self.objs[:1] ) def test_in(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__in=[[1], [2]]), self.objs[:2] ) @unittest.expectedFailure def test_in_including_F_object(self): # This test asserts that Array objects passed to filters can be # constructed to contain F objects. This currently doesn't work as the # psycopg2 mogrify method that generates the ARRAY() syntax is # expecting literals, not column references (#27095). self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__in=[[models.F('id')]]), self.objs[:2] ) def test_in_as_F_object(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__in=[models.F('field')]), self.objs[:4] ) def test_contained_by(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__contained_by=[1, 2]), self.objs[:2] ) @unittest.expectedFailure def test_contained_by_including_F_object(self): # This test asserts that Array objects passed to filters can be # constructed to contain F objects. This currently doesn't work as the # psycopg2 mogrify method that generates the ARRAY() syntax is # expecting literals, not column references (#27095). self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__contained_by=[models.F('id'), 2]), self.objs[:2] ) def test_contains(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__contains=[2]), self.objs[1:3] ) def test_contains_charfield(self): # Regression for #22907 self.assertSequenceEqual( CharArrayModel.objects.filter(field__contains=['text']), [] ) def test_contained_by_charfield(self): self.assertSequenceEqual( CharArrayModel.objects.filter(field__contained_by=['text']), [] ) def test_overlap_charfield(self): self.assertSequenceEqual( CharArrayModel.objects.filter(field__overlap=['text']), [] ) def test_index(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__0=2), self.objs[1:3] ) def test_index_chained(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__0__lt=3), self.objs[0:3] ) def test_index_nested(self): instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]]) self.assertSequenceEqual( NestedIntegerArrayModel.objects.filter(field__0__0=1), [instance] ) @unittest.expectedFailure def test_index_used_on_nested_data(self): instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]]) self.assertSequenceEqual( NestedIntegerArrayModel.objects.filter(field__0=[1, 2]), [instance] ) def test_overlap(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__overlap=[1, 2]), self.objs[0:3] ) def test_len(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__len__lte=2), self.objs[0:3] ) def test_len_empty_array(self): obj = NullableIntegerArrayModel.objects.create(field=[]) self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__len=0), [obj] ) def test_slice(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__0_1=[2]), self.objs[1:3] ) self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter(field__0_2=[2, 3]), self.objs[2:3] ) @unittest.expectedFailure def test_slice_nested(self): instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]]) self.assertSequenceEqual( NestedIntegerArrayModel.objects.filter(field__0__0_1=[1]), [instance] ) def test_usage_in_subquery(self): self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter( id__in=NullableIntegerArrayModel.objects.filter(field__len=3) ), [self.objs[3]] ) def test_unsupported_lookup(self): msg = "Unsupported lookup '0_bar' for ArrayField or join on the field not permitted." with self.assertRaisesMessage(FieldError, msg): list(NullableIntegerArrayModel.objects.filter(field__0_bar=[2])) msg = "Unsupported lookup '0bar' for ArrayField or join on the field not permitted." with self.assertRaisesMessage(FieldError, msg): list(NullableIntegerArrayModel.objects.filter(field__0bar=[2])) class TestDateTimeExactQuerying(PostgreSQLTestCase): def setUp(self): now = timezone.now() self.datetimes = [now] self.dates = [now.date()] self.times = [now.time()] self.objs = [ DateTimeArrayModel.objects.create( datetimes=self.datetimes, dates=self.dates, times=self.times, ) ] def test_exact_datetimes(self): self.assertSequenceEqual( DateTimeArrayModel.objects.filter(datetimes=self.datetimes), self.objs ) def test_exact_dates(self): self.assertSequenceEqual( DateTimeArrayModel.objects.filter(dates=self.dates), self.objs ) def test_exact_times(self): self.assertSequenceEqual( DateTimeArrayModel.objects.filter(times=self.times), self.objs ) class TestOtherTypesExactQuerying(PostgreSQLTestCase): def setUp(self): self.ips = ['192.168.0.1', '::1'] self.uuids = [uuid.uuid4()] self.decimals = [decimal.Decimal(1.25), 1.75] self.tags = [Tag(1), Tag(2), Tag(3)] self.objs = [ OtherTypesArrayModel.objects.create( ips=self.ips, uuids=self.uuids, decimals=self.decimals, tags=self.tags, ) ] def test_exact_ip_addresses(self): self.assertSequenceEqual( OtherTypesArrayModel.objects.filter(ips=self.ips), self.objs ) def test_exact_uuids(self): self.assertSequenceEqual( OtherTypesArrayModel.objects.filter(uuids=self.uuids), self.objs ) def test_exact_decimals(self): self.assertSequenceEqual( OtherTypesArrayModel.objects.filter(decimals=self.decimals), self.objs ) def test_exact_tags(self): self.assertSequenceEqual( OtherTypesArrayModel.objects.filter(tags=self.tags), self.objs ) @isolate_apps('postgres_tests') class TestChecks(PostgreSQLTestCase): def test_field_checks(self): class MyModel(PostgreSQLModel): field = ArrayField(models.CharField()) model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) # The inner CharField is missing a max_length. self.assertEqual(errors[0].id, 'postgres.E001') self.assertIn('max_length', errors[0].msg) def test_invalid_base_fields(self): class MyModel(PostgreSQLModel): field = ArrayField(models.ManyToManyField('postgres_tests.IntegerArrayModel')) model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) self.assertEqual(errors[0].id, 'postgres.E002') def test_nested_field_checks(self): """ Nested ArrayFields are permitted. """ class MyModel(PostgreSQLModel): field = ArrayField(ArrayField(models.CharField())) model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) # The inner CharField is missing a max_length. self.assertEqual(errors[0].id, 'postgres.E001') self.assertIn('max_length', errors[0].msg) @unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests") class TestMigrations(TransactionTestCase): available_apps = ['postgres_tests'] def test_deconstruct(self): field = ArrayField(models.IntegerField()) name, path, args, kwargs = field.deconstruct() new = ArrayField(*args, **kwargs) self.assertEqual(type(new.base_field), type(field.base_field)) def test_deconstruct_with_size(self): field = ArrayField(models.IntegerField(), size=3) name, path, args, kwargs = field.deconstruct() new = ArrayField(*args, **kwargs) self.assertEqual(new.size, field.size) def test_deconstruct_args(self): field = ArrayField(models.CharField(max_length=20)) name, path, args, kwargs = field.deconstruct() new = ArrayField(*args, **kwargs) self.assertEqual(new.base_field.max_length, field.base_field.max_length) def test_subclass_deconstruct(self): field = ArrayField(models.IntegerField()) name, path, args, kwargs = field.deconstruct() self.assertEqual(path, 'django.contrib.postgres.fields.ArrayField') field = ArrayFieldSubclass() name, path, args, kwargs = field.deconstruct() self.assertEqual(path, 'postgres_tests.models.ArrayFieldSubclass') @override_settings(MIGRATION_MODULES={ "postgres_tests": "postgres_tests.array_default_migrations", }) def test_adding_field_with_default(self): # See #22962 table_name = 'postgres_tests_integerarraydefaultmodel' with connection.cursor() as cursor: self.assertNotIn(table_name, connection.introspection.table_names(cursor)) call_command('migrate', 'postgres_tests', verbosity=0) with connection.cursor() as cursor: self.assertIn(table_name, connection.introspection.table_names(cursor)) call_command('migrate', 'postgres_tests', 'zero', verbosity=0) with connection.cursor() as cursor: self.assertNotIn(table_name, connection.introspection.table_names(cursor)) @override_settings(MIGRATION_MODULES={ "postgres_tests": "postgres_tests.array_index_migrations", }) def test_adding_arrayfield_with_index(self): """ ArrayField shouldn't have varchar_patterns_ops or text_patterns_ops indexes. """ table_name = 'postgres_tests_chartextarrayindexmodel' call_command('migrate', 'postgres_tests', verbosity=0) with connection.cursor() as cursor: like_constraint_columns_list = [ v['columns'] for k, v in list(connection.introspection.get_constraints(cursor, table_name).items()) if k.endswith('_like') ] # Only the CharField should have a LIKE index. self.assertEqual(like_constraint_columns_list, [['char2']]) # All fields should have regular indexes. with connection.cursor() as cursor: indexes = [ c['columns'][0] for c in connection.introspection.get_constraints(cursor, table_name).values() if c['index'] and len(c['columns']) == 1 ] self.assertIn('char', indexes) self.assertIn('char2', indexes) self.assertIn('text', indexes) call_command('migrate', 'postgres_tests', 'zero', verbosity=0) with connection.cursor() as cursor: self.assertNotIn(table_name, connection.introspection.table_names(cursor)) class TestSerialization(PostgreSQLTestCase): test_data = ( '[{"fields": {"field": "[\\"1\\", \\"2\\", null]"}, "model": "postgres_tests.integerarraymodel", "pk": null}]' ) def test_dumping(self): instance = IntegerArrayModel(field=[1, 2, None]) data = serializers.serialize('json', [instance]) self.assertEqual(json.loads(data), json.loads(self.test_data)) def test_loading(self): instance = list(serializers.deserialize('json', self.test_data))[0].object self.assertEqual(instance.field, [1, 2, None]) class TestValidation(PostgreSQLTestCase): def test_unbounded(self): field = ArrayField(models.IntegerField()) with self.assertRaises(exceptions.ValidationError) as cm: field.clean([1, None], None) self.assertEqual(cm.exception.code, 'item_invalid') self.assertEqual( cm.exception.message % cm.exception.params, 'Item 1 in the array did not validate: This field cannot be null.' ) def test_blank_true(self): field = ArrayField(models.IntegerField(blank=True, null=True)) # This should not raise a validation error field.clean([1, None], None) def test_with_size(self): field = ArrayField(models.IntegerField(), size=3) field.clean([1, 2, 3], None) with self.assertRaises(exceptions.ValidationError) as cm: field.clean([1, 2, 3, 4], None) self.assertEqual(cm.exception.messages[0], 'List contains 4 items, it should contain no more than 3.') def test_nested_array_mismatch(self): field = ArrayField(ArrayField(models.IntegerField())) field.clean([[1, 2], [3, 4]], None) with self.assertRaises(exceptions.ValidationError) as cm: field.clean([[1, 2], [3, 4, 5]], None) self.assertEqual(cm.exception.code, 'nested_array_mismatch') self.assertEqual(cm.exception.messages[0], 'Nested arrays must have the same length.') def test_with_base_field_error_params(self): field = ArrayField(models.CharField(max_length=2)) with self.assertRaises(exceptions.ValidationError) as cm: field.clean(['abc'], None) self.assertEqual(len(cm.exception.error_list), 1) exception = cm.exception.error_list[0] self.assertEqual( exception.message, 'Item 0 in the array did not validate: Ensure this value has at most 2 characters (it has 3).' ) self.assertEqual(exception.code, 'item_invalid') self.assertEqual(exception.params, {'nth': 0, 'value': 'abc', 'limit_value': 2, 'show_value': 3}) def test_with_validators(self): field = ArrayField(models.IntegerField(validators=[validators.MinValueValidator(1)])) field.clean([1, 2], None) with self.assertRaises(exceptions.ValidationError) as cm: field.clean([0], None) self.assertEqual(len(cm.exception.error_list), 1) exception = cm.exception.error_list[0] self.assertEqual( exception.message, 'Item 0 in the array did not validate: Ensure this value is greater than or equal to 1.' ) self.assertEqual(exception.code, 'item_invalid') self.assertEqual(exception.params, {'nth': 0, 'value': 0, 'limit_value': 1, 'show_value': 0}) class TestSimpleFormField(PostgreSQLTestCase): def test_valid(self): field = SimpleArrayField(forms.CharField()) value = field.clean('a,b,c') self.assertEqual(value, ['a', 'b', 'c']) def test_to_python_fail(self): field = SimpleArrayField(forms.IntegerField()) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('a,b,9') self.assertEqual(cm.exception.messages[0], 'Item 0 in the array did not validate: Enter a whole number.') def test_validate_fail(self): field = SimpleArrayField(forms.CharField(required=True)) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('a,b,') self.assertEqual(cm.exception.messages[0], 'Item 2 in the array did not validate: This field is required.') def test_validate_fail_base_field_error_params(self): field = SimpleArrayField(forms.CharField(max_length=2)) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('abc,c,defg') errors = cm.exception.error_list self.assertEqual(len(errors), 2) first_error = errors[0] self.assertEqual( first_error.message, 'Item 0 in the array did not validate: Ensure this value has at most 2 characters (it has 3).' ) self.assertEqual(first_error.code, 'item_invalid') self.assertEqual(first_error.params, {'nth': 0, 'value': 'abc', 'limit_value': 2, 'show_value': 3}) second_error = errors[1] self.assertEqual( second_error.message, 'Item 2 in the array did not validate: Ensure this value has at most 2 characters (it has 4).' ) self.assertEqual(second_error.code, 'item_invalid') self.assertEqual(second_error.params, {'nth': 2, 'value': 'defg', 'limit_value': 2, 'show_value': 4}) def test_validators_fail(self): field = SimpleArrayField(forms.RegexField('[a-e]{2}')) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('a,bc,de') self.assertEqual(cm.exception.messages[0], 'Item 0 in the array did not validate: Enter a valid value.') def test_delimiter(self): field = SimpleArrayField(forms.CharField(), delimiter='|') value = field.clean('a|b|c') self.assertEqual(value, ['a', 'b', 'c']) def test_delimiter_with_nesting(self): field = SimpleArrayField(SimpleArrayField(forms.CharField()), delimiter='|') value = field.clean('a,b|c,d') self.assertEqual(value, [['a', 'b'], ['c', 'd']]) def test_prepare_value(self): field = SimpleArrayField(forms.CharField()) value = field.prepare_value(['a', 'b', 'c']) self.assertEqual(value, 'a,b,c') def test_max_length(self): field = SimpleArrayField(forms.CharField(), max_length=2) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('a,b,c') self.assertEqual(cm.exception.messages[0], 'List contains 3 items, it should contain no more than 2.') def test_min_length(self): field = SimpleArrayField(forms.CharField(), min_length=4) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('a,b,c') self.assertEqual(cm.exception.messages[0], 'List contains 3 items, it should contain no fewer than 4.') def test_required(self): field = SimpleArrayField(forms.CharField(), required=True) with self.assertRaises(exceptions.ValidationError) as cm: field.clean('') self.assertEqual(cm.exception.messages[0], 'This field is required.') def test_model_field_formfield(self): model_field = ArrayField(models.CharField(max_length=27)) form_field = model_field.formfield() self.assertIsInstance(form_field, SimpleArrayField) self.assertIsInstance(form_field.base_field, forms.CharField) self.assertEqual(form_field.base_field.max_length, 27) def test_model_field_formfield_size(self): model_field = ArrayField(models.CharField(max_length=27), size=4) form_field = model_field.formfield() self.assertIsInstance(form_field, SimpleArrayField) self.assertEqual(form_field.max_length, 4) def test_already_converted_value(self): field = SimpleArrayField(forms.CharField()) vals = ['a', 'b', 'c'] self.assertEqual(field.clean(vals), vals) class TestSplitFormField(PostgreSQLTestCase): def test_valid(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(), size=3) data = {'array_0': 'a', 'array_1': 'b', 'array_2': 'c'} form = SplitForm(data) self.assertTrue(form.is_valid()) self.assertEqual(form.cleaned_data, {'array': ['a', 'b', 'c']}) def test_required(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(), required=True, size=3) data = {'array_0': '', 'array_1': '', 'array_2': ''} form = SplitForm(data) self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'array': ['This field is required.']}) def test_remove_trailing_nulls(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(required=False), size=5, remove_trailing_nulls=True) data = {'array_0': 'a', 'array_1': '', 'array_2': 'b', 'array_3': '', 'array_4': ''} form = SplitForm(data) self.assertTrue(form.is_valid(), form.errors) self.assertEqual(form.cleaned_data, {'array': ['a', '', 'b']}) def test_remove_trailing_nulls_not_required(self): class SplitForm(forms.Form): array = SplitArrayField( forms.CharField(required=False), size=2, remove_trailing_nulls=True, required=False, ) data = {'array_0': '', 'array_1': ''} form = SplitForm(data) self.assertTrue(form.is_valid()) self.assertEqual(form.cleaned_data, {'array': []}) def test_required_field(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(), size=3) data = {'array_0': 'a', 'array_1': 'b', 'array_2': ''} form = SplitForm(data) self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'array': ['Item 2 in the array did not validate: This field is required.']}) def test_invalid_integer(self): msg = 'Item 1 in the array did not validate: Ensure this value is less than or equal to 100.' with self.assertRaisesMessage(exceptions.ValidationError, msg): SplitArrayField(forms.IntegerField(max_value=100), size=2).clean([0, 101]) def test_rendering(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(), size=3) self.assertHTMLEqual(str(SplitForm()), ''' <tr> <th><label for="id_array_0">Array:</label></th> <td> <input id="id_array_0" name="array_0" type="text" required /> <input id="id_array_1" name="array_1" type="text" required /> <input id="id_array_2" name="array_2" type="text" required /> </td> </tr> ''') def test_invalid_char_length(self): field = SplitArrayField(forms.CharField(max_length=2), size=3) with self.assertRaises(exceptions.ValidationError) as cm: field.clean(['abc', 'c', 'defg']) self.assertEqual(cm.exception.messages, [ 'Item 0 in the array did not validate: Ensure this value has at most 2 characters (it has 3).', 'Item 2 in the array did not validate: Ensure this value has at most 2 characters (it has 4).', ]) def test_splitarraywidget_value_omitted_from_data(self): class Form(forms.ModelForm): field = SplitArrayField(forms.IntegerField(), required=False, size=2) class Meta: model = IntegerArrayModel fields = ('field',) form = Form({'field_0': '1', 'field_1': '2'}) self.assertEqual(form.errors, {}) obj = form.save(commit=False) self.assertEqual(obj.field, [1, 2]) class TestSplitFormWidget(PostgreSQLTestCase): def test_value_omitted_from_data(self): widget = SplitArrayWidget(forms.TextInput(), size=2) self.assertIs(widget.value_omitted_from_data({}, {}, 'field'), True) self.assertIs(widget.value_omitted_from_data({'field_0': 'value'}, {}, 'field'), False) self.assertIs(widget.value_omitted_from_data({'field_1': 'value'}, {}, 'field'), False) self.assertIs(widget.value_omitted_from_data({'field_0': 'value', 'field_1': 'value'}, {}, 'field'), False)
bsd-3-clause
[ 646, 6107, 199, 646, 2022, 199, 646, 2882, 199, 646, 5377, 199, 199, 504, 1639, 492, 4513, 199, 504, 1639, 14, 1018, 492, 4967, 12, 12506, 12, 14370, 199, 504, 1639, 14, 1018, 14, 3924, 492, 27691, 199, 504, 1639, 14, 1018, 14, 8110, 492, 1240, 63, 1531, 199, 504, 1639, 14, 697, 492, 26864, 12, 1950, 12, 1709, 199, 504, 1639, 14, 396, 492, 18244, 1746, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 365, 16288, 63, 5181, 199, 504, 1639, 14, 1208, 492, 7137, 199, 199, 504, 1275, 492, 20175, 1746, 199, 504, 1275, 992, 492, 334, 272, 8725, 792, 23636, 12, 6659, 3836, 1685, 12, 13686, 3836, 1685, 12, 7225, 3836, 1685, 12, 272, 23137, 2674, 3836, 1685, 12, 12119, 461, 2674, 3836, 1685, 12, 5439, 4100, 3836, 1685, 12, 272, 20175, 1685, 12, 8053, 12, 199, 9, 199, 199, 893, 26, 272, 687, 1639, 14, 2828, 14, 10675, 14, 955, 492, 8725, 792, 272, 687, 1639, 14, 2828, 14, 10675, 14, 3351, 492, 334, 267, 5870, 3836, 792, 12, 11740, 3836, 792, 12, 11740, 3836, 3339, 12, 272, 776, 199, 2590, 3545, 26, 272, 986, 421, 199, 533, 1379, 8229, 6200, 8, 31433, 1746, 304, 339, 347, 511, 63, 4115, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 1524, 17, 12, 499, 12, 650, 566, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 1560, 8, 277, 304, 267, 1256, 275, 6659, 3836, 1685, 8, 698, 2968, 5006, 297, 283, 8302, 16481, 1105, 267, 1256, 14, 2117, 342, 267, 6511, 275, 6659, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 9356, 8, 277, 304, 267, 1256, 275, 13686, 3836, 1685, 8, 288, 29297, 1524, 7145, 14, 2131, 15618, 288, 10831, 1524, 7145, 14, 2131, 1252, 602, 15618, 288, 5431, 1524, 7145, 14, 2131, 1252, 521, 15618, 267, 776, 267, 1256, 14, 2117, 342, 267, 6511, 275, 13686, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 31601, 12, 6511, 14, 31601, 9, 267, 291, 14, 629, 8, 842, 14, 9356, 12, 6511, 14, 9356, 9, 267, 291, 14, 629, 8, 842, 14, 4508, 12, 6511, 14, 4508, 9, 339, 347, 511, 63, 11760, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 2687, 17, 4641, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 19376, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 23931, 63, 12070, 63, 305, 63, 5465, 8, 277, 304, 267, 327, 961, 5920, 626, 664, 63, 10837, 63, 585, 365, 12309, 7684, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 2968, 17, 1105, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 4591, 14, 698, 12, 359, 17, 566, 339, 347, 511, 63, 885, 63, 2307, 8, 277, 304, 267, 1256, 275, 12119, 461, 2674, 3836, 1685, 342, 267, 1256, 14, 2117, 342, 267, 6511, 275, 12119, 461, 2674, 3836, 1685, 14, 1462, 14, 362, 8, 2051, 29, 842, 14, 2051, 9, 267, 291, 14, 7702, 8, 4591, 14, 698, 9, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 2307, 63, 22273, 8, 277, 304, 267, 1256, 275, 12119, 461, 2674, 3836, 1685, 8, 698, 29, 403, 9, 267, 1256, 14, 2117, 342, 267, 6511, 275, 12119, 461, 2674, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 398, 1256, 275, 7225, 3836, 1685, 8, 698, 29, 403, 9, 267, 543, 291, 14, 1855, 8, 24823, 304, 288, 1256, 14, 2117, 342, 339, 347, 511, 63, 6376, 8, 277, 304, 267, 1256, 275, 23137, 2674, 3836, 1685, 8, 698, 16025, 17, 12, 499, 467, 359, 19, 12, 841, 3934, 267, 1256, 14, 2117, 342, 267, 6511, 275, 23137, 2674, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 1848, 63, 1144, 63, 1313, 8, 277, 304, 267, 1256, 275, 5439, 4100, 3836, 1685, 8, 288, 15017, 2968, 5756, 14, 6568, 14, 16, 14, 17, 297, 19069, 17, 995, 288, 26650, 1524, 2580, 14, 2580, 20, 15618, 288, 6107, 83, 1524, 6355, 14, 6745, 8, 17, 14, 821, 395, 413, 14, 2194, 467, 288, 3762, 1524, 1931, 8, 17, 395, 8053, 8, 18, 395, 8053, 8, 19, 4360, 267, 776, 267, 1256, 14, 2117, 342, 267, 6511, 275, 5439, 4100, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 6142, 12, 6511, 14, 6142, 9, 267, 291, 14, 629, 8, 842, 14, 18401, 12, 6511, 14, 18401, 9, 267, 291, 14, 629, 8, 842, 14, 6355, 83, 12, 6511, 14, 6355, 83, 9, 267, 291, 14, 629, 8, 842, 14, 2969, 12, 6511, 14, 2969, 9, 339, 347, 511, 63, 2307, 63, 504, 63, 697, 63, 585, 63, 22273, 8, 277, 304, 267, 1256, 275, 5439, 4100, 3836, 1685, 14, 1462, 14, 981, 8, 288, 15017, 2968, 5756, 14, 6568, 14, 16, 14, 17, 297, 19069, 17, 995, 288, 26650, 1524, 2580, 14, 2580, 20, 15618, 288, 6107, 83, 1524, 6355, 14, 6745, 8, 17, 14, 821, 395, 413, 14, 2194, 467, 288, 3762, 29, 403, 12, 267, 776, 267, 1256, 14, 6635, 63, 504, 63, 697, 342, 267, 291, 14, 7702, 8, 842, 14, 2969, 9, 339, 347, 511, 63, 1238, 63, 409, 63, 265, 63, 1095, 63, 698, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 342, 267, 901, 275, 1256, 423, 2024, 14, 362, 63, 698, 360, 698, 358, 267, 291, 14, 629, 8, 698, 14, 1238, 12, 7225, 3836, 1685, 9, 267, 291, 14, 629, 8, 698, 14, 1095, 63, 698, 14, 1238, 12, 7225, 3836, 1685, 9, 421, 199, 533 ]
[ 6107, 199, 646, 2022, 199, 646, 2882, 199, 646, 5377, 199, 199, 504, 1639, 492, 4513, 199, 504, 1639, 14, 1018, 492, 4967, 12, 12506, 12, 14370, 199, 504, 1639, 14, 1018, 14, 3924, 492, 27691, 199, 504, 1639, 14, 1018, 14, 8110, 492, 1240, 63, 1531, 199, 504, 1639, 14, 697, 492, 26864, 12, 1950, 12, 1709, 199, 504, 1639, 14, 396, 492, 18244, 1746, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 365, 16288, 63, 5181, 199, 504, 1639, 14, 1208, 492, 7137, 199, 199, 504, 1275, 492, 20175, 1746, 199, 504, 1275, 992, 492, 334, 272, 8725, 792, 23636, 12, 6659, 3836, 1685, 12, 13686, 3836, 1685, 12, 7225, 3836, 1685, 12, 272, 23137, 2674, 3836, 1685, 12, 12119, 461, 2674, 3836, 1685, 12, 5439, 4100, 3836, 1685, 12, 272, 20175, 1685, 12, 8053, 12, 199, 9, 199, 199, 893, 26, 272, 687, 1639, 14, 2828, 14, 10675, 14, 955, 492, 8725, 792, 272, 687, 1639, 14, 2828, 14, 10675, 14, 3351, 492, 334, 267, 5870, 3836, 792, 12, 11740, 3836, 792, 12, 11740, 3836, 3339, 12, 272, 776, 199, 2590, 3545, 26, 272, 986, 421, 199, 533, 1379, 8229, 6200, 8, 31433, 1746, 304, 339, 347, 511, 63, 4115, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 1524, 17, 12, 499, 12, 650, 566, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 1560, 8, 277, 304, 267, 1256, 275, 6659, 3836, 1685, 8, 698, 2968, 5006, 297, 283, 8302, 16481, 1105, 267, 1256, 14, 2117, 342, 267, 6511, 275, 6659, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 9356, 8, 277, 304, 267, 1256, 275, 13686, 3836, 1685, 8, 288, 29297, 1524, 7145, 14, 2131, 15618, 288, 10831, 1524, 7145, 14, 2131, 1252, 602, 15618, 288, 5431, 1524, 7145, 14, 2131, 1252, 521, 15618, 267, 776, 267, 1256, 14, 2117, 342, 267, 6511, 275, 13686, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 31601, 12, 6511, 14, 31601, 9, 267, 291, 14, 629, 8, 842, 14, 9356, 12, 6511, 14, 9356, 9, 267, 291, 14, 629, 8, 842, 14, 4508, 12, 6511, 14, 4508, 9, 339, 347, 511, 63, 11760, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 2687, 17, 4641, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 19376, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 23931, 63, 12070, 63, 305, 63, 5465, 8, 277, 304, 267, 327, 961, 5920, 626, 664, 63, 10837, 63, 585, 365, 12309, 7684, 267, 1256, 275, 7225, 3836, 1685, 8, 698, 2968, 17, 1105, 267, 1256, 14, 2117, 342, 267, 6511, 275, 7225, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 4591, 14, 698, 12, 359, 17, 566, 339, 347, 511, 63, 885, 63, 2307, 8, 277, 304, 267, 1256, 275, 12119, 461, 2674, 3836, 1685, 342, 267, 1256, 14, 2117, 342, 267, 6511, 275, 12119, 461, 2674, 3836, 1685, 14, 1462, 14, 362, 8, 2051, 29, 842, 14, 2051, 9, 267, 291, 14, 7702, 8, 4591, 14, 698, 9, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 2307, 63, 22273, 8, 277, 304, 267, 1256, 275, 12119, 461, 2674, 3836, 1685, 8, 698, 29, 403, 9, 267, 1256, 14, 2117, 342, 267, 6511, 275, 12119, 461, 2674, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 398, 1256, 275, 7225, 3836, 1685, 8, 698, 29, 403, 9, 267, 543, 291, 14, 1855, 8, 24823, 304, 288, 1256, 14, 2117, 342, 339, 347, 511, 63, 6376, 8, 277, 304, 267, 1256, 275, 23137, 2674, 3836, 1685, 8, 698, 16025, 17, 12, 499, 467, 359, 19, 12, 841, 3934, 267, 1256, 14, 2117, 342, 267, 6511, 275, 23137, 2674, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 698, 12, 6511, 14, 698, 9, 339, 347, 511, 63, 1848, 63, 1144, 63, 1313, 8, 277, 304, 267, 1256, 275, 5439, 4100, 3836, 1685, 8, 288, 15017, 2968, 5756, 14, 6568, 14, 16, 14, 17, 297, 19069, 17, 995, 288, 26650, 1524, 2580, 14, 2580, 20, 15618, 288, 6107, 83, 1524, 6355, 14, 6745, 8, 17, 14, 821, 395, 413, 14, 2194, 467, 288, 3762, 1524, 1931, 8, 17, 395, 8053, 8, 18, 395, 8053, 8, 19, 4360, 267, 776, 267, 1256, 14, 2117, 342, 267, 6511, 275, 5439, 4100, 3836, 1685, 14, 1462, 14, 362, 342, 267, 291, 14, 629, 8, 842, 14, 6142, 12, 6511, 14, 6142, 9, 267, 291, 14, 629, 8, 842, 14, 18401, 12, 6511, 14, 18401, 9, 267, 291, 14, 629, 8, 842, 14, 6355, 83, 12, 6511, 14, 6355, 83, 9, 267, 291, 14, 629, 8, 842, 14, 2969, 12, 6511, 14, 2969, 9, 339, 347, 511, 63, 2307, 63, 504, 63, 697, 63, 585, 63, 22273, 8, 277, 304, 267, 1256, 275, 5439, 4100, 3836, 1685, 14, 1462, 14, 981, 8, 288, 15017, 2968, 5756, 14, 6568, 14, 16, 14, 17, 297, 19069, 17, 995, 288, 26650, 1524, 2580, 14, 2580, 20, 15618, 288, 6107, 83, 1524, 6355, 14, 6745, 8, 17, 14, 821, 395, 413, 14, 2194, 467, 288, 3762, 29, 403, 12, 267, 776, 267, 1256, 14, 6635, 63, 504, 63, 697, 342, 267, 291, 14, 7702, 8, 842, 14, 2969, 9, 339, 347, 511, 63, 1238, 63, 409, 63, 265, 63, 1095, 63, 698, 8, 277, 304, 267, 1256, 275, 7225, 3836, 1685, 342, 267, 901, 275, 1256, 423, 2024, 14, 362, 63, 698, 360, 698, 358, 267, 291, 14, 629, 8, 698, 14, 1238, 12, 7225, 3836, 1685, 9, 267, 291, 14, 629, 8, 698, 14, 1095, 63, 698, 14, 1238, 12, 7225, 3836, 1685, 9, 421, 199, 533, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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Factory from django_auth_lti import const from mock import patch, ANY, DEFAULT, Mock from basic_lti_app.views import lti_launch @patch.multiple('basic_lti_app.views', render=DEFAULT) class BasicLTIAppViewsTests(unittest.TestCase): longMessage = True def setUp(self): self.request = RequestFactory().post('/fake-path') self.request.user = Mock(name='user_mock') self.request.user.is_authenticated.return_value = True self.request.session = { 'LTI_LAUNCH': { 'lis_course_offering_sourcedid' : '5', 'roles' : [const.INSTRUCTOR,const.TEACHING_ASSISTANT,const.ADMINISTRATOR,const.CONTENT_DEVELOPER], } } @patch('basic_lti_app.views.redirect') def test_get_lti_param(self, mock_redirect, render): """ Test that get_table_name_from_canvas_role is called with the correct id """ lti_launch(self.request) mock_redirect.assert_called_with('basic_lti_app:main')
mit
[ 646, 2882, 199, 504, 1639, 14, 396, 492, 18638, 199, 504, 1639, 63, 1178, 63, 21934, 492, 950, 199, 504, 1683, 492, 3371, 12, 1821, 12, 6186, 12, 4420, 199, 504, 5678, 63, 21934, 63, 571, 14, 4196, 492, 634, 280, 63, 9850, 199, 199, 32, 2068, 14, 6048, 360, 4316, 63, 21934, 63, 571, 14, 4196, 297, 3795, 29, 3472, 9, 199, 533, 10082, 44, 13247, 2640, 21180, 2925, 8, 2796, 14, 1746, 304, 272, 1846, 2209, 275, 715, 339, 347, 3613, 8, 277, 304, 398, 291, 14, 1069, 275, 18638, 1252, 1932, 2336, 3183, 13, 515, 358, 267, 291, 14, 1069, 14, 751, 275, 4420, 8, 354, 534, 751, 63, 1805, 358, 267, 291, 14, 1069, 14, 751, 14, 374, 63, 12177, 14, 1107, 63, 585, 275, 715, 7318, 291, 14, 1069, 14, 1730, 275, 469, 288, 283, 44, 13247, 63, 5837, 1734, 1244, 356, 469, 355, 283, 14392, 63, 1972, 63, 19501, 63, 1365, 14887, 7, 520, 283, 21, 297, 355, 283, 8050, 7, 520, 359, 1297, 14, 568, 8893, 726, 12, 1297, 14, 3727, 33, 1244, 1206, 63, 16435, 840, 1441, 12, 1297, 14, 14288, 21340, 6467, 12, 1297, 14, 9663, 63, 1093, 2524, 1484, 4227, 467, 288, 789, 267, 789, 339, 768, 2068, 360, 4316, 63, 21934, 63, 571, 14, 4196, 14, 4876, 358, 272, 347, 511, 63, 362, 63, 21934, 63, 635, 8, 277, 12, 1683, 63, 4876, 12, 3795, 304, 267, 408, 267, 1379, 626, 664, 63, 1224, 63, 354, 63, 504, 63, 7682, 63, 3756, 365, 2797, 543, 314, 3211, 1305, 267, 408, 267, 634, 280, 63, 9850, 8, 277, 14, 1069, 9, 267, 1683, 63, 4876, 14, 479, 63, 3527, 63, 1045, 360, 4316, 63, 21934, 63, 571, 26, 973, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2882, 199, 504, 1639, 14, 396, 492, 18638, 199, 504, 1639, 63, 1178, 63, 21934, 492, 950, 199, 504, 1683, 492, 3371, 12, 1821, 12, 6186, 12, 4420, 199, 504, 5678, 63, 21934, 63, 571, 14, 4196, 492, 634, 280, 63, 9850, 199, 199, 32, 2068, 14, 6048, 360, 4316, 63, 21934, 63, 571, 14, 4196, 297, 3795, 29, 3472, 9, 199, 533, 10082, 44, 13247, 2640, 21180, 2925, 8, 2796, 14, 1746, 304, 272, 1846, 2209, 275, 715, 339, 347, 3613, 8, 277, 304, 398, 291, 14, 1069, 275, 18638, 1252, 1932, 2336, 3183, 13, 515, 358, 267, 291, 14, 1069, 14, 751, 275, 4420, 8, 354, 534, 751, 63, 1805, 358, 267, 291, 14, 1069, 14, 751, 14, 374, 63, 12177, 14, 1107, 63, 585, 275, 715, 7318, 291, 14, 1069, 14, 1730, 275, 469, 288, 283, 44, 13247, 63, 5837, 1734, 1244, 356, 469, 355, 283, 14392, 63, 1972, 63, 19501, 63, 1365, 14887, 7, 520, 283, 21, 297, 355, 283, 8050, 7, 520, 359, 1297, 14, 568, 8893, 726, 12, 1297, 14, 3727, 33, 1244, 1206, 63, 16435, 840, 1441, 12, 1297, 14, 14288, 21340, 6467, 12, 1297, 14, 9663, 63, 1093, 2524, 1484, 4227, 467, 288, 789, 267, 789, 339, 768, 2068, 360, 4316, 63, 21934, 63, 571, 14, 4196, 14, 4876, 358, 272, 347, 511, 63, 362, 63, 21934, 63, 635, 8, 277, 12, 1683, 63, 4876, 12, 3795, 304, 267, 408, 267, 1379, 626, 664, 63, 1224, 63, 354, 63, 504, 63, 7682, 63, 3756, 365, 2797, 543, 314, 3211, 1305, 267, 408, 267, 634, 280, 63, 9850, 8, 277, 14, 1069, 9, 267, 1683, 63, 4876, 14, 479, 63, 3527, 63, 1045, 360, 4316, 63, 21934, 63, 571, 26, 973, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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