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
sequencelengths 1.02k
1.02k
| labels
sequencelengths 1.02k
1.02k
| attention_mask
sequencelengths 1.02k
1.02k
|
---|---|---|---|---|---|---|---|---|
zstars/weblabdeusto | server/src/weblab/core/coordinator/scheduler_transactions_synchronizer.py | 3 | 4486 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed below:
#
# Author: Pablo Orduña <pablo@ordunya.com>
#
import time
import random
import Queue
import threading
import voodoo.log as log
import voodoo.resources_manager as ResourceManager
import voodoo.counter as counter
from voodoo.resources_manager import is_testing
_resource_manager = ResourceManager.CancelAndJoinResourceManager("UserProcessingServer")
############################################################
#
# Certain operations, such as updating the queues, we
# only want them to be executed by one thread at a time.
# We can execute them more often, but it simply does not
# make sense. This class provides one public method, called
# request_and_wait. The method makes sure that the update
# method of the scheduler is called once since the method
# is invoked, without mattering if somebody else requested
# it.
#
class SchedulerTransactionsSynchronizer(threading.Thread):
def __init__(self, scheduler, min_time_between_updates = 0.0, max_time_between_updates = 0.0):
super(SchedulerTransactionsSynchronizer, self).__init__()
self.setName(counter.next_name("SchedulerTransactionsSynchronizer"))
self.setDaemon(True)
self.scheduler = scheduler
self.queue = Queue.Queue()
self.stopped = False
self.pending_elements = []
self.pending_elements_condition = threading.Condition()
self._latest_update = 0 # epoch
self.period_lock = threading.Lock()
self.min_time_between_updates = int(min_time_between_updates * 1000)
self.max_time_between_updates = int(max_time_between_updates * 1000)
self.next_period_between_updates = 0
def _update_period_between_updates(self):
self.next_period_between_updates = random.randint(self.min_time_between_updates, self.max_time_between_updates) / 1000.0
def start(self):
super(SchedulerTransactionsSynchronizer, self).start()
_resource_manager.add_resource(self)
def stop(self):
self.stopped = True
self.join()
_resource_manager.remove_resource(self)
def cancel(self):
self.stop()
def run(self):
timeout = 0.2
if is_testing():
timeout = 0.01
while not self.stopped:
try:
element = self.queue.get(timeout=timeout)
except Queue.Empty:
continue
if element is not None:
self._iterate(element)
def _iterate(self, element):
elements = [element]
while True:
try:
new_element = self.queue.get_nowait()
elements.append(new_element)
except Queue.Empty:
break
if not self.stopped:
execute = True
with self.period_lock:
if time.time() - self._latest_update <= self.next_period_between_updates:
execute = False
else:
self._latest_update = time.time()
self._update_period_between_updates()
if execute:
try:
self.scheduler.update()
except:
log.log(SchedulerTransactionsSynchronizer, log.level.Critical, "Exception updating scheduler")
log.log_exc(SchedulerTransactionsSynchronizer, log.level.Critical)
self._notify_elements(elements)
def _notify_elements(self, elements):
with self.pending_elements_condition:
for element in elements:
if element in self.pending_elements:
self.pending_elements.remove(element)
self.pending_elements_condition.notify_all()
def request_and_wait(self):
request_id = "%s::%s" % (threading.current_thread().getName(), random.random())
with self.pending_elements_condition:
self.pending_elements.append(request_id)
self.queue.put_nowait(request_id)
with self.pending_elements_condition:
while request_id in self.pending_elements and self.isAlive():
self.pending_elements_condition.wait(timeout=5)
| bsd-2-clause | [
3381,
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
1898,
334,
35,
9,
11811,
641,
4751,
15904,
402,
1487,
833,
79,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
961,
2032,
365,
18233,
465,
11736,
315,
314,
570,
9685,
12,
1314,
199,
3,
1265,
1077,
1172,
3086,
465,
1777,
402,
642,
4084,
14,
199,
3,
199,
3,
961,
2032,
18581,
402,
406,
26675,
6326,
701,
5002,
8212,
83,
12,
199,
3,
10532,
5084,
26,
199,
3,
199,
3,
6529,
26,
510,
371,
320,
4236,
2033,
22692,
65,
665,
80,
371,
320,
32,
2181,
324,
11552,
14,
957,
30,
199,
3,
199,
199,
646,
900,
199,
646,
2196,
199,
646,
10703,
199,
646,
5796,
199,
199,
646,
14164,
22058,
14,
793,
465,
943,
199,
646,
14164,
22058,
14,
4435,
63,
2609,
465,
7337,
2988,
199,
646,
14164,
22058,
14,
5337,
465,
7055,
199,
504,
14164,
22058,
14,
4435,
63,
2609,
492,
365,
63,
4776,
199,
199,
63,
1927,
63,
2609,
275,
7337,
2988,
14,
9083,
3325,
13005,
4031,
2988,
480,
1899,
9589,
3120,
531,
199,
199,
26207,
381,
199,
3,
199,
3,
11002,
877,
5331,
12,
4066,
465,
12928,
314,
21366,
12,
781,
199,
3,
1454,
2934,
3062,
370,
506,
7934,
701,
1373,
2462,
737,
282,
900,
14,
199,
3,
2136,
883,
5341,
3062,
1655,
14115,
12,
1325,
652,
9329,
1630,
440,
199,
3,
1852,
12249,
14,
961,
1021,
6571,
1373,
4575,
1083,
12,
2797,
199,
3,
1056,
63,
460,
63,
2573,
14,
710,
1083,
7704,
3238,
626,
314,
1678,
199,
3,
1083,
402,
314,
11899,
365,
2797,
5403,
3967,
314,
1083,
199,
3,
365,
10302,
12,
1928,
17247,
316,
340,
2005,
2030,
587,
5839,
199,
3,
652,
14,
199,
3,
199,
533,
32051,
3188,
3723,
21814,
1793,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
11899,
12,
1748,
63,
521,
63,
13007,
63,
7618,
275,
378,
14,
16,
12,
1390,
63,
521,
63,
13007,
63,
7618,
275,
378,
14,
16,
304,
267,
1613,
8,
11251,
3188,
3723,
21814,
1793,
12,
291,
2843,
826,
4533,
267,
291,
14,
18347,
8,
5337,
14,
2184,
63,
354,
480,
11251,
3188,
3723,
21814,
1793,
2237,
267,
291,
14,
409,
20555,
8,
549,
9,
267,
291,
14,
8874,
275,
11899,
267,
291,
14,
1825,
275,
10703,
14,
3737,
342,
267,
291,
14,
14661,
275,
756,
398,
291,
14,
6455,
63,
5527,
275,
942,
267,
291,
14,
6455,
63,
5527,
63,
5394,
275,
5796,
14,
9558,
342,
398,
291,
423,
7410,
63,
873,
275,
378,
327,
9463,
267,
291,
14,
5191,
63,
831,
275,
5796,
14,
6432,
342,
267,
291,
14,
827,
63,
521,
63,
13007,
63,
7618,
275,
1109,
8,
827,
63,
521,
63,
13007,
63,
7618,
627,
5198,
9,
267,
291,
14,
988,
63,
521,
63,
13007,
63,
7618,
275,
1109,
8,
988,
63,
521,
63,
13007,
63,
7618,
627,
5198,
9,
267,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
275,
378,
2378,
347,
485,
873,
63,
5191,
63,
13007,
63,
7618,
8,
277,
304,
267,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
275,
2196,
14,
8393,
8,
277,
14,
827,
63,
521,
63,
13007,
63,
7618,
12,
291,
14,
988,
63,
521,
63,
13007,
63,
7618,
9,
1182,
5198,
14,
16,
339,
347,
1343,
8,
277,
304,
267,
1613,
8,
11251,
3188,
3723,
21814,
1793,
12,
291,
680,
928,
342,
267,
485,
1927,
63,
2609,
14,
525,
63,
1927,
8,
277,
9,
339,
347,
3631,
8,
277,
304,
267,
291,
14,
14661,
275,
715,
267,
291,
14,
904,
342,
267,
485,
1927,
63,
2609,
14,
2168,
63,
1927,
8,
277,
9,
339,
347,
9311,
8,
277,
304,
267,
291,
14,
2379,
342,
339,
347,
1255,
8,
277,
304,
267,
2653,
275,
378,
14,
18,
267,
340,
365,
63,
4776,
837,
288,
2653,
275,
378,
14,
614,
267,
1830,
440,
291,
14,
14661,
26,
288,
862,
26,
355,
1819,
275,
291,
14,
1825,
14,
362,
8,
2593,
29,
2593,
9,
288,
871,
10703,
14,
4699,
26,
355,
1980,
953,
340,
1819,
365,
440,
488,
26,
355,
291,
423,
20627,
8,
2108,
9,
2378,
347,
485,
20627,
8,
277,
12,
1819,
304,
267,
4008,
275,
359,
2108,
61,
267,
1830,
715,
26,
288,
862,
26,
355,
892,
63,
2108,
275,
291,
14,
1825,
14,
362,
63,
20870,
342,
355,
4008,
14,
740,
8,
1222,
63,
2108,
9,
288,
871,
10703,
14,
4699,
26,
355,
2059,
398,
340,
440,
291,
14,
14661,
26,
288,
5341,
275,
715,
288,
543,
291,
14,
5191,
63,
831,
26,
355,
340,
900,
14,
521,
342,
446,
291,
423,
7410,
63,
873,
2695,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
26,
490,
5341,
275,
756,
355,
587,
26,
490,
291,
423,
7410,
63,
873,
275,
900,
14,
521,
342,
490,
291,
423,
873,
63,
5191,
63,
13007,
63,
7618,
342,
953,
340,
5341,
26,
355,
862,
26,
490,
291,
14,
8874,
14,
873,
342,
355,
871,
26,
490,
943,
14,
793,
8,
11251,
3188,
3723,
21814,
1793,
12,
943,
14,
1896,
14,
27677,
12,
298,
1726,
12928,
11899,
531,
490,
943,
14,
793,
63,
2804,
8,
11251,
3188,
3723,
21814,
1793,
12,
943,
14,
1896,
14,
27677,
9,
7318,
291,
423,
6814,
63,
5527,
8,
5527,
9,
2378,
347,
485,
6814,
63,
5527,
8,
277,
12,
4008,
304,
398,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
367,
1819,
315,
4008,
26,
355,
340,
1819,
315,
291,
14,
6455,
63,
5527,
26,
490,
291,
14,
6455,
63,
5527,
14,
2168,
8,
2108,
9,
953,
291,
14,
6455,
63,
5527,
63,
5394,
14,
6814,
63,
452,
342,
339,
347,
1056,
63,
460,
63,
2573,
8,
277,
304,
267,
1056,
63,
344,
275,
2071,
83,
447,
5,
83,
2,
450,
334,
12562,
14,
1818,
63,
2671,
1252,
16405,
1062,
2196,
14,
2355,
1012,
398,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
291,
14,
6455,
63,
5527,
14,
740,
8,
1069,
63,
344,
9,
7318,
291,
14,
1825,
14,
524,
63,
20870,
8,
1069,
63,
344,
9,
7318,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
1830,
1056,
63
] | [
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
1898,
334,
35,
9,
11811,
641,
4751,
15904,
402,
1487,
833,
79,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
961,
2032,
365,
18233,
465,
11736,
315,
314,
570,
9685,
12,
1314,
199,
3,
1265,
1077,
1172,
3086,
465,
1777,
402,
642,
4084,
14,
199,
3,
199,
3,
961,
2032,
18581,
402,
406,
26675,
6326,
701,
5002,
8212,
83,
12,
199,
3,
10532,
5084,
26,
199,
3,
199,
3,
6529,
26,
510,
371,
320,
4236,
2033,
22692,
65,
665,
80,
371,
320,
32,
2181,
324,
11552,
14,
957,
30,
199,
3,
199,
199,
646,
900,
199,
646,
2196,
199,
646,
10703,
199,
646,
5796,
199,
199,
646,
14164,
22058,
14,
793,
465,
943,
199,
646,
14164,
22058,
14,
4435,
63,
2609,
465,
7337,
2988,
199,
646,
14164,
22058,
14,
5337,
465,
7055,
199,
504,
14164,
22058,
14,
4435,
63,
2609,
492,
365,
63,
4776,
199,
199,
63,
1927,
63,
2609,
275,
7337,
2988,
14,
9083,
3325,
13005,
4031,
2988,
480,
1899,
9589,
3120,
531,
199,
199,
26207,
381,
199,
3,
199,
3,
11002,
877,
5331,
12,
4066,
465,
12928,
314,
21366,
12,
781,
199,
3,
1454,
2934,
3062,
370,
506,
7934,
701,
1373,
2462,
737,
282,
900,
14,
199,
3,
2136,
883,
5341,
3062,
1655,
14115,
12,
1325,
652,
9329,
1630,
440,
199,
3,
1852,
12249,
14,
961,
1021,
6571,
1373,
4575,
1083,
12,
2797,
199,
3,
1056,
63,
460,
63,
2573,
14,
710,
1083,
7704,
3238,
626,
314,
1678,
199,
3,
1083,
402,
314,
11899,
365,
2797,
5403,
3967,
314,
1083,
199,
3,
365,
10302,
12,
1928,
17247,
316,
340,
2005,
2030,
587,
5839,
199,
3,
652,
14,
199,
3,
199,
533,
32051,
3188,
3723,
21814,
1793,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
11899,
12,
1748,
63,
521,
63,
13007,
63,
7618,
275,
378,
14,
16,
12,
1390,
63,
521,
63,
13007,
63,
7618,
275,
378,
14,
16,
304,
267,
1613,
8,
11251,
3188,
3723,
21814,
1793,
12,
291,
2843,
826,
4533,
267,
291,
14,
18347,
8,
5337,
14,
2184,
63,
354,
480,
11251,
3188,
3723,
21814,
1793,
2237,
267,
291,
14,
409,
20555,
8,
549,
9,
267,
291,
14,
8874,
275,
11899,
267,
291,
14,
1825,
275,
10703,
14,
3737,
342,
267,
291,
14,
14661,
275,
756,
398,
291,
14,
6455,
63,
5527,
275,
942,
267,
291,
14,
6455,
63,
5527,
63,
5394,
275,
5796,
14,
9558,
342,
398,
291,
423,
7410,
63,
873,
275,
378,
327,
9463,
267,
291,
14,
5191,
63,
831,
275,
5796,
14,
6432,
342,
267,
291,
14,
827,
63,
521,
63,
13007,
63,
7618,
275,
1109,
8,
827,
63,
521,
63,
13007,
63,
7618,
627,
5198,
9,
267,
291,
14,
988,
63,
521,
63,
13007,
63,
7618,
275,
1109,
8,
988,
63,
521,
63,
13007,
63,
7618,
627,
5198,
9,
267,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
275,
378,
2378,
347,
485,
873,
63,
5191,
63,
13007,
63,
7618,
8,
277,
304,
267,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
275,
2196,
14,
8393,
8,
277,
14,
827,
63,
521,
63,
13007,
63,
7618,
12,
291,
14,
988,
63,
521,
63,
13007,
63,
7618,
9,
1182,
5198,
14,
16,
339,
347,
1343,
8,
277,
304,
267,
1613,
8,
11251,
3188,
3723,
21814,
1793,
12,
291,
680,
928,
342,
267,
485,
1927,
63,
2609,
14,
525,
63,
1927,
8,
277,
9,
339,
347,
3631,
8,
277,
304,
267,
291,
14,
14661,
275,
715,
267,
291,
14,
904,
342,
267,
485,
1927,
63,
2609,
14,
2168,
63,
1927,
8,
277,
9,
339,
347,
9311,
8,
277,
304,
267,
291,
14,
2379,
342,
339,
347,
1255,
8,
277,
304,
267,
2653,
275,
378,
14,
18,
267,
340,
365,
63,
4776,
837,
288,
2653,
275,
378,
14,
614,
267,
1830,
440,
291,
14,
14661,
26,
288,
862,
26,
355,
1819,
275,
291,
14,
1825,
14,
362,
8,
2593,
29,
2593,
9,
288,
871,
10703,
14,
4699,
26,
355,
1980,
953,
340,
1819,
365,
440,
488,
26,
355,
291,
423,
20627,
8,
2108,
9,
2378,
347,
485,
20627,
8,
277,
12,
1819,
304,
267,
4008,
275,
359,
2108,
61,
267,
1830,
715,
26,
288,
862,
26,
355,
892,
63,
2108,
275,
291,
14,
1825,
14,
362,
63,
20870,
342,
355,
4008,
14,
740,
8,
1222,
63,
2108,
9,
288,
871,
10703,
14,
4699,
26,
355,
2059,
398,
340,
440,
291,
14,
14661,
26,
288,
5341,
275,
715,
288,
543,
291,
14,
5191,
63,
831,
26,
355,
340,
900,
14,
521,
342,
446,
291,
423,
7410,
63,
873,
2695,
291,
14,
2184,
63,
5191,
63,
13007,
63,
7618,
26,
490,
5341,
275,
756,
355,
587,
26,
490,
291,
423,
7410,
63,
873,
275,
900,
14,
521,
342,
490,
291,
423,
873,
63,
5191,
63,
13007,
63,
7618,
342,
953,
340,
5341,
26,
355,
862,
26,
490,
291,
14,
8874,
14,
873,
342,
355,
871,
26,
490,
943,
14,
793,
8,
11251,
3188,
3723,
21814,
1793,
12,
943,
14,
1896,
14,
27677,
12,
298,
1726,
12928,
11899,
531,
490,
943,
14,
793,
63,
2804,
8,
11251,
3188,
3723,
21814,
1793,
12,
943,
14,
1896,
14,
27677,
9,
7318,
291,
423,
6814,
63,
5527,
8,
5527,
9,
2378,
347,
485,
6814,
63,
5527,
8,
277,
12,
4008,
304,
398,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
367,
1819,
315,
4008,
26,
355,
340,
1819,
315,
291,
14,
6455,
63,
5527,
26,
490,
291,
14,
6455,
63,
5527,
14,
2168,
8,
2108,
9,
953,
291,
14,
6455,
63,
5527,
63,
5394,
14,
6814,
63,
452,
342,
339,
347,
1056,
63,
460,
63,
2573,
8,
277,
304,
267,
1056,
63,
344,
275,
2071,
83,
447,
5,
83,
2,
450,
334,
12562,
14,
1818,
63,
2671,
1252,
16405,
1062,
2196,
14,
2355,
1012,
398,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
291,
14,
6455,
63,
5527,
14,
740,
8,
1069,
63,
344,
9,
7318,
291,
14,
1825,
14,
524,
63,
20870,
8,
1069,
63,
344,
9,
7318,
543,
291,
14,
6455,
63,
5527,
63,
5394,
26,
288,
1830,
1056,
63,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
hobu/arbiter | third/gtest-1.7.0/test/gtest_color_test.py | 3259 | 4911 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test correctly determines whether to use colors."""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os
import gtest_test_utils
IS_WINDOWS = os.name = 'nt'
COLOR_ENV_VAR = 'GTEST_COLOR'
COLOR_FLAG = 'gtest_color'
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_')
def SetEnvVar(env_var, value):
"""Sets the env variable to 'value'; unsets it when 'value' is None."""
if value is not None:
os.environ[env_var] = value
elif env_var in os.environ:
del os.environ[env_var]
def UsesColor(term, color_env_var, color_flag):
"""Runs gtest_color_test_ and returns its exit code."""
SetEnvVar('TERM', term)
SetEnvVar(COLOR_ENV_VAR, color_env_var)
if color_flag is None:
args = []
else:
args = ['--%s=%s' % (COLOR_FLAG, color_flag)]
p = gtest_test_utils.Subprocess([COMMAND] + args)
return not p.exited or p.exit_code
class GTestColorTest(gtest_test_utils.TestCase):
def testNoEnvVarNoFlag(self):
"""Tests the case when there's neither GTEST_COLOR nor --gtest_color."""
if not IS_WINDOWS:
self.assert_(not UsesColor('dumb', None, None))
self.assert_(not UsesColor('emacs', None, None))
self.assert_(not UsesColor('xterm-mono', None, None))
self.assert_(not UsesColor('unknown', None, None))
self.assert_(not UsesColor(None, None, None))
self.assert_(UsesColor('linux', None, None))
self.assert_(UsesColor('cygwin', None, None))
self.assert_(UsesColor('xterm', None, None))
self.assert_(UsesColor('xterm-color', None, None))
self.assert_(UsesColor('xterm-256color', None, None))
def testFlagOnly(self):
"""Tests the case when there's --gtest_color but not GTEST_COLOR."""
self.assert_(not UsesColor('dumb', None, 'no'))
self.assert_(not UsesColor('xterm-color', None, 'no'))
if not IS_WINDOWS:
self.assert_(not UsesColor('emacs', None, 'auto'))
self.assert_(UsesColor('xterm', None, 'auto'))
self.assert_(UsesColor('dumb', None, 'yes'))
self.assert_(UsesColor('xterm', None, 'yes'))
def testEnvVarOnly(self):
"""Tests the case when there's GTEST_COLOR but not --gtest_color."""
self.assert_(not UsesColor('dumb', 'no', None))
self.assert_(not UsesColor('xterm-color', 'no', None))
if not IS_WINDOWS:
self.assert_(not UsesColor('dumb', 'auto', None))
self.assert_(UsesColor('xterm-color', 'auto', None))
self.assert_(UsesColor('dumb', 'yes', None))
self.assert_(UsesColor('xterm-color', 'yes', None))
def testEnvVarAndFlag(self):
"""Tests the case when there are both GTEST_COLOR and --gtest_color."""
self.assert_(not UsesColor('xterm-color', 'no', 'no'))
self.assert_(UsesColor('dumb', 'no', 'yes'))
self.assert_(UsesColor('xterm-color', 'no', 'auto'))
def testAliasesOfYesAndNo(self):
"""Tests using aliases in specifying --gtest_color."""
self.assert_(UsesColor('dumb', None, 'true'))
self.assert_(UsesColor('dumb', None, 'YES'))
self.assert_(UsesColor('dumb', None, 'T'))
self.assert_(UsesColor('dumb', None, '1'))
self.assert_(not UsesColor('xterm', None, 'f'))
self.assert_(not UsesColor('xterm', None, 'false'))
self.assert_(not UsesColor('xterm', None, '0'))
self.assert_(not UsesColor('xterm', None, 'unknown'))
if __name__ == '__main__':
gtest_test_utils.Main()
| mit | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
1898,
9079,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
624,
21168,
626,
4475,
1379,
6657,
16756,
3775,
370,
675,
9229,
1041,
199,
199,
363,
2502,
363,
275,
283,
20444,
32,
3098,
14,
957,
334,
12674,
1629,
951,
644,
290,
3171,
199,
199,
646,
747,
199,
646,
9088,
63,
396,
63,
1208,
421,
199,
1311,
63,
20509,
275,
747,
14,
354,
275,
283,
343,
7,
199,
199,
7134,
63,
9984,
63,
5568,
275,
283,
16151,
63,
7134,
7,
199,
7134,
63,
3719,
275,
283,
8385,
63,
2326,
7,
199,
10761,
275,
9088,
63,
396,
63,
1208,
14,
28967,
27602,
360,
8385,
63,
2326,
63,
396,
15452,
421,
199,
318,
30306,
8,
1813,
63,
1391,
12,
574,
304,
523,
408,
9899,
314,
2589,
1750,
370,
283,
585,
13619,
625,
2193,
652,
1380,
283,
585,
7,
365,
488,
1041,
819,
340,
574,
365,
440,
488,
26,
272,
747,
14,
2314,
59,
1813,
63,
1391,
61,
275,
574,
523,
916,
2589,
63,
1391,
315,
747,
14,
2314,
26,
272,
2150,
747,
14,
2314,
59,
1813,
63,
1391,
61,
421,
199,
318,
14911,
4117,
8,
5125,
12,
3164,
63,
1813,
63,
1391,
12,
3164,
63,
4173,
304,
523,
408,
16291,
9088,
63,
2326,
63,
396,
63,
436,
2529,
2399,
4458,
1233,
1041,
819,
30306,
360,
16718,
297,
6707,
9,
523,
30306,
8,
7134,
63,
9984,
63,
5568,
12,
3164,
63,
1813,
63,
1391,
9,
819,
340,
3164,
63,
4173,
365,
488,
26,
272,
1249,
275,
942,
523,
587,
26,
272,
1249,
275,
14574,
5,
83,
2458,
83,
7,
450,
334,
7134,
63,
3719,
12,
3164,
63,
4173,
1874,
523,
299,
275,
9088,
63,
396,
63,
1208,
14,
22299,
779,
10761,
61,
435,
1249,
9,
523,
372,
440,
299,
14,
32290,
503,
299,
14,
2224,
63,
600,
421,
199,
533,
598,
774,
4117,
774,
8,
8385,
63,
396,
63,
1208,
14,
1746,
304,
523,
347,
511,
1944,
19342,
1944,
5318,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
15564,
18652,
63,
7134,
6590,
1553,
8385,
63,
2326,
1041,
339,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
69,
19309,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
19758,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
5187,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
8,
403,
12,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
5135,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
16680,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
13,
2326,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
13,
3912,
2326,
297,
488,
12,
488,
430,
819,
347,
511,
5318,
5903,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
1553,
8385,
63,
2326,
1325,
440,
18652,
63,
7134,
1041,
339,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
488,
12,
283,
889,
1333,
272,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
2326,
297,
488,
12,
283,
889,
1333,
272,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
69,
19309,
297,
488,
12,
283,
2495,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
283,
2495,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
29271,
297,
488,
12,
283,
5066,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
283,
5066,
1333,
819,
347,
511,
19342,
5903,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
18652,
63,
7134,
1325,
440,
1553,
8385,
63,
2326,
1041,
339,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
283,
889,
297,
488,
430,
272,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
2326,
297,
283,
889,
297,
488,
430,
272,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
1898,
9079,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
624,
21168,
626,
4475,
1379,
6657,
16756,
3775,
370,
675,
9229,
1041,
199,
199,
363,
2502,
363,
275,
283,
20444,
32,
3098,
14,
957,
334,
12674,
1629,
951,
644,
290,
3171,
199,
199,
646,
747,
199,
646,
9088,
63,
396,
63,
1208,
421,
199,
1311,
63,
20509,
275,
747,
14,
354,
275,
283,
343,
7,
199,
199,
7134,
63,
9984,
63,
5568,
275,
283,
16151,
63,
7134,
7,
199,
7134,
63,
3719,
275,
283,
8385,
63,
2326,
7,
199,
10761,
275,
9088,
63,
396,
63,
1208,
14,
28967,
27602,
360,
8385,
63,
2326,
63,
396,
15452,
421,
199,
318,
30306,
8,
1813,
63,
1391,
12,
574,
304,
523,
408,
9899,
314,
2589,
1750,
370,
283,
585,
13619,
625,
2193,
652,
1380,
283,
585,
7,
365,
488,
1041,
819,
340,
574,
365,
440,
488,
26,
272,
747,
14,
2314,
59,
1813,
63,
1391,
61,
275,
574,
523,
916,
2589,
63,
1391,
315,
747,
14,
2314,
26,
272,
2150,
747,
14,
2314,
59,
1813,
63,
1391,
61,
421,
199,
318,
14911,
4117,
8,
5125,
12,
3164,
63,
1813,
63,
1391,
12,
3164,
63,
4173,
304,
523,
408,
16291,
9088,
63,
2326,
63,
396,
63,
436,
2529,
2399,
4458,
1233,
1041,
819,
30306,
360,
16718,
297,
6707,
9,
523,
30306,
8,
7134,
63,
9984,
63,
5568,
12,
3164,
63,
1813,
63,
1391,
9,
819,
340,
3164,
63,
4173,
365,
488,
26,
272,
1249,
275,
942,
523,
587,
26,
272,
1249,
275,
14574,
5,
83,
2458,
83,
7,
450,
334,
7134,
63,
3719,
12,
3164,
63,
4173,
1874,
523,
299,
275,
9088,
63,
396,
63,
1208,
14,
22299,
779,
10761,
61,
435,
1249,
9,
523,
372,
440,
299,
14,
32290,
503,
299,
14,
2224,
63,
600,
421,
199,
533,
598,
774,
4117,
774,
8,
8385,
63,
396,
63,
1208,
14,
1746,
304,
523,
347,
511,
1944,
19342,
1944,
5318,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
15564,
18652,
63,
7134,
6590,
1553,
8385,
63,
2326,
1041,
339,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
69,
19309,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
19758,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
5187,
297,
488,
12,
488,
430,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
8,
403,
12,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
5135,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
16680,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
13,
2326,
297,
488,
12,
488,
430,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
13,
3912,
2326,
297,
488,
12,
488,
430,
819,
347,
511,
5318,
5903,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
1553,
8385,
63,
2326,
1325,
440,
18652,
63,
7134,
1041,
339,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
488,
12,
283,
889,
1333,
272,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
2326,
297,
488,
12,
283,
889,
1333,
272,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
69,
19309,
297,
488,
12,
283,
2495,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
283,
2495,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
29271,
297,
488,
12,
283,
5066,
1333,
272,
291,
14,
479,
2531,
21896,
4117,
360,
31896,
297,
488,
12,
283,
5066,
1333,
819,
347,
511,
19342,
5903,
8,
277,
304,
272,
408,
2925,
314,
1930,
1380,
2337,
1159,
18652,
63,
7134,
1325,
440,
1553,
8385,
63,
2326,
1041,
339,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
297,
283,
889,
297,
488,
430,
272,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
31896,
13,
2326,
297,
283,
889,
297,
488,
430,
272,
340,
440,
2281,
63,
20509,
26,
489,
291,
14,
479,
2531,
1397,
14911,
4117,
360,
29271,
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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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
] |
opencord/voltha | ofagent/main.py | 1 | 9975 | #!/usr/bin/env python
#
# Copyright 2017 the original author or authors.
#
# 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 argparse
import os
import yaml
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from common.structlog_setup import setup_logging
from common.utils.dockerhelpers import get_my_containers_name
from common.utils.nethelpers import get_my_primary_local_ipv4
from connection_mgr import ConnectionManager
defs = dict(
config=os.environ.get('CONFIG', './ofagent.yml'),
logconfig=os.environ.get('LOGCONFIG', './logconfig.yml'),
consul=os.environ.get('CONSUL', 'localhost:8500'),
controller=os.environ.get('CONTROLLER', 'localhost:6653'),
external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS',
get_my_primary_local_ipv4()),
grpc_endpoint=os.environ.get('GRPC_ENDPOINT', 'localhost:50055'),
instance_id=os.environ.get('INSTANCE_ID', os.environ.get('HOSTNAME', '1')),
internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS',
get_my_primary_local_ipv4()),
work_dir=os.environ.get('WORK_DIR', '/tmp/ofagent'),
key_file=os.environ.get('KEY_FILE', '/ofagent/pki/voltha.key'),
cert_file=os.environ.get('CERT_FILE', '/ofagent/pki/voltha.crt')
)
def parse_args():
parser = argparse.ArgumentParser()
_help = ('Path to ofagent.yml config file (default: %s). '
'If relative, it is relative to main.py of ofagent.'
% defs['config'])
parser.add_argument('-c', '--config',
dest='config',
action='store',
default=defs['config'],
help=_help)
_help = ('Path to logconfig.yml config file (default: %s). '
'If relative, it is relative to main.py of voltha.'
% defs['logconfig'])
parser.add_argument('-l', '--logconfig',
dest='logconfig',
action='store',
default=defs['logconfig'],
help=_help)
_help = '<hostname>:<port> to consul agent (default: %s)' % defs['consul']
parser.add_argument(
'-C', '--consul', dest='consul', action='store',
default=defs['consul'],
help=_help)
_help = '<hostname1>:<port1> <hostname2>:<port2> <hostname3>:<port3> ... <hostnamen>:<portn> to openflow controller (default: %s)' % \
defs['controller']
parser.add_argument(
'-O', '--controller',nargs = '*', dest='controller', action='store',
default=defs['controller'],
help=_help)
_help = ('<hostname> or <ip> at which ofagent is reachable from outside '
'the cluster (default: %s)' % defs['external_host_address'])
parser.add_argument('-E', '--external-host-address',
dest='external_host_address',
action='store',
default=defs['external_host_address'],
help=_help)
_help = ('gRPC end-point to connect to. It can either be a direct'
'definition in the form of <hostname>:<port>, or it can be an'
'indirect definition in the form of @<service-name> where'
'<service-name> is the name of the grpc service as registered'
'in consul (example: @voltha-grpc). (default: %s'
% defs['grpc_endpoint'])
parser.add_argument('-G', '--grpc-endpoint',
dest='grpc_endpoint',
action='store',
default=defs['grpc_endpoint'],
help=_help)
_help = ('<hostname> or <ip> at which ofagent is reachable from inside'
'the cluster (default: %s)' % defs['internal_host_address'])
parser.add_argument('-H', '--internal-host-address',
dest='internal_host_address',
action='store',
default=defs['internal_host_address'],
help=_help)
_help = ('unique string id of this ofagent instance (default: %s)'
% defs['instance_id'])
parser.add_argument('-i', '--instance-id',
dest='instance_id',
action='store',
default=defs['instance_id'],
help=_help)
_help = 'omit startup banner log lines'
parser.add_argument('-n', '--no-banner',
dest='no_banner',
action='store_true',
default=False,
help=_help)
_help = "suppress debug and info logs"
parser.add_argument('-q', '--quiet',
dest='quiet',
action='count',
help=_help)
_help = 'enable verbose logging'
parser.add_argument('-v', '--verbose',
dest='verbose',
action='count',
help=_help)
_help = ('work dir to compile and assemble generated files (default=%s)'
% defs['work_dir'])
parser.add_argument('-w', '--work-dir',
dest='work_dir',
action='store',
default=defs['work_dir'],
help=_help)
_help = ('use docker container name as ofagent instance id'
' (overrides -i/--instance-id option)')
parser.add_argument('--instance-id-is-container-name',
dest='instance_id_is_container_name',
action='store_true',
default=False,
help=_help)
_help = ('Specify this option to enable TLS security between ofagent \
and onos.')
parser.add_argument('-t', '--enable-tls',
dest='enable_tls',
action='store_true',
help=_help)
_help = ('key file to be used for tls security (default=%s)'
% defs['key_file'])
parser.add_argument('-k', '--key-file',
dest='key_file',
action='store',
default=defs['key_file'],
help=_help)
_help = ('certificate file to be used for tls security (default=%s)'
% defs['cert_file'])
parser.add_argument('-r', '--cert-file',
dest='cert_file',
action='store',
default=defs['cert_file'],
help=_help)
args = parser.parse_args()
# post-processing
if args.instance_id_is_container_name:
args.instance_id = get_my_containers_name()
return args
def load_config(args, configname='config'):
argdict = vars(args)
path = argdict[configname]
if path.startswith('.'):
dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(dir, path)
path = os.path.abspath(path)
with open(path) as fd:
config = yaml.load(fd)
return config
banner = r'''
___ _____ _ _
/ _ \| ___/ \ __ _ ___ _ __ | |_
| | | | |_ / _ \ / _` |/ _ \ '_ \| __|
| |_| | _/ ___ \ (_| | __/ | | | |_
\___/|_|/_/ \_\__, |\___|_| |_|\__|
|___/
'''
def print_banner(log):
for line in banner.strip('\n').splitlines():
log.info(line)
log.info('(to stop: press Ctrl-C)')
class Main(object):
def __init__(self):
self.args = args = parse_args()
self.config = load_config(args)
self.logconfig = load_config(args, 'logconfig')
# May want to specify the gRPC timeout as an arg (in future)
# Right now, set a default value
self.grpc_timeout = 120
verbosity_adjust = (args.verbose or 0) - (args.quiet or 0)
self.log = setup_logging(self.logconfig,
args.instance_id,
verbosity_adjust=verbosity_adjust)
# components
self.connection_manager = None
self.exiting = False
if not args.no_banner:
print_banner(self.log)
self.startup_components()
def start(self):
self.start_reactor() # will not return except Keyboard interrupt
@inlineCallbacks
def startup_components(self):
self.log.info('starting-internal-components')
args = self.args
self.connection_manager = yield ConnectionManager(
args.consul, args.grpc_endpoint, self.grpc_timeout,
args.controller, args.instance_id,
args.enable_tls, args.key_file, args.cert_file).start()
self.log.info('started-internal-services')
@inlineCallbacks
def shutdown_components(self):
"""Execute before the reactor is shut down"""
self.log.info('exiting-on-keyboard-interrupt')
self.exiting = True
if self.connection_manager is not None:
yield self.connection_manager.stop()
def start_reactor(self):
reactor.callWhenRunning(
lambda: self.log.info('twisted-reactor-started'))
reactor.addSystemEventTrigger('before', 'shutdown',
self.shutdown_components)
reactor.suggestThreadPoolSize(30)
reactor.run()
if __name__ == '__main__':
Main().start()
| apache-2.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
1898,
9708,
314,
3379,
4132,
503,
11462,
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,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
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,
7534,
199,
646,
747,
199,
199,
646,
8864,
199,
504,
7390,
14,
4901,
492,
9655,
199,
504,
7390,
14,
4901,
14,
11610,
492,
8308,
17958,
199,
199,
504,
2863,
14,
1820,
793,
63,
2758,
492,
3272,
63,
4806,
199,
504,
2863,
14,
1208,
14,
9991,
7546,
492,
664,
63,
1662,
63,
13577,
63,
354,
199,
504,
2863,
14,
1208,
14,
685,
273,
2096,
83,
492,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
199,
504,
1950,
63,
7755,
492,
8113,
2988,
199,
199,
8710,
275,
1211,
8,
272,
1101,
29,
736,
14,
2314,
14,
362,
360,
5569,
297,
21526,
1618,
4054,
14,
11714,
659,
272,
943,
888,
29,
736,
14,
2314,
14,
362,
360,
4947,
5569,
297,
21526,
793,
888,
14,
11714,
659,
272,
13447,
348,
29,
736,
14,
2314,
14,
362,
360,
1864,
51,
1293,
297,
283,
5967,
26,
2426,
383,
659,
272,
7614,
29,
736,
14,
2314,
14,
362,
360,
5801,
14881,
540,
297,
283,
5967,
26,
1272,
2481,
659,
272,
5957,
63,
1102,
63,
1562,
29,
736,
14,
2314,
14,
362,
360,
21043,
63,
5449,
63,
12368,
297,
1460,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
4000,
272,
19753,
63,
6520,
29,
736,
14,
2314,
14,
362,
360,
3975,
4222,
63,
21054,
297,
283,
5967,
26,
5783,
1229,
659,
272,
1256,
63,
344,
29,
736,
14,
2314,
14,
362,
360,
18235,
63,
998,
297,
747,
14,
2314,
14,
362,
360,
22647,
297,
283,
17,
3855,
272,
5007,
63,
1102,
63,
1562,
29,
736,
14,
2314,
14,
362,
360,
17681,
63,
5449,
63,
12368,
297,
1460,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
4000,
272,
1736,
63,
694,
29,
736,
14,
2314,
14,
362,
360,
8406,
63,
3022,
297,
1994,
2791,
15,
1618,
4054,
659,
272,
790,
63,
493,
29,
736,
14,
2314,
14,
362,
360,
3078,
63,
3817,
297,
1994,
1618,
4054,
15,
2051,
73,
15,
5650,
273,
65,
14,
498,
659,
272,
6250,
63,
493,
29,
736,
14,
2314,
14,
362,
360,
11163,
63,
3817,
297,
1994,
1618,
4054,
15,
2051,
73,
15,
5650,
273,
65,
14,
16617,
358,
199,
9,
421,
199,
318,
2198,
63,
589,
837,
339,
1798,
275,
7534,
14,
10730,
342,
339,
485,
3437,
275,
661,
2042,
370,
402,
4054,
14,
11714,
1101,
570,
334,
885,
26,
450,
83,
680,
283,
1467,
283,
3917,
3847,
12,
652,
365,
3847,
370,
2446,
14,
647,
402,
402,
4054,
3530,
1467,
450,
22603,
459,
888,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
67,
297,
2850,
888,
297,
717,
2053,
534,
888,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
888,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
661,
2042,
370,
943,
888,
14,
11714,
1101,
570,
334,
885,
26,
450,
83,
680,
283,
1467,
283,
3917,
3847,
12,
652,
365,
3847,
370,
2446,
14,
647,
402,
5236,
273,
65,
3530,
1467,
450,
22603,
459,
793,
888,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
76,
297,
2850,
793,
888,
297,
717,
2053,
534,
793,
888,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
793,
888,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
2650,
4269,
30,
16875,
719,
30,
370,
13447,
348,
6631,
334,
885,
26,
450,
83,
3171,
450,
22603,
459,
8704,
348,
418,
272,
1798,
14,
525,
63,
2094,
8,
267,
2475,
35,
297,
2850,
8704,
348,
297,
2053,
534,
8704,
348,
297,
1595,
534,
1617,
297,
267,
849,
29,
8710,
459,
8704,
348,
995,
267,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
2650,
4269,
17,
30,
16875,
719,
17,
30,
665,
4269,
18,
30,
16875,
719,
18,
30,
665,
4269,
19,
30,
16875,
719,
19,
30,
2263,
665,
4269,
78,
30,
16875,
719,
78,
30,
257,
370,
1551,
1659,
7614,
334,
885,
26,
450,
83,
3171,
450,
971,
288,
22603,
459,
5538,
418,
272,
1798,
14,
525,
63,
2094,
8,
267,
2475,
47,
297,
2850,
5538,
297,
15929,
275,
24999,
2053,
534,
5538,
297,
1595,
534,
1617,
297,
267,
849,
29,
8710,
459,
5538,
995,
267,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
19990,
4269,
30,
503,
665,
711,
30,
737,
1314,
402,
4054,
365,
29542,
687,
9682,
283,
1467,
283,
1589,
4350,
334,
885,
26,
450,
83,
3171,
450,
22603,
459,
5159,
63,
1102,
63,
1562,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
37,
297,
2850,
5159,
13,
1102,
13,
1562,
297,
717,
2053,
534,
5159,
63,
1102,
63,
1562,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
5159,
63,
1102,
63,
1562,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
661,
71,
8171,
1284,
13,
1403,
370,
4907,
370,
14,
2779,
883,
1902,
506,
282,
4125,
7,
1467,
283,
7463,
315,
314,
1824,
402,
665,
4269,
30,
16875,
719,
6244,
503,
652,
883,
506,
376,
7,
1467,
283,
29306,
5492,
315,
314,
1824,
402,
768,
28,
1364,
13,
354,
30,
2382,
7,
1467,
2650,
1364,
13,
354,
30,
365,
314,
536,
402,
314,
19753,
2435,
465,
7264,
7,
1467,
283,
262,
13447,
348,
334,
2694,
26,
768,
5650,
273,
65,
13,
15391,
680,
334,
885,
26,
450,
83,
7,
1467,
450,
22603,
459,
15391,
63,
6520,
1105,
272,
1798,
14,
525,
63
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
1898,
9708,
314,
3379,
4132,
503,
11462,
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,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
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,
7534,
199,
646,
747,
199,
199,
646,
8864,
199,
504,
7390,
14,
4901,
492,
9655,
199,
504,
7390,
14,
4901,
14,
11610,
492,
8308,
17958,
199,
199,
504,
2863,
14,
1820,
793,
63,
2758,
492,
3272,
63,
4806,
199,
504,
2863,
14,
1208,
14,
9991,
7546,
492,
664,
63,
1662,
63,
13577,
63,
354,
199,
504,
2863,
14,
1208,
14,
685,
273,
2096,
83,
492,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
199,
504,
1950,
63,
7755,
492,
8113,
2988,
199,
199,
8710,
275,
1211,
8,
272,
1101,
29,
736,
14,
2314,
14,
362,
360,
5569,
297,
21526,
1618,
4054,
14,
11714,
659,
272,
943,
888,
29,
736,
14,
2314,
14,
362,
360,
4947,
5569,
297,
21526,
793,
888,
14,
11714,
659,
272,
13447,
348,
29,
736,
14,
2314,
14,
362,
360,
1864,
51,
1293,
297,
283,
5967,
26,
2426,
383,
659,
272,
7614,
29,
736,
14,
2314,
14,
362,
360,
5801,
14881,
540,
297,
283,
5967,
26,
1272,
2481,
659,
272,
5957,
63,
1102,
63,
1562,
29,
736,
14,
2314,
14,
362,
360,
21043,
63,
5449,
63,
12368,
297,
1460,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
4000,
272,
19753,
63,
6520,
29,
736,
14,
2314,
14,
362,
360,
3975,
4222,
63,
21054,
297,
283,
5967,
26,
5783,
1229,
659,
272,
1256,
63,
344,
29,
736,
14,
2314,
14,
362,
360,
18235,
63,
998,
297,
747,
14,
2314,
14,
362,
360,
22647,
297,
283,
17,
3855,
272,
5007,
63,
1102,
63,
1562,
29,
736,
14,
2314,
14,
362,
360,
17681,
63,
5449,
63,
12368,
297,
1460,
664,
63,
1662,
63,
3327,
63,
1832,
63,
4774,
20,
4000,
272,
1736,
63,
694,
29,
736,
14,
2314,
14,
362,
360,
8406,
63,
3022,
297,
1994,
2791,
15,
1618,
4054,
659,
272,
790,
63,
493,
29,
736,
14,
2314,
14,
362,
360,
3078,
63,
3817,
297,
1994,
1618,
4054,
15,
2051,
73,
15,
5650,
273,
65,
14,
498,
659,
272,
6250,
63,
493,
29,
736,
14,
2314,
14,
362,
360,
11163,
63,
3817,
297,
1994,
1618,
4054,
15,
2051,
73,
15,
5650,
273,
65,
14,
16617,
358,
199,
9,
421,
199,
318,
2198,
63,
589,
837,
339,
1798,
275,
7534,
14,
10730,
342,
339,
485,
3437,
275,
661,
2042,
370,
402,
4054,
14,
11714,
1101,
570,
334,
885,
26,
450,
83,
680,
283,
1467,
283,
3917,
3847,
12,
652,
365,
3847,
370,
2446,
14,
647,
402,
402,
4054,
3530,
1467,
450,
22603,
459,
888,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
67,
297,
2850,
888,
297,
717,
2053,
534,
888,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
888,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
661,
2042,
370,
943,
888,
14,
11714,
1101,
570,
334,
885,
26,
450,
83,
680,
283,
1467,
283,
3917,
3847,
12,
652,
365,
3847,
370,
2446,
14,
647,
402,
5236,
273,
65,
3530,
1467,
450,
22603,
459,
793,
888,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
76,
297,
2850,
793,
888,
297,
717,
2053,
534,
793,
888,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
793,
888,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
2650,
4269,
30,
16875,
719,
30,
370,
13447,
348,
6631,
334,
885,
26,
450,
83,
3171,
450,
22603,
459,
8704,
348,
418,
272,
1798,
14,
525,
63,
2094,
8,
267,
2475,
35,
297,
2850,
8704,
348,
297,
2053,
534,
8704,
348,
297,
1595,
534,
1617,
297,
267,
849,
29,
8710,
459,
8704,
348,
995,
267,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
2650,
4269,
17,
30,
16875,
719,
17,
30,
665,
4269,
18,
30,
16875,
719,
18,
30,
665,
4269,
19,
30,
16875,
719,
19,
30,
2263,
665,
4269,
78,
30,
16875,
719,
78,
30,
257,
370,
1551,
1659,
7614,
334,
885,
26,
450,
83,
3171,
450,
971,
288,
22603,
459,
5538,
418,
272,
1798,
14,
525,
63,
2094,
8,
267,
2475,
47,
297,
2850,
5538,
297,
15929,
275,
24999,
2053,
534,
5538,
297,
1595,
534,
1617,
297,
267,
849,
29,
8710,
459,
5538,
995,
267,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
19990,
4269,
30,
503,
665,
711,
30,
737,
1314,
402,
4054,
365,
29542,
687,
9682,
283,
1467,
283,
1589,
4350,
334,
885,
26,
450,
83,
3171,
450,
22603,
459,
5159,
63,
1102,
63,
1562,
1105,
272,
1798,
14,
525,
63,
2094,
3654,
37,
297,
2850,
5159,
13,
1102,
13,
1562,
297,
717,
2053,
534,
5159,
63,
1102,
63,
1562,
297,
717,
1595,
534,
1617,
297,
717,
849,
29,
8710,
459,
5159,
63,
1102,
63,
1562,
995,
717,
1720,
3699,
3437,
9,
339,
485,
3437,
275,
661,
71,
8171,
1284,
13,
1403,
370,
4907,
370,
14,
2779,
883,
1902,
506,
282,
4125,
7,
1467,
283,
7463,
315,
314,
1824,
402,
665,
4269,
30,
16875,
719,
6244,
503,
652,
883,
506,
376,
7,
1467,
283,
29306,
5492,
315,
314,
1824,
402,
768,
28,
1364,
13,
354,
30,
2382,
7,
1467,
2650,
1364,
13,
354,
30,
365,
314,
536,
402,
314,
19753,
2435,
465,
7264,
7,
1467,
283,
262,
13447,
348,
334,
2694,
26,
768,
5650,
273,
65,
13,
15391,
680,
334,
885,
26,
450,
83,
7,
1467,
450,
22603,
459,
15391,
63,
6520,
1105,
272,
1798,
14,
525,
63,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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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
] |
giannisfs/Vault | vault/qrc_resources.py | 1 | 335309 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created: ??? ??? 21 00:36:17 2012
# by: The Resource Compiler for PyQt (Qt v4.7.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x01\x2b\xe6\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x01\xa6\x00\x00\x01\xa9\x08\x06\x00\x00\x00\xc6\x27\x92\xd6\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\
\x01\x00\x9a\x9c\x18\x00\x00\x00\x20\x63\x48\x52\x4d\x00\x00\x7a\
\x25\x00\x00\x80\x83\x00\x00\xf9\xff\x00\x00\x80\xe9\x00\x00\x75\
\x30\x00\x00\xea\x60\x00\x00\x3a\x98\x00\x00\x17\x6f\x92\x5f\xc5\
\x46\x00\x01\x2b\x6c\x49\x44\x41\x54\x78\xda\xec\xfd\x77\xbc\x24\
\xd9\x59\x1e\x8e\x3f\xef\xa9\xd8\xe9\x86\xc9\xbb\xab\x99\xd9\xbc\
\xd2\x4a\x42\x01\x81\x10\x8a\x48\x42\x01\x21\x94\x11\x92\x48\x42\
\x80\x8c\x6d\x10\x59\x80\x45\x32\x98\xf0\xc5\x36\x18\x6c\x30\x60\
\x7e\xfe\xda\x06\xbe\x5f\x0c\xc6\x3f\x0c\xd8\x04\x63\x05\x82\xd2\
\xe6\x9c\x77\x27\x87\x3b\x33\x37\xf5\xed\x54\x55\xe7\xfd\xfe\x71\
\x4e\xc5\xae\xea\xae\xea\xdb\x77\x66\x76\xa6\xce\x7e\x7a\x6f\x4f\
\x87\xea\xea\xea\xaa\xf3\x9c\xe7\x79\x9f\xf7\x7d\x89\x99\x51\x8f\
\x7a\xd4\xa3\x1e\xf5\xa8\xc7\xe5\x32\x44\x7d\x08\xea\x51\x8f\x7a\
\xd4\xa3\x1e\x35\x30\xd5\xa3\x1e\xf5\xa8\x47\x3d\xea\x51\x03\x53\
\x3d\xea\x51\x8f\x7a\xd4\xa3\x06\xa6\x7a\xd4\xa3\x1e\xf5\xa8\x47\
\x3d\x6a\x60\xaa\x47\x3d\xea\x51\x8f\x7a\xd4\xc0\x54\x8f\x7a\xd4\
\xa3\x1e\xf5\xa8\x47\x0d\x4c\xf5\xa8\x47\x3d\xea\x51\x8f\x1a\x98\
\xea\x51\x8f\x7a\xd4\xa3\x1e\xf5\xa8\x81\xa9\x1e\xf5\xa8\x47\x3d\
\xea\x51\x03\x53\x3d\xea\x51\x8f\x7a\xd4\xa3\x1e\x35\x30\xd5\xa3\
\x1e\xf5\xa8\x47\x3d\xea\x51\x03\x53\x3d\xea\x51\x8f\x7a\xd4\xa3\
\x06\xa6\x7a\xd4\xa3\x1e\xf5\xa8\x47\x3d\x6a\x60\xaa\x47\x3d\xea\
\x51\x8f\x7a\xd4\xc0\x54\x8f\x7a\xd4\xa3\x1e\xf5\xa8\x47\x0d\x4c\
\xf5\xa8\x47\x3d\xea\x51\x8f\x1a\x98\xea\x51\x8f\x7a\xd4\xa3\x1e\
\xf5\xa8\x81\xa9\x1e\xf5\xa8\x47\x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xf5\x3b\x09\x3e\x35\xa8\xd6\xa3\x1e\x35\
\x30\xd5\xa3\x02\x18\xd1\x14\x10\x9a\xf6\x77\x1a\x78\x4d\x7a\x7c\
\xa7\xc0\x86\xe7\xb8\xad\x79\x4c\xea\x7c\x19\xbf\xa7\x06\xd5\x7a\
\xd4\xc0\x54\x8f\xcb\x02\x90\xa6\x01\xd0\xa4\xfb\x93\x5e\x5f\x16\
\xa4\x76\x1a\x54\x78\x87\xde\x7b\x31\x80\x95\x2f\xd1\xe7\x5e\x89\
\x4c\x75\xa7\xbe\x7b\x0d\x94\x35\x30\xd5\x63\x07\x00\xa9\x08\x5c\
\x68\xc2\x63\x93\x6e\xd3\x18\xd5\x34\x90\xda\x09\xa0\x99\xd7\xe3\
\x17\x9b\xad\xf1\x0e\x6e\xfb\x52\x33\xd0\x8b\xcd\x02\xe7\x71\x2c\
\xaa\x3c\xce\x35\x78\xd5\xc0\x54\x8f\xed\x01\x52\x99\x9b\x28\xb8\
\x5f\x15\xa4\x8a\xc0\x89\x2f\xe2\x44\x71\xa9\x00\xeb\x62\x80\xea\
\xbc\x80\x75\xa7\x98\xe8\xa5\x66\x81\x55\xf7\x8d\x4b\x02\x4e\xf6\
\x3e\x15\xdc\xaf\xc1\xaa\x06\xa6\x7a\xcc\x00\x48\x59\x00\x12\x05\
\xf7\xf3\xfe\x96\x01\xa8\xaa\xc0\xc4\x73\x9a\x44\xb6\xf3\x9a\x9d\
\x9a\x8c\x79\xce\x8f\xed\x24\x60\x5d\x0c\x36\x3a\x4f\xd0\x9a\xe5\
\xbb\x16\x9d\x1b\x3c\xe1\xb1\xbc\xbf\x9c\x01\x25\x4e\x9c\xf3\x79\
\xf7\x6b\x90\xaa\x81\xa9\x06\xa4\x09\x60\x94\x05\xa1\xb2\xb7\x49\
\x20\x55\xc4\x9a\x68\xc6\xc9\x62\x56\xc0\xd9\xee\xbf\x2f\x05\x7b\
\xe3\x39\x6e\x6b\xde\x60\x31\xeb\xfe\x5e\x2a\x16\x58\xe6\x33\xcb\
\x02\x50\xf6\x7e\xde\xbf\x8b\x5e\x93\xc7\xaa\x6a\x70\xaa\x81\xe9\
\xaa\x01\xa4\x2a\xec\x28\x0f\x6c\x8c\x9c\xfb\x46\xce\x73\x45\x00\
\x55\xc4\x9c\x8a\x40\xe9\x62\x81\xce\x3c\x00\x6a\xbb\x60\x70\x31\
\x40\x74\xa7\x00\x6b\x1e\xdf\xa7\xea\xfe\xed\x34\x9b\x9b\x06\x48\
\x45\xc0\x53\x74\x93\x05\x8f\x23\x07\xa4\x6a\x80\xaa\x81\xa9\x06\
\xa4\x09\x80\x94\x07\x3e\xd9\x9b\x28\xf8\x77\x59\x70\x9a\x06\x4a\
\x3b\x01\x3e\xf3\x78\xdd\x4e\xb3\x1c\x9e\xc3\x73\xdb\x65\x2c\xf3\
\xf8\x7e\x3b\x09\x50\xdb\x8d\x0d\x95\x79\xac\x2c\x13\xca\x82\x4f\
\xf6\xbe\x9c\x02\x50\xd3\x58\x54\x0d\x4e\x35\x30\x5d\x51\xa0\x54\
\x64\xed\xce\x8b\x1b\x89\x0c\xd0\x64\x41\xc7\x2c\x71\x7f\x12\x83\
\xca\x7e\x2e\x4a\x82\xd3\xbc\x01\x88\xb7\xf1\xde\x79\x00\xcd\x3c\
\x3f\x6f\xd6\x6d\xec\x14\xd0\xce\xeb\xb9\xcb\x09\x54\xab\x30\x22\
\x99\x73\x3f\x7b\xcb\xbe\x2e\xfc\x37\x0a\x58\x53\x0d\x4a\x35\x30\
\x5d\x91\x80\x04\x94\x93\xeb\x92\xc0\x92\x05\x1e\x33\x73\x3f\xef\
\xb1\x22\x46\x35\x8d\x39\xa1\x00\x9c\xe6\x21\xc7\x55\x01\xa1\xed\
\x02\xd6\xbc\xff\xbd\x13\xf7\xe7\x05\xac\xbc\x43\xdf\x61\xa7\x59\
\x55\xd9\x7f\xf3\x04\x70\x92\x13\x00\x29\x7b\x0b\x32\x7f\xc3\xfb\
\xe1\xb5\x20\x13\xa0\x94\xf7\x19\xb5\xa4\x57\x03\xd3\x15\x0f\x48\
\x79\xa0\x94\x65\x46\x79\x60\x63\x65\xc0\xa8\xe8\xdf\x46\x01\x40\
\x95\x65\x4d\x98\x72\x21\xce\x63\x72\x9e\x05\x90\x76\x42\x56\xdb\
\xce\x77\xbb\x98\x20\x75\xb1\x81\x73\x27\x62\x69\xb3\x7c\xa7\x32\
\x92\x5d\x19\x30\xca\xde\xa4\x3e\xff\xc3\xfb\xc9\x6b\x33\x09\x52\
\x22\xf1\x39\xa8\xd9\x53\x0d\x4c\xcf\x56\x40\x9a\x04\x46\x93\x62\
\x48\x46\x0e\x33\xca\x03\x1d\x2b\x73\x33\x73\xee\x9b\x05\x00\x95\
\x27\xe9\x95\x89\x35\xcd\x7b\xf2\x2e\xe3\xb0\x9a\x17\x00\x6c\x17\
\x88\x76\x02\x60\x2f\x26\x90\x5e\x09\xec\xb4\x2c\x28\x05\x13\x00\
\xc9\xcf\xf9\x2b\x12\xe0\x14\xe4\x28\x07\x9c\x00\x30\x59\x03\x52\
\x0d\x4c\x57\x22\x20\x4d\x72\xd8\xe5\x31\xa4\x22\x20\xb2\x0b\xee\
\xe7\x01\x56\x16\x9c\xb2\x31\xa7\x2a\x26\x88\x8b\x01\x46\x3c\x87\
\x6d\xee\x34\xc3\xab\xfa\xdc\x3c\xf7\x77\x27\x8e\xfd\x4e\xee\xdf\
\xbc\x16\x35\x65\x41\x29\x09\x48\x7e\x06\x94\xb2\x37\x23\x71\x3f\
\xbc\x16\x82\xcc\x35\x10\x82\x91\xc4\x7c\x6a\x48\xd6\xc0\x54\x1f\
\x82\x4b\x0a\x48\x40\x7e\x35\x86\x22\x67\x5d\x56\xaa\x2b\x02\x23\
\xbb\xe0\x56\x04\x52\xd9\x18\x54\x16\x9c\xa6\xc9\x79\x65\xc0\x69\
\x96\x5c\x93\x59\x5f\xbb\x93\x72\xda\x4e\x82\xe9\xc5\x94\xdd\x66\
\xd9\xf7\x4b\xc1\xf6\x66\x39\x6f\x8a\xa4\xbb\x3c\x40\xca\x03\x23\
\x2f\x71\x4b\x2e\x0e\xfd\xc4\x35\x10\xe4\xec\x3f\xd5\x12\x5e\x0d\
\x4c\xcf\x26\x50\x9a\x54\x44\x75\x9a\xed\xdb\x28\x90\xeb\xac\x29\
\x20\xe4\x64\xfe\x26\xef\xe7\x01\x54\x91\x21\x62\x52\xd2\x2d\x50\
\x1c\x63\x9a\xd7\x04\x3e\xeb\xdf\x8b\x01\x54\x3b\xf1\xbd\x76\x12\
\xa8\xe6\x0d\xf2\x3b\x25\x9d\xce\x7a\xdc\xb3\x6c\x29\x8f\x29\x15\
\xb1\x23\x2f\x73\x1b\x25\xae\x07\x0f\x93\x4d\x40\xd9\x7d\x91\xa8\
\x56\xae\xab\x1e\x35\x30\x5d\x32\x40\x02\xaa\x39\xed\xf2\x40\xa9\
\x88\x19\x25\x41\xa8\xe8\x66\x67\xee\x67\x01\xca\x2c\x00\xa7\x69\
\x72\xde\x24\xc6\xb4\x13\xe0\x74\x31\x26\xfc\x9d\x06\xa4\x8b\xc1\
\x52\x2e\xd6\xc2\xe0\x52\x30\xbe\x69\xc7\xb6\x88\x29\xe5\xb1\xa4\
\x2c\x18\x8d\x12\xa0\x34\x42\x71\xac\x75\xd2\xb9\x5f\x33\xa7\x1a\
\x98\x2e\xed\xc8\x76\x98\x24\xd5\x4e\x77\x9e\x4e\xbb\xa4\x6c\x97\
\x07\x48\xd9\x9b\x3b\xe5\x6f\x96\x49\x59\x42\x08\x97\x48\x84\xa0\
\x67\x00\x1c\x01\x93\x94\x92\x98\x79\x9a\x6d\x1c\x15\x27\x92\x79\
\x80\xd0\xc5\x64\x52\xf3\x9e\xd0\x77\x82\x9d\x5c\x6a\x86\x7a\x31\
\x19\x5f\x15\x19\x2f\xcf\xd8\xe0\x65\x40\x29\x09\x48\xc3\xc4\xdf\
\x3c\xe5\xa0\xe8\xdc\xcf\x32\x36\x42\x6d\x1f\xaf\x81\xe9\x92\xd3\
\xa3\xb8\xbf\x7b\x55\x63\xc3\x34\x86\x64\x96\x00\x24\xb7\xe4\x2d\
\x05\x50\x8e\xeb\xb6\xbe\xf5\xbb\x3e\x76\xdd\xed\x2f\x78\xa1\xd5\
\x5e\x58\x30\xc6\x2e\x23\x10\x36\xd6\x56\xe1\xfb\x3e\x06\x83\x01\
\x0c\xc3\x00\x00\x8c\x86\x43\xf8\xbe\x0f\x90\xfe\x42\xc2\x50\xff\
\x06\xb0\x72\xf6\x2c\xbc\xd1\x10\x86\x61\xe0\xc2\xf9\x15\x04\x81\
\x04\x01\x18\x8d\x46\x08\x64\x10\x1d\x98\x20\x08\xb0\xb9\xb1\x9e\
\xfa\x40\x21\x04\x77\x37\x37\x30\x1a\x0e\x19\x00\x36\x37\xd6\x39\
\x41\x3f\x79\xe4\x8d\x30\x1a\x0e\x99\x88\x78\xd0\xef\xb3\xe7\x8d\
\x98\xa5\xcc\x9d\xec\xa5\x94\x52\x2f\x1a\x76\x02\xa0\xe6\x05\x42\
\xf3\x02\xa8\x79\xee\xff\xe5\x04\x50\x65\xb7\x5d\x04\x4c\x79\xf2\
\x5d\x12\x94\x46\xfa\x6f\x12\x8c\x86\x00\x06\x18\x8f\xb7\x4e\x93\
\xf1\xb8\x00\x9c\x6a\x40\x9a\x65\x3e\xbd\x12\x7a\xca\xc7\x98\x70\
\xc9\x24\xbb\x59\x00\x49\x94\x90\xec\xac\x0a\x80\xd4\xc8\xf9\xdb\
\xc8\x79\xde\x21\xa2\xc6\x9b\xde\xfe\xee\xbd\x6f\x7b\xd7\x7b\x1a\
\xad\x56\x9b\x24\xcb\xb1\xaf\x44\x39\xc7\x98\xc1\xe9\x67\x28\xfd\
\x8e\xe8\x79\xca\xd9\x0a\x65\xaf\xe6\xe2\xed\x4c\x3c\xca\xa9\x82\
\x2f\x3c\x8e\xa5\xfa\xc5\xdd\xcd\x4d\x04\x81\x8f\xe1\x70\xa0\xb6\
\x4a\xc0\x68\xe4\x21\x08\xfc\xd4\xeb\x02\x0d\xa8\xe7\xcf\xad\x60\
\x38\x1c\xc2\x34\x4c\x9c\x5b\x39\x03\x96\x0c\x10\x30\x1a\x0d\x11\
\x04\x32\xb5\x0b\x9e\x37\xc2\xc6\xc6\x7a\xea\x73\x0d\xc3\xe0\x8d\
\xf5\x75\x78\x9e\xc7\x00\xb0\xb1\xb6\xca\xea\xb8\x09\x8c\x46\x03\
\x1e\x0e\x06\x00\xc0\x83\x7e\x5f\x02\x80\xef\x79\x2c\x65\x00\x10\
\x8d\x4d\xbe\x52\x4a\x66\x29\xe7\x0d\x5a\xb3\x82\xd2\x3c\x01\x6a\
\x3b\x72\x69\x15\x19\x8f\x31\x6e\x74\x28\x92\xee\x42\x50\x1a\x24\
\x40\xa9\x9f\xf8\xdb\x4f\xfc\x7b\x90\x00\xaf\xf0\xbd\xc9\xed\xf9\
\x48\xbb\xfc\x02\x4c\xae\x16\x51\x59\x91\xa9\x81\xa9\x06\xa6\xb2\
\xa0\x54\xb5\x84\x90\x31\x81\x25\xcd\x0a\x48\xd3\x6e\x11\x30\xbd\
\xea\xf5\x6f\xda\xfd\xce\xaf\xff\x80\xb3\x6b\xf7\x1e\x92\x52\x96\
\x83\xdc\xb1\x7f\x52\xf5\xa3\x54\xf8\x4e\xaa\xbc\x1d\x2a\xb3\xb3\
\x11\x18\x66\xe0\x90\xf2\xde\xc7\xa9\x73\x28\x04\x57\xe6\xa2\xd7\
\xe7\x3d\x9e\x78\x0e\xd3\x85\x4e\x2e\x5c\x44\x13\x06\xbd\x1e\x3c\
\xcf\xc3\x70\x14\xb3\xd4\xe1\x40\xb1\x54\xa1\xff\x4d\x40\xc4\x52\
\xcf\x9e\x39\x8d\xad\xad\x2d\x8c\x86\xc3\x68\xdf\xba\x1b\x9b\xf0\
\xbc\x51\x6a\xcb\x41\x10\x60\x7d\x6d\x15\x42\x88\xd4\xe3\xdd\xcd\
\x4d\x1e\x8d\x86\x20\x80\xd7\xd7\xd7\x10\xf8\x3e\x0f\x06\x7d\x16\
\x44\xf0\x7d\x1f\xa3\xd1\x88\x35\xeb\x95\xbe\xe7\x31\x63\x9c\x89\
\x12\x88\x03\x19\xe4\x01\xea\x3c\x98\x5d\x59\xf6\x99\x07\x4c\x79\
\xf2\xdd\x28\xc3\x90\x86\x09\xe0\xe9\x03\xe8\x25\xfe\xf6\x4a\x00\
\x54\x78\x0b\xb7\x1f\x82\xa1\xcc\x01\xa7\x4a\x13\x6e\x0d\x4c\x35\
\x30\x6d\x07\x90\x80\xea\xc6\x86\x32\x4e\xbb\x64\x3c\xc8\x2d\x01\
\x48\xcd\xcc\xdf\xe8\xfe\xf3\x5e\xf8\xe2\xc5\xb7\xbe\xe3\xdd\xce\
\x0d\x37\xdd\x4c\xcd\x56\x3b\x35\x31\xd2\x25\x06\x1b\x2a\x8b\x8c\
\x33\x6d\xa3\xfc\xb6\xa8\xd2\xae\x4f\xf8\xd6\x34\xdb\x81\xa4\x31\
\x00\xa6\x98\x11\xe6\xe2\xae\x66\xa9\x44\xb9\x0c\x35\x77\xeb\x05\
\xdb\x29\x7d\x98\x72\xe7\x0b\xf5\xa6\x91\x37\x42\xe0\xfb\x9a\x85\
\x2a\xc0\xef\x0f\xfa\x08\x82\x20\x25\x6c\x05\xbe\x0f\x06\x70\x7e\
\xe5\x2c\x06\x83\x21\x64\x10\xa0\xd7\xdb\xd2\x72\xae\x81\x0d\x05\
\x8e\xd1\x17\xf7\x7d\x0f\xeb\xab\xab\xd1\xf3\x89\xf5\x04\x2e\x9c\
\x5f\x61\xcf\xf3\x00\x30\x6f\x6d\x6e\x72\x20\x25\x0f\xfb\x7d\xf6\
\x3c\x2f\xf0\xbc\x51\x40\x44\x72\x34\x1c\xf8\x00\x3c\xdf\xf7\x3d\
\x29\xe5\x88\x99\x47\x32\x08\xfa\x31\x20\xd1\x10\xe0\x3e\x11\xf5\
\xa5\x94\x5b\x00\xb6\x34\x20\x65\xff\xf6\x32\x00\x35\xcc\x00\x54\
\x11\x73\x9a\x99\x35\xd5\xc0\x54\x03\xd3\x3c\x00\x29\xdb\x8c\x2f\
\x9b\x0f\x64\x4e\x91\xed\xec\x02\x96\xe4\x16\xc8\x74\x49\x20\x6a\
\xe6\xfc\xbb\x71\xdd\xe1\xeb\x17\x3e\xf0\xad\xdf\xe1\xdc\x78\xd3\
\x2d\xe4\x36\x1a\xd3\x4f\xf4\xc2\x39\x6a\x5e\xcc\xe6\xe2\x02\x4e\
\x79\xb0\x99\xc2\xc3\xb6\x0b\x36\x33\x6e\x87\xb6\x71\xf8\x4a\x31\
\x5d\xaa\xba\x8d\xc9\xab\x12\xca\xfc\x78\x93\x80\x91\x12\xd4\x93\
\xa6\x5c\xcf\x45\xd7\x38\xd1\x0c\x07\x24\x31\xe1\xa7\x14\x62\x22\
\x7c\xe1\x73\x9f\x5d\xfd\xc5\x9f\xfc\xd1\x3f\xd5\x60\xd4\xcd\xfc\
\xcd\x02\x54\x1e\x7b\xca\x03\x27\x39\x2b\x6b\xba\x5a\x81\xa9\x36\
\x3f\xcc\x17\x90\x26\x39\xed\xb6\x03\x48\x6e\x01\x3b\x2a\xbc\x2d\
\x2c\x2e\xb5\xbf\xe5\xbb\xbe\xbb\xf1\xc2\x2f\x79\x09\x2c\xdb\x82\
\x64\xd6\xab\xeb\xab\x09\x6c\x4a\xf0\xb9\x19\xb6\xb3\x3d\xb0\x99\
\x0f\xe0\xd0\x74\x64\xd8\x0e\x0c\x4f\xdd\x0e\x95\x3c\x49\x62\xa2\
\xc4\x63\xe2\x1c\x47\x0c\x8c\xc0\x89\xf3\xa2\x68\x32\xa6\x62\x0d\
\x75\xc2\x62\x62\xf2\x19\xcb\x09\x84\x63\x66\x7c\xe5\xab\x5e\xbd\
\x7c\xeb\xed\x2f\x78\xe1\x63\x0f\x3d\xf0\x70\xe2\x5a\x46\x8e\x64\
\x38\xa9\xf6\x5e\x78\x13\x18\x37\x42\x00\xb5\x19\xa2\x06\xa6\x39\
\x00\xd2\x24\x30\x9a\xe4\xb4\x13\x98\x6c\xfd\x9e\x04\x48\x4e\x01\
\x43\x2a\x02\xa4\x56\x78\xdf\x76\x9c\xf6\xeb\xdf\xf2\xb5\xcd\xaf\
\x7b\xcf\xfb\xd1\x68\x35\xc1\x92\x55\xac\xa4\x30\x06\xb3\x3d\xf9\
\xeb\x72\x01\x9b\xd9\xd8\xcd\xe5\x05\x36\x3b\x03\x38\xd5\xb6\x33\
\x75\xe1\x41\x15\x7f\x55\xaa\xb0\xfb\x44\x53\x5f\x47\x69\xaa\x54\
\xfe\x7b\x50\x29\x38\x06\x4b\x89\x0f\x7c\xcb\x47\x6e\xfb\xe9\x8f\
\x7f\xdf\xc9\xc4\xf5\x9d\x07\x48\xd9\xd2\x46\x41\xce\x63\x61\xed\
\x3c\x42\x71\x4b\xf6\x7a\xd4\xc0\xb4\x23\x80\x34\xad\x84\x50\x51\
\x82\x6c\x16\x94\xdc\x09\xb2\x5d\x9e\x64\xd7\xca\xfe\x7d\xf3\xd7\
\xbd\xa7\xf5\xce\xf7\xbd\x9f\x9a\xad\x36\xa4\x0c\x00\x9e\x91\x21\
\x5d\x6e\x31\x9b\x6d\x6c\x67\x56\x82\xb8\xe3\xcc\xe6\x22\xb2\x9b\
\x2a\x0c\xa7\xda\xae\x55\x03\x1e\xa2\x2a\xe7\x4c\x49\x6e\x4e\xa5\
\x21\x79\xea\x09\x41\x00\xa4\x94\xf8\xd2\x97\x7d\x59\xf3\xba\x43\
\x87\x6f\x38\x71\xf4\xc8\xd3\x19\xa6\x54\x54\x81\x3c\x0f\x98\x0c\
\xa4\x0b\xbb\x52\x0d\x48\x35\x30\xcd\x53\xb6\x2b\xeb\xb4\xcb\x63\
\x48\x79\x09\xb2\x79\x2c\x69\x92\xb1\x21\x09\x4a\xad\xbc\xbf\xcf\
\xfb\x92\x97\xb4\xdf\xf1\xbe\xf7\x8b\x1b\x6f\xba\x15\x96\x6d\x43\
\xb9\xed\xa6\xb9\xd1\x9e\x2d\xac\xe6\x22\x80\xcd\x4c\xac\x66\x76\
\xa0\x99\x07\xb3\x99\x85\xdd\x94\xfc\x85\xab\x62\x5e\x69\xb6\x53\
\x56\x8e\xa3\x6d\x83\xce\x0c\xfe\xd1\xd4\x0b\x19\xdf\xf6\x5d\xdf\
\x73\xe3\xcf\xfc\xe8\x0f\x9c\xc7\xe4\x9c\xa8\xbc\x5b\xf8\xbc\x91\
\x60\x4d\x02\xe3\x15\x21\x6a\x49\xaf\x06\xa6\x99\x00\x09\x98\xcd\
\x69\x67\x60\xb2\xf5\xbb\x8c\xb1\xa1\x59\x20\xdb\x25\x01\xa9\x75\
\xf0\xfa\x1b\xdb\x1f\xfa\xc8\x77\x1a\x37\xdf\x72\x1b\x2c\xdb\x01\
\xb3\x7c\x56\x82\xcd\xe5\x13\xb3\x99\x27\xab\x99\x27\xd0\x4c\x06\
\x9b\x2a\x92\xda\x4e\xb1\xa1\x18\x6f\x76\x80\x15\x4d\x38\xc9\xa8\
\xba\x9e\x37\xf5\x7d\x81\x94\x78\xd9\x97\x7d\xb9\xbb\xb0\xb4\x7c\
\x60\x63\x6d\x55\x16\x00\x92\x37\x01\x98\xfc\xc4\xdc\x20\x73\x94\
\x96\x1a\x90\x6a\x60\xda\x36\x20\x95\x2d\x21\xb4\x93\xc6\x86\x14\
\x20\xed\xbb\xe6\xda\xce\x47\xfe\xf1\xc7\xcc\x5b\x6e\x7b\x1e\x0c\
\xd3\x04\x33\xeb\x80\x31\xcd\x00\x38\xcf\x22\x66\x33\x2f\x19\xed\
\x0a\x04\x9b\xf2\x3f\x77\xc5\xe4\x00\x9a\x90\xf4\x3c\x03\xe0\x4c\
\x3e\xbf\xe6\x23\xc7\x6d\x63\x8d\x15\x4f\x8c\xa6\x81\xaf\x7a\xd3\
\x5b\xaf\xf9\x93\xff\xfa\xfb\x9b\x48\x57\x8d\xc8\x26\xd4\x7a\x39\
\x20\x65\x26\x80\x2c\xc9\x98\xea\x26\x82\x65\x7f\x9e\xab\xd8\x2e\
\xbe\x13\xcd\xfa\x26\x55\xfd\xce\xc6\x91\xa6\x59\xbf\xc7\x64\x3b\
\xc7\x6d\xb4\xbf\xf3\x7b\x7f\xd0\x79\xd1\x8b\x5f\x0a\xdb\x71\x4a\
\x58\x49\xe7\x6f\x12\xa8\x01\x67\x7b\x60\xb3\x23\x72\x1a\x55\x94\
\xae\x68\xc2\xef\x30\x0f\x36\x54\xf2\x24\xa3\x8a\x0f\x10\x30\xe3\
\x0f\x53\x3d\x53\x8f\x04\xa1\xbb\xd9\xe5\x0f\xbd\xf3\xad\x4f\x00\
\x58\x4d\xdc\xd6\xf4\x6d\x1d\xc0\x06\x80\x4d\x28\x3b\x79\x17\xb1\
\x95\x3c\x69\x23\x1f\x25\x80\x2b\x04\xab\x6c\xbb\xf7\xc2\x51\xdb\
\xc5\xaf\x2e\x86\x34\x0d\x90\x66\x69\xd6\x37\x09\x90\xca\x30\xa4\
\x46\x02\x84\x52\x80\x44\x44\xad\xb7\xbe\xf3\x7d\xcd\x77\xbf\xff\
\x03\x70\x1c\x57\x59\xbf\x99\x31\x9f\x24\xcf\xcb\x11\x74\x76\x48\
\x52\x9b\x47\xdc\x66\x66\x86\x33\x2b\xcb\xa9\xee\x6c\xab\x02\x50\
\x54\x7e\x2f\x2a\x9d\x1c\x34\xc3\x49\x55\xed\xdc\x99\x81\x29\x51\
\x85\x33\x97\x81\xe5\xe5\x65\x7a\xf9\xab\x5e\x7b\xcd\xe7\xff\xee\
\xd3\xd9\x42\xaf\x79\x37\x5b\x03\x90\x85\xb8\xc1\x60\x78\xcb\x3a\
\xf4\xea\x3a\x7a\x35\x30\x4d\x94\xed\xf2\x8c\x0d\xb3\x36\xeb\x0b\
\x0b\xad\x3a\xa8\x66\x6c\xc8\x93\xed\x22\x50\x7a\xdd\x9b\xbe\xa6\
\xfd\xf5\xdf\xf8\x2d\x58\x58\x5c\x84\x0c\x24\x98\xb9\x74\x3e\xc7\
\x14\x7e\x71\xd1\x93\x3d\x2f\x75\x1c\xe7\xf2\x02\x9d\x19\xe2\x3e\
\x44\x15\x25\xb8\x59\x40\x67\x56\x19\x6e\xbb\xec\xa8\x04\xc3\x9f\
\xf1\xc9\x59\x41\x4b\xca\x00\x1f\xfa\xd6\x6f\x6f\x7d\xfe\xef\x3e\
\xdd\xce\x01\xa2\x61\xce\x63\x49\x99\xcf\xcc\x00\x54\x36\xaf\xa9\
\xb6\x8e\xd7\xc0\xb4\xa3\x25\x84\x92\x95\xbf\x8b\x6a\xda\x55\xb6\
\x7e\xbf\xe0\xc5\x5f\xda\x7e\xfb\x7b\xdf\x2f\x6e\xbd\xed\xb9\x30\
\x4c\x4b\x39\xed\xaa\x48\x1d\xcf\x7a\xb6\x73\x39\xc9\x6b\x17\x81\
\xed\x54\x91\xd7\xa8\x9a\x10\x47\xdb\x06\x9d\x59\x72\x86\xb6\x09\
\x3a\x34\xf3\x99\x52\xf1\x47\x2a\x3e\x92\x52\x32\x6e\xb9\xed\x56\
\xba\xed\xf9\x2f\xdc\xf3\xe8\x83\xf7\xe7\xd5\xd5\xcb\x96\x24\x1a\
\x25\xe6\x85\x10\x9c\x92\x71\xa6\xa2\x0a\xe5\x35\x30\x65\x7f\x95\
\xab\x20\xc6\x44\xa8\x16\x47\x9a\xc5\xd8\x50\xb6\xa6\xdd\xd4\x38\
\xd2\xc1\xeb\x6f\xec\x7c\xcb\x77\xfe\x13\xe3\xa6\x5b\x6f\x85\x65\
\xaa\x8a\x0d\x97\x0f\xdb\xa9\x0e\x18\x97\x03\xdb\xb9\x9c\x64\xb6\
\x9d\x95\xd8\x66\xcd\x2d\xab\x9a\x33\xb4\x0d\xa6\x74\x99\x80\x4e\
\xd9\xed\x18\xc2\xc0\xd3\x4f\x3f\x85\x7f\xfa\xe1\x0f\x9d\x02\x70\
\x5e\xdf\x2e\x20\x1d\x73\x5a\xd7\xb7\x30\xde\xb4\x85\xf1\x9a\x7a\
\xd9\x58\x53\xa9\x32\x45\x75\x8c\xe9\xca\x64\x49\x93\x80\xa9\x6c\
\xb3\x3e\x0b\xf3\xa9\x69\x57\x14\x47\x6a\x01\x68\x2e\xed\xda\xdd\
\xf9\x8e\xef\xf9\x01\xeb\x85\x2f\x7a\x31\x84\x10\xca\x69\x37\x56\
\x42\xe8\x59\x2a\xb3\xed\x70\x6c\x67\x56\xe0\x29\x37\xb7\x51\xa5\
\xd7\xee\x9c\xb5\xfa\x52\x01\xcf\x0c\x45\xa8\xe6\x11\x17\xa2\x99\
\xcf\xd8\x19\x17\x3c\x54\xc0\x9a\x24\x6e\xbe\xf9\x16\x1c\xb8\xf6\
\xba\xc5\xd3\x27\x4f\x0c\x12\x6c\x29\xac\x44\xee\xea\xfb\x4e\x8e\
\xac\x97\xed\x06\x1d\x60\xbc\x4c\x51\xcd\x96\xae\x42\x29\x2f\x0f\
\x94\x8a\x9c\x76\xb3\x16\x59\x2d\x72\xda\x15\xe5\x22\xa5\x00\xc9\
\x71\x1b\xed\x77\x7c\xfd\x07\xdd\xaf\x7d\xe7\x7b\x60\x18\x06\x24\
\xcb\x9c\x55\xd2\xb3\x5b\x66\xbb\x7c\x19\xcf\x0e\xb2\x9e\x2a\xe0\
\xb3\x2d\xe0\x99\xd5\x84\x70\xe5\xb3\x1d\x9a\xcf\x09\x0a\x66\xc6\
\x37\x7c\xcb\xb7\x37\x7e\xe5\xe7\x7f\xba\x85\x74\x0b\x8c\x86\x06\
\x25\x37\xc1\x8c\xc2\xf9\x21\x1b\x6b\x4a\xe6\x35\xc9\x5a\xd2\xbb\
\x3a\xa5\x3c\xc2\x74\x73\xc3\x76\x8b\xac\x56\x05\xa4\x56\x16\x94\
\xde\xfd\xc1\x6f\x6e\xbd\xf3\x7d\xdf\x00\xd3\x34\x21\x03\x59\x03\
\xcf\xdc\x19\xcf\x6c\x06\x83\xf2\xaf\xad\x90\xe3\x43\xa5\xf7\xb8\
\x8a\x86\x56\x03\xcf\x36\x4e\xd0\x2a\x7d\xbd\x0c\x21\xf0\xa1\x77\
\xbd\xbd\x7f\xe1\xfc\xca\x99\x84\xa4\x17\xca\x7a\x6b\x18\xb7\x90\
\x6f\x65\x24\xbd\xac\x9c\xe7\x23\x5d\xf0\x35\x57\xce\xab\xa5\xbc\
\x2b\x93\x25\x01\xe5\xcc\x0d\xf3\x8c\x21\x4d\x05\xa4\x2f\xf9\xd2\
\x2f\x6f\xbf\xe3\x7d\xdf\x40\xb7\xdc\xf6\x5c\x08\x21\x0a\x8c\x0d\
\xb5\xd4\x56\x05\x48\x2a\xe1\x78\x05\xf0\x99\x67\x35\x83\x59\x80\
\x67\xba\x92\x57\x03\xcf\xb6\x81\xa7\xc4\x7a\xcc\x30\x0c\xbc\xed\
\xdd\xef\x6d\xfc\x97\xdf\xfe\x8d\x90\x35\xf5\x12\xd7\xfd\x20\xb1\
\x60\x0d\xe7\x8c\xd0\x08\x91\x75\xe8\x05\x89\xb9\xa8\x4e\xb8\xbd\
\x8a\x18\x53\x95\x9c\xa4\xa2\x12\x42\x45\xf1\x23\x07\x33\x24\xc6\
\x86\xb7\xeb\x0e\x5d\xdf\xfa\x47\xdf\xf7\x43\xc6\xf5\x37\xdc\x08\
\x43\x88\xc8\xd8\xb0\xe3\xc0\x53\x62\x3b\x3b\x6e\xa5\x9e\x85\x88\
\xd1\x2c\xb9\x2a\x54\xb9\x58\x45\x69\xa3\xc1\x0e\x49\x6e\xb3\xb2\
\x9e\x1a\x78\xe6\x07\x3c\x53\xf7\x90\x08\x83\x41\x1f\xef\x7e\xf3\
\x57\x6d\x01\x38\x97\xb8\x5d\x40\x6c\x86\x98\xc4\x9a\xc2\xb8\x54\
\xa5\x84\xdb\x9a\x31\x5d\x59\x6c\x69\x5a\xd2\x6c\x9e\xdb\x2e\x2f\
\x0f\x69\x5a\xa5\x86\x49\xcc\x28\xba\x2d\xed\xda\xdd\xfa\xf8\x4f\
\xfd\x9c\x75\xf0\xd0\x21\x08\x61\xe8\x12\x42\x71\x0b\xef\xcb\x1d\
\x78\xaa\x4a\x66\xb3\x00\xcf\x4e\xb0\x9d\x2a\xa0\x33\x0e\x26\x17\
\x53\x72\xdb\x99\xa4\xd3\x8a\x2f\x2d\xcb\xd1\x67\x38\xef\x66\xa7\
\xe4\x34\xdb\x07\x56\xe5\xa2\x25\x2e\x09\x46\xa7\xd3\xc1\xcb\x5f\
\xf5\xda\xd6\xe7\xff\xee\xd3\xbd\xc4\x1c\xd0\x4b\xcc\x13\x49\xc6\
\x94\x65\x4d\x75\xc2\xed\x55\xcc\x98\xca\xf4\x49\x32\x4a\xb0\xa4\
\x22\xb9\x6e\x92\x91\x61\xec\xd6\xea\x74\x3a\xdf\xfa\xd1\xef\xb6\
\x5f\xfe\xca\x57\xc1\xd4\x35\xed\x66\x5e\xcf\x5e\xd2\xaa\x05\x17\
\x49\x66\xab\x5a\x2a\xa7\x6a\x3e\x4f\x49\xb9\xed\x62\x4a\x6e\x57\
\x0d\xeb\xa9\x74\xde\xed\x0c\xeb\x29\x41\xe2\x27\x0e\x21\x04\xb6\
\x7a\x3d\xbc\xe7\xcd\x5f\xd5\xcd\xb0\xa6\xf3\x39\xac\x69\x13\xb1\
\x7d\x3c\xd9\xf1\xb6\xa8\x4c\x51\xae\x75\xbc\x66\x4c\x57\x3e\x73\
\x2a\x62\x4b\x49\x50\x2a\x13\x3b\xca\x63\x46\xed\xe4\x5f\xc3\x34\
\x3b\x5f\xff\x4d\xdf\xd6\xf8\x9a\x77\xbc\x4b\x19\x1b\xa4\x1c\x6b\
\xe5\xfc\x6c\x60\x3d\xf3\xaf\xd1\xb6\x73\x05\x44\xc7\x95\xbf\x8b\
\x6d\xad\xae\x59\xcf\xe5\xcf\x7a\x66\xd3\x0b\x93\x9d\x75\x17\x17\
\x16\xf0\xe2\x97\xbd\xbc\x75\xcf\x1d\x9f\xdf\xca\xcc\x11\x6e\x86\
\x39\x0d\x13\x8b\xde\x70\xae\x09\x17\xc5\x75\xc2\xed\x55\xc6\x98\
\x26\xf5\x4b\x9a\x04\x48\x59\x96\x54\xd4\x03\x29\x17\x88\xf4\xdf\
\x36\x80\xf6\x9b\xbe\xf6\x5d\x9d\x6f\xfc\xc8\x77\x90\x6d\xdb\xe3\
\x4e\xbb\x4b\x6e\x32\xd8\x61\xf0\xd9\x69\xc6\x53\xb1\x10\x60\x55\
\x6b\xf5\x5c\x59\x4f\x85\x27\x6a\xd6\x73\xf1\x58\x4f\x2e\x4c\x56\
\xd8\x80\x10\x02\x27\x4e\x9c\xc0\xb7\xbd\xff\x5d\x1b\xa8\x16\x6b\
\x9a\xc6\x9a\x72\x13\x6e\x6b\xc6\x74\x65\xb0\xa4\x3c\xc6\x54\x64\
\x7a\x48\x4a\x78\x49\x83\x43\x91\x44\x37\x06\x42\x00\x3a\xe1\xfd\
\x97\x7c\xf9\x2b\x16\xdf\xf9\xf5\x1f\x30\x6f\xbd\xed\x79\x60\xf0\
\x44\xa7\xdd\xce\x81\xcf\xf6\x4d\x06\x97\xb4\x74\xce\x74\x64\x98\
\x9f\xdc\x36\x0f\xd6\x53\x83\xcf\x15\x09\x3e\x85\x7c\x91\x14\x50\
\x1c\x3a\x74\x08\xd7\x5c\x77\xb0\x75\xea\xc4\xb1\xad\x0c\x63\xca\
\x8b\x33\x85\xb1\xa6\x6c\xb2\x6d\x72\x4e\xaa\x3b\xdc\x5e\x05\x52\
\x5e\x51\x95\x87\x2c\x6b\xca\x63\x4c\x8d\x0c\x28\xe5\x81\x50\xf2\
\x6f\xe7\xd0\x0d\x37\x2d\x7f\xd7\xf7\xfd\xb0\x7b\xc3\x4d\x37\x01\
\xcc\xc5\x25\x84\x2a\x5e\x69\x97\x96\xf9\x5c\xda\x5c\x9e\x62\xe0\
\xa9\x38\xbd\xd5\xf6\xea\xcb\x5f\x72\x9b\x17\xf8\xd0\x0c\xe5\x21\
\x0b\xc0\x67\xda\x60\x66\x7c\xdb\x77\x7d\xb7\xf1\x2f\x3e\xf1\xc3\
\x0d\x8c\xc7\xa3\xb3\xe0\x54\x24\xe7\xd5\xd6\xf1\xab\x08\x98\x68\
\x0a\x63\x0a\x4f\x88\xa4\xe9\xc1\x29\x00\xa6\x08\x7c\xf2\x6e\x9d\
\x85\xc5\x5d\x1f\xff\xe9\x9f\x5f\xbc\xe5\xd6\x5b\x89\x99\xc1\x52\
\x66\x4f\xf1\xb9\xf6\xe4\xa9\x0a\x56\xf3\xaf\xdd\x36\x7f\xf0\xb9\
\xd8\x05\x43\x6b\xf0\xa9\xc1\x87\xaa\xef\xc4\xd8\x2f\x28\xa5\xc4\
\xeb\x5e\xff\x7a\xfc\xea\xe2\x52\x6b\x73\x7d\xad\x8b\xfc\x18\x93\
\x83\xf1\x2e\xd6\x21\x38\xf9\x25\x18\xd3\x55\xcd\x9e\xae\x44\x29\
\x6f\x12\x28\xe5\xc5\x98\x92\xa0\x94\x04\xa6\x10\x84\x16\xf4\xad\
\x03\x60\xa1\xd9\x6a\xef\x7e\xcf\x87\xbe\x65\xcf\xdb\xbe\xee\x5d\
\x16\x48\x55\x20\x56\x9f\x56\xf5\x92\xbf\x08\xe0\xb3\x43\x66\x03\
\xaa\x78\x85\x6f\xab\x8c\xce\xbc\xc0\xa7\x96\xdd\xae\x3a\xd9\x6d\
\x0e\x5b\x29\xdc\x8e\x21\x04\xbe\xfe\x1b\xbf\xd5\xfa\x9d\x7f\xf7\
\x2b\x45\xac\xc9\xce\xb0\xa6\x3c\xc6\x54\x64\x82\xa8\xcd\x0f\x57\
\x90\xf9\x41\xe4\xc8\x76\x06\x26\x1b\x1d\x92\x45\x55\x93\x0c\x69\
\x31\x01\x48\xe1\xfd\xc5\x0f\x7c\xf8\x3b\x6f\x78\xe7\x7b\xbf\xbe\
\x41\x44\x08\xa4\x2c\x3f\x45\x5e\x04\xb7\xdb\x65\xd1\x2e\x81\xb6\
\x31\xbd\xcd\x50\x0c\xf0\x6a\x76\xbb\xd5\xe0\x83\x59\x76\xa4\x78\
\x09\x51\x71\x3b\x82\x08\xfd\xc1\x00\x5f\xf7\x86\x57\x6f\x01\x58\
\xc1\xb8\x75\x3c\x2c\x55\x34\x8b\x75\x3c\x4a\xb8\xad\xcd\x0f\x57\
\x26\x73\x9a\xe4\xca\x4b\x96\x1a\x4a\x32\xa6\x64\x7c\x69\x01\xc0\
\xc2\x57\xbc\xe6\xab\x6e\xf9\xba\xf7\xbe\x7f\xf9\xa6\x9b\x6e\x36\
\x58\x77\x8f\xa5\x29\x1a\xc3\xdc\xf3\x7c\x2e\x83\xb8\xcf\xfc\xcd\
\x06\x97\xb3\xf4\x56\x5b\xad\xab\xcd\xd7\x34\x8d\xe0\xcf\x04\x64\
\x17\x83\xfd\x54\x84\x54\x65\x82\x00\xd0\x69\xb7\xf1\xda\xaf\x7e\
\x73\xf3\xd3\x7f\xfd\x97\x45\x52\x5e\x1e\x63\x32\x31\x6e\x7e\xc8\
\x63\x4c\x57\x35\x73\xba\xd2\x18\x53\x9e\x6c\x97\xe7\xbc\xcb\x9a\
\x1c\x92\x4c\x69\x11\xc0\x12\x80\xa5\x9b\x9f\x7b\xfb\x6d\xff\xe4\
\xfb\x7f\xf8\x86\x43\x87\xaf\x37\x83\x20\x50\x4e\xbb\x59\x81\xa8\
\x6c\x79\x9d\x4b\x5c\xbd\x3a\x1f\x80\x2e\x81\xe9\xa0\x96\xde\x6a\
\xe9\xed\x12\x83\x4f\x19\xd6\xb4\xd5\xeb\xe1\x1d\x6f\x7c\xcd\xba\
\x66\x4d\x2b\x9a\x31\x85\xf6\xf1\xd0\x3a\xbe\xa1\x6f\xdd\x1c\xd6\
\x94\x6c\x93\x11\x64\x59\x53\xcd\x98\xae\x2c\xc6\x44\x53\x18\x53\
\xd6\x2a\x9e\x8a\x31\x1d\xbe\xf1\xe6\x5b\x7e\xf0\x13\x3f\xfd\x92\
\x6b\xae\xbb\xce\x0e\x7c\x1f\x23\xcf\x8b\x36\xac\x4e\x13\x06\x71\
\xfa\xb4\xe6\x89\x2b\x4d\x4a\x15\x1d\xa1\xaa\x40\xb4\x93\x0c\xe8\
\x52\xb6\x50\x98\x97\xf4\x56\xb3\x9f\x9a\xfd\xec\x20\x00\x15\xbd\
\x3f\x4c\xb8\x7d\xd9\x2b\x5e\xd9\xbe\xe3\xb3\x7f\xbf\x89\x62\xcb\
\xb8\x89\xe9\x71\x26\xa1\x01\x09\x35\x6b\xba\xf2\x18\x53\xb2\xaf\
\x52\x1e\x5b\x4a\x1a\x1c\x92\x36\xf0\x30\x96\xb4\xf4\xd1\x7f\xfa\
\x3d\x5f\xf7\xcd\xdf\xfa\xe1\xeb\xfc\x20\x88\xab\x35\x24\x96\x84\
\x81\x94\x08\x74\xe2\xec\xc8\xf3\x0b\x4e\x5f\x86\xe7\x07\xb9\xfb\
\x49\x00\x02\x66\x48\xc9\xd1\x76\x4a\x4f\x1e\x15\x8b\x9a\x4e\xea\
\xec\x4b\x13\x96\xba\x17\xd7\x7c\x70\x91\xa5\xb7\x79\xb1\x9f\xe2\
\xf9\xfb\x59\xcd\x7e\x2e\x0f\x00\x9a\x3d\xf6\x93\x7f\xfe\x6e\xfb\
\xa8\x14\x7e\x31\x21\x04\xce\x9c\x39\x83\x0f\xbe\xe3\xad\x21\x63\
\x3a\x97\x60\x4e\xab\x19\xd6\x94\xec\x70\x1b\xb2\xa6\xb0\x35\xbb\
\x97\x61\x4d\x61\x8c\xe9\xaa\x04\xa6\x2b\x85\x31\x4d\xea\x52\x9b\
\xc7\x9a\x2c\x14\x98\x22\x86\xc3\x01\x1c\xdb\x82\x19\x88\xca\xac\
\x25\x29\xad\xa5\xcf\x27\x4a\x5d\x1b\x32\x02\xa6\xa0\x1a\xe0\x84\
\xc0\x26\x25\xfc\x40\x16\x00\x63\xbc\xcc\xf2\x3c\x7f\x4c\x8e\x0b\
\x01\x49\x4a\x09\xc9\x09\x70\x4c\xae\x04\xa7\x3e\x30\xfe\x60\xf2\
\x9a\x2d\xca\xe4\x22\xae\x30\x99\x5e\x34\x09\xee\x2a\xb4\x5d\x5f\
\xc5\xf2\xdb\xac\x00\x54\x78\x9d\x49\x89\x6b\xaf\xb9\x06\xd7\x1d\
\x3a\xdc\x3e\x71\xf4\xc8\x06\xd2\xb1\xeb\x3c\xab\xb8\x81\x72\xce\
\xbc\xda\x2e\x7e\xa5\xb2\xc1\x09\xe0\x54\x98\xcb\xd4\xef\xf5\xa1\
\x9a\x9a\x67\x4e\x5e\x46\xfc\x68\x01\x48\x29\x2c\x62\xc5\x8c\xf2\
\xc0\x46\xff\xcf\x20\x82\x21\x00\xdb\x34\x26\x5e\x04\x54\x8d\xc2\
\x8c\x3d\xcb\xa9\xa2\xc5\xe9\x21\x99\xc1\x92\xe1\xcb\x20\x21\x33\
\x52\xc9\x1e\x45\x84\x20\x90\xf0\x83\x00\x23\xdf\x1f\x4f\x0d\x0c\
\xff\xc1\x8c\x91\x1f\x8c\x6d\x53\x1d\x1f\x20\x90\xaa\x42\x86\x9f\
\xd7\x24\x91\xa7\x7d\x63\x1e\xbf\x6a\x73\x8e\x13\x71\xf1\x01\x62\
\x94\x53\x32\x77\x16\x84\x26\xbf\xa1\x96\xdf\xe6\x2b\xbf\xcd\x0a\
\x40\x93\x06\x33\xe3\x1f\x7d\xec\x07\xdc\x1f\xff\x81\xef\x29\x4a\
\xae\xb5\x90\x6e\xb1\x93\x95\xf0\x04\xc6\xeb\xe5\x5d\xd5\xe3\x4a\
\x8f\x31\x65\x2b\x3f\xe4\x19\x23\x52\xf1\xa6\xcd\xcd\x8d\xe9\xd3\
\x33\x03\x5c\xf1\xa2\xe7\x90\x31\x50\x66\xee\x0d\xc1\x2c\xe7\x62\
\xe1\x9c\x49\x3a\xf5\x4c\x01\x72\x71\x09\x49\xc4\x20\x01\x08\xc0\
\x82\x51\x3c\xa9\xcf\xb4\xa0\xa7\x2c\x36\xe5\x7e\x37\xca\x65\x8e\
\x15\xe4\x3d\x82\x06\x47\xc5\x1c\x39\x87\xa7\x31\x6b\xb9\x95\xc6\
\xf7\x31\x09\x8c\x41\x20\xe3\xdf\x67\x1a\x37\x24\x4c\x5f\xc8\x72\
\xfa\x58\x70\x19\x25\x8f\x2e\x15\x08\x25\xf6\xf4\x72\x92\xdf\xe6\
\x0a\x40\xdb\x07\x9f\x49\xe7\xa7\x94\x12\xaf\x7a\xd5\xab\x69\x61\
\x69\xa9\xb5\xb1\xb6\xb6\x8e\xfc\x1c\x26\x0b\x93\xf3\x98\xb2\xac\
\x09\x57\x33\x6b\xba\x52\x2b\x3f\x60\x02\x38\x4d\xca\x71\xb2\x8f\
\x3c\xfd\xf4\x28\x9a\xd5\xe8\xd9\xb2\x80\xe1\x02\x4e\x91\x66\x7c\
\xe9\x97\xa8\x07\x92\xe0\x97\x85\x37\x2e\xa0\x13\x93\x59\x08\xc7\
\x93\x94\x3e\x84\x94\x9b\xc1\x9f\x60\x8e\x96\x31\xc3\x84\x5b\xee\
\xb7\x99\x24\xd1\x2b\x60\xcc\x32\x36\x9e\xf8\x39\x94\x03\x8e\x41\
\x20\x31\xf2\x7d\x70\x0e\xcb\x63\x28\x70\xa4\x3c\xe0\xd7\x09\xda\
\xe1\x3e\x70\xe9\x99\x93\xc7\x4a\x51\x13\x17\xcd\x60\x54\x6e\x6e\
\xae\x0c\x02\x97\x86\x05\x5d\x4a\x00\x9a\xf4\xa8\x10\x02\x1f\xfd\
\xee\x1f\x58\xf8\xa5\x9f\xf9\xf1\x73\x39\xf2\x5d\x96\x2d\xd5\xa0\
\x74\x95\x4a\x79\x79\xa0\x54\x54\x33\x2f\x65\x94\x18\x0e\x87\xa9\
\x79\xb7\x58\x0c\x63\xcc\x4f\xd4\x2e\x7f\xd5\x54\xfd\xd4\xc9\xe0\
\x54\x65\xdb\x65\xdf\x4c\x95\xf7\x8c\x33\xe8\x98\x12\x92\x0a\x27\
\x5c\x2e\x35\x37\x16\x5b\xea\x19\x06\x09\x18\x42\xc0\x32\x27\x68\
\x88\x25\x7e\x9c\xc8\x42\x45\x45\xe0\x38\xbe\x4f\xe1\xba\x47\x4a\
\x2e\x8c\xf5\x4d\x96\xf6\xd4\x3d\x15\x6f\x0c\x40\x20\x8c\x3c\xaf\
\x30\x1c\x38\xf2\xfd\x9c\x63\x13\xc6\x2c\x27\x48\xaa\x39\x98\xc1\
\xc9\xe3\xc4\xe5\x4f\x7c\xa2\xa2\xb7\x30\x88\x2b\xa6\x60\xcc\x49\
\x86\xab\xc4\xd2\x27\x6c\x23\x08\x02\xbc\xe9\xad\x6f\x35\xfe\xd5\
\xcf\xfd\x94\x23\x83\x20\xcb\x92\xf2\xda\x5e\x4c\x8b\x2f\xd5\x52\
\xde\x15\xce\x9a\x92\xa0\x34\xb5\x61\xe0\xa0\xdf\x17\xf1\x4c\xc2\
\x73\x3e\x47\x68\xdb\xaf\xa1\x8b\xba\x2f\xf3\x02\x47\x1e\x63\x4d\
\x93\xb6\x91\x80\xac\x52\x60\xc8\x53\xbf\x11\x97\x7a\x9c\x27\xbd\
\x9c\xb8\x30\xd6\xc4\x39\x00\x94\x04\xa9\x3c\x77\x24\xe9\x79\xd8\
\x30\x48\x05\x3c\x4d\xb3\xf8\x97\xa1\xa9\xbc\x65\xea\xcf\xac\x98\
\x23\x15\xb2\x4a\x29\x65\xaa\x9a\x49\xd9\xf3\x86\x22\x49\x35\xd0\
\x92\x6a\xd1\x32\x40\x33\xc7\x1c\x70\x44\x86\x39\x46\x98\x47\x53\
\x4e\xc2\xca\x84\x22\x07\xfc\xc6\x24\x03\xaa\x98\x56\x10\x9f\x03\
\x8e\x6d\xe1\x1b\xbe\xf9\x23\xfb\x7e\xff\x3f\xfe\xd6\xf9\x09\xa0\
\x94\x67\x13\xaf\x63\x4c\x57\x21\x63\x02\x26\x77\xb3\x4d\x31\xa7\
\x73\x2b\x67\x7d\x46\x09\x19\x6f\x86\x38\xd3\xce\x83\xcd\x9c\x57\
\x86\x05\xf2\xdf\xfc\x94\xc7\x9c\xed\x25\xc0\x86\xca\x6e\x0b\x65\
\x01\x6a\xfa\x21\xe2\x22\x11\x65\x5b\xbf\x77\xfe\x9e\xa5\xe2\x5a\
\x09\x9e\xce\x63\xa8\x92\x37\x1f\x72\x01\x86\x66\x38\x15\x17\x83\
\x63\x24\x43\x85\xcc\xb1\xb4\xa7\xa3\xba\xf9\x83\xa7\x90\x51\x29\
\x55\x45\x95\x28\xde\x57\xe1\x22\x21\x50\xc4\x1c\x8b\x9c\xaa\xe1\
\xc8\x7b\x3e\x64\xd5\x81\x94\xc5\xcc\x31\xe7\xe7\xcc\x44\x82\x11\
\x04\x12\x1f\xf8\xa6\x6f\x76\x7f\xff\x3f\xfe\x96\x39\x23\x28\xd5\
\x8c\xe9\x0a\x07\xa6\x69\xb2\x5e\x11\x73\x32\x99\xd9\x20\x50\x32\
\xfa\x72\x89\xf9\xc9\x1c\x3e\x97\x26\x4c\x2b\x34\x85\x5c\x14\x20\
\x04\xef\xe4\x77\x1a\xd3\x1f\x4b\x1c\xc1\x1c\x80\xda\xf9\xe3\x3e\
\x89\x85\x94\x0b\x51\x4e\xc2\xe8\xa9\x87\x85\xe6\xb2\xab\xb1\xbf\
\x91\x27\xf0\x85\xd4\x71\xe5\xc9\xfc\x8d\x0b\xde\x47\xc5\xcb\x22\
\x43\xa8\x27\x2d\xd3\x28\x87\x74\x98\xcd\x2c\xc2\x28\x6e\x4b\x23\
\xb3\xf9\x85\x13\x3e\x24\x2f\x57\x2a\x08\x02\x5c\xb3\x77\x17\xde\
\xf1\x9e\xf7\x1d\xfc\x93\xff\xf6\x87\xab\x25\x00\x69\x52\x17\xdb\
\xab\x1a\x9c\xae\x74\x60\x22\x4c\x6e\xb3\x3e\xc6\x9e\x3c\xcf\x53\
\x49\xc7\xa5\x42\x8f\x17\x5f\xea\xab\xf2\x89\x13\x41\x89\x4a\xec\
\x02\x6f\x4b\x68\x9b\xbc\xc3\x11\x03\x29\x46\x3e\xa6\xec\xca\xb4\
\xe4\x4c\x8f\x1d\x02\xa9\x39\xb2\xe4\x6d\xa3\x49\x89\xf7\xcc\x42\
\x78\x0b\x5f\x32\x6f\xb2\x9c\xb7\x51\x4e\x83\x58\xf2\x89\xb1\xef\
\x91\xb7\x74\x2c\x04\x2c\x4e\xb1\xab\x22\x65\x2f\x34\xe3\x84\xb2\
\x6a\xd5\x42\xb1\x04\x0b\x86\x69\x62\xef\xbe\xbd\x56\x0e\x28\xe5\
\x81\x13\x15\xa8\x3b\x57\xfd\x10\x57\x38\x28\x4d\x02\xa8\x5c\x70\
\x92\x52\x0a\x29\xa5\x3a\x81\xe7\x49\xb0\x69\x5b\x9d\x01\xa7\x4f\
\xc2\x33\x83\xd2\x84\x2f\x59\x98\xe6\xc7\x95\x77\x8a\x8b\x2d\x0c\
\xc5\xdb\x1b\x8b\xaf\x33\x2a\xc5\x15\x38\xfd\x16\x9e\xb2\x05\x9e\
\x37\xc5\xe5\xb2\xc7\xa6\xc4\x61\xcd\x7b\x09\x4f\x7f\x55\xa5\x9f\
\x6e\xe2\x2f\x35\xe3\x09\x39\xf5\x21\xae\x7c\x6e\x6f\xe3\xb2\x18\
\x5f\x68\x70\xf1\x89\x13\xfd\xc7\xe1\x0d\xd1\xad\xe8\x7b\x31\x33\
\xee\xfa\xe2\x17\x06\x53\x58\x52\x91\x1b\xaf\x06\xa7\xab\x00\x98\
\x66\x05\x28\x31\x1a\x8d\xb4\x26\x4f\xe3\xff\x11\x55\x06\x29\xba\
\x28\x78\xc4\x39\xa0\xb4\x5d\xa2\x39\xdb\x4e\x72\x21\xc0\xf0\x04\
\xe0\xe1\x89\xe0\xc2\x93\xa7\xdb\x6d\x81\x14\x57\x99\xc0\xb9\xe4\
\xc4\x8a\x79\x79\x7d\x2f\x23\xc7\x30\xcf\x6f\x2f\x77\xe4\xf5\x33\
\xbe\x88\xe7\x78\x28\x98\x19\xa7\x4e\x9e\x0a\x50\x2e\x8e\x44\x93\
\x57\x86\x57\x2f\x40\x5d\xa9\xc0\x44\x05\x33\x6d\x99\x9b\xf0\xb4\
\xb5\xb6\x58\xed\x8a\xff\xbb\xa4\x5f\x8e\x2e\xf6\x61\x2c\xcb\x75\
\xb8\xf2\x15\xce\x25\x67\x3e\x4e\xbd\x76\xc6\x49\x7b\xda\x5b\xe7\
\x89\x05\x35\x6b\x2a\x29\x89\x57\xfd\x1d\xf8\xb2\x83\x73\x22\x82\
\xef\xfb\x38\xb7\x72\xd6\xab\xd9\x51\x0d\x4c\xb3\x9c\x97\x34\x09\
\xb0\x98\x79\x3b\xd3\x5e\xe9\xf9\x7d\x16\x80\xa1\x31\x42\x73\x29\
\x8d\x3c\x5c\xf8\xcf\xd2\xac\xa9\x2a\x38\xf1\xd4\x69\x77\x36\x16\
\x35\x4d\xe7\xbb\xcc\x58\x13\x57\x7c\x1f\xcf\xeb\x12\xda\x31\xd6\
\xc4\x17\xe7\xca\x2f\xf5\x7b\x56\x3f\xdf\xc3\x7f\x4b\x29\xe1\x79\
\x1e\x23\x3f\x8f\x92\x6a\x70\xba\xba\x80\x69\xae\x0b\xa4\x23\xcf\
\x3c\x13\x85\x8f\xab\xce\x59\x65\x91\x69\xdb\x3d\x8f\xa6\xbd\x87\
\xcb\xae\xca\x19\x3b\xb3\xbe\xe4\x99\xc1\x69\xea\xb2\x60\x4c\xde\
\xe3\x1d\xfc\x1e\x97\x0b\x6b\xe2\xf9\x9e\xfd\xbc\x8d\x97\xcc\xc2\
\x80\x78\xfb\xc7\xae\x34\x3c\x4f\xcd\xfd\xdd\x99\xe5\x02\x11\xa1\
\xbb\xb5\x85\x09\xe0\x53\x83\xd3\x55\xce\x98\x0a\xd6\x33\xe5\xce\
\xcc\x6e\xb7\x9b\x98\x00\xd3\x93\xde\x3c\xa6\xc0\xca\x45\x41\x2b\
\x5e\x60\x5c\xe6\x5f\xbc\x0d\xfa\x30\x69\xe1\x38\x4d\x67\x9a\x06\
\x4e\x63\x00\x35\x9d\xf1\xcc\xff\x17\xba\x74\xac\x69\xe6\xd7\x5e\
\x26\x92\x5e\x55\xf5\xad\x2a\x6b\x9a\x4f\x84\x68\x07\x59\x53\xfa\
\xa2\xae\x0a\x3e\x35\x38\x5d\x05\xc0\x94\x47\x09\xf2\xee\x8f\xdd\
\x5c\xb7\x51\x30\x67\xc7\x36\x1e\xca\xac\x94\x72\xfc\xac\x25\x11\
\x8a\xaa\x5f\xf4\x5c\xf2\xb3\xb8\x04\x38\x6d\x7b\x25\xcb\x53\x56\
\xb9\x15\xc1\x69\x0c\xa0\xb8\x34\x40\x8d\xc3\xd2\xe5\xc3\xa2\xb8\
\x2a\x2a\x94\x64\x4d\x97\xaf\xa4\xc7\xdb\xfd\x84\xb9\x30\xc2\x4a\
\xcb\x05\xc6\xb6\x8e\x0e\x11\xb0\xbe\xbe\x51\x74\x51\xcf\xd9\x77\
\x5b\x03\xd3\xb3\x15\x84\xf2\x58\xd2\x54\x50\x02\xc0\x8f\x3d\xf6\
\x68\x79\xf6\x43\x61\x6a\x21\xe5\xb7\xbb\x28\xaa\xff\x45\x93\x76\
\xbb\xc4\x17\xe4\xc9\xe0\x90\x7a\x5d\xce\x67\x70\xde\x53\x65\xc8\
\x46\xd9\x79\xaa\x02\x38\x71\x29\xc0\xa9\x00\x50\x63\x20\xb5\x43\
\x2c\x8a\x2b\xae\xf8\xaf\x34\x49\x0f\x3b\xf1\x79\x73\x64\x4d\x33\
\x80\xd3\xb6\x58\x13\x11\xd6\x37\x36\x6a\xf6\x53\x03\x53\xe1\xd9\
\x52\xc4\x92\x8a\xa6\x61\xa9\x6f\x0c\x40\x3e\xf6\xc8\x23\x12\xa0\
\xb1\xdc\x05\x0e\x27\xa2\xc4\xf2\x37\xbf\x7a\x75\x85\x9c\x25\xe6\
\x1c\xb4\x99\x3e\x91\x8e\x03\x54\xf1\x24\xc7\x3c\x1d\xa0\x18\x05\
\xa1\xa7\x49\xbb\xc3\x53\xd6\xc8\x19\x70\xe2\x09\x5f\x82\x4b\x9b\
\x1e\xb8\x9c\xc0\x54\x00\x52\x97\x92\x45\x5d\x71\x92\xde\x65\xc5\
\x9a\x2e\x9d\xa4\x97\xbc\xfc\x9e\x7e\xfa\xa9\xa2\x1d\xe2\x39\xff\
\xec\x35\x30\x5d\x01\x0c\x2a\x0f\x80\x0a\xff\x4d\x84\xc4\x3a\x3b\
\xfd\x1f\x22\xb0\xe2\x08\x94\x92\xf7\x4b\xe1\x51\x18\x1b\xc9\xc4\
\x47\xb2\x20\x98\x43\x8d\x8a\xbf\x60\x4e\x3c\xac\x10\xa0\x18\x85\
\x68\x53\xd9\xec\x51\x01\x9c\xa6\x4d\x70\xbc\x13\x00\x85\x1d\x06\
\xa8\x1d\x62\x4d\xa8\xc8\x9a\x2e\x99\xa4\x37\xcb\xfb\xe6\x60\x1f\
\xe7\x8a\x1f\x5f\x55\xd2\x9b\x35\xb6\x76\xf7\x9d\x77\x4e\x53\x6d\
\xea\x51\x62\x5c\x89\x25\x89\xf2\xe6\xd6\x89\x0c\x29\x7b\xdb\xd8\
\xd8\x90\xcc\x2c\xf2\xd2\xc2\xc3\x22\x9f\x51\xd5\xa2\xb0\xe7\x10\
\x8d\x17\xd7\x61\x5d\xc3\x86\x08\x30\x84\x00\x88\x22\x10\x2b\x2a\
\xaa\x90\x04\xb8\x10\x3f\x54\x28\xaa\x64\x0d\xed\x29\xaf\xcf\xed\
\xbf\x44\xc5\x3d\x88\x4a\xf1\xc1\x54\xc1\xb7\xb8\x80\x4c\x7e\xb9\
\xbb\xb8\x5a\x59\x6e\x58\x8e\x90\xea\x1f\x4c\xd3\x26\x28\x2a\x28\
\x37\x33\xf5\x7d\xe1\x7b\x2e\x5e\x65\xbd\xe8\x50\x95\xac\x15\x34\
\xb9\x8e\x1e\xe7\xfe\xb6\xd3\xeb\xee\xcd\x5e\xfc\xb0\xe4\x6e\x94\
\xdb\x64\x71\xfd\xde\xd2\xfb\x39\xe1\x08\xe4\xbe\xa7\x52\x0b\x9b\
\x19\xeb\x6d\x3d\xf3\xf4\xd3\x93\xe6\x9f\x49\xb2\x48\x0d\x5a\x57\
\x30\x30\xf1\x14\xb6\x54\x04\x50\x12\x40\x10\xde\x4e\x1e\x3f\x1e\
\x30\xc3\x2c\x94\xe9\x52\x6d\x59\x75\xc3\xbd\xc4\x6b\xa3\xb8\x13\
\x11\x18\x8c\x5e\xaf\x87\xd5\xd5\x55\x30\x33\x5c\xd7\x85\xe3\x38\
\x30\x2d\x4b\x25\x38\x08\x03\x24\x48\xdf\x17\x30\x4d\x13\x42\x21\
\x5d\xaa\x97\xd0\x78\x5f\x21\x4e\xaf\xee\x92\xf5\xfd\x92\x5d\x70\
\x23\x9a\x44\x93\x97\x93\x85\xe6\x8d\xe2\xca\x63\xd3\x7a\x37\x15\
\x6e\x36\x02\xa8\x9c\xd6\x0d\xa9\x8f\x2e\x00\xb1\xa9\x80\x56\x1e\
\xa4\x38\x55\xe0\x62\x46\x90\x1a\xab\xa1\xb7\xad\xce\x56\x33\xbf\
\x76\xdb\x40\x33\xf5\x3d\x79\x0d\x4c\xca\x80\x53\x79\x30\xdc\x7e\
\x6d\xda\x59\x8f\x58\xce\x96\x4a\x15\xe2\x4d\xd4\x26\x94\x8c\xc7\
\x1f\x7b\x54\x62\x72\x0c\x3b\x8f\xae\xd7\xac\xea\x2a\x60\x4c\x65\
\x00\x6a\xe2\xad\xdf\xeb\x49\x66\xd5\xc0\x6d\x9a\x36\x10\x4d\xad\
\xe1\x2a\x4e\x32\x3c\xdf\x87\xe7\x07\xe8\x6e\xf5\xe0\x07\x12\x1b\
\x1b\x1b\x78\xf8\xe1\x87\x71\xec\xc8\xd3\xd8\x5c\x5b\xc5\xc6\xfa\
\x2a\x86\x83\x01\x2e\x9c\x5b\x41\x10\x04\x60\x66\x18\x86\x01\xb7\
\xd1\x40\xbb\xd3\x81\x6d\xdb\xb0\x6d\x07\xa6\x65\xa2\xd1\x68\x42\
\x08\x81\x85\xc5\x45\xd8\xb6\x83\x46\xa3\x81\x46\xb3\x89\xbd\x7b\
\xf7\xa2\xd1\x68\xc0\x76\xd4\x63\xbb\x76\xed\x42\x10\x04\xb0\x2c\
\x0b\x82\x08\x7e\x10\x40\x4a\xa9\x80\xd0\xb6\x61\x9a\x26\x98\x19\
\xc2\x10\xba\x41\x1c\xc1\x34\x4d\x18\x42\x80\x44\x0c\x84\x61\x5d\
\x75\x4a\xb9\x34\x38\x47\xea\x28\x60\x59\x1c\x4a\x6c\x94\xf3\x4e\
\xae\x32\x6d\xa5\x28\x40\x69\x80\xca\x80\xd4\xd4\xae\x45\x85\x55\
\xc9\x2b\x36\xd1\xa8\x3a\xcb\x6f\xfb\xf5\x25\xa6\xe5\x12\x15\x59\
\xab\x4f\xe3\xb3\xbe\xa3\xfc\xfb\xa6\xee\xdd\x78\xed\xd7\xe9\xe0\
\x54\xaa\x9d\xca\xec\xe0\x44\xa4\xda\x66\x6c\xac\xad\x4f\x03\xa6\
\x32\xb1\xf0\xab\x1e\x9c\xae\x54\x29\xaf\x88\x32\xcb\x12\xe0\x14\
\x9c\x3d\x7b\xc6\x0b\x64\xd0\x28\x8a\x1b\x25\x27\x5c\xcf\x0f\x20\
\x99\xb1\xb9\x35\x80\xef\x07\x90\x2c\x31\x18\x79\x60\x19\xc7\x40\
\x2c\xa7\x81\x17\xbf\xf4\x4b\xf1\xe2\x97\xbe\x0c\x52\x4a\x0c\x06\
\x03\x6c\x6e\x6c\x60\x65\xe5\x2c\x8e\x3e\xf3\x14\xee\xbb\xf3\x8b\
\x58\xbb\x70\x0e\xab\x17\x4e\xa2\xd7\xdb\x82\x94\x32\x36\x58\xe4\
\x39\xfd\x32\x8f\x13\x11\x84\x10\x90\x52\x42\x08\x02\x91\x92\x0d\
\x05\x11\x1c\xd7\x85\x6d\x3b\xb0\x1d\x1b\x41\x10\xc0\x34\x0c\x90\
\x10\x10\x42\xc0\x71\x5d\xb4\xdb\x0a\x08\x1d\xd7\x85\x69\x9a\x68\
\xb5\x5a\xb0\x2c\x1b\xcb\xbb\x77\x69\x20\x74\xb1\xb4\xb4\x0c\xdb\
\xb6\xd1\x68\x36\xd5\xdf\x14\x10\x9a\x10\x24\xe0\x07\x3e\xa4\x64\
\x34\x5c\x17\xb6\x6d\xc5\x40\x28\x0c\x10\x11\x0c\x43\xc0\x34\x4c\
\x85\xe1\x1a\x18\xc3\x16\xeb\x31\xae\x53\xe1\x3a\xbd\x38\xec\xc0\
\x69\x26\xb6\xdd\x50\x08\xcd\x3e\x75\x57\x66\x42\x3b\x2d\xe9\xcd\
\x32\xfd\xef\x80\xa4\xb7\xbd\x83\x76\x19\x80\x13\xca\x24\x20\x11\
\x46\xfe\x08\x1b\x1b\xeb\x41\xce\x9c\x52\x86\x41\x4d\x5a\x6a\xd5\
\xc0\x74\x05\x81\x13\x4f\x01\xa7\x3c\x80\x0a\x00\x48\xd2\x1a\x12\
\x6b\x77\x02\x03\x7a\xc2\x27\x0c\x86\x1e\xfa\x43\x4f\xcf\x81\x8c\
\xfe\x60\x84\x40\xf7\x71\x09\x15\x34\xd3\x34\xf3\x83\xfe\x0c\x18\
\x86\x01\xdb\xb6\xb1\xb0\xb0\x80\xe7\x1c\x3c\x88\x97\x7e\xe9\xcb\
\xf0\x8e\x77\xbf\x0f\xc3\xd1\x10\x9b\x1b\x1b\x38\x75\xf2\x24\x2e\
\x9c\x3f\x87\x07\xef\xbd\x0b\xeb\xab\xab\x38\x79\xec\x08\x36\x37\
\xd6\x75\x6c\x4a\xc6\xbc\x21\x01\x56\xaa\xc1\x5a\x00\x00\x08\x82\
\xf0\x6b\xa9\x31\x1a\x0d\x31\xd1\x97\xc1\xd3\x2d\x04\x49\x60\x0c\
\x2d\xf1\xc2\x30\xc0\x52\xaa\x7f\x0b\x11\x3d\xae\xa4\x4a\x17\xb6\
\x63\x43\x06\x01\x0c\xd3\x84\x10\x02\x86\x61\x60\x71\x71\x09\xa6\
\x65\x45\x40\x68\x59\x16\x96\x96\x96\xd1\xee\x74\x60\xe9\xc7\xdd\
\x46\x03\x4b\xcb\xcb\xb0\x2d\x1b\x8d\x66\x43\x01\xa1\xdb\xc0\xf2\
\xae\x65\x05\x84\x7a\x7b\xbe\x1f\x80\x59\x31\x42\xcb\x8a\x81\xd0\
\xd0\x8c\x50\x08\x43\x81\x70\x06\xc0\xf3\x65\xd1\xf1\xf9\x80\x27\
\xb8\xdb\x78\xf6\x92\x08\xdb\x3a\xa1\x77\x32\xde\x54\x0d\x9c\x2e\
\xb6\xa4\x37\x6b\x5c\x6c\x4e\xe0\x54\xa6\xdd\x09\x01\xc3\xc1\x10\
\x28\x36\x55\x95\x95\xf7\x6a\x29\xef\x0a\x03\xa6\x32\xa6\x87\x22\
\xf3\x43\x72\x95\x13\x90\xa0\x20\x9c\xae\x85\x21\xc0\xcc\xb8\xfb\
\xfe\x87\x20\x19\x68\x77\x16\xd0\x6a\xb6\x60\xdb\x16\x98\x01\x61\
\x9a\x10\xa9\xb2\xf8\x9c\xe8\x0b\x43\x53\x27\x30\x86\xea\x20\xda\
\x6c\x34\xd0\x6c\x36\x71\xcd\x35\xd7\x00\x44\x78\xe3\x9b\xde\x02\
\x66\xc6\xca\xca\x0a\xce\x9c\x3e\x8d\x73\x2b\x67\x70\xf7\x17\x3f\
\x87\xee\xc6\x06\x4e\x1e\x3f\x82\xee\xc6\x06\xa4\x0c\x12\x80\x48\
\x05\x5d\x4a\x69\xb2\x14\x41\x15\x4b\xd1\x6a\x99\x2c\xf0\x7d\x10\
\x11\x24\x4b\x40\x83\x22\x11\x61\x34\x1c\x02\x58\xdf\xf6\x8f\x99\
\x04\x93\x34\x23\x8c\x41\x90\x84\x50\x40\xa8\xe3\x76\x81\x9f\x01\
\xc2\xa5\xa5\x08\xf0\x22\x20\x5c\x4e\x02\xa1\x83\x86\xeb\x62\x69\
\x79\x19\x96\x6d\xc3\xb6\x6d\x34\x1b\x0d\xb8\xae\x8b\xe5\xe5\xe5\
\x58\x1a\x15\x02\xbe\xef\x47\xd2\xa8\x6d\x59\x30\x0c\x03\x22\x04\
\x3e\x20\xfa\xcc\x68\xdf\x92\xe7\xc0\x1c\x80\x90\xb0\x0d\x62\xb8\
\xbd\xb6\x4e\xdb\x62\x32\x17\x13\x9c\x26\xf4\x09\xbe\x28\xe0\xa4\
\x5b\xd3\x4f\x75\xfd\xa2\x42\x22\x46\x0d\x4c\x57\x3e\x6b\x92\x98\
\xec\xc6\x0b\xcd\x0f\x32\x08\x82\x00\x0c\x9c\x5d\x39\x8f\x23\xc7\
\x8e\xe1\xa9\xa7\x9f\xc6\x13\x4f\x3e\x8d\x40\x4a\xd8\xb6\x8d\xdd\
\x7b\xf6\xc2\xd1\xb1\x9d\xeb\xaf\xbf\x01\x8b\x0b\x1d\x2c\x74\x16\
\x60\x59\x56\x34\x21\xa9\x56\xd1\x72\x6c\xc2\x29\x5e\xad\x73\x5a\
\xd8\x06\x41\x08\xc2\x81\x03\xfb\x71\xcd\x35\x07\x00\x10\xde\xf8\
\xe6\xb7\x00\xcc\x58\x59\x39\x87\xf3\xe7\xce\xe1\xc4\xf1\x63\x78\
\xfc\x91\x87\xf0\xcc\x93\x8f\x61\x7d\xf5\x02\x7a\xdd\x4d\xf4\xfb\
\xfd\xc8\x88\x41\x19\x03\xc5\xf6\xd1\x22\x01\xb6\x63\x13\xef\x38\
\xbb\xca\x68\x8f\xb3\x17\x5e\x4a\x31\xc2\x20\xf5\xdc\x68\x38\x04\
\xaf\xad\x55\x38\x29\xd2\xd2\x5f\xba\x71\x9c\xfa\x97\x92\x1e\x0d\
\xc8\x0c\x23\x14\x44\x70\x1b\x8a\xc5\x99\x96\x05\xd3\x54\xa0\x05\
\x28\x26\xbc\xb4\xbc\x04\xcb\xb2\x61\xd9\x36\x5c\xd7\x45\xa3\xd1\
\xc0\xf2\xae\x5d\x70\xdd\x46\xc4\x14\x1b\x8d\x06\x96\x96\x96\x74\
\x1c\xd1\x46\xa3\xd1\x44\xa3\x11\x03\xa1\x6d\xdb\x30\x0c\x23\x02\
\x42\xdb\xb6\x61\x99\x26\x0c\xc3\x88\x80\x0f\x08\x8d\x32\x46\xe2\
\xf7\x48\x03\x62\xd1\x11\x67\xc4\x29\x0e\x2a\x9e\x98\x76\x40\x46\
\xc7\x27\x3f\xb4\x88\x39\x9e\x4d\x3b\xc6\x9c\x76\x4c\xd6\x2b\xd7\
\x28\x52\x4e\x98\x6b\x18\xe5\xe3\x4f\x57\x35\x40\x51\x99\xfc\x9b\
\xcb\xfe\x4b\xc4\xb3\x6f\x58\x66\xde\x04\x60\x01\x70\xf4\xcd\x05\
\xd0\x04\xd0\x02\xd0\x06\xd0\x01\xb0\x00\x60\x49\xdf\x76\x01\xd8\
\x0d\x60\x0f\x80\xbd\x00\xf6\xdd\xfe\x25\x2f\xb9\x66\x69\xdf\x01\
\x71\x6e\xe5\x2c\x82\x20\xc0\x81\xeb\x0e\xa2\xdd\xe9\x24\x9a\x86\
\x71\x3c\x41\x58\x16\xf6\xec\xd9\xab\x8c\x08\x6e\x03\xd7\x5f\x7f\
\x3d\xf6\xed\xdd\x8b\x85\x4e\x7b\x6c\x82\x95\x92\x73\x26\xfb\x6a\
\xe8\x90\x5e\x95\x13\xa4\x0c\x30\x1c\x0e\x71\xf6\xec\x0a\x9e\x7a\
\xe2\x71\x9c\x38\x76\x04\x8f\x3e\x78\x3f\x56\x4e\x9f\xc4\xd6\x56\
\x17\xc3\xc1\x20\x9a\xd0\xb3\xb2\xd6\x2c\x2c\xa6\x2a\x98\x61\xa7\
\x1a\x84\x4c\x00\x5d\xda\xe6\xfc\x18\x45\xbd\x99\x27\xbf\xa6\x2c\
\x08\x22\x1f\x0c\x93\xd2\xa8\x94\x32\x76\x64\xea\xe7\x6c\xc7\x51\
\xe0\x64\x29\xd6\x17\x01\xa1\x69\x60\x69\x49\x31\x3d\xc7\x71\xe0\
\x38\x0e\x16\x16\x16\xd1\x59\x58\x80\xeb\xba\x30\x2d\x13\xb6\x65\
\x63\x69\x79\x19\x9d\x4e\x47\xc5\x14\x1d\x07\x9d\x4e\x07\xae\xeb\
\xa2\xd3\xe9\x68\xe0\xb3\x60\x08\x43\xc7\x08\x25\x6c\xcb\x86\x69\
\x99\x30\x44\x1a\x08\x0d\x43\x33\xc2\x64\x4c\x30\x11\x2b\x9c\xba\
\xdc\xe2\x7c\xb4\xe3\x89\xd3\x6f\xc5\xe4\xf5\xa9\x2d\xc4\x68\xc2\
\x82\x6b\xea\x89\x36\xf1\xf5\x86\x61\xe0\x91\x47\x1f\xc3\x57\xbf\
\xee\x35\xab\x00\xce\xea\xdb\x0a\x80\xf3\x00\x2e\x00\x58\x05\xb0\
\xa6\xe5\x84\x0d\x00\x5d\x00\x5b\xfa\xd6\x07\x30\x00\x30\xd2\x37\
\x5f\xdf\x24\x5f\x09\x13\x74\xcd\x98\x72\x57\x1c\x65\x1d\x79\x41\
\xf2\xf6\xe8\x43\xf7\xfb\x37\x82\xec\x50\x46\x12\x86\x18\x9b\x4c\
\xc2\xe1\x7b\x1e\x4e\x9d\x3c\x11\x81\xd5\x23\x0f\x3f\x88\x76\x67\
\x01\x7b\xf6\xec\x05\xc0\x11\xb3\xda\xb7\x77\x0f\x3a\xed\x76\xea\
\x62\xce\x82\x55\xb9\xb9\x3f\x96\x0e\xc3\xfd\x71\x5d\x17\x87\x0f\
\x1f\xc2\xf5\xd7\x1f\x56\x12\x9b\x36\x59\x9c\x3d\xbb\x82\x8d\xf5\
\x35\x3c\x70\xdf\x3d\x78\xe0\x9e\x3b\xb1\x72\xfa\x14\x7c\xcf\xc3\
\xe6\xc6\x7a\x8a\x7d\x50\xa1\x14\xb8\x8d\x99\x7e\xa7\x40\x29\x07\
\x90\xe6\xde\xe0\x9e\x68\xe2\x0f\x42\xe5\x7f\xac\xa9\x53\x2d\xb3\
\x92\x46\xa1\x4f\xbe\xe4\xf0\x3c\x0f\xdd\x6d\x80\x63\x56\xae\x25\
\x0d\x7c\x86\x96\x46\x49\x88\x08\x04\x41\x04\x27\x03\x84\x86\x11\
\x32\x42\x53\x49\x9e\x96\x05\xc7\x75\x15\xb8\x2d\x2c\xa0\xd1\x68\
\xc2\x71\x6c\x2c\xef\xda\x8d\x46\xa3\x81\x4e\xa7\x83\x66\xab\x09\
\x96\x1c\x81\xa0\x8a\xa9\x76\x10\x04\x8a\x01\x1a\x42\x44\xae\x51\
\xdb\xb6\x74\xdc\x30\x8e\x09\x86\x0b\x3e\xc3\x34\x22\x2e\xa7\xfa\
\x76\x52\x64\x92\x29\x3a\xf4\x3c\xa5\xb1\x55\xf2\xba\x29\xcf\x84\
\xca\x31\xa7\x53\xa7\x4e\xa1\x84\x32\x33\xcd\xa5\x57\x4b\x79\xb8\
\xf2\x62\x4c\x54\x00\x48\xd3\x62\x4d\x41\x01\x50\x69\xe0\x90\xf0\
\x86\x23\xa0\xd9\x2a\x9c\xb1\x95\xe4\x13\x3f\xb2\xd5\xdd\xc4\xe6\
\xc6\x86\x5e\x74\x33\x1e\x7e\xe8\x41\x74\x3a\x0b\xd8\xb3\x77\x2f\
\x98\x19\x07\x0f\x1e\xc2\xc2\xc2\x02\xf6\xee\xde\x8d\x8e\x66\x56\
\xe1\x64\xc7\x52\x46\x56\x75\xaa\x40\xa9\xb2\x15\x28\x42\xb0\x22\
\x3a\x8c\x17\xbd\xf8\xc5\x90\xdf\xf8\xcd\x18\x0c\x06\xe8\x76\xbb\
\x38\x7d\xea\x14\xee\xbf\xe7\x6e\x3c\xfe\xc8\x43\x38\x7b\xfa\x04\
\xba\x1b\xeb\xe8\x6d\x6d\xc1\xf7\xfd\x88\x2d\xa4\x8c\x03\x55\x0d\
\xd4\x3b\x01\x4a\x3b\x0c\x48\x17\x85\xdd\xe7\xcd\x3c\x93\x00\x8e\
\xb9\x70\xc1\x30\x2b\x38\x22\x21\x8d\xb2\x52\xad\x63\x20\x1c\x8d\
\x8a\x81\x94\x8b\x2b\x4e\x50\x21\xc3\x56\x20\x22\x84\x01\xc9\xe3\
\x8c\xd0\x71\x5c\x58\xb6\x15\xc9\x9f\x42\x18\x11\x03\x59\xde\xb5\
\x4b\xb1\x41\xd7\x85\xeb\xb8\x68\x34\x9b\x68\xb5\x5b\x70\x5d\x17\
\xbb\x76\xed\x86\xdb\x68\x60\x61\x61\x01\xad\x56\x0b\x42\x08\xb4\
\x5b\x2d\x34\x5b\x4d\x65\x9c\x69\x34\x40\x42\xc0\x34\x0c\x08\x41\
\xf0\xfd\x40\x2d\xe0\x1c\x07\xcd\x66\x33\x77\xf6\x60\x9a\x74\x4e\
\xe5\x80\x53\x72\xfd\x02\xe0\xc9\x27\x9e\xc0\x84\xf9\xa4\xc8\x7c\
\x05\xd4\x56\xf1\x2b\x9e\x31\x65\x57\x1d\x95\xad\xe2\xe1\x4d\x4a\
\x19\x3c\xf5\xd0\x7d\xb8\xfe\xb9\x2f\x80\x94\x12\x52\x06\x95\x65\
\x2f\xc3\x48\x9f\xe2\xdd\xee\x26\x36\x37\x55\x91\xc7\x67\x9e\x7e\
\x0a\x00\xa1\xd3\xe9\x60\xcf\xde\x7d\x60\x96\x38\x78\xe8\x10\x16\
\x17\x16\xb1\x67\xf7\x2e\x2c\x74\x3a\xa9\x79\x4b\xc5\xac\xb8\xb2\
\xaa\x35\x0e\x56\x0e\x5c\xd7\xc5\xbe\xbd\x7b\xf1\xa2\x17\xbd\x08\
\x00\x30\x1c\x0e\xb1\xd5\xeb\xe1\xd4\xc9\x93\x78\xec\x91\x87\x71\
\xdf\x5d\x5f\xc4\xfa\xda\x2a\x56\x4e\x9f\x44\xbf\xd7\x8b\xe2\x1d\
\xc9\x15\xf7\x74\x76\x35\x47\x50\xba\x02\x00\xa9\x14\x40\x15\xb0\
\x1d\x94\x65\x46\xdb\xdc\x97\x3c\x90\xa4\xb2\x00\x3a\x81\x19\xaa\
\x18\x61\x3e\x23\x1c\x79\x5e\xb1\x5c\x5a\xf1\x3b\x87\xea\x46\x18\
\x17\x8c\x40\x3d\x7c\x5c\x08\xbc\xfb\x7d\xef\xc7\x4f\xfc\xf8\x8f\
\x47\x0e\xd7\xbc\xe0\x54\x95\x0a\x11\x91\xe2\x0b\xe0\xce\x3b\xbe\
\x88\x29\x80\x54\xc6\xa9\x37\x8d\x60\xd7\xc0\x74\x95\x81\x53\x90\
\x04\x27\x96\x32\x80\x3e\xb9\xc1\x0c\xcf\xf3\xb6\x3f\x01\xe4\x4c\
\xe8\x49\xb0\x3a\xf2\xcc\xd3\x00\x80\x76\xa7\x83\xbd\x7b\xf7\x45\
\xcc\x6a\x71\x71\x01\x7b\x76\xef\x4e\xc4\xac\xd4\xa4\x2f\x13\x16\
\xf2\xd2\xd3\xb5\x16\xf5\xa3\xe4\x61\x82\xb6\x6d\x2f\x61\x79\x79\
\x19\xcf\x7f\xc1\x0b\xf0\xee\xf7\xbe\x0f\x9e\xef\x63\x63\x63\x03\
\xe7\x56\x56\x70\xec\xe8\x11\x7c\xfe\xef\x3f\x83\x73\x67\x94\x3b\
\xb0\xd7\xed\xaa\xc4\x60\x29\xc7\x98\xd5\x4e\x83\xd2\x95\x56\xb2\
\xb9\x32\x40\x4d\x60\x2f\x97\xed\xf7\x22\x2a\x3c\x0f\x27\xb1\xbe\
\x59\x62\x9a\x91\x54\x27\xfd\x94\x8c\x19\x10\x41\x4a\xc6\xbe\xfd\
\x07\x32\xa1\xc3\x1c\xe7\x04\x26\x49\x7b\xe3\x1c\x91\xf5\xe7\xde\
\x7f\xdf\x7d\xd3\x16\xbe\x93\x40\x09\xa8\x2d\xe3\x57\x3c\x30\xcd\
\x05\x9c\xa2\x42\xab\x73\x02\xa6\xd2\x60\xb5\xd9\xc5\xe6\x46\x92\
\x59\x29\x9b\xfa\x5e\x2d\x03\x1e\x0a\x99\xd5\x9e\xdd\x58\x68\xb7\
\x93\x45\x17\x00\xb0\x4e\xee\xcd\xae\x76\x8b\xf9\x86\x4a\xf6\xd4\
\x71\x2b\xfd\x98\x10\x84\xe5\xa5\x25\xec\xda\xb5\x8c\xdb\x6e\xbb\
\x0d\x6f\x7c\xd3\x9b\x20\xa5\xc4\xe6\x66\x17\xa7\x4f\x9f\xc6\xf1\
\xa3\x47\x70\xff\x3d\x77\xe1\xd8\xd3\x4f\x61\xe5\xec\x29\x6c\x75\
\xbb\x08\x7c\x1f\x2c\x39\xf5\xbd\x66\x32\x4c\xe4\x80\xd2\x95\xde\
\x43\xa0\x34\x40\xe5\x01\xd5\x65\x0c\x52\x85\xd6\xf6\xed\x24\x43\
\x4f\xb9\x9e\xb2\xe7\x78\xc4\x9a\x0c\x81\x3d\x7b\xf7\x96\x02\x9b\
\xaa\x71\x27\x66\x46\x77\x63\xa3\x48\xc6\x2b\xeb\xce\xab\xd9\xd2\
\x15\x0a\x4c\x55\xf2\x98\xa6\x82\x53\xa2\xa6\x38\x46\x83\x41\x69\
\x69\x61\xe6\xfa\x66\x89\x39\x87\xc8\x48\x5d\x2b\x2a\x66\xb5\x0e\
\x80\x22\xb0\xea\x2c\x28\x83\x45\xb3\xd9\xc2\x8d\x37\xde\x80\xc5\
\x05\x65\x59\x5f\x0c\x65\x40\x8a\x93\x84\x65\x4e\x83\xc3\xc9\x9a\
\x8e\xae\xe0\x2d\xd3\xc5\x80\x16\x3a\x1d\x2c\x2e\x2c\xe0\xb9\x21\
\x58\x05\x12\x9b\x5d\x05\x56\xc7\x8e\x3c\x83\x27\x1f\x7b\x14\x47\
\x9f\x79\x0a\xa7\x8e\x1f\x45\x77\x73\x43\xd9\xb9\x35\xe8\x09\x11\
\xc6\x1c\xca\xb4\x05\xb9\x3a\x00\x69\x2e\xf3\xf5\x45\x90\xfb\x2e\
\xa3\x6f\x3b\xf3\x10\x42\x60\xf7\xee\xdd\x13\xae\xd1\xfc\x38\x12\
\xa6\xb0\x27\x82\x80\xe7\x79\x58\x5d\xbd\xe0\x4f\x01\xa5\x3a\xc1\
\xb6\x66\x4c\x53\x01\xaa\x4c\xcc\x29\x92\xf2\x2e\xb9\x6b\x53\x5b\
\x8a\x29\xc5\xac\x36\x23\x66\xf5\xd0\x83\xf7\x6b\x27\x95\x83\x3d\
\x7b\xf6\xa2\xd5\x6a\xe1\xc6\x1b\x6e\xc4\xe2\x42\x07\x96\x6d\x63\
\xa1\xd3\x8e\xc0\x25\xfc\x2e\x32\x25\x03\x02\x65\x44\xb8\x54\xcc\
\x4a\x5f\xb0\x9d\x4e\x1b\x8b\x0b\xb7\xe0\xb9\xb7\xdd\x8a\xaf\x7e\
\xd3\x9b\x23\x47\xe0\x89\x13\x27\xb0\xb2\x72\x16\x47\x9e\x7e\x0a\
\xf7\xdf\x75\x07\x4e\x9d\x38\x86\x41\xbf\x87\xe1\x60\xa0\x4c\x16\
\x61\x4d\xbd\x1c\x29\xf0\x6a\x04\xa5\x99\xd9\xd3\xb3\x54\xee\xbb\
\xd8\x47\x54\x08\x81\x46\xc3\x8d\xda\xbf\xe4\x9b\x1d\x66\x63\x4f\
\x52\x32\xa4\x0a\xc4\x56\x01\x25\xd4\x6c\xe9\xea\x02\xa6\x69\x2d\
\x2f\xa6\x81\x53\x82\x35\xc1\x60\x46\xf9\xde\x3f\x3b\xf1\x4d\xa8\
\x9c\x0c\xe8\xfb\x1e\xbc\xcd\x51\x04\x56\x0f\x3e\xf8\x80\xb2\xf7\
\x3a\x2e\xf6\xee\x55\xcc\xea\xa6\x1b\x6f\xc0\xc2\xc2\x02\x6c\xcb\
\xc2\x42\xa7\x93\x58\x6c\x73\xbe\x95\x36\x33\x5b\x16\xd5\x04\x95\
\xe9\x6e\x84\x70\x5d\x17\x37\xdf\x7c\x33\x6e\xb9\xe5\x16\xbc\xf2\
\x95\xaf\x84\xfc\xe0\x37\xa2\xdf\xef\x63\x6d\x6d\x0d\x6b\xab\xab\
\xb8\xf7\xee\x3b\xf1\xf8\x23\x0f\xe1\xf4\xc9\x13\xd8\x5c\x5f\xc3\
\xd6\x56\x17\x81\xef\x81\x65\x22\x09\x79\xbb\x52\xe0\xd5\xc8\x9e\
\x26\x02\xd5\x55\x38\xe7\x51\x5c\x72\xdf\x71\x1c\x1c\xd8\xbf\x1f\
\xd9\xaa\xfa\xdb\x65\x4f\x44\x84\xad\xde\x16\x50\xa2\x40\x34\xca\
\x95\x27\xaa\x19\xd3\x15\x0c\x48\xd3\xa4\xbc\x69\x8c\x49\x81\x13\
\xb3\x31\xb9\x73\xd8\xc4\x06\x31\x97\xe0\x3a\xa4\xc8\xa6\x0b\xa8\
\x1c\x2b\x4f\xe7\x2d\x81\x28\x9f\x59\xdd\x78\x23\x16\x3b\x0b\x58\
\x58\xe8\xc0\xb6\xac\xd4\x8a\x3b\x0b\x38\x15\xbc\xeb\x4a\x0a\x4c\
\xbc\xb5\xd1\x70\xd1\x68\x5c\x83\x6b\xaf\xbd\x16\xcf\x7f\xc1\x0b\
\x00\x30\x46\xa3\x11\xb6\xb6\x7a\x38\x7d\xea\x14\x1e\x7b\xf4\x11\
\xdc\x73\xc7\xe7\x71\xe6\xe4\x09\x6c\x6c\xac\xa1\xd7\xed\xc2\xf7\
\xfd\xb8\x92\x85\x2e\x50\x7b\x35\x41\xd5\xcc\xec\xa9\x70\x63\x74\
\xd1\x41\x6a\x72\x9c\x69\x8e\x72\xde\x84\x45\x0c\x91\x80\xd0\xd5\
\x33\xf2\x3a\xfe\x56\x62\x4f\x79\x1f\xa5\x5e\x1a\x94\x04\x22\x89\
\xe9\xb9\x4c\x35\x30\x5d\xe1\xac\x69\x9a\x9c\x37\x0d\xa0\xa6\x9d\
\xf3\x3b\x38\x1d\xcd\x83\x6a\xe9\x76\x16\x86\x11\x3d\xe3\x79\x1e\
\x3c\x6f\x84\x8d\x8d\x0d\x10\x80\x07\x1f\xb8\x1f\x96\x6d\x63\xef\
\xde\x7d\x70\x1c\x47\x33\xab\x1b\x75\xa9\xa5\x0e\x6c\xdb\x4a\xa9\
\x43\xc5\xa5\x96\x26\x7f\x9f\xc8\x9c\x91\x88\x77\x99\xa6\x89\xa5\
\xa5\x45\x2c\x2f\x2f\xe1\xf6\xe7\xdf\x8e\x77\xbe\xfb\xdd\x18\x0e\
\x47\xe8\xf5\xb6\x70\xea\xd4\x29\x1c\x79\xfa\x69\xdc\x73\xc7\x17\
\x70\xf6\xcc\x29\x9c\x3b\x73\x1a\xdd\xee\x26\x02\x6d\x5f\x57\xb1\
\x38\x71\x55\xb0\xaa\xb9\x47\x63\x42\x90\xba\x2a\x58\x94\x2a\xbd\
\xb4\xb4\xbc\x0b\xcb\x4b\x8b\x89\x56\xce\x65\xdd\x78\x39\x4e\x3c\
\x8e\xd9\x13\x81\xb0\xa6\x54\x8a\xac\xf9\xa1\x4c\x82\xed\xa4\x45\
\x75\x0d\x4c\x57\x20\x28\xa1\x04\x73\x9a\x26\xe9\x71\xea\x4a\x9e\
\x50\xa2\xe6\x59\xa7\x6e\x80\x60\x24\x26\x74\xcf\xf3\x70\xe2\xf8\
\xf1\xe8\x2b\x3f\xf8\xe0\xfd\xb0\x2d\x0b\x7b\xf7\xed\xd7\x60\xd5\
\xc4\x4d\x37\xde\x88\x85\x85\x05\x2c\x76\xd2\xcc\x8a\x23\x27\x60\
\x71\xba\xe5\x04\x53\xe0\x58\xae\x95\x65\x99\x58\x5c\x5c\xc4\xf2\
\xd2\x32\x6e\xbf\xfd\x76\xbc\xf5\x6d\x6f\x03\x4b\x8e\x4c\x16\xc7\
\x8f\x1d\xc5\xe7\xff\xee\x33\x58\x39\x7b\x1a\x2b\x67\x4e\xa1\xbb\
\x99\x04\x2b\xda\x56\xd9\xa5\x67\x03\x7b\x9a\xeb\xac\x75\x05\x01\
\x14\x4d\xf8\x7a\x04\x52\xd5\xee\x85\x91\x53\x1d\xa2\xac\xe1\x61\
\xbc\x37\x4a\xf8\xda\xf3\xe7\xce\x61\x1b\x6c\x69\x5a\xcc\xa9\x06\
\xa6\x2b\x98\x35\x95\x29\xea\x9a\x7e\x3c\x91\x24\x24\x65\x00\xe9\
\xfb\x10\x86\x79\x71\xcf\x9b\x6d\x76\xf8\x9c\xc4\xa5\xb2\x1f\x43\
\x22\x2c\x37\x18\x83\xd5\xf1\xe3\xc7\xa2\x2c\xc2\x2c\xb3\x4a\x1a\
\x2c\xc6\x65\x40\x6d\xae\x28\xbd\xc3\xe9\xd5\xa8\xca\xd3\x92\xa9\
\xa7\x3a\x9d\x36\x16\x16\x6e\xc1\x6d\xb7\xdd\x8a\x37\xbc\xf1\x8d\
\x90\x52\xaa\x2a\x16\xa7\xcf\xe0\xd8\xd1\x23\x78\xf4\xa1\x07\xf1\
\xe4\x63\x8f\xe0\xfc\xca\x19\x74\x37\x37\x30\x1c\x0c\xe2\x56\x21\
\xba\x47\xd5\x95\x02\x55\x73\x95\xf8\x76\x42\x56\xdb\x69\xc6\x57\
\xf1\xe2\x61\x30\x9a\xed\xb6\x6a\x49\x53\x82\x11\x4d\xae\x04\x31\
\x7e\x52\x1f\x3d\x7a\x14\xd8\x7e\x6c\xa9\x96\xf1\xae\x12\x29\xaf\
\x2c\x50\xc9\x69\x52\x9e\x0c\x02\x04\x41\x00\x31\xd6\x6b\xe9\x0a\
\xd6\x8e\xa0\x2a\x6a\x27\x87\x62\x56\xc7\xa2\x4b\xf3\x81\xfb\xef\
\x87\x65\x5b\xd8\x97\x61\x56\x8b\x0b\x0b\x4a\x06\x0c\xc1\x8a\x54\
\x77\x5f\x99\x93\x71\x4f\x93\x96\xbc\x13\x98\x15\x81\xd0\x6e\xb7\
\x71\xeb\x2d\x1d\xdc\x76\xeb\x2d\x78\xe3\x1b\xbf\x1a\x52\x06\x18\
\x0c\x87\x58\x59\x59\xc1\xd3\x4f\x3d\x85\x63\x47\x9e\xc1\xc3\xf7\
\xdf\x8b\x93\xc7\x8f\xa2\xbb\xb1\x81\x91\x37\x8a\xea\xd2\x8d\x31\
\x2b\xca\x9f\xa3\x2e\xe7\xdf\x7b\xae\xbb\x79\x29\xd8\xd3\x4e\x22\
\x56\x94\xec\x4d\x60\x06\xae\xbd\xf6\x3a\x18\x86\x48\x19\x99\x26\
\x56\x21\xaf\x20\xef\x7d\xfe\x73\x9f\x05\x8a\x63\x4c\x65\xdd\x79\
\x78\x76\x9c\x75\x35\x30\x6d\x17\x90\xb8\xe2\x6d\x8c\x35\xb1\x9e\
\xb8\x82\x20\xc0\x68\x34\x82\xed\x38\xe0\x52\x1c\xe4\x0a\xc5\x2a\
\x40\x95\x7b\x49\x0c\x7f\x02\xb3\x0a\xdb\x3f\xdc\x78\xc3\x0d\x63\
\x15\xd7\xe3\xea\x15\x5c\xe1\xf3\xc7\x8f\xb3\xd4\x96\xfe\x70\xb8\
\xae\x8b\x43\x87\x0e\xe1\xf0\xe1\xc3\xd1\x67\xf4\xfb\x7d\xac\xac\
\xac\x60\x73\x73\x13\xf7\xdf\x7b\x0f\xee\xbf\xeb\x0e\x9c\x38\x76\
\x04\x81\xef\x63\x73\x73\x03\xbe\xe7\x21\x65\x5f\x4f\xb4\x93\xc8\
\xed\x88\xc7\x97\xef\xef\xb3\xed\x99\x6d\x87\xd9\xd3\x45\x45\xa7\
\xd8\x07\x04\xc7\x75\x41\x44\x51\x6e\x5e\x84\xc1\xc8\xd6\x71\xc8\
\x97\xf7\xa8\xc0\x92\xca\x0c\x3c\x78\xff\xfd\x45\xb5\x37\x67\x69\
\x16\x58\x33\xa6\xab\x84\x2d\x6d\x07\x9c\xa2\xd5\x7a\x3d\x8a\xaf\
\x7e\x95\x3c\x9b\xcf\xac\x00\xe0\x81\x07\xee\xc7\xc2\xc2\x02\xf6\
\xed\xdb\x0f\x66\x46\xa3\xd1\xc4\x4d\x37\xaa\x8a\xeb\x0b\xed\x76\
\x0c\x02\x48\x33\x2b\x9a\xde\xcb\x20\x97\x59\xa5\x3a\xf3\x12\xa1\
\xe1\xba\x38\x7c\xe8\x10\x40\x84\x17\xbe\xf0\x85\xe0\x0f\x7e\x08\
\xfd\xc1\x00\xc3\xe1\x10\xa7\x4e\x9d\xc2\x3d\x77\xde\x89\xc7\x1e\
\x7e\x10\xa7\x4f\x1e\xc3\xc6\xda\x1a\xba\xdd\x4d\x05\x56\x39\x05\
\x6d\x63\xb0\xe2\x2b\x97\x4d\xed\x00\x38\x5d\x1a\x39\x2f\xfe\x74\
\x37\xcc\x61\xca\xc1\xa0\xfc\x1e\x4e\x19\xc8\x4a\x18\x1e\xd2\xe7\
\x9b\xc4\xb9\x95\xb3\xdb\xa9\xf6\x50\x1b\x1f\xae\x42\x29\xaf\x6c\
\x37\xdb\xfc\x78\xd3\xa4\xdc\x9e\x67\xc5\x21\xa0\x8a\x84\x6e\x96\
\xf7\x14\x2c\x54\x53\xcc\x8a\xb0\xb9\xb9\x89\x8d\xf5\xb8\xbb\xed\
\x83\x0f\xdc\x87\xce\xc2\x22\xf6\xed\x53\x75\x01\x0f\x1f\x3a\x8c\
\xc5\xc5\x9c\x8a\xeb\x1a\x6c\x64\xc1\x0f\x51\x58\x7b\x3b\xa3\xca\
\x70\x82\x59\x91\x66\x56\x0d\xd7\xc5\xf2\xd2\x12\x9e\x7f\xfb\xed\
\x00\x80\xe1\x68\x84\x5e\xaf\x87\x53\xa7\x4e\xe3\xf1\x47\x1f\xc1\
\x5d\x5f\xf8\x2c\x56\xce\x9c\xc6\x85\x73\x2b\xba\xfa\xba\x07\x96\
\x01\x72\x13\x83\xaf\x34\x90\xba\xe8\xcc\x69\xbe\xdf\x98\x32\x5f\
\xe5\xa6\x9b\x6e\x56\x8c\x89\x65\xa1\x64\x57\x46\xde\x4b\x4a\x7b\
\x44\x04\xcf\xf7\x71\x6e\x65\x25\x98\x02\x4a\x93\xe2\x4d\x35\x18\
\x5d\x85\x52\x5e\x55\x06\x95\xe3\xca\x7b\xb6\x9e\x33\x54\x89\x69\
\xec\xf8\xde\x10\xa5\x6c\xeb\x00\xd0\xdd\xdc\xc0\xc6\x86\x02\xab\
\xa7\x9e\x7a\x12\x00\x52\xcc\xea\xf0\xa1\x43\x58\x5c\xd4\x15\xd7\
\x13\xcc\x2a\x92\x01\xa5\xcc\x05\xa2\x52\x00\xa6\x59\x55\x5c\xc9\
\x82\x60\x99\xca\x11\xb8\xb4\xb4\x84\xdb\x6f\x7f\x2e\xde\xf1\xae\
\x77\xc1\xf7\x7d\x6c\x6d\x6d\xe1\xec\x99\xb3\x38\x76\xec\x28\x3e\
\xfb\xb7\x9f\xc6\xca\xe9\x53\x38\x7b\xe6\x24\xba\x1b\x1b\xaa\xfa\
\x7a\x20\xe7\x53\x1f\xf0\x72\x13\xce\x9e\x35\xb8\x44\x13\x4e\x7d\
\xe5\xa8\x5d\x5a\x5a\xca\x99\x12\xca\xc4\x94\x8a\xdd\x78\x60\x40\
\x4a\x09\xdf\xf7\x8b\x5a\xe8\x94\x91\xf1\x6a\x29\xef\x2a\x62\x4c\
\x28\xc1\x98\xa6\x95\xa5\x97\x17\x85\xa4\xcc\x7e\xf9\x5d\xb2\x6d\
\xcc\x63\x6b\x61\x65\x69\x23\x59\x78\x93\x90\x60\x56\x84\xa7\x9e\
\x7c\x02\x00\xd2\xcc\xea\xf0\x61\x2c\x2d\x2c\xc4\x45\x6c\x13\x1b\
\x54\x32\x60\xd9\xba\x80\x05\x21\xed\x8c\x14\x28\x88\xa2\x1a\x81\
\xb7\xde\x7a\x0b\xde\xf0\x86\x37\x68\x47\xe0\x16\x4e\x9f\x39\x8d\
\xe3\x47\x8f\xe2\x1f\xfe\xf6\xd3\x58\x39\x73\x0a\x67\x4f\x27\xc0\
\x2a\x91\x6b\x75\xb9\x39\x02\xab\xb9\xfa\x9e\x05\xe8\x44\x13\x98\
\x93\x6e\x32\xb8\x6b\x79\x39\x87\x03\x55\x29\x41\x34\xce\x9e\x48\
\x10\xba\xdd\x2d\x20\x6e\x99\x53\xd5\x8d\x57\x57\x7d\xb8\x8a\x80\
\xa9\x88\x26\x4f\x8b\x2b\xa5\x00\x8a\x99\xe5\xd1\xc7\x1f\xc6\xc1\
\x9b\x9f\x0b\x66\xc6\x70\x38\x40\x3b\xd1\x27\x69\xe2\x49\x3b\xe7\
\x8b\x8d\xe6\xf4\x46\x2a\xfb\x5e\xba\x74\x33\xcb\x76\x98\x95\x92\
\x01\x5b\xa9\xba\x80\x8a\x15\x49\x6c\xa7\x0d\x3b\xeb\x4a\x16\xe0\
\x58\x28\x6a\x77\x5a\xb8\x75\xe1\x66\x05\x56\x6f\x7c\x03\xa4\xce\
\xb5\x3a\x73\xe6\x0c\x8e\x1e\x39\x82\xc7\x1f\x7d\x18\x47\x9e\x7a\
\x12\xc7\x8f\x3c\x8d\xee\xc6\x06\x06\xc3\x01\x58\x4a\x5d\xd0\x56\
\x44\xdf\xf5\xb2\x67\x4f\x3b\x2d\xe9\xcd\x61\xd3\x34\xed\x74\xd6\
\x3d\x99\x92\xc0\x83\x49\x00\x55\x98\xcf\x54\x68\xdb\x9c\x9e\x7e\
\x92\x2f\xe1\x15\xa9\x3d\x35\x30\x5d\x05\x8c\xa9\x4c\xc5\xf1\x31\
\xb0\x62\xe6\x40\x10\x49\xe8\xe4\x9e\x58\x36\xaa\x44\x9e\xae\x6a\
\xf9\xae\xd2\xce\x50\x19\x66\x15\xbf\x28\x19\xb3\x7a\x52\x33\xab\
\x85\x85\x45\xec\xdd\xab\x4a\x2d\xdd\xac\x13\x82\x55\x5d\xc0\x76\
\x6a\x12\xe4\x69\x6e\x40\xca\x7f\x80\x32\x3f\x70\xb6\x64\x53\xa7\
\xdd\xc6\x42\xa7\x83\x5b\x6f\xb9\x05\x6f\xfc\xea\x37\x82\x25\xab\
\x16\xf7\x2b\x2b\x38\x75\xf2\x24\x9e\x7a\xf2\x09\xdc\x7b\xe7\x17\
\x70\xe2\xe8\x11\xf4\x7b\x5b\x18\xf4\xfb\x2a\x6e\xc5\xb8\x64\x52\
\xe0\xe5\xe1\xbf\xdb\x89\xbd\xa0\x08\x60\x1a\x6e\x03\x07\x0f\x3e\
\x27\xfe\xcd\x0b\x95\x8d\x72\x6d\xd4\x63\x07\x27\xb0\xbe\xbe\x01\
\xcc\x96\xbb\x54\x97\x25\xba\x8a\x81\x29\x0b\x50\xd3\x98\x53\xde\
\xca\x47\x00\xd0\x96\xe2\x8b\xaf\xe3\x51\xd5\x57\xd2\x7c\xdf\x7f\
\x69\xa5\xc2\x62\x26\x48\x18\x67\x56\x9b\x9b\x1b\x0a\xac\x08\xb8\
\xff\xfe\xfb\x60\xdb\x36\x1c\xc7\xc5\xbe\x7d\xfb\xd0\x6a\xc5\xa5\
\x96\x6c\xcb\x42\x67\x62\xc5\xf5\xd9\x2a\x9c\xe7\x31\x2b\xc7\x71\
\x70\xe8\xe0\x41\x1c\x3e\x74\x08\xaf\x78\xc5\x2b\xf0\x81\x0f\x7e\
\x08\x83\xc1\x00\x6b\x6b\xeb\x58\x5d\x5b\xc5\x3d\x77\xde\x81\x47\
\x1e\x7a\x00\xa7\x8e\x1f\xc3\xc6\xda\x2a\xba\x9b\x9b\x1a\xac\xc2\
\x0e\xac\xd8\xf1\x1a\x81\x53\x61\xe1\xa2\x18\x21\xe6\xb1\xfd\x9c\
\xaa\x23\x82\x40\x82\x60\x9a\x66\xc9\x3a\x79\xf9\xec\x89\x72\xd2\
\x06\x08\x84\x33\x67\xcf\x4e\x02\xa6\x2a\xb9\x4c\x35\x28\x5d\x25\
\xc0\x34\xad\x1e\xd5\x34\x06\x95\x32\x40\x78\xa3\x51\x65\xba\x74\
\x71\x58\x53\x31\xa0\xd0\x36\x2e\xe8\x9d\x04\x9b\xb2\x8d\xd2\xab\
\xf6\xae\x55\x32\x60\xba\xd4\x92\x37\xf2\x22\x19\xf0\xfe\xfb\xee\
\x83\x65\x5b\x70\x1d\x17\x7b\x35\x58\xe5\x31\x2b\xa2\x84\x13\x90\
\x4b\x63\x65\xe1\xbe\x8e\xb7\xb8\x77\x71\xcd\x35\x2e\xae\xbd\xe6\
\x00\x5e\x70\xfb\xed\xaa\xe7\x57\xe8\x08\x3c\x7d\x1a\x8f\x3d\xf2\
\x30\xee\xf8\xfc\x67\x13\x60\xb5\x91\x2e\x68\xab\xdb\x87\x5f\x31\
\xd9\x73\xf3\xc2\xbc\x9c\x24\x69\x66\xe8\x3a\x79\x4b\xfa\xf8\x95\
\x4d\xa4\xcd\x36\x03\xcc\x91\xf6\x08\x38\x71\xec\x18\x30\x3d\xb9\
\xb6\x36\x3e\xd4\xc0\x34\xb6\xf2\x98\x45\xca\x4b\x82\x13\x00\xc2\
\x70\x58\xa6\x59\xe0\xc5\x16\xf0\xe6\x01\x4a\x17\x81\xee\xd0\xa5\
\xda\x96\x92\x5b\x0c\x32\xc6\xc0\x6a\x7d\x63\x1d\x14\x81\x95\x0d\
\xd7\x75\xb1\x77\xef\x3e\xb4\xdb\x99\x22\xb6\x96\x15\xfd\xae\x51\
\x7b\x10\xf0\x4c\xc0\x99\x04\x2a\x75\xb6\xc4\xc0\x67\x9a\x26\x16\
\x17\x17\x94\x23\xf0\x79\xcf\xc5\x3b\xdf\xf5\x2e\x55\x7d\xbd\xd7\
\xc7\xa9\x53\xa7\xf0\xcc\x53\x4f\xe1\xce\x2f\x7c\x16\x67\x4e\x9d\
\xc4\xd9\x53\x27\xb1\xb9\xb9\x11\xd5\x08\x9c\x07\x58\x5d\x72\x8b\
\xc3\xbc\x58\x19\x8d\x57\x13\x09\x82\x00\x86\x61\x24\x36\x5d\xd6\
\xf4\x90\xc3\x9e\x32\xaf\xb9\xeb\xae\x3b\x43\xc6\x14\x14\x80\xd1\
\x24\xb6\x54\xb3\xa4\xab\x5c\xca\x43\x05\x70\xca\x9e\x5c\x89\x25\
\x53\xc5\x4f\xa3\x4b\x13\x6b\xa2\x1d\x7c\xf5\xc5\xda\x61\x9a\x4c\
\x4b\xa6\xc1\xd1\xe4\xe7\xf2\xc0\xca\x1b\x61\x63\x7d\x0d\x00\xe1\
\xbe\xfb\xee\x85\x6d\xd9\xd8\xb7\x7f\x3f\x1c\xc7\x45\xab\xd5\xc4\
\xcd\x51\xa9\xa5\x76\xba\xd4\xd2\xb4\x5e\x56\xc0\x04\x37\x7b\x66\
\x1a\x64\x24\x4b\x34\xaa\xea\xeb\x0b\x0b\x58\x5e\x5c\xc4\xf3\x9f\
\xf7\x3c\xbc\xed\x6d\x6f\x83\x64\x89\xcd\xee\x16\xce\x9c\x3e\x8d\
\xa3\x47\x8f\xe2\x1f\x3e\xfd\x49\x9c\x39\x1d\x83\x95\xef\x79\xa9\
\x82\xb6\xcf\x2a\x66\x45\x09\x6d\x6d\x6e\xf3\x35\xa3\xd9\x6a\xc1\
\x34\x8d\x70\x29\x30\x59\xb6\x9b\x96\xcf\x94\x90\xf6\x98\x19\x47\
\x9f\x79\x66\x9a\x94\x57\x15\x94\xea\x18\xd3\x55\x02\x46\x55\x1c\
\x7a\x05\x52\xde\x0c\x88\xf4\x6c\x94\x53\x2e\xe7\x0f\x9d\x03\x28\
\x4d\x06\x0d\x1a\x6b\x0f\x72\xec\xd8\xd1\xe8\x0c\xb8\xef\xbe\x7b\
\x61\xdb\x36\xf6\xed\xdb\x0f\xd7\x75\xd1\x6c\x36\x71\xf3\x4d\x37\
\x25\x98\x95\x19\x6d\x30\x96\xee\x78\xa6\x2f\x42\xa9\x55\xbc\xde\
\x56\x5c\xca\x02\x9d\x76\x0b\x0b\xb7\x28\x47\xe0\x1b\xb5\x23\x30\
\x2c\x68\x7b\xea\xd4\x49\x3c\xf6\xc8\xc3\x78\xe0\xde\xbb\x70\xf2\
\xe8\x91\x08\xac\x42\x67\x62\x64\xb0\xb8\x5c\x8b\xda\x46\xb8\x54\
\x16\xa0\x68\xe2\x71\x65\x06\xae\xb9\xe6\x5a\x98\x46\x5c\x59\x3c\
\x3f\xae\x44\xd5\xa4\x3d\xcd\x7c\x9f\x7c\xe2\x89\x59\xe3\x4a\xb5\
\x6d\xfc\x2a\x05\x26\x2e\x01\x52\x55\x9a\x78\xd5\x63\x0e\x48\xb6\
\x53\x6c\x6e\x16\x40\x9a\xf6\xbc\xa0\x74\x5d\xc0\x14\x58\x51\x0c\
\x56\xfb\xf7\x1f\x88\x2a\xae\xdf\x3c\x26\x03\xaa\xd7\x4a\x39\xd9\
\x09\x58\xae\x98\x2d\x25\x98\x55\x7c\x7a\x12\x10\x15\xb4\xbd\xf5\
\xd6\x9b\xf1\xba\xd7\xbe\x56\x25\x06\xf7\x7a\x38\x7d\xe6\x0c\xce\
\x9c\x3e\x8d\x33\xa7\x4f\xe1\xce\xcf\x7f\x16\xcf\x3c\xf9\x04\x36\
\x37\xd6\x30\x1a\x0e\x11\x04\x41\x24\x03\x46\x40\x55\xe8\x0a\xe4\
\xb9\x9d\x35\x5c\xe9\x85\x53\xde\x51\x80\x4b\x49\xfb\x8a\xed\x38\
\xe9\xb6\x35\xb9\xe0\x53\xc6\x91\xc7\xa9\xb3\x2d\x08\x24\x36\x36\
\xd6\xf3\x12\x6b\xcb\x82\x52\x3d\xae\x22\x60\x2a\x13\x08\xaa\xc2\
\x9c\xf4\xb9\x48\x15\x77\x61\x9b\x3a\xde\x45\x23\x5e\x93\xf7\x95\
\xb6\x3d\x0d\xcd\xe1\x5d\x53\xab\x3a\xd0\x4e\xef\x52\x34\x84\xc8\
\x01\xab\xa3\x47\xa2\x13\xe5\xbe\x7b\xef\x85\x65\xdb\xd8\xbf\x7f\
\x7f\x54\xc4\xf6\xe6\x1b\x6f\x8c\xeb\x02\x26\xe7\x3e\x56\xbd\xac\
\xca\x80\xd1\xd4\x67\x98\x21\x93\x8e\x40\x41\xba\x55\x48\x07\xb7\
\xdd\x72\x0b\x40\xc0\xbb\xdf\xf3\x5e\x0c\x75\xf5\xf5\xcd\x6e\x17\
\x8f\x3f\xfa\x28\x3e\xff\xf7\x9f\xc1\x33\x4f\x3e\x8e\xde\xd6\x16\
\xfa\xfd\x5e\xe4\x3e\x0d\x25\xc0\x9d\xb0\xaf\xcf\x13\x9c\x26\x8a\
\xb6\x1a\x8b\x1a\x8d\x46\x49\xf0\x29\xef\xc8\x03\x04\x3c\x6f\x84\
\xad\x6e\xd7\xc7\xb4\xd2\x66\xf9\xe1\x81\x1a\xa4\xae\x62\x29\xaf\
\xe8\x04\x28\xdb\xdd\x36\xd1\xc5\x96\xb6\xb5\x03\x34\xe3\xab\x77\
\x1e\x9f\xaa\x18\x28\x76\xc0\xbd\x47\xdb\xdb\x1a\x55\xae\x45\x34\
\x9f\x63\x96\xaa\xc5\x26\x8c\x0c\x58\x8d\x70\xec\xe8\xd1\xc8\xdc\
\x70\xdf\xbd\xf7\x62\x61\x71\x11\xfb\xf7\xef\x07\x00\x34\x1b\x0d\
\xdc\x74\xd3\x8d\xd8\xbf\x77\x2f\x3a\xed\x56\x6a\x8b\x93\x2a\xae\
\x57\x05\xec\x58\x52\x8c\xf9\x83\xeb\x3a\x38\x74\xe8\x20\x08\x84\
\x17\x3e\xff\x76\xbc\xe3\x1d\xef\xc0\x60\x38\xc4\xda\xfa\x3a\xd6\
\xd7\xd6\xf0\xc8\xc3\x0f\xe1\xee\x2f\x7e\x01\x4f\x3f\xf1\x18\xb6\
\xba\x9b\x29\x47\xe0\x25\xc9\xb5\x9a\xc9\x0f\x91\xa6\x3a\x07\x0f\
\x1d\x4a\x6c\xa6\x4c\x5c\x69\xba\x23\x8f\x08\x18\x0c\x07\xc0\xec\
\x7d\x98\xb2\x8b\xe8\x1a\x9c\xae\x02\x60\x9a\x16\x5c\x9c\x24\xeb\
\x45\x27\x53\x78\xce\x12\xe2\x9e\x4c\x46\x26\x77\x66\x67\xc8\x53\
\xd9\x37\xe5\xbf\xae\xdc\x67\x4d\xae\x2f\x57\x68\xe9\xa6\xb2\xf3\
\x3f\xcd\x6f\x62\xaa\x0a\x4a\x3b\x36\x6f\x96\xcb\x6f\x22\x90\x6e\
\xbc\x18\x8f\xcd\x8d\x0d\xac\xaf\xaf\x45\xff\xbe\xf7\xbe\x7b\xb1\
\xb0\xb0\x88\x03\x07\xf6\x83\x19\x2a\x66\x95\x64\x56\xc9\xb9\x33\
\x64\x56\xa5\xbf\xdf\x04\x43\x3e\x27\xf2\xad\xf4\xc9\xdd\x70\x5d\
\x34\x1a\xca\xbe\x7e\xfb\xf3\x9e\x87\x77\xbd\xeb\x5d\x18\x79\x3e\
\x86\xc3\x21\xce\x9c\x3d\x8b\x27\x1f\x7f\x1c\xff\xf0\x99\x4f\xe1\
\xe4\xf1\xa3\x38\xb7\x72\x06\xfd\xad\x2d\x8c\x46\xa3\x08\x40\x85\
\xd8\xe1\xb2\x4b\xdb\x70\xec\x11\x11\xf6\xec\xd9\x3d\x79\xc9\x57\
\x28\xed\x4d\x66\x4f\x5a\x0a\xad\x02\x48\x12\xb5\x55\xbc\x66\x4c\
\x15\xc0\xa8\xb8\x02\x84\x5e\x1e\x05\x41\x80\xc0\xf7\x2b\x00\xd3\
\xfc\xb8\xce\xe4\x2d\xcd\x02\x4e\x34\x9b\x6c\x47\x25\xa6\x3f\xaa\
\x32\xdb\xcc\x3a\xf5\x5f\x4c\x50\xa2\xb9\x6c\x9a\x04\xc1\xc0\x78\
\x42\xf0\xfa\xfa\x5a\xb4\x9a\xbf\xf7\xde\x7b\xb0\xb8\xb8\x88\xfd\
\xfb\x0f\x80\x59\xe2\xfa\xc3\xd7\x63\x69\x71\x11\x7b\xf7\xec\x4e\
\x30\x2b\xf5\x7f\xc5\xac\x64\x39\x30\x9a\xf2\x05\x42\x66\x17\xe5\
\x49\x81\x60\x59\x26\x2c\xcb\x44\xa7\x73\x23\x6e\xb9\xf9\x26\xbc\
\xf9\x2d\x6f\x46\x10\x04\xe8\xf5\xfa\xb8\xb0\xba\x8a\xa3\x47\x8e\
\xe0\xee\x3b\xbe\x80\xc7\x1f\x7d\x18\x27\x8f\x1d\x45\x77\x73\x03\
\x5e\x02\xac\xa6\x39\x02\x77\xd4\x9e\x4e\x49\x39\x8f\xb0\x6b\x79\
\x57\xd4\xff\x70\xb6\xb8\x52\xa6\xc3\x72\x88\x55\x6a\x76\x98\x54\
\x59\xbc\x2c\x73\xaa\x59\xd3\x55\x04\x4c\x55\x58\x53\xe1\xea\x86\
\x12\xab\x23\xd5\x2c\xd0\xad\x70\xfe\xa4\x41\x63\x3b\xac\xa9\xd4\
\x7b\xb7\x81\x85\x53\xed\xcc\x34\x61\x0a\x9c\x42\xa8\x38\x3b\xbd\
\xd3\xb6\x76\x2a\x1f\x94\x68\xae\x33\xda\x7c\x36\x3d\x4d\x65\x24\
\x1a\x5b\xe8\x6c\x6c\x6c\x60\x7d\x4d\x31\xab\xc7\x1f\x7f\x1c\x00\
\x12\x60\xc5\xb8\xfe\xfa\xc3\x0a\xac\x76\xef\x9e\xce\xac\x2a\x7e\
\x01\xca\x4b\x3c\x4d\xb0\x2b\x21\x44\x54\x76\xe9\x86\xc3\x87\xf0\
\xda\xd7\xbc\x1a\x7e\x08\x56\x17\x2e\xe0\x48\x08\x56\x8f\x3c\x8c\
\x93\xc7\x8f\x62\x73\x7d\x2d\x51\xd0\x56\x01\x95\xa0\x8b\x22\x4c\
\x47\xf7\x84\x10\x70\x1c\x27\x35\x1b\xa4\xa5\xbb\x32\x71\xa5\xf4\
\x6b\xc2\x12\x52\xc7\x4f\x9c\x08\x19\x53\x80\xd9\x0b\xb7\xd6\xf9\
\x4c\x57\x09\x30\x15\xb5\xbe\x28\x2d\xe1\x21\x2f\x8f\xa9\xf0\x34\
\xbd\x1c\xc0\x89\x31\x4b\x3d\x85\x79\x82\x12\x4d\x9b\xf0\x68\x12\
\xff\xe0\x0a\x13\xcf\xbc\x41\xe9\xe2\x82\x51\x19\xe9\x89\x26\x82\
\xd5\x63\x63\x60\x75\xc3\xf5\x9a\x59\xed\xde\xa5\x4b\x2d\xc5\x3b\
\x22\x59\x4e\x70\x03\x52\x65\xdf\x05\x23\x6d\x5f\x17\x24\xd0\x6e\
\xb7\xd0\xe9\xb4\x71\xfd\xe1\xc3\x78\xed\x6b\x5f\x83\xc0\x0f\xd0\
\xeb\xf7\x71\xfe\xc2\x05\x1c\x3d\x7a\x14\x47\x9e\x7e\x1a\xf7\xdf\
\x7d\x07\x1e\x7d\xf0\x3e\x6c\x6c\x6c\xa4\x8c\x74\xbc\xbd\x83\x35\
\xf1\xda\x61\x00\x8e\xe3\xe2\xe0\x73\x9e\x93\x3e\x06\x25\x5c\x79\
\xf9\x8d\x01\xd3\xaf\x39\x76\xfc\xf8\x24\x29\x6f\x1a\x50\xd5\xa0\
\x74\x95\x4b\x79\x65\xda\xad\x4b\x14\x57\x1a\xcf\x5c\xa3\x3c\x03\
\x33\xd9\x0e\x38\xcd\x5d\x19\xac\xb6\x69\x9a\x2e\x07\x4e\x9c\xda\
\x29\x07\x8c\x8a\xa2\xf8\x3c\xc3\x04\x5f\xb1\x12\xc4\x5c\xf1\xe4\
\x22\x79\x00\x2a\x81\xd5\xbe\xfd\x68\xb5\xdb\xb8\xe9\xc6\x1b\x40\
\x20\x1d\xb3\x6a\x45\x3f\x44\x08\x2a\x85\x60\x55\xb9\xe6\xae\xa2\
\x20\xa9\x8a\x18\x82\xd0\x6a\x36\xd1\x6c\x36\x71\xdb\xcd\x37\x62\
\xa1\xf5\x56\xec\x5e\xec\xe0\xfe\xfb\xee\xc1\x1b\xbf\xfa\xcd\x30\
\x32\xce\xc6\x9d\x3c\x6e\x48\xd5\xfe\x9d\x56\xc9\x61\x7a\xa5\x87\
\xe4\x49\x7a\xec\xc8\x91\x69\xc0\xc4\x13\x16\xbb\xb5\x23\xef\x2a\
\x07\x26\xa0\x5a\x9d\xbc\xe8\x04\xa2\x64\xa2\x48\xce\xbb\x99\x66\
\x64\x3f\x28\xca\x30\x9f\xce\xcf\xca\xe2\x53\x59\xdf\x44\x59\x30\
\xcd\x03\xa5\xa9\xd3\x3c\x25\x9b\xb5\x4d\x9f\xff\xa6\xe5\x54\x52\
\xe9\x0a\xb5\x3b\x54\xfb\xef\x32\xca\x48\x9d\x06\x56\xf7\xdc\x7d\
\x17\x00\x60\x61\x71\x09\xfb\xf7\xef\x47\xbb\xd5\xc2\x2d\x37\xdf\
\x84\xc5\x85\x05\x58\xba\x2e\x20\x25\xd8\x41\xc4\x84\x2a\xc8\x64\
\x79\x2f\x90\x52\xc9\x89\x8b\xed\x06\x76\x2f\x76\xb0\xd8\x6e\xc2\
\x34\x4d\x18\x86\x01\x6f\x34\x2c\x51\xd6\x6b\x7e\x3f\x0c\x33\xb0\
\xb4\xb4\x8c\x5d\xba\x4e\x1e\xe7\x5d\x45\xb9\x2d\x2e\x78\x0a\x38\
\xa9\x71\xdf\x3d\x77\x03\x93\xfb\x30\x95\x2d\xde\x5a\x5d\x3a\xa8\
\x81\xe9\x59\x0d\x44\x65\xd8\x52\xa1\x5d\x9c\x99\xe5\xd1\x27\x1e\
\xe1\x83\x37\xdf\x96\xc9\x3d\xe4\xca\x40\x31\x06\x32\xdb\xe8\x7c\
\x5e\x16\x48\xf2\x5f\x3e\xee\x46\xca\xdf\x8f\xc9\x96\xbd\xa9\xaf\
\xa5\xb8\x65\xc5\x34\x46\x15\x3d\x12\x81\x36\xcf\x00\x4a\x73\x74\
\x85\x3d\x4b\xab\xa3\xe6\x83\xd5\x3a\xd6\xd7\x56\x01\x22\xdc\x73\
\xcf\xdd\xba\x2e\x60\x43\x81\x55\xbb\x85\x5b\x6e\xba\x39\xaa\xb8\
\xae\x8a\xd8\x52\x2c\x84\xa5\x4a\x24\x15\x83\x11\x33\x43\xea\xd8\
\xd6\x62\xbb\x81\x83\xfb\xf7\xa0\xe1\x3a\x51\x3c\x29\x34\x1e\x6c\
\xf5\x7a\x17\xe7\x38\x24\x68\x92\x1f\x39\x69\x39\x03\x32\x15\xd8\
\x53\x4e\xdc\x89\x99\xf1\xe8\x23\x8f\x70\x09\x86\x24\x51\xbe\x02\
\x4d\x3d\x70\xf5\xe5\x31\x55\x06\x28\x66\x0e\x88\x88\x01\x10\x33\
\x63\x38\x18\xa0\xd5\xee\x8c\x51\xa6\xea\x2a\xdb\xac\xec\xa9\xda\
\x76\x8b\xf7\x2d\xdf\xc2\xc7\x13\x54\xb6\xe2\xd5\xf2\x04\x36\x14\
\x81\x52\x19\x6b\x7a\xf8\x1a\x4e\x4c\x06\xe5\xe4\x26\x2a\x5b\x4f\
\x8f\xaf\x2c\x20\xaa\x02\x56\x21\xe9\x57\x45\x6c\x47\x31\x58\xdd\
\xad\xc0\xaa\xe1\x36\xb0\x6f\xff\x7e\x55\x41\xe2\xe6\x9b\xe2\x8a\
\xeb\x3a\x29\x98\x90\xa8\x0b\x18\x1e\x4e\xa9\x00\xc9\xb1\x4d\x3c\
\x67\xdf\x6e\xb4\x9b\x0d\x58\xa6\x09\x43\x08\x70\xe6\xd7\x63\x30\
\x8e\x1e\x3d\x3a\xfb\x69\x0d\x2e\xfe\xd9\x0a\x8b\x55\x30\x9a\xcd\
\x16\x4c\xd3\x9c\xa0\x74\x4c\x63\x47\x89\x45\x68\xc2\x91\x27\xa5\
\xc4\xfa\xda\xea\xb4\xaa\xe2\x75\xe5\x87\x1a\x98\x2a\x01\xd4\x24\
\xdb\x78\x5e\x9b\x75\x11\x9e\x8c\xb9\x7a\x1e\xaa\xca\x7a\x39\x74\
\xa5\x2c\x40\x4d\x95\x10\x79\x4c\x1b\x2b\x6e\x76\x96\xd6\xd1\xc6\
\x9d\x48\x25\x73\xa9\x38\x47\xda\xcb\x80\x12\x15\x8a\x93\xe3\xbd\
\x04\xa8\x82\xb8\x41\x55\x6c\xea\x74\x75\x5f\xf0\xc9\x05\x83\x61\
\x64\x2b\xae\x8f\xb0\xb6\x1e\xcb\x80\x76\xc8\xac\x0e\xec\x47\xbb\
\xd5\xc6\x2d\x37\xdf\xac\x4b\x2d\xb5\x61\x9a\x26\xa4\x94\x58\x68\
\x35\x70\xdd\xbe\x5d\x70\x6c\x0b\x96\x9e\xfc\x19\xc5\x0b\x8a\x13\
\x27\x4e\xcc\x16\x5b\x1d\xfb\x16\x3c\x59\x66\x54\x15\x96\x20\x19\
\x38\x70\xcd\x35\x30\x12\x75\xf2\x66\x61\x47\x59\x70\x12\x82\xe0\
\x79\x1e\xd6\xd7\xd7\x27\x01\x53\xdd\x56\xbd\x06\xa6\xb9\xb1\xa7\
\x7c\x67\x9e\x7e\x47\x7e\xb3\xc0\xc4\x0a\x7f\x26\xe6\x33\x0e\x50\
\xf9\x1b\xc8\xd1\xc5\xa7\x92\x91\x18\xf1\xca\x00\xe7\xd4\x8e\x9e\
\x93\x2e\x6c\x4e\xf7\x1b\x98\xea\xd2\xcb\xca\x78\xa9\x07\x58\x6d\
\x8e\x29\x96\xf5\x38\xfb\xfa\x32\x2c\x89\x2a\xd0\xa6\xed\x20\xd9\
\xe5\x3d\xb7\x50\x99\xe7\xa3\x2e\xc1\x6a\x8c\x3c\x0f\x23\x0d\x56\
\x04\xe0\xee\xbb\xef\x82\xed\x38\xd8\xbb\x77\x2f\x3a\x9d\x05\x7c\
\xf7\x87\x3f\x88\xdd\xcb\x4b\xba\x9e\x20\x97\x3a\x02\xdd\xee\x16\
\xca\xc1\xcc\xa4\xe3\x5b\xe1\x58\x33\xc3\x71\x1c\x10\xd1\xb8\x24\
\x59\x02\x80\x8a\x2c\xe3\xcc\x2a\x96\x26\xd5\x4a\x75\x12\x20\x15\
\x01\xd4\xb3\xeb\x04\xaa\x81\x69\x47\x40\x68\xd6\xf6\xea\x63\xce\
\x3c\xcf\x1b\x4d\x05\x80\xe8\x5f\xdb\x60\x50\x93\x6d\xe1\xc8\xbd\
\xc0\xf2\x65\xb7\x24\x70\xa8\x9e\x9b\xc5\x12\x5d\xfc\x9a\xb1\x0b\
\x32\x05\x6c\x09\xb0\x43\x3a\xee\xc6\x71\x4f\xd8\xd4\xfd\x31\x60\
\x9c\x50\x70\x53\xcf\x92\x20\x5d\x59\x9b\x52\xf1\x38\x2e\xc9\x90\
\x26\x37\xbe\xe0\xc2\xf9\xa0\x74\x94\x2d\xf7\x7d\x7c\x19\xce\x35\
\xdb\xe9\xcf\x94\x6e\x69\xaf\x9a\x65\x1e\x3d\x7a\x14\x9d\x76\x0b\
\xed\x66\x03\x42\x88\xd2\x66\x06\x29\x25\x1e\x7b\xec\xf1\x8a\x35\
\x27\xb7\xf9\x85\x89\xe0\xba\xee\xc4\xe5\x57\x3e\x00\x15\x81\x93\
\x7a\x9e\x88\xd0\xdd\xda\x02\x94\xf1\x21\xbc\xe5\x25\xd8\x72\x09\
\x49\xaf\x1e\x35\x63\x9a\xb9\x61\x20\x00\x60\x38\x98\xd6\x2c\x70\
\x5c\x12\xa8\x0e\x50\x28\xf9\x5e\x2e\xc6\xc7\xa4\xb0\x51\xa4\x8b\
\xa5\x0a\x2d\x53\x1a\x60\x12\x48\x47\x94\x04\xad\xcc\x63\x08\x0b\
\x36\xeb\xc7\x98\x63\x60\x63\x06\x53\x01\x38\x71\xc1\x77\xa3\xf4\
\x7d\x8a\xa4\x48\x1e\x83\x9b\xed\x58\x1d\x62\x5e\x36\xdf\x42\x4a\
\x45\xb0\xc6\x97\x00\xa8\x68\x87\xb6\x48\x44\x30\x0d\xb3\x12\xf6\
\x12\x08\x0c\xc6\x60\x30\xd8\x46\x59\x5f\xae\xfe\x1e\x96\x78\xce\
\xc1\x83\x4a\xd6\x93\x59\xf3\x12\xa6\xb0\xa3\x49\xe0\x14\x6d\x63\
\x1e\x12\x5e\x0d\x4e\x57\x31\x30\x95\x4d\xba\x9d\xbc\xaa\xe1\x19\
\x3e\x4e\x33\x0b\x54\xb6\x87\x27\xde\x9b\x0b\x32\xe5\xb6\xc1\x3c\
\x3e\x55\xe5\xad\x02\x99\x33\x7c\x83\xd2\x8f\xe7\x3d\x96\x04\x29\
\xe6\xf0\x35\x1c\x65\xc6\x23\x0c\x94\x93\x9a\x9a\x14\x3e\x85\xf7\
\x69\x8a\x1c\x98\x38\x66\x5c\xa1\xfc\x10\x97\x7f\x1d\xcd\x32\x3f\
\xce\x30\x95\xd0\x18\x50\xed\xec\x5c\x44\x3b\xbc\x35\xcb\x32\xc7\
\xaa\xac\x4f\x3e\x1b\xd5\xf7\x0d\x64\x50\xfd\xb0\x8e\x55\x18\x27\
\x94\xb6\x1b\x11\x61\xd7\xae\x5d\x33\xb2\xa3\xe2\xe7\x88\x08\xeb\
\xeb\x1b\x93\x80\xa9\x08\xa4\x26\xe9\x92\x35\x40\x5d\x65\xc0\x54\
\x64\x78\x98\x24\xfd\x65\x4f\xae\xed\x7f\x3c\x27\x64\x24\xaa\x52\
\x35\x02\x19\x90\xa1\x52\x73\x09\x95\x02\xab\x1c\x01\x8c\xd2\x2d\
\xbf\xa3\xf6\x01\xa9\xc7\xc2\xc7\x93\xc0\x55\x54\x67\x33\x5c\x2f\
\x27\xef\xab\xf7\x46\xf2\x22\x25\x44\xb6\xbc\x40\x5d\x95\x22\x7e\
\x54\x7a\x19\x3f\x79\x3a\xa0\x19\x66\xfe\x0a\x0c\xa2\xea\x9b\xb9\
\xc2\x57\xda\xc9\x21\xa5\xc4\xee\x5d\xcb\xb1\x05\xbb\xcc\x7e\x11\
\x61\x34\x1a\xe1\xc4\xf1\x93\xb3\x49\x79\x59\x0d\x78\x6a\xc0\x34\
\x66\x77\xbb\x76\x2d\x8f\x5d\x43\xdb\x05\x27\x02\xe1\xc4\x89\xdc\
\xaa\x0f\x65\x64\x3c\xa0\x2e\xe2\x7a\xd5\x02\x53\x99\xd6\xc5\x33\
\x74\x95\xe4\xf9\xec\x56\x92\x09\xcd\x1c\x8b\x2a\x21\x05\x56\x9c\
\x22\x99\xc6\xdf\x48\x13\x48\x08\xe7\xed\x1a\x65\xef\xa7\xdb\x2e\
\xf0\xf8\xa2\x36\x71\x58\x28\x16\xd8\x4a\xda\x1c\x29\xc7\xbe\x3e\
\x2e\x9d\x51\x8e\x2b\x90\xf3\x01\x6a\x1e\x5a\x1e\x6f\xe7\xcd\xf9\
\x1b\xb8\x9c\x0c\x85\x23\xcf\x57\x86\x82\x4a\x80\x16\x60\x6d\x7d\
\x7d\x2a\xde\x73\xd5\x43\x35\xe1\xd8\x08\x21\xd0\x68\x34\xf4\xe2\
\x69\x36\x76\x94\xfb\x1c\x01\xc7\x8f\x1d\x03\x8a\x1b\x04\x32\xaa\
\xb7\xbd\xa8\xc7\x55\x2a\xe5\xcd\x6a\x80\x88\x57\xf4\xc9\x8b\x91\
\xb7\x13\xc7\xe5\x0c\x88\x4c\x90\xd9\x76\x34\xf7\x26\x23\x2a\x71\
\x95\x89\x22\x1d\x08\xe3\x24\xe3\x09\x8d\x0a\xa1\x3b\x42\x5f\xd1\
\xb1\x79\x21\x3f\x0b\x38\xee\xaa\xad\x01\x8a\xa9\xfc\xf7\xcd\xbe\
\x34\x01\xfe\x54\x20\xad\xe5\x02\xd4\x4e\x6a\x69\x5c\x75\x03\x97\
\xe7\xbc\xc5\x2c\x2b\xf7\x64\x32\x0c\xb3\xb4\xa3\x9f\xa7\xef\xc0\
\xd4\x8b\x8f\x99\xe1\x3a\x0e\x0e\x1d\x3c\x98\x88\x0b\xcf\x07\x9c\
\x00\xe0\xee\xbb\xee\x9a\x26\xe5\x55\xb5\x89\xd7\x20\x75\x95\x00\
\x53\xd1\xaa\xa4\x0a\x40\xa5\xa5\x3c\x1d\xcc\x0f\x4f\x74\xce\x4c\
\x9c\xb4\xed\x5d\x2d\x96\xd9\x66\x9f\xe4\xb6\x77\x00\xa7\xcd\xb1\
\x94\x00\x28\x85\x49\x9c\x62\x40\x94\x8a\x33\x29\xfb\xb7\xb2\xef\
\xb2\x96\xff\x48\x01\x50\xce\x2a\x38\xa5\xea\x71\x91\xc5\xbc\x60\
\x27\x93\x46\x8b\x82\xd7\x10\x17\x31\xac\x1d\x1a\x54\xf5\x37\xa4\
\xcb\x6e\xde\x92\x52\xe2\x9a\xfd\xfb\x2a\x03\xd3\x60\xd0\xc7\x70\
\x38\x2c\xb5\x9a\x9b\x08\x4e\xcc\x25\xd6\x11\x0c\x22\x81\x4c\xa1\
\xbc\x39\x82\x13\xe3\x89\xc7\x1f\x0b\xe7\x87\x32\x6d\xd5\x25\x26\
\x57\xa3\xa9\xc7\x55\xca\x98\x80\xf2\x65\x41\xf2\x4e\x2c\x55\x07\
\x4c\xf7\x64\x12\x86\x99\xab\xf2\x65\xed\xd8\x74\xb9\x7c\x6b\x94\
\x0c\xb8\xe7\x4c\xe2\x11\xf3\x29\x98\x55\xa3\x83\x43\xea\x75\x9c\
\xf8\xf2\x94\xa8\x12\x40\x44\x1a\x84\x10\xb9\xf5\x22\xe0\x4a\x3e\
\x4e\x34\xc6\xa2\x38\xdc\x7e\x06\xa0\xb2\xc0\x39\x6e\x32\xc0\xe4\
\x98\x13\xe5\x31\xac\x69\x95\x64\xe7\x38\x8f\x54\x02\xaa\x4b\xc1\
\xa2\x28\x97\x89\xec\x5a\x5a\xac\xbc\xa5\xc1\x60\x80\x40\xca\x39\
\xed\x53\xf1\x6f\x14\x96\x23\x62\x66\x2c\x2e\x2f\x63\xd7\xae\xe5\
\x4c\x9d\xbc\xed\x83\x93\x94\x12\xa7\x4e\x9e\x2c\x53\xf1\xa1\x6c\
\x2f\xa6\x1a\x9c\xae\x32\x60\x9a\xc6\x9a\x4a\xcb\x79\xa4\x4f\xc8\
\x20\x08\x20\x4c\x73\x4a\x43\x8c\x39\x02\x15\x8f\xc3\xc0\xec\x47\
\x82\xc7\x2e\x69\x9e\x04\xe1\x91\xb4\x96\x82\xa0\x9c\xd8\x12\x83\
\x28\xe9\x97\x20\x64\xc3\x55\xe1\x0a\x3b\xf7\xaf\x66\x53\x44\x1c\
\x83\x13\x4a\x00\x54\x24\x19\x66\xe4\xc4\x14\x44\x51\x0e\x28\xd3\
\xf8\x34\x9f\xd8\x6e\xd9\x52\xa6\x3b\x06\x54\x97\x1d\x40\xc5\x1f\
\xcd\xcc\x70\x5d\x27\x65\x69\x29\x33\xfa\xbd\x1e\x58\xca\x52\x6e\
\x3e\xde\xf6\x01\x54\x23\x6e\xec\x99\xd7\x11\xa0\x1c\x38\x8d\x25\
\x76\x13\xe0\xfb\x3e\x2e\x9c\x3f\x1f\x60\x7a\x93\xc0\x32\xb9\x94\
\xf5\xb8\x8a\x80\x69\x92\x25\xb3\x0c\x6b\xca\x32\x28\x80\x80\x20\
\xf0\x75\xb3\x40\xa7\xe4\x19\x35\x01\xa8\x76\xe2\xf2\x2c\x03\x62\
\x09\x80\xe2\x50\x96\xd4\xb7\x14\x61\x8a\x00\x02\x63\xb1\xa4\xa4\
\xa4\xc2\x89\x3a\x66\x11\xd8\x20\x8c\x13\x65\xa6\x8c\x04\x18\xe5\
\x01\x54\x78\x0b\xc1\x89\x42\x79\x30\x91\xe4\x49\xa0\xb1\x92\x46\
\x4c\x9c\xc8\x79\x1a\x4f\x51\xce\x4e\xa2\xf9\x86\x3f\x8a\x18\x16\
\x95\x3c\xfc\x93\x45\xa5\x6d\xcc\x39\xa5\xb0\xef\x52\x01\x14\xe9\
\x82\xad\xd5\x2a\x68\x0c\x86\x03\xcc\xa7\xb0\x38\x4f\x23\x75\xd1\
\xab\x9a\xad\x56\x54\x2a\x69\x56\x76\xc4\x21\xe9\xce\xb4\x54\x0f\
\x54\x5f\xf5\x59\xe3\x4b\x3b\xb4\xb2\xa9\x81\xe9\xd9\x0e\x56\x65\
\xc0\x28\xf1\x97\xf2\xa9\xc4\xb6\x77\xa1\xfa\xdb\x2a\x31\xa7\xb0\
\x10\x2a\x87\x2d\x0d\x38\x06\x12\xfd\x9c\xe5\xb6\x60\x58\x36\x48\
\x90\xb6\x8b\x13\x02\x6f\x84\x60\x34\x84\x37\xcc\x4f\x28\x8e\xda\
\x66\x67\xc0\x27\xf7\xb5\x89\xff\x51\x84\x6f\x14\x01\x5f\x12\x04\
\xb3\x80\x35\x06\x54\x44\xe3\x13\x88\x22\x51\x89\xe4\x5d\x8a\x18\
\x1e\x65\x04\x3e\x9e\x02\x02\xa9\x98\x13\xf1\xac\x73\xe2\x24\x6e\
\xb9\x03\x40\x75\x91\x00\x2a\xd1\x23\x63\xd7\xd2\x62\x6c\x6a\x29\
\xf9\xd6\x33\xa7\x4f\xe3\x62\xc6\xf1\x98\x19\x7b\xf7\xed\x87\x69\
\xa6\xeb\xe4\x55\x61\x47\x79\xe0\x44\x44\x61\x69\xa5\x32\x12\x5e\
\x5d\xc4\xb5\x06\xa6\xd2\x92\x5e\x95\x72\x44\x11\x63\x4a\x4e\x33\
\xcc\x17\x6f\x8f\xa7\x02\x51\x8e\x67\x3b\x05\x42\x96\x0b\x21\x04\
\x6c\xb7\x09\x77\x71\x17\x1a\x9d\x45\xd8\xb6\x0d\xcb\xb6\xe0\x38\
\x0e\x5a\x8b\x4b\x70\x1b\x0d\x58\x96\xea\x99\x63\x1a\x06\xa4\x54\
\xb1\xb4\xd1\x60\x90\x02\x9c\xb3\x27\x8e\xa1\x7b\xe1\x3c\x36\x56\
\xcf\x61\xf3\xc2\x79\x8c\xfa\x3d\x55\x83\x8c\x19\xc2\x30\x40\xc2\
\x88\xc1\x26\x25\x1c\xd2\x18\x40\x45\x20\x44\xf1\xbf\x93\x60\x95\
\xfa\x37\x09\x05\x9c\x49\x99\x2f\xb7\xc8\x6c\x1c\xeb\x0a\xcd\x18\
\x79\xc7\x2e\x55\xda\x28\x67\x52\x2b\x34\x45\x94\xf4\x22\xe4\x57\
\x96\xd8\x69\xc9\x6f\x9e\x9f\x35\x99\xd9\x2f\x2f\x2e\x54\x3e\x95\
\xfb\x83\xc1\xf6\xf6\xaa\x42\x22\x17\x11\x00\xc9\x68\xb5\x5a\xb9\
\x75\xf2\xaa\xb0\xa3\xb1\xe7\xe2\xb1\x1d\x47\x5e\xcd\x96\xae\x72\
\x60\x9a\x26\xe9\x95\x65\x4e\xf9\x5b\xa6\xf9\xef\x6d\x21\x10\x71\
\x7a\x62\x1d\xbb\x26\xb5\x14\x37\x82\x01\x61\x37\x60\x3a\x0d\xb4\
\x16\x16\xe1\x76\x16\xd1\xea\x2c\xa0\xbd\xd0\x41\xa3\xd9\x80\x63\
\xdb\xba\x72\xb4\x03\xdb\x32\x61\x9a\x26\x4c\x53\x01\x92\x61\x08\
\x18\x86\x01\x43\x08\x18\x42\x40\x44\x7f\x55\x30\x59\x7e\xc9\xf3\
\x01\xa8\x6a\xd4\xe7\xcf\x5d\xc0\x68\x34\xc4\xfa\xea\x2a\x4e\x3c\
\xf5\x24\x4e\x3c\xf9\x18\xd6\xcf\x9d\x45\xe0\x79\x10\x86\x80\x30\
\x0c\x08\x61\x44\x55\x1f\xb2\x73\xa8\x8a\x29\x65\x24\xbd\xcc\xe3\
\x31\x33\x53\x52\x5d\x92\xa9\x25\x1d\x7e\x31\x40\xa5\x83\x52\x34\
\x21\x9b\x39\x27\xcd\x2a\x3d\xc1\x71\xd6\x56\x5e\x1d\xa4\xd2\x2f\
\xd9\x01\x66\x53\xb8\x49\x9a\x6d\x46\x2f\xf9\xb4\x69\x1a\x95\x4f\
\xec\x99\x5b\x5e\xcc\x7c\x6c\x62\x86\xbd\x5d\xe9\x2e\x1d\xbd\x24\
\x6c\x6c\x6e\x00\x93\xdd\x78\x45\x8e\x3c\x14\x48\x2f\x35\x40\x5d\
\x45\xc0\x54\x26\xcb\x7a\x92\x45\x3c\xa4\x1d\xf2\xd8\xe3\xaa\x59\
\x60\x52\x14\xe2\x12\xa7\x13\x95\xe8\x0d\x54\x8e\x11\x15\x84\x99\
\x35\x33\xf2\xc9\x46\x60\xda\xb0\x6c\x1b\xb6\xdb\x46\x6b\x69\x19\
\x0b\x4b\x8b\x68\x34\x5b\xe8\x74\x5a\x70\x5d\x17\x8e\x63\xc3\xb2\
\x2c\x58\x96\x02\x22\x43\x68\x30\x32\x35\x10\x19\x02\xa6\x61\xe8\
\xe7\x62\x50\x32\x53\x60\x45\x11\x50\x5d\xbb\x77\x97\x0e\x4d\x31\
\xfc\x57\xbe\x02\xeb\x9b\x9b\x38\x7f\xfe\x02\x4e\x9d\x38\x89\xc7\
\xef\xbf\x07\xa7\x9e\x7e\x12\x1b\xe7\x57\x60\x98\x26\x84\xa1\x4a\
\xd8\x50\x32\x9b\x36\x02\xa0\x02\x16\xa5\x6f\x82\x39\x0d\x52\xc9\
\x7f\xeb\xd7\x32\xc5\x32\x24\x28\x5b\x3f\x06\x69\x57\x21\xa5\xe1\
\x9d\x8a\x5a\x7b\x24\x26\xfd\xe2\xda\x7a\x3c\x03\x48\xd1\xfc\x8b\
\xbd\x4e\x54\x0d\x69\xae\x57\x14\x09\x42\xa7\xdd\xae\xfc\xd6\xd5\
\xd5\xd5\xd2\x9d\x97\x67\xfb\x9e\xe3\xe3\xf0\xe1\xc3\x05\x75\xf2\
\x4a\x80\x53\xd1\x52\x86\x80\x13\x27\x4e\x86\x8c\x69\x5a\x82\x6d\
\xcd\x9a\x6a\x60\x9a\x8b\x9c\x37\x96\xb9\xcd\xcc\x92\x04\x49\x00\
\x06\x33\x30\x1a\x0e\xd0\x6a\xb7\x4b\x9d\x4f\x3c\xab\xd4\x52\x64\
\xf1\xe6\xc4\xee\x33\x23\x30\x6c\x48\x61\x03\x96\x0b\xab\xd1\x46\
\x7b\x71\x11\xad\x4e\x07\x8b\x4b\x8b\x68\x34\x5c\x38\x8e\x03\xdb\
\xb6\x60\x9a\x16\x6c\xdd\x33\xc7\x34\x0d\x08\x0d\x42\x86\x21\xe2\
\x2e\xa3\xba\xbe\x9d\x20\x8a\x40\xc9\x30\x04\x4c\xd3\x80\x65\xc6\
\x2c\xca\x10\xfa\x35\xa4\x00\x2a\x1c\x4b\xed\x06\x0e\x5f\xb3\x0f\
\xfe\xf3\x6e\xc5\x6b\x5f\xf3\x95\x38\x7d\xf6\x1c\x1e\xbc\xef\x7e\
\x3c\x7c\xf7\x9d\x58\x39\x7e\x04\x5b\xeb\x6b\x30\x4c\x0b\x86\x69\
\xc4\x96\xf0\x49\x4c\x29\x5a\xf1\x4a\x25\xe5\x69\x6b\xb9\xa0\x0c\
\x73\x4a\x02\x19\x53\xb4\xbd\x31\x80\x0a\x17\x0a\x99\xdc\xb3\x48\
\xd6\x9b\x9c\x8d\x9b\x90\xf8\xa6\xb0\xa0\x12\xc4\x28\x6b\x0b\xe1\
\x79\xcc\x51\x3b\x15\x6a\xca\x4c\xdc\x86\x30\xd0\x6c\x34\x2a\x6f\
\xe6\xec\xd9\x95\x39\xed\x47\x1a\x9d\x68\xc2\xcb\x77\xef\xd9\x3d\
\xe1\x02\x9b\x12\x57\x2a\xaa\x2c\x0e\xe0\xa9\x27\x1e\x9f\x26\xe5\
\x95\x69\xa9\x5e\xc7\x99\x6a\x60\xaa\x04\x4e\x13\xe5\x3c\x39\x73\
\x2e\x46\xd9\x52\x42\x5c\x08\x52\x04\x86\xc7\x06\xa4\x61\xab\xe6\
\x67\x96\x0b\x72\x9a\x68\xb5\x5b\x68\x75\x3a\x68\xb4\x5a\x68\x36\
\x1b\x68\x34\x1a\x11\x3b\x8a\xff\xaa\xce\xa2\xa4\x81\x45\x7d\x17\
\x06\x48\xaa\xf8\x0d\x13\x24\x4b\x48\x16\x10\xaa\x22\x2b\x44\xc8\
\x90\x88\x60\x50\x92\x31\x09\x0d\x4e\x04\xa1\x19\x8f\xd0\x81\x61\
\xb6\x18\x4d\xc7\xc2\x72\xbb\x85\xe7\xde\x70\x08\xbd\xb7\x7c\x35\
\x4e\x9d\x3d\x87\x7f\xf8\xcc\xdf\xe2\xc1\x2f\x7c\x16\x2b\x27\x8e\
\x82\x84\x50\x4c\x8a\x44\x0a\x34\x28\x19\x53\x4a\x81\x8d\x62\x49\
\x42\x4a\xb0\x18\x07\x29\x64\xdf\x17\x1a\x39\x78\x02\x40\x01\x69\
\xcb\xf9\xe4\x7e\xf4\xb9\x2b\xf6\x34\x93\xe2\x99\x81\x82\xe6\x29\
\xf7\xcd\x13\xa0\x0a\x8e\x83\x51\xa1\x80\x2b\x00\xb0\x94\x38\x76\
\xec\xd8\x7c\x5a\x5e\x94\x62\x4d\xea\x77\x2d\x53\xc0\x75\x92\x74\
\x57\x74\x2e\x3c\xf0\xc0\x03\xc0\xf4\xf8\xd2\x34\x50\x9a\x33\x6d\
\xae\x81\xe9\xd9\x08\x46\xd3\x2c\xe2\x65\x98\x14\x80\xa2\x66\x81\
\xdb\xdf\xc3\x31\x49\x2f\x03\x52\xc4\x12\x81\xb0\xe1\xdb\x2d\xc0\
\x72\x61\x58\x16\x4c\xd3\x84\xe3\x3a\x68\xb6\xda\x68\x34\x9b\x70\
\x1d\x1b\x96\x65\x2a\xf0\x11\x8a\xf9\x84\x7f\xc1\x0c\xc9\x12\x24\
\xf5\x15\xa3\xe9\x9c\x10\x02\x06\x14\xd0\x04\x01\x81\x28\x88\x5e\
\x0f\x45\x19\x55\x53\x34\xc1\x10\x09\x87\x9b\x20\x8a\xd9\x93\x08\
\xf3\x90\xe2\xb9\x23\x8c\x1d\x35\x6c\x13\xcb\xed\x83\xb8\xed\xfa\
\x0f\xe0\xfc\x3b\xdf\x8e\x07\x1f\x7e\x14\x7f\xf1\x47\xff\x15\x27\
\x9e\x78\x0c\x81\xef\xc1\xb2\x6d\x08\x61\x80\x44\xb8\x6d\x02\x89\
\x98\x25\x09\x26\x10\x49\xed\xce\x13\x20\xcd\xa0\x44\x98\x98\x9b\
\x60\x4e\x0a\xc0\x44\x9a\x7d\x85\x76\xbd\xbc\x1e\x1b\x29\x9b\x79\
\xa2\xb5\xc6\xa4\xba\x79\x85\x18\x34\x7b\x2c\xaa\x58\xee\xbb\x44\
\x00\x45\xc5\x0a\x80\xe3\xd8\x70\x1c\xa7\xc2\xa6\x08\x12\x8c\xb5\
\xb5\xf5\x39\x8a\x8a\xd3\x2b\xee\x09\x1a\xaf\x93\x57\x55\xba\x63\
\xdd\x17\x2c\x9d\x70\x0e\x1c\x3f\x76\x8c\x31\xde\x83\xa9\x6c\x8d\
\xbc\x9a\x31\xd5\xc0\x54\xb8\x32\x29\x63\x1d\xcf\x2d\x23\xe2\x7b\
\xde\xfc\x5c\x79\x5c\x10\x3d\x4a\xe6\x14\xb1\x84\x2f\x2c\x48\xb3\
\x09\x58\x2e\x4c\xbb\xa1\x4c\x0a\xa6\x62\x43\x8d\x56\x13\x8d\x56\
\x03\x8e\x63\xc3\xd0\xd6\x58\x29\xa5\xce\x76\x57\x0e\xbd\x20\x08\
\x20\x75\x72\x63\x40\x52\x01\x89\x9e\xb8\x0d\x21\xc0\x6c\xc4\x97\
\x29\x11\x02\x11\x20\x10\x04\x11\x48\x15\x57\x30\x01\x21\x05\x24\
\x31\x24\x31\x44\x12\x30\x23\xe6\x44\x9a\xc1\xe4\x74\x97\xd5\xdf\
\xf3\xda\xdd\x8b\xb8\xe6\x95\x5f\x8e\x2f\x7f\xc9\x0b\xf1\xf8\x33\
\xc7\xf1\x37\x7f\xfe\xe7\x78\xf0\x8b\x9f\x45\x6f\x7d\x0d\xa6\xed\
\xc0\x30\x54\x19\x19\x92\x88\x9c\x78\x2c\x13\x2c\x88\x24\x48\x0a\
\x08\xa1\xbe\x97\x10\x94\x8e\x39\x25\x8d\x12\x49\xc0\xd2\xff\xe5\
\x75\x4c\xe2\xa4\xc4\x97\xc7\x9e\xa6\xe9\x45\x89\xd7\x4d\x75\xe3\
\x55\x06\xa9\x8b\x0c\x50\x34\x4d\x9a\x66\xb4\x5a\x4d\x34\x5c\xb7\
\x42\xc6\x82\x7a\xa1\x1f\xf8\x3b\x24\x2f\x8e\x7f\x51\x66\x82\xd3\
\x70\x70\xe8\xd0\xa1\xb1\x3a\x79\x85\xe0\x54\x50\x7e\x2f\xcb\xa8\
\xa4\x94\x38\xf2\xcc\x33\x55\x5a\x5d\x4c\x03\xa4\x1a\x9c\x6a\x29\
\xaf\xb4\x9c\x97\xe7\xb0\x01\x00\x0c\x87\x03\x4c\x4e\x5e\x2d\xf3\
\xe1\x3c\x15\xa8\x88\x19\x3e\x19\x08\x0c\x17\xb0\x5c\xc0\x6e\x68\
\xa3\x02\x29\x5b\xb7\x65\xc2\x76\x1d\x38\x8e\xa3\x64\x3d\x66\x04\
\x7e\x00\x66\x25\xc1\x49\x19\x28\x10\x95\x52\xbf\xcf\x48\xc4\x84\
\x14\x8b\x32\x4d\x03\x52\x08\x04\x52\x22\x90\x12\xa6\x29\xa3\x0b\
\x39\x4c\x53\x31\x0c\x11\xe5\x6f\x84\x53\xae\x20\x82\x24\x09\xc1\
\x22\xb6\x10\x68\xef\x81\x48\xe6\x27\x85\xd7\xb3\x08\xff\xa7\x2c\
\xec\xbb\x3b\x2d\xec\x7a\xc1\x6d\x78\xf1\x73\x6f\xc2\xe3\x47\xdf\
\x8b\x3f\xfd\xa3\x3f\xc2\x03\x9f\xff\x07\x6c\x6d\xac\xc1\xb2\x1d\
\x5d\x1d\x40\x82\x24\x69\xe9\x4e\x80\x64\x0c\x4e\xcc\x02\x82\x0d\
\xb0\x96\xf9\x14\xd0\x26\x8c\x11\x49\xc0\xd2\xb2\x23\x92\xb7\x4c\
\xd1\x5c\xe6\x04\x7b\x22\xa4\x9a\x74\x6c\x07\xa0\x0a\x65\xbe\x0a\
\x80\x51\x5c\xbd\x62\x8e\x00\x55\x92\xca\xa8\x64\xec\x8a\x1f\xbb\
\xdd\x96\x17\x39\x8b\xb6\x38\x7f\xae\xa8\x4f\x17\xe5\x93\xe4\x29\
\xe0\x34\x31\x8f\x29\x21\xe5\x77\xbb\x9b\x65\x40\xa9\x6c\x5b\xf5\
\x7a\x5c\xc5\xc0\xb4\x9d\xea\xe2\x29\x29\x0f\x89\x8b\x73\xae\xee\
\x2a\x0e\x57\xeb\xea\x33\x7c\x32\x31\xb2\x34\x4b\x32\x75\x7c\x48\
\x03\x84\x30\x0c\x98\xa6\x09\xdb\xb2\x34\x28\x49\xf8\xbe\x07\x12\
\x02\x16\x18\x32\x10\xf0\x7d\x1f\x32\x08\xd4\x63\x96\x05\xc3\x10\
\xba\xb0\xa5\x9a\x60\x0c\xc3\x40\x10\x98\xca\xda\x2d\x84\xfe\xb7\
\x91\x88\xa1\x31\x02\x93\x61\x4a\xd5\x3e\x5b\xdd\x4c\x1d\xeb\x09\
\xc1\x87\x21\x88\xc1\xa4\x56\xa9\x8c\x74\xb7\x8a\x71\x06\x45\x08\
\xc3\x4a\xcc\x0c\x53\x58\x78\xf1\xcd\x87\xf1\xbc\x1f\xfc\x5e\x3c\
\xf2\xcc\x7b\xf0\x07\xff\xe9\x3f\xe3\x81\xcf\xfd\x1d\x7c\x29\x61\
\x5a\x16\x48\xb7\xee\x56\x52\x9e\xd0\xb2\x5e\xbc\x3f\x8a\x3d\x49\
\xc5\xaa\x44\xd2\x24\x41\x10\xc4\x11\x40\x21\x62\x4f\x42\xe3\x12\
\x8f\x03\x14\x32\x0d\x3a\x28\x27\xdf\x89\x73\xe7\xb9\x0a\x32\xdf\
\x76\x00\x8a\xe6\xd3\x60\x70\x1b\xd8\x40\x82\x66\xda\x83\x32\x2d\
\x2f\x4a\x5d\x41\xcc\x53\x8f\x51\x78\x6e\x2d\x2e\xc5\x75\xf2\x0a\
\x3f\x8c\xa6\x4b\x77\x49\xd0\x22\xa1\x40\xb6\xb7\xb5\x15\x60\xb2\
\xe1\x61\x16\x77\x5e\x3d\xae\x32\x60\xda\x4e\x75\xf1\xdc\x13\x68\
\xae\x1d\x48\x93\x2c\x49\x9b\x1b\x02\x61\x02\x96\x0b\xb2\x5c\x98\
\x86\x48\xb4\x37\x57\x31\x14\x43\x10\x4c\x53\xc5\x65\x98\x25\x64\
\xa0\x98\x88\x30\x0c\x08\x22\xf8\x81\x0f\xd2\xa1\x30\x21\x04\x98\
\xa5\x0a\x58\x47\x95\x13\x14\xeb\xf2\x03\x5f\xbb\xef\x4c\x18\x86\
\x80\x6f\x68\x60\xd2\x72\xa0\x15\x48\x04\xa6\x81\x20\x90\x91\x3c\
\x98\x65\x7e\xa9\xf9\x5d\x08\x10\xab\x2b\x51\x50\x7a\xa5\x29\x34\
\x9b\x4a\xae\x6a\x4d\xa1\x41\x52\x10\x5e\x72\xcb\x0d\x78\xee\x4f\
\xfe\x18\xee\x7d\xf4\x49\xfc\xce\xaf\xfc\x32\x8e\x3d\xfe\x08\x4c\
\xd3\x82\x61\x9a\xda\xe0\xa0\x98\x52\x28\xd5\xb1\x64\x90\x90\x90\
\x1a\x9c\x48\x83\x93\x20\xa1\x9e\x27\x86\xd0\xaf\x57\xb2\x9f\x7e\
\xaf\x10\x91\xb0\x97\x9d\xa0\x42\xf6\x44\x14\x37\x2c\x64\xca\x24\
\x09\x4f\x9b\xe0\x26\x10\x24\x9e\x14\xb9\x2f\xe5\xe6\x23\xec\x7c\
\xff\xdb\x09\x00\x13\x48\xec\xdb\xb3\x1b\x96\x65\x55\xda\x8b\xb2\
\x2d\x2f\xe6\x09\xb2\x7e\x61\x9d\xbc\xc9\xa6\x87\x22\x70\x0a\x97\
\x28\xbe\x1f\x60\x0e\x32\x5e\x0d\x48\x57\x31\x30\x71\xc9\xe7\xcb\
\xb4\xbd\xe0\x9d\xd8\xbb\x74\xfd\x36\x86\x0f\x03\x43\x2d\xdd\x59\
\x96\x09\x23\x6a\x43\xae\x2e\x0c\xa1\x2b\x2b\x80\xa0\x65\x2d\x80\
\x65\x80\x40\x52\x14\x4f\x22\xbd\xdb\x1c\x04\x4a\x5a\x33\x0c\xcd\
\x9c\x62\x5b\xb8\x61\x18\xea\xa2\x25\xd2\x96\x70\xcd\xa8\x84\x80\
\x0c\x02\xc5\xc0\x02\x13\xbe\x8e\x63\x19\x86\x92\xfb\x22\x23\x44\
\xc4\xa0\x8c\x10\x2f\x13\x67\x93\x50\x4e\x3d\xa5\x00\x42\x42\xb3\
\x17\x0a\x25\x35\x64\xab\xbb\xc2\x80\x32\x59\x18\xc2\xc6\x2b\x5e\
\xf8\x5c\x3c\xef\x57\x7f\x05\x7f\xfd\xe9\xbf\xc7\xef\xfe\xda\x2f\
\x63\xb0\xd5\x85\xe5\x38\x10\x24\x20\x43\xf6\xc4\x02\x4c\x31\x18\
\x85\x80\x25\x38\xae\x9b\x27\x28\x1d\x87\x8a\xc0\x49\xff\x1d\x97\
\xf6\x28\x4f\x11\x4a\xd6\x3a\xca\x0a\x7c\x13\x56\xdf\xc5\xf3\xe8\
\x54\xe7\xdd\x54\x80\xba\x74\xf0\xc4\x50\xf1\xca\xc9\x2d\x2f\xc6\
\xc1\x77\x38\x18\xa8\x96\x17\x17\xa5\xde\xbe\xd2\xa0\x9b\xcd\xb8\
\x4e\xde\x38\x08\x55\x37\x3d\xa8\x5f\x4e\x60\xab\xb7\x05\x28\xe3\
\x43\xb6\x88\x2b\x97\x00\xa9\x39\x4a\x2c\x35\x30\x5d\x89\x72\x5e\
\x95\x22\xae\xf3\x5f\xe1\x8c\x39\xee\x54\x3c\x69\x68\x34\x41\x96\
\x03\xd3\x10\x10\xa4\xf3\x7b\xa5\x7a\xa5\x61\x18\x3a\x96\x12\x17\
\x5d\x05\xb3\x06\x12\xcd\x5f\x84\x04\x07\x4a\xc2\x93\x86\x0f\x90\
\x7e\x9f\x61\x64\x56\xb0\x71\x55\x06\xc3\x10\x30\x2d\x1f\x86\x4e\
\x82\x65\xcd\x8c\x0c\xc3\x87\x6f\x99\xf0\x83\x40\x95\x29\xd2\xac\
\x29\x66\x4f\x12\x92\x2d\x55\x11\x82\x19\x0c\x03\x6c\x00\x92\xa1\
\x18\x1d\x04\x48\xe8\xf0\x12\xa5\x25\xb3\x78\x62\x8b\x8f\x82\x41\
\x04\x13\x04\xc9\xc0\x9e\x4e\x0b\xef\x7d\xeb\x1b\xf1\xf2\x2f\x7b\
\x29\xfe\xef\xdf\xf9\xbf\xf1\xb7\x7f\xfa\xdf\x61\xda\x36\xcc\x90\
\x3d\xe9\x38\x83\x08\x41\x8a\x19\x42\x30\xc0\x02\x24\x38\xc1\x98\
\x94\xc4\x28\x88\x95\xa4\xc7\x8a\x31\x85\xb1\x0f\x65\xb0\x28\x30\
\xdf\xa5\x62\x4f\xb1\xbc\x57\x08\x50\x15\x3a\xba\x97\xaa\xa5\x37\
\xf5\x69\xba\x44\xe0\x84\x02\x60\xa2\x8c\xab\x30\xde\xb7\x91\x37\
\x52\x4c\x9c\xb6\xf9\xc1\x25\xd9\x93\xaa\x93\xb7\x0f\xa6\x69\x46\
\xea\xdf\x38\x08\x4d\xb6\x84\x17\x7e\x8c\xfa\xee\xdb\x69\x0e\x58\
\x9b\x1f\x6a\x60\x9a\xda\x62\x7d\x92\xac\x97\xdf\xdc\xab\x6a\x00\
\x77\x4a\x01\xd6\x10\x94\x46\x66\x13\x64\x3a\x30\x0c\x3d\xe5\x48\
\x8e\x2b\x7f\x13\x01\x86\x48\xac\xb7\x19\x2c\x03\x48\x19\x44\x05\
\x5a\x15\x38\x29\x53\x83\x0c\x7c\x04\x9a\x15\x18\x3a\x86\x14\x5d\
\xbd\x61\x45\x05\x6d\x2a\x10\x9a\x31\x99\xa6\x09\xc3\x34\x55\x9d\
\xbc\x20\xd0\x31\x27\x1b\x41\x20\x61\x1a\x06\x82\x20\x80\x1f\x04\
\xf0\x7d\x5f\xd7\x1e\x53\xec\x29\x08\x0c\x04\x96\xa9\xf7\x01\xb0\
\x0c\x06\x43\x44\x6b\x4c\x43\x08\x40\xaa\xa9\x8a\x04\x60\x90\x88\
\x72\x9f\x22\x80\x48\x1c\x9f\x18\x4c\x08\x37\xee\xdf\x83\x8f\xff\
\xc0\xc7\xf0\xaa\xaf\xfa\x2a\xfc\xea\x4f\xff\x38\x7a\x1b\x1b\xb0\
\x5d\x37\xca\x5d\x0a\xc2\xca\x10\x61\x75\x74\xc1\x51\x1c\x8a\x42\
\xe7\x1e\x0b\xf5\x78\x28\x85\x26\x00\x8a\x88\x21\x10\xb2\x27\x11\
\x27\xe6\x8e\xc5\x9e\xd2\xf2\x5e\x12\xa0\x68\x86\xd9\x76\x9e\xe0\
\x74\x31\xb9\x93\x94\x12\xd7\x1e\xd8\x17\x97\x84\xca\x26\xba\x16\
\xb8\x0e\xfb\xfd\x3e\xa4\xe4\x54\x42\xf6\x5c\x41\x29\x67\xb4\x5a\
\xcd\xf1\x3a\x79\x55\xa5\xbb\x1c\x99\xf6\xdc\xb9\x73\xd3\xa4\xbc\
\x69\xf1\xa5\x9a\x35\xd5\xc0\x34\x95\x15\x95\x61\x4b\xa9\x2e\xb6\
\x54\xe2\x94\x2a\x9d\xc9\x9f\x00\x25\x98\xb6\xc6\x9e\x84\xd5\x5b\
\xb7\x17\x30\xc2\xd2\xfd\x1c\xba\xe2\x54\x7b\xeb\x40\xe7\x54\x85\
\x96\xf0\x90\x0d\x05\x3e\x45\x18\x2a\x84\x88\xe3\x2a\x22\xdd\x1e\
\x3a\x69\xa4\x30\x2d\x0b\x96\x65\xc3\xf7\x1d\x78\xa6\x07\xc3\x34\
\x75\x79\x7f\x1f\x86\x30\xe0\x79\x26\x6c\xdb\x47\x10\xd8\xd1\x67\
\xfa\x41\x00\xdb\xb2\x20\xa5\xda\x57\xa9\x0d\x12\x26\x33\xd8\x60\
\x30\x0b\x45\xec\xb4\x3d\xdd\x88\xa6\x71\xc5\x3e\x54\xe2\x2e\x45\
\xf9\x51\x0c\x86\x64\x82\x64\x95\x33\xc5\xcc\x30\x1b\x36\xde\xf4\
\x8a\x2f\xc5\x0b\x7e\xff\xff\xc1\x6f\xfd\xd6\xef\xe0\x93\xff\xfd\
\x0f\x61\x3b\x4e\x14\x7b\x0a\xc1\x49\x81\x10\xab\x5c\xa7\x10\xa0\
\x44\x08\x46\x22\x06\x2e\xfd\xb3\x52\xc8\x9e\x38\x96\x45\xa3\xc4\
\xdc\xec\xf4\xaf\xcd\x1d\xf9\xcd\x0a\xb9\x1c\x38\xe5\x24\xe7\xce\
\x03\x9c\x2e\x2a\x77\x62\xc0\xb6\xac\xb1\x4f\x26\x14\x74\x20\xd6\
\xf7\xd7\xd7\x56\x35\x40\x18\x73\xb8\x8c\xcb\xb1\x26\x22\x91\x13\
\x19\xa6\xea\x71\xa5\x54\x0c\x92\xf0\xc8\xc3\x0f\xa3\x04\x53\x2a\
\x93\x5c\x5b\x83\x52\x2d\xe5\x95\x92\xf7\x80\xc9\x2d\x91\xa3\x55\
\x63\xc8\x28\x92\xf9\x46\xd5\x57\xcd\x09\x50\xb2\x6c\x18\x14\x82\
\x92\x06\x26\x56\x26\x04\x61\x88\xc8\xa9\x17\x3e\xce\xcc\x60\x6d\
\xf1\x4e\x02\x13\x4b\x86\x0c\xcd\x12\x51\xcb\x0b\xe8\x84\x5b\x01\
\x41\x6a\x5a\x0e\x7c\x3f\xca\x6b\x12\x86\x01\xc3\x30\x61\xda\x36\
\x6c\xc7\x81\xe5\x8d\x60\x59\x36\x0c\xd3\x84\xef\x79\xf0\x1c\x5b\
\xd5\xcc\x33\x2d\xf8\x81\xad\xcd\x11\x12\x32\x08\xe0\xdb\x16\x7c\
\x3f\x50\xf2\x9e\xde\x2f\xc9\x0c\x4b\x1a\x08\xa4\x81\xc0\x60\x58\
\x06\x22\x06\x14\x08\x8a\xab\x4a\x80\xa2\x1b\x51\xec\x5e\x33\x48\
\x31\x14\x66\x46\xc0\xea\xaf\x20\xc6\xa1\x3d\x4b\xf8\xd1\x1f\xf8\
\x1e\xbc\xec\x2b\xbe\x02\xbf\xf1\x73\xff\x1c\xfd\xad\x2e\x2c\xdb\
\x01\x11\x41\x52\x32\x8e\xa4\x6d\xdf\x3a\x9e\xa4\x58\x14\x6b\x8b\
\x79\xd8\x02\x04\x10\xa1\x84\x47\x2a\x76\x90\xc7\x9e\x52\xcd\x0f\
\x91\x6d\x56\x48\x09\x35\x68\x76\x70\x02\xa6\x98\x22\x4a\x9e\x4d\
\x17\x03\x9c\x98\x19\xed\x76\x2b\x5d\x52\x2a\xd1\xa7\x6b\xad\x37\
\xc0\x30\x08\x00\x06\x0c\x02\x5a\xb6\x05\xd7\xb6\x70\xfa\xcc\x59\
\xb5\x70\x8a\x98\x2a\x55\x6e\xcd\x3e\x19\x87\xc6\xb7\x75\xe8\xf0\
\xe1\x1c\x50\x9f\xee\xbc\x9b\xf6\xf8\x53\x4f\x3d\x09\xe4\xd7\xc8\
\x2b\x5b\x8e\xa8\x36\x3f\x5c\xe5\xc0\xc4\x25\x59\x53\x99\xe4\x5a\
\x19\xae\x98\xbc\xd1\x10\x83\x7e\x0f\xad\x76\x67\x7b\xa0\x04\x03\
\x23\xb3\x01\x98\x16\x8c\x48\xba\x93\x3a\xc6\x23\xe3\x55\x9f\x9e\
\xa4\x95\xac\x27\x21\x03\x40\x0a\x35\x19\x87\x5f\x49\x49\x6a\x2a\
\xb6\x84\x51\x2c\x35\x41\xb2\xd6\xf6\xb5\x74\x27\x08\x90\xac\xac\
\xe4\x32\x50\x52\x9e\x10\x10\x86\x09\xcb\xb6\xe1\xb9\x2e\x2c\xc7\
\x85\x65\x3b\x30\x2c\x13\x43\xd3\x82\xe3\xd8\x30\x2d\x0b\xa6\x61\
\xc2\xf7\x1d\x04\xbe\x8f\xc0\xf7\xe1\x79\x3e\x6c\xcf\x82\x63\xdb\
\x0a\x14\x59\x82\x25\xc3\x97\x12\xbe\x69\xc0\x32\x4d\x58\x52\xe5\
\x57\xb1\x8e\x8f\x89\x20\x9c\xbe\x55\x6c\x07\x89\xb2\xb8\xa4\xc1\
\x2a\xfa\xc1\x88\x60\x30\x2b\xf3\x84\x64\x04\xcc\x68\x3b\x36\xde\
\xfe\xba\xaf\xc4\x73\x6f\xfd\x4f\xf8\xe7\x3f\xf2\xa3\x38\xf2\xe8\
\x43\x70\x1a\x8d\x54\x2d\x3d\xd6\xa5\x8a\x92\x66\x07\x08\x65\x0a\
\xe1\x10\xe8\x18\xb1\xac\x27\x84\xb6\xbd\x0b\x48\x40\xb3\x4b\x09\
\x42\x7e\x62\x6e\x68\x88\xe0\xbc\x4e\xba\x05\x93\x64\x2a\xc8\x51\
\x60\x29\x9f\xea\xd8\x2b\x49\x18\x78\x87\x2f\xa8\x86\xeb\x00\x48\
\xb7\x34\x01\x03\xe7\xb7\x7a\x38\xba\xd1\x4b\xe4\xcb\x11\xa8\xef\
\xa1\x6d\x9b\x68\x5d\x7f\x1b\x3e\xf1\xeb\xbf\x83\x3b\xff\xee\x33\
\xb8\xff\x73\x7f\x8f\xb5\x95\xb3\xe8\x75\xbb\x60\xd6\x69\x01\x44\
\x15\xf6\xbf\x1c\xa0\x45\x75\xf2\x4a\xc6\x90\x8a\x5e\x96\xad\xa5\
\xf8\xc8\x43\x0f\x63\x46\x50\x9a\x14\x52\xa8\xc7\x55\xcc\x98\xa6\
\x75\xb2\x9d\xd2\x2c\xb0\xda\x85\x31\x0d\x94\x86\x86\x0b\x18\x21\
\x28\x69\x33\x81\x94\x91\xf9\x40\x01\x49\xc8\x94\xa4\x9a\x0c\x75\
\xa0\x5f\x06\x01\x7c\xbd\x2d\x45\x02\x24\xa4\xaf\x12\x6a\x83\xc0\
\x4f\xc5\x9d\xa2\x9c\x1f\x9d\x53\x24\x03\x09\x19\xf8\x0a\xe8\xa2\
\x78\x93\x01\xc3\xb2\x60\x3b\x2e\xec\x46\x13\x96\xe3\xc2\x30\x2d\
\x08\xc3\x80\xed\xe8\x24\x5e\xd3\xc0\x70\x68\x63\x34\x74\x31\xd2\
\x89\xbd\xae\xeb\x24\x12\x72\x49\x5b\xcc\x2d\xd8\xa6\x89\xc0\x92\
\x08\x4c\x53\x39\xf9\xc2\xd6\xeb\xac\xdc\x77\x6c\x00\x82\x8c\xb0\
\x7c\xbb\xf6\x3b\x51\xa2\x86\x5d\xdc\xf1\xd6\x00\x60\x1a\x84\x80\
\x19\x1e\x29\x3b\xf8\x73\x9f\x73\x00\xbf\xf2\xeb\xbf\x86\x5f\xfb\
\xb7\xbf\x89\xbf\xf9\xe3\x3f\x80\xe5\x38\xca\x92\x4c\x89\xbc\xa5\
\x84\x13\x2f\x94\xf9\x42\xe3\x44\xe8\x28\x8c\x65\x3d\x11\xb9\x08\
\x23\xb3\x86\xd2\x41\x53\x80\xc4\x1c\xf7\xc3\x50\x21\xa7\xd0\x35\
\x99\xec\xee\x3b\x81\x3d\x6d\x4f\xb1\x9b\x6f\xe9\xed\x19\x2f\xa1\
\xc5\x4e\x67\xec\xb1\xa1\xe7\xe3\xe9\x0b\x1b\x60\xbd\x90\x42\x18\
\x47\x24\xc2\x96\x2f\xb1\xb8\xb4\x84\xf7\xbe\xe3\xed\x78\xcf\xd7\
\x7d\x2d\xb6\x06\x43\x6c\x76\xbb\xd8\xd3\x69\xe2\x73\x5f\xfc\x02\
\x3e\xfe\x91\x0f\xc3\x1b\x79\x98\x6a\xf4\x43\x85\xc6\x84\x44\xa9\
\x3a\x79\xb9\x50\x53\x5a\xd2\x8b\x87\x94\x12\x8f\x3d\xfa\x48\x08\
\x40\xc1\x8c\x4c\xa9\x66\x4e\x35\x30\x15\x4a\x77\x45\x72\xde\xc4\
\x66\x81\xdb\xbd\xf6\x15\x28\x09\x0c\x84\x03\x18\x66\x0a\x94\x58\
\x4a\x48\xa9\xe4\xb8\x74\x17\xd7\x84\x8c\x27\xa5\x8a\xc3\x68\xf3\
\x03\xab\xfa\x43\x0a\xac\x74\xa5\x07\x6f\x38\xd2\xcf\x29\xb9\x8d\
\xf5\x05\x25\xa5\x5e\x93\x73\x0c\x4c\x61\xab\x08\x21\x94\x73\xcf\
\xb4\x1d\x38\xcd\x3e\x2c\xa7\x01\x91\x04\x26\xb7\xa1\xe3\x50\x26\
\x46\x8d\x06\x82\x76\x4b\x35\x12\x1c\x8d\x30\x18\x0c\xd1\x68\xb8\
\xf0\x5a\x4d\xb8\x8e\x03\xdb\xb6\x95\xc4\x17\x58\xb0\xac\x40\xd9\
\xcc\xa5\x02\x28\xdb\x90\x90\x96\x01\x02\x60\x19\xda\xfe\x1d\x16\
\x80\xcd\x4c\x44\x94\x99\x6e\x09\x04\x61\x08\x04\x02\xf0\xa5\xc4\
\x81\xc5\x0e\x7e\xec\x87\x3e\x86\x2f\xfd\x8a\x97\xe3\xd7\x7e\xfa\
\x27\x30\x1a\x0c\x60\xd9\x36\x40\x2a\x46\x15\xb6\xc8\x50\xf2\x11\
\x8d\x81\x54\xf4\xd3\x33\xa2\xa4\xdf\x50\x32\x25\x5d\xa8\x36\xea\
\x97\x90\x29\x5a\x1a\xb6\x8e\x27\x6d\xe3\xa7\x54\x0b\xdd\x12\xec\
\x69\x07\xc1\x65\xa7\xe1\x69\x71\xa1\x93\x90\xf6\x94\xbc\xf7\xe4\
\xd9\x0b\x38\xbf\xb9\x85\x46\x58\xcd\x5e\xea\xde\x5e\x42\x19\x76\
\x54\x3f\x2f\x75\x5c\x76\x2f\xb4\xf1\xd2\x43\x07\x60\x12\xe1\x45\
\x87\xde\x05\x30\xf0\xb1\x0f\x7d\x03\x4c\x1d\x47\x9d\xdc\xc1\x83\
\x4a\x31\x27\x22\x11\x55\x40\xaf\x56\xa4\x35\xff\xf1\x24\x6b\x1a\
\xf4\xfb\xdb\xa9\x26\x5e\x8f\x1a\x98\x72\x99\x51\x15\x39\x2f\x06\
\x27\x66\x3e\xf6\xc4\x23\xfc\x9c\x9b\x6f\xa3\x4a\x9f\x9c\xba\x58\
\x18\x1e\x0b\x0c\xc8\x01\x44\x06\x94\x82\x40\xc5\x68\xa4\x54\x13\
\xaa\x88\x3b\xb6\x46\x57\x2a\x33\x64\xe0\xab\x09\x30\x0c\xe6\x4b\
\x99\x00\xb6\x00\x81\xe7\x21\x18\x0d\xe1\xfb\xaa\x14\x91\x92\xf7\
\xa4\x76\xda\xc9\xc8\xe5\xc7\x52\xc6\xd3\xbd\x2e\xe1\x23\x84\x01\
\x32\x0c\x0c\xfb\x5b\x09\x60\x32\x61\x39\x2e\x9c\x86\x0b\xd3\xb2\
\x60\xdb\x0e\x86\xfd\x1e\x36\xd7\xd7\xd0\x68\x36\xd1\x6c\xb5\xd0\
\x6c\x35\xf5\x7e\x49\xf8\xbe\x0f\x6b\x34\xc2\x48\x37\x23\x74\x6c\
\x1b\x81\x13\x80\x59\xcb\x3f\x32\x76\xb2\x59\xa6\xa1\xf3\x9d\x04\
\xcc\x6c\xfb\x6a\x8c\xe7\xac\x86\x15\x24\x04\xa0\xdb\x75\x30\x84\
\x63\xe1\x1d\x5f\xf5\x4a\xdc\x78\xfd\x7f\xc2\xcf\xfc\xc8\x8f\xe0\
\xe4\xd3\x4f\xc0\x76\x5c\x75\xec\x82\xd0\xdc\xa0\x18\x91\x10\x88\
\x00\x2b\x39\xb3\x2a\xa5\x4f\x1d\x17\xc1\x0c\x29\x04\x84\x9e\x61\
\x42\xf7\xa2\x02\x28\xa1\x63\x4e\x49\xe1\x2d\x36\x46\x64\x5d\x7b\
\x53\xd9\x53\x21\xa8\x6c\x07\x5a\x76\x9e\x35\x99\xba\xfc\x55\x08\
\x34\xbd\xe1\x10\x4f\x9c\x3a\x83\x91\x04\x86\x43\x2f\xaa\x64\x6f\
\xea\xa4\x6d\x4b\x57\x2d\x09\xeb\x33\xde\xb4\x67\x19\x46\x22\xf9\
\xfa\xbd\x5f\xf3\x16\x7c\x9f\x10\x53\x15\xb7\xb2\xdf\x8c\x99\xe1\
\xba\x6e\xa2\x4e\xde\xc4\xee\x4a\xa5\x1f\x27\x22\x8c\xbc\x11\xd6\
\xd6\xd6\xfc\x1c\xb6\x34\x29\x36\x5d\x33\xa5\x1a\x98\x4a\xb3\xa5\
\x4a\xe0\xc4\xcc\x01\x91\xd0\xda\x17\x27\x67\x9e\x82\x53\x2c\x6d\
\x0c\x27\x00\x23\x49\xe8\xc3\x04\x99\x06\x4c\x8a\x01\x42\xb1\x24\
\x19\xc9\x6d\x42\x5b\xbc\xc3\x36\xe5\x71\xff\xa5\x90\x55\xa9\x59\
\x9a\x01\x0d\x4c\x41\xb4\x1d\x7f\x34\x82\xef\x0d\xe1\x0d\x87\x91\
\xc1\x41\x06\x3e\x7c\x4f\xdd\xe7\x4c\x79\xd1\xb0\xfb\xab\x52\xae\
\x14\x20\x7a\x83\x01\x0c\xb3\x0b\x32\x2d\x08\xd3\x82\x69\xd9\xb0\
\x1c\x47\x19\x0d\x84\x80\xe3\x38\x70\x1a\x0d\x78\xc3\x21\x46\xc3\
\x21\x86\x83\x01\xbc\x91\x87\xe1\x70\x88\x56\xab\x85\x46\xa3\xa1\
\x0c\x11\x52\xa6\x64\x3e\x66\x86\x67\xe8\x12\x43\x9a\x31\x09\x98\
\x3a\x1e\xa4\xf1\x36\x31\x33\x14\x15\xf6\x0e\x01\x8a\x84\x96\xff\
\x40\x78\xf1\x4d\x87\xf0\x2f\xff\xed\xaf\xe1\xe3\x1f\xfb\x5e\x1c\
\x7d\xfc\x61\xd8\x4e\x43\x81\x93\x54\x74\x28\x4c\x52\xa6\x04\xe8\
\x84\x1f\x25\x32\x3f\x62\x54\xa9\x02\x0a\x34\x43\x93\x88\x86\x2a\
\x10\x44\x0c\x4b\x89\x4a\x11\x63\xae\xbd\x04\x7b\x02\xca\xdb\xca\
\x27\x82\x13\x5d\xda\x29\x4d\x08\x91\x68\x12\xa8\x58\xfc\x56\x7f\
\x80\xa3\x27\x4f\xc3\xb2\x1d\x38\xae\xab\x3b\x24\x5b\xb0\x74\xf5\
\x7b\x43\xc4\x8d\x26\x0f\xef\xdb\x85\x96\x95\x76\xe6\xb5\x1d\x1b\
\xa6\x65\x23\xf0\xbd\x54\xcc\x71\xaa\xaf\x9a\x8a\x65\xbc\xec\x73\
\x55\xab\x3c\x14\xb1\x26\x5d\xfd\x64\x12\x53\x9a\xc4\x9e\xea\xd8\
\x52\x0d\x4c\x33\xc5\x9a\xf2\x2c\xe2\xd9\x13\x4d\x40\x37\x0b\x6c\
\xb6\xda\x48\xb6\xb1\xe5\x29\x93\x8d\x0f\x01\x29\x4c\xd8\xda\xea\
\xcd\xcc\x60\x6d\x1a\x08\x2f\xfa\xa8\xe8\xa8\x50\xf9\x45\xe1\x84\
\xce\x52\x6a\x29\x41\x19\x0c\x02\x96\x91\x63\x2c\xd0\x85\x5a\x59\
\x4a\x04\xbe\x87\xc0\xf3\xe0\x7b\x1e\xfc\xd1\x50\xc5\xa2\xbc\x11\
\x02\xdf\x8f\xad\xc9\x09\x07\x5c\x7c\x21\xa7\x9b\xf3\xf9\x42\x01\
\xa3\x30\x4c\x8c\x4c\x4b\x95\x2c\xb2\x14\x83\x1a\xd8\x36\x6c\xd7\
\xc5\xa0\xb7\x85\x66\xbb\x8d\x61\xbf\x15\x35\x4f\x1c\x0e\x06\xb0\
\x1d\x07\xae\xeb\xaa\x2a\xd4\x8d\x06\x5c\xd7\xc5\xc8\x73\xd1\x6e\
\x34\x60\xdb\x56\xb4\xd2\x0e\x7b\x3b\x19\x42\xc0\x17\x9c\x60\x4b\
\x94\xa9\x5b\x37\x9e\x1e\x13\x5a\xe6\x4d\xa1\x1a\x16\xfa\x92\x71\
\xd3\x81\xdd\xf8\x8d\xff\xf0\x9b\xf8\x99\x9f\xfd\x05\x7c\xf6\x2f\
\xff\x1c\xb6\xeb\xaa\x9c\x2e\x0a\x63\x48\x61\x55\x8c\x44\x2e\x13\
\x27\x93\x95\xd5\xd6\x93\xc0\x15\x15\xac\x05\x22\x50\x83\x36\x46\
\x44\x62\x1d\x25\x7a\xfd\xe4\xc4\x9d\x92\x13\x5b\x15\x80\xba\x1c\
\xe5\x3c\x22\x82\xeb\x38\x71\xec\x52\x32\xce\xaf\xad\xe1\xc8\x33\
\xcf\xa0\xdd\x59\x80\xd3\x68\xaa\x6e\xc9\xae\x03\xc7\x76\x52\x00\
\x25\x99\xf1\xd2\x1b\xae\xcb\xd9\x37\x2a\x9f\x1a\x58\x50\x01\x3c\
\x9b\x5c\xbb\xb0\xb8\x84\xdd\xbb\x77\xa5\x2a\x8b\x4f\x04\xa1\xfc\
\x28\xd4\xd8\x77\xef\x76\xb7\x80\xd9\xca\x11\xd5\x8c\xa9\x06\xa6\
\x52\xb1\xa5\x59\x63\x4d\x6a\x6a\xd2\x52\x18\x97\xf4\x10\x79\x20\
\x48\x61\xc1\x34\x28\x32\x33\x84\x4c\x89\x88\x54\x45\x83\xd0\xc9\
\x44\x71\x1f\x25\xf5\x61\xa1\x45\x5c\x17\x51\xd1\xec\x88\x10\xe6\
\xdd\x30\x3c\x6f\xa4\x64\x3c\xdf\x43\x30\x1a\xc1\xeb\x6f\x61\xd0\
\xef\xa9\xd8\x93\xaf\x1d\x73\xc9\x2b\x38\xb1\x32\x45\xa2\xd9\x9e\
\x08\x5b\x47\x68\x70\x94\x41\x00\x92\x01\xa4\x30\xe0\x8f\x86\x00\
\x01\x23\xc3\xc4\xc0\xb2\x30\xd8\x6a\x60\xb0\xb5\x85\x46\xbb\x8d\
\x5e\xb7\x8b\x5e\xa7\x83\x85\xc5\x45\xb8\x8d\x86\x8a\x43\x05\x01\
\x7c\x3f\x80\xef\xf9\x9a\xd1\x49\xb8\x9e\x03\xdf\xd5\xf9\x56\x42\
\xc0\x36\x8d\x44\xb3\x41\x03\x06\x11\x0c\x4a\xe7\xc5\x4c\x68\x28\
\xab\x63\x53\x04\x32\x00\x92\x02\xfb\x3a\x2d\xfc\x8b\x9f\xfe\x04\
\x7e\x61\x71\x11\x7f\xf5\x87\xbf\x0f\x5b\xb3\x3c\x22\xc5\x8d\x74\
\x31\x0d\x1d\x53\xe2\xb1\x0e\x4a\xac\xcd\x24\x61\x5b\x0f\x01\x28\
\x69\x4f\xdb\xf2\x65\x78\x7c\x50\xd0\x40\x23\x8c\x3b\x15\x80\x53\
\x59\x80\xda\x1e\xb0\xec\x1c\xad\x22\x9d\xc0\x1d\x9a\x58\x24\x4b\
\x1c\x3f\x79\x0a\xc7\x9e\x7a\x12\x9d\xa5\x65\x38\x6e\x13\x6e\xab\
\x05\xb7\xa1\x9a\x55\x3a\xae\xea\xa2\x6c\x59\x16\x1a\x8d\x06\x16\
\x1c\x6b\x6c\x9b\x5e\xa0\x12\xba\xa7\xa2\x13\x17\x01\x09\x8d\x1d\
\xcf\xc0\xf7\x61\x1a\xc6\x98\x55\xbc\x50\xd2\xab\xa6\xeb\x49\x94\
\x4f\xb0\x9d\x06\x48\x35\x40\x5d\xc5\xc0\xc4\xf3\x90\xf3\xe2\x85\
\x34\x57\x5a\xf3\x7a\x92\x30\x20\x0b\x2c\x04\x0c\x9d\x38\x1b\x56\
\x6c\x08\xab\x7a\x1b\x96\x15\xb5\x66\x48\x76\x72\x85\xd6\xc8\x43\
\x40\xe2\xb0\x30\x9d\x76\xf0\x09\x26\x15\xff\x90\x3e\x20\x03\x04\
\xde\x08\xbd\xcd\x75\x0c\xb6\xb6\xe0\x7b\xa3\xa8\x49\x5a\xd4\x2c\
\x2d\xcc\xd1\x49\xb1\xa7\x98\x31\x05\xa1\x26\x1f\xf6\x30\x32\x04\
\x84\x61\x41\x98\xa6\x6e\x8b\x6e\x82\x35\x0b\xf3\x86\x03\x0c\x7b\
\x5b\x18\x6c\x6d\xc2\x6e\x34\xd1\xdf\xea\x62\x34\xe8\xa3\xdd\xe9\
\xc0\x6d\x34\x23\x99\x6f\xd8\x6c\xc2\xf7\x7d\x78\xbe\x0f\xbf\xa1\
\x24\x3e\x02\x69\xc6\x44\x3a\x29\xd7\x02\x5b\x4a\xde\x63\x0d\xc8\
\xc6\x94\x95\x74\xe4\xbc\x0e\xbf\x83\xfe\x5a\x8b\xae\x83\x1f\xff\
\xa1\xef\xc5\x75\x87\x0e\xe1\x3f\xfe\xcb\x9f\x87\xe5\x68\xe6\x24\
\xa5\x06\x28\x7d\x3c\x39\x06\xaa\x14\x7b\xca\xca\x57\x50\xf6\x7c\
\x21\x95\xb4\x07\x29\xc7\xcd\x10\xa1\xa4\x07\x8e\x4d\x11\x49\x70\
\xca\x41\xd8\xe9\x00\x75\x99\xc9\x79\xcc\x4a\x9a\x33\x8c\x28\xf9\
\x9b\x25\xe3\xe4\xa9\x53\x38\xfe\xd4\x13\x68\x2f\x2c\xc2\x6e\xb4\
\xe0\x36\x5b\x68\xb4\xd4\x5f\xb7\xa9\x18\x94\x69\xd9\x78\xde\x73\
\x6f\x81\x99\xd3\xf9\xf6\xc8\xd9\x15\x04\x9e\x0f\xc3\x34\x2a\x5c\
\xc6\x93\x63\x4c\xcd\x56\x13\xa6\x39\x5e\x68\xb6\x8a\x11\x22\x65\
\x13\xd7\xd7\xe4\xa9\xd3\xa7\x80\x62\x37\xde\x24\x47\x6f\x9d\x60\
\x5b\x03\x53\x25\xb0\xaa\x0a\x4e\x00\x54\xe5\xe2\x72\xb2\x83\xb2\
\x86\x07\x64\xc0\x8c\x24\x3c\x09\xe9\xfb\xca\x05\xa7\xdb\x56\x18\
\xa6\xa9\xa5\xbc\x64\x65\x09\x65\xb3\x0e\x99\x8c\xd4\x8f\x29\x29\
\x09\x08\x7c\x0f\x5e\xe0\xeb\xc9\x55\x62\xb0\xd5\xc5\xea\xca\x19\
\x8c\x06\x83\x48\x2a\x4c\x6c\x0a\x48\x94\x39\xe2\x64\x62\x70\x8a\
\x3d\xe9\x16\x18\xa6\x09\xb7\xdd\x49\x48\x89\x01\xbc\x41\x00\x5f\
\x10\x84\xa1\x4b\x17\x05\x02\xd2\xf7\xe1\x8f\x06\x18\xf6\x7a\x18\
\xf6\x7b\x18\xf4\xb6\xd0\xeb\x2c\xa0\xd1\x6e\xa3\xdd\x5b\xc0\xb0\
\xd3\xc1\xb0\xdd\xc6\x68\x34\xc2\x68\x34\x82\xa7\x63\x5d\xaa\x6f\
\x13\xb4\x9b\x50\x03\x27\x01\x92\x0d\xb0\x69\x44\xd6\x6d\x22\x9a\
\x16\x52\x88\x00\x8a\x74\x27\x5d\x9f\x18\x4d\x32\xf1\xed\xdf\xf0\
\x6e\x34\x1a\x0d\xfc\xc6\xcf\xfe\x14\x0c\x3d\xa1\x86\x31\xa3\x38\
\xb1\x96\xd3\x00\x54\xb0\x4a\x17\x10\x90\x14\xc7\x9d\xf2\xdc\x7a\
\x91\xa4\x87\x1c\xc7\x5e\x26\xee\x94\x0f\x50\x79\xa2\xe5\xac\xa4\
\x88\xe6\xd1\x62\x30\x4d\x13\x98\xb1\xd0\x69\xa3\xd5\x6c\xc6\x95\
\x49\xc0\x68\xb9\x2e\x56\x4e\x9c\xc0\xe6\xea\x05\x18\xa6\x0d\xd3\
\x71\xe0\x36\x9a\x0a\x98\x5a\x0a\xa4\x2c\xc7\xc5\xe1\x83\xd7\x8e\
\x7d\x7d\x06\xf0\x9f\x7f\xf7\x77\xe7\x5a\xdb\x95\x99\xb1\x67\xcf\
\x5e\x98\xb9\x40\x37\x05\x84\x26\x50\x26\x22\xc2\x33\x4f\x3f\x13\
\x32\xa6\x00\xb3\x57\x17\xaf\x41\xa9\x06\xa6\xa9\xec\xa9\x8c\x84\
\x97\x38\xe1\xd4\x5b\xb6\x36\x37\xb1\x67\xff\x81\x09\x0b\x3a\xf5\
\x0f\x8f\x05\x02\x61\xc4\xa5\x86\xb4\x19\x81\x88\x60\xd9\xb6\x6e\
\x2b\x2e\x60\x98\x86\x02\xa6\x0c\x23\x93\x41\x00\x19\x30\x24\xab\
\x96\xe2\x52\x02\x32\x50\x8c\x29\x8c\x95\x0c\xfb\x3d\xac\xae\x9c\
\x45\xbf\xbb\x19\xb5\x7d\x0f\x73\x9b\x42\x09\x2d\x4c\x7e\x0d\x41\
\x49\x15\x43\x15\x71\xa9\xa3\x50\xd2\xd3\x5f\xb9\xd1\x59\xc2\xd2\
\xfe\x6b\x10\x76\x58\xf7\x3d\x0f\x83\xad\x2d\xf4\x36\xd6\x00\x1a\
\x69\xf6\x64\xa9\x5e\x4e\x81\x11\xc5\xb2\x46\xfd\x1e\x06\x5b\x5d\
\xb8\xcd\x16\xfa\x0b\x5d\x0c\xfa\x4b\x68\x0f\x06\x18\x0e\x06\x18\
\x8d\x46\x71\x22\x6e\xb8\x6f\x9a\xa1\x45\x60\xe9\xd8\xba\x0e\x9b\
\x76\x25\x32\x20\x68\x5c\xc6\xa3\x82\xe9\x43\x10\x60\x85\xef\xb7\
\x4c\x7c\xd3\x3b\xbf\x06\xcd\x66\x03\xbf\xf2\x13\xff\x0c\x81\xef\
\xab\xef\xab\xc1\x4e\x12\x25\xc0\x88\xd3\xe0\x44\xe3\x25\xbe\x23\
\xb2\x14\xfe\x23\x46\xfc\x54\x1c\x22\x94\x5c\x43\xc6\xa4\xcc\x11\
\x08\x03\x50\x85\x28\xcb\x73\x9f\xaf\xb6\xef\xf1\xcb\x32\x26\x95\
\x9d\x10\x44\x31\x39\x29\x19\xcf\xd9\xbf\x0f\xc3\xad\x0d\x04\xde\
\x10\xc2\x30\x41\xc2\x40\x57\x97\xb8\x12\xa6\xa5\x72\xcc\x4c\x0b\
\x2f\x78\xc1\xed\x39\x6a\x82\xc4\x7f\xfd\x0f\xbf\x9d\x76\x4a\x96\
\x44\xe3\x49\x58\xd6\x6a\xb7\xd5\x6f\x21\xc7\x3b\x37\x4e\x74\xff\
\x71\xc1\x6b\xf5\x66\xce\x9d\x5b\x01\x8a\xfb\x2f\x95\x4d\xae\xad\
\x41\xa9\x06\xa6\x89\x2c\xa9\x2a\x73\x92\xd3\x15\x86\x98\x89\x08\
\x28\xc3\x43\x00\x01\x81\x38\xae\x04\x40\x19\x04\x1a\x2e\x84\xae\
\xe8\xad\xec\xcf\x94\x98\xec\xf4\x84\x22\x08\x92\x80\x00\xaa\xa5\
\x39\x05\x0c\x92\x4a\x0e\x33\x84\xc0\x56\x77\x13\xa7\x8f\x3e\x03\
\x6f\x34\x4a\x25\xd5\x86\xf9\x50\x6a\xf2\x97\x30\x0c\x03\x0b\x8b\
\x8b\x30\x0c\x13\xcc\x12\xb6\xe3\xaa\x0a\xe3\x24\x72\xbf\x10\x35\
\x9a\x9a\x71\x29\x13\x86\x65\x98\xaa\xf5\xb9\x65\x62\x6b\x6d\x15\
\xc3\xde\x96\x62\x21\x96\xad\xb6\x63\x9a\x30\x8c\x40\x01\xd4\x68\
\x84\x61\xbf\x8f\x41\x4f\x31\x28\xc5\xa4\x16\x31\x1c\x0c\x54\xd5\
\x08\x1d\x53\x08\x02\x19\x83\x81\x64\x78\xc9\x2a\xe9\x6c\x00\xa6\
\x72\x0a\x9a\xa0\x5c\x70\xca\x9b\xb2\xc2\xe7\x4c\xa1\x8d\xe5\x26\
\xf0\xbe\x37\xbf\x1e\xb6\xfd\x4b\xf8\xbf\x7e\xe4\x87\xa2\x52\x52\
\x2c\x65\xc4\x42\xd3\x4c\x89\x27\x4e\x5a\xc2\xc8\x80\xd3\x34\x59\
\x2f\x55\x67\x2f\xd1\x68\x81\x4b\xcc\xae\x73\x09\x25\xcd\x0f\x9c\
\x42\xf6\xca\xe1\xc2\x47\x6f\xd7\x75\x6c\xc8\xe1\x00\x0c\x09\xdb\
\xb1\x30\xf2\x09\xdd\x2d\xf5\xfb\x9a\x96\x5a\x7c\x91\x20\xdc\xfd\
\x85\x2f\x80\xbf\xed\x43\xa9\xaf\xfc\xf9\x87\x1e\xc1\xe9\xe3\xc7\
\x74\xdf\xa4\xf9\x8d\xa5\xe5\x65\x10\x08\x32\xf7\xf7\x9c\x9d\x35\
\x3d\x70\xff\xfd\x98\xc2\x90\xf2\x2c\xe3\xa8\x63\x4c\x35\x30\x4d\
\x02\xa3\xbc\xe7\xaa\x9a\x20\x0a\x4e\xab\x71\x7b\xb8\x07\x42\x00\
\x11\x27\xc8\xea\x1a\x73\xa1\xfd\xda\xb4\xe2\x36\x0e\xa6\x36\x01\
\x84\x31\xa4\xf0\xb5\xe0\xf0\xe2\x92\x08\x58\x2a\x49\x09\x26\x58\
\xfa\x38\xfa\xd4\x13\xe8\xae\xad\x2a\x50\xd2\x71\xa4\xb0\x97\x92\
\x0c\x54\x8b\x81\x46\xa3\x89\x46\xa3\x09\xdb\x75\x61\x25\x8a\x6f\
\x72\x71\x2f\x80\x94\xd3\x30\x92\x85\x74\x6c\xca\x6d\x75\x60\x98\
\x26\x7a\x1b\xeb\xe8\xad\xaf\x21\xf0\x3c\x18\x96\x62\x4f\xd2\x34\
\xa3\x58\x94\xd4\xf1\x2e\x6f\x34\xc4\xb0\xdf\x43\x6f\x71\x0b\xbd\
\xad\x2e\x86\xc3\xa1\x72\x0c\x86\xdd\x75\xf5\x44\xee\x05\x3e\x3c\
\xdf\x8e\x99\xa2\x63\xc7\x6d\xda\x55\x29\x06\x5d\x91\xa1\x18\xa0\
\xb2\xff\x36\x04\xc1\xd2\x81\xa7\x77\x7c\xd5\xab\x10\xfc\x8b\x5f\
\xc0\x2f\xfe\xf0\x0f\xa8\xcf\x34\x0c\x05\x4a\x52\xa6\xc1\x49\x55\
\x2f\x82\x9c\x30\x5f\xe4\x81\x13\x09\x91\x6d\x31\x15\x39\xf5\x92\
\x39\x4e\x4c\x48\xc8\x87\x73\x02\xa8\x8b\xc4\x9c\x02\x29\xb1\x7f\
\xef\x1e\xb8\x8e\x83\x64\x0f\xf9\xa5\xc5\x45\x2c\xb4\x5c\x40\xfa\
\x58\x70\xd5\x39\xd0\x59\xda\x85\xb7\xbf\xf3\xdd\xf8\xeb\x4f\xfe\
\x2d\x1e\x79\xf4\x31\x74\x37\x37\xf1\xe4\x43\x0f\x20\x90\x1c\x15\
\x12\xde\x1a\x79\x78\xff\x5b\xde\x9c\xa8\x7c\x3f\xaf\xef\x0a\x2c\
\x2f\x2f\x27\xa8\x4e\x45\x10\x1a\x73\x53\xea\x23\xc8\x8c\x27\x1e\
\x7b\x8c\x4b\xc8\x78\x72\x0a\x6b\xaa\x9d\x79\x35\x30\x4d\x04\xa3\
\x69\x6c\x49\x96\x05\xa5\x6c\xa1\xcf\x91\x04\x06\x30\x00\x43\xe8\
\x02\xa2\x01\x64\xe0\x43\x08\x03\xb6\x63\xc3\xb2\x2d\x98\x96\x09\
\xd3\x34\x21\x48\x31\x26\x43\x17\x6b\x8d\x12\x6e\x83\x40\xc9\x7f\
\x64\xc2\x20\x46\x00\x46\xe0\x33\xbc\xc0\xc7\xd1\xc7\x1f\xc5\xea\
\xd9\xb3\x1a\x64\x94\x4c\x17\xe7\x43\x01\x8b\x4b\xcb\xb0\x1c\x07\
\x8d\x46\x33\xde\x47\x9e\xd0\xd6\x3b\xe7\xa1\x90\xb7\x85\xb9\x4e\
\x61\x00\xd8\x30\x6d\x34\x5a\x6d\x10\x80\xc1\x56\x17\x90\x01\xbc\
\xa1\x8f\xc0\x37\x61\x5a\x36\x58\x4a\x18\xa6\xa5\x65\xcb\x00\xfe\
\x48\xe5\x3b\xf5\x36\x37\x31\xe8\xf5\xe1\xfb\x1e\x3c\xcf\x53\x49\
\xc0\x9a\x1d\x8e\x5c\x17\x7e\x43\x26\x64\x48\x56\x55\xc7\x49\x95\
\x61\x32\x85\x80\x29\x00\xc1\x71\x95\x08\x9e\xc0\x9e\xc2\xbf\xa6\
\xa0\xa8\x9d\xfc\xbb\xde\xf8\x5a\xf4\x7e\xea\x67\xf0\x6f\x7e\xfc\
\x47\xe1\x34\x1a\x2a\xde\x04\x91\x06\x27\xfd\x66\x41\xb1\x67\x2f\
\x8f\x2a\x87\x44\x33\x99\xeb\x44\x63\xcc\x89\x74\x6e\x5a\x12\x9c\
\x54\xfc\x49\xed\x5f\x06\xa0\x68\x66\xcc\xd9\xa9\x97\x8f\x4b\x6f\
\xbe\x9f\xea\x42\x4c\x44\x58\x5c\xe8\xe0\xf0\xa1\x6b\x71\xe1\xfc\
\x79\xb4\xdb\x2d\x98\x86\xc0\x8f\xfe\xd0\xf7\xe3\xd5\xaf\x7b\x13\
\xfe\xd1\x47\x3e\x82\xfb\xee\xbb\x17\xaf\x7f\xe3\x9b\xf1\xe4\xea\
\x79\xfc\xfa\x1f\xfc\x11\xfe\xc9\xfb\xdf\x8b\xee\x68\x84\xf7\xbd\
\xff\x1b\xb0\x7a\x6e\x25\x97\x2d\x6d\xb7\x5e\xde\xf2\xf2\x72\x09\
\x10\x9a\x22\xdd\x65\x73\x9e\x98\xb1\xba\x7a\xa1\x0c\x28\xd5\x16\
\xf1\x1a\x98\xe6\xc2\x9a\xca\x48\x79\x12\xe0\x20\xef\x6d\x9c\x73\
\xc9\xf8\x9a\x2d\x99\x1a\x38\x42\x09\xcf\xb2\x6d\x55\x8f\x4e\x5b\
\x68\xc3\x96\xe6\x61\x66\xbc\x50\x8e\x00\xc8\xc0\x87\xf4\x09\x2c\
\x03\xb5\xd2\x16\x0c\x29\x08\x43\x96\x78\xf4\xc1\x07\x34\x28\x71\
\x04\x48\x52\x83\x80\x65\xd9\x58\xde\xbd\x07\x8d\x66\x2b\x66\x5f\
\x9c\x7f\x31\xd3\xc4\x6b\x3e\x31\x85\xe9\x88\x7e\x14\x37\x11\x04\
\x32\x0c\x58\x8e\xa3\xaa\x3d\x0c\x07\x18\x0d\x06\xf0\x46\x43\xf8\
\x83\x3e\x4c\xb7\x01\xc3\xb4\x54\x63\x3f\xdb\x89\x6b\xfb\x8d\x46\
\xf0\x46\x23\x65\xda\x18\x2a\x33\x84\xaa\x54\xce\x18\xb6\x9a\xf0\
\x43\xb6\xa7\xc1\xca\xd0\x13\xbd\x6d\x1a\x70\x4c\xb5\x4f\xa6\x80\
\x6e\x02\x38\xbd\x4a\x40\x04\x1c\x44\xb0\x0d\x95\x8a\xfb\xc1\xb7\
\xbf\x05\x9e\xe7\xe1\xdf\xff\xec\x4f\xa9\xfd\x17\x48\x83\x93\x56\
\xe7\xb2\x1b\x13\x19\x80\x4a\xfe\x7b\xa2\x21\x22\x14\xf4\x22\x06\
\x15\x53\xa9\x78\xee\x4b\x98\x23\xaa\xb2\xa7\x19\xa6\xba\x99\xc1\
\x89\x11\x37\x6a\x0c\x4b\xdb\x12\xd0\x6e\xb7\xf0\x9a\x57\xbf\x1a\
\xff\xf3\xcf\xff\x1c\x42\x10\x5e\xff\xfa\xd7\xe3\xe5\x5f\xf9\x5a\
\xb5\xb8\x10\x06\x16\x3a\x1d\xf8\x9e\x07\x21\x04\x7e\xf4\xdb\xbe\
\x19\xff\xee\x67\x7e\x0a\xe7\xce\x9c\x46\x7f\x6b\xab\x22\x28\x55\
\xac\x93\xc7\xd3\x40\x68\xba\x74\x97\xa4\xc0\x9e\xe7\xe1\xdc\xca\
\x4a\x30\x23\x28\xa1\x06\xa8\x1a\x98\xaa\xb0\xa6\x92\xa0\x94\x3e\
\xa1\xc2\x8a\x0c\x79\xa0\x34\x0c\x18\x01\x0c\x18\xa6\x6a\x2c\xae\
\x18\x90\x84\x69\x5b\x70\x1a\x6e\x94\xdb\x11\x56\xec\x0e\x01\x49\
\x50\x08\x4c\x52\xc5\x96\x04\x01\x6c\x42\xfa\x1e\x58\x10\x3c\x29\
\xf1\xc8\xdd\x77\xe2\xfc\x99\x53\xba\x9d\xb9\x9a\xf0\xc3\x9c\xaa\
\xa5\x5d\x7b\xd0\x6a\x77\x60\x5a\x66\x1c\xf4\x4d\xc8\x4a\xa9\x39\
\x8f\x26\x1f\x9d\xa2\x3a\x6f\x61\x5a\xa9\x08\x73\xad\x0c\x53\xbb\
\xf4\x0c\x04\xde\x08\x41\x30\x82\x0c\x02\x98\x8e\xab\xe4\x3c\xdf\
\x57\x06\x0f\x53\xc5\xb6\xc2\x0a\xe8\x9e\x06\xa9\xb0\x68\x6d\x67\
\xd0\x89\x1c\x7b\x52\x07\xd6\x05\x09\x04\xcc\x68\x58\x26\x98\x2d\
\x40\x4f\x8a\x44\xe9\x22\xdd\xd3\xe6\xf1\xa8\x28\xab\x01\x30\x0c\
\x7c\xcb\xbb\xdf\x8e\x33\x27\x4f\xe2\xbf\xfd\x87\x7f\x0f\xa7\xd1\
\x04\x48\x1d\x6f\x48\xc4\xe0\x14\xd7\x93\x1f\xdb\x16\x93\xea\xb2\
\x1b\xc9\x7e\x59\x43\x44\x32\xee\x44\x1a\x48\xc1\x09\x06\x95\x06\
\xa7\xe4\xb1\x2d\x2d\xef\xf1\xf6\xe0\x68\x16\x70\x92\x2c\xb1\x67\
\xd7\x72\x46\x7a\x53\x09\xce\xdf\xf1\x9d\xdf\x85\x0b\xe7\x57\x70\
\xcd\x35\xd7\xe0\x3b\x3e\xfa\x4f\x61\x59\x76\xf4\x8a\xd5\xd5\xd5\
\xa8\x8f\x18\x09\x81\xe3\xcf\x3c\xad\xd2\x05\x66\x62\x4a\x53\x28\
\xb2\xfe\x0c\xa5\x14\xf0\xb6\xa4\xbb\xec\xc9\xa5\x63\xa3\xdb\x49\
\xae\xad\x63\x4b\x35\x30\x95\x66\x4d\x55\x01\x2a\x9e\xed\x0b\x2e\
\x6f\x0f\x04\x1f\xa4\x0e\xae\x54\xd5\x1d\x48\x50\x82\x2d\xd9\xb0\
\x6d\x27\x92\xf2\x0c\xc3\xd0\x2d\x1f\x10\x95\xce\x61\x21\x20\x05\
\x81\x58\x02\xa6\x81\xe1\xa0\x8f\x7b\x3f\xff\x59\xac\x9c\x38\x1e\
\xc9\x77\x32\xd1\xe2\x7c\x79\xf7\x5e\x2c\x2c\x2d\xeb\x0a\x10\x9c\
\xb3\x8a\x9c\x7c\x65\x53\x11\x95\xa2\x9c\xd7\x46\xf9\x56\xaa\x97\
\x93\x30\x4d\x88\xc0\x82\x61\x29\x56\x18\xf8\x23\x0c\x46\x03\x08\
\xc3\x84\xd3\x5e\x00\x4b\x09\xd3\xb6\x23\x30\xe5\x20\x2c\x93\xe4\
\x29\x66\x18\xf8\x18\xf4\x07\xf0\x3c\x2f\x06\x5a\x8d\xa4\x7e\x10\
\xc0\x6b\x38\x9a\x45\x01\x82\x4c\xe5\x04\x4c\x31\x8e\xe9\xd3\x71\
\x08\x4e\x96\x50\x86\x88\xef\xff\xc7\xdf\x81\xf3\x67\xcf\xe0\x53\
\x7f\xfa\xff\x87\xe3\x36\x94\xc9\x51\x84\x65\x9f\xe2\x93\x41\x4e\
\x00\xbb\x88\x31\x69\x20\x8b\xf2\x9c\x00\xed\x9a\x4c\x80\x13\x62\
\x50\x8a\xab\x44\xa4\xcb\x18\xc4\xb5\xf5\x32\xf1\xa7\x1d\x8c\x3c\
\x55\x99\x25\x99\x19\x4b\x8b\x9d\xd4\x77\x08\x13\xb4\x97\x96\x77\
\xe1\xe7\x7e\xe1\x97\xe3\xfa\x8e\x71\xf2\x0f\xba\xdd\x6e\xfa\xd8\
\x15\x9c\x8c\x5c\x05\x80\xf3\x56\x58\xda\x90\xe1\x38\x0e\x0e\x1f\
\x3e\x94\x2f\x5d\x57\x90\xee\xd2\xad\x4e\xa2\xef\x31\x2d\xae\x54\
\xd6\x36\x5e\x8f\xab\x1c\x98\x78\xc2\xfd\x2a\x7d\x99\x12\xae\x62\
\x82\xd4\x9d\x5d\x45\xb8\xea\x4b\xc4\x9b\x0c\x61\xa8\xbe\x42\x2c\
\xa3\x16\xe4\x96\xed\xc0\x6d\x34\x60\xdb\x36\x2c\x4b\xc5\x98\x2c\
\x5d\xad\xdb\xd4\x39\x4c\xda\xbd\xa0\x7b\x2e\xa9\x56\xea\x42\x03\
\xd6\x17\x3f\xf3\x49\x9c\x3e\x7a\x44\xb1\x1f\x29\xa3\xc2\xac\xcc\
\x8c\x5d\x7b\xf6\xa2\xb3\xb8\xac\x0b\xb3\xa2\xb4\x5b\x8b\x26\xad\
\xca\x23\x87\x60\x7a\x45\x1a\xe5\xe8\x44\xb7\xb8\xd0\xa9\x61\x18\
\xe0\x40\xa8\x3e\x51\x52\xc2\x1b\x6d\xc1\xd4\x25\x87\x06\xbe\x07\
\xdb\x09\x94\xb4\x67\xca\xa8\xf2\x79\x10\xa8\x36\x1d\xa3\xe1\x00\
\x9e\x37\x8a\x6a\xec\x85\xfb\x2f\x99\x75\x75\x72\x35\xa9\x1b\x42\
\xc0\x14\x04\x23\x55\x8b\xae\xbc\xac\x67\xaa\xaa\xb1\x68\xd9\x16\
\x7e\xfa\xc7\x7f\x0c\x1f\x3b\x7f\x1e\xf7\xfe\xc3\xdf\xc2\x71\x1b\
\x0a\x4c\xa4\x80\xd4\x8d\x05\xa5\x54\xdd\x6e\x19\x32\xb9\x22\x49\
\x1d\x1f\x11\xc9\x79\x4a\x6e\x0d\x01\x89\x72\x4a\x55\xa5\x63\x4e\
\x09\x59\x0f\xe3\x2b\x76\xcc\x5c\x9d\x7c\xe7\x40\x8a\x19\x70\x1d\
\x27\x0d\x3c\x89\xff\xa7\xdb\xa6\xc7\xf7\xcf\x9e\x3d\x3b\xf5\x74\
\x9c\x0c\x4a\x45\xc5\xa9\x8a\xcf\xdd\x89\x7d\x95\x4a\x48\x77\x1c\
\x2d\x12\xc7\x34\xe3\x00\xe5\x12\x6c\x27\x49\x78\x35\x38\xd5\xc0\
\x54\xfa\x3a\x28\x2f\xe5\x11\xe0\x8d\x46\x18\x0c\xfa\x68\xb5\x3a\
\xa9\x7a\x5c\x1e\x13\xbc\x50\x3e\x93\x4a\x6a\x33\x4c\x43\xc9\x77\
\xba\x86\x98\xed\xd8\xb0\x2c\x4b\x55\x60\x36\xf5\x2d\x63\x7c\x60\
\x19\x00\x32\x80\x10\x84\x53\xc7\x8e\xe1\xc4\x53\x4f\xaa\xe7\x25\
\x47\x4c\x09\x0c\xec\xda\xb3\x0f\x0b\x4b\xcb\x5a\xce\xcb\xfb\x62\
\x54\xb0\x02\x9c\x00\x54\x3c\xbd\xee\x1f\x65\x6a\xeb\x85\x15\xca\
\xa3\xee\xa4\x22\x6c\xff\x1a\xc0\xb5\x4c\x04\xba\x8e\xdf\x28\x08\
\x60\x39\x6e\xa2\x4f\x94\x02\x28\x6f\x38\x84\x37\x1c\x21\xf0\x55\
\x95\xf5\x24\x68\x86\x71\x27\x21\x08\x96\x61\xc0\x12\xaa\x1d\x7b\
\x6e\xbb\x8c\x29\xfb\x9d\x04\xa7\xc5\x86\x83\x5f\xf8\xbf\x7e\x1e\
\x1f\xfe\xe0\x87\x70\xf6\xf8\x71\xd5\x32\x43\x28\x3d\x8f\x35\xea\
\xa8\xd2\x3b\xfa\x61\x42\xba\x88\x5e\x04\x78\xa4\xc0\x8b\x00\x21\
\x05\x20\x24\xa4\x14\x10\x22\x84\xac\x3c\x70\x4a\xc8\x7a\x05\xf9\
\x4d\x3b\x01\x50\x65\x54\xc2\x49\xeb\x9a\xf0\x3c\xcb\x07\x27\x60\
\x6c\xb5\xc3\x8c\x27\x9f\x7a\x6a\x1b\x7b\x9f\x99\xcb\xa7\x6d\x88\
\x19\x0b\x8b\x8b\x71\x9d\xbc\x3c\x26\x54\x52\xba\x4b\x49\xdb\x44\
\x38\x77\xfe\x7c\x92\x31\x55\x49\xb0\x2d\xb3\x50\xae\xc7\x55\x0e\
\x4c\x93\x64\x3b\x60\x7a\xa2\x6d\x86\x50\xa4\xf0\x0a\x3e\x08\x3e\
\x93\x6a\x69\xa1\xd9\x92\x69\x59\x3a\xae\xa4\xc0\xc9\xd5\xd6\x6d\
\xd3\x34\x55\xeb\x07\x21\x60\xe8\x18\x13\x41\xb5\x46\x97\x3e\x40\
\x30\xe0\x8d\x86\xf8\xc2\x27\xff\x37\xbc\xe1\x10\x88\xaa\x1b\xab\
\xed\xee\xda\xb3\x17\x9d\xa5\x04\x53\x2a\xb1\x26\xce\x02\x12\xe5\
\x94\xf1\xa6\xb0\x72\x39\x23\x53\xed\x39\x9e\xb2\x42\x39\x2f\x55\
\x08\x36\xa3\x01\xaa\x6e\xbf\x1e\x5c\xdb\x02\x11\x30\xf2\x7c\x6c\
\x0d\x3d\x0c\x82\x00\xb6\xdb\x88\x9b\x23\x06\x2a\x16\x35\x1a\x0e\
\x55\x02\x2e\xe2\x3e\x51\x80\xb2\x29\x4b\x66\x5d\x5b\xcf\xd4\x85\
\x5b\x55\xb9\x24\xe8\x24\xd9\xb2\x53\x77\x08\x4e\x86\x20\x30\x04\
\xf6\x2f\x74\xf0\xaf\x7f\xf3\x37\xf1\xd1\x0f\x7c\x00\xbd\xee\x26\
\x4c\xcb\x02\x20\x63\x30\x0a\x59\x91\xc2\x1b\x24\x0a\x1a\x45\x7f\
\x23\x43\x84\xee\x46\xa2\x5e\xcc\xb1\x3c\x98\x99\xec\x0b\xc1\x09\
\x28\xa8\xad\x87\xc4\x39\x46\x33\x9f\xf6\x45\x33\x22\x95\x06\x27\
\x46\xab\xd9\x4c\x9e\x05\x19\x2c\xca\xad\x1e\x88\xd5\x0b\xab\xd5\
\xd9\xd2\x36\x2e\xee\xc0\xf7\x55\xbe\xde\x24\x6e\x54\xa2\x98\x6b\
\xc4\x9a\xf4\x51\x3f\x7d\xea\x14\x50\xce\x1e\x5e\x96\x41\xd5\xe3\
\x2a\x07\xa6\x49\x19\xd8\x25\x2b\x3e\x4c\x0c\x39\x00\x50\x16\x71\
\x4f\x35\x4f\x8d\xfa\x23\x85\x8d\xf6\x6c\x47\x57\x5c\x0e\x59\x93\
\x6d\xc3\x32\x8c\x28\xb1\x36\x0a\xe8\xb3\x54\x93\x9b\x50\xf2\xd8\
\xa7\xfe\xfc\x4f\x71\x4e\x5d\x10\x51\x95\x71\x60\x9c\x29\x4d\x5d\
\xed\xa6\xe6\xbb\x3c\x90\x4a\x76\x8f\xd5\x93\xa6\x0e\xd8\x0b\xd3\
\x44\xa0\x5d\x55\xc9\xc9\x35\x79\x0b\xb7\x97\xac\xf3\x97\x9c\x44\
\x99\x19\x96\x69\xa2\xc1\x0c\x3f\x90\x90\xfe\x08\x9e\x76\x2a\xaa\
\x0a\x02\x52\x55\x40\xcf\xc4\x05\x58\x4b\x79\xcc\xaa\xe8\xab\xa9\
\x8f\x97\xba\x59\xb0\x35\x22\x54\x01\x27\x00\x30\x00\x9d\x4f\x23\
\x70\xdb\x75\x07\xf0\x4b\xbf\xf5\xdb\xf8\xd8\xb7\x7c\x13\x64\x20\
\x21\x0c\x15\x34\x0a\xa5\x39\xd6\xf5\x08\x55\x36\x99\x2c\x90\xf3\
\xe2\x03\xac\x7b\xe3\xa9\x3a\xe5\x89\x58\xd3\x24\x70\x8a\xe5\x27\
\xc6\x24\xcb\x21\x8f\xd7\xe5\x2e\xf5\xba\xb2\xc0\x40\x13\xce\x25\
\x66\x60\xdf\x9e\x5d\x91\x9b\xa6\x90\x25\x21\x5d\x56\x6b\x6d\x7d\
\x7d\x1b\x8c\xaf\x5c\xb5\x87\x68\x81\xc5\x40\xa3\xd9\x82\x65\x99\
\x13\x30\xa7\x08\x84\x8a\x58\x93\xfa\x7d\x9e\x7c\xe2\x49\x4c\x91\
\xf1\xca\x58\xc5\x6b\x40\xaa\x81\xa9\x8c\x36\x50\x3a\xce\x24\x99\
\x59\x1e\x7f\xf2\x51\x79\xdd\x4d\xb7\xa6\x5a\xf8\x84\xe7\xb2\xc7\
\xb1\xe9\x21\x59\xfa\xc7\x71\x95\xe1\xc1\x71\x5d\xb8\xba\x4d\xb9\
\x63\xdb\x30\x4d\x43\x15\x32\xd5\x93\x12\x85\xb6\x62\x5d\x95\xe0\
\xe8\xd3\x4f\xe1\xa9\x87\x1f\x0c\xb3\xfb\x22\x63\x43\x6b\x61\x01\
\x8b\xcb\xbb\x54\x45\x66\x14\x94\xb2\xc9\x75\x1e\x4f\x01\xa4\x44\
\x4b\x8c\x64\x8e\xed\xee\xfd\x07\x60\x08\x81\xd3\xc7\x8e\x46\xef\
\x0f\xf3\x9b\x92\x60\x14\x79\xe5\x28\xd1\xe0\x30\x59\x69\x15\x0c\
\xc7\x32\xe1\x5a\xc0\x28\x90\xe8\x7b\x23\x0c\xa5\x84\xed\x36\x60\
\xb0\xc4\x50\x4a\xac\x23\xec\xb6\x2b\xa3\xea\x02\x61\xff\xa6\xd0\
\xb9\xa8\x62\x4d\xea\x06\xd3\x84\x43\x71\x55\x82\xb2\xac\x29\x04\
\x14\x93\x08\x2c\x04\x5e\x76\xdb\xcd\xf8\x9e\x9f\xfc\xe7\xf8\xc5\
\x1f\xfe\x01\xb8\xcd\x66\xc4\x4e\x55\x42\xb3\xd4\x15\xb5\x25\xc0\
\x42\x4b\x8b\xe9\x65\x8a\x20\x52\xf9\xd0\x1a\xa4\x04\x18\x52\x48\
\x2d\xed\x71\xbe\xb0\x9a\x71\xe9\x71\x49\x70\xca\x07\x20\x9a\xcb\
\xbc\x97\xdd\x5a\x16\x9c\xc2\xae\xb0\x54\xc6\xde\x49\x04\x29\x25\
\x9e\x79\xe6\x48\xf9\xb6\x16\x25\xc5\x45\x2a\x54\xf2\x18\x7b\xf6\
\xec\x81\x69\x9a\x71\x2f\xb0\xd2\x20\x34\x39\x5a\x79\xc7\x17\xbf\
\x00\x4c\xaf\x28\x5e\xa5\x83\x6d\x0d\x52\x35\x30\x4d\x04\xa7\x2c\
\xb3\x92\x28\xd1\xfa\x22\x3b\x94\x51\x81\xa2\xd8\x89\x30\x84\x06\
\x25\x17\xb6\xad\x58\x92\xe3\x3a\x68\xb8\x2e\x6c\xdb\x52\xb9\x4b\
\x44\x30\x04\x22\x19\x8f\x99\x21\x08\x18\x0d\x87\xf8\xe4\x9f\xfd\
\x0f\x2d\xe1\xc5\xad\xd1\x85\x61\x60\x79\xf7\x9e\x04\x53\xe2\xfc\
\xd5\xe3\x44\xd6\x44\x63\x0c\x2a\xdd\xb1\x3a\x1d\x23\x30\x4d\x13\
\xd7\x1e\x3a\x84\x33\xc7\x8f\xe9\x8b\x7d\xac\xb7\x6c\xba\x9f\x53\
\x62\x15\x1d\xfe\xc7\x89\xee\xae\x12\x0c\xcb\x10\x00\x9b\xe8\x8d\
\x3c\x0c\xfb\x0c\xdb\x75\x61\x30\x63\xd8\xdb\xd2\x25\x95\x74\xed\
\x05\xdd\xf3\x27\x64\x19\x22\xd1\x9e\x43\x08\x01\x72\x09\x06\x19\
\xaa\x69\x60\xc5\x3c\x55\x02\x60\xe8\x0e\xba\x0c\xe0\x5d\x6f\x7a\
\x3d\xbe\xf8\xf7\xef\xc6\xa7\xfe\xec\x4f\x54\x17\x5c\x5d\x74\x57\
\xf7\x68\x4c\x55\x88\x10\x88\x65\x3d\x99\x39\x66\x61\xe3\x43\xb0\
\xd0\xb9\x64\xfa\x1d\x94\x94\xbf\x38\x36\x40\x14\x95\xdf\xe0\x0a\
\x01\xb4\x39\xcf\x71\x9c\x8f\x33\xca\xfc\x80\xc9\xf5\xf5\xe7\x96\
\x86\x35\x53\xc2\x15\xc7\x75\xf2\x12\xb1\xdf\xf1\x63\x39\x21\xa0\
\x94\x67\xac\x61\x60\x65\xe5\x2c\x63\xfb\xc9\xb5\xb5\x8c\x57\x03\
\x53\x69\x79\xaf\x8a\xa4\x27\x09\x30\x38\x71\xe1\x10\x00\x4f\x2a\
\xe3\x03\x51\xdc\x78\xce\xb2\x54\xa7\x57\x65\x78\x50\xa6\x07\xc7\
\xb6\xd5\x5f\xcb\x82\x69\x1a\x51\x5e\x90\xa9\x2b\x8b\xb3\x0c\x60\
\x08\x03\xcf\x3c\xf9\x24\xce\x1c\x3f\x06\xd2\xab\xce\xd0\xcd\xb5\
\xbc\x7b\x0f\x2c\xcb\x1e\x93\xf0\xa6\xcd\xc0\xe3\x20\x34\x0e\x4e\
\x79\x72\x1f\x43\xe5\x6f\x74\x3a\x1d\x2c\x2c\xef\xc2\xda\xf9\x95\
\x78\x7e\x8d\x30\x49\xc3\x4f\x4c\x9f\xf4\xbf\x13\xaf\xd1\xdd\x5d\
\x55\xae\xae\x3a\x70\xb6\x65\x00\x60\x74\x07\x23\x0c\x65\x00\xdb\
\x55\x55\x2a\x46\xfd\x1e\x36\x43\x6b\xb9\xd4\x52\x9e\x96\x15\xa3\
\xbe\x51\x50\x0e\x3d\xc7\x34\x60\xeb\x36\xeb\x0a\x00\xab\x4d\x8e\
\xc9\x86\x83\x0d\xcb\xc4\x27\x7e\xec\xe3\x78\xf2\xe1\x87\x70\xe2\
\xa9\x27\x61\x39\x3a\x17\x47\x72\xe4\xd4\x63\xed\x86\x50\x5e\x3d\
\x75\x7a\xa8\xd4\x33\x1d\x77\x22\x52\xcc\x36\x84\x1f\x21\x75\xe0\
\x89\x23\xa7\x1e\x27\x7f\x87\xa8\x02\x39\x32\xac\xa9\xd4\x22\xfe\
\xa2\x0e\x22\x81\x56\xb3\x91\x4e\x8c\x9b\x02\x4a\x52\x4a\x6d\x1a\
\xd8\xa1\x2f\x91\xb3\xd9\x64\xd5\x87\x49\x17\x3f\x15\x81\x50\x01\
\x13\x3b\xb7\xb2\x52\x64\x7c\xc8\xeb\x60\x2b\xa7\x00\x52\x0d\x4e\
\x35\x30\xe5\x82\x51\x19\x80\x2a\x2a\xd0\x08\x66\x28\x36\xd3\x54\
\x6d\xa6\x3d\xd6\xa6\x07\x52\x6c\x89\x84\xd0\x60\xa4\x99\x92\x63\
\x6b\xab\x78\x6c\x13\xb7\x4c\x03\x86\x6e\xfb\x2d\xa2\x38\x89\x89\
\x8d\xf5\x75\x7c\xf2\xcf\xfe\x34\xea\x6c\x1b\x56\xe2\xb6\x1d\x07\
\x0b\x4b\xbb\xa2\xc7\xa7\x9e\xde\x99\x4e\xb5\xf9\x8c\x29\xa7\xa3\
\xad\x46\xdb\xb0\x72\x84\x94\x12\x96\xed\xe0\xd0\xcd\x37\x63\xed\
\xdc\xd9\x84\xcc\x47\xb1\x49\x21\xd3\x05\x37\x89\x4a\x49\xc6\x44\
\xd1\x76\x15\xab\xb0\x2d\x13\x2d\x66\x78\x92\x01\xdf\x83\x17\x4e\
\x78\xc3\x3e\xba\xeb\x88\xd8\x13\x98\x21\x28\x6e\x9e\x28\x74\x7d\
\xc1\x76\xc3\x81\x63\x18\x71\x4d\x3d\x22\x54\x2d\x07\x9a\x94\xf4\
\x76\xb5\x9a\xf8\xb9\x5f\xfe\x65\x7c\xe7\x07\xde\x0f\x7f\xe4\xe9\
\x74\x00\x56\xb1\xbf\x4c\x02\xae\xd0\x6b\x10\x99\x4c\xc4\xa5\x58\
\x04\x13\x24\xc1\x1c\xbf\x38\x6c\x3d\x92\x12\xdd\x34\x10\x15\x4a\
\x7a\xdb\x29\x57\x34\x77\x60\xa2\x89\xc5\x56\xf3\x76\xd1\xf7\x3d\
\x9c\x3f\x7f\x61\x9b\x52\x5e\xb5\x11\x16\x70\x9d\x04\x42\x53\xa7\
\x89\xd4\x6b\x09\x41\xe0\x63\x6d\x75\x6d\x1a\x53\x2a\xdb\xf2\xa2\
\x1e\x35\x30\x15\x4e\xe1\xb3\x36\x0c\x94\xc9\xd5\x60\xf8\x76\x41\
\x22\x9a\x60\x58\x4a\x58\x8e\x03\xdb\x75\x23\x70\x8a\x0c\x0f\x96\
\x6a\x35\x6d\x9b\x16\x4c\x53\xc0\x34\x0c\x55\x39\x5b\x33\x22\xcb\
\x30\xf1\xd0\x03\x0f\xe0\xe4\x33\x4f\xa9\xea\xc8\x7a\x52\x26\x22\
\x2c\xef\xde\x87\xb8\xe9\xdf\x04\xe9\x83\x32\x92\x5e\x19\x40\x4a\
\x31\x0d\x4a\x1d\xb1\xb0\xb2\xc4\xcd\xb7\xde\x8a\xfb\xbf\xf0\xb9\
\xb4\x0b\x90\x44\x2a\x9f\x29\x4a\xbe\x45\xa4\xf0\xc5\xd5\x0f\x74\
\xad\xb8\x30\x50\x1d\x76\x8b\x75\x6c\x0b\x2e\x08\xa3\x20\xc0\xc0\
\xf7\xe0\x25\x24\xc2\xad\xc4\x8a\x95\xc2\x76\xf3\xba\x8b\xaa\x69\
\x18\x58\x75\x94\x89\x04\x04\x90\x69\x46\xfb\x51\x15\x9c\x08\x80\
\xa5\xcd\x10\xb7\x1f\xbe\x0e\x3f\xf4\xb3\x3f\x8f\x9f\xfe\xd8\x3f\
\x85\xd3\x68\x26\x08\x02\x47\xdd\x87\x15\xb0\x86\x32\xa3\xe6\x4f\
\x19\xe6\x14\x1e\xa6\xc8\x0c\x91\x8c\x37\x91\x6e\x58\x87\x12\xf1\
\x26\x60\xb6\x72\x45\x73\x1e\x42\x90\xea\x0a\x5b\x41\xba\x23\x10\
\x46\x5a\x8e\xae\x2c\x3e\xce\x58\x06\x42\x31\x26\x2e\x35\x21\x94\
\x61\x4d\x44\xc0\x70\xe4\x61\x30\xe8\xfb\x98\xad\x0f\x53\x2d\xe5\
\xd5\xc0\x54\x19\xa4\x66\x28\x4b\xa4\x10\x20\xf0\x7d\x00\x8c\x51\
\x00\x8c\x24\x47\x3d\x77\x48\x10\x2c\x6d\x76\x70\xb4\xd9\xc1\xb6\
\xb5\x8c\x67\xdb\xb0\x2d\x0b\x96\x6d\x2a\x57\x9e\xae\x91\x47\x21\
\x30\x99\x26\xee\xfb\xc2\xe7\xa3\x9e\x4d\x21\x5b\x6a\x2d\x2c\xa2\
\xd5\x6e\x47\x20\x31\x8e\x4e\x09\x5d\x71\x06\x50\xca\xde\x4f\xcb\
\x49\x4a\xc2\x72\x1c\x1b\x8e\xdb\xc0\xa0\xd7\x55\xdf\x33\x72\x74\
\x27\x58\x53\x82\x45\x51\xa2\xe5\x35\x53\xdc\x39\x94\x91\x06\x28\
\x68\x59\xcc\x32\x0c\x10\x49\xf4\x3d\x0f\x5e\x62\x0f\xb6\x34\x6b\
\x10\x42\x28\xf9\x53\xc7\x97\x2c\xd3\x80\x65\x1a\x51\x0e\x98\x68\
\x10\x88\x0c\x08\x41\xd5\xc2\x33\x48\xb7\xcb\x90\x2c\xf0\x96\xd7\
\xbc\x02\x7f\xf9\x86\x37\xe1\x0b\x9f\xfc\xdf\xb0\x5d\x37\xb1\x92\
\x96\x0a\x60\x42\x21\x4f\x14\x33\x27\x2d\xe0\x29\x40\x4e\xb8\xfc\
\x54\x82\x14\x12\x56\xfc\x38\xde\x94\x0f\x4e\x19\xf6\x34\x6b\x40\
\x67\x3b\x17\x8c\x64\xb4\xdb\x6d\xb4\xdb\xed\x4a\x1f\xcb\xe0\xc8\
\xa4\xb3\x6d\xcc\x29\x01\x89\x44\x50\x75\xf2\x32\x28\xb3\x5d\xd6\
\x14\xf8\x01\x30\x3d\xae\x54\xb5\x2c\x51\x3d\x6a\x60\x2a\x04\xa2\
\x32\xe0\x94\xd5\x8f\x01\x00\xbd\xad\xae\x96\xf1\x18\x1e\x6b\x39\
\x48\x4a\x98\x96\x19\xd9\xc2\x1d\x27\x99\x50\x6b\xc1\xb6\x55\x62\
\xad\x65\x5a\xa9\x49\x15\xcc\x30\x0d\x03\x67\xce\x9c\xc6\x13\x0f\
\xde\xaf\x2e\x23\x1d\xab\x22\x21\xd0\xee\x2c\xa6\xb0\x88\x0b\x56\
\xa7\x93\x65\x3c\x4a\x03\x57\xd1\xfd\xec\x61\xd1\x76\xee\xdd\xbb\
\x77\xe1\xe0\x4d\x37\xe1\xd1\x7b\xee\x1e\x03\x24\x4a\x26\xe8\x26\
\x5c\x79\x31\x83\xe2\x28\x0f\x8a\x38\x66\x4c\x21\x1b\x08\xf7\xdc\
\x32\x94\xa0\xd9\xf7\x47\xf0\x46\xe1\x72\x15\xd8\x02\xb0\x72\xea\
\x24\x4c\xcb\x8c\x2a\x40\x44\x09\xca\x11\xc0\x6b\x33\x89\xfe\x7c\
\x81\xea\xe0\x24\x00\x58\x42\x55\x86\xf8\xc9\x9f\xfa\x71\x7c\xeb\
\xa3\x0f\xe3\xc2\xd9\xb3\xba\xa1\xa2\x8a\x13\xc5\xc5\x71\xe3\xbf\
\x51\x95\x08\xd2\x6e\xc2\x0c\x73\x0a\x0b\x7b\x64\xe3\x4d\xa1\xb8\
\x97\x2c\x51\x14\xb7\xf4\x2e\x00\xa7\xbc\xb3\x99\x76\xfa\xa2\x51\
\x76\x7f\xa3\x42\x8b\x0a\x22\xc2\x70\x30\x80\xe7\xf9\x39\xa5\x97\
\x76\x4a\x6e\x14\x68\x36\x1a\x15\x3f\x63\x0a\x6b\x22\xc2\x56\x6f\
\x0b\x98\xec\xc8\x9b\xd4\x4a\x7d\xfe\x98\x7c\x85\x0f\x71\x95\x7c\
\xcf\xed\xf4\x64\x9a\x98\xc9\xcd\xcc\x10\xaa\x5f\x6a\x64\x6d\x56\
\xb9\x4b\x9a\x2d\x69\x70\x52\xac\x49\x19\x1e\x54\x62\xad\xa9\xee\
\x1b\x26\x2c\xcb\x84\x6d\x5b\xb0\x2d\x13\x9f\xfa\xeb\xbf\xc2\xe6\
\xea\x85\xa8\x72\x04\x33\xa3\xd5\x5e\x40\xb3\xdd\x2e\xcc\x4d\x19\
\x63\x38\x59\x89\x2e\x01\x4a\x11\x84\x24\x5c\x73\xd9\xfb\x51\x43\
\x38\x0e\xbf\xb0\x8a\xf3\x18\x42\xe0\xba\x43\x87\xc6\xe1\x30\x1b\
\x63\xca\xac\x68\x23\xde\x94\x03\x8e\xb1\x69\x22\x26\x04\xb6\x69\
\xa0\x69\x19\x80\x3f\x82\x37\x1c\x20\xf0\x3c\x78\xc3\x01\xb6\x36\
\xd6\x70\xf6\xe4\x09\xac\x9c\x3e\x8d\x95\x95\x15\x9c\xbf\xb0\x8a\
\xf5\x8d\x4d\x6c\x74\xb7\xb0\xba\xd9\xc5\x7a\xaf\x8f\xfe\xc8\xc7\
\x48\x4a\x04\x3c\xdb\x0c\x10\x75\xc1\x15\x02\xd7\x2c\x2d\xe2\x13\
\xbf\xf0\x8b\x51\xe9\xa7\x54\xa7\x5d\xcd\x64\xa3\x5b\xa2\x2b\xaf\
\xfa\xdd\x54\x52\x70\x68\x5c\x89\x6e\x92\x53\x0d\x1d\x43\x70\x43\
\xd4\xea\x9e\xd3\x95\x37\x38\xfb\xab\x17\xcc\x77\x3b\xbc\x1e\x67\
\xe6\x99\xb0\xaf\xd7\xef\x23\x90\x41\xf5\xab\x75\xaa\x5d\x2f\x7f\
\x1f\x6d\xdb\xc6\xe1\xc3\x87\xa3\xdf\x6b\x7c\x12\x48\x9f\x18\x3c\
\x15\xb0\x62\x90\xad\x20\xdf\x95\xa9\x93\x57\x03\x54\xcd\x98\x26\
\x82\x51\xe5\x7c\xa6\xec\xaa\x10\xc4\x40\x18\x3f\x21\xc0\xb4\x2c\
\xe5\xbc\x73\x54\xb5\x07\xd7\x71\xe0\xd8\x8a\x2d\x39\x96\x02\x20\
\xcb\x32\x60\x0a\x25\x3b\x19\x3a\x90\x7f\xf2\xd4\x29\x7c\xf1\x53\
\xff\x07\x44\xca\x66\xcc\x3a\x76\xd5\x5e\x58\x40\x71\x60\xa9\xe8\
\x9a\x8d\x81\x68\x1a\x63\x1a\xcb\x65\x1a\x93\x71\xe2\xc9\xf5\xf0\
\xf5\x87\x61\x98\x26\x64\xe0\x47\xd2\x49\x58\xd0\x35\xee\xdb\x44\
\x09\xfe\x96\x60\x4c\x61\x17\xd7\xc8\x39\x1e\x33\xb2\x74\x32\x2e\
\x60\x19\x06\x9a\x00\x7a\x9e\x07\x5f\x03\x9e\x37\x00\xba\x6b\xab\
\x38\x67\x9a\x10\x86\x01\xd3\xb4\x94\x2c\xaa\x0b\xe1\x5a\xa6\x89\
\x86\x6d\xc1\x36\x0d\xc5\x9a\xb4\xd3\xb1\xea\x84\x1a\x15\x7c\x35\
\x04\xbe\xe2\x85\xcf\xc3\x9b\xdf\xfb\x7e\xfc\xaf\x3f\xf8\x7d\xd5\
\xc3\x29\x05\x1e\x49\xe6\x24\x15\x4b\x22\x86\x64\x55\xbf\x48\x40\
\x26\x5c\x7a\xba\x09\xa4\xe0\x28\x1f\x2a\x31\xeb\xa9\x3f\x19\x87\
\x1e\x12\x1d\x8d\x79\x2c\x4f\xab\x40\xd3\xdb\x21\x06\xc5\x0c\x74\
\x3a\x6d\x98\x66\xb5\x29\x63\x34\x1c\xa6\xbe\x4b\x65\x26\x53\x75\
\x59\x41\x39\x8c\x72\x06\xe9\x2e\xd9\x92\x84\x88\x70\xf2\xe4\x29\
\x60\x72\x7c\xa9\x4c\x9c\xa9\x06\xa5\x1a\x98\x66\x66\x4d\xa5\xeb\
\xe5\x49\x29\xb1\xd9\x1b\x80\x4d\x5b\x4b\x6f\x12\x86\x69\xc0\xb2\
\x1d\x58\x96\xce\x59\x6a\x38\x2a\x36\xa3\x63\x4b\xb6\xa5\xc0\x49\
\x4d\xa6\x71\x15\x03\xc7\xb6\x70\xcf\x9d\x77\x62\x63\xf5\x82\x6a\
\x6c\x17\x3a\xd1\x0c\x13\x8d\x56\x5b\xaf\xb4\xd3\xd3\x10\xa7\xee\
\xa0\x00\x74\xb2\xa0\x44\x51\x45\xe8\x6c\x29\x19\x1a\x93\x00\x39\
\x5a\x89\xb2\x94\xf0\x3c\x1f\xfb\xf6\xec\xc1\xee\x03\x07\x70\xf6\
\xf8\xb1\x54\xb9\xa2\xa4\x33\x2f\x7f\x62\xcc\x5a\xa2\xe3\xbc\x26\
\xa6\x7c\x6c\xb5\x75\x3c\xa9\xe7\x79\xf0\x34\xd8\x0d\xfb\x3d\xac\
\x9f\x3f\xaf\x80\xc9\xb2\xe0\xba\x61\x5f\x2b\x05\x4c\x6d\xd7\x85\
\x6b\x59\x51\xd9\x22\x31\x83\xa4\x17\xee\x83\x29\x08\xae\x69\xe2\
\x7b\xbf\xfb\x1f\xe3\xde\xcf\xfd\x03\x56\x4e\x9d\x84\x11\x26\x6e\
\xb2\x8a\x8c\x21\x6a\x7b\x21\xc0\x42\x46\x2d\x30\x58\xc7\xd5\x14\
\x58\xe9\x58\xa1\x3e\x7b\x92\x4e\xbd\xd8\x32\xae\x7f\x13\x7d\x7f\
\xac\x22\x84\xce\x1f\x2b\xf6\x40\xe4\x94\xcd\xc6\x3c\x41\x8a\xd3\
\xd5\x14\x92\x41\x1d\x2e\x0e\x7c\x6d\x6c\x6e\x68\x55\xa1\x2a\x16\
\x55\x9f\xbb\x99\x19\x0b\x0b\x8b\xd8\xbd\x7b\x77\x3a\x87\x69\x4a\
\x8e\x58\x99\x22\xc0\x47\x9e\x79\x3a\x64\x4c\x01\x26\x5b\xc3\xa7\
\x25\xd8\xd6\xa0\x54\x4b\x79\x73\x63\x4d\x99\x13\x4f\xf7\x96\x21\
\x81\xde\x60\xa0\xac\xce\xfa\x69\xd3\xb2\xe0\x36\x1a\xaa\xc5\x85\
\xed\x44\x06\x88\xd8\xfc\x10\xc6\x98\xd4\x44\x6a\x59\x26\x1c\xdb\
\xc2\xc6\xe6\x26\xfe\xe1\x7f\xff\x55\x42\x46\x53\xbb\xd4\x59\x5c\
\x2a\x12\xd3\xd3\xba\x5d\x0e\xe3\x49\xca\x77\x91\x8c\x97\x8a\x01\
\xc5\x4c\x27\x2a\xc2\x9a\x00\x97\x64\xf7\x75\x29\x25\x3c\xdf\xc7\
\x9e\x5d\xcb\x78\xce\xe1\x1b\xc0\x52\xa6\x18\x51\x0a\xf4\x32\x1a\
\x63\xe8\xda\x43\x12\x10\x13\xef\xa3\xcc\x2d\x29\xeb\x59\xa6\x81\
\xa6\x6d\x80\x7c\x0f\xbe\x37\x44\xe0\xfb\x18\xf6\x7b\x58\x3d\x7b\
\x16\x2b\xa7\x4e\x61\xe5\xcc\x59\x9c\x3f\x7f\x01\xab\x6b\xeb\x58\
\xef\x76\x71\x61\x73\x13\x1b\xfd\x01\x86\x7e\x80\x40\xf2\xf6\x24\
\x3d\x28\x49\x6f\xff\x62\x07\x3f\xf2\xb3\xff\x22\x51\x32\x29\x2d\
\xc7\x65\xa5\xb9\x58\xea\x4b\x48\x7e\x9c\x91\xf4\x72\xb6\x91\x94\
\xf3\xa2\x89\x35\x25\xe5\x71\xaa\xda\x48\x69\x0d\x6c\x0e\x53\x21\
\x33\xc3\xd6\x0b\x00\x24\x17\x22\xd9\x45\x09\xa5\xcf\xc7\x0b\x17\
\x2e\xcc\xe1\xe3\xcb\x57\x16\x0f\x02\x1f\xa6\x69\x14\x62\x5c\x59\
\xe9\x2e\x7b\xad\xdd\x7f\xdf\x7d\xd3\xa4\xbc\xda\x2a\x5e\x33\xa6\
\x4b\xcb\x9a\x38\x13\xcb\x89\xa4\x17\x28\x19\xcf\x0a\xc1\x29\x64\
\x48\x8e\x1d\xb3\x26\x3b\x94\x9f\x0c\x95\x97\x43\x80\x63\xdb\xb8\
\xeb\x9e\x7b\x70\xec\xc9\x27\x94\x8c\xa7\x2b\x87\x13\x11\x1a\xad\
\x56\x15\xfd\xae\xb0\xa0\x26\x52\xf1\xa3\x38\xc9\x36\x59\xe7\x2e\
\x95\xc7\x94\xac\x49\xa4\x83\xfb\x52\x97\x4a\x3a\x70\xed\xb5\x89\
\xe2\xa3\xd9\xcf\x4d\xb3\xae\x6c\x62\x6f\xcc\x02\x42\xd6\x41\x93\
\xbf\x11\x03\xb6\x61\x80\x40\xe8\x07\x3e\xfc\x51\x2c\xa1\x5e\x38\
\x73\x3a\x2a\xf7\x64\x5a\xa6\xea\x73\xa5\xad\xf8\x0d\xdb\xd2\x2e\
\x3f\xd5\x38\x2e\xec\x42\x5b\x75\x3a\x34\x48\x19\x32\x5e\xfe\x82\
\xe7\xe1\xb5\x6f\x7b\x3b\x3e\xf5\xe7\x7f\x0a\xc7\x71\x75\xbc\x4f\
\x1b\x14\x42\xb7\x5e\xb4\x6c\x41\x54\x0d\x82\x24\x81\x49\x42\xea\
\xd2\xe4\x82\x62\x53\x0b\x67\x8f\x33\xe2\x62\xb9\xe1\xb1\xca\x2f\
\x57\x84\xb1\x26\x83\xe9\xe3\x36\x7f\x93\x04\x33\x60\xdb\x76\xea\
\x37\x2f\x33\x36\x36\x36\xe6\x78\xd9\xe6\x7f\x87\x64\x5d\xbe\x66\
\xb3\x09\xcb\xb4\xca\x79\xd1\xa7\xb0\xa6\xe4\x63\x8f\x3f\xfe\x38\
\x30\xbd\x80\x6b\x95\xd8\x52\x0d\x54\x35\x30\x95\xb6\x87\x63\x32\
\x53\xca\xaa\x67\xe9\x22\xa5\x42\x08\xb8\x8d\x26\x1c\xb7\xa1\x2a\
\x88\xdb\x56\xe4\xc6\x4b\x82\x52\x08\x4c\xb6\xee\xc8\xca\x2c\xf1\
\xa9\xbf\xfc\x0b\xc5\x42\x22\x2d\x9e\x61\x1a\xa6\x6a\x62\xc7\xf9\
\x2b\xe1\xa9\x3d\x88\x92\x6c\x29\x05\x4a\x89\x8a\xe0\x19\x46\x15\
\xc3\x09\xa5\x18\x53\xb4\xb2\x07\xb0\x7b\xcf\xee\x9c\x9d\xa0\xcc\
\x67\x52\x5a\xf7\xe7\xb8\xac\x10\x27\x7a\x10\x4d\x8e\x3c\xc4\xcf\
\xda\x96\x81\xa1\x37\xc0\xc0\xf3\x21\x84\x80\x4f\x84\x61\xaf\x87\
\x73\xa7\x4e\x6a\x70\x72\xe0\xba\x2e\x5c\x2d\x99\xba\x8e\xa5\x40\
\xc0\xb5\x21\x2c\x2a\x6c\x4e\x57\x4a\xd2\x23\x55\x15\xe2\x07\x7e\
\xf0\xfb\x70\xef\xe7\x3f\x8b\xee\xfa\x7a\x94\x78\x1b\xc7\x9a\x94\
\x59\x45\xc5\x90\x38\xaa\x6d\xa8\x7a\x53\x85\xc9\xb6\x3a\xde\x44\
\x04\x92\x9c\xaa\x0a\x91\x92\x62\x79\x5a\x6e\x13\x72\xfb\x38\x65\
\x63\x23\xb9\x67\xc9\x8c\x00\xc5\x2c\xb1\xbc\xb8\x50\x19\xd7\x1e\
\x7b\xec\xf1\xf9\x5d\xc5\x84\x29\xe7\x09\x63\xf7\x9e\xbd\x30\x4d\
\x03\x09\x2b\x49\xa5\x0a\x0f\xb9\x05\x5e\xa5\xc4\x91\xa7\x9f\x9e\
\xd4\xea\xa2\xac\x84\x57\x83\x52\x2d\xe5\x55\x02\xaa\x69\x16\xf1\
\x8c\xf9\x41\x4d\xdc\x32\xf0\x01\x61\x44\x9b\x31\x2d\x53\x31\x26\
\xc7\x86\xad\xdd\x78\x21\x30\x85\x37\xd3\x30\x61\x5b\x26\x5c\xdb\
\xd1\x71\x27\x13\x6b\x1b\x9b\x78\xf4\x9e\xbb\xa2\xaa\x06\xe1\xc4\
\xe6\x34\x1a\x19\x71\x6c\x4a\xfc\x34\xc7\x81\x17\x03\x4e\x92\x29\
\x65\x41\x29\xed\xc8\xcb\xae\x8a\x59\x86\x56\x0c\xf5\xa9\x7b\xf6\
\xec\x8e\x5a\x63\xa4\x5c\x75\x19\x7f\x60\x4a\x80\xa1\x74\x37\x50\
\xca\xd3\xfc\x32\x37\x42\x12\x50\x95\x21\x82\xa4\x0f\x6f\x38\x84\
\xf4\x7d\xf8\xde\x10\xbd\xcd\x4d\xac\x9c\x3a\x85\x73\x67\xce\xe0\
\xfc\xb9\x73\x58\x5d\x5b\xc7\x46\xb7\x8b\x73\x6b\x9b\x58\xd9\xe8\
\xa2\x3b\xf4\xe0\x05\xaa\xe8\xaa\xdc\xc6\x7c\x68\x09\x81\x6b\x97\
\x97\xf0\xb1\x4f\xfc\x04\xbc\xd1\x28\x21\xc3\x25\x4c\x10\xc8\x91\
\xf4\x64\x42\xd6\x0b\x4d\x24\x19\xa7\x5e\x22\xf8\x94\x50\x93\xe2\
\x5c\xb5\x7c\x59\xaf\x58\x7a\xda\x09\x17\x1f\x4b\xc6\xae\xe5\x45\
\x54\x2a\xe1\xc0\x8c\xb5\xb5\xb5\x8b\x97\x13\xcc\x40\xab\xd5\xaa\
\xc0\xea\xb8\xd4\xc3\xcc\x8c\x7e\xbf\x3f\xcd\xf8\x50\xe7\x2e\xd5\
\x8c\x69\x6e\xe0\xc4\x25\xe5\xbc\xec\xca\x08\x51\x3f\x4c\xd3\x8a\
\x2a\x33\x58\x8e\x13\x35\x04\x74\x13\xb1\x25\xd3\x88\x73\x6d\x4c\
\x43\xe8\x40\xbd\x8e\x31\x99\x26\x7a\xbd\x3e\xba\x51\x6b\x80\xb8\
\x4e\x6c\xb3\xd5\x89\x94\x1e\x4e\x2e\x94\x27\x5c\x53\x49\x93\x43\
\xf2\x6f\x32\x19\x36\xae\xc4\x9d\x60\x2d\x39\x66\x88\x28\xc8\xaf\
\xe3\x23\x60\xc0\xf3\x7d\x5c\xb3\x6f\x2f\x96\xf6\xec\xc3\xda\xb9\
\xb3\x89\x4f\xa5\xd4\x47\xa6\xf1\x46\x05\xf5\xc3\x1c\x9d\xa8\x9c\
\x11\x65\x66\x02\x46\x7e\xcb\x6c\xfd\xbd\x1b\xae\x03\xc3\x10\xd8\
\x1c\x8c\xe0\x8d\x86\xca\xa9\x37\xec\x63\x73\xf5\x3c\xce\xea\x62\
\xb9\x61\xfe\x98\x5a\x04\x08\xb5\x08\x30\x0d\x55\x8b\x50\xd0\x4c\
\x2e\xbd\xa4\xa4\xf7\x86\xaf\x7c\x39\x7e\xef\x85\x5f\x82\xa7\x1e\
\x7e\x48\xf7\x6e\x4a\x80\x09\x73\x54\x88\x97\x92\xb1\x26\xa6\xf8\
\xaf\x66\x4c\xa1\x33\x8f\x52\x92\x1e\x90\x6c\x0c\xc8\xa4\xf3\x9d\
\xe2\x96\xb7\xe9\xda\x7a\x29\x70\x4a\xbb\x22\xf2\x1b\x3b\x6c\x8f\
\x41\x31\x57\xbf\xc0\x92\x52\xde\xc5\x98\xa1\x97\x96\x97\x0b\x0c\
\x19\xe9\x23\x92\x57\x61\x9c\x73\xa4\x50\x22\xc2\x68\x34\xc2\xfa\
\xfa\xda\x34\xb6\x54\x83\x54\xcd\x98\xb6\x05\x44\xb3\xb4\x57\x4f\
\xb1\xa8\x63\x4f\x3c\xc2\xd1\xca\x5f\x27\x1c\x0a\x21\x94\xe1\xc1\
\x71\xd0\x6c\xb5\x94\x7c\x17\xb5\xb8\x50\xee\x31\x3b\x4c\xb2\x4d\
\xdc\x1c\xcb\xc4\x1d\x5f\xfc\xa2\xaa\x22\x11\x36\x33\x65\x86\x69\
\x5a\x68\x34\x5b\x69\x07\x42\xe6\xf2\x9e\xd6\x65\x36\xfe\x5b\xc0\
\x98\x72\xc1\x49\xfd\xc3\x12\x80\x23\x12\x32\x9e\xae\x6c\xe1\xfb\
\x3e\x76\x2f\x2e\x60\xef\xb5\xd7\xaa\x2a\x14\x94\x0c\xb4\x51\xae\
\xea\x92\x94\xf6\x28\xcf\xd2\x8b\xb4\xcd\x7c\xac\x59\x87\x66\x71\
\xcc\x0c\xc7\xb6\xb0\xd0\x70\x21\x64\x00\xcf\xf3\x10\xf8\x01\x86\
\xfd\x3e\x56\xcf\x9e\xc1\xf9\xb3\x67\x70\x7e\xe5\x1c\x56\x2f\xac\
\x61\x63\xa3\x8b\xcd\x5e\x1f\x6b\xdd\x2d\x6c\x0c\x46\x18\x06\x01\
\x02\xe6\x89\xb3\xc3\x34\x69\xd4\x22\x81\xb6\x63\xe3\xe3\x3f\xf9\
\x13\xf1\x4c\x9d\x64\x4e\xb9\x26\x08\x8e\xf2\xd1\x22\x03\x84\x6e\
\x7c\x38\xfe\x5a\x64\x98\x54\x0c\x78\x9c\x59\x95\x8c\x83\x04\x23\
\x2f\x47\x87\xcb\x52\xa5\x29\xd3\x26\x03\x68\xb7\x9a\x95\x2e\x38\
\x29\x25\x1e\x7b\xfc\x09\x5c\xac\x42\x79\x0c\x55\xc0\x95\x32\x17\
\xc7\x64\xa3\xdf\x64\xd6\xc4\x50\x8d\x2a\x2b\x4a\x78\x12\x75\xf1\
\xd6\x1a\x98\xb6\xc9\x96\x2a\x59\xc5\x99\x39\x20\xa2\xf1\x24\x5b\
\xc3\x4c\x14\x6c\x75\x60\x9a\xca\xf4\x60\x9a\x86\xfa\xb7\x61\xc0\
\xb6\x2d\xb8\x51\x2e\x93\x05\xc7\xb6\xc0\x0c\x7c\xf6\x93\xff\x47\
\xc7\x11\xd2\xcb\x39\x61\xc4\xf9\x4c\x45\x4e\x2d\x9e\x25\xd7\x23\
\x9e\xf1\x0b\xa6\x64\x82\x2d\x08\xae\x11\x4f\x94\x32\x0c\xee\x83\
\xe0\x3a\x36\xf6\x1e\xb8\x26\xe1\x26\x4b\x4b\x76\x84\x6c\x79\xa2\
\x74\xc7\xdb\xac\xb4\x57\xb4\x9b\x63\xb2\x22\xc5\x85\x5f\xdb\xae\
\x0d\x83\x03\x04\xde\x08\x81\xe7\x61\xd8\xeb\xe1\xfc\xe9\xd3\x38\
\x7f\xf6\x2c\xce\x9f\x3f\x8f\xd5\xf5\x75\x6c\x74\xb7\xb0\xb9\xd5\
\xc7\x66\xbf\x8f\x9e\xe7\xc3\xe3\xe9\x2e\x3d\x9a\x00\x50\x61\xe2\
\xed\x0b\x6f\xba\x01\xaf\x7a\xd3\x5b\x30\x1a\x0d\x33\x8e\xb9\x8c\
\x2b\x6f\xcc\xa1\x97\x00\x9d\x30\x11\x57\xa6\x5d\x79\x71\x4a\x73\
\x22\x56\x95\xfb\x4b\x73\xf2\xd0\x4f\x94\xf7\xf2\x97\xeb\x5c\x5e\
\x47\xd0\xe7\xf8\xf2\xe2\x42\xe5\x0b\x4d\xa6\x7a\x86\xcd\x79\x64\
\x53\x22\x48\x33\xa6\xc2\x4f\x9c\x2e\xdd\x65\x97\x7d\x44\x84\x6e\
\x77\x0b\x98\x1e\x5f\x92\x98\x6e\x7a\xa8\x41\xa9\x06\xa6\xca\x22\
\x73\xd9\x72\x44\x91\x9c\x67\x38\x6e\x34\x71\x0a\x21\x60\x59\x36\
\x6c\x2d\xe1\x29\xd9\xc9\xd0\xb5\xf1\x54\x5c\xa9\xdd\x68\x60\xa1\
\xd5\x42\xbb\xd1\x40\xd3\xb1\xd1\xb0\x2c\xf8\x52\xe2\xec\xc9\xe3\
\x19\x5d\x9c\xe1\xba\x0d\x44\x9e\xe9\xdc\x4a\x00\xc9\x98\x04\x27\
\xe6\x24\x2e\x74\xbd\x66\x2f\xe8\xb4\x84\x97\xad\x8e\x9d\x5e\x69\
\x46\x95\xb1\x09\xb0\x4d\x13\x87\x6f\xb8\x41\x4d\xb8\xe9\x17\x24\
\xb6\x41\x59\x12\x95\x9b\x4b\x35\x66\x31\x4e\xb4\xd1\x48\x6e\x8f\
\x12\xfb\xc9\x00\x5c\xdb\x84\xc1\x81\xaa\x0c\x11\xf8\xf0\x47\x43\
\x74\x37\xd6\xb0\x72\xea\x24\xce\x9f\x3d\x8b\x0b\xe7\x2f\x60\x7d\
\x7d\x03\xdd\xad\x1e\xd6\xb7\xfa\xd8\x1c\x0c\x31\xf0\x03\xf8\xcc\
\x93\x9b\x6a\x4d\x60\x4f\x04\xd5\x92\xdd\x35\x4d\x7c\xf7\xf7\x7e\
\x0f\x5a\x9d\x85\xa8\xcd\x7d\x4a\x63\x4d\x26\xdd\xe6\xd9\xc7\x73\
\xc1\x2b\xcd\x9c\xe2\x9f\x34\xdc\x5e\x0c\x10\x59\x10\x2a\x04\xa7\
\x59\xe3\x4f\x05\x4f\x35\xa3\x04\xe3\xf2\x63\x30\x18\xcc\x2d\xc6\
\x44\x53\xaf\x64\xc2\xee\x5d\xbb\x26\xdb\xc4\x27\x80\x50\xd1\xc1\
\xa2\xb0\x8d\xd8\x64\x70\x2a\xeb\xca\xab\x59\x53\x0d\x4c\xa5\x2e\
\xb9\x59\x5a\xae\x33\x40\x30\xdd\x66\x1c\x17\x10\x02\x86\x69\xea\
\x0a\xe2\x66\xe4\xc4\x73\x2c\x4b\xb1\x25\xcb\x82\x6b\xdb\x68\xd8\
\x36\x5c\xdb\x82\x6d\x9a\xb0\x4d\x03\x9b\xbd\x1e\xd6\xcf\x9f\x53\
\x6d\xbe\x29\x9e\x78\x9a\xed\x4e\xfa\x63\xa3\xfc\x17\x60\x6c\xa9\
\xcc\xc8\x71\xee\xf1\x1c\x4e\xff\xb4\x19\x83\x11\xc7\x9d\x6e\xba\
\xe1\xfa\xa8\x3e\x5e\x72\x77\xd2\xed\xd6\x33\xa6\x71\x42\xa6\x89\
\x60\xda\xea\x90\xa8\xb8\x97\x06\xa5\xcc\x7d\x42\xcc\x9c\x04\x24\
\xfc\xd1\x10\x41\xe0\xc3\x1b\x0e\xb0\x76\x6e\x05\x67\x4f\x9f\xd2\
\x46\x88\x35\x6c\x74\xbb\x3a\xbf\x49\x4b\x7a\x3a\xbf\x49\x96\x58\
\x4f\x53\xc1\x05\x63\x09\x81\x1b\xf6\xef\xc5\xbb\xbe\xf9\x5b\x55\
\xeb\x13\x4e\x3b\x17\xd3\x39\x4a\x32\x3f\xc7\x29\x71\x3f\x02\xb0\
\x78\x43\x29\x39\x2f\xb3\x3a\xc8\x01\x27\x2e\x96\xec\x4a\xa5\x35\
\x71\xa9\xab\xc5\xb2\xcc\x4a\x20\xe3\x79\x1e\x4e\x9d\x3e\x3d\x77\
\x29\xaf\x90\xd1\x0a\x42\xa3\xd9\x98\xf2\xbd\xb8\xd2\x54\x21\x88\
\x70\xf4\xe8\x51\x60\x7a\x6c\xa9\x6c\x4b\xf5\x1a\x94\x6a\x60\x2a\
\xc5\x90\x66\x95\xf6\xa2\xf8\x52\x98\x73\x64\x5a\x16\x0c\x53\x15\
\x16\xb5\x75\xff\xa5\x50\xc2\x6b\x38\x8e\x2a\x45\x64\x1a\xb0\x0c\
\x55\xbc\xd5\x32\x0c\x3c\x7d\xf4\x38\x7c\xcf\x8b\xd9\x51\x18\x3f\
\xd0\xd2\x1e\x03\xe9\x15\x74\x91\xfb\x2b\x7c\x5f\x62\x82\xe3\x48\
\x00\x4a\x4b\x44\xa9\x24\xcd\xec\xa4\x56\x20\xe3\x84\x13\x02\xb3\
\xd2\xdc\xaf\xdd\xb7\x47\x07\xff\xd3\xed\x2e\x90\x2a\x4b\x14\xa3\
\x11\x25\xaa\x6e\x27\x8b\xbd\xa6\x26\x2d\x4a\x3f\x9e\x64\x49\x29\
\x66\xa7\x0f\x55\xc3\x75\xb1\xd4\x6e\xc1\x60\x09\x7f\x34\x52\xc9\
\xb7\x83\x3e\xce\x9f\x3e\x85\x95\xd3\xa7\x23\xd6\xb4\xd9\xdd\xc2\
\xda\x66\x17\x6b\x5b\x3d\xf4\x3c\x1f\x43\x29\xe1\x73\x39\x11\x34\
\x2f\x1a\x26\xb4\x11\xe2\x43\x5f\xff\x1e\x2c\xef\xdd\xa7\x4a\x10\
\xa5\x0f\x58\x14\x2f\x42\x0a\x88\xe4\x78\xbc\x29\x2f\x51\x17\x79\
\x92\x1e\x52\x71\x26\x66\x1e\xff\x4c\x94\x93\xf6\x8a\xc1\xa9\xf8\
\x88\x18\x42\x60\x69\x61\xa1\xf4\xac\xaa\x5a\xb6\x04\xd8\xdc\xe8\
\x5e\x94\x26\xbc\xaa\x4e\x9e\x13\xd5\xc9\xe3\xaa\xd8\xc4\x05\xfc\
\x89\x08\x47\x9e\x39\x92\x04\xa6\xa0\x00\x8c\x26\x15\x71\xad\x41\
\xa9\x06\xa6\x99\xc1\xaa\x44\xc5\x87\xb1\xae\x94\x29\x2d\x9a\x84\
\x72\xdc\x99\xba\xe4\x50\x58\x9c\xb5\xe9\xba\x68\xba\x8e\xae\xe3\
\xa6\x98\x92\x4a\xfe\x24\xfc\xed\xa7\x3f\x9d\xda\x0e\xb3\xb2\x9d\
\x3b\x4e\x23\xb1\x62\xce\xc4\x1c\xb2\x81\xf6\xbc\x4a\x04\x49\xa9\
\x2f\x1b\xc2\x48\x48\x44\xe3\x17\x26\xe7\x5e\xf4\x21\x34\x49\x56\
\x15\x20\x9a\xae\x03\xcb\x71\xa3\xef\x9e\xaa\x97\x97\x23\x0b\xa6\
\x24\xba\x04\xe8\xa4\x81\x27\xe6\x4c\x29\xa9\x0f\x69\xcb\x79\x68\
\x51\x67\x66\x38\x96\x85\x85\xa6\x0b\x53\x00\x81\xe7\x21\xf0\x46\
\xe8\x77\xbb\xb1\xa4\x77\x61\x15\xab\xeb\x1b\xd8\xe8\x6e\x61\xad\
\xbb\x85\xee\x50\xb1\x26\xbf\x80\x35\x95\xbd\x68\x4c\x12\xd8\xb7\
\xd0\xc1\xfb\xbf\xfd\x3b\x14\x6b\x4a\xfe\x86\x63\x92\x5e\x81\x29\
\xa2\x50\xca\xe3\xc2\xdf\x2b\xf9\x09\xc8\x01\xa7\x2a\xd2\x5e\xf9\
\xea\x11\x3c\xb5\x49\xe0\xf8\x56\x58\xd5\xd5\xa3\xed\xce\xc6\xb4\
\xcd\x97\x71\xc9\x7b\xc5\xe3\xdc\xb9\x73\xc0\xf4\x3a\x79\x65\x73\
\x98\xea\x51\x03\xd3\x54\x81\x62\x9a\x84\x07\x94\x2a\xe4\x0a\x98\
\x96\x2a\x24\x1a\xde\xc2\x0a\xe2\x8e\x6d\xa1\xe1\xd8\x68\x39\x0e\
\x1c\xcb\x84\x65\x08\x98\x42\xdd\x24\x33\x1e\x7f\xf0\x81\x84\xf1\
\x81\x23\xf6\x95\x34\x3e\x84\x4c\x28\x09\x38\x49\xd6\x54\x3c\xf1\
\x15\x3f\x9f\x94\x9f\x92\xae\xaf\x22\x17\x18\x98\x75\xb5\x6c\x86\
\x17\x04\x58\x6c\x36\xb0\xf7\x9a\x6b\x75\x25\x87\x0c\xc0\x50\x02\
\x44\xf2\x0a\x50\x64\x3a\xdd\x8e\x31\xae\x0c\x70\x8d\xbb\xfa\xf4\
\x3d\x6d\x3f\x77\x6c\x0b\x26\x18\xfe\x68\x04\x19\x04\xf0\x47\x43\
\x6c\x5e\x38\x8f\x95\xd3\xa7\x71\x7e\x65\x05\xab\x17\x56\xb1\xbe\
\xd9\xc5\x46\x77\x0b\x17\x36\xb7\xd0\x1d\x7a\x18\x05\xf9\xac\x89\
\x73\x26\xbb\xbc\x39\x4f\xd9\xc7\x0d\xbc\xe3\xad\x6f\xc1\x9e\x03\
\xd7\x44\xd5\x3a\xd2\xcc\x07\x13\xc1\xa8\xa8\xac\x51\x72\x25\x91\
\x2f\xe9\xa5\x19\x6f\x1e\x08\x15\xca\x75\x5c\x96\x27\x71\x0a\x68\
\x49\x37\x66\x2c\x0d\x27\x44\xe8\xf5\x7a\x18\x0e\x86\xe3\xf2\xec\
\x9c\xd9\x52\xb8\x78\x5a\x58\x5c\xc4\x9e\x54\x9d\xbc\x8a\x9f\xc7\
\xf9\x49\xec\x77\x7c\xf1\xf3\x28\x09\x48\xd3\x0c\x10\x75\x8c\xa9\
\x06\xa6\xd2\xa7\x64\x95\xf8\x52\x74\x33\x1c\x17\xc2\xb2\x15\x90\
\x08\xa1\x2a\x5d\xdb\x36\x0c\xc3\x54\x7d\x81\x0c\x03\xc2\x10\x10\
\x24\xa2\xfc\x25\xdb\x30\x34\x28\x11\x0c\x41\xda\xf8\x70\x22\x36\
\x3e\x68\xf3\x42\x54\xb0\x35\xa1\xe3\x25\xff\x59\x34\x79\xa5\xec\
\xc9\x72\x32\x58\xe5\xb3\xaf\x1c\x70\x4a\x7c\xa6\x94\x32\xaa\x9b\
\xd7\xb0\x2d\x5c\x73\xf0\x50\xba\xcd\x7b\x42\x8f\x4b\x46\x98\x26\
\xcc\x5e\x29\x90\x4a\x99\xc5\xb3\xc6\x08\x20\x93\x04\x1c\xa1\x9c\
\xea\x82\x6b\x99\x30\x89\x55\xbc\xc9\xf7\x31\x1a\x0d\xb1\xba\x72\
\x06\xe7\xce\x26\x6a\xe9\x6d\x86\xed\x31\x06\xe8\x7b\x3e\x7c\xc9\
\x15\xa4\xa9\xf1\x7f\x9b\x44\xd8\xbf\xd8\xc1\x07\x3f\xfa\x5d\x18\
\x0d\x07\x39\x35\x6d\x78\x1c\xac\xa6\xfd\x26\x48\x48\xb3\x59\x19\
\x96\xd3\x55\xcd\x67\x03\xa7\x2a\xec\x09\xd1\xe7\x36\x1a\x2e\x1a\
\x15\xcd\x0f\xfd\x7e\x4f\xb5\xbc\xa0\x79\x5e\xae\xc5\x23\xf0\x7d\
\x98\x86\x99\x3e\x36\x85\x32\x1d\x97\x8a\x44\x31\x33\x8e\x1f\x3b\
\x56\xa6\xff\x52\x59\xd6\x54\x83\x52\x0d\x4c\xa5\xcf\xf0\x32\x2c\
\x29\xc6\x06\x66\x16\xa6\x15\xb5\xa7\x10\x42\xc0\xd0\x86\x07\x2b\
\x64\x4e\x42\xc0\x10\x8a\x39\x09\x12\xd1\xc4\x2a\xc2\x26\x76\x44\
\x18\x78\x3e\x56\x4e\x1e\x03\x09\x91\x89\x71\xa7\x77\x67\xac\xd0\
\x67\x2a\xae\x34\x49\x1a\x92\xe9\x5b\xb2\x6f\x50\xe6\x3d\x28\x00\
\xae\xe4\xe4\x84\x04\x98\x19\x42\x60\x79\xf7\x6e\x4c\x0c\x50\x25\
\xfb\x3a\x65\xa4\xa9\x22\xa0\x1a\x8b\x3b\x21\x53\x5d\x22\x11\xbb\
\xa2\x44\xec\xaa\xe1\x3a\x58\x6c\x35\x54\x07\xda\xc0\x87\xf4\x3c\
\xf4\xbb\x5d\x9c\x3f\x73\x1a\x17\x42\xd6\xb4\xb1\x89\x8d\xad\x1e\
\xd6\xb7\xb6\xd0\x1b\x79\xf0\x24\x43\xf2\x04\xcb\xd4\x94\x29\x44\
\x90\xaa\x40\xfe\xd6\x37\xbc\x0e\x7b\x0e\x5c\xa3\xbb\x0b\xe7\xcb\
\x68\xa9\x63\x2c\xa7\xb1\xa6\xd8\x64\x92\x94\x62\x63\x49\x2f\x13\
\x6f\xaa\x04\x4e\xd5\xd9\x13\x33\xc3\x75\x6c\x58\x15\x5b\x5e\x0c\
\x87\xc3\xd9\xd9\x4b\x55\x29\x8f\x81\x46\xb3\x09\xd3\x32\xe7\x3a\
\x4b\x30\x33\xba\xdd\x6e\x51\x7c\x69\x92\x94\x87\x1a\x88\x6a\x60\
\xda\xae\x9c\x37\x29\x19\xae\x58\xca\xd3\x12\x1c\x09\x43\x99\x1e\
\xc2\xd2\x43\x66\x2c\xeb\xd9\x76\x58\xb0\x95\x40\x42\x4d\x66\x21\
\x2b\xd8\xec\x0f\xe0\x8d\x46\x71\xb7\x52\xfd\x91\x6e\xb3\x09\x5d\
\xe1\x2b\xd3\xb5\xb6\x20\x19\x53\xa6\xd9\x92\x4c\x82\x8f\x54\xf2\
\x5b\xf4\x1a\x19\x17\x64\x4d\x36\xb1\x93\xa9\x04\xd0\x64\x10\x3e\
\xe1\xba\xa3\x38\xe1\xd0\x10\x84\xdb\x6e\xbb\x0d\xcc\x72\xac\x0d\
\xfb\x98\x29\x39\x17\x4c\x91\x5b\x9b\x73\xcc\xa9\x47\x69\xe9\x2e\
\xd9\x74\x30\x59\x59\x5d\x32\xd4\xe4\x29\x00\x7f\x34\x84\x0c\x02\
\x78\xa3\x21\xd6\xcf\x9f\xc3\xf9\x95\xb3\x58\xbd\x70\x1e\x6b\x6b\
\xeb\xd8\xd8\xec\x62\xbd\xbb\x85\x8d\xbe\xaa\xbb\xe7\x95\x89\x35\
\x51\x31\x6b\x32\x74\xac\xe9\x43\x1f\xfd\xae\x4c\xac\x29\x6d\x61\
\xc0\x44\x59\xb5\xa0\x71\x60\x8e\x11\xa2\x28\xe9\x76\x5e\xe0\x94\
\x2b\x29\x84\xf5\xfa\x2a\x32\x9f\xc1\x60\x30\x7d\x5a\x9e\x98\xf4\
\x4a\x28\x9b\x0e\xcd\xcc\xd8\xbd\x67\x0f\x4c\xd3\xcc\xcf\x66\xcd\
\x63\x4d\x53\x98\x14\x88\x30\xf2\x3c\x9c\x3f\x77\x2e\x40\xb5\xdc\
\xa5\xba\xea\x43\x0d\x4c\x33\xad\x87\x78\xca\x73\xe5\x7a\x32\xe9\
\xbb\x24\x08\x86\x50\x40\x14\xb2\x26\x65\x11\x37\x61\x19\xa6\x66\
\x4f\x02\x22\x93\xbe\x79\xe6\xfc\x5a\x04\x0e\xd1\x65\xa8\xab\x3e\
\xc4\xd7\x24\xe7\x42\x66\x71\x75\x81\xa4\x9c\x27\x15\x48\xe9\x2e\
\xab\x11\x18\x65\x6e\xd1\x63\x59\x80\x4a\x50\x07\xb5\x7d\x2d\x99\
\x48\x55\x7b\xee\xf0\xc1\xeb\x90\x4a\x49\x4d\xa2\x0d\xa5\x2b\x36\
\x24\xe5\xa8\x2c\x48\x8d\x07\xed\xd3\x12\xde\x58\x23\xc3\x74\xe3\
\xa8\xa8\x9d\x87\x92\xf4\x2c\x98\x02\xf0\xfd\x11\x64\xe0\x63\xa4\
\x2d\xe4\xab\xe7\x2f\x60\x75\x55\xb1\xa6\xcd\xad\x1e\xd6\x36\xb7\
\xb0\x39\x1c\xa1\x9f\xa8\x08\x91\x3b\x5f\x4e\xe9\xb8\x60\x10\x60\
\x0a\x81\xb7\xbc\xe1\x75\xd8\xbd\xff\x80\x8a\x35\x45\x87\x22\x29\
\xb9\x71\x8a\x79\x16\x31\xd6\x54\xfc\x10\x49\xb9\x35\x71\x3e\x64\
\x8d\x2a\x25\xc1\xa9\xaa\xa5\x3c\x29\x1f\x77\xda\x6d\x25\x93\x55\
\x18\xa7\x4f\x9f\x9e\x9c\x00\x3e\xe7\xa9\xba\xd5\x6a\xa9\x62\xbd\
\x3c\xbf\x0d\x07\xbe\x0f\x29\x65\x80\x7c\xf3\xc3\xb4\x72\x44\x75\
\x6c\xa9\x06\xa6\x6d\xb3\xa6\xd2\xf1\xa5\xec\xa2\x4b\x10\xa9\x98\
\x92\x10\x10\xba\x16\x9e\x69\x1a\x68\x3a\x0e\x9a\x5a\x02\x31\x0d\
\x11\xc5\x46\xc2\x37\x9f\x3d\x77\x3e\x5a\x15\x4a\x29\x11\x04\x41\
\x64\x7b\x4d\x25\xdc\x32\xe2\x88\x43\x69\xa7\x97\x2e\x7b\xa3\x19\
\x94\x4c\x48\x7a\x52\xa6\x6f\x63\xa0\xa5\xe3\x49\x60\x19\xb9\xed\
\x38\x59\x79\x42\x4f\xb4\xfb\x76\x2d\x43\x18\x22\x51\x74\x8c\x53\
\xf2\x5b\x2c\xe7\xc5\xfb\x17\xb3\xb7\x98\xb1\xc9\xac\x1b\x2d\x35\
\x59\x8e\x83\x12\xe5\xf4\x9c\x0a\x19\x66\xc3\x71\xb0\xd8\x6a\xc2\
\x12\x04\x19\x04\x08\x3c\x0f\xbd\xee\x26\x56\xcf\xad\x60\xf5\xc2\
\x05\xac\xad\xad\x61\xb3\xbb\xa5\x25\xbd\x3e\xfa\xd3\x58\x53\xa6\
\xe1\x5e\x6e\xac\x49\x08\xec\x5d\xe8\xe0\xed\x1f\xf8\x20\xbc\xd1\
\x30\x4f\x0b\x8b\x17\x13\x28\x90\x65\x73\xcc\x29\x48\xc4\xfd\x62\
\x60\xcf\x91\xf4\x12\x3b\x3a\x09\x9c\x8a\x67\x46\x9e\xb2\xa6\x67\
\x58\x96\x55\x39\x1d\xa9\xdf\xef\x6f\x53\x4b\xab\x36\x8f\x47\x75\
\xf2\x80\x99\x6c\xe2\xd9\xc7\x88\x08\x9b\xdd\x2e\x30\x7b\xf1\xd6\
\x9a\x2d\xd5\xc0\xb4\x6d\xd6\x54\x05\xa0\x64\x32\xef\x28\x4c\xae\
\x0d\x2d\xcf\x82\x84\xaa\x04\x61\x9a\x70\x2c\x13\xae\x65\x6a\xe3\
\x83\x8a\x2d\x19\x1a\xa0\x8e\x1d\x3f\x0e\x61\x18\x30\x6c\x17\x20\
\x01\x32\x2c\x98\x4e\x13\x9b\xdd\x2e\xd6\x56\xd7\xa0\x16\x6a\x89\
\xd5\x7a\xb2\x24\x51\xde\xc4\x26\x33\x31\x0c\x99\x91\xe7\x42\x59\
\x8f\xd3\x60\x94\x05\xa7\xe8\xdf\xfa\xf4\xb0\x6c\x3b\x55\x7d\x20\
\x3c\x42\x2d\xd7\x86\xa1\x7b\xdf\xe4\xda\x1d\x88\x10\x04\x12\x2b\
\x2b\xe7\x71\xee\xdc\x05\x74\xbb\x5b\xf0\x3c\x4f\xb3\x38\xbd\x3f\
\x81\x54\x37\x19\xa4\x1b\xea\x8d\xfd\x4c\xe3\x4d\x78\xb2\x95\x24\
\x14\xe8\x33\x5c\xdb\x82\x25\x08\xbe\xe7\x41\x06\x01\x46\x7d\xcd\
\x9a\xce\x9d\xc3\xda\xea\x1a\x36\x36\x36\x55\x45\x88\x6e\x1c\x6b\
\x0a\xb8\x7c\x7a\x3e\x15\xb0\xa6\x77\x7f\xdd\xdb\xd1\x59\x5a\xce\
\x00\x78\xc2\xfd\x98\x5c\x64\x4c\x88\x31\x8d\x55\x2a\x4f\xca\x9f\
\x99\x5c\xb4\x58\xd2\xcb\xec\x77\x2e\x38\xf1\x64\x70\x9a\x34\xa1\
\xeb\xb6\x2e\xb9\xc7\x23\x99\x73\x86\x98\x29\x3e\xf9\xe4\x93\x93\
\xd9\xcb\x1c\xf2\x6e\x29\xb1\x8b\xcb\x51\x39\xa2\x22\x71\xae\x9c\
\xe1\x21\xfc\x0e\x89\xdd\x2b\x53\xbc\xb5\x6c\x82\x6d\x3d\x4a\x8c\
\xab\xb1\xb5\x3a\x26\xc4\x91\x80\xb2\x6d\x30\x32\x17\x95\x8a\x29\
\x99\xca\x89\xa7\xa5\xbb\xd0\xe4\x30\xd6\xe6\x9b\x80\x61\x20\x01\
\xc3\xc4\xe2\x81\x83\xf0\x86\x23\xb8\x8b\x7b\x22\xab\xb3\xef\x8d\
\xb0\x35\x1c\x61\xe4\x07\x2a\x4e\x65\x1a\x70\x6c\x2b\xaa\x0c\xc1\
\x48\x37\x99\x2b\x5a\xf4\xa9\x92\x7e\x1a\x40\x49\x57\xa5\x06\x01\
\xac\x2b\x57\x83\xc0\x4c\x63\xf6\xed\x64\x12\x6b\x36\xb1\x17\x0c\
\x48\x66\x04\x92\xe1\x5a\x16\xdc\x66\x0b\x5b\xeb\xab\x40\xb2\x72\
\x77\xa2\xdf\x53\x10\x78\xe8\x6d\x6d\x42\x18\x26\x06\xfd\x1e\x84\
\x2e\xd3\x64\x9a\x06\x2c\xd3\x42\xa3\xd1\x50\x7d\xa8\x44\x72\x3f\
\x44\xb4\x64\xd2\x2d\x05\xe3\xef\x52\x62\x9a\x62\x56\x65\x93\x46\
\xc1\x08\x41\xe0\x43\x04\x02\x83\xad\x2d\xac\x9e\x5b\x41\x67\x71\
\x11\x8b\x8b\x8b\xe8\x74\xda\x68\x35\x5d\x6c\xf4\x5a\xe8\xb8\x0e\
\x6c\x21\x60\x18\x25\xda\xb0\x53\x7e\x6c\xcc\x12\x02\x07\x96\x16\
\xf0\xca\xaf\x7e\x33\xfe\xea\xbf\xfd\x21\x2c\xc7\x49\xcb\x64\x09\
\x49\x93\x98\x52\x0b\x0a\x2a\x00\x27\x05\xbc\x9c\xea\x02\xc6\x89\
\xbe\x57\x71\xb3\x46\xfd\x78\x58\x81\x1c\xe1\x4f\xce\xe3\x7e\xfd\
\x44\x8b\x76\x2a\x04\xa7\xf1\x27\x55\x12\x71\x7e\xa1\xa6\x81\xe7\
\x63\x63\x30\x82\x20\xa0\x19\xa6\x44\x18\x06\x9e\x7a\xf2\x49\x48\
\x29\x61\xe4\xed\xc7\x9c\xb5\x3d\x02\xb0\xb4\xb4\x3c\xe3\xcc\x50\
\xb0\x7f\x44\x38\x73\xe6\x2c\xb0\x7d\xab\x78\x6d\x86\xa8\x81\x69\
\x66\xb0\x2a\xc3\x9a\xe2\x93\x8f\xe3\x69\x82\x19\x10\x86\xa1\x62\
\x4b\xa6\xa9\xcb\x0b\xe9\x1a\x7a\xd1\x64\xab\x8c\x0f\xcc\xc0\x6a\
\x7f\x84\xcf\x3d\xfa\x34\xae\x3d\x78\x10\xff\xf8\x13\x3f\x85\x47\
\x1e\x7a\x18\xf7\xdf\xf1\x45\x9c\x3b\x79\x1c\x76\xd0\x04\x4b\x89\
\xc0\xf7\x10\xf8\xaa\xf7\xd0\x30\x08\x20\x3d\x15\xcc\x37\x00\x05\
\x52\xc9\xa4\xdb\xdc\x05\xaf\x9e\x80\xc6\x00\x0a\xba\x9d\x82\x06\
\xa7\x44\x45\x6f\x35\xb9\x51\x3a\x36\x44\x49\xd7\x7a\xcc\x64\x24\
\x33\x5a\xb6\x85\xc5\xdd\x7b\xd0\x5d\x5f\x8d\x19\x53\x26\x17\x49\
\x95\xdc\x61\x90\x11\x37\x45\x1c\x0e\x87\x18\x8d\x08\x40\x1f\xc2\
\x10\x70\x6c\x07\xa3\xd1\x00\xa6\x69\x29\x30\x17\x0c\x82\x50\xf1\
\x02\x12\x09\x49\x2f\x0f\x9c\xc6\x9d\x09\xaa\x2a\x84\x8d\xa1\xef\
\xa3\x37\xf2\x60\x18\x06\x7c\x6f\x84\xcd\xd5\x0b\x58\xbf\x70\x1e\
\x1b\xbb\x96\xb1\xb9\xd8\x41\xbb\xd9\xc4\xda\xe6\x16\x16\x9b\x0d\
\x38\x86\x80\x29\x8c\xf4\xca\x3f\x7d\x28\x27\xe2\x93\xd0\x79\x4d\
\x1f\xfc\xc6\x0f\xe2\x6f\xfe\xe4\x8f\x91\xed\x90\x1a\x37\xf6\x8b\
\xc1\x28\x69\xd7\x27\xfd\x7b\xa6\xda\x66\x24\x41\x89\x78\x8c\x3c\
\x87\x79\x5c\xc4\x14\x2f\x3c\x32\xe0\x84\x4c\xa7\xe1\x98\x3d\x15\
\x81\x53\xfc\x7c\xf8\x81\x81\x94\xb8\x66\xff\xbe\xb1\x66\x8b\x04\
\x42\xcf\xf3\x70\x6c\xa3\x87\x20\x3c\x46\x03\x0f\xb6\x10\x58\x72\
\x4c\xdc\xf6\xca\xd7\xe3\x9a\xbf\xf8\x1b\x6c\x5c\x38\x87\x41\xaf\
\xa7\xbe\x97\x08\x7f\x57\xda\x06\x04\xe5\xd2\x36\xec\xda\xbd\x2b\
\xfd\x73\x65\x81\xba\xe8\xb1\x82\x9f\x9a\x00\x1c\x3f\x76\x0c\x98\
\xec\xc6\x2b\x53\xbc\xb5\x66\x4c\x35\x30\xcd\x24\xe9\xcd\xd0\xfe\
\x82\x53\x55\xc0\xa3\xdc\x25\xa1\xee\x27\x2b\xee\x84\x6c\xc9\x93\
\x8c\x27\x56\xd6\x70\xcf\xe3\x4f\xc3\x34\x95\x59\xe2\x39\xd7\x1e\
\xc0\xc1\x6b\x0f\xe0\xcb\xbe\xec\x4b\x71\xc7\x1d\x77\xe1\xfe\x2f\
\x7e\x11\x17\xce\x9e\x86\x29\x25\xa4\xef\xc3\xb4\x1d\xc8\xc0\x47\
\xe0\xf9\x08\x28\x40\x20\x03\xb0\x2f\xe1\x7b\x23\x98\x82\x60\x99\
\x46\xaa\x78\xeb\xf8\x55\x96\x06\xa8\x10\x7c\xb2\xe0\xa4\xaa\x36\
\x84\xf8\xa5\xfb\x00\x85\x72\x06\x73\xae\xed\xd7\x34\x04\x76\xed\
\xd9\x8b\x13\x4f\x3e\x96\x9b\x38\x1b\x25\xc1\x72\x46\xf6\x49\x24\
\xcc\x7a\x01\xe3\xa5\x5f\xf1\x95\x78\xfc\xde\xbb\xb0\xb5\xbe\xae\
\xac\xf3\xcc\x10\xcc\x60\xa1\x5a\xcf\x93\x20\xad\x3a\xeb\xda\x7c\
\x25\x0c\x62\xcc\x80\x63\x9a\xf0\x02\x15\xbb\x13\x81\x8f\xd1\x60\
\x80\xb5\xf3\xe7\xb1\xb6\x7b\x37\x16\x16\x17\xd1\x69\xb7\xb1\xde\
\x6d\xe0\x42\xab\x81\x86\x6d\xc1\x31\x14\x6b\xe2\x8c\x44\x44\x25\
\x59\x93\x29\x08\x37\x5f\x7b\x00\xcf\x7d\xf1\x4b\xf1\xf0\xdd\x77\
\xa9\xca\x07\x99\x08\x50\x0c\x22\x09\x20\xca\xf4\x70\xa2\x24\x78\
\x8d\xb1\xa6\xa8\xb3\x7a\x1a\x60\x52\xe4\x38\xcd\x00\x78\x0a\x38\
\xe5\x4f\xf7\xf1\x06\x99\x25\x96\x97\xc6\x9b\x04\x06\x52\xe2\xa9\
\x0b\x1b\xf0\x58\x81\xb2\xd0\xe7\x90\x0f\xe0\xdc\x30\xc0\x57\xbd\
\xe1\x0d\xf8\x8a\x57\xbe\x1a\xab\x9b\x9b\xb8\xf7\xbe\xfb\xf1\xbf\
\xfe\xf0\x0f\xf0\xd8\x3d\x77\xe0\xc2\x99\xd3\x90\xb9\xfb\x34\x3b\
\x50\x09\x22\x34\x1b\xcd\xb9\x1a\x1f\x40\x84\xa3\x47\x9f\x09\x19\
\x53\x80\x72\xc5\x5b\x65\xc1\x22\xb7\x1e\x75\x8c\x69\x22\x18\xf1\
\x36\xc1\x49\x02\x60\x32\xcc\x28\xb9\x34\xca\x57\xd2\xa0\x24\x88\
\x60\x18\x22\x5a\x61\x0a\x02\xfa\x7e\x80\xcf\x3c\xf2\x34\x3e\xf7\
\xc0\x23\x2a\xe0\x1f\x48\x04\x81\x84\xe7\x07\xf0\xfc\x00\x9d\x4e\
\x1b\x6f\x78\xfd\x6b\xf1\xed\xff\xf4\x1f\xe3\xfd\xdf\xfe\x1d\xd8\
\x7f\xf0\x30\x2c\xb7\x81\x46\x7b\x01\x8d\xf6\x02\xdc\x56\x1b\xed\
\xa5\x5d\x68\x2e\xee\x02\x2c\x17\x30\x1d\x04\x64\x62\x14\x00\xbd\
\xe1\x08\x9e\xe7\xa3\xb0\xf5\x82\x94\x19\x2b\xb8\x8c\x6d\xe5\x51\
\xec\x29\x63\x8a\x08\x64\xdc\x02\x1d\x48\x54\x32\x50\xc5\x32\x25\
\x33\x4c\x41\xd8\xb5\x6f\x9f\x5e\xf1\xa7\x6b\xe5\xa5\x8a\xb5\x86\
\x80\x25\x84\x02\x40\x11\x03\x79\xbf\xb7\x85\xcf\x7f\xfa\x53\xb8\
\xed\x4b\xbf\x02\x86\x65\xeb\xea\x0d\x3a\xee\x14\x04\x3a\xde\x95\
\x67\xa7\x46\xa6\x3c\x4f\x16\x98\x18\x0d\xd7\x81\x65\x08\x04\x3a\
\xd6\x14\xf8\x1e\xba\xeb\x6b\x58\xbf\x70\x01\xeb\xda\x3a\xbe\xa5\
\x7b\x36\x6d\x0e\x86\x18\xe9\xbc\xa6\x59\x54\x26\xd2\x93\xa3\x63\
\x9a\xf8\xd6\x8f\x7e\x54\x75\x37\xce\x8d\xef\x24\x12\x99\x73\x92\
\x6f\x93\x95\xdc\xb3\xf1\xa5\x6c\xd2\x2d\xf3\x78\xec\xb1\x28\xc6\
\x94\x9f\x4f\x54\xc2\x14\xa1\x3f\xdf\x75\x9c\xc4\x57\x51\x8f\x9d\
\x5a\xdb\xc0\xd9\x8d\x2e\x06\xc3\x11\x86\x9e\x0f\x3f\x90\x08\x02\
\x46\x10\xc4\x6c\xb0\xd9\x70\x70\x70\xff\x5e\x7c\xed\x57\xbf\x1e\
\xff\xfd\xff\xfd\x5d\x3c\xf1\xc4\xe3\xf8\xdb\x07\x1e\x9a\xa3\x7b\
\x4e\xed\x8b\xed\xd8\x38\x7c\xf8\x50\xf4\x3d\xf3\x2c\xe1\xa8\xf8\
\x18\x01\xb8\xf3\x8e\x3b\x31\x05\x90\xca\x54\x17\x9f\x8f\x5e\x59\
\x33\xa6\xab\x0a\xa0\x78\xc2\xf3\x45\xb4\x5d\x1e\x7d\xf0\x6e\xbe\
\xe9\xcb\x5e\xad\xa6\x5e\x41\x2a\x8f\x29\xc1\x98\x4c\xc3\x88\xba\
\xd6\x0e\xbc\x00\xff\xeb\x8b\xf7\xe1\xdc\x85\x55\xb8\xae\x0b\xc0\
\x83\x61\xa8\x38\x94\x61\xa8\x1c\x27\x66\x82\x24\xa0\xd9\x6c\xe0\
\x05\xb7\x3f\x17\x37\x5c\x7f\x18\xcf\x1c\x39\x86\x4f\xfe\xc5\x5f\
\xe0\xfc\xa9\x53\x30\x6c\x07\xac\x27\x57\xdb\x6d\x40\xca\x00\xfe\
\x68\x04\x6f\xd8\x07\x81\x10\x68\x90\xf1\x7d\x1f\x26\x01\x96\x69\
\x80\x29\xce\x8f\x52\xd2\x50\xcc\x60\x54\x19\xa4\x50\x5a\xd2\x8f\
\x6b\xc9\x31\x92\xf7\x98\xe3\x9a\xac\x22\xdb\x21\x55\x81\xd1\xc1\
\x43\x87\xd5\xfd\x4c\xe2\x6b\x76\xe5\x29\x84\x02\x24\xe4\x94\x23\
\x1a\xf6\x7a\xf8\xd4\x9f\xfd\x09\x4c\xd3\xc0\x9e\xbd\x7b\xb1\x79\
\xfe\x1c\x4c\xcb\x02\x25\xd6\x4d\x02\x00\x84\x88\xf2\x97\x38\xfc\
\x3f\x53\x52\xa5\x1c\x9b\x8c\x43\xd6\x24\x83\x00\x32\x50\xd2\xe8\
\xfa\xf9\xf3\x58\x5b\x5e\x56\xac\xa9\xd3\x46\xbb\xd5\x40\xb7\x3f\
\xc0\xa0\xe1\xc2\x16\x02\xc2\x20\x18\x93\x95\xbc\x7c\x39\x0f\x2a\
\xf1\xf8\xc5\xcf\xbb\x15\x07\x0e\x1e\xc2\xb9\x33\xa7\x21\x48\xe8\
\xe3\x9b\x95\xf3\x28\x15\x5b\x1a\xbf\x9f\x78\x0f\x11\xb2\x9d\x6a\
\xc3\xb8\x1b\x47\x71\x38\x8e\xf2\xe1\x62\x67\x5a\x79\xe6\x54\x74\
\x0c\xc3\x6f\x1a\x26\x0f\x87\xd0\xe8\x79\x3e\xee\x3b\x76\x0a\x12\
\xca\xe0\x62\xf9\x3e\x2c\x43\xd7\x87\x34\x0d\x48\xd6\x31\x56\xa9\
\xb6\x78\x70\xd7\x02\x5a\xda\xd9\xf7\xa2\xeb\x0f\xe3\x8d\xef\x7e\
\x0f\xfe\xf2\x0f\xff\x2b\x84\x61\x64\xbc\xf9\x33\xcc\xdb\x71\x55\
\xe0\xa9\x17\x3d\x55\x78\x8c\xc1\x38\x77\x6e\x85\x51\xce\x95\x37\
\x2d\xc9\xb6\x06\xa4\x9a\x31\xed\xa8\x9c\x17\x36\xe0\x91\xc9\x55\
\x68\x58\xdf\x4e\x50\xcc\x94\x4c\x43\x20\x90\x8c\xcf\x3e\xfa\x34\
\x1e\x7f\xf2\x29\x0c\x06\x03\xf4\x7a\x3d\xf4\xfa\x7d\x0c\x06\x43\
\x0c\x47\x1e\x46\x23\x0f\x9e\xef\xc3\x0f\x54\x3b\x86\x90\x45\x35\
\x5c\x17\x2f\xb8\xfd\x36\x7c\xf8\xa3\xdf\x89\xf7\x7d\xe4\x23\xd8\
\x77\xdd\x41\x18\xb6\x03\xbb\xd1\x82\xd5\x68\xc2\xb4\x1d\xb8\xed\
\x0e\x5a\xcb\x7b\xd0\xde\xbd\x0f\xee\xc2\x2e\x90\xd3\x04\x59\x0e\
\xa4\xb0\x30\x92\x84\xfe\xd0\xc3\xc8\xf3\x52\x2b\x72\x99\xb0\x83\
\x2b\xcb\x76\xc2\xba\xad\xd9\x89\x0c\x42\xeb\xba\x8c\x40\x4a\x84\
\x05\x5a\x13\xe6\x07\x00\xb8\xfe\xf0\xc1\xd4\x6a\x93\x12\xbd\xd5\
\x63\x39\x53\x80\x0c\x23\x66\x4a\x1a\xa4\xc2\xa2\xaf\x61\xcb\x73\
\xdf\xf7\xf1\x9e\x8f\xfc\x23\xbc\xf4\xd5\xaf\xc3\xa0\xdf\x4b\xe4\
\x59\x05\x09\xe7\x60\x51\xee\x53\x66\xa2\xd2\xf1\x97\xa6\xeb\xc0\
\x36\x8c\xc8\xa1\xe7\x7b\x23\x6c\x46\xac\x69\x0d\x9b\xdd\x2e\x7a\
\xfd\x01\x36\x7b\x7d\x74\x87\x23\x8c\x82\xa0\xb8\x99\x20\x4f\x0e\
\x75\x84\x65\x8a\x16\x5c\x17\x6f\xfc\xba\x77\xc4\x55\xe3\xc7\x80\
\x20\x99\x30\x9b\x65\x4b\x3c\x56\x6f\x2f\xd9\x57\x24\xc5\x9a\x52\
\xb9\x4d\xe9\xf8\x62\x11\x63\x28\x66\x4e\x13\x8e\x27\x33\x76\x2f\
\x2f\xc5\xc4\x4c\x4a\xf4\x06\x03\x9c\x59\x39\x87\xf3\xab\x6b\x58\
\xdb\xd8\xc4\xc6\xe6\x16\x36\x7b\x7d\x6c\x6c\xf5\xb0\xd6\x55\x56\
\xfc\xee\x60\x88\xad\xe1\x08\x6d\xd7\xc6\x42\x68\xde\xd1\xe7\xc4\
\x4b\x5f\xfe\x15\xe5\xaa\x42\x94\xb9\x88\x99\xb1\xb0\xb0\x50\x5c\
\x27\x6f\xc6\xc7\x98\x81\xb5\xd5\xd5\x69\x7d\x98\xa6\xb9\xf2\x6a\
\xb6\x54\x33\xa6\x8b\x0d\x4e\x48\xd9\xa8\x95\x4d\x9c\xa2\x09\x5c\
\x90\xc0\xb9\xcd\x2d\xfc\xcd\x27\x3f\x0d\xcb\x76\xc0\x0c\x0c\x87\
\x23\x98\x96\xea\xdb\x64\xdb\x2a\xc7\xc9\x32\x4d\x18\xa6\x91\x62\
\x50\x52\xe7\xf7\x34\x1a\x0e\x9e\xff\xbc\x5b\x71\xfd\xe1\x83\x38\
\x72\xf4\x04\x3e\xf5\x57\x7f\x8d\xf3\xa7\x4f\xc1\xb4\x5d\xb0\x54\
\x2e\x3e\xc3\x30\x61\x39\x0d\xd8\x8d\x96\x32\x4d\x8c\x86\xf0\x86\
\x03\x48\x1a\x42\x72\x80\x61\xc0\x08\xfc\x11\x2c\x21\x60\x59\x06\
\x98\xb5\xd9\x21\x65\x7e\x48\xf7\x74\x62\x32\xc0\x01\xc3\xd1\x2c\
\x07\x94\x9d\xc7\xd4\xeb\xae\xdd\xb7\x37\xdd\xc1\x36\x85\x50\xa1\
\x31\x84\x60\x18\x66\xc2\xe2\x4d\x63\x20\xa6\x3e\x5f\xe2\x3f\xff\
\xdb\x7f\x83\x7f\xf9\xef\x7f\x1b\x1b\xab\x17\xf0\xf8\xfd\xf7\xc0\
\x72\x5c\x08\x29\x21\xb5\x35\x5c\x44\x52\x97\x48\xf7\x6a\x4a\x2c\
\x10\x92\x50\xc1\x50\x75\xf4\x46\x41\x10\xb1\xa6\xd1\xa0\xaf\x4c\
\x10\xbb\x77\xa3\xbb\xb9\x0b\x5b\x8b\x7a\x42\x6d\x36\xd1\xb4\x2d\
\xd8\x86\x01\xa3\x24\x6b\x1a\x5b\xe9\x69\xeb\xf8\xd7\x7e\xcd\x5b\
\xf0\xff\xfe\xf6\x6f\x8e\xb3\x96\x70\xcf\x42\x39\x8f\x58\xef\x25\
\xc6\x62\x4e\x88\x4c\x10\x31\x63\x4a\x7e\x63\x45\x74\x72\xd8\x55\
\xca\x85\x59\x96\x39\x65\x62\x56\x69\xb1\x0c\x7b\x77\xef\x02\x10\
\xe6\x9c\x01\x67\x2f\xac\xe2\xa9\xa7\x9f\x41\xbb\xb3\x80\x66\xbb\
\x8d\x66\xa3\x01\xd7\x75\x61\xdb\xaa\x0f\x99\x65\x99\xb0\x2d\x0b\
\x00\xe1\xf6\x6b\xf6\x6a\x55\x20\x3e\x88\xbb\x76\xef\xce\x99\xaa\
\x67\x9f\xb7\xfd\x20\x80\x61\x1a\x33\x31\xa4\xa2\x11\x04\x01\x36\
\x36\x36\xa6\x81\xd2\x34\x8b\x78\xcd\x96\x6a\x60\xaa\x2c\xe5\x55\
\x2d\xe0\x1a\x9d\x88\x32\x08\xa4\xdf\xdf\x82\xb9\xb0\x14\x33\xa6\
\x90\x0d\xe8\x18\x93\x6d\x1a\x78\xf8\x99\xe3\x38\x71\xf4\x28\xda\
\x0b\x0b\xb0\x1d\x17\x8d\x56\x13\x8d\x46\x13\xbe\xeb\xab\x89\xd2\
\xb6\xe1\x79\xca\x39\x66\xea\xc4\x5c\xd3\x30\xa3\x9a\x5f\xcc\x04\
\x29\x95\xc6\x7f\xfb\x73\x6f\xc6\xe1\x43\xcf\xc1\x91\xe3\x27\xf0\
\x99\xbf\xfe\xdf\x38\x7f\xfa\xb4\x32\x47\xf8\x3e\x7c\x6f\x04\x61\
\x5a\x30\xa5\x0d\xe9\xb8\xb0\x9b\x2d\x04\x9e\x07\x3f\x02\x29\x81\
\x80\x25\x64\xc0\x10\x2c\x61\x99\xda\x36\xce\x9c\xf0\xbe\x33\x60\
\xda\x10\x76\x03\x86\xd3\x84\xd3\x6a\x01\x0c\xf8\x9e\x07\x5f\xb7\
\xc8\xce\x74\x3a\xc7\xee\xc5\xce\x98\xa1\x21\x79\x98\x4d\xdb\x86\
\x61\x39\x8a\x31\xa5\x64\x97\x71\x30\x33\x0c\x03\xeb\x17\xce\xe1\
\x37\x7e\xed\xd7\xf0\x33\xbf\xf4\xaf\xf0\xd1\x0f\x7e\x3d\xba\x1b\
\x1b\x20\xc3\x50\xcd\xf4\x24\xa2\xa9\x1b\x22\x34\x07\xa4\xa8\x5a\
\x2e\x40\x35\x1b\x0e\x46\x7e\x80\xad\x91\x07\xa1\xd9\x53\x77\x7d\
\x1d\x9b\x6b\x6b\xd8\xdc\xd8\x44\x77\x6b\x0b\x9d\x76\x0b\x9b\xbd\
\x3e\x7a\xad\x06\x5a\xb6\x05\x5b\x18\xa5\x4c\x16\x94\x43\xa4\x0c\
\x41\x78\xce\x9e\xdd\xb8\xed\x4b\x5e\x84\x47\xef\xbd\x57\xc9\x55\
\xa9\x55\x39\x69\xc7\x1d\x29\x5f\x43\xe8\xcc\xe3\xb4\x23\x8f\x32\
\x35\x0b\x63\x6b\x78\xe2\xb3\x99\xa2\xfc\xad\xb4\xa4\x87\xb4\x3c\
\xb7\x0d\x70\x22\x50\x54\xea\x27\x8c\xf7\x9d\xbb\xb0\x8a\xa7\x9f\
\x78\x1c\x4b\xbb\xf6\xa0\xd9\xee\xa0\xd5\xe9\xa0\xd9\x6c\xa2\xd1\
\x68\xa0\xd1\x50\x5d\x9c\x2d\xd3\xc4\x9e\xe5\x45\x34\xc3\xfa\x75\
\x14\x1f\xaf\x53\x27\x4e\xcc\x89\x4c\x28\xf9\xb2\xd9\x68\xc2\xb2\
\xac\x98\x61\x52\x79\xd1\x2e\xfd\x0c\x47\x71\xd1\xe1\x70\x88\xde\
\xd6\x56\x50\x11\x94\x50\xb3\xa5\x1a\x98\xb6\xc3\x90\xf2\x18\x13\
\x26\xac\x78\x52\xd4\x5d\x06\x01\x07\x83\x2d\x60\x71\x39\x2a\x43\
\x13\x82\x93\x21\x84\xb6\x91\x33\x4e\x9c\x3e\x83\xf3\x67\x4e\x63\
\x34\x1c\xc2\x6d\x36\xd1\xdb\xda\x82\xed\x38\x70\x5c\x57\xad\x30\
\x1d\x1b\x8d\x46\x13\xae\xeb\x46\xab\xcc\xc0\x94\xf0\x83\x20\x2a\
\x6d\x64\x18\x06\xa4\x64\x04\x52\xc2\x71\x6c\xdc\x7e\xeb\x4d\xb8\
\xfe\xe0\x75\xb8\xe3\xce\x7b\xf1\xc5\xbf\xfd\x0c\x86\xfd\x3e\x1c\
\xdb\xd6\x01\x7e\x5f\x49\x5f\xbe\xa7\x80\xca\x76\x60\x37\x9a\x08\
\x7c\x0f\xde\x70\x80\x51\xbf\x0f\xcf\x1f\x82\xa5\x80\x0c\x7c\x10\
\x18\x96\x21\x00\x61\xc2\x5e\xd8\x8d\xa5\x03\xcf\xc1\xee\x6b\xae\
\xc3\xde\x03\xfb\xb1\x6b\xcf\x1e\x18\x86\x80\xa9\x19\x5d\x18\x23\
\x0a\x13\x46\x09\xc0\x72\xbb\x09\x61\x18\x99\x9a\x79\xb1\x14\x65\
\x5a\x0e\x4c\xb7\x51\x22\xd0\xad\x9e\xb7\x6c\x07\x77\x7c\xf2\xaf\
\xf0\x85\x7b\xde\x83\x1f\xfa\x99\x5f\xc0\x8f\x7e\xf4\xc3\x70\x9b\
\x2d\x40\x4a\x05\x4a\x24\xb5\x12\x16\xda\xd9\xd3\x49\xbd\xe3\x13\
\xae\xae\x3e\x6e\x6b\xd6\x24\x03\x70\x10\xc0\x1b\x0e\xb1\xb1\xb6\
\x86\xcd\x8d\x75\x74\xbb\xcb\xe8\x2d\x74\xb0\xd5\xef\x63\x6b\x38\
\xc2\x42\xc3\x81\xab\xcd\x2b\x13\xad\xe3\x05\x21\x91\xd0\x04\xf1\
\xb6\x77\xbf\x1b\x0f\xde\x79\x07\x1c\x0d\x4c\x31\x87\xe1\x44\x7c\
\x8f\x73\x63\x4d\x88\xec\xe2\x1c\xb9\xec\x92\xa5\xab\xa2\x09\x95\
\x90\xda\x5e\x0a\x54\xc2\xf7\xa5\x23\x53\x25\xc1\x09\x9a\xa9\xa9\
\xf3\xba\xe1\xba\xd1\x6f\x2a\xa5\xc4\x89\x93\x27\x71\xe4\xd1\x47\
\xb0\xb6\x7b\x0f\x9a\x9d\x45\xb4\x16\x16\xd0\xea\x74\xd0\x6a\x77\
\xd0\x6a\xb7\xd1\x6c\x36\x61\x18\x06\x0e\xee\xdf\x0d\x43\x50\xea\
\x70\x49\x66\x7c\xe6\x2f\xff\x42\x7f\x07\x9e\x1c\x3a\x2a\xf1\x20\
\x33\x63\xf7\x5e\x55\x27\x6f\x4c\x8e\x43\xa2\x30\x49\x95\x00\x93\
\x66\x61\x53\xe2\x4b\x55\x12\x6c\xeb\x51\x03\xd3\xb6\x19\x54\x49\
\xf6\xa4\x63\x2e\x89\x52\x3e\xa1\x23\xcf\x34\x0d\x30\x80\x1b\x0e\
\x3d\x07\xe7\x4e\x9d\xc4\xa0\xd7\x83\xd3\x6c\xc1\x6d\xb5\x14\x10\
\x35\x1b\x70\xdc\x06\x1c\xd7\x41\xaf\xbb\x05\xcb\xb6\xe1\x38\x0e\
\x1c\xd7\x51\xab\x4e\xd7\x45\x10\x58\x30\x4d\x43\x9b\x29\x4c\x18\
\x86\x02\x06\xdf\x27\x58\xa6\x89\x57\x7d\xe5\x97\xe3\xd6\xdb\x6e\
\xc6\xa3\x8f\x3e\x81\x3b\xfe\xee\xef\x30\x1a\x0e\x60\x58\x96\x96\
\xac\xec\x48\xba\x0a\xbc\x11\x68\xa4\xe2\x3a\x96\xe3\x2a\x26\xe5\
\x0d\x21\x47\x23\x80\x08\xcd\x3d\xfb\xb0\x7c\xe0\x3a\xec\x7b\xce\
\x21\xec\x3d\x70\x00\xbb\xf7\xec\xc1\xee\xdd\xcb\x58\x5c\xe8\xa0\
\xd3\x6e\xa9\x26\x87\x8e\x03\x10\xc3\xb5\x6d\x38\xb6\x19\x4d\x78\
\xae\x69\x2a\x16\x32\x0a\x10\xb7\x13\x54\x87\x4f\x18\x26\x0c\xcb\
\x4e\x37\x0f\x04\x30\x56\xaa\x20\x33\x9c\x66\x13\x3f\xff\xf1\xef\
\xc3\x9f\xfe\xef\x4f\xe2\xd5\x6f\x7e\x1b\x3e\xfb\x7f\xfe\x0a\xa6\
\x65\xab\x24\x4f\xd5\x3b\x18\x82\x64\x64\x20\x48\xcd\x29\x89\x8a\
\xe6\xe1\xa4\xcd\x4c\x68\x3a\x9a\x35\x0d\x7d\x48\x43\xc7\x9a\xd6\
\x56\xb1\xbe\xba\x8a\x8d\xdd\xbb\xb1\xb4\xb4\x84\xde\x60\x80\xde\
\x60\x08\xcf\x6f\xc1\xb7\x18\x06\x53\x4a\xc5\xac\x66\x82\x20\x7c\
\xc5\xcb\xbe\x14\x6e\xa3\x09\x29\x83\x14\x8b\x49\x32\x93\xd0\x3a\
\x9e\x4d\xb2\xcd\x5a\xc7\xe3\x4a\x04\xa1\xc5\x3b\xc1\x73\x39\xae\
\x15\x18\x4a\x7a\x1c\x81\x6a\x82\x15\x24\xd2\x07\x52\xe0\x84\x02\
\x6a\x18\x02\xa1\x20\x98\x86\x11\x95\x8e\x92\x52\xc2\x24\x60\xe5\
\xc4\x31\x6c\x5c\x38\x0f\xbb\xd1\x84\xdb\xea\xa0\xb5\xb0\x88\xf6\
\xc2\x02\xda\x8b\x4b\x68\x2d\x74\x60\x18\x26\x5e\xf7\xe5\x2f\x1e\
\xdb\x74\xdf\xf3\xf0\xd0\xdd\x77\x25\x0c\x21\x05\x17\x65\x6a\xd1\
\x41\x13\x2e\x5e\x46\xb3\xd9\x8c\x24\xf0\x69\xa2\xdd\x74\x8c\x62\
\x10\x09\x6c\x6d\x6d\x61\x4a\x7c\x69\x5a\x82\x6d\xcd\x96\x6a\x60\
\xba\x28\x60\x94\x73\xe2\xc5\xe6\x01\xa9\x2d\xd9\x44\x14\x35\x55\
\xfb\x92\x1b\x0e\x62\xef\x35\xd7\xe2\xf8\x53\x4f\xc0\x6d\xb6\x61\
\xb9\x2e\x9c\x46\x03\x8d\x56\x0b\x8d\x66\x0b\x8e\xdb\x80\xed\x3a\
\x70\x1b\x0d\x38\x8e\x0b\xb7\xd1\x40\xbf\xd7\x53\xac\xca\xb6\xd1\
\x68\x2a\xed\xde\x32\xa5\xae\x2e\xa1\xe4\xc2\x40\x4a\x50\x10\x60\
\xcf\xae\x65\xec\x7f\xe5\xcb\x71\xfb\xed\xb7\xe1\xfe\x07\x1e\xc6\
\x9d\x7f\xf7\xb7\x30\x4c\x2b\x2e\xf1\x23\x25\x58\x36\x54\xec\x49\
\x4b\x7b\xfe\x68\x08\xcb\x6d\xa0\xb9\xb0\x84\xdd\x07\xae\xc5\x81\
\x83\x07\xb1\xef\xc0\x01\x2c\x2d\x2d\x62\x69\x69\x11\x8b\x9d\x36\
\x5a\xad\x06\x9a\xae\x0b\xd7\xb1\xe1\x58\x26\x1c\xcb\x8a\x1b\x1d\
\x1a\x2a\xbf\x68\x73\xe8\xc1\xf3\x03\x1c\xba\xe5\x79\x78\xf8\xce\
\xcf\xab\x92\x35\x64\x80\x4c\x1b\x06\x03\x86\x2d\x20\x0c\x4b\xd5\
\xdc\xcb\x5c\xa3\x3c\x36\x01\x52\x4a\x86\xf3\x86\x03\xfc\xc2\x2f\
\xfd\x4b\xfc\xb3\x1f\xf9\x11\xbc\xf7\x53\x7f\xa3\x26\x67\xdd\x0f\
\x8a\x89\xc0\x32\xc1\x9e\x12\xf1\xa6\x88\x55\x50\x9c\x84\xaa\x62\
\x23\x61\x35\x88\xd0\x0e\x1f\xe8\x58\xd3\x05\x6c\xac\x6b\xd6\xd4\
\x69\x63\x6b\x30\xc0\xc0\xf7\xe1\x05\x26\x2c\x41\x30\xa6\x89\x79\
\x05\x39\x4d\x06\x09\x1c\x58\x5a\xc4\xcb\x5e\xfd\x6a\x7c\xee\xff\
\xfc\x0d\x0c\x93\x52\xbc\x25\x09\x4e\x91\x74\x87\x38\x0f\x29\x9b\
\xd7\x84\x44\xac\x89\x38\x1d\x43\x23\xca\x56\xe3\x4e\xfc\x4d\xe6\
\xb2\x8d\xe3\x52\xcc\xe4\x26\xe8\x96\xa4\x17\x21\x49\xd3\xc6\xbe\
\x5d\xbb\xd0\xdf\x5c\xc7\x68\xd0\x87\xd8\xdc\x80\x69\xad\x62\xd5\
\x71\x60\xbb\x0d\x34\xda\x0a\xa4\x84\x69\xa2\xe9\x7c\x43\x16\xe7\
\x70\xd7\xa3\x8f\xa1\xbb\xb1\x31\xbd\x23\x2e\x4f\xa2\x4e\xc9\xe3\
\x4d\x58\xde\xb5\xab\x04\xfa\x14\x54\xc2\x18\x7b\x0c\x89\x98\xeb\
\xd4\x76\x17\xd3\x00\xa9\x06\xa8\x1a\x98\x4a\xcb\x78\xb3\x57\x7c\
\x48\x9f\x90\x2a\x3e\x20\xd3\xf9\x40\x81\x94\x51\x05\x81\x8e\x63\
\xe1\xbd\x1f\xfc\x10\x7e\xee\xe3\xdf\x0f\xdf\xf3\x60\xf6\x2c\xf4\
\x6d\x1b\xdd\x35\x1b\x6e\xb3\x05\xc7\x75\x61\xbb\x2e\x9c\x46\x13\
\x6e\xa3\x89\x46\xab\x89\x66\xb3\x05\x57\x03\x52\xbf\x3f\x50\x46\
\x09\xc7\x8e\x0c\x13\xa6\x6e\xab\x61\x99\x26\xd6\xd6\x37\xb1\xbe\
\xb1\x81\xb3\x67\xce\xe2\xdc\x99\x33\x30\x2d\x5b\x27\xa8\x8a\xa8\
\xc2\xb8\x6a\xd6\x46\x30\x6d\x1b\xad\x4e\x07\xb6\x6b\x43\x4a\x56\
\x9f\xeb\x3a\x90\xc1\x08\xae\x6b\xe3\xc6\xeb\x0f\x61\x71\xa1\x0d\
\xc7\xb2\x60\x5b\x26\x5c\x5b\xfd\xb5\x74\x2b\x78\x2b\xb4\xb8\x0b\
\x82\xa1\x13\x61\x5d\xcb\xc4\x6f\xfc\x9b\x5f\xc2\x8f\xfe\xcc\x2f\
\xe1\x33\x7f\xf6\xdf\x61\xd9\x0e\x08\x02\xa6\xb0\xa2\xaa\x0f\x20\
\x91\xae\x50\x91\x9c\x03\x23\xb9\x29\x9d\x50\x63\x39\x0e\x3e\xf5\
\xa7\x7f\x8c\xef\xff\xd8\xf7\xe0\xeb\x3f\xfc\x1d\xf8\xfd\xdf\xfe\
\x75\x58\xb6\xa3\x6c\xcb\x51\xf2\xae\xe6\x0d\x22\x1d\x87\xe1\xb1\
\xfb\x6a\xa2\x6e\xd8\x16\x46\x41\x80\xde\x28\x00\x1b\x12\xde\x70\
\xa8\xe2\x4c\xeb\xeb\xd8\xdc\xdc\x44\x6f\x71\x11\x5b\xbd\x3e\xba\
\xfd\x21\xda\x8e\x0d\xd7\x34\x72\x8c\x00\xf9\x93\xfb\xb8\x9c\x07\
\xd8\xa6\x81\xb7\xbd\xf3\x9d\xf8\xfb\xbf\xfa\x4b\x55\x53\xb0\x68\
\xbd\x1f\xc5\x9a\x62\xb3\x43\xe4\x65\xe0\xa4\xcb\x9c\xa3\x78\x5a\
\x94\xb0\x9b\x90\x2b\x89\x92\x46\x88\x44\x22\xf2\x18\x38\x8d\x4f\
\xc6\x1c\x82\x24\x8d\xcb\x64\x0d\xd7\x45\xab\xd9\x4c\x55\x9c\x6f\
\xb8\x0e\xfc\xfe\x16\x78\x34\x80\xdb\x68\xc0\xf7\x47\xe8\x6d\xae\
\x23\x60\x28\x25\xa0\xd9\x82\x64\xc6\x60\x34\x4a\x2d\x47\x3c\x29\
\xf1\x4f\xbe\xf9\x9b\x4b\x26\xd7\x26\x0e\x34\x61\x22\x63\x5a\x5c\
\x5c\xcc\xc8\x96\x93\x31\x6a\x6a\xe4\x8a\x08\x77\xde\x71\x07\xb6\
\xc1\x96\xea\xbe\x4c\x35\x30\xcd\x8d\x35\x95\xad\x97\x97\x62\x4c\
\x91\xf5\x5a\x57\xf4\x0e\x82\x18\x9c\x04\x11\xde\xf9\xba\xaf\xc0\
\xbf\x69\x77\xd0\xdb\xda\x82\x37\x1c\x28\xe7\x9d\x10\xe8\x6f\xae\
\xc3\xb2\x1d\x58\x8e\x03\xcb\xd1\xe0\xd4\x6c\xa2\xd9\x6a\x2b\xa7\
\x53\xbb\x8d\x46\xb3\x09\xb7\xd1\x80\xed\x38\x30\x4d\x0b\x52\x4a\
\x8c\x46\x1e\xce\x9f\x3b\x87\xfe\x56\x0f\xeb\xab\x17\xb0\xb5\xb9\
\x19\x5f\x50\x42\xaf\x92\xa5\x00\x84\x4e\x8e\x6c\xb8\x70\x6c\x1b\
\xa6\xad\x00\x2d\xf0\x3c\xf8\xbe\x8f\x20\x08\x30\xec\xf7\x70\x7e\
\x34\xc4\xfa\xea\x05\x9c\x39\x75\x12\xb7\xbf\xe0\x05\x78\xe9\x0b\
\x9f\x87\x5d\x0b\x6d\x18\x82\x54\xc7\x5d\xc3\x80\x69\x68\x40\x22\
\xc5\x96\x0c\x43\xc0\xd2\x20\xd5\xb0\x5c\xfc\xea\xcf\xfc\x18\x3e\
\xde\x6c\xe2\xaf\xfe\xf0\xf7\x61\x59\xb6\x06\x25\x11\xb5\x1c\x8f\
\x25\xa6\x48\xa7\x49\x4c\x38\x7a\xc5\x1e\x77\x80\x8a\xbe\xcf\xbf\
\xfe\x57\xff\x1a\xbf\xf8\x33\x3f\x85\x3f\xf8\xff\xfd\x66\xe4\x1a\
\x94\x52\x4d\xdc\x92\x42\x59\x4f\xff\x32\xd9\x46\x83\x09\x10\x54\
\xb1\x0d\xc0\x36\x0c\x78\x86\xae\xb8\xae\x59\x53\x68\x82\xd8\xec\
\x76\xd1\xed\x75\xb0\xbe\xb5\x85\xc5\x96\x8b\xa6\x65\xc2\x24\x02\
\xcd\x6a\x82\x20\x81\xe7\xde\x74\x23\xdc\x66\x0b\x41\x10\x24\x3a\
\x15\x27\xa8\x40\x24\x37\x72\x2e\x53\x0a\x65\xbe\xf8\xd8\x51\xa6\
\xc0\xe8\x78\x2d\xc1\x64\x4e\x53\x24\xe9\x65\x67\xe7\x02\x83\x40\
\xcc\x32\x63\x60\x52\x3d\xc5\xcc\xd4\x6f\xb3\x7b\xd7\x32\x76\x2d\
\x76\x20\xfd\x11\x0e\xec\x5d\x80\x69\x59\x78\xc9\x97\xbd\x1c\x2f\
\x7c\xc9\x97\xe1\xff\xf9\x6f\x7f\x82\x47\x1e\x7d\x1c\xfd\xfe\x00\
\xf7\x3d\xfa\x04\x5e\x7a\xf8\x39\xd1\x77\xfe\x1f\x9f\xfe\x5b\x3c\
\xfe\xe0\x03\xd3\xd9\x12\x4a\x1c\xf0\x24\x63\x5a\xde\x95\x2f\x45\
\x52\x79\xc3\x43\xea\x31\x22\x74\xa7\x57\x16\xaf\x8b\xb7\xd6\xc0\
\xb4\x63\xec\x69\x56\x19\x8f\xc3\xaa\x0a\x71\x45\xee\x38\x1e\xe0\
\xfb\x7e\x94\xeb\xb3\xb7\xe9\xe2\x1d\x1f\xfc\x26\xfc\xde\xaf\xff\
\x2a\xc8\x30\xe0\x79\x43\x70\x10\xc0\xb4\x1d\x78\x66\x1f\x86\x65\
\xeb\x46\x83\x36\x4c\xcb\x86\xdd\x70\xd1\xec\x2c\xa0\xd1\x6a\xc3\
\x69\x34\x30\xe8\xf5\x35\xf1\x20\xf4\xbb\x5b\x51\x41\x4d\x4a\x26\
\xae\x26\x2d\xdf\x89\x36\x09\x86\x21\xe0\xd8\x16\x1c\xd7\x56\xe5\
\x7e\xa4\x8c\x74\x78\x4a\xc4\x65\x88\x08\xa7\x4f\x1c\xc7\xe9\x13\
\xc7\x71\xdf\xdd\x77\xe3\x2d\x6f\x7d\x33\x5e\x7c\xeb\x8d\x68\x3a\
\x36\x84\xa0\xa8\x3a\xba\x21\x62\x53\x80\x91\x98\xb4\xdb\xb6\x85\
\x7f\xfd\xcf\xbe\x1f\x1f\x38\x7a\x14\x0f\x7c\xe1\xef\xe3\x72\x3c\
\x94\xb4\xa2\xc7\x13\x6b\xfe\xb4\x9e\x28\xbf\xc3\x80\x65\xd9\xf8\
\xf4\x5f\xfc\x29\x82\x9f\xfe\x09\xbc\xea\x0d\x6f\xc2\x67\xfe\xfa\
\x2f\xf5\x84\x16\x84\x9d\x1a\x63\x86\x22\xc2\xff\xc5\x93\x12\xd3\
\x78\xf9\x25\xc7\x34\xe0\x05\x12\xfd\x40\x2d\x26\x46\x83\x3e\x36\
\xd6\x56\x23\x13\xc4\x56\xaf\x8f\xcd\xad\x1e\x36\xfb\x6d\x74\x1c\
\x1b\xb6\x50\xd5\xe0\x51\x91\x35\x85\x95\x20\xf6\x2d\x2d\xe2\xf6\
\x97\xbe\x14\xf7\x7e\xee\x73\xaa\x02\x7d\xb6\xe0\x51\xa2\x16\xde\
\x58\xad\xbc\xa4\x43\x2f\xaa\x5f\x97\xb5\x9f\x87\x65\xa3\x12\x00\
\x95\xa2\x79\xe3\xb6\xf1\x22\xa7\x5e\x2a\xee\x94\xf8\xdd\xc2\x1c\
\x36\x2d\x24\x42\x10\x61\xa1\xd3\xc1\x4d\x37\x1c\xc2\xfa\xfa\x2a\
\x1a\xcd\x06\x16\x17\x3a\xf8\xa1\x1f\xf8\x41\xec\xda\xbd\x0f\xef\
\x7f\xd7\xbb\xf0\x5b\xbf\xf3\xdb\xf8\xf8\xc7\x3f\x81\x5f\xfc\x67\
\x3f\x86\xf7\xbd\xee\xd3\x70\x4c\x03\x77\x3d\xf1\x24\xbe\xed\x1d\
\x6f\xdf\x3e\x28\xe5\x1c\xec\x5d\xbb\x76\xa5\x64\x62\x2a\x41\xc2\
\x26\x3d\x46\x00\x1e\x7f\xec\xb1\x64\x8c\x69\x56\x77\x1e\x6a\x29\
\xaf\xfa\x10\x35\x20\x8d\x3d\x56\xb6\x61\xa0\x24\xc3\x04\x4b\x15\
\xfb\xd1\x0d\xc5\xa2\xa4\x48\x95\x30\x1b\x68\x59\x87\xf0\x5d\xdf\
\xf4\x7e\xd8\x8e\x03\xdb\x32\x41\xcc\x90\xde\x10\x5e\x6f\x13\xc3\
\xcd\x35\x0c\x36\x56\x31\xe8\x6e\xa2\xbf\xb9\x81\xad\xf5\x55\x6c\
\x9c\x5b\xc1\xb9\xe3\xc7\x70\xfc\xf1\x47\xf1\xd4\x03\xf7\xe3\xd4\
\x33\x4f\xe1\xec\xf1\xa3\x38\x77\xf2\x04\x06\xfd\x2d\x04\xbe\x0f\
\xd6\x31\x24\x29\x95\xc1\x41\xdd\x82\x54\x6c\x09\x2c\x61\x18\x6a\
\xee\x49\x76\xac\x4d\x88\x37\x80\xee\x91\x04\x40\x95\x55\x32\x0c\
\x9c\x3d\x7d\x0a\xbf\xf3\xef\x7f\x13\xff\xe5\x8f\xff\x0c\x81\x94\
\x68\xdb\x16\x5c\xd3\x80\x63\x1a\x70\x0c\x01\x5b\xdf\x4c\x41\x11\
\x58\x19\x44\x68\xd9\x26\xfe\xcb\xbf\xff\x65\x2c\xed\xd9\xa7\xb6\
\x49\x99\x96\xe8\x65\xe4\x9b\x4c\x5f\x73\x7f\x38\xc4\x1f\xfd\xd9\
\xff\xc2\x37\x7d\xf8\x23\xf0\xbc\x51\xd4\xd3\x49\x26\x12\x6f\x8b\
\xfa\x4b\x25\x1b\x25\x46\x0d\x13\x99\x11\x04\x7e\xf4\x7b\x05\x81\
\x8f\xad\x8d\x0d\x74\xd7\xd7\xb1\xd5\xed\xa2\xd7\xeb\x61\xab\x3f\
\x40\xb7\x3f\x40\xdf\xf3\xe1\x73\xf9\x0e\xb7\xb9\x72\x9e\x61\xe0\
\x8d\x5f\xf3\x35\x08\x52\x25\x8a\xb2\x27\x18\x8f\xf5\x00\x4c\xfd\
\x3b\x61\x29\x4f\xf6\xe4\x4a\xb5\x5f\x4f\x01\x1d\x32\xc5\x7d\x39\
\xbf\x6f\x53\x8a\xbd\x8d\x83\x53\x38\x1c\xd7\x89\x62\xa6\x44\x80\
\x10\x02\xed\x56\x0b\x6f\x78\xfd\x57\x81\x99\xd1\x6a\x36\xf1\x63\
\x9f\xf8\x29\x2c\x2f\xef\x51\xd7\x83\x69\xc2\x1b\x0c\x10\x78\x23\
\x1c\xb9\xff\x2e\xbc\xf4\x25\x2f\xc1\x2b\x5e\xfd\x1a\x7c\xd5\x8b\
\x5f\x84\xc0\xf7\x51\xa6\x4a\x43\xa9\xe0\x92\xfe\x66\x82\x04\x1a\
\xcd\xc6\xc4\xac\xe8\x59\x10\xe1\x89\xc7\x1f\xe7\x29\x4c\xa9\x2c\
\x63\xaa\x01\xa9\x66\x4c\x95\x63\x4d\x55\x73\x98\xa2\x93\x91\x88\
\xa2\x40\xba\x37\x1a\x21\xd0\xb5\xdd\x24\x2b\x29\xcf\xf3\x83\x88\
\x9d\x1c\x5a\x5e\xc0\x4d\xb7\xbf\x10\x4f\x3c\x78\x2f\x4c\xcb\x02\
\x58\x95\x14\x92\xbe\x07\x6f\xd0\x03\x89\x2d\x98\x6e\x23\x62\x4f\
\xbe\x69\x29\x47\x9b\x61\xc2\x30\x4d\x88\xc0\x87\x0c\x4c\x04\xbe\
\x0f\xc3\xf4\x20\x84\x01\x32\x04\x84\x30\xc6\x58\x13\xa0\x2c\xb9\
\x86\x20\x10\x8b\x68\xc2\x16\x88\x6d\xde\x71\x55\xeb\x58\x8e\x0c\
\x8b\xcf\x1a\x86\x09\xe1\x12\x3e\xfb\xe9\x4f\x41\x4a\x89\x1f\xfa\
\xb6\x0f\xa2\x6d\x1b\x51\xa7\xd8\x08\x67\x12\x7d\x90\xc2\xb1\xec\
\x58\xf8\x4f\xbf\xf7\xbb\x78\xfb\x1b\xdf\x00\xdb\x71\x74\x59\xa4\
\x8c\xd0\x95\xed\xce\x9b\xfd\x59\x12\xee\x34\xd3\xb6\xf1\x47\xbf\
\xfb\x9f\xf1\xc1\x77\xfe\x21\x16\x16\x97\xd0\xef\xf5\x40\x82\x20\
\xe5\xf8\x4f\x4a\xda\x4d\x15\xad\xee\xc3\x12\x4c\xba\x32\x39\x13\
\x81\x83\x00\x96\x10\xf0\x84\x8c\xfa\x53\xa9\x6a\x10\x1a\x98\xfa\
\x7d\x0c\x06\x03\x6c\xf6\x7a\xe8\x0e\x5b\x68\xdb\x96\x2a\x53\xb4\
\x8d\x9c\xa6\x97\xbf\xf4\x25\x70\x5c\x37\x55\x7b\x30\x5f\x76\xe2\
\xb4\xac\x47\x89\xaa\xe3\x51\xf2\x6c\x96\xe5\x70\x82\x01\x51\x94\
\x74\x8b\x9c\x9c\x26\xe4\xc5\x9b\xa6\x30\xa7\xb0\x4e\x9e\x61\x1a\
\x29\x89\x4f\x08\x81\x6f\xfe\xf0\xb7\xe3\x86\x1b\x6e\xc0\x0b\x5f\
\xf4\x62\x1c\x3c\x78\x43\x6a\x9f\x4e\x9f\x39\xa3\x2a\x7a\x08\x81\
\x63\x4f\x3e\xa1\x41\x4d\x20\xd5\x29\x73\xd6\x12\x44\x99\x53\xc6\
\xb2\x6d\x5c\x7f\xf8\x70\x41\xd5\x07\x14\x9a\x20\xd2\x26\xc9\xf4\
\x63\x52\x4a\x1c\x39\xf2\x4c\xd9\x12\x44\xb2\x04\x20\xd5\xe0\x54\
\x33\xa6\x4a\x6c\x69\x96\x58\x13\x03\x90\x52\xbb\xf1\xbc\xd1\x10\
\xc3\xe1\x50\xe5\x11\x05\x81\xea\xc1\xa4\xa9\xca\xe6\xd0\xc3\xd1\
\xf5\x2e\xfe\xd7\x9d\x0f\x62\xf5\xdc\x0a\x84\xd0\x14\x06\xaa\x24\
\x0f\x40\xe0\x40\xc2\x1f\xf4\xd0\x5f\x3b\x8f\xad\xf3\x67\xd1\xdf\
\x58\x53\xb7\xcd\x75\x0c\x7b\x5d\x0c\xfb\x3d\x75\xdb\xea\x62\xd8\
\xdb\x54\x7f\xfb\x5b\x18\xf5\x7b\x18\x0d\x7a\x18\x0d\xfa\xf0\x86\
\x03\xf8\x9e\x02\x47\xb5\x0f\x71\x5b\x84\x74\x51\xd6\xb8\x71\x5d\
\xc8\x20\xe2\xce\xe8\x7a\x92\x13\x04\x61\x1a\x68\xb4\x5a\xf8\xdc\
\x67\x3e\x8d\x1f\xfe\xc5\x7f\x83\xee\xc8\xd7\x7d\xa5\x74\xb5\x74\
\x1d\xdb\x89\x80\x2a\x71\x91\xbf\xe8\x39\x7b\xf1\xb1\x9f\xfc\x59\
\x0c\x07\xfd\x52\x0b\xdf\x74\xce\x6d\xa2\x7c\x12\x2b\xb0\x7c\xe6\
\xd1\x87\x70\x6e\x63\x13\x2f\x7d\xc5\xab\x10\x04\x7e\xdc\x36\x3e\
\x51\x70\x36\xd9\x70\x50\x6a\xb9\x32\x97\x41\x49\xa9\x19\x1f\x45\
\x8f\xf9\xa3\x11\xba\x1b\xeb\xe8\x6e\x6c\xa2\xb7\xb5\x85\xfe\x60\
\xa8\xcb\x14\x0d\x30\xf0\xf3\x5b\xaf\x8f\x9d\x4d\x05\x25\x8a\x0c\
\x22\xec\x59\x5c\xc0\x75\xd7\xdf\x10\xd5\x9b\x2b\x3c\x39\xc7\xa6\
\xb2\x74\xe3\xc0\x6c\x2b\xf5\x24\xb3\x4a\xb2\x26\xce\x13\x92\x92\
\xdf\x81\xcb\xab\x4c\x61\x0a\x44\x28\xcd\x52\x82\x05\xb7\x5b\x1d\
\xbc\xf5\x6b\xdf\x95\x06\x25\x8d\x35\xfd\x7e\x3f\x3e\x2f\xa2\x3a\
\x89\xa5\x89\x50\x25\x19\x2f\x8d\xa9\x3c\x17\x14\x60\x66\x0c\x07\
\x03\x99\x91\xf1\x18\xc5\xe5\x88\x64\x1d\x5f\xaa\x19\xd3\xbc\x59\
\x53\xd9\x58\x53\xea\x24\x64\x6f\x84\x60\xd0\x43\xe0\xd8\x18\x0e\
\xfa\x08\x82\x00\x9e\xe7\xe3\x99\xa3\xc7\xf1\xcc\xd1\xe3\x38\x76\
\xf4\x18\x1e\xbe\xf7\x1e\x1c\x7f\xe2\x31\xf8\x9e\x2a\xdc\x2a\x0c\
\x03\x2c\x83\xe8\x62\x0d\xab\x6e\x43\x12\xd8\x57\x39\x47\xfe\x70\
\x00\x21\x0c\x34\x97\x96\x11\x8c\x86\x20\xd3\x86\x69\x3b\x10\x42\
\x57\x97\x30\x4c\x08\xd3\x52\x26\x0a\x43\xc9\x6f\xc2\x30\x40\x42\
\xdd\x40\x84\x46\xb3\xa9\xf2\x9e\xa2\x95\xaf\x84\x94\x14\xb1\xa2\
\x6c\x1d\x36\x4a\x24\x53\x46\x7d\x77\x0c\xa0\xd1\x6c\xe2\x89\x07\
\xef\xc7\x8f\xfe\xd2\xbf\xc5\xaf\xfe\xb3\xef\x85\x6b\x88\xc2\xb9\
\x38\xf9\xef\xef\x79\xff\xdb\xf1\x7b\xbf\xf5\x1b\x58\x3b\x77\x26\
\x91\x10\xca\xf9\x13\xa3\x36\x2f\x64\x5b\xc4\x43\xaa\x09\xd9\xf7\
\x3c\xfc\x9f\xbf\xfb\x2c\xbe\xec\x55\xaf\xc1\x27\xff\xe7\xff\xd0\
\x9d\x54\x29\x6c\x3e\x12\x49\x6d\x04\xa8\x7e\x52\x02\x63\xac\x29\
\xf9\x1d\x41\x04\xdf\xf3\x11\x40\xc0\x30\x0d\x48\x19\x60\xb0\xd5\
\x43\x77\x73\x03\x5b\xdd\x2e\xfa\xfd\x3e\x86\xa3\x11\xfa\xc3\x21\
\xfa\x9e\x8f\x96\x6d\xc2\x24\xa3\x54\x4e\xd3\xd8\xbc\x49\x04\xd7\
\x34\xf1\xca\x37\xbc\x11\xcf\x3c\xf6\xd8\xd4\xf8\x4a\x2a\xce\x94\
\xc9\xfd\x62\xcd\x76\x22\x63\xc3\x18\xa8\x23\x6b\xc5\x4b\x46\x98\
\x32\xf1\x26\x64\x2a\x43\xe4\x07\xce\x18\x88\xca\x64\x4d\x75\xd2\
\xe9\x9d\x91\xcc\x38\x76\xec\x78\xc9\x9e\x4b\x34\x65\xbd\x38\xa5\
\x30\xab\x64\x2c\x2e\x2d\x63\x77\x58\x27\x2f\xf7\x2d\xc5\x86\x87\
\xbc\xd7\x11\x11\x46\x9e\x17\x96\x23\xaa\x1a\x5b\xaa\xa5\xbc\x1a\
\x98\xe6\x2e\xe9\x55\xa9\x93\xc7\xec\xfb\x90\xa3\x3e\x80\x65\xac\
\x9d\x3b\x87\xbb\x3f\xff\x39\xdc\x6f\x5a\xb8\x70\xf6\x0c\x7c\x6f\
\x04\x19\x04\x00\x18\xa6\x65\x43\x18\x06\xa4\xef\x47\xe5\x7b\x84\
\x20\xc8\x10\x9c\x0c\x03\xa4\x2d\xdd\x44\x42\xc5\x23\x98\xc1\xbe\
\x07\xc9\x23\x60\x34\x84\x3f\xe8\x81\x0c\x03\xa6\x96\xfa\x42\x70\
\x4a\x02\x93\x10\x06\x84\xa9\x92\x5a\x4d\xcb\x4c\xb5\xbc\x8e\x18\
\x92\x9e\x98\xa3\x86\x78\x14\x77\x53\x45\xe2\x31\x22\x02\x69\x67\
\xa1\xdb\x6c\xe1\xa1\x7b\xee\xc2\xaf\xfd\xd1\xff\xc4\x0f\x7e\xfd\
\xd7\x42\x10\xa6\x82\x93\x23\x08\xbf\xf6\x1b\xbf\x8e\xf7\xbd\xed\
\xad\x68\x34\x5b\x89\x9e\x42\xe3\xd3\x42\x6e\x8b\x8e\x90\xcd\x31\
\xc3\x30\x0c\xfc\xf9\x1f\xff\x21\xbe\xf3\x9f\x7c\x77\x9c\xab\xc4\
\x00\x84\x84\x94\xc9\x85\xb8\x8a\x37\x00\x0c\xa6\xb0\x27\x16\xc5\
\xf6\x6b\x0a\xdd\x7c\x04\x93\xa0\x98\x10\xc7\x72\x5e\x77\x63\x03\
\xdd\x6e\x17\x5b\xbd\x1e\x06\x83\x21\xfa\xc3\x21\x06\x23\x0f\x23\
\xd7\xd6\x72\x1e\xcd\x24\xe7\x09\x21\xf0\xda\xd7\xbc\x1a\xbf\xf7\
\x1b\xff\x6e\xfc\xf4\xe3\xa4\x16\xaa\x2b\x37\xa4\x4b\xde\xc5\xb9\
\x4c\x13\x7a\x28\xa5\x71\x25\x6b\x1b\x4f\x4a\x7a\xe3\xdd\xa6\x26\
\x55\x47\x90\x41\x80\xc3\x07\xaf\x4b\xb5\x55\x4f\x75\x29\xce\xfc\
\xf0\xe1\xef\xb3\xbe\xbe\x31\xad\x40\xc6\xdc\x86\x21\x04\x5c\xd7\
\x2d\xfe\x8c\x09\x86\x87\x6c\xce\x73\xf8\x0f\x75\xed\x16\x26\xd7\
\x4a\x54\xca\x75\xac\x47\x0d\x4c\xd5\x25\xbd\xa2\x84\xb8\xa9\x00\
\xc5\x00\x42\x03\xc4\x68\x30\xc0\xea\x70\xa8\x53\x6c\x14\x33\x22\
\xa2\x68\xa2\xa5\x54\x5f\x22\x05\x40\x42\x08\x05\x4e\x14\xf7\x29\
\x52\xad\x26\x84\x8a\x53\xf9\x3e\x0c\xc3\x04\x4b\xd5\xee\x02\x20\
\xb0\x37\x84\x47\x42\x95\x1b\xb2\x6c\x08\xcb\x8e\xc1\x49\x18\x20\
\xc3\x80\xdb\x44\x64\x2d\xa7\xc4\x4a\x97\xb5\x95\x5d\x88\x6c\x43\
\xbf\x70\x02\xa1\x88\xc5\x21\x29\xc1\x48\x89\x66\xbb\x8d\x3f\xfe\
\xbd\xdf\xc5\x6d\x37\xdd\x80\x77\xbe\xec\xf9\xf9\x8b\xe5\xcc\x78\
\xe5\x73\x6f\xc0\x0b\xbf\xfc\x15\x78\xf4\xde\xbb\x52\x13\x5b\x9a\
\x51\x40\xc9\x8c\x41\x10\xb3\xa5\x0c\x38\x91\x20\x3c\xf8\xc5\xcf\
\xe1\x13\xdf\xfd\xa0\x72\xb6\x85\x6c\x4f\x2a\x70\x82\x2e\x08\x41\
\xac\xc4\x69\xc5\x9a\x34\x3b\x88\xe2\x4c\x89\x44\x51\x22\x58\x06\
\x21\x90\x04\x4f\x4a\x08\x29\xe1\x7b\x9e\x32\x41\x6c\x6c\x62\xab\
\xbb\x85\x5e\xbf\x8f\xfe\x60\x80\xde\x70\x04\x5f\x36\x12\x55\x7b\
\xab\x2d\xea\x43\x39\xef\x9a\xbd\xbb\xd1\x59\x5c\x42\xbf\xb7\x35\
\xce\x3c\x52\x31\x9e\xc4\x29\x16\xc5\x9d\x28\x79\x37\xb7\x30\x6c\
\xdc\x28\x30\xcd\x90\xf2\xfa\x59\xe4\xb1\xa4\xe2\x9a\x7a\x40\xab\
\xd9\xc8\x65\x4b\x94\x73\x27\x34\x19\xfa\xbe\x3f\x37\xa9\x6e\xda\
\x18\x79\x5e\x54\x16\xac\x1a\x43\xca\xff\x41\x89\x04\xd6\x37\x36\
\x80\xd9\xca\x11\x95\x0d\x1f\xd4\xa3\x8e\x31\x4d\x64\x49\x79\x74\
\x7b\x2a\x28\x11\x11\x9f\x78\xea\x31\x56\x93\x86\x36\x2f\x8b\x70\
\x62\x47\x02\x88\x10\x97\x7c\x49\x36\xcc\xd3\x00\x20\x48\xc4\xef\
\x4b\xf4\x2b\x82\x4e\xdc\x8d\x7e\x28\x22\x08\x30\xd8\xf3\x10\x8c\
\x06\xf0\xfb\x5b\x18\x6e\x6d\x60\xb8\xb9\x86\xe1\xd6\x46\x1c\x6f\
\xd2\x7f\x91\x4c\xe5\x09\x27\x67\xc9\x90\x32\x80\x37\xf2\xb4\x3b\
\x4a\xcd\x3c\xa1\x59\x83\x42\x49\x30\x6c\x75\x21\x04\x0c\xd3\x84\
\xa1\x5b\x8e\xb7\x17\x17\xf1\x4b\x3f\xff\x0b\x58\xe9\x0d\x53\x71\
\x25\x9a\x70\x72\xfd\xf4\x4f\xfd\x24\x86\xfd\x5e\x6a\xa6\x91\x50\
\xe6\x85\x20\x90\xf0\x46\x3e\x46\x43\x0f\xfd\xfe\x00\xa3\xe1\x70\
\xcc\x61\x28\xa5\x02\x2c\x05\x1c\xeb\xa9\x18\x54\xba\xf1\x61\xd8\
\xc6\x23\x88\x63\x6a\x49\xa7\x1e\xc7\x7f\xc3\xc7\x05\x2b\x50\x0a\
\xcb\xec\x78\xa3\x21\xba\x9b\x1b\xe8\x6e\xa9\x06\x82\xbd\xc1\x10\
\xdd\x7e\x1f\x03\x2f\x80\xaf\x9b\x08\xce\x12\xcd\x16\x04\x2c\x36\
\x9b\xb8\xf9\xf9\xcf\x87\x0c\x64\xa9\xe5\x11\x8f\xa9\x9e\x71\x9b\
\x8c\x08\x31\x92\xb7\x74\x6a\x5d\x22\xd6\x14\x57\x2e\xcf\x95\x51\
\xa7\x06\xcf\x18\xa6\x69\xa6\x80\x89\xc6\x40\x29\x7e\x84\x08\xf0\
\x3c\x0f\x27\x4f\x9e\x9a\x2c\xe5\x51\x49\xf4\xe1\xe9\xb1\xa0\x6b\
\xaf\xbd\x0e\xb6\x6d\x67\x0e\x5a\xfe\x76\x18\x53\xe2\x51\xe3\x55\
\x1f\xaa\xca\x77\x75\x59\xa2\x1a\x98\x2e\xaa\x9c\x97\x3a\x49\x59\
\xa1\x91\x0c\xa5\xa0\x64\xcf\x9c\xbc\x2b\x30\x72\xb4\x51\xa6\xa3\
\xab\xd0\x3d\x9c\x52\xfd\x89\x14\x40\x05\x81\x9f\x9e\x01\xc2\xe6\
\x7a\x20\x40\x4a\x48\x6f\x04\x7f\xd0\x83\xd7\xeb\x62\xb8\xb1\x8a\
\xfe\xfa\x2a\x46\xbd\x4d\x58\xb6\xf3\xff\xb1\xf7\xe7\xe1\x96\x5c\
\x77\x79\x28\xfc\xae\xb5\x6a\xdc\xc3\x19\x7b\x52\x6b\xb6\x06\x5b\
\xd6\x60\x07\x6b\x32\x21\x04\x12\x48\x00\x33\xe6\x42\xe0\x83\xf0\
\x7c\xc1\x7c\x09\x17\xb8\x90\xcb\x93\xdc\x87\x29\xe4\x92\xdc\xe4\
\x7e\xb9\x1f\x5c\x48\x20\x24\x38\x10\x27\x71\x20\x04\x42\x18\x92\
\x6b\xb0\x49\xf0\x88\x8d\xa5\x6e\x49\x96\xd4\xb2\x64\xcd\x2d\xf5\
\x74\x4e\xf7\xe9\x33\xed\xb1\xaa\xd6\x5a\xdf\x1f\x6b\x55\xd5\xaa\
\xda\xab\x6a\xd7\x3e\xdd\x92\x65\x54\x4b\x4f\xe9\xf4\xd9\x67\x9f\
\x7d\xf6\xb8\xde\x7a\x7f\xbf\xf7\xf7\xbe\xda\x1e\x08\x59\xf9\x2e\
\xdd\xb8\x79\xc2\x11\xeb\x32\xe3\x74\x3c\xc2\x74\x32\x85\x1f\x74\
\x71\xf8\xe8\x71\x38\xae\x0b\x21\x64\x5e\x0a\xa4\x14\x8c\x39\x70\
\xdc\xbc\x64\xc8\x18\xc3\xdf\xfb\x3f\x7f\x6e\xbe\x84\x5a\xaf\xfb\
\x6e\xbb\x11\xc7\x6e\xb8\x09\x52\x08\xc5\x12\x1d\x17\xcc\xf5\xb5\
\xe3\xb8\x0b\x10\x06\x50\x07\xa0\x0e\x24\x28\xb8\x00\x92\x44\x31\
\x44\xc1\xb5\xf4\x5d\xcf\x1c\x99\xee\xd6\xb3\xe0\x24\xf3\x3c\x29\
\x8b\x74\x3c\x97\x98\xe7\x5f\x99\x14\x60\x10\x59\x29\x31\x9a\x4e\
\x31\xdc\xdb\xc3\x70\x5f\xc9\xc6\x27\x93\x29\x46\x93\x09\x86\x93\
\xa9\x32\x80\xad\xf2\x75\xab\x29\xda\xa4\x79\xbe\x2e\x63\x78\xf7\
\x5f\xfc\x8b\x10\x7a\x84\xc0\xd6\xda\x94\x85\x54\xde\x9c\x35\x99\
\xa0\x52\xde\x4a\x67\x76\xbe\xda\x2c\xa9\xf2\xed\x54\x6c\xd0\x25\
\xf0\xe2\xa9\xb3\x7c\x19\x90\x88\xbd\x98\xcb\x39\xc7\xee\xee\x6e\
\x21\xa2\x83\x34\x02\x27\xe3\x20\x04\xb6\xc9\x66\xcb\x48\x30\x3a\
\xdd\x0e\x28\xa5\xd6\xc7\xd4\xb8\x6e\x52\xea\x0b\x9e\x78\xf8\xe1\
\x79\xa5\xbc\xa6\xb3\x4c\x2d\x28\xb5\xa5\xbc\xd7\x0c\x9c\x44\x05\
\x48\x49\x91\x44\x10\xd1\x04\xd2\x75\x8b\x1f\x1f\x02\x95\xc0\x4a\
\xb4\x0c\x55\xf7\x8f\xcc\xb2\x5d\xe1\x20\x66\x78\x9e\x2c\x58\xeb\
\x14\x06\x4f\xcd\x3f\x91\x36\x1b\xb8\x1e\xe6\x25\xea\xdf\x61\xaf\
\x97\x97\x0a\xb9\xb2\x05\x8a\x13\x35\xaf\xc3\x93\x44\x97\xc7\x1c\
\x1c\x3e\x7e\x3d\xde\xf2\xd6\xb7\xe2\xb6\xdb\x6f\xc5\xf5\xc7\x8f\
\x81\x10\x89\xf3\x9b\x9b\x38\xf9\xf0\x49\x0c\xf6\xf7\x15\x50\x25\
\x5c\xab\x94\x25\x38\x07\xc2\x6e\x17\x4f\x3f\xfe\x18\x4e\xbc\x70\
\x06\x0f\xdc\x72\xdd\xdc\x27\xd6\xa5\x04\xef\xfd\xc1\x1f\xc6\x3f\
\xfd\xb1\xbf\x8b\xce\xf2\x3a\x98\x17\x64\xb7\x97\xb1\x22\xce\x21\
\x12\x35\x5b\xc4\xe3\x08\x84\x32\x08\x1e\xeb\x12\x5f\xac\x22\x2f\
\x20\x21\x25\xcb\x95\x83\x19\x0b\xd0\xe7\x56\x42\x40\x52\xaa\xf9\
\x58\x9a\x05\x65\x94\xf2\x0a\x62\x08\x6d\x7c\x0a\x40\x20\xf5\x13\
\xa4\x8a\x95\xed\xef\x63\xb0\xbf\x9f\x01\xd3\x78\x1a\x61\x7f\x3c\
\xc1\x4a\x37\x44\xe8\x30\x08\x14\x73\x9a\x6a\x1b\x4c\x46\xb9\x92\
\x12\xe0\x9d\xf7\xdc\x6d\xef\xb1\x99\x85\xb0\x54\xf2\x2d\xcb\x61\
\xb4\x79\x9f\x49\xa6\x57\x40\xa9\xe7\x65\xd6\xe8\x0a\xe9\xc4\x73\
\x4a\x5b\xd6\x92\x1e\x32\xf7\xf3\xc3\x6b\xab\x55\xb5\x3b\xfb\xa6\
\xe2\x38\x79\xea\x6e\x23\x49\x26\x2a\x7d\xf1\x9a\x14\xdf\x66\x7c\
\xf2\x2a\xab\x98\xcd\xa6\x6b\x09\x21\xd8\x57\x6e\x2a\x07\x75\x7c\
\x68\x85\x0f\x2d\x30\x5d\x11\x18\xcd\x93\x88\xd7\x32\x29\x42\x88\
\x90\x49\x0c\x1e\x4f\x01\xf4\x90\xab\x7a\x8a\xbb\x92\x34\xa3\xc4\
\x8d\xb2\x5d\xf9\xa0\x84\x40\x52\xe5\x56\x40\x08\x01\x4f\x74\xed\
\x9c\x90\x02\x2e\xa5\x13\xf8\xe6\x25\x54\x2b\x12\x24\x4f\x20\x39\
\xc7\xfe\xce\x76\xc6\x18\x00\x20\x9a\x4e\x10\x47\x91\xb6\x3d\xea\
\x62\x65\xfd\x10\x6e\xbf\xf3\x4e\xfc\x85\x2f\x7b\x10\xd7\x1f\x3d\
\x84\xd0\xf3\xd0\xf5\x3d\xfc\xf9\x3b\x6f\xc7\x5f\x7d\xf7\x7d\x78\
\xdf\x6f\xfc\x0e\x4e\xbf\xf8\x02\x1c\xcf\x53\x59\x4f\x4c\xcd\x67\
\x11\x42\xd0\xed\x2f\xe1\xa7\xfe\xf1\x3f\xc5\x1f\xbe\xff\x5f\x80\
\x35\xd8\x39\xbe\xf3\x3d\x5f\x8d\x9f\xfd\xdf\x43\xb8\x61\x07\xae\
\x1f\xaa\xe7\xc4\x28\xc1\x15\x4a\x77\x3c\x05\x28\x65\x38\xcb\xa3\
\x31\x84\x96\xc1\x4b\x99\xbb\x46\x48\xdb\x2c\x54\xea\xa3\x47\xa8\
\xda\x97\xd3\xb0\x3c\xad\x54\x23\x99\x13\x84\x4a\x2e\x42\x3a\x78\
\x2c\x05\x98\x66\x95\x71\x34\xc5\x70\x7f\x1f\xa3\xe1\x08\xe3\xc9\
\x04\xd3\x28\xc2\x68\x3a\xc5\x34\x49\xc0\xa5\x5b\xf6\x9b\x9d\x6d\
\x9e\x57\xec\xbd\x94\x10\x1c\x5a\x5d\x81\xe7\x07\xaa\xf7\x07\x62\
\xe9\x09\xe5\xa0\x92\xcd\x30\x99\xb1\x17\x30\x1c\xc2\x25\x29\x43\
\x5a\xc1\xcc\xb5\x5a\x9c\x96\xef\xd8\x99\x28\xc2\x86\x53\x46\x49\
\xf1\xd0\xfa\x9a\xf1\x9e\x9b\xbf\xc6\xe3\x31\xa2\xe9\x74\x36\x23\
\xab\x6e\x97\x3e\x80\x84\x3c\xfd\x95\xe5\xa5\xe5\xa6\xed\xa3\x4a\
\xc1\x43\xf9\x44\xc1\x00\x26\x5e\x01\x46\x75\x6c\xa9\x65\x49\x6d\
\x29\xef\x8a\x18\x92\x8d\x31\x61\x81\x5e\x93\xcc\x3e\xe4\x33\x33\
\x2a\x46\xe9\xcd\x04\x26\xcd\x8c\x54\xa8\xa0\x16\x2c\x50\x56\x60\
\x4e\xd0\xd7\x11\x42\x22\x9a\x8c\x51\xa9\x05\xab\xc8\x60\x18\xec\
\xee\xa8\x92\xd4\xde\x2e\x46\xfb\xea\x6b\x12\x45\x58\x3b\x72\x14\
\x47\xae\xbd\x0e\xcb\x6b\xab\x80\xe4\xf8\xfc\x93\x9f\xc5\xc7\x3f\
\xfe\x49\x4c\xa6\x11\x8e\x2d\xf7\x70\xa4\xdf\xc1\x6a\xe8\xe1\xe6\
\xb5\x25\xfc\xef\xdf\xf7\xdd\xb8\xfd\x8e\x3b\x20\xa5\x04\x73\x5c\
\x30\x87\x65\xc3\xbc\x5e\x10\x60\xeb\xe2\x06\x1e\x7e\xee\x74\xa3\
\x27\x7b\xad\x1b\xe0\x6d\x5f\xf2\x00\x1c\xbf\x03\x37\x08\xe1\xfa\
\x01\xbc\xb0\x03\x2f\xec\xc2\xeb\x74\xe1\x77\xfb\xf0\x7b\x7d\x04\
\xdd\x3e\x82\xde\x12\xc2\xde\x32\xc2\xfe\x32\x3a\xcb\xab\xe8\xac\
\x1c\x42\xb0\xbc\x0e\xbf\xbb\x0c\xe2\x06\x88\x24\xc1\x24\x51\xc3\
\xcb\xa6\x6f\x42\x59\x6a\x9e\xab\xfc\xa4\x76\x7d\x90\x33\xf3\x4c\
\x42\x08\x10\x9e\x80\xf0\x24\x53\x00\xc6\xd3\x48\x01\xd3\x68\xa8\
\x64\xe3\xd3\x08\xd3\x28\xc2\x24\x4e\x54\x9f\xa9\xc1\x8e\x43\xac\
\x7d\x26\x82\xd5\x5e\x0f\xd7\xde\x74\x93\x2e\xe7\x99\xce\x0d\x66\
\xaf\xc8\xa8\xb5\x95\xdb\x42\x32\x35\x5b\x2d\x97\xf3\x64\xb1\x1c\
\x57\xa8\xe9\x95\x7b\x4d\x35\x1f\x04\x69\x2f\x11\x7a\xae\xdb\x18\
\x38\x08\x80\xc9\x64\xac\x7a\x96\x57\x88\x3f\x64\xce\x4f\x52\x30\
\x59\x4d\x19\x5d\x45\x0f\x69\xa1\xa6\x95\xbe\xcd\x93\x27\x1e\x6e\
\xc2\x98\x16\x01\xa5\x16\xa8\x5a\x60\x7a\xfd\x7a\x4d\x4a\x24\x65\
\xd8\xfd\xc8\xd9\x7a\xb5\xfd\xa0\x05\x90\x2a\x96\xf5\x72\xe1\x04\
\x6c\x59\x39\x75\x9f\x6e\x29\x11\x6b\xf1\x83\xd9\xb0\x5e\x3e\x74\
\x18\xfd\x95\xd5\x4c\xae\x9e\x9a\x75\x3e\xfd\xf8\x67\xf1\x33\x3f\
\xfb\xf3\x38\x73\x79\x17\x1d\x87\xc1\xa3\xca\x6a\x68\xc9\x73\xf0\
\x13\xdf\xf3\x1d\xe8\x2f\x2f\x65\x51\x1b\x69\x1f\xcc\x71\x1c\x74\
\x7b\x7d\xfc\xff\x7e\xe1\x97\x1a\x7d\xda\x28\x80\x6f\xfc\xf6\x6f\
\x87\xdf\xed\x82\x30\x07\x8e\xef\x83\x79\x2e\x5c\x1d\x93\xe0\x85\
\x21\xbc\xa0\x53\x02\xab\x1e\x82\x6e\x1f\x61\x7f\x19\xdd\xe5\x55\
\xf4\xd6\xd6\x11\x2c\xad\x82\x84\x7d\x48\x27\x00\x27\x0e\x62\x41\
\x31\x8e\x12\xc4\x71\x82\xd4\xf9\x01\x56\x61\x44\x3a\xc7\x25\x0b\
\x22\x08\x21\x24\xa8\x48\x40\xb5\xc0\x42\x02\xe0\x3c\xc1\x78\x38\
\xc0\x70\x7f\x80\x61\xc6\x9a\x62\x8c\xa7\x11\x62\x2e\x0e\xbc\xbf\
\x10\xa8\xf0\xc0\xbb\xef\xbd\x57\xf5\xce\x64\xc5\x19\x90\xb4\x98\
\x07\x99\x03\xb6\x1a\x9c\xa4\x34\xac\x8c\x2a\x7a\x49\x4d\x7a\x4d\
\x98\xb9\x8d\xd9\x7c\xab\x6e\x27\x5c\x00\x52\x08\x46\xc3\x11\xa4\
\x78\x9d\xf6\x61\x42\x94\x4f\x5e\x53\xc1\x83\x9c\x0f\x60\x52\x4a\
\x9c\x3f\x7b\xee\xa0\x7d\xa5\x56\x36\xde\x02\xd3\xeb\x52\xce\xab\
\xef\x35\x65\xfd\x12\x91\xb9\x5f\x17\x2d\x57\x90\x33\xa7\x99\xf2\
\x5d\x2e\x82\x28\x33\x27\x64\xcc\xa9\x38\xd8\x98\x2a\xe6\xea\x56\
\x32\x9d\xe6\xd9\x39\x52\xc2\x71\x5d\xf4\x57\x56\xb4\xe9\x2b\x01\
\x65\x54\xfb\xe7\x29\xcb\x9f\xd1\xfe\x3e\x7e\xfc\xef\xff\x34\xb6\
\x27\x91\x72\x76\xd0\x7f\x61\xc9\x65\xf8\xfe\xef\xfe\x4e\x4c\xc6\
\x63\xc5\x96\x58\x7e\x7f\x82\x30\xc4\x2b\x2f\xbf\x84\x57\xb7\x76\
\x1b\x3d\xc1\x37\xdd\x78\x1d\xde\xf3\x6d\xdf\x86\x5b\xef\xbc\x0b\
\x52\x02\xcc\x71\x75\xec\x7a\x9a\xb2\x1b\x28\x36\x15\x04\x0a\xa8\
\xc2\x8e\x02\xa7\x5e\x1f\xc1\xd2\x0a\xc2\xe5\x35\x74\x56\xd7\xd1\
\x5b\x59\x47\x6f\x75\x1d\x5e\x6f\x19\xd2\x0b\x21\x98\x87\x18\x0c\
\x53\x2e\x31\x98\xc4\x98\xc6\x71\x61\x33\x2f\x82\x93\xe1\x2a\x91\
\x82\x54\x29\xa0\x2f\x53\x00\xee\x6b\x17\x88\xf1\x04\x93\xe9\x14\
\xc3\xc9\x14\xd3\x84\x83\x8b\xf9\x9e\x09\x36\x8b\x5a\x42\x94\x3d\
\xd1\xbd\xf7\xdd\xa7\x37\xed\xfc\xf5\x91\x05\xb6\x04\x83\xe1\xc8\
\x22\x80\xd9\x14\x75\x32\x17\xde\xc8\x2c\x2f\x69\x0e\x6b\x9a\x77\
\x9b\xc6\xf7\x94\x12\xf8\x9e\xb7\x10\xcd\x99\x4c\x27\x06\x9f\xb1\
\xcb\xcc\xc9\x55\xc3\x25\x82\x30\xec\x5c\x19\x29\x29\x81\x95\x94\
\x12\x83\xe1\xe0\x20\xc6\xad\x2d\x08\xb5\xc0\xf4\x9a\x94\xf3\xe4\
\xe2\xbd\x26\xa2\x7a\x20\xd1\x44\x2b\xdf\x0a\x27\x73\x85\x52\x5e\
\x91\x2d\x91\xa2\xe0\x21\x63\x4e\x2c\xbb\x1e\x25\x04\x49\x92\x20\
\x8e\x22\xcb\xcc\x91\x85\x4d\x69\x86\x15\x0d\xf7\xf2\xec\x1c\x29\
\x11\x76\x7b\xca\xa0\xd5\xf0\xd4\x4b\x65\xed\x90\x12\xae\xe7\x61\
\x3c\x1c\xe0\x07\x7e\xf2\x1f\x21\xd5\x50\xa4\x37\x7b\xef\xcd\xc7\
\x71\xcd\xf1\xe3\xca\x2c\x33\xf3\xe3\x23\x60\x8e\x83\x4e\xa7\x8b\
\x9f\x7b\xff\xaf\xcf\x45\x7b\x2e\x25\xce\x6d\x5c\xc4\xb5\xc7\x8f\
\xe1\x2b\xbf\xea\x2b\xf1\x57\xbe\xf9\x9b\xb0\x7a\xe8\x10\x40\xa0\
\x5c\xd5\x3d\x4f\x03\x95\x8a\xff\x70\x7c\x05\x52\x5e\xd8\x81\xd7\
\xe9\xc1\xef\xf4\x54\xfa\x6f\xa7\x07\xbf\xdb\x43\xd8\x5b\x42\x67\
\x69\x05\xdd\xa5\x15\xf4\x56\xd6\xe0\x77\x97\x20\x9c\x00\x9c\x30\
\xc4\x82\x60\x12\x73\x0c\x46\x13\x4c\xa7\x51\xb6\xf9\x0b\x59\x64\
\x4d\x05\x23\xd4\x24\x06\x92\x28\x53\xfd\xc5\x51\xa4\x40\x69\x34\
\xc2\x78\x3c\xc6\x64\x3a\xd5\x2e\x10\x31\x62\x21\x20\xe4\xe2\x75\
\x9a\x54\x9d\x77\xfd\xb5\xd7\x66\xcd\x16\x39\x03\x0a\xd2\x38\xa1\
\x40\x51\xba\x5c\x52\xe7\xcd\x9e\xf3\x57\x83\x8b\xed\x4e\xca\x46\
\xbf\xaf\x43\x2f\x9d\xc5\x5a\xd1\xdb\xdb\xdb\x25\x46\x48\x6a\x9e\
\x93\x6a\x90\x9a\xf7\x9c\xaa\x48\x0e\x1f\x37\xde\x78\x43\xa1\x5a\
\x71\xb0\x72\x5e\x9e\xe1\x15\xc5\x31\xb6\x2f\x5f\x4e\x1a\x30\xa6\
\x72\xef\x09\x2d\x48\xb5\xc0\x74\xb5\x00\xa9\x6a\x5f\x6d\xd6\x63\
\x22\x4a\x70\x20\xb4\xf3\x75\xfe\x06\xd7\x05\x9c\x42\x9f\x89\x02\
\x94\xaa\x01\xd7\x19\x35\x1e\x29\x7e\xd5\x47\xaa\x54\x43\xd9\x75\
\x80\xd4\x7d\xee\x49\x61\xbb\x61\x8e\x93\x35\xed\x69\x36\x40\x9b\
\x03\x24\x08\x81\xeb\xf9\x78\xe1\x73\x4f\xe1\xa3\x4f\x3e\x3b\xf3\
\x06\xf9\xa1\xef\xfe\x0e\x4c\x27\xe3\x3c\x66\x43\x3f\x96\xb0\xdb\
\xc5\x33\xcf\x3c\x8d\xa4\xca\xa1\x3a\x65\x70\x42\xe2\xd2\xe5\x6d\
\x0c\x06\x43\xc4\x71\x8c\x9b\x6e\xb8\x1e\x5f\xff\x2d\xdf\x84\xaf\
\x7a\xcf\x7b\xb0\xbc\xb6\xa6\xa4\xe4\x94\x82\xb9\x8e\x02\x28\xcd\
\xa2\x1c\x3f\xcd\xaa\xf2\x75\x5f\x2a\x44\xd0\xe9\x22\xe8\xf5\x10\
\xf6\xfa\x08\xfb\x4b\xaa\x27\xb5\xb4\x82\xee\xf2\x2a\xfa\xab\x87\
\xe0\xf5\x96\x21\xa8\x07\x0e\x8a\x88\x0b\x8c\xa7\x71\x56\xea\x4b\
\x37\xfe\x32\x8b\x42\x12\x01\x49\x9c\xbd\x7e\x49\x1c\x63\x34\x50\
\xca\xbc\xf1\x78\x82\xc9\x24\x42\x14\x45\x88\x32\xb7\x71\xb9\x70\
\x13\x21\x65\x4d\x6b\xcb\x4b\xe8\xf4\x7a\x2a\xba\x44\x9f\x3c\x14\
\xfa\x63\x06\x63\x32\xe7\x96\x52\xfb\xa8\x22\x2b\x97\x33\x10\x23\
\xcd\xf2\x5c\xa9\x27\x25\x01\x4b\xe3\xaa\xba\xe4\x25\x25\xe0\xba\
\x0e\x3c\xcf\x5d\xe8\x03\xb6\x6f\xe4\x83\x35\xed\x2e\x91\x8a\x63\
\x5e\x79\x74\xee\x6d\x37\x2d\xe7\x19\xdf\x70\x9e\x40\x28\x63\xc3\
\x3a\x40\x6a\x9a\xc1\xd4\x82\xd3\x01\x56\x2b\x17\x6f\x26\xf3\xac\
\xeb\x35\x21\x3d\x05\x36\x63\x2f\x48\xe9\xe3\x23\x33\x2f\x3a\x1d\
\x3f\x4e\x95\x41\xa9\xd4\x47\xea\x00\x91\xbb\x41\xe4\xee\x10\x29\
\x60\xc9\x99\x8f\xa5\x9c\xa9\x1a\x02\x80\xd4\xea\x36\x42\xd9\xcc\
\x4e\x43\x29\x03\x71\x08\x90\x40\x6d\xb0\x32\x2f\x89\x74\x7a\x7d\
\xfc\xd4\x3f\xf8\x69\xfc\xa5\xdf\xfd\x8f\x05\xb5\xdd\xed\xc7\x8f\
\x80\x51\x96\xf9\xb7\xa5\xfd\x2f\xc7\x75\xb1\x7d\xe9\x22\x5e\xbe\
\xb4\x8b\x5b\x0f\xaf\x54\x3e\x71\xa3\x38\xc1\xe5\xad\x2d\x2c\x2d\
\x2d\xc1\x4f\x12\x44\x51\x04\xcf\x75\x71\xfd\x75\xc7\x71\xf4\xc8\
\x7b\xb0\xb1\x79\x11\x8f\x3e\x7c\x12\xbb\xdb\x97\xf5\x3c\x0a\x2b\
\x0c\xd5\x48\x29\x95\x03\x86\x14\x10\x0e\x87\x23\x3c\x15\x5b\x91\
\x24\x48\x12\x35\x2c\x2c\xb8\x9a\x7d\xe2\x51\x84\x24\x08\x90\x44\
\x11\x92\x38\x42\x12\x4d\x95\xa1\x6b\xac\x22\x2e\x5c\x46\xe1\xb9\
\x4e\xa6\x7c\x4b\xff\x4e\xc1\x1e\x49\x08\x4c\x27\x13\x8c\x32\xdf\
\xbc\x29\xa6\x51\x8c\x49\x14\x21\xe6\x1c\xdc\x61\x70\x2a\xdc\xc6\
\xe7\xed\x42\xfd\x30\xc0\x91\xe3\xd7\xe2\xf4\xf3\xcf\x81\xb0\xdc\
\xb7\x2e\x75\xa4\x40\x1a\x10\x98\xa6\xda\x6a\xdd\x78\x39\xd9\x36\
\x57\xe6\x65\x7e\x0b\x05\xd6\x6c\x74\x89\x66\xef\xa0\x4d\x3e\x9e\
\xca\xc3\x4d\xdf\x08\x21\xd0\xeb\xf7\xd0\x09\x3b\x95\xf1\x18\xb6\
\x27\x60\x63\x63\xa3\x06\x7e\xae\xde\x5e\x2d\xa5\xc4\xca\xca\x0a\
\x0e\x1d\x5a\x2f\xc4\xb9\x1c\x3c\xc3\x56\xbb\x3e\xec\xd6\xba\x3e\
\x34\x0c\x10\x6d\x19\x53\xcb\x98\x0e\xce\x9a\xe4\x9c\x9f\xcd\xed\
\x35\xa5\x67\xc2\x69\xb6\x8f\x94\x96\xf7\xe3\xcc\x60\x2d\x51\x00\
\x61\xcc\x33\x51\xcb\x4c\x53\xca\xb4\x78\x92\x20\x8e\x72\xf9\x6d\
\xd1\x1e\x66\x76\xf0\x23\x89\x22\x24\x9a\xe1\xa4\x67\x80\xe9\xd9\
\xb4\xd0\x96\x47\xcc\x51\x2e\x0f\x66\xad\xde\x75\x5d\x0c\x07\xfb\
\x78\xec\xc5\x57\x0b\x37\xc9\x28\xc1\x2d\xb7\xdd\x06\x1e\xc7\x06\
\x38\x29\xb0\x74\x3d\x1f\x9f\x7e\xe2\xe9\xda\xba\xe7\xf6\x70\x82\
\xad\x8b\x1b\xd8\xdd\xdd\xc5\xde\xee\x2e\x86\xc3\x21\x86\xa3\x11\
\x76\x76\x77\xc1\x39\xc7\xf1\xe3\xc7\xf0\x57\xdf\xf3\x35\xb8\xe7\
\xde\x7b\x95\xc9\x2d\x17\x85\x21\x64\xca\x52\x0f\x40\x37\x67\x4f\
\x81\x92\x9f\x7b\x41\x67\x56\x38\xd1\xe9\x29\x26\xd5\x5f\x46\x67\
\x69\x15\x6e\xa7\x07\xe1\x78\xe0\xc4\x41\x24\x80\x49\xcc\x31\x1c\
\x4f\x10\x45\xb1\xe1\x23\xc8\x01\x29\xb2\xf9\x28\xc1\x39\x46\xc3\
\x11\xa6\x13\x75\xbd\x28\x56\x02\x88\x49\xac\x66\xc6\xe4\x81\x3e\
\x6c\x6a\xd0\xf6\xd8\x75\xd7\xe9\xa1\xe1\xd2\x5c\xb6\xd1\xe7\x2a\
\xa8\xf6\x52\xbe\x33\xc3\x98\x6a\x40\xb1\x20\xf0\x93\x76\xa1\xc3\
\x1c\x97\xf1\x82\x91\x2c\x21\x0d\x3f\x58\x12\x67\xcf\x9e\x9d\x43\
\x64\x9a\x72\xa2\x7a\xc4\x97\x90\xa0\x8c\x22\xf0\xfd\x52\xfe\xd4\
\xe2\x82\x07\xf3\x22\x6d\xa7\xc4\xe7\x94\xef\x9a\x30\xa7\x96\x35\
\xb5\xc0\x74\x55\x59\xd3\x02\x87\x06\x0b\x29\x41\x74\x1e\x53\xd6\
\xdf\x31\xfa\x4c\xb0\xf5\x98\x58\xa9\x9c\xa7\x7b\x4c\xb4\x54\xd2\
\x4b\xe7\x7a\x08\x21\xf5\x25\x3c\x0d\x3a\x9d\x6e\x47\x99\xc2\xea\
\xab\x4c\x86\x43\xd5\x70\x27\xb9\xea\x2b\xed\x61\x51\xb3\x6f\x45\
\x09\xc2\x6e\x17\xff\xfc\x57\xfe\xdd\x0c\x72\x1f\x5a\x5f\x47\x1c\
\xab\x61\x57\x35\x8b\x95\x8a\x20\x02\x7c\xe2\x53\x9f\x06\xb7\xb4\
\x28\xd2\x8d\x77\x30\x99\x60\x7b\x73\x13\x5b\x9b\x9b\xd8\xde\xda\
\xc2\xa5\xcd\x4d\x6c\x5d\xbc\x88\xdd\x9d\x5d\xec\xee\xee\x62\x77\
\x67\x17\x49\x12\xe3\xed\x77\xbc\x15\x5f\xfd\x9e\xaf\xc5\x6d\x77\
\xdd\x89\x24\x8e\xb4\xc7\x60\xea\xe1\x47\xb4\x00\x43\x01\x14\xf3\
\x3c\x38\x9e\x97\x95\xfc\x1c\x3f\x80\x9b\xf5\xa6\xba\xf0\x35\x40\
\xf9\x5d\x55\xf2\xeb\xe8\x72\x9f\x1b\xf6\xc0\xa9\x8b\x04\x14\x53\
\x2e\x31\x9a\xc6\x18\x8e\xa7\x88\x27\x13\x55\xda\xd3\xcf\x23\x4f\
\x12\x4c\xc7\xa3\x8c\x31\x45\x71\x8c\x28\x49\x10\x25\xbc\xb2\xcf\
\x54\xb7\x17\xe7\x02\x08\x8a\x9b\x6e\xb9\x45\x45\x60\xc8\x92\x8a\
\xd0\x70\x7c\xcf\x85\x0c\x39\x40\x15\x9e\x57\xc8\x4a\x79\x77\x41\
\x04\x51\xb9\x01\xcb\x42\xe9\xcf\xb6\x81\xe7\xa0\xb4\xd8\x87\x69\
\xeb\xf2\x76\x31\xe2\x82\x34\x01\xa9\xc5\x17\x01\x10\x47\x71\x66\
\x40\x7c\x90\x53\xd3\x19\xa1\x0a\x25\x78\xf6\xf3\x9f\x4f\x19\x53\
\x15\x38\x35\x1d\xae\x6d\x41\xa9\x2d\xe5\xbd\x6e\xac\xa9\x1c\x10\
\xa6\x10\x9e\x28\x70\x12\x9c\x43\x32\x07\xa0\xb9\x2a\x29\xad\xae\
\xa4\x59\x47\x90\x9a\x09\x48\xb3\x94\xc7\x40\x29\xcf\x1d\xc7\x69\
\x49\x20\x41\x59\x76\x6b\xb2\x62\xb3\x71\x5c\x17\xdd\x6e\x4f\xf9\
\x86\x25\x53\x88\xf1\x00\xf0\x42\x08\xa1\x32\x9a\x98\xc3\xb2\x4d\
\x2f\xfd\x1c\x53\xc6\x40\x0d\xb6\xe7\x79\x1e\x9e\x7b\xe6\x69\x4c\
\xb9\x80\xcf\x94\xcd\x4b\x22\x25\x92\x24\x86\x48\x12\x08\xc7\xc9\
\xe2\xd5\x05\x21\x60\x8e\x8b\x4b\x17\x37\x91\x08\x01\xca\x68\x81\
\x01\x28\xa7\x5b\x89\xbd\xe1\x08\x5b\x17\xce\x21\x8e\x63\x74\x7a\
\x7d\x04\x9d\x0e\x82\x20\x84\x1f\x86\x08\x82\x40\x25\xfb\x7a\x3e\
\x3c\xdf\x43\x10\xf8\xb8\xf3\xce\x3b\xb0\xb6\xbe\x86\xa7\x3e\xfb\
\x38\x06\xbb\xbb\xda\xbf\x8f\x16\xcb\x98\x94\x81\xa6\xcf\x08\x53\
\xd1\x15\x42\x33\x2b\x91\x28\xbf\x3d\xc6\x75\xba\x6f\x92\xa8\x9c\
\xaa\x24\x81\xe3\x07\xaa\xe4\x17\x47\x48\xa2\x48\x7d\x95\x1c\xc9\
\x78\x0a\x57\x70\x30\xb8\xea\x7e\xf3\x04\xd3\xc9\x18\x93\xf1\x18\
\xd3\xc9\x14\x71\x1c\x23\x49\x12\x24\x5c\x20\xd1\x79\x4f\xb2\x81\
\xdb\x78\xb9\xf8\x4a\x09\xc1\x5b\xdf\xf6\x36\x35\x5b\x25\x65\x89\
\x8c\x10\x23\x12\x1e\xc6\x70\x6d\x1e\x16\x68\xc6\xac\xcb\xcc\x1e\
\x02\x59\x14\x46\xe1\x06\x73\x8b\x8c\x2c\x5e\xbe\x5c\xae\xb3\xbe\
\xf3\xf5\x75\xb8\x10\x38\x7c\x68\x1d\x9e\xeb\x35\x2a\xe5\xa5\xec\
\x73\xe3\xc2\x46\xbd\x05\x51\xa5\x75\xd7\x62\x7b\xb8\x94\x12\xd7\
\x5c\x5b\xf2\xc9\xbb\xe2\x72\x1e\xc1\xa5\xad\x4b\xf3\x4a\x79\x75\
\x6c\xa9\x05\xa5\x16\x98\xae\x08\x90\x80\xc5\x8c\x5b\x6d\x00\x55\
\xf8\xc4\x09\x29\x40\x38\xd7\xaa\x2f\x5a\x3a\x89\xd3\x56\x38\xa0\
\x00\x95\x20\x32\x65\x4a\x0c\x84\x72\xdd\x5b\xca\xc1\x89\x52\x06\
\x49\xb9\xb2\xd9\xa1\x14\x3c\x89\x11\xc7\xca\xbb\x2e\xff\x18\x13\
\xe3\xcc\x57\xa9\xeb\x3c\xdf\x57\x4c\x23\x89\x01\x9e\x80\x50\x8a\
\x24\x8a\xb1\xb7\x7d\x19\xeb\xc7\x8e\xe9\xe6\xbf\x00\xd1\xb9\x4a\
\xb9\xa0\x81\x02\x10\xa0\x94\x61\x32\xda\xc5\x85\xfd\x11\xae\x5f\
\xee\x81\x4b\x89\x58\x08\x0c\x07\xfb\xda\xa5\x81\x1b\x02\x08\x02\
\xc6\x18\x46\x83\x01\xf6\xa3\x04\xab\x81\x57\x98\x82\x11\xba\x74\
\x18\xc7\x31\x2e\x6f\x5c\xc0\x74\x3c\x56\xec\xa5\xd7\x47\xd8\xed\
\x2a\x17\x8a\x30\x44\x10\x76\xe0\xf9\x3e\xfc\x20\x80\xef\xfb\xf0\
\x7c\x1f\x47\x0e\xad\x63\xfd\x2f\x7d\x05\x5e\x78\xfe\x05\x3c\xff\
\xf4\xd3\xe0\x71\xac\x9c\xc5\x0b\x9b\x2e\xd1\x39\x54\x14\x54\xa8\
\xe7\x4f\x32\x01\xc1\x1c\x23\x72\x5e\x59\x1e\xa5\x20\xc5\x93\x44\
\x01\x53\xe2\xc3\xf1\x62\x08\x1e\xab\xd2\xe7\x74\x02\x1e\x27\x70\
\x7d\xbd\x91\x6b\x75\x5e\x34\x55\x21\x90\xd3\x69\x8c\x69\x14\x23\
\xe6\x09\xb8\x10\x3a\x3c\x90\x58\xb7\xbf\xca\x2d\x4f\x0b\x2b\x6f\
\xb8\xfe\xba\x3c\xbe\x23\xfb\xa5\xfc\xb5\x4c\x01\x28\x8b\xc0\xc8\
\x13\x2f\x8a\x31\x18\xd9\x05\xfa\x77\x8d\x04\x56\x45\x22\x6a\x40\
\xc8\xec\x35\x49\x64\xb6\x45\xe5\x9e\x24\xd7\x65\xd5\x45\xc0\x62\
\x63\x63\xa3\x99\x81\xab\xbc\x32\x70\x92\x00\x3a\x1d\xe5\x93\x57\
\x18\xe8\x6d\xe8\xf0\x60\xb5\x23\x02\x70\x71\x73\xb3\x0e\x98\x44\
\xcd\x89\x2a\xd0\x2a\xf2\x5a\x60\x7a\x8d\xc0\x6a\x91\x5e\x53\x51\
\x14\x2b\x04\x20\x78\x16\xd7\x90\x65\x1c\x19\x0d\x69\xf5\x4f\x03\
\x9c\xb2\x3c\x26\xa1\x41\x49\x39\x2c\x08\xca\x35\x68\x29\xb0\x48\
\xe2\x08\x34\x4e\xe0\x38\x6e\x9e\x3a\x2b\x4b\x1f\xe5\x6c\xae\x45\
\x5b\xdd\xa4\x73\x51\x84\x60\x3c\xd8\x87\x14\x47\xb2\xf8\x89\x2c\
\xef\x08\x30\xd8\x19\x32\x49\xf8\x8b\xe7\x37\x71\xb4\xdf\x41\xcc\
\x05\x76\xc7\x13\x9c\x7e\xe1\x05\x1d\x51\xc1\xc1\xd3\x32\xa4\x06\
\x35\x9e\x24\xd8\x9f\x4c\xb1\x12\xb8\x05\xc6\x14\x6b\x77\x05\x87\
\x02\xc3\x9d\xcb\x88\xa7\x13\x0c\xf7\x76\xe1\x77\xba\x4a\x55\xd7\
\xed\x21\xe8\x76\x11\x76\xba\x8a\x45\x85\x1d\xf8\x41\x00\xcf\x57\
\x00\x15\x84\x01\x6e\xb9\xf5\x16\xac\xac\xac\xe0\xa5\xe7\x5f\xc0\
\xc6\xd9\xb3\xa0\x0e\x9b\x8d\x4f\x07\xd4\x73\x48\x29\xa4\x66\x6e\
\x42\x30\x48\xee\x14\xfd\xf8\x38\x07\x65\xb1\xea\x57\x25\x09\xb8\
\xe3\x82\xc7\x91\x36\x96\x75\xd5\xef\x4b\x09\x4a\x91\x95\xd0\xa2\
\xe9\x14\xd1\x34\x42\x14\x6b\x07\x88\x28\x06\x17\x12\x5c\x2a\xe0\
\xa5\x0b\x56\x90\x28\x21\x58\x5b\x5a\x02\x73\x5c\xed\x4a\x4f\xb3\
\xd2\x9a\x99\x8f\x95\x89\x20\xd2\x68\x75\x4b\x0c\x06\x0c\x16\x64\
\xf3\xb9\x43\x29\x83\x49\xb1\xae\x32\x6b\xaa\x12\x48\xa8\x2f\x4e\
\x29\x52\xbd\x9e\x6c\x28\x73\x61\xce\xc5\x15\x7c\x14\x6d\x89\x56\
\xd5\x7b\xfc\xea\xea\x5a\x05\xcc\x34\x60\x48\xf6\x54\x10\x7c\xf6\
\xb1\xc7\x6c\x3d\x26\x5b\x39\x6f\x9e\x79\x6b\xdb\x63\x6a\x81\xe9\
\xaa\x94\xf4\x16\x0d\x0b\x14\x30\xea\xf1\x94\x20\x8b\x5d\xa0\x42\
\xea\x72\x9e\x84\xe9\x30\x9e\x35\x1b\xb4\x59\x6b\x51\x99\x67\x32\
\x26\x5a\x2c\xeb\x19\xb1\x18\x7a\x47\x9e\x21\x7c\x99\xdc\x38\x2d\
\xf9\xc5\x13\xc8\x09\x03\x71\x03\x24\x71\x84\xbd\xed\xcb\x58\x3d\
\x7c\x44\x3b\x3f\xa8\x99\x1e\x62\x38\x44\xa4\x92\x72\xc7\x73\x31\
\x18\x0e\x30\xd2\x0c\xe1\x85\xb3\x67\x71\x69\xe3\x02\x98\x17\x28\
\x66\x28\x84\xea\x4d\x11\x64\x7e\x6f\x5b\x7b\x03\x5c\xbb\xdc\xcb\
\x1c\xb8\xb9\x90\xca\x91\x5b\x2b\xdc\xa6\xc3\x7d\x88\x24\x41\x34\
\x1e\x61\x32\x1c\x60\x3c\xd8\x87\xeb\x07\x08\xba\x3d\x04\x9d\x2e\
\xc2\x5e\x0f\x61\xb7\x67\x80\x54\x08\x6f\xe4\xc3\xf7\x7d\x74\x3a\
\x21\xee\x7a\xe7\x3d\x38\x7a\xfc\x1a\x7c\xee\xb3\x9f\x45\x92\xc4\
\x60\x8e\xab\xc1\x49\x66\x4a\x34\xd5\xcf\x63\x8a\xad\x52\x01\x49\
\x15\x33\x24\x9c\x81\x32\x05\x4c\x84\x31\xd0\x24\x01\x67\x09\xa8\
\xc3\x55\xd8\x62\x1c\x69\xc6\x58\xec\xdb\xf0\x24\x41\x34\x99\x20\
\x8a\x22\xc4\xb1\x12\x40\x44\x71\x82\x44\x08\x05\x4e\x54\x82\x2d\
\x50\xce\x4b\x4b\xb1\xdd\x30\x40\x77\xa9\x8f\xfd\x9d\x1d\x50\xa6\
\xca\x76\x2a\xdc\x30\xa3\x3a\x8a\x35\xa5\xa5\x3c\xdd\xb3\x4c\xc3\
\x03\x61\x30\x26\x69\x30\xa6\x8c\x88\x90\xa2\xbd\xab\x3d\x9c\x56\
\x1a\x69\xb7\x98\x65\x4d\xda\x66\xeb\xd0\xfa\xaa\x45\x11\x5a\xbd\
\xb8\xe0\xd8\xd8\xd8\x40\xa3\x67\x85\xa0\xd6\x91\xbf\xc9\x5a\x5e\
\x5e\xb2\x03\xd1\x15\x98\xb8\x4e\x27\xd3\x3a\x96\xd4\x24\x4a\xbd\
\x9d\x65\x6a\x81\xe9\xc0\x60\x24\xe7\x80\x13\x1a\x81\x13\xc9\x37\
\x31\x4a\x19\xe0\x2a\x06\xa1\x66\x87\x28\xc8\x8c\x6b\x72\x3a\xcf\
\xa4\x19\x93\xb4\x95\xf3\x58\x06\x52\x29\x68\x51\xca\xc0\x79\x82\
\x24\x8e\x94\x74\xba\x34\x10\xe9\xba\x69\x19\xcf\x28\xa6\x4d\x27\
\x90\x8e\x07\x1a\x74\x21\xe2\x18\x7b\x5b\x5b\x58\x5e\x5b\x57\x20\
\x67\x18\xbf\x02\xf9\x7c\x93\x10\x02\x7e\x10\xa2\xe3\x7b\xd8\x1f\
\x8f\xb0\xb9\xbd\x83\xff\xfa\xdf\x3e\x08\x9e\x70\x30\xaf\x24\x58\
\x27\x79\x94\xc7\x34\x8e\x95\x2c\x5b\x1f\x31\xe7\x98\xc6\x09\x24\
\x24\x2e\x5e\xba\x84\x68\x34\x84\x14\x02\x6e\xa0\x7b\x5e\x71\x8c\
\xa9\x3b\xc2\x64\xb0\x0f\x2f\xec\xc0\xf1\x7c\x04\xdd\x2e\x3a\xbd\
\xa5\x0c\xa4\x82\x30\x84\x1f\x04\xd9\xd7\xe5\x95\x65\xdc\xf1\x8e\
\x77\xe0\xdc\x2b\xaf\x62\x6b\x73\x53\xf5\xcc\xd2\x59\xac\xb4\x0c\
\xa6\x4d\x70\x21\x73\x47\x77\x4a\x04\x84\x30\x66\xc3\xa8\x02\x2b\
\x21\xb8\x4e\x02\x76\x40\x5d\x57\x0d\x49\x1b\x72\x7f\x9e\x24\x98\
\x4c\x94\x21\x69\x1c\x27\x48\x38\xc7\x34\x8e\x11\xeb\x08\x0c\xb1\
\x40\xe7\xc2\x24\x15\x8c\x52\xf8\x41\x80\xbd\x6c\x70\x36\x2f\xc9\
\x65\xb6\x4a\x84\x64\xef\x1d\x45\x94\x4a\x86\xae\x29\x90\x48\x52\
\x69\x2a\x5b\x04\x9b\x32\x6b\x32\xaf\x6b\x32\xae\xe2\xa5\x9e\xbb\
\xd8\x0c\x53\x92\x24\x18\x8e\x46\x58\x08\xad\xaf\x60\xeb\xce\x18\
\x53\x93\x17\xa2\x82\x21\x95\x4b\x91\xe7\xcf\x9d\x9b\xd7\x57\x6a\
\x9d\x1f\x5a\x60\x7a\xdd\x00\xaa\x89\x81\x6b\xe1\xec\x49\x4a\xc9\
\xcf\x3c\xff\x79\x79\xdd\x2d\x6f\x25\x3c\x49\x40\x19\x53\x53\xf2\
\x29\x6b\xca\x84\x06\x36\xc9\x2d\xd5\x15\xbd\x94\x31\x31\x08\xc6\
\x55\xaf\x44\x30\x50\xc1\x20\xb8\x2a\xe5\x11\xa2\x06\x50\x79\x1c\
\x81\x27\x3c\x2b\xe7\xa5\xc4\x49\x4a\xc0\xf5\x3d\xf8\xbe\x9f\x46\
\x42\xe7\xf1\x0e\x49\x04\x19\x4d\x40\x1d\xe5\x12\x7e\xe1\x95\xd3\
\x38\x72\xdd\x0d\x70\x5d\x17\x84\xb2\x2c\xaf\x29\x75\x3d\xe7\x71\
\x84\x9b\x6f\xbd\x05\x81\xc7\xf0\xd8\xe7\x9e\xc1\x87\xfe\xf0\x43\
\x78\xfc\xb1\xcf\x22\xe8\x2d\x65\x81\x7a\x54\x03\x41\x36\xcf\xe4\
\xb8\x58\xea\x04\xe0\x42\x22\x11\x02\x89\x50\xa0\xc4\xf5\x06\xfe\
\xc8\xc9\x13\x6a\x9e\x28\x89\x31\x1d\x0d\x94\xb2\xce\x53\x0a\xba\
\xd8\x71\x11\x4f\xa7\xa0\xae\x8b\xc9\x70\x80\xc1\xce\x8e\xea\x3d\
\x75\xbb\x59\x2f\x2a\xe8\x76\x11\x86\x5d\x78\xbe\x8f\xb0\xd3\xc1\
\x2d\x6f\xbd\x0d\x41\x27\xc4\x85\x33\x67\x20\x79\x02\x18\x43\xc3\
\xd2\xec\xe7\x80\x42\x32\xa9\x1c\xdb\x85\xee\x43\xa5\x06\xb9\x8c\
\x41\x72\x0e\xce\x04\x68\xa2\x4f\x06\x92\x18\x32\x89\x32\xe2\x24\
\x04\x47\x34\x51\x3d\xa6\x24\x49\x90\x24\x5c\xb1\xa7\x84\x9b\xba\
\x82\x85\x0b\x55\x2e\x63\x38\x7e\xc3\x8d\xaa\x34\x49\x99\x2e\xc9\
\xa5\xac\x89\x14\xca\x76\xd2\x28\xe9\x91\x02\xfb\xc9\xe3\x2f\x88\
\x4c\xbd\x84\x49\x61\x1e\x8b\x14\x54\x37\xb6\xcd\xbb\x04\x6c\x65\
\xd2\x21\x04\xd6\x57\x57\x4b\x11\x2c\xf3\x4a\x95\x14\xd3\xe9\x74\
\xf1\x27\xa5\xb6\xe0\x55\xe5\x1c\x41\x0a\x06\xae\xcd\xca\x79\xf5\
\xcc\x8a\x73\x8e\xdd\xbd\xdd\x45\x12\x6b\x5b\x80\x6a\x81\xe9\x0d\
\x53\xce\x2b\x53\x7b\x96\xa9\xdc\xa0\x36\x34\xc9\x39\x24\x63\x90\
\x84\xce\x46\x1b\xa4\x61\x7f\xaa\xa9\x93\xf5\x99\xa8\x60\x90\x54\
\x80\x32\x01\xc9\xd5\x9c\x91\x10\x3c\x2f\xe5\x31\x06\xc1\x13\x24\
\x5a\x08\x50\x98\x4f\x49\x5d\x0c\xf2\x53\x3f\x35\xd4\x3b\x9d\xa8\
\xcd\xae\xb7\x0a\x42\x29\x46\xfb\x7b\xd8\x3c\x73\x1a\xd7\xdc\x78\
\x73\x41\x4c\x90\x0e\xf3\x3a\x8e\x8b\x43\xab\x7d\xfc\xe6\x7f\xfa\
\x4d\x9c\xfc\x93\x4f\x62\x34\x99\xa2\xbb\xb2\x9e\xb1\x29\x0a\x0e\
\x30\x9a\xb9\x78\xa7\xbf\x97\x70\x8e\x69\x92\x20\xe2\x8a\x59\x24\
\x5c\x20\xe1\x1c\x93\x69\x84\x87\x3e\xfa\x91\xac\x04\x28\x93\x04\
\x60\x1c\x9d\x4e\x07\x0e\x05\xa2\x68\x82\xf1\x74\x0a\xe6\x2a\x80\
\x62\x8e\x83\xc9\x68\x80\xd1\x7e\x80\x7d\x6f\x0b\x41\xaf\xa7\x00\
\xaa\xd7\x57\x3d\xa8\x30\x44\xd8\xe9\xe0\xd0\xe1\x43\x08\x82\x00\
\x2f\x7e\xfe\xf3\x10\x49\x9c\x59\x39\xa5\xcf\x6d\xe6\xbc\x91\x3e\
\xdf\x4c\x85\x22\x11\x4a\x40\xb8\x8a\xae\x17\x8c\x81\x72\xae\x18\
\x14\xa5\xa0\xb4\x8f\x78\x32\x56\xc3\xc9\xfa\x39\x4d\x62\x25\x80\
\x88\xa2\x48\xd9\x43\x25\x89\x02\xdd\x03\xce\x32\x15\x62\x51\xa4\
\x69\xcc\x9a\x83\x8c\xca\x50\x2a\xe1\x89\xe9\x8b\x37\xc3\x82\xd2\
\x7e\x63\xd9\x0f\xab\x2c\x82\x58\x8c\x35\xcd\xfa\x4a\xcc\x5f\xd3\
\x68\x8a\xc9\x64\x02\x72\x25\x39\x16\xb2\x19\x36\x51\x4a\xd0\xe9\
\x74\x1b\x83\xce\x3c\x2a\x45\x28\xc1\x74\x32\xc5\x78\x34\xe2\x73\
\x00\xa9\x0a\xa0\xda\xde\x52\x0b\x4c\xaf\x1b\x38\x01\xd5\x61\x81\
\xd6\x37\xa4\x14\x42\xc9\xb3\xcd\x09\x4a\x92\x97\xbf\xb2\x0b\x08\
\x81\x34\x7c\xf2\x24\x53\xee\x0a\x54\x0a\x48\xc7\x01\x15\x02\x94\
\x73\x48\x2a\x32\x85\x1e\x8f\x23\x70\x9e\xc0\x71\xdd\x6c\x5f\x73\
\x5d\xc5\x96\x4c\xfb\x1a\x92\xef\x4a\x10\xd3\x31\x88\xe3\x81\x84\
\x3d\x50\x4a\x11\x4d\x26\xb8\xf0\xca\xcb\xe8\x2d\xaf\x20\xec\xf6\
\xe0\xf9\xbe\x3a\x73\x47\x8c\xe9\x60\x17\x0f\x7f\xfc\x63\xd8\xdb\
\xd9\x01\xa1\x14\x41\xb7\x07\xc7\xf3\x40\x18\xcb\x8c\x42\x85\x4e\
\xa3\x15\x44\xd9\xfa\xf8\x61\x00\x4a\x80\x69\x12\x23\x4e\x38\x12\
\xce\x11\xc5\x09\xa6\x71\x84\xc7\x9e\x3c\x85\x67\x3e\xfb\xa8\x76\
\x6f\x60\xe8\x2d\xaf\xa0\xd3\xed\x2a\x66\x29\x25\x28\x24\xa2\x84\
\xab\x24\x59\xae\xca\x64\x3c\x49\x90\x44\x11\x22\xc7\xc1\x74\x34\
\xc4\x70\x37\x65\x51\xaa\x1f\x15\x74\xba\xe8\xf4\x7a\xe8\xf6\xfb\
\x38\x76\xdd\xb5\x38\x77\xfa\x74\x76\x9f\xca\x9e\x84\x66\xff\x49\
\x12\xc5\x0c\x29\x28\x88\x24\x59\x7f\x8f\x32\xa6\x07\x8e\x3b\x18\
\x53\x82\xf1\xde\x8e\x3e\xc5\x90\xe0\x9c\x67\xca\xbc\x38\x56\x8f\
\x2f\x4a\x12\xdd\x3f\x73\x00\x4a\x16\x2e\xe7\x31\x42\x71\xfc\xfa\
\xeb\xf1\x68\x81\x51\x57\xe4\x30\xc9\xd9\x0d\x56\x01\x95\xd1\x74\
\x2a\xd5\x8b\xab\x45\x10\x8b\xb0\x26\xf5\xde\xed\x86\x61\xe3\x4a\
\x1c\x01\xb4\x73\xba\xbc\xf2\x4f\xe1\x1c\xa0\x92\x52\xc2\x73\x3d\
\x1c\x3f\x7e\x4d\x51\xdd\x48\xb0\x10\x43\x2a\x5c\xc5\x68\x2f\x1a\
\x47\x9d\x4c\xbc\xe9\x80\x6d\xbb\x5a\x60\xba\x2a\xbd\xa6\xa6\xec\
\xa9\x94\x83\x90\x36\x8e\x05\xa0\xa5\xca\x34\xb5\xf2\x29\x7c\x14\
\xd2\xe0\x3a\x2d\x80\x20\x54\xcb\xc2\x19\x28\x15\xa0\xcc\xd1\xea\
\x32\x83\x35\x09\xd5\x87\x52\xe9\xae\x5c\x87\xf7\x29\xd6\xe4\x69\
\x89\xb5\x30\x32\xa1\x8a\xfb\x10\x81\x88\x26\x58\xbb\xe6\x7a\x50\
\xcf\x03\xd7\x0e\xdc\xe3\xe1\x00\x49\x1c\xc1\x0f\x54\x78\x1f\x8f\
\xa6\x20\x44\x42\x50\x86\xee\xaa\x8a\x12\x60\xae\x07\xea\x78\xd9\
\x99\xb6\xb6\x8f\x50\x60\x29\x94\xc8\xe1\xf8\xf5\xd7\xa1\xe3\x79\
\x1a\x8c\x94\x43\xc2\x68\x32\xc1\xfe\x60\x80\x0f\xbc\xef\x97\x11\
\x47\x11\x96\x96\x57\xd0\xeb\xf7\x35\xa0\xa6\xbd\x15\x20\xf0\x7d\
\x04\xbe\x6a\xee\x73\xce\x31\x4d\x22\x24\xb1\xc0\x94\x4b\x35\x48\
\xeb\x38\x60\x63\x55\xe6\x1b\xed\xef\xc1\x71\x3d\xf8\x61\x47\xf5\
\xa1\x7a\x7d\xf4\x96\x96\x11\x84\xa1\x16\x12\xb0\xdc\x04\x97\x92\
\x02\x50\x65\x5a\x6d\x69\x98\xeb\x4a\x40\x12\xa6\xae\x2b\xf4\xf5\
\x67\x5e\x4b\x99\x01\x53\x14\xc7\xe0\x9c\x23\xd1\xe0\x1b\x0b\x01\
\x37\x4d\xc9\x5d\x80\x14\x10\x42\xb0\xbc\xba\x9a\x65\x78\x49\x99\
\x06\x4c\x1a\x12\xf1\x4c\x83\xa0\x81\x2a\x55\xe6\x99\x3d\xa8\x19\
\x60\x31\xb8\xb9\x94\x99\x08\x62\x61\xd6\x64\xfc\xfd\x63\x47\x0e\
\xcf\x2d\xae\x65\x7b\x3a\x21\x18\x0c\x87\x10\x5c\x0d\x61\x5f\x11\
\x28\xcd\xe9\x1b\x11\x42\xc0\x85\x1d\x04\x9b\x32\xa4\xf2\x65\x84\
\x50\x6c\x6f\x6f\xe3\x2a\x95\xf0\x5a\x70\x6a\x81\xe9\x8a\xcf\xcd\
\x9a\xf8\xe4\xd5\xf5\x9d\x8a\x25\x06\xe8\x8c\x26\xce\x21\x1d\x35\
\xd3\x64\x0e\xb5\x12\x42\xf2\xfd\x84\x52\xc5\x1c\x8c\x5e\x13\xa5\
\x42\x7d\x65\xca\xe9\x80\x72\xae\xe4\xe3\x44\xfd\x2c\x89\x23\xd0\
\x24\x01\x73\xdc\xf9\x1f\xbf\xb4\xa4\x97\x44\x18\x6f\x5d\xc0\xfa\
\x5b\xde\x8a\x98\x31\xd5\xd7\x21\x02\xd1\x64\x82\x78\x3a\x85\xeb\
\xb9\x60\x94\xc1\xf5\x43\xb5\x7f\xeb\xd2\x60\xe6\xd3\x97\xb2\x3f\
\x6a\x2a\xb9\xd4\xe0\xed\x0d\xd7\x5f\x07\x42\x80\xfd\xd1\x18\xc3\
\xf1\x18\x7b\x83\x01\x76\x76\x77\xf1\xa9\x4f\x7e\x12\x4f\x9d\x7c\
\x18\x9d\x6e\x0f\x6b\xeb\x87\x72\x09\xbd\x51\xd2\x32\x8d\x07\x18\
\x63\xe8\x30\xa6\x94\x7c\x71\x02\x50\x20\x8a\xa7\x88\xa7\x13\x30\
\xe6\x20\x9e\x8c\xe1\x78\x3e\x26\xc3\x01\x86\xbb\xdb\x70\x7d\x1f\
\x41\xb7\x0f\x42\x29\xe2\x48\xc9\xc0\x29\x73\x32\x21\x47\x3a\xe3\
\x54\x60\x50\x33\xbd\x3e\x99\xb9\x60\xcc\xa8\xa6\x35\x58\xc6\x51\
\x84\x38\x52\x66\xb0\x69\x39\x2f\xe6\x5a\x99\x27\xd1\x28\xc5\xb7\
\xbc\xa9\xaf\xad\xaf\xe7\x8f\x3d\x05\x95\x2c\x06\x3d\x77\x7d\x20\
\xa5\x77\x61\x31\x6e\x3d\x3b\xc7\xc9\x67\x6b\xd3\xb9\x36\x42\x66\
\x7b\x2d\x35\xac\x29\x2d\x1f\x96\xdf\xf4\x8e\xc3\x1a\x75\x7c\xd2\
\xcb\x26\x93\x31\xe6\x8c\xf0\x36\xa3\x5f\x56\xb0\x32\x1e\x91\x90\
\x58\x5e\x5d\xc1\xe1\xc3\x87\x4b\xe0\xb4\x00\x43\xb2\xfc\x1d\xfd\
\x45\x34\x38\x9a\x1a\xb7\xb6\x00\xd5\x02\xd3\xeb\xde\x6b\xb2\x1b\
\xe3\x69\xaf\x35\x99\x24\x7a\x3e\x46\x40\x4a\x32\x23\x84\xc8\x26\
\x9b\x28\x05\x91\x0c\x94\xa5\x91\x0c\x4a\x94\x40\x05\xcb\x58\x13\
\xe5\xf9\xc0\x6d\xca\xa2\x92\x38\x06\x65\x4c\x0d\x82\x3a\x0e\x5c\
\xd7\xb3\xc6\xbe\xa9\x7d\x8f\x60\xb4\xbd\x05\xf9\xc2\x33\x58\xba\
\xee\x66\x05\x88\x9a\x25\x50\xa6\x06\x77\x29\x53\x76\x48\x4c\x83\
\x83\x30\xcf\xe8\xd3\x0f\xbf\x0e\xd9\xa3\xc4\xc9\xb6\xcd\xb7\xdd\
\x7a\x33\xf6\x86\x43\xec\xee\xed\x63\x7b\x77\x17\xcf\x3e\xfb\x2c\
\x3e\xfe\x47\x1f\xc6\xa9\x13\x0f\x21\x8e\x62\x55\x66\x34\x9e\x9e\
\x6c\x96\x26\x55\xa1\x91\xfc\x7c\x1d\x52\xf9\x9f\x75\x98\x0f\x02\
\x80\x01\x88\xe2\x04\x8c\x02\x22\x89\x30\x9e\x8c\xc1\x5c\x0f\xcc\
\x71\x30\x1d\x39\x18\xef\xef\x83\x30\x06\xe6\x7a\x70\x5c\x95\xef\
\x44\xb3\xc7\xc2\xb2\xc7\x64\x32\xa8\xd4\x1e\xaa\xb0\xd9\xe9\xdd\
\xbd\xb0\xc9\x11\x55\x96\x4d\x92\x18\x49\x1c\x2b\xf7\x07\xce\x11\
\x2b\xf7\x69\xa3\xc7\xb7\xf8\x06\x7c\xf8\xc8\xe1\xbc\xc7\x64\x91\
\x76\xe7\x83\xb5\x65\x01\x84\x34\x4a\x79\x06\xfb\xa9\x80\x8c\xf4\
\x3d\x67\x5e\xd3\xc6\x9a\x60\x29\xfd\x11\x02\x84\x95\xa5\x3c\x52\
\x94\xff\xe9\xb5\xbb\xbb\xab\xfb\x5d\x24\x63\x7c\x57\x0c\x4e\xd6\
\x0f\xaa\x72\x29\xe9\xf7\x7a\xa5\xde\x6a\x83\x72\x5e\xc5\xa5\x84\
\x12\x3c\xf2\xc8\x49\xa0\x99\xdb\xc3\x3c\xe3\xd6\xb6\xa4\xd7\x02\
\xd3\x55\x67\x4f\xf3\xc0\xc9\x78\xd3\x92\xec\x5c\x35\x57\x84\x13\
\x10\x21\x95\x3a\x8f\x0b\x50\x66\xd9\xc0\x52\xd1\x01\x28\x40\xb5\
\xd7\x9e\x64\xa0\x54\x42\x32\x75\x46\x48\x85\x00\x65\x5a\xd2\xcc\
\x12\x08\x4e\xb3\x50\xc1\x24\x8e\x40\xa9\xea\x35\x65\xc0\xe4\x79\
\x66\xda\x59\xfe\x77\xd2\xb2\x0e\x21\x98\xec\x6e\x43\x0a\x89\xde\
\x35\xd7\xe7\x65\x46\x53\x84\x61\x30\x0d\x70\xae\xa7\xff\x79\x76\
\xb7\x85\x10\x48\xf4\xa0\xaf\x90\x02\x37\xdc\x78\x23\xba\x81\x87\
\x57\xce\x9e\xc3\xc6\xc6\x06\x3e\xfd\x89\x4f\xe0\xc4\x27\x3e\x86\
\xcb\x9b\x9b\x3a\xce\x22\x9d\x2f\xd2\x77\xc7\x98\xbd\x49\xcb\x4b\
\xe5\x01\x53\xf3\x85\x08\x7c\x0f\x61\xa0\x4a\x89\x49\xa2\x8c\x56\
\x27\xa3\x01\x22\x10\x38\x9e\x07\xaa\x73\x9c\x52\x47\x75\x1a\x3b\
\x0a\x90\x5c\x17\x8c\x39\x60\xda\xa6\x48\x05\x31\xa6\x16\x4f\x24\
\xf3\xdf\xcb\xa2\x49\x32\x24\x2a\xbe\x50\x42\x08\xf0\x84\x2b\xa6\
\x94\xda\x12\x25\x1c\x5c\x14\xed\x84\x16\xe9\x33\x11\x00\x61\x10\
\xcc\x60\xc1\xec\xad\x58\xd4\x78\x12\x25\xda\x64\xe2\x6b\xda\x63\
\x24\x85\x1e\x23\xcc\x7f\xd7\xb1\xa6\xc2\xd0\x2d\xc0\x28\xc3\x52\
\xaf\x67\x67\x4b\xc4\x8e\x26\x83\xc1\xa0\x00\x46\xa4\x02\x10\x6a\
\xc9\x44\x03\x13\x72\x02\x20\xd6\x23\x0a\x36\x30\x3b\x48\x39\x8f\
\x80\x60\x5f\x39\x8b\x73\x2c\x2e\x7c\x68\xcb\x78\x2d\x30\xbd\x26\
\x3d\xa6\x45\x92\x6c\x67\x52\x6c\x0b\x1b\x84\xae\x78\x09\x29\x20\
\x78\x02\x29\x1c\x48\x9a\x0f\xc0\x66\x3d\x89\xec\x4c\x96\x82\xd2\
\x1c\x50\x54\xf2\x6a\xca\x98\x1c\x50\xc6\x41\xf4\x57\x29\x84\x56\
\xee\x31\x0d\x12\x91\x76\x2a\x27\xf6\x93\x4d\xb3\x1f\xa1\x37\xa7\
\xe9\x60\x17\x38\x2f\xd1\xbd\xe6\xfa\x3c\x1a\x43\x2a\xa9\x6f\xce\
\x2c\xf2\x92\x89\x69\x4c\x9b\x9e\x9d\x72\x2e\xb0\xbc\xba\x82\xbb\
\xdf\x7e\x3b\x5e\x7d\xf5\x0c\x36\x37\x36\xf0\x5f\x7f\xeb\x3f\xe1\
\xfc\xe9\x97\x91\x4a\xe7\x05\x01\x48\x92\x75\x56\xb4\xbc\x5d\x16\
\xc1\x09\xb9\xd4\xb9\xaa\x5c\x94\x0d\xfe\x3a\x0c\x4b\x6e\x17\x9d\
\xc0\x47\x1c\x27\xe0\x52\x62\x32\x19\x21\x4e\x59\x94\xab\x4c\x5d\
\x99\xe7\xa9\xa1\x59\x4a\x55\x8f\xca\x51\xbd\x2a\xca\x9c\xdc\x34\
\x57\xa7\xf9\xa6\x60\x0c\x5d\xea\x93\xe5\x92\x91\x94\xe0\x5c\x7b\
\xed\x71\x0e\xce\x05\x92\x24\x41\x94\xa8\x4d\xf1\xa0\x3b\x50\x81\
\x45\xa2\x38\xd8\x5a\x28\xed\x15\xd4\x78\x16\xa5\x9e\x29\x6e\x40\
\x41\xa7\x67\xc4\x64\x18\x4c\xbd\x54\x68\xb3\xb3\xa6\xfc\x67\xcc\
\x74\xa0\x2f\x9d\x54\x15\x98\xa5\x26\x70\x1b\x17\x36\xd0\x24\x7b\
\x49\x36\xa1\x47\x73\xc4\x0f\xd7\x1c\x3f\x0e\xdf\xf3\x8c\x32\xe6\
\x15\x96\xf3\x00\x3c\xf3\xf9\x67\xe6\x95\xf2\x16\x95\x89\xb7\x20\
\xd5\x02\xd3\x81\x18\x52\x15\x58\x35\x99\x6b\x2a\x5e\xaf\xec\x8d\
\x27\x04\x24\x4f\x20\x05\x87\x94\x54\x0f\x1d\x51\xdd\xab\xa1\xc5\
\x5f\xa1\x14\x04\x52\xc9\xc6\xa5\x84\x64\x02\x54\x28\x30\xa2\x8e\
\x03\xc6\x39\x64\x0a\x4c\x52\x1d\x3c\x8e\xb5\xcd\x8e\x63\xdc\x01\
\xdb\xe9\x63\xbe\x51\xa5\xd7\x8a\x06\x7b\xc0\xf9\x33\x08\x0f\x1f\
\x03\x75\x7d\xc3\x01\x9d\x6a\xd3\x54\x02\x70\x02\x49\x38\x88\xa0\
\x90\x9c\x17\x1e\xae\xe0\x1c\x87\x56\xfa\x38\xb4\xb6\x8a\xaf\xfe\
\xd2\x77\xa3\x1f\x78\xf8\xe0\x7f\xf9\x2f\x10\x52\x2a\x23\x55\xce\
\x41\xa4\xc8\x9d\x2a\x0a\xb6\x04\x06\x38\xa5\x65\xa3\xf2\xcb\x32\
\x93\xd6\x9b\x5f\xe6\x3a\x2e\x5c\x3d\xf8\xd9\x09\x7c\x44\x71\x02\
\x2e\x81\xd1\x78\xa8\xfa\x51\xae\x0b\x47\x97\xf6\x84\xe3\x20\xa1\
\x91\x56\xde\xb9\x06\x7b\x52\x4a\x48\x5a\x62\x8a\x28\xe5\xfa\x48\
\xa9\x14\x96\x82\xab\xe7\x9e\xeb\x23\x49\x38\x22\xce\xc1\x85\x80\
\x24\x6c\x61\x83\x6c\xd7\x71\x8b\x01\xc4\xe5\x5d\xd3\x74\x65\xb0\
\x56\xa7\x52\x43\xd7\xa2\x6c\x7c\x56\x5c\x27\x4b\xd2\xf1\xd9\x3f\
\x68\xfe\x2b\xbb\x45\xa9\xec\x93\x1c\x0d\x4c\x96\x57\x23\x7f\xa7\
\x65\x6a\x50\x89\xe7\x5f\x78\xa1\xa1\x55\x6a\x43\x70\xaa\xfa\x90\
\x4a\xe5\x93\x97\xda\x50\xcd\xa7\x4b\xcd\xca\x79\x2f\xbf\xf8\x52\
\xca\x8a\x0e\x12\xab\x8e\xb6\x8c\xd7\x02\xd3\x6b\xc1\x9c\x9a\xb8\
\x3e\x08\x34\x91\x85\x6a\xb7\x71\x29\x38\x38\x57\x0c\x42\x52\xaa\
\x40\x05\x34\x2f\xdf\xe8\x8d\x9b\x08\x68\xc7\x71\x09\xc9\x18\xa8\
\x14\xba\x94\xa7\x65\xe3\x0e\x07\x15\x5c\x2b\xf4\x84\x12\x48\x30\
\xa1\x4b\x4d\x31\x08\xe9\xe4\xb1\x18\x15\x49\x07\xc4\x4c\x43\x25\
\x14\xd1\x70\x0f\x3c\x9a\x20\x58\x3d\x84\xce\xfa\x91\xdc\xc5\x3c\
\x95\xaf\x43\xc5\xa2\xa7\x06\xaf\x69\xe4\x77\x12\xc7\xb8\xe3\xce\
\xb7\xe1\xab\xbe\xf2\x2b\xf0\xa5\xef\xb8\x0b\xeb\x9d\x00\x14\x04\
\x37\xdd\xfe\x56\xbc\xfa\xc2\x73\x19\x7b\xd3\x05\x33\xc4\x51\x94\
\x19\x95\x92\xc2\x60\xa8\x4e\x3f\x22\xf6\x4d\xaf\xd0\xff\x49\xbf\
\x90\x62\x04\xa3\xe3\x38\x59\xf4\xb7\xe7\x50\x8c\xc7\x13\x4c\xc7\
\x43\xc4\xa3\x01\x98\xeb\x2b\x16\xe5\xab\xaf\x69\xa9\x8f\xa4\xa2\
\x12\x46\xf3\x1e\x14\xa1\xa0\x42\x40\x08\x5e\x7a\x57\xa8\x7e\xa1\
\xc9\x9a\x84\x50\x0e\xe3\x09\x4f\xcd\x5c\x0f\xd0\x64\xaa\x2c\x36\
\xd5\x49\x07\x66\xc3\xf0\xf2\xc8\x07\x59\x59\x36\xb3\x89\x20\x0c\
\x8b\x3d\xd8\x24\xe3\x52\x0a\xf4\x7a\x3d\xf4\xfb\x3d\x54\x51\xd9\
\xad\xd1\x18\x1e\xa5\x08\x3d\x17\x54\xb3\xa6\x8d\x8d\x0d\x55\xca\
\x6b\x80\x37\x07\x06\x27\x7d\xa2\xb3\xb2\xba\xda\x1c\x74\x1a\x80\
\x95\x90\x12\x67\xce\xbc\x3a\xcf\x55\x5c\x36\x60\x50\x2d\x5b\x6a\
\x81\xe9\x8a\x59\xd3\x95\x18\xb8\x0a\x10\x54\x3b\x56\xea\x90\x3f\
\x41\x22\xe5\xd6\x20\x84\x1a\xb8\x25\x02\x92\x11\x10\x50\x18\x23\
\x2c\x6a\x63\x49\xc1\x89\x32\x50\x26\xc0\x1c\x06\x29\x18\x24\x73\
\x20\x98\x06\x38\x21\x54\xa9\x4f\x2b\xf4\x88\x10\x88\xe3\x18\xd3\
\x68\xaa\x98\x44\xaa\xc4\x33\x36\xcd\x4c\x9d\x57\x3a\x4f\x16\x49\
\x8c\xf1\xa5\x0b\x48\x86\xfb\x08\x57\xd6\xd0\x3f\x7a\x5c\x07\x09\
\x6a\x53\x53\x21\x95\xcf\x9c\xa0\x10\x89\x80\xef\xfb\xb8\xeb\x9d\
\xf7\xe0\x4b\x1f\xbc\x0f\x6f\x7d\xcb\xcd\xf0\x18\x4b\x8d\xbe\x71\
\xe8\xc8\xd1\x4c\x06\x9f\xc9\xb3\xcd\x3d\xd8\x02\x4e\x40\x6e\xbd\
\x53\xb5\x01\x92\x19\x80\x22\xb3\xec\x94\x00\x81\x1f\x20\xf0\xfd\
\x7c\x10\x36\x8a\x31\x9d\x8e\x10\x4f\xc7\xaa\x9c\xe7\xa6\xf9\x4d\
\x01\xa8\x23\x40\xd3\x9e\x9d\x06\x27\xe5\xb6\xc1\x8b\x55\x20\xed\
\x34\x9e\xca\xc4\xb9\xee\x31\xc5\x71\x0c\x21\x16\x17\x3f\x98\x19\
\x49\x64\xc1\xae\xc8\xec\xf5\xca\x35\xaa\xd2\xcf\x24\x0c\xb6\x54\
\x14\x41\x54\x83\xa3\x96\x58\x48\xc0\x75\x9c\xcc\xf4\xb7\xcc\x62\
\x2f\x8f\xa7\xb8\x38\x8e\x41\x09\x81\x37\x8d\xe1\x53\x8a\x9e\xeb\
\x80\xf8\x1d\x10\x42\xb5\x45\x17\x2d\xc5\x95\xd4\x55\xeb\x16\x04\
\x27\x09\x2c\x2f\x2f\x17\x1e\x76\x13\x13\xd7\x3a\xb0\x92\x52\x20\
\x9a\x4e\xe7\xe5\x30\xcd\x8b\xbb\x68\xc1\xa8\x05\xa6\xd7\x8c\x35\
\x35\x03\x25\x45\x21\x44\xf9\x8c\xaf\xd0\x72\x52\x9a\x63\x70\x1d\
\x41\xa1\x14\x7a\xb4\xf8\xa1\xc8\x14\x7a\x6a\x20\x94\x50\xa9\x7a\
\x34\x3a\x1e\x9d\xe8\xc6\x3d\x63\x0e\x04\xe5\x4a\x9d\xc7\x28\xa4\
\x64\xa0\x42\xbd\x84\xd3\xc9\x04\x8c\xb1\xac\xc4\x55\xc5\x98\x64\
\xc5\xd6\x10\x8f\x87\x48\xa6\x63\x44\xfb\xbb\xf0\x3a\x5d\x74\xd7\
\xf5\xfc\x0a\x73\x11\x4d\xa7\x18\x0f\xf7\xd1\xed\xf5\x70\xeb\xed\
\xb7\xe2\xe6\x9b\x94\xa5\x91\x90\xa2\x20\x79\x36\xfb\x37\xa6\x23\
\x35\xd1\x6e\x0c\x79\x94\x79\x69\x53\x24\xb2\x62\xd3\x22\xb3\x00\
\x45\x8a\x60\x34\xb3\xc5\xe9\x24\x5e\xd7\xf3\xd0\x09\x81\x84\x27\
\x88\x22\x65\xbc\x3a\x1c\x0e\x10\x4f\xc7\x70\x26\x3e\x98\xe7\xc3\
\xf1\x02\x30\xcf\x05\x49\x74\x59\x8f\x29\x60\x22\x33\xe1\x75\x52\
\x27\x14\xe7\x8e\x16\xb1\x2e\xe3\xe9\x37\xc1\x02\x02\xe9\x2b\xdf\
\xb7\x0c\x92\x64\x05\x24\xf5\x5a\xd7\x64\xbf\x9b\x25\xc2\x6c\x53\
\x37\x7b\x4d\x32\x73\xb0\xb7\x3d\xaa\xad\xe1\x04\xe7\x47\x53\x78\
\x4c\xbd\x2f\x63\x49\x10\x73\x60\x3f\x89\xf1\x37\x7f\xe4\x7f\xc3\
\x7d\x5f\xfb\x4d\xf8\xed\x0f\xfc\x7b\x9c\xfc\xd8\xff\xc0\xfe\xce\
\xb6\x76\x2a\x61\xa0\x35\x20\x55\xb2\xa1\x6d\xc4\x9a\x56\x57\x57\
\xab\x81\x7d\xc1\x72\x1e\x25\x04\x51\x14\x61\x7f\x7f\x3f\xb9\x82\
\x1e\x53\x5b\xca\x6b\x81\xe9\x35\x65\x4d\x8b\x00\x94\xcc\xcc\xbe\
\x6d\x4f\x30\x23\x48\xa4\x50\x1f\x4e\xe6\xa8\xf9\x20\x2d\x84\x50\
\x67\xae\x86\x3b\x01\x84\x96\x8e\xab\xa8\x0b\xe6\xb8\x88\xe3\x04\
\x93\x28\x86\xc7\x1c\x08\x2e\x94\x15\x51\xea\xc5\x47\x05\x24\xa3\
\x2a\x18\x8f\xf0\xfc\xec\x96\x18\xea\x32\xd3\xd4\x55\xbb\x56\x17\
\x3f\xa6\xb9\x3b\x37\x24\x10\x8d\x06\x88\xc7\x43\x8c\x2e\x5f\x52\
\x9b\x0e\x18\xa6\x52\x0b\x0f\x96\x97\xe0\x07\x81\xf2\xd8\x03\xc9\
\x6c\x79\xa4\x51\x1e\xcc\x98\x12\x8c\xaf\x65\x65\x48\xe9\x2e\xda\
\x3a\xef\xa4\x11\x20\x99\xd7\x25\x56\xc6\xaa\xfa\x51\x1e\x00\x09\
\xdf\x75\x30\x1c\x8d\x30\x1d\x2b\x80\x62\x5e\xa0\x01\xca\x87\xe3\
\xb8\x59\x6f\xad\x1c\xf3\x90\x47\x9c\xab\xf3\x10\xa1\xdd\x2f\xd2\
\x7e\x93\x90\x4c\xb5\x0f\xb1\x60\xab\xc9\x48\x37\xb6\x09\x0a\x2c\
\xff\x9c\xff\x4e\x26\x75\x48\x56\x49\x2f\x2c\xbf\x22\xd1\xef\xf5\
\xb2\x32\x69\x7a\x59\xc2\x05\x5e\xd9\xd9\x07\x28\x53\xa5\x54\x50\
\x25\x22\x21\x4a\x3c\xb3\xdc\xed\xe0\xcb\xee\xfb\x12\xbc\xfb\x4b\
\xde\x81\xed\xc1\x08\x4f\x3f\xfb\x3c\x1e\xfd\xd4\xc7\xf1\xdb\xff\
\xe6\x5f\x63\x6f\x7b\x7b\x36\x85\xd9\xb8\xff\x8b\xb0\x27\xe5\x93\
\xb7\xb6\x10\xbf\x9c\x07\x56\x42\xc5\x75\x5c\x49\x09\xaf\x05\xa4\
\xab\xb4\xe8\x9b\x1c\x90\x80\x6a\xb7\x87\x26\x7d\x26\xa1\x27\x22\
\x6b\x4b\x14\xc4\x70\x82\x90\x52\x00\x32\x15\x30\x94\xaa\x24\x69\
\x9c\x3a\xa1\x98\x4e\xc6\xd8\xdf\xdf\xc3\x9d\xb7\xdf\x82\x7f\xf2\
\xc3\xef\xcd\x66\x77\xd4\x10\x29\xcb\x5c\x0e\x28\x65\x20\x2c\x97\
\x7d\x93\x39\xa7\xda\x66\x8c\x77\x9a\xdb\x94\x29\xee\x90\x02\x0d\
\x29\x94\x37\x54\x46\x11\x2b\x46\xc0\x9b\x51\x19\x7a\x05\x61\x58\
\xd8\xd8\x49\xf1\x7f\x28\xe2\x47\x51\x46\x3e\x0b\x34\xe9\x75\x88\
\x61\x2b\x64\x64\x5b\x19\xce\xe6\xb9\x93\x86\x61\x47\x64\x24\x07\
\xa7\x9b\x4f\x18\x06\x38\xb4\xb6\x86\x23\x87\xd7\xb1\xb6\xd4\x83\
\x4f\x05\x92\xd1\x00\xe3\xbd\x1d\x8c\xf6\xf7\x30\x1e\xec\x23\x8e\
\xa6\xf9\x1d\x30\x06\xa2\xcb\x0e\x03\x6a\x93\xe6\x2a\x02\x43\x3f\
\x7f\x8b\xbc\xf9\x84\x10\xf9\x7d\x9c\xe5\x89\x07\x7e\x4b\x4b\xe3\
\xdd\x2b\x9b\x9e\x93\x99\xd7\x37\x7e\x29\x73\x16\x97\x99\x6b\x31\
\xce\x5c\xde\xc1\xd6\xfe\x10\xa3\xe9\x14\xe3\x28\xc2\x38\x8a\x31\
\x89\x63\xc4\x89\x06\x6c\x09\x24\x42\x40\x12\x82\x63\xab\xcb\xf8\
\x8e\xbf\xfc\x65\xf8\x67\xff\xf0\xa7\xf0\x89\x47\x1f\xad\xcf\x75\
\x9a\x01\xe2\x9a\x4c\x76\xa9\x66\x8e\x3a\x9d\x4e\x31\x8b\x6c\xe6\
\x31\xcb\xf9\x9c\x55\xe6\xaf\xf1\x1c\xd7\x87\x45\x24\xe2\x2d\x38\
\xb5\x8c\xe9\x35\x01\xab\x45\x59\x53\x61\x53\x29\xdf\x10\xd5\x06\
\xa8\x49\xa2\xdc\x09\x88\x10\x50\x2a\x6d\x99\xfd\x96\x84\x04\x4f\
\x12\xc4\xd3\x09\xba\xfd\x65\x7c\xeb\x5f\xff\xeb\xf8\xfe\xff\xe9\
\x3d\x58\xd2\xcd\xe7\x53\xcf\x9f\xc6\x7f\xfa\xe0\x1f\x29\x50\x72\
\x5c\x50\xdd\x67\x92\x52\x80\x42\x82\xc7\x31\x86\x83\x7d\x84\x9d\
\x8e\x35\x06\xdb\x9c\x70\xc9\x36\x59\x22\x8b\x29\x83\x42\x91\x9e\
\xbc\x1c\xa4\xce\x5d\xb2\x2c\x28\x53\xc1\x46\x29\x58\x1a\x3a\xa8\
\xb7\x8f\xf5\xf5\x43\xf9\xd6\x42\x72\xf9\x43\xb1\x54\x57\x64\x50\
\x44\xdf\x8f\xe2\xc9\xac\x0d\xa0\xca\xff\xce\xc1\xa3\xdc\x83\x82\
\x75\xbb\xcf\xff\xac\xeb\x7a\x70\x5d\x0f\x9d\x4e\x88\x24\x51\x4e\
\xe8\x02\x2a\xba\x63\x3a\xe2\xf0\x82\xd0\x12\xc0\x2a\x33\x70\x64\
\x1a\xfc\x14\x73\xca\xc7\x00\x16\x79\x93\x8d\x27\x93\x22\x71\x3a\
\x08\x53\x9a\xc9\xf7\xb3\x67\xea\xe6\x4a\x3b\xb3\xcf\x64\x23\x11\
\xa6\xa8\x42\xc0\x75\x5d\x2d\x82\x51\x8f\x71\x3c\x8d\xf0\xd9\x97\
\x5e\x05\x07\xc5\x34\x0e\x11\x78\x3e\x7c\xcf\x85\xeb\x3a\xf0\x1c\
\x07\x8c\x53\x38\x4c\xbd\x2f\x1c\xc6\x70\xb4\x17\xc2\xd3\x49\xc9\
\x37\x1e\x3e\x84\x1b\x6e\xbb\x0d\x2f\x3f\xfb\xf9\xda\x92\x9e\xed\
\x5d\x32\x5b\x82\x94\x70\x5d\x0f\xc7\x8f\x1f\xaf\x8f\x7c\x6f\x5c\
\xce\x33\x3b\x7f\xb5\x6a\xbc\x45\x06\x6c\x5b\x80\x6a\x81\xe9\xaa\
\x96\xf4\x0e\x14\x16\x48\xac\x5c\x29\xf7\x10\x83\x54\xd2\x71\x91\
\xce\xf8\x70\x15\x9d\xa0\x62\x2a\x08\x82\x4e\x07\x77\xbd\xeb\x7e\
\xfc\xb5\x6f\xfe\x06\x7c\xf9\x1d\x6f\x41\xdf\x2d\x5a\xc1\xfc\xa3\
\x1f\xfb\x7b\xf8\x77\xbf\xfb\x41\xf4\xc3\x00\xd2\x95\xca\xbd\x5c\
\xa7\xe5\x42\x2a\xef\xba\x28\x8a\xb0\xb7\xbb\x83\xa5\xa5\xe5\xd9\
\x19\x1b\x43\xd2\x9b\xd5\xd1\x84\x34\x38\xb3\x71\xc6\x6d\xfe\x3b\
\xf3\xf4\xcb\xa3\x25\x08\xa1\xca\xae\xc7\x48\xc1\x05\x80\xc3\x47\
\x8f\x64\x2d\xa4\xc2\x50\xad\x51\xbb\xb3\x66\x1c\xda\x58\x82\xb9\
\x53\x13\x4b\xd9\x8e\x18\x67\xd6\xa4\x74\x1b\x64\xce\x0e\x6e\x5c\
\x5e\x50\xf5\xb1\x18\x11\x71\x8c\xfb\xa4\xbd\xe4\x64\xe9\xa4\x58\
\x67\x2a\xd1\x74\x1e\x8a\x90\x9a\x0e\x86\x65\x97\x92\x2a\xeb\x29\
\x7b\x40\x86\x1b\xc5\x62\x6c\x69\x4e\x13\x09\xb3\x79\x4d\x85\xab\
\x54\x0d\xf6\xea\xb1\xa9\x6e\xb7\x93\xb1\x1c\x21\x25\x86\xe3\x31\
\x5e\x39\x73\x0e\x8e\x17\xa0\xd7\xef\xa1\x13\x86\x08\x02\x1f\xbe\
\xe7\xc1\x73\x5d\x78\xae\x03\xd7\x61\x60\x8c\xe1\xda\x95\x7e\x06\
\x4a\xe9\xc9\xd9\xb5\x37\xdd\x84\x97\xd5\x9c\xd0\x15\x2d\x02\x52\
\x61\x16\x7b\x40\x75\x9e\x54\xfd\xd1\x13\x27\x4e\xa4\x8c\x69\xde\
\x80\x6d\xd3\x3e\x53\xbb\x5a\x60\xba\x6a\x25\xbd\xc5\xc3\x02\x6d\
\xa5\x29\x39\x5b\x33\x15\x9c\x23\x8e\xa6\x8a\x35\x81\xa0\xbf\xb4\
\x8c\x1b\x6f\xbb\x1d\xb7\xdc\x7e\x1b\xee\xbe\xf3\x0e\x3c\xf8\xf6\
\xdb\xb0\x1e\xfa\xf0\xb4\x54\xdb\xfc\xfc\xf8\xcb\x6b\xb8\xf7\x9e\
\xbb\xf0\xf4\xf3\x2f\xa8\xfe\x53\x2a\x3e\xd0\x7d\x1e\x2a\x25\x64\
\x2c\x30\x1a\x0c\xd0\xeb\xf5\x73\xf0\xb1\xfa\x8f\xa5\xa0\x25\x00\
\x41\x35\x38\x09\x95\x5f\x54\x02\xa6\xd4\x31\x22\x2d\x31\xa6\x25\
\x33\x09\x89\x28\x4e\x20\x8c\xb3\x4d\x95\x88\x4b\xf2\xf2\x1a\xca\
\xb6\x3f\xc4\x40\xbb\x1a\x45\x1b\x29\xca\xc5\x8b\x80\x43\x66\x58\
\x52\x91\x31\x91\x03\xbf\x19\x7c\xcf\x05\x25\x2e\x62\xcb\xf6\x5f\
\x2e\x43\x11\x42\xc0\x18\xcd\x40\x69\x51\x3a\xbe\x79\xf1\xa2\x21\
\x7a\xa9\x00\x1c\xd2\x64\xdb\xad\xfb\x6b\x64\x0e\x95\x98\x1d\xec\
\xcd\x4c\x8b\xa4\xc0\xda\xea\x8a\x7a\x97\x08\xf5\x3e\xdb\xde\xdd\
\xc3\xd3\x4f\x3d\x85\x95\xf5\x43\xe8\x6b\x53\xde\x5e\xb7\x8b\xb0\
\xa3\xd4\x90\xbe\xe7\xc1\xf7\x3c\x38\x0e\xc3\xdd\xc7\x0f\x15\xfe\
\x82\x90\x12\x83\xdd\xbd\x85\x5f\x1f\x5b\xff\x56\x4a\x89\xe5\x95\
\x65\x8b\x4f\x5e\x3d\x0b\xac\xe3\x96\x04\xc0\xde\xee\xee\xbc\x52\
\x5e\xab\xcc\x6b\x81\xe9\x75\x67\x49\x75\xe5\xbc\xea\xb0\x40\x21\
\xf8\xab\xcf\x3f\x23\xaf\xbb\x35\x0d\x0b\x4c\xc0\x18\xcb\xe4\xda\
\x65\xd6\x94\xf6\x9a\x56\x0e\x1d\xc6\x5d\x5f\xf2\x2e\xbc\xfd\xae\
\xb7\xe3\xf8\xb1\xa3\x38\xbc\xb6\x82\x69\x9c\x60\xec\x3a\x20\xae\
\x3a\x0b\x2f\x7f\x9c\xfe\xf3\x2f\xff\x02\xde\xf2\xe7\xbf\x0a\xfd\
\x4e\x08\x09\x80\x65\xe5\x3c\x09\x30\x55\x6e\xe1\x71\x84\xfd\xfd\
\x3d\x2c\x2d\xaf\xe8\xfb\x30\x8b\xbf\xaa\x17\x9e\x96\xf4\x84\x1a\
\xfa\x4d\xd9\x94\x4c\x3f\x9b\x14\x52\x68\x44\xd5\xc0\xa4\xc4\x01\
\x29\x4b\xa0\x70\x1c\x06\xa6\x1d\xb9\x89\x3e\x2b\xce\x00\xc9\x24\
\x3a\xb2\xe8\x40\x4d\x0a\xa9\xad\xf5\xa0\x54\xec\x51\xcd\xfa\xdb\
\x91\x4a\xc6\x44\x16\x7b\x23\x48\x69\x1d\x22\x4d\x01\x95\x94\x1c\
\x4e\x29\x21\x60\xd4\x30\xa2\x5d\x08\x36\x24\x76\xb6\x77\x0a\x1a\
\x11\x02\x3b\x43\x6c\x90\x04\xde\xac\x94\x55\x9c\xae\xad\xbd\x49\
\x09\x25\x91\x5f\x59\x5a\xca\x80\x40\x48\x81\xf1\x78\x8c\x97\x9f\
\x7b\x06\xcb\x5b\x87\xd1\x5b\x59\xc3\xd2\xca\x0a\xfa\xcb\xcb\xe8\
\xf7\xfb\xe8\xf5\xba\x08\xc3\x10\x8e\xe3\xe0\xae\x5b\x6e\xcc\xc7\
\x08\xf4\x6d\xc6\x5c\xe0\x85\xa7\x9f\x6a\xec\x3a\x2e\x6b\xee\x69\
\xea\x93\xd7\x6b\xe4\x93\xd7\x7c\xed\xef\xed\xa1\x41\x09\xaf\xb5\
\x22\x6a\x81\xe9\x0d\x57\xce\xab\xf0\xcc\x22\x02\x00\xe3\x49\xac\
\x1d\x06\x9c\x9c\x19\x18\x25\xbd\xd4\x75\x3c\x89\xa6\x98\x8e\x47\
\xd8\xdf\xdf\xc3\xd6\xd6\x65\x74\x3a\x1d\x78\xae\x8b\xc0\x73\xe1\
\x32\x06\x87\x52\x38\x84\xa1\x2c\x60\xea\xac\xad\xe3\x2b\xbe\xf4\
\xdd\x78\xf8\xb1\xc7\x54\x8f\xc7\x71\x0d\xbb\xa0\x3c\x2e\x63\x34\
\x18\x22\x08\x42\xed\x9d\x57\x2c\xe9\xe5\x62\x3d\xdd\x6f\x90\xc8\
\x4a\x7a\x02\x02\xd4\x60\x50\x02\x39\xc3\x51\xde\x72\xb9\x53\x02\
\x63\x14\x8c\x16\xef\xa3\xeb\xb9\x79\xe4\x84\xa9\xa4\x23\xd6\xae\
\xc1\x2c\x73\x22\xb3\x4d\x96\x99\xfe\x11\x31\x89\x13\x29\x96\x02\
\x0f\xc8\x98\xcc\x52\x63\x85\xb8\xcf\x10\x7b\xa8\xe8\xf8\xcc\x2b\
\x2f\x2d\x7d\x35\x7d\x93\x49\xcd\x1e\xf6\xf7\x32\x91\x46\x2e\xe6\
\x20\xb9\x51\x46\xf6\x58\x48\x25\xa0\x2c\x02\x36\xe5\xdf\x99\x27\
\x39\x07\x80\x38\x49\xb2\xc7\x2b\x84\xc4\x68\x30\xc0\x2b\xcf\x7e\
\x1e\xdd\xa5\x0d\x74\xfa\x4b\xe8\xad\xac\x61\x79\x7d\x1d\x4b\x2b\
\xab\x58\x5e\x5d\x41\xaf\xbf\x04\xd7\xf3\x71\xff\xdb\x6f\xcd\x2a\
\xc4\xe9\xf3\x72\xfa\xe2\x26\x06\xbb\x7b\xa0\x8c\x2e\xf4\x91\x94\
\x15\xfd\xc2\x28\x8e\x33\x49\x7b\xf1\x65\x3b\x68\x58\x20\xf0\xd8\
\x63\x8f\xca\x06\x25\xbc\xa6\xce\x0f\x2d\x50\xb5\xc0\xf4\xba\x82\
\x53\x6d\x39\x6f\xa6\x7b\x2d\x4b\x3b\x9c\x54\xfd\xa1\xe1\xde\x1e\
\x2e\x9e\x3b\x87\xd5\xb5\x75\x2c\x2d\x2d\xa1\x13\x06\x08\x7c\x0f\
\xbd\x30\x40\xe8\x3a\x70\x29\x51\xae\xdf\xa5\x3b\xf8\x81\x5f\xfc\
\x19\xdc\xf6\xa5\x7f\x49\x9d\x91\x32\xa1\xd8\x99\x60\x90\xc2\x51\
\x1b\x24\x73\xc0\x85\xc0\xde\xee\x2e\xd6\xd6\xd7\x6b\xcf\x43\xd3\
\x28\x8e\x94\x38\xcd\x82\x13\x32\x6f\x3f\x18\x25\xbd\xcc\xca\x87\
\xe4\x39\x88\x00\xb0\xd4\xef\x1b\xa8\x61\x88\x1f\x2c\x80\x44\x32\
\xab\x4f\x62\x6f\xf8\x57\x95\xeb\x6c\xe5\x41\x0b\x28\x55\x01\x95\
\x69\xa1\x63\x45\x20\xdb\xcb\xa8\xc5\x1e\x94\xe6\xe0\x94\xf0\x44\
\x0d\xd8\xa6\x25\x5c\x5d\xf6\x94\x73\x0a\x68\x0a\xd4\x04\x5e\x7c\
\xf6\x59\x1d\xab\x4e\x66\xb1\x85\x10\xcc\x3e\x35\xa4\xf0\x70\x6c\
\x2c\x87\xd4\x72\x0c\x52\x2a\xde\x55\x97\xf3\xd2\x7f\x2a\x1f\x3a\
\xf5\x02\x0b\x21\xd0\xeb\x74\x30\xdd\xdf\x45\x34\x1e\x61\x7f\xfb\
\x32\x2e\x6f\x6e\x20\xe8\xf5\xd1\x5f\x59\xc5\xf2\xda\x1a\x96\x56\
\xd7\xe0\x87\x5d\xf4\xbe\xfe\x2f\x17\xe6\x01\x24\x80\x5f\x7e\xdf\
\xaf\x1c\x30\x40\xd0\x52\xaa\x93\x12\xd7\x5c\x53\xf4\xc9\x6b\x4e\
\x1d\x91\x0d\x70\x95\x3d\x03\xcf\x9f\x3d\x27\x61\xef\x2f\x2d\x52\
\xc2\x6b\x41\xa9\x05\xa6\xab\x06\x46\x07\x35\x70\xad\xcc\x64\x2a\
\x83\x11\x31\x36\x79\x29\x94\xfa\xee\xf2\xe6\x06\x2e\x6d\x1e\xc1\
\xf2\xca\x8a\x2a\x85\x04\x01\xf6\x86\x63\xf4\x7c\x1f\x9e\xc3\xc0\
\x88\x54\x33\x22\xc6\xcd\x79\x9d\x2e\xbe\xe3\xaf\xfd\x35\xfc\xd6\
\xef\xfc\x8e\x1e\x0a\x75\xb4\x42\x4f\xb3\x26\xc9\x20\xa5\x8b\x38\
\x9e\x62\xb0\xbf\x8f\xa5\xe5\x65\x70\x21\x8c\xcc\x1e\x63\xbe\x89\
\x98\x97\x91\xac\xdf\x94\x81\x13\x91\xc5\x8d\x12\xb9\x24\x3b\x55\
\x5e\xe5\xa5\x2c\xb5\x91\x65\x12\x6f\x09\x3b\x43\x6a\x68\x57\x63\
\x2b\xe5\x65\x3d\x19\x62\x6b\xc5\x90\x22\xfb\x99\xc7\x8e\xca\xbb\
\x87\x8e\x26\x2f\xc7\x61\x10\x2d\xf6\xc8\xc0\x18\xa9\xb1\xab\x40\
\x9c\xe4\x0d\xf8\xaa\xf1\x9c\xc2\x1b\x49\x2a\x63\x5f\x29\x25\xe2\
\x69\x54\x28\x5b\x16\x02\x0d\x4b\x85\x4b\x7b\xbb\x28\xa5\x02\x15\
\xac\xc9\x6a\x37\x54\x01\x5f\xd9\x55\x8a\xac\x69\x7d\x6d\x55\xfb\
\xc7\xaa\xfd\x78\x69\xa9\x0f\x97\x48\x44\xa3\x7d\x50\x24\x88\x92\
\x08\xfb\x3b\x97\x71\xe9\xfc\x59\x84\xdd\x1e\xba\x4b\x2b\x08\x7b\
\x7d\x78\x0e\x53\x7d\x25\x7d\x4b\x83\xe9\x14\xbf\xf5\xab\xbf\xa2\
\xd9\x12\x69\x5c\xb8\xab\x7a\xa3\x28\x61\x46\x57\x3b\x93\xf0\x03\
\x33\xa4\xf2\x5d\x98\x46\xd3\xa6\xfd\xa5\x26\xb1\xea\xed\x6a\x81\
\xe9\x8a\x19\x52\x13\x0a\x5e\xdb\x6b\xaa\xff\x48\x15\x4b\x7a\x44\
\xb3\xa6\xd1\xfe\x1e\x2e\x9e\x3f\x87\xe5\xd5\x55\x2c\x2d\xf7\xd1\
\xed\x74\xb0\x17\x06\xe8\x85\x01\x7c\x87\x81\x11\x17\x8c\x10\xb0\
\xd2\xa6\xf7\x7f\xfc\xe8\x8f\xe0\x37\x7f\xe7\x77\x95\x3d\x91\x54\
\xf1\x18\x69\x39\x4f\x59\x08\x49\x48\xe1\x60\x38\x1c\x82\x10\xa0\
\xdb\x5f\xb2\x84\xa9\xe5\xa0\x54\xe8\x37\x99\xe0\x64\x4a\xcb\x35\
\x8d\x50\x52\x5f\xb5\x85\x29\x65\x5a\xbe\x81\xd2\x6c\xbe\x49\x96\
\xea\x5b\xf6\x68\x39\xd2\x28\xad\x87\x58\xc0\x86\x94\xfa\x50\x75\
\xa0\x64\xfa\x07\x56\xf9\x5e\xa8\x7f\xc4\x82\x20\x91\xc6\x74\x51\
\x5a\x5e\x4b\xc3\x06\x0b\xb3\x54\x4a\x95\xc8\xb3\x19\xb0\xf9\x6f\
\x30\x09\x35\xe7\x13\x25\x09\x36\xcf\x9f\x53\xcf\x25\x99\x4d\x83\
\x25\xa6\x24\x9e\x54\x3d\x83\xa4\x36\x2d\xbd\x5e\xb0\x97\x1a\xd4\
\x1a\xb1\xee\x16\xd6\xc4\x52\xa9\xb8\xbe\x4f\x81\xef\xe1\xd8\xe1\
\x35\x5c\xbe\x74\x11\xd7\x1c\x59\x06\x65\x0e\xee\x7c\xe7\xbb\xb0\
\x7c\xf8\x38\x3e\xf4\x3f\x3e\x8a\x0b\x17\xce\x02\x84\x62\x38\x99\
\x42\xf6\x7b\xd9\xec\xd3\xcf\xfd\xf2\xfb\xb0\xb3\xb5\xa5\x4a\xdc\
\x75\x00\x54\x79\xc2\x32\xfb\x83\x5e\xbf\x5f\xc3\x18\x17\x2c\xe7\
\x11\x82\x38\x49\xb0\xb3\xb3\x33\x8f\x2d\x1d\xc4\x5d\xbc\x5d\x07\
\x58\xb4\x7d\x0a\x0e\x54\xce\xb3\xf5\x9a\xaa\xb6\xcd\x99\x52\x15\
\x21\x04\x10\x09\xa2\xc9\x18\xdb\x9b\x9b\xb8\x78\x61\x03\x97\xb7\
\x2e\x63\x6f\x7f\x1f\xc3\xd1\x18\x3b\x83\x21\xf6\xa7\x11\x22\x2e\
\x10\x4b\x59\xce\x6f\x87\xe7\x7b\xf8\x91\x1f\xfc\x41\xc4\x49\xa2\
\x1d\x22\x1c\x15\xf4\x67\x0c\xe0\xa6\x5e\x77\xa3\xd1\x48\xe5\x22\
\x11\xab\xce\x2d\x2b\x8d\xe4\xc3\xb7\x5a\x50\xa1\xe3\x2e\xd2\x1e\
\x93\xd4\x6e\x07\x66\xdc\x93\x84\x2c\x00\x53\xa8\xa3\x1c\xa4\x45\
\x14\x26\xeb\x79\x51\x45\x29\x8b\xcc\xfd\x59\x81\xe1\x14\xec\x22\
\x66\x7b\x36\x85\x88\x75\x4b\xcc\x46\x02\x8a\x44\xd2\x02\xfb\x21\
\x3a\x38\x91\xe8\xb0\x41\x4a\x15\x38\xab\xb2\x9e\x12\x05\x08\x39\
\x7f\xac\x33\xed\x2d\x01\xc0\x34\x4e\xb0\xbf\xb3\x93\xe5\x41\xa1\
\x1c\xff\x5e\xa2\x85\xa4\xe6\xd9\x92\x36\xf6\x33\xef\x59\x6f\xb8\
\x75\xba\xae\x93\x0b\x5b\x28\x41\xbf\xd7\xc3\x3d\x77\xdd\x81\xc3\
\x87\x56\xe1\xfb\x3e\xde\x72\xd3\x8d\xf8\xe9\xbf\xff\x53\xf8\xfb\
\x7f\xf7\x47\xf0\xc7\xbf\xf7\x5b\xf8\xae\x6f\xfd\x26\x5c\x3e\xf7\
\x2a\x3e\xf8\xd1\x4f\x64\x35\xde\x4f\x3c\xfe\x24\xfe\xef\x9f\xfc\
\xc9\x1a\x50\xb2\x3f\xb6\xba\xc7\x0c\x02\xac\xa7\x65\x6a\xb9\xe8\
\xc7\xba\xf8\x6d\x0a\x56\x2a\xa5\x38\x5a\xc4\x51\x5c\xa0\x9d\x5f\
\x6a\x19\xd3\x17\xa0\x9c\xd7\xfc\x20\xb6\x37\x62\xe9\x2c\xcf\xa8\
\xb9\x67\x46\x3d\x82\x63\x3c\xdc\xc7\xe6\xb9\x33\x58\x5d\x5f\xc3\
\xd2\xd2\x12\xba\xdd\x8e\xee\x35\x85\xe8\xf9\x1e\x3c\x46\x15\x63\
\x2a\xa9\xf4\xfe\x97\xf7\x7e\x17\xfe\xd5\xbf\x7d\x3f\x84\x6e\x50\
\x4b\x29\xc1\xd2\xd9\x24\x21\x20\x99\x04\x93\x0e\x78\x1c\x63\xfb\
\xf2\x16\x56\x56\xd7\x32\x99\xb7\x6d\xf4\x5d\xce\x84\xe4\x89\xac\
\xfe\x44\x8d\x28\x75\x73\x98\xb4\xac\x1b\x3c\xb2\xba\xbc\x60\x1f\
\xa1\xc4\x24\x17\xda\xba\xec\x78\x35\xeb\xa1\x57\xcd\x90\xa4\x91\
\x63\x84\x14\x64\x4b\xaa\x31\x42\x89\x06\x7e\x96\x33\x42\xa2\x54\
\x79\x94\x52\x3d\x97\x2c\x73\x69\x7d\xdd\x19\x8e\x66\x6d\x83\xd1\
\x08\x93\xf1\x18\x4c\x97\xbc\x2a\x1f\x1f\x29\xb1\xc0\x99\x19\x2e\
\x03\xf5\x48\x45\xe0\x90\x45\xdc\x60\x8f\xc7\x30\xca\x79\x52\x3d\
\xb6\xc3\xa9\xe5\x8f\x7e\xef\x79\xae\x8b\x3f\xff\x65\x5f\x86\xcf\
\x3d\x75\x0a\xab\xab\xab\xf8\x7b\x3f\xfa\x13\xe8\xf6\xfa\x90\x52\
\x22\x08\x42\x74\x5d\x86\x64\x3c\xc0\xff\xf1\x43\xdf\x0f\x31\x19\
\xe2\xa5\x17\x5e\xc0\x7f\xf8\xc5\x5f\x00\x21\x0b\xbc\x1f\x48\x33\
\x25\xc9\xf2\xca\x4a\x35\x45\x6c\x5c\xce\xcb\x87\xa6\xb7\x77\x76\
\x00\xd5\x5f\x6a\x3a\x60\xdb\x7a\xe4\xb5\xc0\xf4\xba\x97\xf3\x0e\
\x02\x50\x85\xbd\x43\xfd\x76\xa9\x5c\x65\x80\x13\x25\x04\x52\x70\
\x4c\x47\x23\xec\x6e\x5d\xc4\xc6\xd9\xb3\x58\x5a\x59\x41\xaf\xd7\
\x43\xe0\xfb\xe8\x86\x01\x96\x3a\x01\x5c\x46\x41\xc0\x40\x18\x29\
\x9c\xc9\x33\x46\xf1\xb3\xff\xf4\x9f\xe2\x87\xfe\xce\xdf\xc9\x8c\
\x5b\x33\xc6\x23\x4d\x09\x39\x10\xc7\x53\x0c\x87\x03\x2c\x2d\x2d\
\x81\xf3\x12\x60\x16\x9b\x2c\x0b\x34\x93\xab\xbe\xb3\xcf\xe6\x90\
\xf2\x6d\x1b\x6e\xe3\x45\x13\x24\x52\x03\x27\xa4\xe2\x3a\x65\xc9\
\x5e\xe9\x72\xeb\x6c\x99\x2c\xce\xc8\x48\x18\xb2\xf0\x9c\x51\x51\
\x42\x33\x40\x22\x46\xb9\xcb\x54\x82\x65\x76\x4e\x92\x64\xe0\x64\
\x9b\xae\x91\x1a\xc0\x2e\x5c\xbc\x04\x21\x04\x18\x9c\x19\x56\x98\
\x9a\x29\x11\x62\x73\x51\xaf\x79\x16\x2c\xa0\x54\x3f\x6e\x5a\xee\
\x51\xcd\xaa\xf2\x28\xd3\x8f\x5b\x5f\x87\x50\x82\x6f\xf8\x86\x6f\
\xc1\xdd\x77\xdf\x83\xe3\xc7\xaf\xc3\xd2\xf2\x6a\xfe\x3c\x48\x89\
\xbd\xfd\x7d\x50\x4a\x31\x1d\x0e\xf1\x93\xdf\xf7\xb7\xf5\x6d\x30\
\xed\x30\x2e\x8b\x6c\x7a\x1e\x38\xa1\x1a\xa3\x08\x08\xd6\x2c\x3e\
\x79\x07\x2e\xe7\x11\x95\x86\x6b\x80\xcf\x41\x07\x6c\x0f\xc0\x4b\
\xdb\xd5\x02\xd3\xfc\x37\xce\x41\x23\xd6\xed\x61\x81\xb6\xd2\x79\
\x99\x39\x49\x05\x4e\x9b\x67\x5f\xc5\xd2\xea\x2a\xfa\xfd\x3e\xc2\
\x30\x40\x18\xf8\xe8\x06\x01\x1c\x4a\x41\x7c\xa8\x99\x19\x10\x50\
\x92\xd7\x5f\xbf\xee\x2f\x3c\x80\xff\xeb\xa6\xb7\x60\xe3\xdc\x59\
\x55\xbe\x93\x4e\x16\x89\x91\xb2\x1b\xca\x24\xa4\x74\x31\x1e\x8d\
\x40\x08\x41\xb7\xdb\xcb\xa2\xd6\x67\xf0\x49\xa2\x00\xa4\x12\x50\
\x2c\x0c\xb9\x57\x5a\x7a\xcf\x33\xe7\x87\xf2\xc6\x40\x60\xd9\x6c\
\x0d\x56\x23\x8d\xbf\x60\x86\x07\x36\xa1\x45\x55\x5b\xb4\x15\x97\
\x88\xfd\xf5\x40\x81\x32\xe5\x8f\x97\xe4\x65\x56\xb3\xd2\x47\x19\
\x83\xe3\xba\xca\x1d\xdb\x48\xf7\x25\x44\x3d\xfe\xc4\x48\xf7\xad\
\xd0\x15\x20\x55\xe4\x0b\xa1\xc0\xe9\xe9\xa7\x9f\x29\x81\x76\xa9\
\x8c\x57\xe8\x2f\x59\xfa\x68\x35\x67\xff\x05\xad\x59\xc9\x39\x5c\
\x92\xf9\x09\xae\x06\x8f\xc8\x4c\x81\x89\xe1\x4a\xe1\x07\x21\xde\
\x76\xc7\xdd\xd6\xdf\x19\x0c\x86\x59\x69\x72\xb6\x74\x67\x3a\x77\
\xc8\xc2\x7b\xae\xfa\x75\x95\x56\x70\xa2\x94\xa2\xdf\xef\x17\x7d\
\xf2\x1a\x3b\xdd\xce\xaa\xf3\x28\xa1\x78\xe6\xe9\xa7\x31\x87\x29\
\x35\x71\x7c\x68\x15\x79\x57\x69\xb5\x3d\xa6\x6a\x96\x34\x0f\x9c\
\x2c\x5e\x59\xb2\xb2\xc6\x64\xdb\xaa\x29\xa5\x70\x08\x85\xe4\x09\
\x06\xbb\x3b\x38\xff\xca\x69\x6c\x5c\xb8\x80\xed\xed\x1d\xec\xed\
\x0f\x71\x79\x6f\x1f\x3b\xa3\x31\xc6\x31\xc7\x34\xed\x37\x19\x1f\
\x54\x4a\x80\xff\xfc\x6f\xdf\xa7\xca\x78\xda\x1d\x3b\x37\x7a\x35\
\xfa\x4d\xcc\x01\x21\x14\xe3\xd1\xd8\x68\x78\x13\xeb\x69\x77\x66\
\xea\x6a\x0e\xef\x1a\xa7\xba\x04\xaa\x29\x4e\x2c\xec\xca\x5a\xc6\
\x2b\x34\xda\x4c\xd7\x86\x72\xe3\x0d\xf3\x7d\xe2\xca\x0a\xf1\xc2\
\x60\x2d\x99\xad\x81\x35\xaa\x0d\xaa\xdf\x4f\x24\x41\x02\x9a\x67\
\x49\x65\xa5\x3c\x0a\xd7\x75\xe1\x30\x07\x9e\xe7\x29\xb6\x6a\x98\
\xd8\x2a\x77\x71\x59\x59\x17\xce\xd5\x78\xea\xb9\xe5\x42\xe0\xe9\
\x53\x4f\x16\x73\x8e\x6c\xef\x8f\x2a\x50\x22\x57\x72\xae\x85\x7a\
\x83\x57\xc3\xac\xb5\xd3\xe9\x60\x65\x69\xc9\x30\xc6\x85\xe1\x54\
\x21\xcb\x4f\x21\x84\x10\x78\xfe\xf9\x17\xea\x8d\x5a\x4b\x2f\x38\
\x31\xdd\x52\xaa\x5e\xf0\x72\x79\x54\x02\xae\xeb\xe2\xd0\xa1\x43\
\xa5\x37\xa0\x6c\xfc\x8c\xd8\xd6\x8e\x2a\xe5\xcd\x33\x6e\x15\xa8\
\xf7\xc9\x6b\x41\xa9\x05\xa6\xd7\x8c\x35\xd9\xf6\x97\x7a\xe6\xa4\
\xf4\xb4\x73\xcf\xec\xad\x62\x08\x02\x80\x2b\x21\xc4\xe5\xcd\x0d\
\x5c\x38\xf3\x2a\x2e\x5e\xbc\x88\xcb\x3b\x3b\xd8\xdd\x1f\xe2\xf2\
\xfe\x00\x7b\xe3\x09\xc6\x71\x82\x48\x27\xa6\x9a\x14\xed\xd8\x4a\
\x1f\xdf\xf5\x37\xbf\x17\x09\xe7\x60\x8e\xa7\x0c\x5e\x59\xee\x40\
\x9e\xba\x8f\x53\xc7\x85\x04\xb0\xb3\xb3\xad\xce\xa0\x67\x9c\x25\
\x64\x61\x27\xcd\x5d\xc7\x65\xe1\xcc\x3e\x9d\x5f\x4a\xa3\x0e\x6c\
\x1b\x7d\x11\x6d\xec\x92\x45\x33\xe1\xb6\xf8\x5f\x5a\xc2\x6a\x48\
\x9d\x66\xd8\x12\x59\x8c\x75\xe9\xfe\x5d\x02\x0a\x0e\x36\x13\xa9\
\x41\x09\xd1\x8c\xc9\x51\xa1\x8d\x52\xea\x59\x2e\x92\x19\x96\x12\
\xc3\x2b\x6f\xa6\xe1\x90\xb9\xb6\x2b\x56\x35\x8d\x13\x3c\xf3\xc4\
\x13\xd9\xf3\x38\x77\xfb\x2e\x60\x2c\x69\x4e\x2b\xe5\x41\xb6\x69\
\x99\x9d\x60\x78\x9e\xab\xe5\xff\xb9\x83\xbb\xd5\x2d\xde\x28\x0d\
\xe8\x72\xd8\xc2\xac\x37\x7b\xdd\xc9\x9c\xd7\x58\x5f\x87\x73\x5e\
\x09\x80\xb2\x5c\x02\x68\xf8\x2c\x6c\x5c\xb8\x00\x54\xcf\x30\xb5\
\x8a\xbc\x16\x98\xbe\x60\xe0\xd4\x64\x70\x4e\x56\x9c\x45\x89\x46\
\x9b\xa7\x85\x49\x65\x3f\xe6\x1c\x93\xe1\x00\x17\x5e\x7d\x05\x1b\
\xe7\xce\xe1\xd2\xc5\x2d\xec\xec\xed\x61\x7f\x30\xc2\xd6\xfe\x00\
\xdb\xc3\x31\xc6\x71\x92\xb1\x26\x13\x9c\x7e\xe2\xfb\xbe\x1b\x2b\
\xeb\x87\x40\x34\x3b\x62\x8e\x5b\x54\xea\x51\x96\xb1\xa9\x38\x4e\
\xb0\xb3\xbd\xad\x66\xab\xa8\xfd\x54\x35\xdb\x50\x4b\x62\x07\xa9\
\xc3\xf2\x84\x8e\x5b\x67\x94\x16\x80\x8b\x51\x5a\xdc\x4d\x67\x76\
\x0a\x69\x67\x49\x85\xa3\x1a\x58\xa4\xac\x7a\x52\x17\xd8\xb0\xab\
\x5e\x22\x3d\xa7\x84\x52\x6c\x07\xd1\xcf\x9b\xeb\x2a\x57\x0b\xcf\
\x73\xb3\x99\xb0\x74\x9e\x8b\xa0\xe4\x4f\x6d\xb9\xdf\xda\x28\x02\
\xe3\x28\xc2\xce\xd6\x96\x11\xd7\x51\x1c\x46\xce\xfb\x4b\xb8\xa2\
\xc7\x24\x6b\x77\x62\x39\x03\x44\x65\xe6\x4b\x8c\xc8\x8f\x0c\x34\
\xac\xa0\x94\xff\xce\xfe\x60\x50\x88\x21\x59\xf0\x15\x68\xf4\x60\
\xa4\x94\x58\x5a\x5e\xc6\x91\x23\x47\x8a\xae\xee\xb2\xe9\x93\x62\
\x67\x90\xcf\x3c\xf3\x0c\x1a\x02\x52\x1d\x5b\x3a\x08\x59\x6b\x57\
\x0b\x4c\x07\x2e\xf1\xcd\x05\xa9\xd9\x16\x76\x83\x92\x1e\xc9\xcf\
\xca\x19\x01\x44\x12\x63\x7f\xfb\x32\xce\xbf\xfa\x0a\x36\x37\x2e\
\x60\xeb\xf2\x36\xf6\x06\x43\x0c\x46\x63\xec\x0c\x47\x99\x84\x9c\
\x97\xc0\xc9\x63\x14\xbf\xf6\x6f\xfe\xb5\x6a\xa8\x7b\x69\x6e\x93\
\xc1\x9e\xd2\xd2\x9e\x06\xad\x38\x4e\xb0\xbd\xbd\x9d\x6f\x40\x33\
\x49\xa5\xf6\x0a\xa5\xd0\x83\xa5\x42\xef\xb2\x8a\x35\x91\x02\x30\
\xd9\x1d\xb2\x65\x9e\x13\xb4\xd0\x79\x25\xa9\x0e\x96\x6b\xbc\xd9\
\xd5\x1d\xc6\x07\xc1\x98\x57\x4a\x95\x7d\x84\x52\x38\x1a\xd8\x53\
\x55\x9e\xa7\xa3\x20\x28\x25\x19\x78\x93\x0a\x03\xef\xf4\x7f\x42\
\x7b\xcd\x01\xc0\xe6\xd6\x16\x26\xa3\xd1\xec\xfb\x61\xe6\x6e\x55\
\xcc\x63\x5d\x61\x41\x60\xee\x53\xaf\x4f\x46\x56\x57\x56\xe0\x6b\
\xf9\x3f\x48\x91\x01\xdb\xee\x46\x92\x24\xd8\xda\xba\x5c\xa6\xa2\
\x8b\xbf\x5e\x64\xfe\x23\xf2\x7c\x8b\x4f\xde\x15\x96\xf3\xf6\xf7\
\xf6\x9a\x98\xb6\x36\x75\x7e\x68\x41\xa9\x05\xa6\xab\x52\xc6\x5b\
\x94\x35\x59\x0e\x32\x73\x16\xdf\x08\x9c\x0a\xac\x49\x95\xf4\x2e\
\x9d\x3b\x8b\xf3\x67\xce\xe0\xe2\xe6\x26\xb6\x77\x77\xb1\x3f\x1c\
\x63\x38\x9e\x60\x77\x38\xc6\x30\x8a\x11\x71\x81\x44\x14\xfb\x4d\
\x6f\xbb\xf6\x30\xbe\xfd\xff\xfd\x5e\x70\xce\xe1\xf8\x01\x1c\xcf\
\xd3\xcc\x49\x1d\xd4\x71\x40\x34\x48\x31\xd7\x43\x9c\x24\x18\x0d\
\x47\xda\xcd\xc0\xd2\x6f\x2a\x6a\x9c\x8d\x33\x6b\x99\xcd\x34\x71\
\x51\x74\x32\x73\x28\xb5\xce\x08\x65\xe0\x84\x3c\xf1\xb6\xfe\x23\
\x4c\x2c\xcf\x1f\xb1\x27\xd5\xca\xf9\x1b\x50\x75\xbb\xc9\xec\x2f\
\xb1\x62\xef\x0d\x00\x63\x0c\x8e\xe3\xea\x39\xa6\xdc\x96\xc8\x61\
\x0c\x8e\x1e\x6e\xb6\xbd\xd2\xb2\x54\x19\x15\x46\x28\xe3\x53\x4f\
\x3f\x53\x60\x24\xf6\xf7\x43\x59\xd4\x71\x35\x40\x49\x36\xd6\x8d\
\x11\xe4\x8a\x3c\x58\x8a\x76\x36\x2c\x11\x42\x60\x34\x1c\xce\x9e\
\x98\x90\x2b\x0d\xf2\x98\x7d\xec\x71\x94\xfb\xe4\x5d\x8d\x72\x9e\
\x94\x12\xe7\xce\x9d\xb5\x29\xf2\xe6\x89\x1f\xd0\x02\x51\x0b\x4c\
\xaf\x37\x50\xd5\x79\x60\x15\xe5\xa3\x84\x14\xac\x52\x49\x6d\xe3\
\xbd\x7c\xa6\x4c\x8a\x2f\x06\xe7\x18\x0f\x07\xb8\xf0\xca\xcb\xb8\
\x70\xee\x1c\x2e\x5e\xbc\x84\x9d\xbd\x3d\x0c\xc7\x13\x0c\xc6\x13\
\xec\x8d\x26\x18\xc6\x09\xa6\x42\x20\x29\x89\x21\x7e\xfc\x6f\x7d\
\x17\x56\x0f\x1f\x55\xcc\xc8\xf5\xc0\x3c\x0f\xd4\x55\xcc\x89\x39\
\x1e\x98\xeb\x82\x32\x57\x7f\xef\x62\x3c\x1e\x63\x38\x18\xea\x12\
\x96\x29\x23\x98\x1d\x54\x95\x12\x05\xb5\x1f\xe7\x1c\x51\x9c\x94\
\x62\x95\x72\xf3\xd6\x62\x77\x89\xe4\xca\xb5\x14\xdc\x50\x5d\x86\
\x29\x55\x8d\x0a\xa0\x54\x76\x44\x28\xb3\x93\x83\x70\x2a\x4e\x18\
\x38\x61\x33\xec\x8c\x32\x06\xc7\x73\x55\x60\x1e\xa1\x70\x1d\x17\
\x52\x62\xc6\x26\x6a\x06\x70\xb3\x37\x47\xfa\xfa\xa8\xff\x12\x2e\
\xf0\xf0\xa7\x3e\xad\x85\x0f\x35\x03\xa5\xb3\x4f\x40\xb3\x92\x57\
\x53\x8a\x20\xe7\x91\x26\x09\x29\x64\x16\x04\x59\x07\x4a\xd9\x49\
\x09\x53\xd2\x77\x6b\xe0\x06\x59\x8c\x3d\x91\x39\x91\xef\xd7\x1c\
\x2f\xfa\xe4\x5d\x51\x39\x8f\x00\x09\xe7\x18\x0e\x87\x57\xea\xf6\
\xd0\x02\xd4\x55\x5c\xed\x1c\x93\xbd\x74\x87\xe6\x4c\xa9\xee\x0d\
\x69\xb1\xdd\xb1\x7a\x9a\x6a\x3f\x3d\x42\xc0\xa0\x4b\x7a\x97\x2f\
\xe3\xdc\xe9\x97\xd1\xe9\xf6\x10\x04\x01\x3c\xd7\xcb\xce\xd4\x19\
\xa3\x00\x02\x00\x0e\x88\xf6\x1f\xa3\x04\x08\x1d\x86\x0f\xbc\xff\
\x7d\xf8\xe6\x6f\xf9\x36\x38\x9e\x9f\xcd\x09\x11\x42\x20\x98\x03\
\x92\x30\x00\x51\xae\x28\x03\x30\x1c\x8d\x00\x00\x9d\x6e\x07\x82\
\x0b\xbb\xc7\x8d\xde\x01\x84\x48\xcb\x78\x32\x63\x02\x69\x9d\x5f\
\xce\xa0\x72\x69\xeb\x16\x52\xcf\xa7\x98\xe0\xa7\x65\xeb\x20\xe6\
\x8f\x00\x2b\x28\xd5\x9d\x5f\x97\x86\x47\xcb\xd6\x3b\x35\xbf\x3d\
\x15\x12\x71\x3a\x2c\x6b\xcc\x0e\x29\xa5\xa3\x03\xcf\xf3\xe1\xb8\
\x0e\x82\x30\x00\x90\x6e\xd6\x24\x0b\x08\x94\xda\x69\x5c\x50\x35\
\xc7\x24\x8c\xc0\xde\x4c\x62\xaf\xbf\x9f\xc4\x31\x9e\x79\xfc\xb3\
\xa0\x8c\x59\x76\xe0\x62\x7f\x29\x17\x04\x90\x2b\x7b\x43\xcb\xa6\
\x98\x50\x9a\x02\xd2\x3d\xc8\xb9\x4f\xbd\x7e\x1c\xa3\xd1\x10\x93\
\xc9\xa4\x70\x7f\x67\xdf\xea\x8d\x4c\x12\x4b\xbd\x44\x39\xf3\x89\
\xec\x74\x3a\x76\x9f\x3c\xcb\xe3\xa8\xbf\x54\x85\x60\x4e\x27\x13\
\x4c\xc6\xe3\x04\xf3\x87\x6b\x6d\x40\x75\x90\xca\x61\xbb\x5a\xc6\
\xd4\x08\x88\xe6\xe5\x30\xd9\x2e\xcb\xde\xa4\x52\x08\x7e\xe6\xf9\
\xcf\xcf\x16\x8e\xc8\x02\x25\x3d\xf3\x32\x9e\x20\x9a\x8c\xb0\x75\
\xfe\x2c\xce\xbe\xfc\x12\xce\x9f\x3b\x8f\xcb\x97\x2f\x67\xfd\xa6\
\xdd\xe1\x18\x7b\x93\x29\x46\x51\x82\xa9\xd1\x73\x92\x00\x6e\x3b\
\xbc\x82\xff\xf9\xef\xfd\x28\x78\x12\xc3\xf5\x03\xb8\xbe\x0f\x37\
\xec\xe8\xf2\x9e\x0f\xc7\xf3\x33\xc6\xc4\x5c\x0f\x94\x39\x18\x8e\
\x46\x18\x0e\x87\x85\xb2\x5e\xfa\x7f\x11\x4f\x73\x97\xe8\xcc\xb6\
\x48\xbf\x79\x74\xbc\xb8\x94\xd6\x1d\x25\x27\x00\x84\x66\x3e\x7e\
\xf9\x6d\x68\x9e\x91\xda\x21\x19\x1b\x90\xac\x02\x79\x1b\x8b\xa8\
\x62\x16\x0d\x07\x85\x13\x49\xc1\x41\xf3\xa8\x8e\xf4\x83\xa1\xc5\
\x10\x7e\xe0\xc3\x75\x15\x6b\x92\x12\xf0\x3c\x57\x29\xf5\x18\x83\
\xe3\xb0\x82\x50\x42\x16\x4a\x96\xb2\xb0\xa7\x12\x10\x9c\xd9\xd8\
\xc0\xa5\xcd\x8d\x22\xd8\xcc\xcc\x2f\x99\xac\x89\x94\xde\x51\xe4\
\x8a\xde\xe8\xf6\xcb\x66\x7f\x22\x84\xc0\xb1\xa3\x47\xf4\x60\x6c\
\x1d\x28\xe5\xf7\x6c\x34\x1e\x43\x70\x6e\x1d\x7d\x3e\x68\x4e\x56\
\xd5\x23\xc9\x7c\xf2\x9a\x94\xea\x6a\x04\x0f\x99\xd3\xbc\x0e\xe9\
\xc5\x95\xa9\xf1\x5a\x40\x6a\x19\xd3\x6b\x5a\xca\x5b\x64\x76\xa9\
\xd0\x18\x25\x04\x94\x27\x31\x92\x38\x02\x73\x5c\xe4\xd3\xb5\x36\
\xe6\x54\x0a\x12\x2c\x9d\x2d\x70\xce\x31\x19\x0e\xb1\x71\xe6\x15\
\x84\xdd\x1e\x3a\xdd\x0e\xfc\xc0\x87\xa3\x07\x3d\xd3\xcd\x8e\x51\
\x75\xe6\xee\x51\xe5\x65\x40\x09\xf0\xb7\xbe\xe1\x2f\xe1\xe3\x1f\
\xf9\x08\x9e\x3b\xf5\x04\xbc\xb0\x0b\x9e\x24\x88\xc9\xa4\xc0\x30\
\x12\xf3\x81\x4a\x60\x34\x1c\x03\xda\xb5\x59\x65\x3c\xe9\x4d\x36\
\x89\x0b\x6a\xf8\xd4\x1b\x2e\x9d\xcd\x49\x4b\x55\x56\x66\xa2\x19\
\x9b\xef\xfb\x86\x8b\x79\xea\x7d\x63\x78\xf8\x98\xdf\x96\x7f\x36\
\x73\xd6\x6b\x9f\xe8\x37\xe9\x52\x31\x9d\xb4\xce\xd1\x54\xf5\x91\
\x04\x73\x0a\x2e\x0b\x52\x4a\x30\xaa\xc4\x0e\xae\xe7\xa9\xf8\x75\
\xc6\xe0\x3a\x4e\xd6\x67\xa2\x54\xa9\x12\x19\x25\x45\x39\x75\x09\
\xa6\x48\x56\xd2\x93\xf8\xd3\xcf\x3c\xa4\x04\x2a\x4e\x5d\x51\xae\
\xa1\xc2\xb0\xae\x5c\x3c\x77\xd6\x89\x58\x18\x52\xce\xac\x84\x94\
\x58\x5b\x5d\xd1\x2e\xf1\xb2\xe2\x76\x8b\x7f\x64\x3a\x9d\x1a\x33\
\x72\xf6\xbb\x94\x1b\x7d\x90\x2b\xd8\xc7\x49\xee\x93\x67\x63\x44\
\x45\xca\x5c\xc7\x09\x33\xe6\x7b\xf1\xe2\x25\x60\xbe\x79\xeb\x22\
\x03\xb6\xed\x6a\x81\xe9\x75\x01\xa7\x2a\x89\xb8\xd1\x30\x25\x02\
\x84\xd0\x24\x8e\x41\x99\x03\x47\x9f\x61\x37\xa9\x60\x14\x53\x6e\
\x75\x49\x8f\x48\x88\x24\xc6\x68\x6f\x17\xe7\x4f\xbf\x84\xae\x8e\
\xc5\x70\x98\x93\x9d\xcd\x3b\x8c\x69\xcb\x22\x40\x38\x0c\x2e\xa5\
\x60\x14\xf0\x19\xc5\xbf\xfa\xbf\x7e\x1a\xdf\xf2\x5d\xdf\x8b\xc9\
\x68\x04\x92\xca\xb8\xd3\x33\x7a\x59\x7c\x98\x0e\x80\x24\x02\x46\
\xa3\x31\x84\x10\xe8\x76\x3b\xf9\x6c\x8e\x10\x48\x06\x3b\x70\x83\
\x6b\xb2\x9d\x4b\x70\x91\x31\x1e\x69\x75\x08\xb7\x0c\x9c\x66\xc2\
\x09\x02\x42\x6a\xc0\xc5\x24\x0d\x1a\xa4\xb2\xdf\x91\x45\x19\xba\
\x24\xb3\x29\x43\xd9\x63\x2c\x94\x07\xed\x4f\x7e\x2c\x09\xb8\x06\
\xa0\x62\xbd\x4b\x82\x32\x86\xa0\xd3\x85\xe3\xb8\x70\x5c\x17\x8e\
\x9e\x63\x62\x5a\xa9\xe7\x39\x0e\x1c\x4a\x41\x75\x82\xaf\x19\x6a\
\x47\x0a\x6f\x20\x45\x9b\xa6\x71\x8c\x3f\xf9\xc8\x47\x54\xb8\x62\
\x13\xd0\xb1\xa0\x10\x69\x3a\x88\x7c\xc5\x9f\x02\x89\x30\xf0\x6b\
\xfe\xc0\xec\x85\xd3\xe9\xa4\x58\x9e\xb4\x30\x95\x66\xe0\x54\x65\
\x99\x95\xff\xb8\xe8\x93\xd7\xb4\x4a\x69\x8f\x58\x37\x2e\x6a\xd2\
\x5f\x9a\xa7\xca\x43\xcb\x9e\x5a\x60\x7a\xbd\xca\x7b\xb6\xa9\xef\
\xd9\x83\x80\x13\x10\x87\x94\x63\xb8\x0d\x86\x44\xa4\x9d\x35\x59\
\xc1\x09\x04\x10\x1c\xd3\xd1\x10\xbb\x97\x2e\xe2\xcc\xcb\x2f\x21\
\xec\x74\xe0\x7a\x2e\x18\x53\x71\x13\x94\x10\x38\x94\x42\x02\xe0\
\x52\x22\x74\x1c\xb8\x50\x9e\x45\xeb\x81\x87\xff\xfb\xe7\x7e\x06\
\x3f\xf0\x3f\xff\x00\x1c\xd7\x2b\x6e\x16\x85\xae\x71\xbe\x4d\xf2\
\x84\x60\x34\x1e\x23\x8a\x22\xac\xd8\xce\x98\x65\xda\x35\x4b\x9d\
\xb2\x49\x4d\x83\xa0\xf8\x7b\x52\x68\xd6\xa5\x01\x46\x12\x39\xa3\
\x82\x4b\xf1\xc5\x9e\xaf\xa8\xc0\xa9\x00\x6c\xc6\xc9\x7f\x06\x52\
\xd9\xc9\x80\xcc\x4c\x5a\xad\xf6\x79\x52\x89\x1e\x04\x75\xc0\x4a\
\xa0\x44\x40\xe0\x05\x01\x3a\xdd\x6e\x56\xc6\x73\x5d\x27\xeb\xef\
\xd1\xd4\xb5\x9c\xcc\xf6\xf5\x65\xe9\xff\x29\xa3\xdc\xdc\xde\xc6\
\xe7\x9f\x78\x7c\xa6\xbf\x44\xe6\x51\x9d\x52\x99\x8f\x34\x66\x47\
\x4d\x62\x04\x61\x37\x7e\x5d\x0c\x35\x01\x00\x1b\x1b\x9b\x45\xf9\
\x76\x5a\xb6\x2b\x29\x13\x8a\x2e\x54\x76\x73\xc6\x82\xd9\x70\xe9\
\x3d\x48\x80\xa2\x4f\x5e\x63\x86\x64\xff\x21\x21\x14\x27\x4f\x9e\
\x00\x0e\x36\x5c\x5b\x75\x42\xdb\xae\x16\x98\xae\x3a\x18\xcd\x2b\
\xe5\x95\x98\x92\x71\x10\x14\xf2\x7a\x6c\x1f\xea\xaa\x92\x9e\xed\
\xa4\x51\xb9\x42\x70\x4c\xc7\x43\x6c\x9d\x3f\x8b\x6e\xaf\x07\x3f\
\xf0\x75\xa4\xb9\x6e\xc0\x53\x5d\x42\x0b\x03\x7d\xa7\x99\x2a\x06\
\x52\xe0\x5d\x37\x1e\xc5\xdf\xfc\x81\xff\x05\xff\xee\x5f\xfe\x0b\
\xb8\x99\x18\xa2\xd4\x4c\x26\x40\x42\xcc\x6d\x83\x20\x89\xa6\xd8\
\xdd\xd9\xc5\xf2\xca\xb2\x92\x49\x3b\x6e\x19\xcb\x34\x06\x89\x42\
\x8f\x29\xe6\x5c\xf5\x92\x08\xcd\x41\xd6\x28\x01\x2a\x40\x20\x05\
\x10\x91\x04\x25\x36\x64\x77\xdb\x4c\xad\x5e\x53\x70\x82\xbe\x0d\
\x99\x1a\x8c\x6a\x70\xca\x80\xd6\xd8\xb0\xca\xbd\x74\x42\x80\x04\
\x04\x82\x3a\xda\x64\x94\x14\xbd\x6c\x09\x81\xeb\x79\x70\x3d\x17\
\x41\x18\xc2\xf5\xd4\xe3\xf7\x7d\x2f\x63\xab\xb2\x60\xe4\x6a\x93\
\xb7\x23\x93\xd5\x0b\x29\xf1\xd0\x23\x8f\x82\x27\x1c\x8e\x47\x8b\
\xaf\x3d\x4a\xfd\xa3\x06\x14\x88\x94\xe7\xb1\xc8\xe2\x6f\x76\x52\
\x4b\x98\x24\x8e\x1d\x39\x3c\x63\xaf\x5b\xb7\x26\x93\x49\xae\xca\
\x2c\x18\x17\x1b\xff\x90\x28\x95\x38\xab\x19\x96\x29\x42\xc9\x4e\
\x3e\x00\x50\xca\xd4\x0c\x53\x56\x40\xbe\x92\x72\x9e\xfa\xf7\xde\
\xee\x1e\xb0\xb8\x79\x2b\xda\x32\x5e\x0b\x4c\xaf\x47\xf9\xce\x06\
\x54\xa2\x21\x28\x25\x04\xe0\x4a\x6e\x5c\xf3\xb1\x6f\xdc\x6f\x52\
\xb7\x43\x41\xe1\x32\x02\xce\x13\x8c\x07\xfb\xb8\xf0\xea\x69\xf8\
\x41\xa8\x9c\x1c\x68\xee\x7a\x2d\xa5\x36\x79\x25\x29\x93\x71\x00\
\x50\x30\x42\xf0\xde\xaf\xfb\x0a\x3c\xfd\xf4\x33\x38\xf1\x89\x8f\
\xc2\xf5\x7d\xcc\x06\xf8\x65\x89\x3b\xd9\x26\xee\x80\x20\x8e\x15\
\x38\xf5\x7a\x3d\xb8\xd9\xc9\xad\x56\xd7\xe9\xdf\xe7\x5c\x66\xc6\
\xa4\x52\x02\x71\xc2\x67\x9f\x51\x42\x20\x04\x87\xe0\x1c\x40\xd1\
\x77\x4d\xa6\x1b\x59\x66\x30\x9a\x66\x3f\x99\x66\x9f\xc4\x9a\xc6\
\x9a\x27\x02\x1b\x17\xcb\xa2\xd2\x2f\x35\x69\x2d\x0f\xad\x46\x89\
\x40\x44\x5c\x50\x57\xb3\x25\x3d\x7b\x93\x9e\xf1\xbb\x9e\x0b\x3f\
\x08\xe0\x07\x01\x1c\xd7\x81\xeb\x38\x00\x24\x3c\xcd\x9a\x3c\xd7\
\xc9\x43\x12\x0d\xf6\x54\x2c\x5d\x42\x8b\x52\x24\x26\x51\x8c\x3f\
\xf8\xdd\xdf\xb5\x88\x4b\x90\x51\x2e\x62\x1b\xae\xad\x29\xa3\xcd\
\x65\x5a\x57\x88\x4e\x1d\x7d\xa2\xd3\x74\x3d\xf7\xfc\x0b\x05\xa6\
\x94\x2b\x13\xab\x58\x94\x2c\x9a\x83\xd4\x30\xa8\x4c\xc3\x29\x05\
\x1c\xcf\xc1\xa1\x43\x87\x66\x6d\xf2\xe6\x01\x91\xed\x3a\xfa\x36\
\x9e\x7b\xf6\x59\xcc\x01\xa4\xba\xef\x5b\x67\xf1\x16\x98\x5e\x57\
\xd6\xd4\x94\x29\x25\x39\x38\x19\x9b\xcc\xec\xb9\x63\x91\x0d\x95\
\xdf\xbd\x36\x70\x82\x21\x21\x8f\x95\x2b\xc4\xb9\x97\x5f\x54\x9b\
\xa5\xab\x07\x3f\xf5\xe6\xe8\x3a\x0c\x00\x81\xe7\x30\xfd\x60\xd4\
\xa6\xeb\x52\x8a\x7f\xf8\xc3\xff\x1f\xfc\xd0\xa5\x4b\x78\xe9\x99\
\xa7\x94\x8c\xdc\xfc\x9b\x34\x0f\xa9\x33\x6d\x68\x40\x80\x24\x8a\
\xb0\xbd\xb3\x03\x67\xe5\x30\xbc\x34\x2c\x50\xe6\xc6\xae\xa2\xf4\
\xd8\x12\xce\x8d\x0d\xc0\xec\x3f\x4c\xe1\xb9\x9e\x2a\x63\x49\x0d\
\x48\xba\x94\x27\x33\xe7\x6a\x32\x53\xe2\x53\x65\x3b\x73\x43\x21\
\x95\xbb\x6a\xb9\x7f\x91\x72\x20\x49\x4a\x99\x4b\x00\x38\x28\x04\
\x53\x20\x33\x43\x6f\x09\xe0\x7a\x1e\x3c\xcf\x53\xac\xc9\x75\x11\
\x04\x3e\x3c\xcf\x03\xd5\x36\x4c\x6e\x2a\xdb\xd7\xe2\x07\x6a\x76\
\xba\xa4\xc1\x96\x74\x24\xf9\xf9\x4b\x5b\x78\xee\xd4\xa9\x39\x65\
\xbc\xb2\x4c\xdc\xc6\xc1\xc8\x02\xc5\xb5\x66\x80\x64\x0a\x4a\xf2\
\x13\x02\x82\x30\x58\x0c\x98\x2e\x5d\xba\x54\x52\x1b\x22\x63\xc8\
\x4d\x00\x4a\xd6\x55\x10\x8c\x12\x9f\xa8\xf1\xc9\x3b\x28\x6b\x7a\
\xf9\xe5\x97\x64\xc3\x32\xde\xbc\x21\xdb\x16\x90\x5a\x60\x7a\xdd\
\x00\xca\x06\x4a\x65\x70\x8a\x01\xc4\x33\x72\x58\x7d\x16\x3f\x0b\
\x4e\x15\x8a\xbc\x32\x68\x91\xbc\xb4\x24\x39\xc7\x64\x30\xc0\x36\
\xd9\x80\xe3\xba\x70\x3d\x2f\x4b\x56\x4d\xd9\x53\xcc\x05\x3a\x81\
\x0f\x42\x08\xb8\x94\xf0\x18\x83\x60\x12\x7d\xcf\xc5\x3f\xfe\xf1\
\x1f\xc1\xf7\xfd\xf0\xff\x86\xe1\xde\x2e\x1c\xdf\xd7\x82\x88\xd4\
\x86\xa7\xe8\xd8\x90\xc4\xf9\x1d\xe2\x71\xa4\xb6\x0e\x82\xa2\xd4\
\x5b\xa2\xe8\x55\x66\xdb\x22\x75\xaf\x4c\x68\x8f\x3d\x32\xc3\x92\
\x64\x06\x8a\xd2\x88\x2e\x07\x91\x19\x60\x99\x00\x45\xea\xb1\xc9\
\x02\x52\xf9\xf3\x9c\xb2\xac\x58\x52\x48\xd7\x87\xeb\xfa\x19\xa8\
\x67\xb2\x61\x28\x95\x9e\x17\x04\x08\xc2\x10\xbe\xef\xc3\xf7\x15\
\x48\x79\xae\x03\xca\xb4\xe8\xc4\x71\xe0\x39\x4a\x78\xc2\x74\x0c\
\x86\xa9\x75\x03\x34\x5b\x12\x6a\xc6\xe9\xc3\x7f\xf4\x47\xe0\x49\
\x02\x47\xe7\x66\xe5\xe1\x7f\x64\x96\xb9\x5a\x3c\xe9\x0e\x26\x15\
\x6f\x20\x30\x81\x5d\x10\x90\xa6\xd5\x36\xff\x53\x12\x93\xe9\x34\
\x83\xd5\x42\x82\xee\x0c\x40\x19\x84\xa2\xc4\x6c\xad\xd1\x30\x7a\
\x56\x2c\x05\x7b\xd3\x27\xaf\x49\x59\x72\x1e\x58\x49\x29\x71\xe1\
\xfc\x79\x51\xd3\x63\x6a\x32\x68\xdb\xb2\xa5\x16\x98\x5e\xd3\x72\
\xde\xbc\x99\xa5\x19\x96\xa4\x41\x29\x21\x84\x24\x64\x26\xee\x7b\
\x51\x70\x9a\xe1\x4b\x59\x5a\x1a\x25\x44\x67\x37\x0d\xb1\x75\xe1\
\x3c\x5c\xcf\x87\x9b\x46\x5d\x68\xfb\x18\xae\x05\x06\x8c\x52\x44\
\x89\x83\xd0\xf3\x20\x3d\x07\x12\xc0\xb1\xa5\x2e\x7e\xee\x67\xfe\
\x09\xfe\xee\x8f\xfe\x14\x06\xbb\x3b\x1a\x04\x28\x08\x65\x3a\x63\
\x88\x64\x07\x08\x05\xc7\x34\xab\x93\x91\x34\xa9\x55\x88\xac\x67\
\x22\xf5\xc6\x2b\xa5\xe1\x18\x51\x2a\x45\x15\xfb\x51\xaa\xac\x45\
\x64\x0e\x3a\xaa\x2f\x64\xfe\xdd\x14\x84\x72\xa6\x24\x4b\xe1\x7d\
\xe9\xcf\xb3\x0d\xa6\x24\x2b\x37\x41\x3d\x63\x2f\xfa\x35\x88\x84\
\x44\x4c\x99\x72\xbf\x20\xd4\x32\x83\xa4\xdc\x1e\x54\x5f\xc9\x87\
\xe7\xab\x19\x26\x47\x1b\xe2\xaa\xde\x1e\x32\xe5\x64\xea\x74\x20\
\x8d\x32\xa0\x24\x2a\x77\x29\xe1\x1c\x42\x0a\xec\x8d\x46\xf8\xd0\
\xef\xfe\x2e\x18\x63\x76\xe5\x21\x29\xab\xed\x88\x95\x4b\x91\x6a\
\x9b\x3f\x94\x9e\xfc\x06\x5b\x74\xf5\x76\xae\x9c\x2d\x28\x82\xc0\
\x6f\xfc\xe1\x11\x42\xe0\xd9\xe7\x9e\x47\xd9\xbf\x55\x9a\x29\x8c\
\x86\xe8\x24\xef\xfb\xc9\x9a\x12\xf7\xac\x6a\x4f\xcd\x91\xf9\xe8\
\xf7\x7b\x99\xca\x13\x85\xec\xa9\xc6\xc1\x4c\x05\x60\x92\x42\x34\
\xf1\xc9\x6b\x62\x57\xd6\xae\x16\x98\xae\x7a\x7f\xc9\xf6\x46\x13\
\x35\x65\xbc\xc4\x38\x62\x80\xc4\x33\xa5\x0c\x69\x82\x93\x2d\xfe\
\xc1\x02\x4e\x33\x4a\x3d\xa2\xcf\x62\x95\x81\x68\xcc\x13\x4c\x86\
\x03\x6c\x9e\x79\x05\x8e\xeb\x82\x3a\xca\xfd\x9a\x50\x06\x29\xa1\
\xca\x53\x00\x62\xcf\x05\xd7\x03\xad\x5c\x4a\x04\x0e\xc3\xcd\x87\
\x56\xf0\x93\x3f\xf9\x63\xf8\x89\x1f\xfd\x09\x50\x47\xb3\x24\x42\
\x15\x6b\xca\x98\x13\xcd\xcc\x4c\x49\x92\xa8\xfb\xa1\xad\x69\x14\
\xf3\x51\x83\xb2\x22\x8b\xc4\x90\x46\xab\xc4\xd4\x72\x17\x3e\xf8\
\x98\x4e\x26\xe8\x74\xbb\xc6\x50\xa3\x66\x49\x26\x50\xa5\x20\x24\
\x8d\x12\x5f\x09\xa0\xca\x2c\x4a\x92\x34\x04\x8f\xcc\xd9\x9b\x25\
\x38\x18\xa4\xe3\x65\xde\x77\x65\x0b\x74\xc7\x71\xd0\xe9\x76\x11\
\x76\x3a\xf0\x7c\x0f\xbe\xaf\x4b\x78\xa9\x79\xab\xfe\xfb\x89\xe0\
\x2a\x87\x49\x08\x48\xc3\x5e\x48\x00\x80\x90\x88\x85\x00\x97\x2a\
\x9a\xfe\x89\x67\x3e\x8f\xcd\x73\xe7\xe0\x7a\x5e\x61\x56\xaa\xae\
\x8c\x37\xf3\x1e\x69\xae\x8b\xb8\x2a\x8b\x10\x02\x2f\x55\x72\x36\
\xfc\x10\x8d\xc7\x93\x19\xd6\x4c\x88\x6c\x00\x50\x15\xe0\x64\x91\
\x66\x12\x02\xc4\x71\x04\x29\x64\x49\x92\x7f\x30\x11\x04\xa5\x04\
\x93\xe9\x14\xdb\xdb\xdb\xc9\x82\xa0\x84\x96\x2d\xb5\xc0\xf4\x85\
\xee\x33\xd5\x81\x52\x0c\x20\x4a\x0f\x2b\x63\xaa\x39\x03\xac\x06\
\xa7\x99\x93\xc9\x5c\x2d\xc6\x1c\x24\x82\x63\x3c\xd8\xc7\xc6\xab\
\xa7\xe1\x7a\x2e\x1c\xc7\xcd\x82\xe7\x1c\x57\x31\x24\xae\xcb\x48\
\x09\xe7\xe0\xd2\x07\xa4\x07\x87\x49\xdc\x75\xc3\x31\x7c\xff\x8f\
\xfc\xaf\xf8\x57\x3f\xff\xf3\x60\x8e\xab\x59\x93\xb1\xe9\xeb\xe1\
\x51\x42\x29\x68\x1c\x67\xa0\x08\x28\xc9\xb7\x10\xbc\xd0\x67\x32\
\xfb\x07\xa9\x5d\x51\x59\x61\x95\xb9\xe3\xcd\x26\x0b\x1a\xaa\xac\
\x12\x40\x15\xc0\x29\x67\x0c\x69\xf9\x4f\x95\xe0\x88\x9e\x75\x32\
\xba\x25\x69\x5f\x4a\xa2\x28\x0d\xa7\x0c\xc4\x0b\x14\x40\x98\x73\
\x4b\xc6\x5d\x72\x5c\x27\x13\x3d\xa4\xa0\xa4\x18\x93\xb6\x81\x22\
\x8a\xb9\x42\x97\x31\x53\x71\x83\xd4\x19\x59\xc8\xcc\x6d\xd5\xf3\
\x33\x8e\x22\xfc\xf6\x7f\xfc\x8d\x52\x28\xe0\xac\xd9\x6f\x59\x0f\
\x9e\xa5\x00\x13\xf2\xfa\xbd\xeb\x0d\x66\x1b\x86\x01\x3a\x9d\x70\
\x21\x20\xfb\xba\xaf\xfb\x3a\x3c\xf1\xc4\x93\x98\x4e\xc6\x79\x22\
\xaf\x2c\xa5\xd6\x4a\xa3\xcc\x97\xc5\xa7\x1b\xec\x69\x66\xbe\xa9\
\x58\xdb\x96\x12\x38\x76\xcd\x71\x78\xbe\x97\xbf\x97\x48\x33\xd6\
\x64\x05\xab\x7c\x8c\x41\x34\x3c\x5a\xd7\x87\x16\x98\xbe\xa0\x60\
\xd4\x44\xf0\x10\x1b\x47\x0e\x4c\xb2\xda\xb2\xd9\x5a\xd2\xb3\x82\
\x56\x99\x62\xe5\xdf\x13\x3d\xbb\xc4\x45\x82\xe1\xde\x0e\xce\x9f\
\x7e\x59\xb9\x4c\xe8\x9d\x9b\x31\x06\x21\x84\x02\x24\xe1\x67\xf1\
\xe7\x42\x4a\xf8\x8e\x03\x97\x31\xfc\x95\xfb\xee\x06\xff\xe1\xbf\
\x83\x5f\xf9\x17\xff\x02\xcc\x75\x33\xb6\xa4\x98\x13\x43\xc2\x1c\
\x10\xc6\x40\xa8\xba\xad\xd4\x9a\x26\x55\xe5\x09\x99\x1f\xe6\xc3\
\xdd\xd8\x52\x51\x1a\x92\x54\x65\x8c\xcb\x8a\xfc\xba\x0a\x80\x32\
\x36\xed\x14\x84\x52\x61\x46\xa1\x3f\x65\x02\x54\x49\x28\x41\x20\
\x95\x49\xab\x13\x80\xb8\xbe\x1e\xa6\xa5\x85\x13\x5c\x15\x41\x4f\
\xe1\x07\x41\xe6\x4d\x18\x04\x01\x3c\xcf\x55\x87\x06\x27\x87\xb1\
\xcc\x53\x4f\x01\xbf\x02\x21\x82\xd4\x9e\x49\xa7\xd9\xea\x27\xe5\
\x85\x57\x5e\xc5\xa3\x9f\xfe\x54\x2e\x7a\x28\x60\x11\x99\x2d\xe3\
\x11\x93\x3b\xcd\x61\x48\x57\x5f\x88\x97\x3d\x17\xbe\xaf\xca\xc4\
\x4d\x77\xdb\x24\x49\xb0\xbe\x7e\x08\xdf\xff\x03\x3f\x88\x57\x5e\
\x79\x05\xff\xfd\x8f\x3e\x8c\xfd\xbd\xdd\xac\x44\x2c\x65\x3e\xa0\
\x96\xc1\x90\x34\xe2\xd3\x75\x0d\x54\x6a\x10\x9a\xa9\x2e\x18\xe2\
\x95\x4e\xa7\x03\x4a\x68\x36\x7e\x80\x03\xb3\x26\x95\x29\xb6\xb1\
\xb9\x89\x39\xfd\xa5\x79\x03\xb6\x2d\x5b\x6a\x81\xe9\x75\x07\xab\
\x32\x30\x95\xca\x77\x19\x28\x4d\x09\x21\x11\xc1\x9c\x33\xdd\xca\
\x7e\x13\x2c\x4a\x3d\x03\x8c\x4a\xfd\x26\xa5\xd4\xa3\x48\x52\xa5\
\xde\xe9\x97\x0a\xe0\xc2\x39\x57\x3d\x0e\x6d\xba\xaa\x8c\x46\x05\
\x02\xd7\x45\xe8\xb9\x08\x3d\x07\x5f\xf3\xc0\x3b\x30\x1c\x7f\x2f\
\x7e\xfd\x57\x7f\x35\x07\x27\x0d\x4c\x29\x28\x11\xea\x68\xb9\xb7\
\x98\xd1\x43\xa7\xc2\x07\x61\x80\x0d\x17\x7c\x26\x2a\xc3\xfc\xa5\
\xf4\x77\x08\x66\xc5\x02\x96\x53\xf7\xbc\xdc\x67\xf6\xa0\x0c\x80\
\x92\xd9\x80\xab\x2c\xfc\x4c\x2a\xe2\x87\x28\xe1\x10\xd4\x81\xd3\
\x09\x41\xbc\x40\xab\x18\xa9\x55\x95\xcc\x18\x53\x2a\x3c\xdf\x83\
\xe7\xfb\x08\xc2\x20\x63\x4c\xae\xa3\xa2\xd5\x59\x6a\x43\xa4\x05\
\x0f\x66\xd0\x78\x6e\xd5\xa4\x80\x69\x1a\xc7\xf8\xcf\xbf\xf9\x9b\
\x90\x42\x80\x18\xea\xbf\x2a\x2e\x4d\x1a\x66\xc1\x93\xd7\xb8\xa0\
\x27\xe5\x62\xfb\x6b\x2a\xb3\x1f\x8d\xc7\x58\x5f\x5f\xc7\x91\x23\
\x87\x71\xc3\x0d\x37\xe0\x33\x9f\xf9\x0c\x1e\x7b\xf4\x11\x4c\xc6\
\xe3\x7c\xac\x21\xd5\xf5\x1b\x2c\xaa\x00\x50\xd9\x67\x43\x97\xf4\
\x2c\x26\x10\xfd\x7e\x7f\x66\x82\xe0\x60\xac\xc9\xfc\x66\x6e\xdc\
\xc5\x3c\x40\x6a\x01\xaa\x05\xa6\xd7\x8d\x39\x99\x6f\x50\x3e\xa7\
\x8c\x37\x05\xc1\x34\x9d\x87\x21\x05\x75\x92\x6c\x08\x4e\x8b\x89\
\x21\x54\x7a\x2a\x01\x8f\x26\xd8\xdb\xba\x68\x88\x19\x28\x12\xce\
\x91\xe8\x40\xbf\x84\x8b\x2c\xdc\xcf\x64\x4f\x2e\x63\xf8\xab\xef\
\xfe\x73\xb8\x78\xf1\x9b\xf1\x47\xff\xf5\xf7\xe1\x38\x4e\x56\x47\
\x2a\x32\x28\x32\x53\xb6\x49\x85\x0c\xb9\x10\x42\xfd\x6c\x1a\xc5\
\xf6\x06\x7e\xe6\x40\x2e\xb3\x99\x23\x13\x99\x52\xa2\x49\x2c\x9f\
\x70\x22\x2d\x3d\xa6\x14\x84\x60\xf6\xa3\x14\x40\x49\x5d\x06\x8c\
\x41\x10\x81\x81\x7a\xa1\x3a\xb4\x82\xb1\xdc\x57\x92\x69\xff\xce\
\xf7\xe1\x07\xa9\x12\x4f\x1d\x81\xef\x69\xb6\x94\x7b\xe2\x29\x4b\
\x22\xa6\x24\xe3\x94\x16\x9e\x0f\x09\x99\x39\x5c\x3c\xfd\xe2\x8b\
\xf8\xd8\x07\x3f\x08\xe6\x38\x39\x20\x55\xba\x3d\x90\x62\x98\xed\
\x0c\x31\xb2\x95\xff\x6c\xe7\x3f\x57\x0e\x5a\x84\x10\x15\xf3\x41\
\x9b\xfb\x3b\x53\xaa\x98\x7a\x1c\x27\x10\x42\xe2\xc8\xe1\xc3\xf8\
\xc6\x6f\xfc\x46\xdc\xf1\xf6\xb7\xe3\x73\x4f\x3d\x85\xc7\x1f\x7b\
\x14\xe3\xc9\x18\x8c\x32\x03\x3f\xd4\x1b\xa1\x00\x50\x59\xbf\x50\
\x16\x4b\x7a\x46\x25\x62\x75\x6d\xad\x12\x9c\x17\x65\x4d\x84\x50\
\x9c\x3c\x71\x12\xb8\x32\xe3\xd6\xd6\x8a\xa8\x05\xa6\xd7\x14\x94\
\x80\x66\x6a\xbc\x19\xb6\xa4\x19\xd3\x34\xf3\x97\x93\x02\x3c\x89\
\x32\x06\x62\xcb\x80\x39\xa8\x18\x02\x48\x3f\xb8\x50\x19\x41\xbe\
\x87\xf1\x64\x8c\xdd\xad\x4b\x19\xeb\x49\x92\x04\x3c\xe1\xca\xe7\
\x2e\xe1\x4a\xb0\x80\xbc\x1f\x12\xc5\x0e\x18\xa3\x08\x5c\x07\xdf\
\xfa\xb5\x5f\x89\x28\x8a\xf0\xd1\x3f\xfc\x03\x38\x8e\x51\xd6\xd3\
\x8a\x3d\xd7\x0f\xd4\xc6\x9b\x44\x85\xb3\x6a\x21\x8a\xfd\x14\x21\
\x81\x9d\xdd\xbd\x3c\xd3\xc8\xec\x77\x93\xdc\x8d\x41\x42\xe6\x83\
\xb0\x15\x9d\x37\x82\xdc\x88\x55\x96\x94\x57\xa9\x53\x44\x59\x66\
\x9e\x0f\xe9\x02\x82\x32\x24\x8e\x0f\x37\xe8\xc2\x0b\x02\xcd\xfe\
\x0c\xc9\x98\xf1\x6a\x13\xa8\x81\xda\xb0\xd3\x85\x1f\x06\x4a\x89\
\x67\xce\x31\x39\x2c\x33\x74\x4d\xa5\xe5\x99\x2b\x81\x7e\x4e\x91\
\xce\x2c\xe9\xd7\x79\x1a\x45\xf8\xfd\xdf\xfe\x2f\x10\x42\x58\xca\
\x78\x85\x69\x25\x8b\xfd\x76\x0e\xbe\xf6\xe1\xdb\x1a\x10\x22\xf5\
\x3f\x6f\x02\x5b\x42\x08\xac\xaf\xad\xea\x13\x95\x46\x48\x06\xce\
\xb9\x06\x28\x9a\x7f\x98\xa4\xc4\x5b\x6f\xbf\x1d\xb7\xdf\x76\x1b\
\xee\xba\xeb\x2e\x9c\x3c\x79\x12\x9f\x7b\xea\x14\xe2\x28\x52\x27\
\x09\x59\x9b\x27\x05\xa8\x1c\x9c\x50\x00\x29\xe4\x02\x19\x10\xf8\
\x99\x5a\xb0\x6c\xd6\x6b\x3d\xa3\xa9\x65\x4d\x04\xc0\x70\x38\x68\
\xd2\x63\x6a\xea\x93\xd7\xae\x16\x98\xae\x2a\x20\xd9\xc0\x69\x5e\
\x6f\x29\x32\x80\x69\x02\x60\x92\x4b\x9e\x05\x64\xc2\x01\xca\x00\
\x2a\x80\x0c\xa0\x64\xe1\x03\x4d\x6c\x3d\x97\x39\x62\x88\xb4\xa0\
\x93\x82\x53\x18\x86\x90\x90\x18\x0e\xf7\xb0\x4b\x95\xca\x2e\x8e\
\x63\x70\x6d\x0f\xa4\x4a\x7a\x2a\x8e\x40\x48\x89\x98\x73\xb8\x8c\
\xc1\xf7\x5c\x24\x9c\xa3\xeb\xfb\xf8\xeb\x5f\xff\xd5\x58\x5a\x5e\
\xc2\x27\xfe\xf8\x23\xd8\xdf\xde\x56\xf3\x36\x84\xe8\xd4\x56\x06\
\x29\x05\xc6\xfb\x51\x21\x83\x29\x8b\x4b\x37\xee\x5a\x36\xcb\x42\
\x68\x19\x99\x32\x65\x5f\x56\x2e\x22\x28\x9c\x1d\x57\x75\xdf\xec\
\xdb\x4a\x3a\x0c\x9a\x03\x14\xa0\xbc\xef\xc0\x5c\x50\x2f\x80\x1b\
\x74\xe1\x7a\xde\x0c\x53\x92\x25\xb6\xc4\x18\x83\x1f\x76\x10\x76\
\xd4\xe1\xfb\x41\x36\xbc\xcc\x28\xd5\x72\x7c\x25\x7e\x70\x1d\xa6\
\xcb\xa2\x1c\x49\xc2\xc1\x08\x51\x0c\x29\x3b\xd1\x50\x20\xf5\xd4\
\x73\xcf\xe1\xa3\x7f\xf0\x07\x33\x9b\x7b\x39\x2d\x22\x17\xdc\x11\
\x34\xf2\x72\x98\x71\x20\x22\xaf\x89\x54\x2f\x8e\x63\x25\xf2\x68\
\xb8\x26\x93\x29\xa6\xd3\x08\xcc\x61\xc5\xd2\x9b\x7e\x83\xdc\x7e\
\xfb\xed\xb8\xe5\x96\x5b\xf0\xc4\x13\x6f\xc7\x67\x3e\xf3\xa7\x78\
\xf9\xa5\x17\xd5\xed\x13\x82\x19\xdb\x43\xfd\xba\x4a\x39\x5b\x3b\
\x00\x01\x0e\x1f\x3a\x3c\xfb\x4e\x39\xa8\xf3\x03\x80\xfd\xbd\x7d\
\xe0\x60\x83\xb5\x55\xa0\xd4\x82\x54\x0b\x4c\xaf\x09\x38\xd9\x0c\
\x5b\xab\x4b\x78\x1a\x98\x08\xa1\xd3\xc2\x5c\x0c\x21\x80\x14\x6a\
\x52\x5d\x18\x00\x45\x18\x8a\x29\x3d\xf5\xe0\x84\x52\x09\xaf\xdc\
\x17\x09\xb4\xd9\xa8\xd8\xb8\x80\xf1\xfe\x1e\x08\xa1\x10\x82\x83\
\x27\x09\x78\x92\x28\xf6\xc4\x39\xa4\x54\x0a\xbd\x4e\x18\x64\xa0\
\x14\xb9\x0e\x62\xce\xe1\x3b\x2e\xbe\xfe\x2b\xde\x8d\x3b\x6e\x7b\
\x0b\x7e\xf5\x57\xff\x1d\x76\x2e\x5d\x82\xe3\x7a\x10\x8c\x81\x32\
\x06\xc1\x93\xec\xde\x66\x91\x18\xb2\xdc\x22\x93\xd8\xdb\xdf\x9f\
\xa9\x47\xa5\x9b\x53\x1c\xab\xfb\xe3\x38\x0e\x3c\xcf\x2b\x3d\xfb\
\x69\x3f\x81\x64\x6c\x69\x36\x43\xa7\x28\x90\x48\xa7\x5a\x25\x01\
\xa4\x06\x24\xe2\x06\xa0\x7e\x08\x37\x08\xe0\xb8\xae\xea\x95\x19\
\x03\xb0\x45\xe6\xaa\xe2\xcd\x3d\xcf\x53\xc3\xb4\x61\x88\x30\x0c\
\xb5\xcb\x83\x9b\xcd\x86\x51\x5d\x32\x65\xda\xcd\xdd\x61\x14\x42\
\x48\x44\x5a\x4a\xef\xe8\xd8\x11\xaa\xa5\x80\xfb\xa3\x11\x7e\xe3\
\xdf\x7f\x40\x45\x85\x64\xa9\xb8\xa4\xb6\x8c\xd7\xb4\xbb\x64\x43\
\xad\xcc\x6d\xa4\xf4\xa3\x2b\xc1\x2b\x21\xe4\xc2\x8a\x40\x9a\x0a\
\x43\xca\xc6\xe0\xfa\x44\x86\x52\x8a\x77\xbd\xeb\x4b\xf0\xf6\x3b\
\xdf\x8e\xc7\x1f\x7f\x1c\x7f\xfc\xdf\xff\x08\xbb\x3b\x3b\xb9\xeb\
\x48\xca\xa6\xb5\xc5\x56\xb9\xc7\x24\xa5\x04\x25\x54\xf5\x98\x8c\
\x11\xa6\xca\xf2\x5d\xc3\xf5\xb9\xa7\x9e\x02\xe6\x07\x04\xb6\x65\
\xbc\x16\x98\xde\x50\x3d\xa6\x9a\xb9\xa5\x02\x5b\xf2\xa4\x14\xc3\
\xac\x94\x87\xd2\x59\x6d\x06\x50\x54\x01\x94\x2e\x93\xa1\x8e\x2d\
\xd8\xe6\x99\x0c\x70\x92\x42\x22\xe8\x04\xf0\x3c\x1f\x52\x0a\x1c\
\x39\x7a\x0c\x1b\x17\x2e\x60\xb4\xbf\x0b\x40\xaa\x0c\xa6\x28\x46\
\x1c\xc7\x48\x92\x04\x42\x0b\x22\x26\x51\x84\x30\xf0\xd1\x0d\xc3\
\xcc\xc5\x21\xe1\x02\xd3\x84\xe2\xba\x23\xeb\xf8\xae\xef\xfe\x4e\
\x7c\xe0\xdf\x7e\x00\xfb\x3b\x3b\x6a\x3e\x8a\x10\x44\x63\x55\xc6\
\x63\xae\xab\xe2\xd5\xcb\xb3\x4b\xfa\xae\x9e\x3e\x7d\x3a\x97\x62\
\xa7\x71\xec\x12\x00\x61\x10\x52\xb1\x0c\x21\x09\x04\x62\xa5\xee\
\x13\x1c\xae\xe3\xc0\xf3\x5c\x4b\xae\x92\xb1\xf9\x68\x07\x09\x69\
\x78\xe5\x09\x49\x21\x29\x03\xa3\x0e\xe0\xfa\xa0\x7e\x08\xcf\x0f\
\xf4\x6c\x57\x6a\xce\x4a\x4b\x2d\x25\x99\x09\x37\x00\xc0\x71\x5d\
\xf8\x61\x98\xcb\xc3\x7d\x0f\x9e\xef\x19\x43\xb5\xc5\xc1\xe3\x54\
\x29\x98\x4a\xdf\xa5\x14\x90\x92\x42\x6a\x95\x1e\x20\xf1\xb1\x4f\
\x7c\x12\x27\x3f\xf9\x49\xb8\x9e\x67\x2d\x7b\x81\x98\xa5\x3a\x83\
\x2c\x11\x5b\x09\xaf\x28\x25\x37\x21\x8c\x34\x72\x15\x5f\x1c\xa1\
\x84\x10\x38\x7e\xcd\xd1\x85\x18\x53\x5a\xc6\xa3\xa5\xaa\x80\xe9\
\xa8\x01\xcd\xb6\x03\xdf\xc7\xbb\x1f\x7c\x10\x77\xbc\xed\x6d\x78\
\xee\xb9\xe7\xf1\xe1\x0f\xfd\x21\x76\x77\xb6\x75\x09\x59\xbd\xaf\
\xd5\x89\x44\xd1\x11\x42\x4a\x01\xcf\xf5\x70\xcd\xf1\xe3\xa5\xd8\
\x96\x0a\xd1\x43\x03\x16\x25\xa5\xc4\xab\xaf\xbe\xc2\xd1\xcc\x23\
\xaf\x09\x20\xb5\xe0\xd4\x02\xd3\x6b\xda\x63\xaa\x2a\xe3\x25\x1a\
\x90\x5c\x0d\x4a\x6e\x7a\x24\x71\xbc\xad\xe2\x9e\x85\xde\x50\xd2\
\x1a\xb8\x21\x01\x92\x12\x92\xc7\xaa\xc4\x27\x45\x36\xcc\xaa\x4c\
\x2f\x17\x03\x27\x3f\xf0\x11\x74\x3a\x99\xcb\x32\xa3\x14\x47\x8f\
\xa5\xe0\xb4\xa7\x7a\x40\x9c\x23\x8e\xa6\xe0\x49\x02\xa9\x6d\x81\
\xba\xbd\x1e\x38\xef\x6a\x49\x79\x00\x9f\xbb\x70\x1d\x07\xae\xc3\
\x90\x24\x02\x37\x5e\x73\x04\xdf\xf9\xdd\xdf\x89\xdf\xff\xbd\xff\
\x86\x8d\x33\x67\x73\x77\x02\xdd\x2b\xc9\x4a\x79\x04\x99\x91\x29\
\xa4\x7e\xb2\xf4\xf0\x2d\xa1\x12\x5e\xd8\x41\x12\x27\xa0\x8e\x0f\
\xe2\xe4\x67\xbd\xa9\x42\x50\x12\x01\xa1\xfb\x4d\x44\x90\x3c\xcd\
\xd6\x2c\xff\xa5\x7f\xdb\x18\x00\x26\x3a\x06\x5d\x32\x07\xc4\xf1\
\xc0\x7c\x1f\x8e\xa7\x00\x29\x1d\x34\xa6\x94\x2a\x59\x5e\x49\xe8\
\x90\xf3\x4f\x9d\xb7\x14\x84\x08\x3b\x1d\x04\x61\x3e\xb7\xe4\xb9\
\xea\xf9\x70\x1c\x96\x7d\x25\xe9\x63\x14\x42\xf7\x92\x68\xc6\x04\
\xa4\x94\x10\x5c\x6d\xa6\xaf\x9e\xbf\x80\xff\xf0\xcb\xbf\x5c\x5d\
\xc2\xb3\x70\xa5\x32\x5f\x22\xb0\xb6\xa4\xe6\xf6\x8f\x66\xa6\x70\
\x89\xa5\x7c\xd8\x10\xa5\x3c\xd7\xad\xbd\x6a\x81\xcf\x6a\x3b\x22\
\xaa\x85\x21\x33\x49\xc4\xa6\x75\x90\x61\x2d\xb4\xbc\xb2\x82\xfb\
\xee\xbf\x0f\x37\xde\x74\x23\x3e\xfd\xe9\x4f\xe3\x91\x13\x27\x30\
\x1e\x0d\xb5\x9f\xa2\x34\xca\xad\x14\x80\x1a\x59\xe0\x82\x1f\x68\
\xb4\xab\xaa\x9c\x27\x01\x4c\x27\x13\xd9\xb0\x94\x37\xcf\xb8\xb5\
\x5d\x2d\x30\xbd\xa6\xe0\x24\x6a\x18\x53\xac\x9f\xb3\x48\x7f\x4d\
\x81\xc9\x01\xe0\x66\xae\xd9\x32\x4d\xc7\x94\x33\xce\xd9\xaa\x3f\
\x22\x20\x05\x07\x28\x05\x24\xcb\xdd\x16\xd2\xb2\x56\x0d\x38\x01\
\x04\x42\x72\xf8\xbe\x9a\xb5\x11\xba\xf1\x9c\x81\xd3\xd1\xa3\xb8\
\x74\xe9\x12\xc6\xa3\xa1\x1a\x88\xe5\xca\xd9\x3b\xf5\xab\x8b\xe2\
\x38\x93\x92\x27\x49\x82\xd8\x0f\x10\xf8\x1e\xb8\x76\xd1\x8e\x39\
\xc7\x4d\xd7\x1e\xc3\xf7\x7e\xcf\xdf\xc0\x87\xfe\xf8\x13\x38\xf1\
\xc9\x4f\xc2\x0b\x3b\x70\x7d\x5f\x25\xe7\xa6\x62\x86\x72\x3c\xb8\
\xde\xf2\x09\xa3\x00\x28\x88\xe3\xc1\xeb\xad\xc0\x95\x00\xa4\xd0\
\xc3\xb9\x42\x95\xb8\x4c\xcf\x3d\x21\x66\x7a\x56\x99\x00\x80\x12\
\xf5\x1c\x51\xed\x09\xa8\xcb\x45\x94\x39\x60\xae\x1a\x2c\x66\x29\
\x43\xca\x00\x89\x16\xee\x5b\xf1\xec\x5a\xfb\xe1\x39\x0c\x7e\x06\
\x4a\xa1\x9a\x59\x4a\x15\x78\xd9\xcc\x92\x93\xcd\x2e\x29\xe6\x94\
\xdf\x4c\x9a\xde\xcb\xb9\x48\x27\xac\x10\xc7\x11\x7e\xfd\x03\x1f\
\xc0\xf6\xa5\x4b\x70\x3d\x77\x46\xb0\x90\x82\x50\x91\x15\xc1\x18\
\xa8\x9d\x69\x25\x59\x7b\x53\x95\xfd\xa5\xab\x34\xf4\x24\x84\x44\
\xbf\xd7\xb5\xfe\x4e\xe1\x35\xd7\x74\x58\x12\x82\x28\x8a\x8a\xce\
\x1d\x86\x1e\xbf\xcc\x9a\xca\x60\x75\xf4\xe8\x51\x7c\xcb\xb7\x7c\
\x0b\xee\xba\xeb\x2e\x3c\xf9\xe4\x29\x3c\xf6\xc8\x09\x8c\x46\x23\
\x50\x42\x15\x88\x08\x01\x80\x42\x42\x60\x69\x69\x19\x47\x0e\x1f\
\x99\x91\xb4\x1f\xa8\x9c\x47\x08\xe2\x38\xc6\xee\xee\xee\x22\x1e\
\x79\xed\x90\x6d\x0b\x4c\x6f\x28\xc6\x94\x00\x60\x1a\x98\x98\xe5\
\xa0\x84\x10\xff\xa5\x67\x3e\xf7\x2b\x52\xca\xae\x10\xa2\x73\xeb\
\xdb\xef\xfe\x66\x25\x1f\x56\x67\xe8\x29\x40\x21\x55\xa5\x69\x00\
\x93\x22\x56\x76\x42\x70\x8c\x7a\x7b\x49\x68\x6e\x80\x93\x90\x52\
\x49\x9b\x7d\x5f\x4b\x93\xf3\x52\xa0\xd4\xb5\xfe\xa3\x47\x8f\x62\
\x7f\x30\xc0\xa5\xad\xcb\x59\x26\x10\xe7\xaa\xc7\x13\xc7\x31\xa2\
\x28\x42\x12\xc7\xe8\xf5\x7a\x88\xe3\x04\x49\x12\x20\x08\x7c\xb8\
\x0e\x07\x63\x14\x71\x92\x20\xf0\x3c\x7c\xd5\x57\x7c\x19\x96\x97\
\x97\xf1\xe4\x67\x3f\x8b\x4b\xe7\xcf\x21\x89\x62\x9c\x7b\xe5\x65\
\x1c\x3a\x72\x18\xd7\x5e\x73\x0c\x66\xeb\x9e\x4b\x89\x73\xaf\xbe\
\x8a\xce\xea\x61\x10\xea\x28\x5f\x33\xc0\x00\xc7\x04\x52\x0b\x31\
\xa4\x30\xc1\x49\x14\xad\x9b\x50\x2c\x77\xa5\x32\x6b\xc5\x94\x54\
\xcf\x8b\x39\x0c\x94\x39\xfa\x60\xb9\x85\x92\xd1\xcb\x29\x38\x53\
\xc8\xbc\x84\x47\x29\x81\x1f\x04\x08\xbb\x1d\x04\x9d\x50\xb1\xa5\
\x40\x95\xf1\x1c\xd7\x55\x7d\x24\x87\xe9\x08\x7b\x1d\x6d\x81\x1c\
\x88\x33\xe1\xbb\x14\x90\x92\x40\x08\x09\x4a\x08\x3e\xf9\xa7\x9f\
\xc1\x27\x3f\xf4\x87\x70\x5c\xa7\xc0\x87\xca\x20\x04\x94\x8d\x59\
\x6d\xd7\x9d\x2d\xe5\x11\x8b\x2f\x51\x39\x42\xa3\x91\x0e\x6f\x2e\
\x73\x92\x08\x82\xc0\xe2\x08\xa4\x4e\xad\xf6\xa7\x11\xa6\x31\x07\
\xa4\xc0\x4a\xa0\xec\x9d\xa6\xd3\xa9\x7a\x7d\x18\x2d\x64\x64\x55\
\x02\x93\xd1\x7b\x4a\xaf\xf7\xb6\xb7\xbe\x15\x6f\xbd\xfd\x76\xbc\
\xe3\x1d\xf7\xe0\xa1\xcf\x3c\x84\x53\x4f\x3e\x8e\x48\xdf\x6e\xfa\
\xac\x7b\x9e\x8f\x5e\xbf\x9f\x9f\xba\xcd\x2b\xdf\xd5\x0d\xd7\x42\
\x01\x53\x1c\xc7\x89\xf1\x39\x6f\x2a\x19\x47\x0b\x48\x2d\x30\xbd\
\x11\x7a\x4c\x55\xc0\x44\xf5\x41\x84\x10\x64\x34\x18\x24\x00\xba\
\x94\xb1\xe5\xcf\x3d\x76\xf2\xd7\x28\x21\x5d\xc7\x75\x97\x01\x04\
\x52\x22\x94\x52\x78\x00\x02\x00\x3e\x24\x7c\x00\xbe\x84\xf4\x6f\
\xbb\xeb\x1e\x5f\x8a\x48\x95\x2d\x68\x11\xa0\x4c\x70\x4a\xa7\xf2\
\x97\x96\x96\xe0\x79\xbe\x2a\x2b\x59\x86\x73\x25\xa0\xdc\xa1\xa5\
\xc4\xc5\xad\x4b\x9a\xa1\x29\x80\x48\xe2\x18\x93\xf1\x18\xd3\xc9\
\x14\x51\x14\x61\x69\xa9\x8f\x28\x8a\x31\x8d\x22\x78\x9e\x0b\xdf\
\xf3\xe0\x3a\x0e\xa6\x51\x0c\x87\x31\xfc\xf9\xfb\xff\x1c\xee\x7e\
\xfb\x5b\x71\x79\x67\x17\x9c\x27\xd8\xdd\xdd\xc3\xde\xee\x2e\xb6\
\xb6\xb7\xc1\x28\x41\xc2\x13\x5c\x0c\x43\xec\x8d\x26\xd8\xdd\xdd\
\x43\xd0\x5f\x03\xa1\x54\xff\xad\x28\x3b\xb3\x16\x82\x6b\x60\x12\
\x39\x4b\x4a\x81\xa9\x70\x46\x9e\xc7\x86\xa4\x2c\x8a\x68\x9b\x24\
\xaa\x59\x13\xd1\x00\x65\x82\x91\x99\x86\x9b\x95\x05\x8d\x43\xca\
\x54\xec\xe0\x2b\x96\x94\x1e\xda\xe5\x21\x7d\xdc\x8e\x96\x87\x33\
\x1d\x9b\x5e\x64\x5e\x39\xc0\x49\xfd\x98\x00\x82\x17\x5e\x79\x15\
\xff\xf1\x57\x7f\x15\x36\x5d\x37\xa9\x28\xe2\xd9\x44\x0f\x95\xde\
\xac\x33\x72\x72\xcc\xb0\xd5\xe2\x5f\x20\x57\xf4\x21\x58\xee\xf7\
\x4a\x4c\x5d\xbd\xf7\xb6\x27\x11\xb6\xa7\x49\x26\x76\x19\x8d\xa6\
\x08\x28\xc1\x1e\x27\x58\x5e\x5d\x41\x32\x99\x22\xe6\xc9\xcc\x0c\
\x94\x84\xac\xdc\xbe\x25\xf2\x74\x63\x42\x29\xde\xf6\xb6\xb7\xe1\
\x96\x5b\x6e\xc1\xa9\x53\xef\xc0\x47\x3e\xf2\xc7\x38\xf3\xca\x69\
\xf0\x44\x89\x22\x26\x93\x31\x38\x4f\xa0\x4f\x79\x0e\x56\xce\x33\
\xde\x6b\x9b\xca\xf5\x61\x1e\x5b\x6a\xf3\x97\x5a\x60\xfa\x82\x01\
\x12\xa9\x60\x4c\x65\x70\xa2\xa5\xc3\xd6\x01\x10\x42\x0d\x76\x4c\
\x38\x30\xe6\x9c\x0f\x01\x84\x1a\x90\x82\x0c\x98\xf4\x57\x42\x48\
\xf0\xf4\x63\x8f\x78\x84\x52\x9f\x31\xe6\x43\xc2\x05\x81\x93\xfb\
\xee\xd1\xec\xc3\xfd\x96\x3b\xdf\x09\xcf\x57\xae\xd7\x42\x88\x99\
\x72\x5f\x11\x9c\x24\xfa\xfd\x3e\xa4\x94\xd8\xbc\xb8\x09\xa9\x95\
\x79\x3c\x49\x30\x9d\x8c\x31\x9d\x4c\x10\x45\x53\xc4\x51\x84\x6e\
\xaf\x87\x28\x0e\x11\x86\x01\xa2\x28\x86\xeb\xba\x2a\xad\x95\x10\
\x50\x42\xe1\xb9\x0e\xae\x3d\x7a\x18\x52\x4a\x5c\x7b\xcd\x51\x08\
\xae\xca\x82\x42\x08\x5c\xb8\xbc\x8b\x84\x5f\x06\xe7\x02\xdf\xfa\
\xdd\x7f\x03\xe7\xce\x5d\xc0\x89\x4f\xff\x29\x76\x2f\x6f\xc1\xd3\
\xfd\x02\xce\x13\x50\x2e\x00\x47\x18\xa2\x81\x1c\x30\x8a\x65\x22\
\x23\x08\x50\x5f\x27\x8d\xf6\xc8\x07\x7f\x0d\x20\x2a\x39\x30\x14\
\x0c\x64\xd3\xff\x34\xa8\xb8\xae\x87\xa0\x13\xe6\x82\x07\xcd\x94\
\x3c\xcf\xd3\x5f\x53\xfb\x21\x47\xcf\x2d\x95\xcb\x57\x79\x2d\x4f\
\x70\x01\x42\x09\xb6\xb6\x77\xf1\xfe\x7f\xf9\x2f\xb1\x71\xe6\x8c\
\x52\x02\xce\x0c\xc9\x92\x62\x2f\xa9\x6c\x41\x54\x12\x43\x54\x2a\
\xf4\x48\x5d\x27\x6a\x7e\xc9\xae\x31\x54\x49\x89\xf5\xb5\xd5\x19\
\x60\x19\x44\x09\x36\x46\x11\x3c\x6d\x80\x4b\x35\x6e\x8d\x84\xc4\
\xca\x91\xa3\xe8\xae\xac\x60\x3c\x1a\x61\x7f\xe3\x02\xe2\xc9\x58\
\xcd\x70\x51\x0a\xe6\x38\x10\x5c\x60\x34\x1e\x67\x00\x9f\x24\x49\
\xe6\x28\x12\x47\x31\x40\x69\xae\xe0\x03\xe0\x3a\x0e\xbe\xe4\x4b\
\xfe\x1c\x6e\xb9\xe5\x2d\x78\xea\xa9\xcf\xe1\xc3\x1f\xfa\x43\x5c\
\xdc\xb8\x80\x9b\x6e\xb9\x15\x41\x10\x54\xdb\x7e\x35\x29\xe7\x19\
\x2d\x5f\xae\x94\x95\x1c\xb3\x91\x36\x07\x19\xb0\x6d\x01\xaa\x05\
\xa6\xd7\x85\x31\x49\xfd\x46\x4d\x41\x28\xa9\x01\x25\x13\xd8\x4c\
\x20\x33\x95\x7b\xbe\x01\x4a\xe9\xe1\x49\x29\xd5\x57\x21\xfc\x44\
\x08\x4f\x9f\x0e\x7a\xba\x77\x95\xfe\x9b\xb9\x9e\x87\xd3\xcf\x9c\
\x42\x10\x86\x78\xe7\xbb\xff\xc2\xac\xd0\xdc\x22\x31\x97\x90\x58\
\x5a\x5e\x82\x94\x02\x5b\x5b\x5b\xba\x8c\xc6\x11\x47\x11\x26\xe3\
\x31\xa2\xa9\x02\xa6\xe5\xc9\x04\x41\xa7\x83\x20\x08\xd0\xed\x74\
\xe0\xf9\x3e\x26\x93\x09\x5c\x4f\x0b\x01\xb8\xb2\xe3\x21\x99\xd2\
\x4e\xff\x5d\x9d\xc8\x4a\xd5\x94\x14\xfa\xbd\x2e\x6e\xbd\xe5\x66\
\x1c\x3e\x7c\x08\xaf\xbc\x7a\x06\x4f\x9e\x7c\x44\x45\x6c\x50\x0a\
\xe2\x01\x92\x0b\xcd\x32\x30\x53\x6e\x83\x59\xf2\x49\x11\x36\x8d\
\x4d\xd7\x33\x55\xc5\x72\xd6\x6c\x79\x26\xfb\x9d\x8c\xdd\x48\x40\
\x6a\x2f\x3b\xe6\xc0\xf3\x83\xbc\xa7\xe4\x79\xf0\xdc\xd4\x41\x5c\
\x01\x52\xea\x8d\xe7\xba\x39\x63\x4a\xa5\xe0\x29\xf4\x09\x21\x20\
\x34\xa0\x08\x2e\xf1\x5f\x7f\xef\xf7\x70\xea\x91\x93\x86\x0a\x2f\
\x1f\x92\x25\x25\xe5\x5d\xfe\xed\xec\xf9\x4c\x56\x94\x2b\x2b\xf7\
\xca\xa0\x56\xea\xf7\x98\x8e\x12\x33\xc2\x87\x03\x12\x27\xd7\x71\
\x0b\xdf\xc7\x09\xc7\xe9\xed\x3d\x80\x3a\x48\x28\x85\x23\x89\xfa\
\x00\xa4\x52\x7a\x46\xe1\xba\x0e\x82\xb0\x83\xfe\xf2\x32\x64\x12\
\xc3\xa7\x04\xbb\x97\x2e\x62\xb8\xb7\x0f\x42\x29\xba\xdd\x4e\x76\
\xdf\x52\x95\xa5\x90\x02\xaa\x92\x56\x7c\x5c\x9c\x73\x8c\x46\x63\
\xac\xac\x2c\xe3\xc6\x1b\xae\xc7\x3b\xdf\xf9\x0e\x3c\xfc\xf0\x09\
\xf4\xfa\x3d\xed\x93\x27\x6d\xaf\xfe\x42\x3c\x91\x10\x8a\x67\x9f\
\x7b\x16\x28\x0a\x9c\x0e\x3a\x60\xdb\x82\x52\x0b\x4c\xaf\x2b\x6b\
\x22\x06\x38\x91\x1a\x96\x54\xfe\xbd\x54\x28\x31\x2d\x01\x93\x67\
\x7c\x2d\xff\xdb\x06\x48\xd9\xf7\x71\x14\xf9\x71\x14\x79\x9d\x6e\
\xcf\x7b\xea\xe4\x43\xb8\xf3\xde\x07\x66\x47\x9b\x2c\x2a\x3e\x29\
\x25\x96\x97\x57\xd0\xe9\x74\xb1\xb5\x75\x09\xc3\xdd\x6d\xe5\xa5\
\x17\x47\x88\xa7\x13\x44\x93\x31\xa6\xe3\x31\x7a\x4b\x4b\xe8\xf5\
\xfb\x88\xa6\x53\xf8\x41\x88\x4e\x27\x84\x9f\x70\x44\x8c\x2a\x1f\
\x39\x6d\x53\x23\x8d\x79\x13\x4a\x29\x64\x6a\x75\xa4\xe7\xa4\xe2\
\x38\x86\xe3\x38\xb8\xe1\xfa\xeb\xb0\xba\xb2\x82\x8d\x8d\x0d\x5c\
\x38\x73\x16\x9b\xe7\xce\x21\x89\x23\x30\xe2\x68\xec\x10\x86\xe3\
\x4c\xa9\x2f\x64\x94\xf8\xc8\x4c\x6e\x79\x11\xbc\x8a\x3d\x0c\x99\
\x65\x23\xc9\x8c\x8d\x11\x30\x47\xf9\xe0\x65\xae\x0e\xa9\x73\xb8\
\xe7\x2a\x2f\x3c\xdd\x5b\x62\x54\x09\x1d\x98\x9e\x57\x4a\xe5\xe2\
\x29\x5e\xa4\x0c\x8e\x73\x01\x41\x24\xfe\xe0\x83\x7f\x80\x8f\xfe\
\x3f\xff\x4d\x07\x00\x16\x2d\x93\x32\x80\x41\xd1\x8c\x16\xa4\x64\
\x3f\x44\xaa\x59\xcd\x2c\xfe\x96\xcb\x78\xf3\x4a\x86\x8b\xd2\x25\
\x25\xfb\x5e\xea\xf7\x0a\x27\x0f\xe3\x28\xc2\xf9\xcb\xbb\xe8\x84\
\x01\xc2\x20\x40\xe0\xaa\x39\x2f\x47\x0b\x5d\xa8\x7e\x2c\x94\xaa\
\xe4\xdb\x43\xdd\x15\xf8\x8c\x61\xb4\xba\x82\xc7\x1f\x79\x34\xf3\
\x9b\x22\x30\xc4\x33\x20\x60\x84\xc1\x09\x9c\x22\x98\xea\x7f\xf4\
\xba\xdd\xec\xf2\x23\x87\x0f\xe1\x9d\xf7\xdc\xa5\xfd\x08\x85\xd1\
\x25\x6a\xfa\xc9\xb6\x27\x1e\xef\xed\xee\x01\xc5\x7c\x35\x5e\x03\
\x54\xed\x0c\x53\x0b\x4c\x5f\x70\xc6\x24\x0c\xf0\x49\x19\x10\xd1\
\x6f\x60\x58\x80\x49\x5a\xd8\x92\x39\xeb\xe4\x37\x01\x1f\xcb\x57\
\xf3\xdf\x3e\x00\xef\xf2\xc5\x8d\x00\x80\xff\xc4\x43\x9f\x0a\x19\
\x73\xd8\x9d\xf7\x3e\x50\x64\x1e\x36\x70\x82\x84\xeb\xba\x38\x7c\
\xf8\x08\x70\xf1\x22\x46\xc3\x3d\x08\x9e\x40\x24\x09\xa2\xb1\x02\
\xa6\xf1\xda\x1a\x26\xe3\x31\xba\xfd\x3e\x7c\x7f\x84\xe1\xc0\x87\
\x1f\xf8\xe8\x74\x3a\x99\x13\x82\xa7\x1d\x21\xa4\xde\xc0\x52\x79\
\x30\xe7\x22\x13\x59\x24\x09\x57\x6a\x3f\x3d\x4c\x7b\xfc\xf8\x71\
\x1c\x3d\x7a\x04\xdb\x37\xdf\x8c\xf3\x67\xcf\xe2\xe2\xf9\x73\x98\
\x8c\xc7\xba\x45\xa7\x81\xa7\x90\xed\x94\xaa\x16\x67\xfb\x29\xa9\
\x4c\x5d\xca\xd9\x97\xcc\x54\xf9\x01\x52\x31\x3c\x2d\x8c\x60\x7a\
\xa8\x37\x0d\xfe\x73\x5d\x57\x95\xf1\x74\x0a\x30\xd3\x82\x07\xa6\
\x13\x6a\x59\x5a\x3a\x24\x46\xe9\x4e\x08\x08\x42\x90\x48\x09\x4a\
\x81\x53\xa7\x9e\xc2\x1f\xfe\xf6\x6f\x63\x3a\x9e\x64\xfd\xae\x59\
\x71\x43\x09\x8f\x48\x99\x2d\xcd\x8a\x1e\x88\x2d\x11\xb0\xb2\x8c\
\x67\xfb\xf7\xfc\x38\xf6\x99\xdb\x32\xae\xc2\x28\x55\xa0\x90\x46\
\x7b\x08\x81\xa7\x5f\x3d\x8f\xcd\xcb\xdb\xe8\xf7\x7a\xe8\x44\x31\
\x42\xdf\x47\xe0\xb9\xf0\x3d\x17\x9e\x56\x2d\x3a\x7a\xec\xe1\x70\
\x37\x84\xcf\xd4\xbf\x03\xcf\xc3\xd2\xea\x0a\xf6\xb6\x77\x2c\x73\
\x51\xe9\x6b\x9d\xbb\x80\x00\xca\x35\xbe\xdc\x27\x4b\x61\xa5\xda\
\xbf\xef\x00\x26\xae\x00\xb6\xb7\xb7\x65\x05\x28\x35\x89\xbe\x68\
\x59\x52\x0b\x4c\xaf\x3b\x5b\x92\x16\xb0\x21\x96\x4f\x7f\xd5\x75\
\x4d\x60\xf2\x34\x63\x2a\x03\x8f\x79\x78\x35\xdf\x7b\x25\x86\xe5\
\x03\xf0\x2f\x5f\xdc\x0c\x00\x04\x4f\x3c\xf4\xa9\x2e\x63\x8e\x77\
\xd7\x7d\x0f\xe6\x7d\x27\x9b\xbf\x9e\xb6\xdf\x39\x76\xec\x18\xf6\
\xf6\xf6\xb0\xb9\xb9\x01\x1e\x47\xe0\x49\x8c\x68\x3a\xc1\x64\x34\
\xc4\x64\x38\xc4\x78\x79\x05\x9d\x7e\x5f\xc9\xd1\xc3\x10\x93\xc9\
\x04\x41\x10\xc0\x75\x3d\xb8\xae\xa3\xfd\xf4\x14\x5b\x62\x4c\x59\
\xd0\x70\x3d\x74\x2b\x0c\x6f\x3e\x21\x38\x04\xd7\x89\xb7\x82\xa3\
\xbf\xd4\x47\x10\xde\x82\xa3\xd7\x1c\xc3\x60\x7f\x80\x68\x3a\xc1\
\xf6\xd6\x65\xec\xef\xee\x40\xf0\xa4\x18\xbd\x2d\x8d\xde\x4e\x2a\
\x00\x91\xa5\x8c\x1e\x6d\x9a\x0a\x03\x90\x08\x21\xa0\x0e\x53\x33\
\x35\x4c\x05\x28\x2a\xc1\x04\x55\xf7\xdf\xf3\xe0\xb8\xda\x31\x5c\
\x7f\x4d\xa3\x2c\xa8\x16\x3c\xe4\xc2\xf7\xbc\x88\xa6\xa4\xee\x2a\
\xae\x1e\x94\xe0\xf9\xe7\x5f\xc2\xfb\xff\xd9\x3f\xc3\x70\x7f\x5f\
\x83\x12\x32\x46\x40\x4a\x20\x53\x66\x50\x36\xb6\x34\x23\x82\x28\
\x24\xad\x2f\x56\xc6\x6b\xdc\x65\xaa\xba\x3e\x51\x0c\x33\xf5\x01\
\x14\x42\xe0\xfc\xc6\x26\xce\x5e\xb8\x84\xd5\xd5\x55\xf4\xfb\x3d\
\x74\xc2\x10\x61\xe0\x23\xf0\x3c\xf8\x9e\x0b\xdf\x75\xe1\xb9\x0e\
\xd6\xba\x21\x3c\xa6\xfa\x45\x69\xc8\x30\xa9\x04\x13\xb2\xf8\x47\
\x74\xf1\x80\x5a\xd4\x3d\x1d\x9f\x3b\x75\x8a\x23\xb7\x18\x4b\x4a\
\x20\x65\xf6\x9c\x9a\xca\xc3\x5b\xa0\x6a\x81\xe9\x35\x67\x4e\x02\
\xf3\x45\x53\x55\xa0\x94\x18\xa0\x54\x06\x21\xa7\xe2\xdf\x75\xc7\
\x0c\x30\xe9\x7e\x55\x70\xf9\xe2\xe6\x00\x40\x70\xe2\xe3\x7f\xdc\
\x0d\x3a\x9d\x40\x4a\x49\xef\xba\xf7\xc1\x02\x38\xa5\x67\xa0\x69\
\x4f\x6a\x69\x49\xf5\x9d\x76\x77\x77\x31\xda\xdd\x46\x12\x47\x48\
\xe2\x08\xe3\xe1\x10\xe3\xe1\x00\xbd\xe5\x55\x04\xdd\xae\x9a\xf5\
\xe9\x76\x94\xdb\xb6\x76\xde\x76\x5c\x07\xae\xe3\x82\x69\xf5\x1a\
\x74\x94\x78\x5a\x9e\xe3\x42\x28\x40\x92\x3a\xe9\x36\x35\x79\xd5\
\x36\x49\xae\xeb\x62\x69\x79\x09\x49\xd2\x41\x6f\x69\x09\x83\xbd\
\x3d\x4c\x75\xaf\x6b\x3c\x1c\x2a\xf5\xd5\x68\x84\x68\x32\xc9\xf6\
\x22\x33\xc7\x49\x1a\xd1\x12\x52\x8a\xac\xa4\x08\x4a\xd5\x7d\xd2\
\x40\xc3\xf4\xf7\x34\x63\x44\x69\xd9\xce\x81\xe3\x3a\x99\x24\x5c\
\xa9\xf0\x28\x68\x1a\x90\x08\x92\x45\xb2\x13\xe4\x7f\x87\x27\x0a\
\x94\x5e\x78\xfe\x25\xbc\xff\x9f\x97\x41\xc9\x9c\x51\xb2\xcd\x21\
\x59\x4a\x7a\x36\xb6\x64\x7b\xb3\x19\x7e\x7a\x8d\xca\x78\x57\xe0\
\x49\x24\xa5\x84\xe3\xa8\xd7\x37\x7d\x9e\x87\xa3\x31\x1e\x3a\x79\
\x12\xc3\x58\x62\x6f\x6f\x0f\x2b\xab\xab\xe8\xf7\x97\xd0\xeb\x76\
\xd0\xd1\x16\x4e\x81\xaf\x14\x8d\x37\xae\xf6\xb3\x61\x64\x40\x8d\
\x10\x28\xc9\x77\x3d\x40\x5c\xb5\xd3\xca\x05\xd7\x70\x34\x4c\x2a\
\x40\xa9\x4e\x3e\xbe\x08\x50\xb5\xab\x05\xa6\x2b\x7e\x7b\xa3\x78\
\x4a\x5e\x00\xa7\x14\x74\xe6\x01\x93\x09\x4e\x2e\x72\x97\x08\xc7\
\xf8\xea\xcc\xf9\xde\x06\x5a\x36\xd6\x64\xaa\xfc\x82\xc1\xde\xee\
\x70\xb0\xb7\x1b\xf4\x96\x96\x7b\x4f\x3d\xf2\x50\x20\x85\x70\xee\
\xba\xef\xdd\x33\xe0\x94\x6a\xd5\x96\x97\x57\xd0\xeb\xf5\x70\xf1\
\xe2\x45\x0c\x86\x03\xf0\x24\x46\x12\x47\x98\x8e\x47\x18\x0d\x06\
\xe8\xf4\x97\x10\x74\x7b\x08\x3b\x5d\x84\xdd\xae\x72\x9a\x08\x43\
\x04\x41\x08\xe6\x38\x39\x7b\xd2\xa5\xbd\x94\xe9\x88\x74\x90\x56\
\x37\x80\x52\xe7\xe9\x3c\xdd\x55\x95\xfa\x52\x9b\x24\x3f\x08\x40\
\x99\x4a\x8e\x0d\x3b\x9d\xc2\xec\x4a\xae\xfe\xe3\x80\x21\x31\x4f\
\xd5\x72\x52\xd2\x4c\xf9\xc5\xb2\x41\x58\x92\x81\x13\xa5\x14\x8e\
\x93\x02\x91\x03\x47\x97\xf1\x18\x65\x99\xe2\x30\xbb\x2e\x21\x0a\
\x9c\xd2\xbe\x92\x66\x80\x92\x2a\x91\x03\x08\xf0\xc2\xf3\x2f\xe1\
\x3f\xfc\xd2\x2f\x61\xb8\xb7\x97\x81\x52\x2e\x71\xcf\xc1\x85\x94\
\x18\x13\x29\xb7\x98\x48\x05\x88\xcd\x15\x3d\x90\xb2\x95\x43\x05\
\x1a\x91\x6a\x13\xd8\x9a\x5d\x5c\x4a\x89\x5e\xaf\x8b\x30\x08\x32\
\x16\x3a\x8d\x22\x3c\xf3\xe4\x13\x18\x27\x02\x2b\x87\x8e\x62\xf5\
\xf0\x61\xac\xac\x1f\xc2\xf2\xca\x0a\x96\xfa\x7d\x74\xf5\x89\xcb\
\xcd\xc7\x8f\x22\x74\x9d\x82\x9d\x94\x10\x42\x9d\x60\x1c\xb0\xdf\
\x85\xd7\x10\xb3\xa4\x90\x38\x77\xf6\x6c\x84\x62\xe0\x67\x52\xc1\
\x9c\x9a\xca\xc6\xdb\xd5\x02\xd3\x6b\x0e\x52\x26\xe0\xcc\x63\x56\
\x75\x2e\x11\xe9\xc1\xe6\x7c\x5f\x07\x52\x36\x70\x0a\x4a\x00\x15\
\x1a\x00\x15\x76\xfb\x4b\x29\x40\x79\x77\xdd\xf7\x60\xc1\xaa\x5c\
\xbb\xbd\xe9\xd2\xde\x35\xd8\xdd\xdd\x51\x6e\x11\x71\x0c\x1e\xc5\
\x48\xa2\x08\xe3\xe1\x00\x7e\xd8\x45\xd8\xeb\xa3\xd3\xeb\xa1\xdb\
\xef\x63\xec\x07\x2a\x1a\xc2\xf3\xb5\x80\xc0\x55\xfe\x68\xc6\x66\
\x9a\xf6\x9a\x52\xc2\x26\x84\xd0\x4e\xd2\x00\x4f\x72\x50\x92\x3a\
\xcb\x29\x2d\xfb\xe5\x2e\x10\x42\x45\x9c\x87\x21\xe2\x69\xa4\x76\
\x96\x58\xe4\x2f\x82\x31\xd3\x04\xdd\x77\xa0\x8c\x16\xbc\xed\xd2\
\xbe\x51\x5a\x6e\x4c\x41\x49\x39\x3b\x38\x2a\x5f\x89\x69\x96\xa4\
\x95\x65\xa4\x6c\xb2\xaa\x99\x52\x12\xab\xfb\x7f\xfa\xe5\x97\xf0\
\x1b\xff\xfa\x5f\x63\xb8\xbf\x67\xcc\x50\xe5\x6c\x29\x03\x22\x03\
\x60\xac\x65\xbd\x42\x87\xa7\x28\x92\x98\xc1\x0f\x0b\x5b\x2a\x0c\
\xd5\x96\xcb\x78\xb6\x68\x0c\xb2\x98\x54\x1c\xc8\x4f\x2e\xb8\x90\
\xf0\x5c\x17\x62\x3a\xc1\xcb\xcf\x3d\x8f\xee\xd2\x39\xf4\x57\xd7\
\xb0\x7a\xf8\x28\xd6\x8e\x1c\xc5\xca\xfa\x3a\x96\x57\x56\x10\x84\
\x1d\xdc\x72\xed\x91\xbc\x8f\xa4\x19\xee\x60\x34\x42\x12\xc7\x3a\
\xfa\x83\xbc\x01\x3e\xd6\xf9\x13\x95\x70\x8e\xfd\xbd\xbd\x89\x3e\
\x79\x8c\x8d\xcf\x6c\x15\x28\xb5\x91\x17\x2d\x30\x7d\xc1\xde\xb5\
\x65\xf9\xa7\x98\xc3\x92\xaa\x80\x89\x95\xc0\xc7\x1c\xca\x75\x2c\
\xff\xae\x03\xaa\x32\x38\xf9\x75\xcc\x49\x03\x54\x38\xdc\xdf\x1b\
\x0e\xf7\xf7\xc2\x6e\x7f\x69\xe9\xa9\x47\x1e\x56\x00\x75\xef\x83\
\xb3\x85\x3d\x29\xb1\xbc\xbc\x8c\x4e\xd8\xc1\xd6\xe5\x2d\x0c\x06\
\xfb\xaa\xb4\x17\x4d\x11\x4d\x26\x98\x8e\x86\x98\x0c\xbb\x98\x8c\
\x86\xe8\xf4\xfa\xf0\x02\x05\x4c\xbe\x4e\x78\x65\x8e\x5b\x8c\x96\
\x28\x6f\xf0\x44\xc5\x8e\x2b\x90\xe2\x88\x23\x15\xc9\x91\x06\xec\
\xa5\xce\xe7\x99\xc0\x80\x8b\x82\xf2\x8e\x12\x02\x41\x09\x20\xd4\
\xe6\x4c\x09\xc9\xac\x89\x52\x19\x39\xa3\x1a\x7c\xb4\xe9\x2c\x63\
\x0c\x8e\xeb\x64\x00\xc6\x98\x0a\xf7\x63\x69\xe9\x4e\x83\x95\x6b\
\xcc\x2b\x41\x03\xa3\xe0\x1c\x60\x14\x3c\x91\x10\x1c\x60\x94\xe0\
\xe5\x17\x5f\xc4\xef\xfc\xfb\x7f\x8f\xd1\xfe\x3e\x18\x73\xf2\x3e\
\x4f\xa9\xaf\x54\x06\xa5\x02\x73\x9a\x91\x91\x93\x59\x32\xd4\x94\
\x2d\x11\x9b\x14\xa2\x8e\x95\xcc\xf7\x2e\x07\x90\x85\x42\x72\x7d\
\xd2\x90\xf5\xf2\x26\x23\xc4\x7b\x97\x31\xe1\x11\x86\xbb\x3b\xd8\
\xba\x70\x0e\x9d\xfe\x32\xd6\xaf\x39\x8e\x95\x43\x87\xd1\xe9\x2f\
\xe1\x9b\xbe\xf2\xdd\x85\x52\x03\x17\x02\x9b\x1b\x9b\x39\x58\x5f\
\xc5\xea\xdd\x95\x7e\xd0\x29\x21\x98\x4e\x26\x18\x8f\xc7\x23\xe4\
\x49\x01\x55\x8c\xa9\x0c\x52\x36\x50\x6a\xc1\xa9\x05\xa6\xd7\x8d\
\xf9\x9b\xde\x79\x65\x50\x02\xea\x07\x71\x59\xcd\x41\x2b\x2e\xaf\
\x02\x29\x93\x3d\x79\x15\xfd\xa6\x19\xe6\x54\x02\xa8\x4e\xb7\xbf\
\xd4\x7f\xea\xd1\x87\x43\x48\xe9\xdd\xf9\xae\x07\x48\x0a\x4e\xa9\
\xca\xcd\xf5\x5c\x1c\x3b\x76\x0c\xbb\x3b\x3b\xd8\xdc\xdc\x44\x12\
\x4d\xe0\x25\x1d\xf0\x68\x8a\x68\x3a\xc6\x64\x38\xc0\xb8\xd7\x47\
\xd0\xed\xc1\x33\x98\x93\xeb\xfb\x70\x5c\x4f\x25\xb5\x92\xd4\x1a\
\x88\x66\x02\x89\x82\x88\x41\x0f\x57\xf2\x84\x67\x9b\xa0\x14\xbc\
\xe8\x9d\x67\xf4\x90\x88\xde\x2c\x29\xa1\x90\x44\x64\xd6\x43\x54\
\xcf\xce\xe4\x36\x45\x74\x06\x8c\x5c\xed\x79\x47\x88\x56\xd9\x69\
\x86\x94\xf6\xa4\x68\x76\x3b\xe9\x9c\x92\x32\xbd\xe5\x94\x20\x8a\
\x44\x36\xbb\xf4\xb1\x0f\x7f\x08\x4f\x3d\x72\x12\x93\xd1\x48\x9d\
\xf9\x9b\x60\x54\x2a\xdb\xa5\xdf\xcf\x30\xa5\x82\xcd\x52\x01\x0a\
\x2c\xd6\x43\xf3\xd9\x52\x7d\x33\xa9\xae\x8c\x57\xaf\xc8\xe3\x5c\
\xe0\xe8\x91\x23\x08\x7c\x1f\x52\xa8\xd7\xc1\x75\x1c\xdc\xf1\xd6\
\x5b\xf1\xc2\x33\x4f\xe2\x50\xd7\x01\xf5\x5c\x4c\x05\x10\x4f\x06\
\xf8\xfc\xa3\x0f\xa3\xb7\xbc\x8a\xee\xd2\x0a\x3a\xff\xeb\xf7\x15\
\x58\xd7\x70\x32\xc1\xf6\xc5\xcd\x1a\xf1\x43\xdd\x3d\x5e\x00\xca\
\xc8\x41\x3e\xd9\x32\xfd\x7e\x6a\x80\x52\x54\x62\x4c\x49\x05\x6b\
\x6a\xcb\x79\x2d\x30\x7d\xc1\xfb\x4d\x28\x81\x13\x29\x5d\xc6\x2c\
\xfd\x25\x13\x7c\xcc\xaf\xb4\xe6\x67\x75\x8c\xea\x20\xe0\x94\x01\
\x93\x3e\x46\x29\x83\x72\x5d\xaf\xf7\xd4\xa3\x0f\x77\x21\xa5\x7f\
\xd7\xbd\x0f\x10\x99\x3a\x46\xe8\x47\xbd\xbc\xb2\x82\xb0\xd3\xc1\
\x70\x30\xc0\xc5\x8b\x9b\x88\x1d\x0f\xae\x1f\x20\x99\x4e\x11\x4d\
\x27\x18\x0f\x07\x70\xfd\x00\x41\xa7\x03\xcf\x0f\xe0\xfa\x01\xfc\
\x20\x80\xe3\xf9\x9a\xc9\xa8\xd2\x9e\x59\x4e\x93\x59\x15\x4e\x95\
\x50\x78\x92\xe4\x9b\xb4\x21\xfd\x4e\x0d\x5e\x85\x28\xb9\x41\xe8\
\x19\x19\xd3\x8d\x21\x05\x18\xe6\x50\x30\xe6\x64\x60\x63\xf6\x97\
\x18\x73\xf2\x92\x5d\x61\x60\x36\x15\x36\x88\x6c\x20\x57\xc9\x88\
\x05\x24\x4f\x20\xc0\x30\x9e\x4c\xf0\x89\x3f\xfa\x30\x9e\x7d\xfc\
\x71\x08\xc1\x15\x2b\x44\x89\x19\x95\xcb\x76\x25\x60\xb2\x81\xd2\
\x0c\xc3\x32\x49\x90\x59\x1a\xac\x61\x4b\xc4\x82\x4b\xcd\xca\x78\
\x73\xa5\x7b\x88\xe3\x18\xa6\xf4\xda\x71\x1c\xdc\x7e\xcb\x4d\x58\
\x5e\xea\x63\xa9\xdf\x85\xe7\xba\xf8\x47\xff\xf8\xff\x8b\x1b\x6e\
\xba\x05\xbf\xff\x07\x7f\x88\x5f\xfd\xc0\xaf\xe3\xc5\xe7\x9e\xc6\
\x99\xcd\x4b\xb8\x69\x7d\x4d\x39\x76\x27\x09\x5e\x7a\xfe\x05\xcc\
\xb1\x3a\xaf\xbc\x1f\xe4\x00\x50\xb6\xc8\x22\x94\xe0\xc2\xf9\x0b\
\x12\x4a\x2d\x9b\xce\x1a\xc6\xa5\xa3\xc9\x3c\x53\xbb\x5a\x60\x7a\
\xdd\x00\x89\xd4\x80\x93\x59\xad\x48\xff\x9d\x82\x8e\xd0\x5f\x4d\
\xb7\x88\x26\x47\x1d\x8b\x62\x15\x65\x3d\xaf\x06\xa0\x82\x2a\xf6\
\x04\x20\x8c\xe3\x68\x74\xe9\xc2\xf9\x90\x31\xa7\xfb\xf8\x67\x3e\
\xdd\x65\x8e\x13\x70\xce\xe9\x3d\xf7\x3f\x98\x99\x26\x78\xae\x07\
\x6f\x6d\x0d\xae\xe7\x61\x7f\x6f\x0f\xfb\xfb\xfb\xa0\x8e\x03\x37\
\x56\x00\xe5\x06\x01\xa6\xa3\xa1\xea\xdb\x04\x1d\x55\xde\x0b\x42\
\xc5\x9c\xf4\x20\x2e\xd5\x72\x6d\xa6\x63\xcd\xd3\xf8\x8a\x54\xd0\
\x90\xb3\x29\x15\x22\x07\x9d\x06\x6b\x3a\x90\x13\x7d\x76\x4b\xb4\
\x4c\x3b\x07\x25\x05\x2c\x24\x13\x30\x28\xd0\x49\x4f\x84\x19\x63\
\x59\x70\x5f\x1a\xc7\x40\x34\x20\x31\xaa\xcb\x98\xba\x6c\xc7\x93\
\x04\x0e\x25\x4a\x75\xc7\x28\xb8\xa4\xb8\xb4\x71\x01\x0f\x7d\xfc\
\xe3\x78\xe9\x99\x67\x34\xd0\xb1\xa2\xc1\x6c\x06\x48\xc8\xca\x73\
\x29\xb3\x69\x06\x4a\xb0\x80\x5a\xd1\xd9\xa2\x9e\x2d\x95\x2f\x23\
\xb3\x00\xd6\x60\x9b\xb7\xfd\x24\x2d\x87\xa6\x55\x59\xc6\x28\xee\
\xb9\xe7\x1e\x84\xa1\x0f\x10\x82\xaf\xfb\xfa\xaf\xc7\xdb\xee\xb8\
\x1b\xcc\x61\xf8\x1b\xdf\xfe\xed\xf8\xcb\x5f\xfe\xe5\x78\xff\xaf\
\xfd\x06\x3e\xf7\xf8\x67\xf1\xee\xb7\xde\x8a\x44\x08\xbc\x7a\xe6\
\x8c\x12\x88\x38\x6c\xb1\x32\xde\x81\xd1\x86\x2c\x7c\x7d\x3d\x9b\
\x3d\x31\x58\x53\x5d\x39\xaf\x89\xb1\x6b\x0b\x54\x2d\x30\xbd\xee\
\xe0\x64\x38\x6c\x15\x00\x49\x1a\x80\x44\x50\xb4\x2b\xaa\xba\xac\
\xfc\xef\x3a\x36\xe5\xd4\x80\x93\x3b\x07\x9c\xfc\x0a\x70\x1a\x01\
\x08\x39\x4f\x46\xdb\x5b\x17\x07\x00\xc2\xd5\x43\x87\x97\x9e\x7a\
\xe4\x84\xcf\x39\x67\xf7\xdc\xf7\x60\xd6\x7b\xea\xf5\x7a\xe8\xf5\
\x7a\x08\xb7\xb7\xb1\xb7\xbb\x8b\xc9\x70\x00\xc2\xc6\x88\xa7\x3e\
\x98\xeb\xc1\xf5\x02\x44\xe3\x31\xa8\xe3\xc0\x0f\x3b\x70\xfd\x00\
\xcc\x55\x2e\xdd\x8c\x39\xa0\x0e\xd3\xbe\x73\x2c\x2f\xc9\x69\x63\
\x56\xa6\x3d\xd7\x80\x5c\xcc\xa0\xe2\x39\x12\xed\xeb\xa7\xf6\x81\
\x94\x1d\x10\x89\x5c\x22\x4e\xb5\xf8\x00\x79\x1f\x44\x65\x02\xea\
\x01\x5b\xa9\xcf\x21\x52\x90\x03\xd5\xd7\xd5\xcc\x4c\x08\x35\x60\
\xcc\x08\x78\x2c\x11\x49\x01\xcf\x75\x30\x1d\xc7\x38\xf1\x27\x9f\
\xc4\xab\xcf\x3f\x8f\xc9\x68\xa4\x9d\xc2\x51\xcb\x94\x72\x66\x67\
\x88\x21\xca\x82\x08\x03\x98\x6c\xbf\x6f\x32\x26\xd3\x03\xb0\x9a\
\x2d\x91\xca\x6a\x1e\xb1\xb1\xa5\x86\xfb\xb6\x10\x02\x87\xd6\x57\
\x55\xbc\x09\xd4\x0c\x12\x01\xc1\x1d\x6f\xbf\x0b\xff\xaf\xef\xf8\
\x0e\x5c\x73\xcd\x35\xf8\xea\xaf\xf9\x06\x50\x46\x91\x32\x6d\xca\
\x28\xbe\xea\x2b\xff\x22\x38\x17\x78\xe1\xe5\x97\x31\x19\x8f\xb1\
\xb7\xbd\x0d\xea\xb0\x46\x20\xd2\x04\xa8\xc8\x55\xc6\x28\x4a\x09\
\x9e\x7e\xfa\xe9\xd4\x91\x65\x11\x70\x92\x96\x3e\x53\xbb\x5a\x60\
\x7a\x43\x30\xa7\x52\xbe\x6a\x26\x27\xb7\x59\x16\x55\x7d\x5f\x05\
\x4e\x65\xa0\x62\x73\xca\x7a\x36\x70\x2a\xab\xf6\xc6\x75\x00\x05\
\x20\xdc\xbe\x74\x71\x04\x20\x5c\x5d\x3f\xbc\xf4\xd4\xa3\x27\x7c\
\xce\xb9\x73\xf7\x7d\x0f\x66\x8e\x12\x2b\x2b\xab\x58\x59\x59\xc5\
\xce\xce\x36\xf6\x76\x77\x30\x19\x0d\x91\xb0\x09\xb8\x3b\x05\xd3\
\x02\x88\x64\x3a\x01\x75\x1c\x30\xc7\x83\xe3\x69\x70\xd2\x99\x49\
\x54\x47\xb4\x53\x9a\xbb\x3d\x50\xa3\xe4\x96\xfe\x5c\x0a\x01\x91\
\x24\x90\xda\xd3\x4f\x68\x80\xa2\x80\x8e\xd9\x36\xe6\x97\xa0\x67\
\x88\x74\xb6\x95\x24\x50\x61\x86\x52\xf5\x8a\x28\xd1\xb1\xeb\x82\
\x43\x72\x40\xa6\x4a\x3e\x21\x00\x2d\x01\xe7\xb1\x04\x75\x1c\x70\
\x29\xb0\xb9\x75\x11\xa7\x4e\x9e\xc0\x99\x17\x5e\xcc\xa2\x35\x0a\
\xbc\xa4\x12\x90\x60\xcc\x31\x61\x56\xa5\x67\x0e\xca\x56\xdd\x46\
\x41\x99\x67\x32\xb1\x66\x6c\x89\x34\xdc\xe5\xf3\x12\x60\xf5\x15\
\x57\x96\x97\x55\x5f\x28\x95\xe5\x83\x20\x0c\xbb\x78\xef\xdf\xfa\
\x01\xfd\x18\x4a\xb7\x4a\x28\x38\x17\xa0\x8c\x62\xf3\xdc\xb9\xac\
\xef\x57\x00\x49\x1b\x99\x23\x55\x40\x75\xb0\x7e\x12\xa9\xbb\xcc\
\xc2\x22\xb7\xb6\x2e\x45\xfa\xb3\x61\x96\xf3\x22\x4b\xaf\xa9\xa9\
\x3a\xaf\x5d\x2d\x30\x7d\xc1\x99\x93\x09\x4a\xb0\x00\x54\xd3\xa3\
\x0a\xa8\x98\x05\xa0\x4c\xf6\x64\x03\xa7\xb2\x6a\x6f\x52\x62\x50\
\xe3\x8a\xfe\x53\x06\x52\xdb\x5b\x06\x40\x3d\xf2\xb0\x2f\xa5\x70\
\xef\xba\xf7\x81\x6c\x30\x77\x65\x65\x05\x2b\x2b\x2b\xd8\xd9\xde\
\xc6\xee\xee\x0e\x26\xe3\x01\x30\xa1\xaa\x84\xe7\x79\x60\x8e\x07\
\xea\x4c\x41\x46\x4a\x6c\xc0\x1c\x17\x8e\xeb\x81\x3a\x6a\xe6\xc9\
\xc9\x92\x51\x73\x60\x52\xd7\x51\x73\x48\xca\x73\x55\xbb\x48\x70\
\xae\x41\x85\x67\x91\x15\xb9\xbb\xb7\x62\x3c\x84\x68\x87\x02\xa3\
\x5f\x44\x1d\x40\x24\x12\x5c\x0a\x10\x29\xc0\xa5\x00\x38\x57\xc3\
\xb6\xae\x72\xba\x8e\xb9\x8a\xf4\x90\x9c\x62\xef\xf2\x16\x5e\x7e\
\xf6\xf3\xd8\x3c\x7b\x16\xd1\x78\xa2\x7d\xef\x4a\x9b\x9b\x15\x88\
\xca\x5f\x49\x9e\xf6\x6b\x29\xe1\xd9\x00\x8d\x14\xfc\xf4\x6c\x25\
\xbc\x45\xd8\x12\x69\x96\xc7\x34\xfb\xe0\xf2\x37\xb7\x94\x08\x03\
\x5f\xa9\x28\x8d\xc7\x5e\x00\x98\xfc\x07\x90\x40\xe6\x1a\xae\x98\
\x08\x5d\x88\xdf\x90\x46\x77\x95\x2c\x00\x38\xcd\x1e\x37\x01\xf0\
\xd2\x0b\x2f\x0e\x0c\x60\x32\x59\x53\xd3\x72\x1e\xd0\x9a\xb8\xb6\
\xc0\xf4\x05\x02\x27\x7b\xca\x58\x11\x9c\x60\x01\xa8\xaa\x7f\x97\
\xbf\xa7\x15\x20\x55\x55\xe2\x9b\xa7\xd8\x4b\x23\xdf\xcb\xe5\xbd\
\x49\xa9\xff\x34\x6e\x02\x50\xdd\xfe\x52\xff\xa9\x47\x4e\x04\x52\
\x0a\x4f\x01\x94\x3e\xab\x5e\x5d\xc5\xf2\xea\x2a\x86\x83\x7d\xec\
\xee\xec\x60\x38\x18\x20\x9a\x0c\xc1\x98\x9b\x31\x28\xea\xa8\x5e\
\x53\xa4\xe3\x2a\x98\xe3\xc2\xf5\x3c\x50\xe6\x64\x8c\x89\x64\xc0\
\xa4\x63\xd1\xf5\x46\x4c\x75\x44\xbd\x94\x4a\x3e\x2e\xb5\x43\xb8\
\xf9\xd9\x17\x3c\x81\xe0\xaa\x54\x48\x1c\x06\x21\xa8\x02\x31\x9e\
\x28\xb6\x23\x18\x20\x19\x88\x74\x00\x4a\x21\x92\x08\x7c\x4a\x32\
\x31\xc4\xde\x68\x84\xf3\xa7\x4f\x63\x7b\x73\x13\xd1\x64\xa2\xa2\
\x35\x1c\x56\xb4\x43\x2a\x6f\x68\x75\xc0\x54\x2e\xe7\xc1\x54\xe1\
\xd5\x83\x52\x41\xf4\x40\xca\x45\x39\xb3\x27\x55\xc3\x96\x50\x2c\
\xfd\x2d\x5a\xc6\x4b\x17\xe7\xb9\x79\xae\xc9\xb0\x48\x05\x22\x10\
\x42\xb4\xc1\x6f\x9e\xce\x8c\x34\x8a\x5e\x8a\x6c\xa8\xdb\x5e\x9b\
\x9b\x4f\x81\xe6\x83\xed\xc1\x1a\x53\x9b\x9b\x1b\x7b\xfa\xfd\x3e\
\x9e\x53\xce\xe3\x35\xe5\xbc\x16\x94\x5a\x60\xfa\x82\xb3\x27\xcc\
\x29\xeb\x55\x54\xfd\x2b\xc1\xcb\xfc\x7e\x1e\x40\x31\x0b\x7b\x72\
\x50\x1c\xe2\x8d\x2c\xe5\xbd\xe9\x95\x00\xd4\x70\x7f\x6f\x94\xcf\
\x42\x95\x00\x4a\x02\xbd\x5e\x1f\xdd\x9e\x72\x24\x1f\xec\xef\x61\
\xb0\xbf\x8f\xd1\x68\x90\x31\x22\xe6\xb8\x1a\xa4\x1c\x24\x94\x21\
\x9e\x50\x9d\xad\xa4\xc2\xfe\x88\x56\xce\x39\x3a\xd2\x3c\x1d\x5c\
\x4d\x95\x75\x6a\xa3\xd4\x89\xb7\xf9\xfe\x9d\x53\x59\x4a\x21\x39\
\x83\xe4\x2a\x43\x89\x50\x02\x29\x14\x60\x49\x46\x91\xc4\x14\x89\
\x1e\xa2\x05\xa4\x0a\x2a\xe4\x09\xb6\x37\x37\xb1\xbf\xb3\x83\x38\
\x9a\x2a\x39\xb9\xe3\x98\x44\xc0\x86\x48\xa5\xfd\xd4\xce\x94\x80\
\x9a\x7e\x52\xb9\xaf\x64\xf9\xdd\x2a\x10\x9b\x71\x74\x98\x51\xe2\
\xcd\x13\x3d\xcc\x96\xf1\xaa\xb6\xf7\x5e\xb7\x93\x89\x52\xec\xd7\
\x2d\x3a\xbd\xff\xe2\x3f\xff\x05\xbc\x74\xfa\x34\x6e\xbc\xf1\x26\
\x74\xba\x5d\xbc\xe5\x96\xb7\x60\x34\x1c\x62\x79\x65\x05\xb7\xde\
\x7a\x2b\xa0\x47\x11\x98\x3e\x41\x31\x55\x98\x42\xc7\x5f\xe4\x99\
\x59\xa8\xb6\x6b\x68\x52\xc6\x6b\x80\x51\x04\x2a\x05\xfa\xd5\xd3\
\xaf\x6c\x58\x80\xe9\xa0\xe5\xbc\x76\xb5\xc0\xf4\x86\x00\x28\x5b\
\xa9\x6f\x26\x8d\xba\xe2\xf3\x53\x07\x54\x4d\xd8\x13\x43\x3e\x2b\
\x55\x55\xde\x8b\x1a\x00\x54\x60\x29\xf3\xd5\x02\x54\xa7\xd7\xeb\
\x3f\xf5\xc8\x89\x50\x4a\xe1\xe7\x00\xa5\xa2\xde\xd7\xfd\xc3\x58\
\x5b\x3f\x84\xc1\xfe\x3e\xa2\x48\x01\xd5\x70\x30\xd0\x4e\xe4\x4c\
\xf7\x9f\x34\x33\xd2\xa0\x94\x6e\x54\x84\x92\xac\xd4\x97\xf5\xa7\
\x74\xdf\x49\x24\x89\xb2\x35\x92\xb2\x60\xf1\x93\xfe\x9b\xc7\x14\
\xdc\x89\xc1\x1d\x47\x9b\xb6\xaa\xb3\xf5\x28\x55\xfb\xe9\xf4\xde\
\xe9\x70\x80\x78\x3a\x45\x12\xc7\x48\xa6\x53\x2d\x69\x77\x4a\x66\
\xb7\xb3\x60\x34\xbb\xf9\x95\x99\x0c\x99\x55\xe8\x19\x97\xcf\xb0\
\x24\xcc\x8a\x25\x8a\x7d\xa5\xea\xb2\x61\xf1\x7e\x91\x32\x49\x5a\
\x8c\x2d\x91\xd9\xdb\x90\x52\xe2\xc6\xeb\xae\xcd\x72\xb7\x66\xaf\
\x46\x66\x36\xf8\xf7\xbd\xef\x7d\x2a\xf8\xaf\x6e\x93\x71\x1c\x78\
\xbe\x8f\x43\x87\x0e\xe1\xee\x7b\xee\xc1\xa1\x43\x87\x71\xed\x75\
\xd7\xe2\xa6\x9b\x6f\x46\x14\xc5\x58\x5a\xea\xe3\xba\x6b\xaf\x03\
\x21\x04\xbe\xef\x17\x9c\x3d\xd2\x12\xa3\x19\xa7\x2e\xe5\x41\xb0\
\xa0\x08\xa8\x49\x12\x0f\xf4\xfb\xdb\xc6\x9a\xca\x16\x45\xad\x5c\
\xbc\x05\xa6\x2f\x2e\xb0\x92\xc5\x0c\x06\xb3\xc4\x41\x6a\x4f\x61\
\xeb\x4b\x80\x65\x06\x95\x1e\xbc\x06\xa0\x92\x12\x8b\x4a\x01\xca\
\xec\x3f\x4d\x2d\x3d\xa8\x32\x40\x85\x16\x90\x1a\x01\x08\x47\x83\
\xc1\x68\x34\x18\x84\x9d\x5e\x6f\xe9\xa9\x47\x4e\x84\x80\xf4\xee\
\x7c\xd7\xfd\xc4\x34\x59\xed\x2f\x2d\x01\x80\x06\xa9\x3d\x4c\x27\
\x13\xec\xef\xed\x61\x3a\x19\x63\x3c\x1a\xe6\x8c\x89\xe5\x8c\x89\
\x32\x86\x98\x52\xc5\x9a\xf4\xc6\xce\x98\x02\x1a\xd7\x73\x41\xa9\
\x93\x39\xa7\xa7\xb9\x48\x94\x10\x0d\x72\x14\xf1\x74\x92\x0f\xf4\
\x42\xf5\xa9\x08\x94\xcc\x3c\x15\x54\x08\x9e\x5b\x1d\xa6\x22\x09\
\x1b\x00\xd9\xb7\xb4\xd9\xba\x52\x19\x64\x2a\x41\x6a\x4e\x09\xd0\
\x2a\x76\xa8\x00\x25\x93\x41\x91\x99\xde\x12\x39\x30\x5b\x32\x97\
\xeb\xb9\x15\x2c\x64\xd6\x9d\x5c\xa2\xba\xec\x69\xae\xd4\x86\xea\
\x95\xe1\x10\xaf\x9c\x3e\x0d\xcb\x66\x9f\xdd\xaa\xe3\x38\x34\x08\
\x02\x7a\xf8\xc8\x11\x7a\xcd\xb5\xd7\xb2\x6b\x8e\x5d\x83\x5b\x6f\
\xbb\x15\xb7\xdc\x72\x2b\x00\x60\x75\x6d\x15\x87\x0f\x1f\xd1\x20\
\xe6\xa9\x93\x1e\x63\x26\x2e\xf5\x68\xcc\xcc\x7f\x4b\x51\x29\x84\
\x12\x4c\xa6\x53\x6c\x6e\x6e\xbe\x04\x60\xa8\xdf\xdb\x75\x7d\xa6\
\x3a\xf7\x87\x16\x9c\x5a\x60\xfa\xe2\x45\xac\x32\x70\x11\x5b\x8d\
\xa6\xf8\xd5\x54\xf9\x89\x05\x01\xca\x2c\xf3\x99\xe0\x14\x95\x7a\
\x50\x55\x00\x55\xa5\xe2\x9b\x01\x28\xc7\x75\x7b\x4f\x3d\x7a\x42\
\x0d\xeb\xbe\xeb\x7e\x22\x8d\xa8\x74\x00\x2a\x7c\x70\x69\x19\xeb\
\x87\x8f\x60\x3a\x9d\x60\x3c\x1a\x21\x49\x62\xec\xed\xec\x20\x8e\
\x63\xc8\x84\x63\x3c\x1a\xe4\x8e\x11\x80\x06\x2b\x96\xcd\x41\x51\
\x63\x50\x37\xdd\xac\xcd\xe6\xbc\x94\x12\x9d\x4e\x17\x9e\xef\x2b\
\x97\x5d\x29\x21\x25\x07\x91\xba\x19\x9f\x06\x1b\x6a\xa5\x59\xbe\
\x47\x17\x63\x36\xaa\xf6\x18\x52\x51\x26\x33\xc5\x09\xd5\x65\xbb\
\xfc\x9c\x63\xf6\xfa\xe6\x6d\xcf\x82\xd9\x0c\x28\x81\x58\xc8\x1c\
\x99\xc1\xa3\xfa\x94\x5f\x3b\x5b\xca\xef\x1b\x81\xef\x79\xea\x79\
\x9d\xab\x4c\x20\xe0\x3c\xd1\x03\xb9\x73\x57\x6c\x61\x22\xe5\x8d\
\x1e\x00\x48\x92\x24\x64\x30\x18\xd0\xc1\x60\x40\x5f\x7a\xf1\xc5\
\x72\xc5\xa0\x90\x16\xed\xba\x2e\xf1\x7d\x1f\xcb\x2b\x2b\xb8\xfe\
\x86\x1b\xd8\x75\xd7\x5d\x4f\xef\xba\xe7\x6e\xf7\xd8\xb1\x63\xd4\
\x75\x3d\xac\xad\xad\xb1\xd5\xd5\x55\x4a\x29\x45\x10\xe4\x4c\x8c\
\x27\x1c\x00\x06\x06\x30\x8d\x1a\xf4\x99\x5a\x57\xf1\xd7\x71\x91\
\x83\xd1\xe2\x37\xd8\x83\x20\xe4\x0b\x09\x40\x57\xe3\xfe\x93\x05\
\x4a\x7c\x66\x99\x6f\x9e\xc5\x91\x6d\xf6\xa9\x6a\x40\xd7\x2b\xb1\
\x27\xbf\x06\xa0\xd2\xa3\x03\x20\x64\x8c\x75\xfb\xcb\x2b\x3d\xe6\
\x38\xfe\x5d\xef\xba\x9f\xda\x31\xb9\xa8\xfe\xe2\x7a\xb8\x75\x34\
\x1c\x64\x42\x80\x24\x8e\xb1\xbb\xb3\x5d\xd8\x3b\xa3\x89\x0a\xe2\
\xeb\x74\x7b\x9a\x49\x31\x84\x9d\xae\x62\x4d\x7a\x70\xd6\xd5\xaa\
\x3f\xe8\x19\xa9\x74\xaf\x28\xfe\xdb\xe8\x61\x94\xf6\x12\x59\xf9\
\x4d\x99\x50\x11\x0b\x00\xd8\x58\x10\xaa\xd9\x52\x2d\x28\xe5\x00\
\x41\x2c\x65\x43\xfb\xed\x98\x00\x35\x2b\x52\x20\x75\x40\x54\x7a\
\x8c\x51\x14\xe3\x97\x7e\xe6\x9f\xe0\xe6\x1b\x6f\x9c\xbb\xdb\x12\
\x42\x30\x1a\x0e\xb1\x7e\xe8\x70\xdd\xd5\xa6\x0d\xd8\x88\xe9\x49\
\x49\x50\x3d\x46\x91\x5e\x5e\x7e\xb5\x44\x89\xd5\x98\x59\x68\x69\
\x50\xe7\x34\x08\x02\x1a\x76\x3a\x58\x5b\x5d\xf3\x24\xe4\xf8\xc5\
\x17\x5e\x78\xa2\x04\x4c\x63\xe3\xb0\xf5\x9c\x22\xe3\xb6\x79\x45\
\x89\xef\x0d\xb9\xbf\xb4\x8c\xa9\x5d\x57\xc2\xae\xa4\xa5\xfc\x67\
\x1b\xec\x15\x06\x93\x32\xdd\x26\x98\x85\x45\x39\x46\x99\x6f\x5e\
\x89\xcf\x2c\xf5\x99\x2c\x6a\x82\xea\x3e\x94\x1e\xd6\xe5\xa3\x9d\
\xcb\x5b\x03\xc6\x58\xef\xf1\x87\x3e\xdd\xd1\x6e\x12\xec\x9e\xfb\
\x1e\x2c\x61\xad\xcc\x4a\x2a\xa9\x65\x91\x1f\x04\x69\x0d\x06\x12\
\x52\x6f\x74\xd2\x88\xd1\x50\x7b\x17\xa5\x6c\xf6\x43\xaa\xbf\x37\
\xcb\x37\xc4\x0a\x85\x86\x6d\x2d\x31\xea\x50\x98\xed\x2f\x49\x52\
\x55\x7f\x2d\x32\x91\x82\x62\xcd\x2c\x93\x11\x52\x3a\x61\x2a\x03\
\xd1\x01\x98\x92\x4d\x12\x3e\x03\x4a\x15\xfd\xa0\x39\xa0\x84\xd2\
\x7d\x77\x5c\xa7\x7a\x82\xaf\xb4\x28\xab\xf4\xc1\x13\xc6\xa6\x6f\
\x4a\xb2\x4d\x36\x62\x6e\xee\xb2\xf4\x5e\xb7\x01\xd2\x0c\x63\xc2\
\x6c\x16\x9a\x99\x87\x66\x82\x53\x34\xd1\x6b\xfb\xf2\xe5\x89\xbe\
\x4f\x65\x40\xaa\xeb\x31\xd5\x99\xb8\xb6\x8c\xa9\x05\xa6\x16\xa0\
\x50\x94\xaa\x97\x81\xca\x04\x29\x86\xa2\xa9\x6c\xb9\xc4\x67\x96\
\xfa\x6c\x3d\x28\x9b\x8a\xaf\x09\x40\x85\x00\x3a\x2b\x6b\xeb\xfd\
\x74\x58\xd7\x04\xa8\x34\xae\x3c\x1b\x49\x92\x35\x9f\x6d\x02\x1d\
\x99\x80\x4c\xfc\x20\xb3\x06\x42\xba\xcb\x4a\x10\x49\xd4\x80\x6d\
\x65\xdd\x4a\x03\x92\x34\x76\x5c\x62\x41\xa1\x6c\xd7\x93\x25\x99\
\xe5\xec\x46\x5e\x64\x47\x26\x10\x90\x59\xf5\x5e\x0d\x4b\xb2\xb2\
\xaa\x0a\xa0\xa9\xeb\x2b\xd9\x0c\x5e\x9b\xd4\x11\xd2\xdf\x93\x52\
\x82\x32\x06\x87\xb1\x66\x2c\x1f\xc0\x74\x3a\xb1\xfd\x28\xd1\x65\
\xb2\x79\xe2\x02\xb3\x7f\x63\xbe\x09\xe6\xb9\xa5\x94\x3f\x17\x65\
\xaf\x4a\x93\x35\xc5\x06\x40\x4d\x8d\x63\x52\x02\xa4\x26\x3d\x26\
\xf1\x7a\x30\xa4\x76\xb5\xc0\xf4\x67\x09\xa0\x44\xe9\x2c\xd3\x66\
\x28\xcb\x0d\x16\x55\x66\x50\xe5\x5e\x54\x59\xc9\x57\x56\xf1\x55\
\x09\x25\x52\x37\x89\xce\xce\xe5\xad\xa1\x01\x50\xc1\x0c\x40\x65\
\x3b\xa7\x04\x64\x6a\x18\x24\x8b\x1b\xbf\x59\x76\xd3\xa0\x44\x0a\
\x08\x24\x21\xe5\xac\x59\x69\x7d\xa8\x69\x19\x9c\xaa\xb7\xeb\x99\
\xdb\x29\xcf\x18\x11\x0b\x18\x59\x4a\x6c\x05\x55\x9d\xad\xdf\x64\
\x65\x4a\xb6\xdf\x29\x32\xa4\xd9\xb2\x62\x09\x94\x6a\xd8\x51\x19\
\xb9\xa4\x94\xe8\xf7\xba\xe8\xf7\xfa\x8d\xb7\x5c\xdd\xab\x29\x33\
\xa5\x01\x80\x7d\xe4\x3d\x9c\x61\x05\x6b\x2a\xb3\x91\x02\x19\xab\
\x61\x4b\xa4\x06\x98\x6c\xe0\x94\x94\xca\x71\x53\x4b\x89\xd1\x26\
\x15\xb7\xf5\xc2\xaa\xa4\xe2\x2d\x48\xb5\xc0\xf4\xa6\x07\x28\x69\
\xf9\x90\x56\xf9\xf6\x71\x03\x94\x78\xa9\xc4\xc7\x4a\x0c\xca\x56\
\xe2\xab\x2a\xef\xd9\x64\xe6\x8d\x00\x4a\x0a\xe1\xde\x75\xdf\x03\
\x85\xe0\x42\x10\x99\x6f\xa7\x59\x2b\x48\x16\x37\x52\x3d\xf3\x52\
\x06\x25\x62\x7c\x5f\x43\x9b\xb4\x82\xcc\xb2\x85\xd8\x44\xfe\xb2\
\xa2\x9c\x57\xa2\x33\xa4\x34\x50\x64\x2f\xad\xd9\x66\x90\xca\xce\
\x0e\x8b\x81\x12\xa9\x00\xa8\xd9\xbb\xd9\xdc\x97\xce\xec\xd9\x35\
\xa3\x4c\x04\xfb\x83\xfd\xf2\xa5\x23\x0d\x44\x03\xe3\x28\x97\xf4\
\x6c\x73\x42\xa6\x3a\xaf\xca\x11\xa5\x0e\x98\xca\xac\x49\xa0\xe8\
\xde\x50\xc7\x9e\x22\x4b\x09\xaf\xcc\xe8\x38\x5a\x8f\xbc\x16\x98\
\xda\xb5\x30\x40\xf1\x1a\x16\x55\x55\xe2\x63\x15\x0c\x2a\xb6\x80\
\x54\x0a\x4e\xd3\x12\x50\x35\xf5\xe3\xcb\x00\x4a\xb9\x49\x9c\x0c\
\xa4\xe0\xde\xdd\xf7\x3d\xa0\xdb\x44\xe6\xae\x2a\x8b\xa5\xa9\x94\
\x35\x15\x54\x74\xb2\xb4\x61\xab\xef\x0b\xe5\x37\x83\xee\x48\xeb\
\x16\x9d\xef\x2f\xb2\x0c\x46\x74\x76\x23\x9f\x2d\xe9\xd5\x80\x51\
\xb9\x2f\x34\xc3\xb4\xec\x8c\xe9\x20\xa0\x64\xcd\x68\xb2\x29\xf2\
\xac\x40\x55\xee\x87\x95\xde\x45\x73\xd6\xc4\xb0\x23\xd2\xef\x9b\
\x91\x71\x0c\xe6\xb0\x26\x33\x5e\xa2\xaa\xcf\x44\x1a\x00\x13\x6a\
\x58\x13\xaf\x00\xa8\xc8\x72\xcc\x03\xa5\x2a\xa9\x78\x0b\x54\x2d\
\x30\xb5\x00\x55\xd8\x44\x66\xf7\xdd\xf2\x87\x5b\x96\xca\x7c\xb6\
\x12\x5f\x15\x83\x72\x4a\xe5\xbd\xaa\x12\x5f\x59\x6a\x1e\x62\xb6\
\x0f\x95\x01\x54\x1a\x5c\xd8\xe9\xf5\x7a\xa7\x1e\x39\xd9\x91\x92\
\x7b\x77\xdf\xfb\x40\x71\x07\x95\x46\x97\xa7\xc0\x9a\x34\xfc\x18\
\x8f\x5f\xa6\x4c\x09\xb3\x23\x49\x65\x3b\x8e\x22\x42\x65\x19\xbe\
\x0d\x2c\xd7\x88\x9d\x75\x90\x72\x4c\x3a\x2c\xec\xc8\x02\x48\x55\
\x8c\x8b\x94\xe4\x1a\x4d\x41\x89\x94\xff\xc6\xec\xe3\x20\xa8\x54\
\x75\xa8\x1a\x9c\x90\x38\x7c\x68\x1d\xbe\xe7\x35\xde\x6a\xb7\xb5\
\x82\x32\xc5\x29\xe4\xbd\x9b\x51\x89\x3d\x8d\x2a\x58\x53\x59\x9d\
\x57\xae\x06\xd8\x40\xc9\x56\xde\x36\x59\x93\x34\xc0\xa4\x0e\x9c\
\x6c\x47\x82\x59\x9f\xbc\xd6\xc0\xb5\x05\xa6\x76\x5d\x05\x80\x92\
\xa8\x17\x49\xd8\x58\x94\x8d\x41\x39\xc6\x07\xb6\xca\x4d\xc2\x9c\
\x85\x0a\x8c\xcd\xa9\x4a\x28\x91\x01\xd4\x68\x30\x18\x8e\x06\x83\
\x4e\xa7\xd7\xeb\x9f\x7a\xe4\x64\x28\x25\xf7\x33\x80\x22\xb3\x8c\
\x49\xda\xce\xfa\x67\xca\x7b\x79\x89\x2f\xbf\x58\xe6\x25\x42\x52\
\x01\x58\xb5\x25\x2b\xfb\x35\xad\xcc\xc8\x06\x66\x65\x50\xb0\xf4\
\x84\xc8\x0c\xa2\x2c\x0a\x4a\xb5\xf0\x59\x23\x0a\x29\x3e\x6f\x42\
\x88\x85\x46\x2f\xce\x9d\x3d\x97\xe1\x1a\x8a\x7d\x1b\x53\x7a\x3d\
\xb2\x94\xf3\xa6\x15\xe5\x3c\xf3\xce\xd9\x00\xaa\xea\xe1\xd8\x4a\
\x7a\x4d\xd9\x93\x0d\x8c\xea\xca\x78\x2d\x20\xb5\xc0\xd4\xae\x03\
\x00\x94\xad\xd4\x57\x2e\xef\x91\x0a\x16\x55\x16\x49\x30\xe3\x43\
\x5c\x66\x51\x75\x25\x3e\x9b\x92\xcf\x2c\xf3\xd9\x01\xea\xd1\x93\
\x61\x3a\xac\x8b\x12\x63\x2a\xb0\x1e\xcc\xba\x36\xe4\x6a\x3d\x02\
\x9b\x64\x44\x92\x9a\x8d\x5a\xce\x41\x29\x52\x27\xa5\x20\x15\x60\
\x64\x43\x0d\x62\xb1\x36\x2a\xdd\x7e\x9d\x90\x02\x55\xa0\x54\x13\
\x69\x51\x71\x99\x8d\x76\x30\xed\x55\xd8\x74\x3d\xf1\xc4\x13\x66\
\x19\xcf\x26\x2e\x28\x03\x54\xfa\xef\x69\x89\x35\x99\x9b\x7f\x15\
\x30\xd9\x66\xfd\xca\xe5\xbc\x3a\x70\x12\x16\xe0\xb1\xb9\x88\x57\
\x95\xf0\xaa\x7a\x4c\x2d\x48\xb5\xc0\xd4\xae\x3a\x80\xc2\xc1\xa4\
\xe6\x55\xb3\x50\x36\xf6\x94\xaa\xf8\x4c\x16\x65\x2b\xf1\xcd\x33\
\x8c\xad\x04\x28\xc7\x75\xbb\x4f\x3d\x7a\xa2\x2b\xa5\xf4\xef\xbe\
\xf7\x7e\x5a\x28\xeb\x59\x37\x5a\xa9\x4b\x7c\xc5\xdd\x56\x9a\x88\
\x34\xb3\x11\xcb\x42\xd9\xd0\xd0\x5c\xd4\x52\x27\xfb\x9e\x3d\x1f\
\x8c\x8a\xff\xac\x00\xa4\x99\xdb\xb7\x80\xd2\x8c\x96\xdc\xf6\x7d\
\x93\x12\x1e\xb1\xbd\x89\xd0\xed\x74\xd0\x2c\xd8\x5c\x5d\xff\x33\
\x0f\x3d\x6c\x02\x93\x0d\x9c\xd2\x63\x8c\xd9\x01\xd6\x72\x39\xaf\
\x2c\xc1\x6e\x02\x4a\x55\xac\xa9\x4a\xad\x67\x63\x50\x65\x20\x2a\
\x7f\x15\x96\x52\x61\xcb\x9c\x5a\x60\x6a\xd7\x01\x40\xea\x4a\x67\
\xa1\xcc\x0f\x70\xd5\xb0\xae\x8d\x41\x35\x99\x85\xaa\x05\xa8\x24\
\x8e\x87\x97\x36\x2e\x74\x18\x63\xdd\xcf\x7e\xe6\xd3\x5d\xe6\xb8\
\xbe\x14\x9c\xdd\x73\xff\x83\x15\x16\x0d\xa4\x54\xa2\x93\xb9\xea\
\xdc\x52\xe6\x53\xcf\x11\xb1\xe1\x4a\xd3\xba\x9e\x05\xe8\x6a\xc0\
\x68\x2e\x20\xcd\xf6\x96\xac\x40\x57\x13\x3f\x41\x2a\xee\x07\xa9\
\x40\x2b\x9b\x61\xad\x90\x12\x2b\xcb\x4b\xd5\x91\x1f\x96\x37\xd3\
\xc5\x8b\x97\xd2\x6f\x39\xec\x02\x83\x32\x40\x55\xcd\x0c\x95\xe7\
\x99\xe6\xc5\xc5\x54\x01\x93\x8d\x39\xd5\x95\xf7\xaa\x80\xa8\xcc\
\x92\xaa\x32\x98\xda\xd5\x02\x53\xbb\xae\x02\x40\xd9\x9a\xcb\xb6\
\x59\xa8\x26\xc3\xba\xe6\xa0\xae\xcd\x97\x6f\xde\x2c\x54\x2d\x40\
\x71\xce\x87\xe9\xb0\xee\xea\xa1\xc3\x4b\x4f\x9e\x3c\xe1\x49\x59\
\x9c\x85\x2a\x9f\xf1\x13\x2b\x50\x21\x77\xf0\xac\x13\x08\xd4\xec\
\x3a\xb5\x99\x40\xa4\x62\xcb\x27\x16\xc8\x20\x33\xf1\xaf\xb3\x00\
\x57\xa7\xee\xab\x02\xa5\x79\xf3\x4a\x75\x25\xc9\x4c\x8d\x2f\xb1\
\xb6\xba\xaa\x80\x49\xca\xf9\x60\x2d\x25\xf6\xf6\xf6\x4c\x60\x6a\
\xa2\x80\x33\x01\xca\xd6\x67\x2a\x0f\xda\xa2\x82\x2d\x2d\x02\x4e\
\x75\x00\x65\x63\x46\x36\x40\xb2\x29\xf1\xa4\x94\x52\x7e\x21\xed\
\xd0\x5a\x60\x6a\xd7\x9f\x15\x80\x22\xa8\x56\x3f\xd9\x44\x12\xf3\
\x86\x75\x13\x54\x2b\xf9\x6c\x42\x09\x5b\x1f\xaa\x16\xa0\x00\x8c\
\xb6\x2f\x5d\x1c\x66\x00\xf5\xc8\x09\x5f\x0a\x13\xa0\xaa\x36\x5d\
\x99\x2a\xcf\x67\x7e\x26\xad\xdb\x59\xdd\x66\x4c\x2c\x5f\x48\x0d\
\x82\x5d\x05\x40\x2a\xdd\x5e\xb5\xca\xcf\x0e\x4a\x55\x31\x1e\xf5\
\xc1\x7b\x0d\xab\x53\x84\x40\x08\x8e\xcd\xcd\x8b\xe9\x25\x65\xe6\
\x61\xeb\xe1\x44\x15\x40\x55\x16\x40\xd8\xa2\x63\x9a\x02\x53\x1d\
\x38\xc9\x0a\xe0\x11\x16\xf0\x92\x73\x8e\x76\xb5\xc0\xd4\xae\xd7\
\x91\x41\x01\x07\x1f\xd6\xad\x62\x50\x2e\xec\x3d\x28\xdb\x2c\x54\
\x88\xa2\x50\xa2\x0c\x50\x2a\xfa\xfd\xd0\xe1\xa5\x53\x8f\x9c\x08\
\x84\x10\xce\x3b\xee\x7b\xb0\x92\xe7\xcc\x38\x0e\x55\x66\x2f\xe9\
\xeb\xcf\x65\x4b\x55\x75\x3f\x62\xbb\xb9\xd9\xcb\x6d\x49\x28\x55\
\x60\x77\x10\x50\xc2\x82\xa0\x44\x8a\x4d\xb9\x5e\xb7\x9b\x9d\x9f\
\x2c\xc8\x03\x6c\x8c\x64\x9e\x54\xdb\x04\x2a\xb3\xd7\x83\x86\xe0\
\x84\x86\xe0\x84\x1a\x80\x92\x0d\xc1\xa8\x8c\xda\x52\xbe\x59\xdd\
\x55\x5b\x60\x6a\xd7\x6b\x08\x50\x55\x52\xf3\xaa\x61\xdd\xb2\x50\
\x42\xc0\x2e\x35\xb7\x31\x28\xb3\xc4\xe7\x19\x67\xca\xb6\x1e\x54\
\xfa\xef\xb0\xc4\xa2\x4c\x80\x0a\x53\x80\xea\x2d\x2d\xf5\x9f\x7c\
\xe4\xe1\x50\x4a\xe9\xde\x73\xdf\x03\xb3\xa0\x62\xba\x8b\xd7\xd5\
\xf0\xe4\x9c\x1d\x8f\xcc\xdd\xfa\xeb\xd3\xf9\xe6\x32\xa4\x2a\xd0\
\x5b\xa0\xa7\x64\xfd\x3b\x0d\x41\x09\x4a\x60\x72\xe4\xd0\x7a\x73\
\x24\xe2\x02\x51\x14\xd9\x36\xff\x2a\xa9\x76\x13\xc9\x76\x95\xf2\
\x8d\x54\xa2\x70\x7d\x35\xb6\x09\x40\xc9\x8a\x9f\x03\xf6\x41\xda\
\x16\x94\x5a\x60\x6a\xd7\x17\x08\xa0\x50\x2a\xf9\xd9\xc4\x11\x14\
\xf3\xfd\xf8\xca\xbd\xa8\x26\xb3\x50\x26\x93\x2a\xcf\x41\x8d\xcd\
\x52\xdf\x60\x6f\x6f\x34\xd8\xdb\xeb\x74\xfb\x4b\x7d\xcd\xa0\xbc\
\x02\x40\x95\x45\x07\xd2\xdc\x86\xe7\x6c\x6f\x75\x40\xd4\x34\xcb\
\xfb\x0a\x00\x69\x96\x74\x91\x5a\x36\x56\x07\x4a\x98\x73\x79\x7a\
\xcb\x4a\x95\x57\x07\xce\xb9\x25\x44\x45\x0e\x53\xd9\x89\xa1\xca\
\x64\xb5\x0a\xac\x4c\x6b\x22\x59\x03\x42\x8b\x10\x3a\x39\x07\xa4\
\x2a\x01\xc8\x06\x74\x2d\x28\xb5\xc0\xd4\xae\x2f\x3c\x40\x2d\x3a\
\xac\x3b\xcf\x8f\xcf\x16\xbb\x61\xb2\xa7\xaa\x59\xa8\xba\xe8\xf7\
\xcc\x4d\xa2\xdb\x5f\x5a\xb2\x02\x54\x55\x79\x0c\x68\xaa\x76\x68\
\xf6\x43\x52\xc9\xa7\x2c\xcc\x65\x0e\x20\x5d\x29\x28\xcd\x2b\x47\
\x96\xa9\x08\x01\x02\xdf\x6b\x00\x64\x55\xc8\x5a\xcb\x60\xaa\xfa\
\x3c\x55\x73\x43\x72\x81\x57\xa6\x49\xbf\xa9\x09\x9b\xaa\xba\x2c\
\xfb\xbe\x05\xa5\x16\x98\xda\xf5\xc6\x00\x28\x5b\xa9\xcf\xa6\xe2\
\x23\x73\x4a\x7c\x55\x0c\xaa\xac\xe4\x6b\x32\x0b\x65\xf3\xe3\xeb\
\x00\x18\x0d\xf7\xf7\x46\x1a\xa0\xfa\xa7\x1e\x39\x11\x4a\x29\xbd\
\x7b\xee\x7d\xa0\x2e\x16\xf0\x40\x20\x44\x9a\x32\xa6\x05\x19\x52\
\x15\x4b\x3a\x10\x28\x11\xb2\x10\xae\x52\x4a\xd1\xb1\x31\xa6\x8a\
\xa9\x03\x29\x44\xf9\x56\xab\xe6\x8e\xd0\xa0\x8c\x66\x13\x26\x2c\
\x02\x4e\x0b\xbf\xdd\x9b\x7e\xdf\x82\x51\x0b\x4c\xed\x7a\x03\x01\
\x14\xae\x4e\x70\x61\x5a\xe6\x6b\xc2\xa0\xaa\x4a\x7c\xf3\x44\x12\
\xe5\x12\x5f\xc6\xa0\x5c\xd7\xeb\x3d\xf9\xc8\xc3\x5d\x29\xa5\x77\
\x8f\xcd\x30\xb6\xc9\x8e\x47\x0e\xb0\x2f\x92\x2a\x8e\x42\x2a\x6f\
\xaf\x8a\x25\x55\x5e\xd6\x10\x94\x48\xa3\xfb\xa5\x43\x02\xcb\x59\
\x4c\xa5\xdb\x51\x1a\x69\x25\x13\x19\x8d\x47\x05\x5c\x43\xb5\x13\
\xf8\x41\x40\xab\xc9\xdc\xd0\x55\x07\xa8\x16\x84\x5a\x60\x6a\xd7\
\x17\x0f\x48\x5d\xc9\xb0\x6e\x9d\x92\xaf\xcc\xa0\xcc\x3e\x54\x95\
\x93\x44\xd9\x8f\xaf\x96\x41\xc5\x71\x34\xba\x78\xe1\x7c\xe8\x7a\
\x5e\xef\xc9\x93\x0f\x77\x01\xf8\x77\xdf\xf7\x80\x31\xd7\xd4\x64\
\x91\x06\x3f\x9e\xe7\x4d\x37\x07\x90\x6a\xc0\x8f\x5c\x2d\x50\xaa\
\x79\x1c\x2a\x12\x84\xc2\x71\xec\xdb\x81\x90\x12\x7b\x93\x08\x0e\
\x01\x7c\xa6\xae\xb7\xbb\xb3\x63\x03\xa6\xb2\xdd\x15\x6d\x00\x54\
\x75\xef\x3f\xb1\x00\xeb\x69\x57\x0b\x4c\xed\x6a\x01\xea\xaa\x0c\
\xeb\x96\xa5\xe6\x36\x06\x65\x96\xf8\xa6\x07\x61\x50\x71\x14\x8d\
\x2e\x5e\x38\xdf\x61\x8c\x75\x1f\xfb\xd3\x4f\x75\x1d\xc7\xf1\xef\
\xb9\xef\x01\x22\xa5\xf9\x30\x16\xc1\xa9\x05\x4c\x52\x2d\xa0\x43\
\x2a\x7f\x99\x58\x30\xa6\x89\xca\x6f\x4e\xf9\xce\x02\x8c\x26\x7c\
\x49\x29\x54\x48\x60\xbf\x37\x73\x5b\x12\xc0\xc6\x38\xc2\x34\xe1\
\x90\x42\x80\x02\xe8\x7b\x1c\x9b\xdb\xbb\x55\xc0\x54\x05\x48\xb6\
\xe8\x8a\xc6\x20\xd5\xae\x16\x98\xbe\x18\x37\xce\xf6\x95\x7c\xfd\
\x01\xea\x6a\x0c\xeb\x9a\xec\xa9\x8e\x41\xd9\xec\x8e\x16\x66\x50\
\x9c\xf3\xd1\xf6\xa5\x8b\x03\x00\x9d\xc7\x3e\xf3\xe9\x3e\x73\x1c\
\xff\x9e\x7b\x1f\x20\x85\xf7\x4f\xc3\x9e\xd3\x62\xc0\x30\x2f\x76\
\x82\x54\xdc\xd4\xc1\x41\x89\x34\x22\x4b\x24\x3b\x8d\x70\x5c\x07\
\x8c\xb2\xc2\xf5\xa5\x04\xf6\xa2\x04\xb1\x24\x70\x98\x03\xc9\x24\
\xa4\x94\xd8\x4d\x04\x56\x6e\xba\x0d\x3f\xf7\x6b\xbf\x85\x9f\xf8\
\xdb\xdf\x83\xc9\x68\x58\x05\x4a\xf3\x58\x53\xf9\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x4b\x45\xdb\
\xb5\xf0\x9b\x86\xcc\xf5\x48\xa8\x32\xe0\xb4\x45\x66\x9b\x07\xb3\
\x1c\x4e\xe9\x70\x0d\x60\x32\x95\x7c\xa6\x8a\xcf\x4c\xd5\x0d\x60\
\x8f\x7d\x4f\x8f\x8e\xf9\xb5\xbf\xb2\xd2\x0f\xc3\x4e\x20\xa5\xcc\
\x1d\xcd\xc9\xfc\x3d\xd3\xee\x71\xd7\x00\x90\x30\x47\x7e\x7e\x50\
\x50\xaa\x60\x72\x36\xd7\xf5\x24\x49\x70\xcb\xcd\x37\xe1\x67\xfe\
\xe1\xdf\x87\xeb\xba\x90\x52\x62\x12\xc5\xf8\xd8\x33\x2f\x82\x3a\
\x2e\xfa\xdd\x2e\xba\x61\x80\xc0\xf3\xe0\xb9\x0c\x8e\x06\x28\xaa\
\xfd\x5e\x29\x01\xd6\x42\x1f\x1e\xa3\x88\x39\x47\xdf\xf7\x7f\x1d\
\xc0\x65\x7d\xec\x00\xd8\x05\xb0\x07\x60\x1f\x79\xa2\x6d\x39\x9b\
\xc9\x96\x1a\xdb\x0e\xb4\xb6\x8c\xa9\x5d\xed\xba\x2a\x0c\xca\x76\
\xd9\xd5\x8c\x7e\x37\xad\x6c\xaa\x4a\x7c\xbe\xa5\xcc\x57\xd5\x87\
\x2a\x94\xf9\xf6\x77\x76\x46\xfb\x3b\x3b\x61\x7f\x69\xb9\xff\xe4\
\x89\x87\x43\x09\xc9\x66\x0c\x63\x67\x80\xe0\x60\x80\x54\xcb\x92\
\x16\x04\x25\x34\x00\xa5\xaa\xbf\x23\x25\xe0\x7a\x6e\xd6\xd3\x11\
\x42\x60\x30\x1a\xe1\xcc\xb9\x0b\xf0\x3b\x1d\x4c\xa2\x18\xa3\x69\
\x88\x6e\x18\x20\xf4\x7d\x04\x9e\x0b\xdf\x75\xe0\x31\x06\x4a\x08\
\x56\x43\x1f\x2e\xa3\x2a\x6c\x90\x52\xf4\x97\x97\x97\xf7\x77\x77\
\x2f\x37\xb8\x03\x2d\x53\x6a\x57\x0b\x4c\xed\x7a\x43\x00\xd4\x95\
\x44\xbf\x9b\xa5\xbe\x2a\x99\xb9\x99\xac\x5b\x17\xb9\x11\xc2\xae\
\xe8\x53\x00\xb5\xb7\x3b\xda\xdf\xdb\xd5\x00\xf5\x50\x28\x21\xb5\
\x61\x6c\x93\xcd\xbf\x69\xc9\xae\x1e\xb4\x16\x01\x25\xd2\xe0\x7e\
\xd5\x11\xb3\xb4\x8c\x27\x84\x02\xa6\x97\x5e\x3d\x8b\x53\xa7\x9e\
\xc2\x91\x63\xd7\x60\xb0\xb6\x86\xe5\xe5\x25\xf4\x7a\x8a\x39\x85\
\x81\x8f\xd0\x53\x00\xb5\xde\x0b\xe1\xd2\x9c\x2f\x26\x52\x62\x34\
\x18\x8c\x50\xdd\x23\x92\x73\xde\x27\xed\x6a\x57\x0b\x4c\xed\x7a\
\xdd\x01\xaa\x0c\x54\x8b\x44\xbf\xdb\x66\xa1\x6c\x91\x1b\xd1\x82\
\x0c\xaa\xca\xee\x28\x07\xa8\xe5\x95\xa5\x53\x8f\x9c\x08\xa4\x94\
\xee\xdd\x36\xbb\xa3\x3a\xb0\x21\xcd\x67\x8a\x72\xf2\xd5\xcc\xe7\
\xae\x29\x28\xd5\xfd\x5d\x21\x38\x6e\x7d\xcb\xcd\xa0\x94\x42\x08\
\x01\x2e\x04\x2e\x6c\x5c\xc0\xe7\x1e\x3d\x89\xed\x9b\x6e\xc6\xa1\
\xa3\xd7\x60\xfd\xd0\x21\xac\xac\xad\x62\x79\x69\x09\xbd\x6e\x07\
\xdd\x30\x84\xe7\xb9\xb8\x7e\xb5\x57\x28\xed\x46\x49\x02\xce\x79\
\x84\xe6\x4e\xdd\xed\x6a\x57\x0b\x4c\xed\xfa\x82\x02\x94\x4d\xe0\
\xb6\x68\xf4\xbb\x6d\x16\xca\x64\x51\xe5\x12\x5f\x95\xa3\x79\xb9\
\x07\x55\x0f\x50\xbb\x3b\xa3\xfd\xdd\x9d\x8e\xe7\xfb\xdd\x53\xca\
\x4d\xc2\xbd\xe7\xbe\x07\x4b\x72\x61\x52\x87\x1f\x68\x3a\xac\x5b\
\x5d\x85\x3b\x68\xf9\xae\x80\x78\xb3\x2f\x8e\x04\x1c\xc6\x74\x19\
\x4f\x1d\xd1\x64\x82\x33\xcf\x7f\x1e\xbb\x97\xb7\xb0\x7a\xe4\x18\
\x0e\x5d\x73\x2d\x0e\x1f\x3b\x86\xf5\xc3\x87\xb1\xb2\xb2\x82\x7e\
\xbf\x8f\xe3\x47\x0f\x21\x74\x9d\xc2\x5f\x78\xfc\xb9\xe7\x81\xea\
\x24\x58\x59\xc3\xa6\xdb\xd5\xae\x16\x98\xda\xf5\x05\x05\xa9\x83\
\x00\xd4\xbc\xd0\x42\x5b\xf4\x7b\x9d\xa3\x79\x9d\x61\xac\x4d\x28\
\x31\x02\xd0\x89\xa6\xd3\xe1\x85\x33\xaf\x76\x1c\xc7\xe9\x3c\xfa\
\xa7\x7f\xd2\x73\x1c\xc7\xbb\xe7\xbe\x07\x67\x73\x57\x17\x06\xa4\
\x83\x81\x12\x69\x08\x4a\xb5\xfa\x0d\x02\x4c\xa3\x08\x42\x8d\xa9\
\x41\x4a\x81\xe5\x6e\x07\x7b\x1b\xe7\x20\xa7\x63\x0c\x76\x77\x70\
\xf1\xfc\x79\x5c\x38\x72\x04\x47\xaf\xbd\x1e\x87\x8e\x1d\xc3\xd2\
\xca\x2a\x6e\xbc\xe6\x10\x1c\x42\x73\xe6\x25\x25\x7e\xf8\xbd\xdf\
\xf3\x04\xe6\xc7\x94\x8b\x0a\x16\xd5\x02\x56\xbb\x5a\x60\x6a\xd7\
\x1b\x0e\xa0\x16\x75\x93\x30\x81\x6a\x9e\x1f\x9f\xd9\x87\xaa\x32\
\x8c\x35\x67\xa1\x6c\x4a\xbe\x6c\x0e\x2a\x49\x92\x70\x6b\xe3\xc2\
\x10\x40\xf8\x18\xff\x54\xdf\x71\x5c\xff\xee\x7b\x1f\x80\x3d\xe3\
\x6e\x3e\x20\xd5\x63\xda\x95\x80\x52\x23\xab\x59\x38\x8e\x93\xc9\
\xc4\x09\x80\xd5\xe5\x25\x74\x7c\x07\x6b\x1d\x06\x37\x24\x18\x4d\
\x77\xb1\x7d\x76\x8c\x73\x2f\xbd\x88\xf5\x63\xd7\x60\xed\xc8\x31\
\xfc\x85\xfb\xdf\x01\x42\xf2\x17\xe8\xf4\xa5\x2d\x9c\x7a\xe4\x91\
\xe7\x51\x54\xd8\xf1\x0a\xe6\x34\x8f\x45\xb5\xab\x05\xa6\x76\xb5\
\xeb\x0d\x01\x50\x8b\xba\x49\x94\x01\xaa\x2c\x92\xb0\xf5\xa2\xca\
\xd1\xef\x55\x6e\x12\x65\x91\x84\x15\xa0\x00\x84\x97\x2e\x9c\x1f\
\x01\x08\x93\x24\xee\x3b\x8e\x6b\xd8\x1d\xcd\x43\x09\x52\x0f\x1c\
\x15\xa0\xb4\x88\x84\x8d\x34\x50\x0c\x4a\x09\x1c\x39\x74\x08\x90\
\xda\xa4\x95\x10\x1c\x3b\x7a\x04\xb7\xdc\x7c\x03\x18\x05\x3c\xcf\
\xc5\xdf\xfe\xb6\x6f\xc3\xd7\x7d\xfd\x5f\xc3\x6f\xfc\xce\xef\xe1\
\x27\x7f\xf4\xc7\x10\x47\x53\xbc\xe7\xeb\xff\x0a\xf0\x25\xf7\x28\
\xd1\x83\x10\xb8\xff\xce\xb7\x9f\x28\x81\x92\x09\x4e\x55\xd1\x16\
\x6d\x6c\x79\xbb\x66\x16\x6d\x9f\x82\x76\xbd\x81\x00\xaa\xec\x2a\
\x2d\x2a\x8e\xaa\x24\xd4\xc8\x60\x43\x53\xe4\xc3\xb6\xe9\xcc\xcc\
\x48\x1f\x43\x7d\x0c\xf4\xb1\xaf\x8f\x3d\xa8\x99\x9b\x5d\xa8\xf9\
\x9b\x1d\x00\xdb\xc6\x91\xce\xe6\x6c\xe9\xe3\x92\x79\x5c\xba\x70\
\x7e\x63\xe3\xec\xab\x97\x1e\xfb\xd3\x3f\x99\x3c\x79\xf2\x21\x49\
\x29\x2d\xa2\x09\x29\x7e\x43\xae\x18\x94\xc8\x1c\x1d\x45\x73\x19\
\xbb\x97\xf6\x8a\x88\x8a\xc0\x58\xea\xf7\x71\xe4\xc8\x21\x08\x21\
\xf0\xe5\x5f\xfe\xe5\xf8\xd6\x6f\xfb\x2e\xac\xae\xac\xe2\x07\xde\
\xfb\x3d\xf8\xdc\xa9\xcf\x82\xc7\x31\xfe\xcd\xcf\xfd\x2c\xa4\x04\
\xb8\x94\xf8\xe9\x9f\xf9\xd9\xd1\xee\xe5\xcb\x5b\x28\xc6\xa7\xd7\
\x31\x27\x51\x7a\xbd\xcb\x27\x2a\xed\x6a\x19\x53\xbb\xda\xf5\x86\
\x64\x50\xe6\x65\x07\xf1\xe3\x6b\x6a\x18\x5b\x66\x50\xf3\x32\xa1\
\xca\x65\xbe\x8c\x41\x49\x29\xc3\x8b\x17\xce\x0f\x09\x21\x9d\xcf\
\x7c\x74\xd0\xeb\xf4\x7a\x81\x10\x82\xde\x73\xff\xbb\x8b\x60\x31\
\xb7\xf6\x36\x47\xc7\x47\x9a\x14\xe8\x9a\xd3\x2b\xd7\x75\x41\x08\
\x40\xf5\x2f\x84\x9d\x0e\xbe\xff\xfb\x7f\x10\xe7\xce\x9d\xc1\xd7\
\x7c\xed\x37\xc2\xf3\x7d\x08\x29\x41\x29\x01\xd3\x7d\xa5\x27\x3f\
\xf3\x69\x7c\xdd\x37\x7f\xf3\xe4\xd9\x53\xa7\xb6\xce\x9e\x7e\xf9\
\x65\xe3\xc4\x20\x9e\xc3\x9c\xea\x58\x53\xbb\xda\xd5\x02\x53\xbb\
\xde\xd0\x00\x65\xbb\xec\xa0\x86\xb1\x66\x2f\x6a\x5e\x68\x61\xd3\
\x59\xa8\x5a\x80\xda\xdd\xbe\x3c\xdc\xdd\xbe\x1c\x2e\xaf\xae\xf5\
\x4f\x9d\x7c\x28\x10\x42\xb0\x77\xdc\xff\xa5\x73\xb1\x64\x6e\xe6\
\x6c\x83\xf9\xa9\xf9\x66\x15\xf9\x0f\x19\xa3\x38\xbc\xbe\xa6\x65\
\xdf\xea\x29\x26\x84\xe0\xfe\x07\xbf\x0c\x84\xa8\x5b\x53\x39\x4c\
\xea\xf7\xc6\x79\x16\xd3\xe4\xa3\x1f\xfc\x7f\x52\xe6\x38\x2d\x01\
\x93\x79\x54\x81\x52\xdb\x67\x6a\x57\x0b\x4c\xed\xfa\x33\x0b\x50\
\xd0\xe0\x33\xcf\x30\x96\x61\xbe\x61\x6c\x39\x72\xa3\x1c\xb7\xe1\
\xd7\x00\x94\xd5\x34\x76\x77\xfb\xf2\x48\x03\xd4\xd2\x93\x27\x3f\
\x13\x48\x89\xa2\x9b\x44\xcd\xe4\xeb\x6b\x03\x4a\xb3\xbf\xe3\x30\
\x86\xdc\x34\x9e\x68\x40\x2a\x3e\xd9\xe9\x8a\xe3\x38\x03\x26\x7d\
\x4c\x8d\x23\x32\x8e\xa4\x74\xd4\x31\x26\x60\xbe\x4a\xaf\x5d\x2d\
\x30\xb5\xab\x5d\x5f\x54\x00\xc5\x71\xe5\x86\xb1\x75\x52\x73\xb3\
\xc4\x57\xe7\x6a\x3e\xc3\x9e\x6c\x00\x75\xea\x91\x87\x03\x29\x84\
\x73\xf7\xfd\x0f\x5e\x45\x50\x42\x43\x50\x9a\x1d\x00\xa6\x94\x16\
\x54\x7e\xb9\xdb\x38\x99\xf1\x10\xda\x51\x21\x81\xb1\x01\x4c\x93\
\x12\x30\xd5\xf5\x99\xaa\x54\x7a\xad\x23\x44\xbb\x5a\x60\x6a\xd7\
\x9f\x49\x80\x32\xcf\xba\x6d\x52\xf3\xaa\xd0\x42\x5b\x89\xcf\x16\
\xb9\x51\x55\xe2\x4b\xd9\x53\x13\x57\xf3\x0c\xa0\x3c\x3f\xe8\x9d\
\x3a\xf9\x70\x47\x42\xba\x77\xdf\xfb\x20\x6a\x79\x53\x23\x50\x6a\
\x42\x93\x8a\xce\xe7\x52\x48\x74\x3b\x1d\xac\x2c\x2f\x15\x81\xa8\
\x66\xd8\xf7\xb9\xe7\x9e\x03\x72\x41\xc9\xa2\xe0\x24\x8c\xaf\x6d\
\x39\xaf\x5d\x2d\x30\xb5\xeb\x4d\x0b\x50\x8b\x1a\xc6\x3a\xc6\xf7\
\xb6\x3e\x54\xb9\xc4\xe7\x61\x71\x37\x89\x4e\x34\x9d\x8c\xce\xbd\
\xf2\x72\xc7\x0f\xc2\xde\xa9\x47\x1e\xea\x40\xc2\xbd\xfb\xbe\x07\
\x4b\xd1\xef\xa4\x61\x59\xae\x89\xd8\xc1\x62\xe0\x0a\x09\xd7\x75\
\xe1\x79\x9e\x06\x22\x39\xd7\x81\xe2\xfc\x85\xf3\xd2\x00\xa6\xb1\
\x05\x94\x4c\x70\x6a\xca\x98\x5a\xb6\xd4\xae\x16\x98\xda\xf5\xa6\
\x00\xa8\x83\x1a\xc6\xda\xac\x8e\xaa\x94\x7c\x55\x25\xbe\x79\x6e\
\x12\x59\xa9\x6f\x3a\x19\x0f\xcf\x9d\x7e\xb9\xe3\xba\x5e\xf7\xb1\
\x4f\x7f\xb2\xeb\xb8\xae\x97\x01\x54\x43\x50\x5a\x44\xec\x60\x7e\
\x2b\xb5\xd2\x0e\x50\x83\xb5\x92\xd4\x0f\xfb\x4a\x00\x1f\xff\xf8\
\x27\x23\x28\xb9\x7d\x2a\xbf\x2f\x03\x54\x59\x04\xd1\xa4\xc7\xd4\
\x32\xa6\x76\xb5\xc0\xd4\xae\x37\x05\x40\x95\x81\xaa\xca\x49\x82\
\xa0\x99\x61\x6c\x9d\x92\xef\x8a\xdd\x24\xe2\x38\x1a\x6e\x9e\x3f\
\xdb\x21\x84\x74\x39\xe7\x5d\xc6\x98\x7f\x77\x45\xe4\xc6\xd5\x00\
\xa5\xf4\xd2\xc0\x0f\xe0\x30\xa7\x86\x57\x99\x17\x4a\x6c\x6d\x5d\
\x9e\x56\x80\xd2\xa4\x06\x9c\x16\x55\xe5\xb5\x20\xd5\x02\x53\xbb\
\xda\xf5\x67\x0e\xa0\x9a\xfa\xf1\x99\xfd\xa7\x32\x7b\xaa\xca\x84\
\x6a\x32\x0b\x65\x96\xf8\x6c\xec\xa9\x32\x17\x4a\x4a\x39\xdc\x38\
\xfb\x6a\x0a\x50\x3d\xc7\x71\xbd\xbb\xef\x7b\xa0\x3a\xd4\xf3\x0a\
\x40\x09\x12\x08\xc3\x00\x8c\x31\xfb\x4d\x59\x9e\xc1\xd1\x68\x34\
\x5e\x80\x31\xd5\x29\xf3\xaa\x54\x79\x2d\x28\xb5\xc0\xd4\xae\x76\
\xfd\x99\x06\xa9\x2b\x31\x8c\xb5\xd9\x1d\x35\x65\x50\x65\xb3\xd8\
\xa9\x01\x52\x36\x91\x44\x80\x92\x92\x4f\x4a\x39\xda\x38\xfb\xea\
\x80\x10\xd2\xe5\x49\xdc\x63\xae\xeb\xdf\x73\xdf\x83\x44\x64\xd1\
\xef\xa4\x51\xae\x6e\xed\x13\x24\x25\x08\x21\x70\x1c\x96\x3f\x03\
\x95\xbf\xae\x82\x04\x5f\x7e\xf9\xe5\x4b\x50\x8e\x19\x65\x70\x2a\
\xf7\x9a\xaa\xfa\x4c\x55\xce\xe3\xed\x6a\x57\x0b\x4c\xed\x7a\x53\
\x03\xd4\xa2\x86\xb1\x8b\xba\x49\x94\x41\xaa\xa9\x9b\x84\xc9\xa6\
\x46\x00\x42\x29\xe5\xe8\x82\x06\xa8\xd1\xfe\x7e\xb7\xd3\xef\x07\
\x42\x70\x7a\xcf\x7d\x5f\xba\xa8\x71\x9e\x15\x6f\x58\x36\xc3\x54\
\x87\x67\x6a\xe8\xf6\x63\x1f\xfb\x88\x1c\x8f\x27\x5b\xc8\x6d\x9d\
\x86\x25\x60\x32\x59\xd3\x41\x7b\x4c\x2d\x48\xb5\xc0\xd4\xae\x76\
\xbd\x29\x01\x6a\x51\xc3\x58\x9b\x92\xcf\x64\x4f\x75\xc9\xba\xb6\
\x12\x5f\x5d\xb2\xae\x2d\x72\x23\x94\x52\x8e\xb6\xb7\x2e\x0e\xb6\
\xb7\x2e\x76\x56\xd6\xd6\x7b\xa7\x1e\x49\xdd\x24\xde\x3d\x9f\x2d\
\x55\x00\x18\x17\x1c\x37\x5d\x7f\x2d\x68\x1a\x5f\x51\xa9\x7a\x90\
\xf8\x85\x5f\xf8\xe7\x93\x1f\xfd\xb1\x9f\x78\x14\xb9\xc7\xe0\x00\
\xc5\x52\x5e\x9d\x00\xa2\x8e\x2d\x95\x5f\xa3\x76\xb5\xc0\xd4\xae\
\x76\xb5\x0c\x0a\x8b\xb9\x49\x98\x02\x89\x72\x89\xcf\xe6\x26\x51\
\x16\x49\xd4\x25\xeb\x56\x39\x9a\x17\x84\x12\x3b\x97\xb7\x86\x3b\
\x97\xb7\x3a\x2b\x6b\xeb\xfd\x53\x27\x1f\xf2\xb9\x10\x8e\x1d\xa0\
\x50\x1e\x5d\x9a\x79\x26\xba\xdd\x8e\xf6\xde\x93\x36\x9e\x04\x21\
\x04\x7e\xfc\xc7\x7f\x6c\xf0\x0b\xbf\xf8\x4b\x4f\x42\x19\xdd\xee\
\x23\x2f\xe5\x95\x19\x93\xe9\x02\x71\x10\xc6\xd4\x02\x53\xbb\x5a\
\x60\x6a\xd7\x9b\x1b\xa0\xd2\x1e\x4b\x05\x40\xd5\xb9\x49\xd8\x32\
\xa1\x6c\x6e\x12\x8b\x32\x28\x13\xa4\x82\x86\x00\x15\x2a\x80\x7a\
\x38\x50\xc3\xba\x0f\xcc\xc3\xa7\xc2\x83\x75\xb4\xf0\xc1\x06\x4a\
\x09\xe7\xf8\xb6\x6f\xfd\x9f\x2e\x7d\xe8\xc3\xff\xfd\x39\x03\x94\
\x4c\x60\x2a\xf7\x98\x26\x68\xa5\xe2\xed\x6a\x81\xa9\x5d\xed\xba\
\x0a\xe8\x04\x54\x01\x54\x99\x61\x2d\xea\x26\xb1\x08\x83\x9a\x17\
\xfd\x5e\x25\x35\x0f\x53\x80\xf2\xc3\xb0\xfb\xd4\xa3\x27\x3a\x52\
\x08\xe7\xee\xfb\x1e\x64\x72\xce\x76\x4f\x00\x24\x09\x9f\xbd\x9c\
\x10\xc4\x71\x8c\xfb\xef\x7f\xe0\xd5\x67\x9e\xf9\xfc\x2b\x28\x46\
\x83\x0c\x4a\xc0\x54\xee\x2f\x95\x7b\x4c\x4d\x06\x6b\xd1\x82\x53\
\xbb\x5a\x60\x6a\x57\xbb\x16\x03\xa8\xaa\xa1\xdd\x2b\x75\x93\x58\
\x24\xfa\xbd\x6a\x16\x2a\xbb\x6c\x3a\x1e\xef\xbf\xfa\xe2\xf3\x81\
\xeb\x79\x9d\xe4\x4f\xff\xa4\xe3\x79\x9e\x7b\xe7\xbb\x1e\x08\x64\
\xc5\x9e\x2f\xa5\xc4\xb1\x23\x87\x0b\x82\x3c\x42\x28\x46\xa3\x21\
\xee\xba\xeb\xee\x67\xcf\x9f\xbf\x70\x1e\xc5\x9e\x52\x0a\x50\x55\
\x65\xbc\x32\x5b\xb2\x05\x05\xb6\x25\xbc\x76\xb5\xc0\xd4\xae\x76\
\x5d\x05\x80\x2a\x03\xd5\x6b\xe5\x26\x61\x2b\xf1\x55\x19\xc6\x96\
\x81\x2a\x63\x59\x71\x14\xf9\x17\xce\xbc\xe2\x11\x4a\xfd\x24\x49\
\x96\x1c\xd7\x63\x77\x7e\xc9\x7d\x2b\x36\x3d\xf8\xe1\x43\x6b\xaa\
\xc7\x24\x25\x08\xa1\x18\xec\xef\xe1\xc6\x9b\xde\xf2\xc8\x68\x34\
\xba\x8c\x3c\x58\x71\x80\x62\xb8\x62\x9d\x1a\xaf\xec\x2c\x3e\x6f\
\xb0\xb6\x05\xa5\x76\xb5\xc0\xd4\xae\x76\xbd\x46\x00\x75\x35\xdc\
\x24\x6c\x52\x73\xdb\xb0\x6e\x59\x72\x6e\x02\x53\x7a\x78\x52\x08\
\xef\xdc\x2b\x2f\xef\x50\x4a\x3d\xce\xe3\x81\xeb\x7a\xec\x8e\x3f\
\x77\xef\x35\x99\x1f\x1f\x21\x70\x1d\x27\x63\x4a\x3b\x3b\xdb\xb8\
\xe9\xa6\xb7\x7c\x62\x3a\x9d\xee\xa2\x98\xfc\x3b\x44\x31\xfd\x77\
\x88\x6a\x25\x5e\x62\x61\x4c\x36\x50\x42\x0b\x4a\xed\x6a\x81\xa9\
\x5d\xed\xba\x02\x80\x02\x20\xc9\x2c\x4a\x2d\xea\x26\x61\x06\x17\
\x36\x4d\xd6\x2d\xcf\x41\x4d\x31\x9b\x0d\x55\x3e\x3c\xe3\x70\x84\
\x10\xce\xd9\x97\x5f\xba\x44\x29\x75\x92\x84\xef\xb9\x9e\x4b\xef\
\x78\xe7\xbd\xb7\x51\x4a\xd1\xed\x74\x40\x08\xc1\xcb\x2f\xbd\x80\
\xb7\xdd\x71\xd7\xef\xa3\x3a\x96\xde\x8c\xa7\x9f\x37\xbb\x34\x4f\
\x1e\xde\x32\xa5\x76\x55\xae\x6a\x9b\x93\x76\xb5\xab\xea\x4d\x43\
\xc8\x9f\x99\xc7\x72\xd0\xf7\x3f\xc9\x53\xf5\x50\xfa\x5a\x3e\x4c\
\xf6\x94\x1e\x66\x0f\x8a\xa1\xa8\xe2\x73\x50\x14\x49\xa4\x87\x57\
\x3a\x6c\x40\x54\x06\x25\xf3\xf7\x4d\x50\xa4\x94\x52\xb6\x7e\xe4\
\xd8\x6a\xd0\xe9\x38\x1f\xfb\x1f\x1f\x7e\x40\x24\x11\x6e\xbb\xfd\
\x8e\x5f\x33\x58\x9b\x09\x4e\x26\x40\x99\x2c\xc9\x64\x4b\x13\x14\
\x43\x02\x17\x51\xe4\x5d\xf5\xd7\xa7\x5d\x2d\x30\xb5\xab\x05\xa6\
\x37\x1d\x30\x55\x00\x54\x15\x38\x11\x0b\x38\xd1\x12\x38\x31\x0b\
\x38\x95\x41\xca\x2b\x81\x94\x5f\xf1\xef\x32\x28\xa5\xb7\x63\xfe\
\xdd\xec\x29\xf8\x9e\xef\x7d\xef\x97\xff\xdb\x7f\xf3\xfe\xff\x81\
\xbc\x04\x17\x19\xe0\x34\xb5\x80\x54\x55\x06\x93\x2d\x87\x69\x9e\
\x79\xeb\x6b\xfa\xfa\xb4\xab\x05\xa6\x76\xb5\xc0\xf4\xa6\x7e\x5a\
\xae\x32\x40\x35\x61\x50\x36\x26\x65\xfe\xcc\x31\xbe\x9a\x8c\xa9\
\x3c\x58\x6c\xfa\x01\xc6\x25\x70\x2a\x03\x54\xf9\x88\x50\x1d\x73\
\x51\x16\x3e\x2c\x2c\x7a\x68\xf7\xa7\x37\xe7\x6a\x7b\x4c\xed\x6a\
\xd7\x55\x22\x5f\x38\xb8\xdd\x11\x81\x5d\x6a\x5e\x56\xf3\x99\x7d\
\x28\x73\x0e\xca\xad\x60\x49\x65\x50\x32\x81\xc9\x54\x88\xa7\xa0\
\x61\x02\x4a\x6c\x80\x4d\x54\x02\xa1\x32\x43\xaa\x2b\xdd\xb5\xb1\
\x16\xed\x6a\x81\xa9\x5d\xed\x7a\x03\x01\x94\x79\xd9\x3c\xbb\x23\
\x9b\xc4\xbc\xac\xe2\x33\x45\x12\x31\x66\x05\x13\xe5\xd2\x9d\x63\
\x61\x4b\xb4\x74\x3f\x64\x89\x35\x95\xc1\x29\xb6\x80\x54\x8c\xfa\
\xf8\xf4\x79\x2c\xa9\x05\xa5\x76\xb5\xc0\xd4\xae\x76\x7d\x81\x00\
\xca\x76\x59\x9d\xdd\x51\x53\x37\x09\x53\x66\xee\x54\x80\x91\x53\
\xc1\x96\xcc\x52\x1e\x29\x01\x53\x15\x38\x95\x41\x2a\x2e\xfd\xac\
\xb5\x1d\x6a\x57\x0b\x4c\xed\x6a\xd7\x9f\x11\x80\x2a\x33\xac\xa6\
\x6e\x12\x36\xa9\xb9\x09\x44\xe5\xaf\xa6\x12\xb0\xcc\xdc\x50\x02\
\xa6\x32\x38\xf1\x0a\x10\xb2\x01\x12\x37\x7e\xbf\xca\x7a\xa8\x05\
\xa8\x76\xb5\xc0\xd4\xae\x76\x7d\x11\x00\xd4\xa2\x6e\x12\x26\x7b\
\x62\x25\x66\x64\x63\x49\xb6\x32\x1e\xb1\x80\x85\x09\x4c\xe6\x91\
\x54\x80\x15\xaf\x01\x25\x89\xd6\x7a\xa8\x5d\x2d\x30\xb5\xab\x5d\
\x5f\xb4\x00\x55\x06\xaa\x45\xdc\x24\x4c\x80\xaa\x03\xa4\x26\xc0\
\x24\x4b\xe0\xc2\x6b\x0e\x31\x87\x25\x89\x16\x8c\xda\xd5\x02\x53\
\xbb\xda\xf5\xc5\x09\x50\x4d\xa3\xdf\xeb\xdc\x24\xca\x20\x54\x05\
\x48\x4d\x80\xa9\xcc\x9c\x84\x05\xac\xca\x3f\x13\x0d\x40\xa9\x05\
\xa8\x76\xb5\xc0\xd4\xae\x76\x7d\x91\x81\x54\x53\x80\xb2\x01\x55\
\x0a\x52\x55\x60\x54\x06\x24\x52\xf1\xb7\xca\xc0\x54\x77\xc8\x06\
\x80\xd4\x82\x52\xbb\x5a\x60\x6a\x57\xbb\xde\x64\x00\x25\x2a\x00\
\xc8\xc6\x90\xca\x6a\xbc\x3a\x60\x92\x25\xa0\x29\x03\x91\x9c\x03\
\x46\x2d\x28\xb5\xab\x05\xa6\x76\xb5\xeb\x4d\x00\x50\x75\xc3\xba\
\x29\x48\x91\x1a\x76\x54\x66\x4a\xa4\xe6\xef\xd6\x81\x54\xdd\x65\
\x40\x2b\x74\x68\x57\x0b\x4c\xed\x6a\xd7\x9b\x06\xa0\xaa\xdc\x24\
\x50\xfa\x5e\xd4\x00\x91\x0d\x94\x08\xaa\xe5\xdc\xb2\xc1\x81\x96\
\x25\xb5\xab\x05\xa6\x76\xb5\xab\x65\x50\x80\x5d\xc1\x57\xe5\x76\
\x8e\x9a\xaf\xe5\xbf\x83\x0a\x80\xa9\xfb\x37\x5a\x50\x6a\x57\x0b\
\x4c\xed\x6a\xd7\x9b\x17\xa0\x6c\x97\x11\x0b\x70\xd5\x01\x11\x69\
\xf8\x37\xe4\x9c\xaf\xf3\x7e\xd6\xae\x76\xb5\xc0\xd4\xae\x76\xbd\
\x89\x01\xca\xbc\x9c\x94\xfe\x8d\x86\xa0\x54\x75\xfb\x72\x01\xf0\
\x6a\x57\xbb\x5a\x60\x6a\x57\xbb\x5a\x80\xb2\x2a\xf9\xaa\x40\x85\
\x2c\x78\xdb\x8b\x82\x56\xbb\xda\xd5\x02\x53\xbb\xda\xd5\xae\x4a\
\x16\x63\x03\x23\x59\x03\x52\xb2\xe1\xed\xb7\xab\x5d\xaf\xe9\x6a\
\x83\x02\xdb\xd5\xae\x76\xb5\xab\x5d\x6f\xa8\x45\xdb\xa7\xa0\x5d\
\xed\x6a\x57\xbb\xda\xd5\x02\x53\xbb\xda\xd5\xae\x76\xb5\xab\x5d\
\x2d\x30\xb5\xab\x5d\xed\x6a\x57\xbb\x5a\x60\x6a\x57\xbb\xda\xd5\
\xae\x76\xb5\xab\x05\xa6\x76\xb5\xab\x5d\xed\x6a\x57\x0b\x4c\xed\
\x6a\x57\xbb\xda\xd5\xae\x76\xb5\xc0\xd4\xae\x76\xb5\xab\x5d\xed\
\x6a\x81\xa9\x5d\xed\x6a\x57\xbb\xda\xd5\xae\xd7\x78\xfd\xff\x07\
\x00\xdf\xeb\xa6\x5e\x67\x5d\xc3\xc8\x00\x00\x00\x00\x49\x45\x4e\
\x44\xae\x42\x60\x82\
\x00\x00\x10\xaf\
\x3c\
\xb8\x64\x18\xca\xef\x9c\x95\xcd\x21\x1c\xbf\x60\xa1\xbd\xdd\x42\
\x00\x00\x01\x10\x00\x00\x05\x5b\x00\x00\x0e\xce\x00\x00\x05\x5b\
\x00\x00\x0f\x2c\x00\x04\xec\x30\x00\x00\x09\x90\x00\x2a\xcf\x04\
\x00\x00\x00\x94\x00\x2b\x66\xbe\x00\x00\x00\xc1\x00\x4c\x99\x62\
\x00\x00\x08\x7f\x00\x5c\x8c\x34\x00\x00\x0d\x6c\x00\xc2\x69\x4a\
\x00\x00\x09\x0c\x01\x41\x67\xe1\x00\x00\x09\x4e\x01\x6e\x3c\x3e\
\x00\x00\x06\x40\x02\x77\x43\xb2\x00\x00\x07\x30\x02\xa7\x96\xc4\
\x00\x00\x00\x00\x03\x0f\x07\xc2\x00\x00\x07\xa8\x04\x26\xa4\x7e\
\x00\x00\x0d\x95\x04\x84\x78\xf1\x00\x00\x0c\x0e\x04\xa3\x1d\x95\
\x00\x00\x06\x0e\x04\xeb\xd1\x1e\x00\x00\x0a\xe7\x05\x0f\xee\xd1\
\x00\x00\x04\xef\x05\x97\x18\xa4\x00\x00\x08\x1b\x06\x1b\x1e\xf4\
\x00\x00\x04\xb6\x06\x5b\x01\x15\x00\x00\x07\x76\x06\x7c\x5c\x69\
\x00\x00\x08\xaa\x08\xaa\xe3\xe4\x00\x00\x0e\xf5\x08\xaa\xe3\xe4\
\x00\x00\x0f\x4d\x0a\xa8\xb8\x85\x00\x00\x00\x2a\x0a\xa8\xc3\x5f\
\x00\x00\x0c\x7a\x0a\xac\x2c\x85\x00\x00\x00\x61\x0b\x30\x83\x76\
\x00\x00\x01\x44\x0d\x19\x52\xba\x00\x00\x0e\x82\x0d\x7e\x3d\x9a\
\x00\x00\x05\x9a\x0d\xde\x2e\x6a\x00\x00\x0e\x16\x0e\x1c\x3f\xe7\
\x00\x00\x0a\x9b\x0e\xf1\xf0\x41\x00\x00\x00\xf0\x0f\xb2\x8a\xe1\
\x00\x00\x09\xbc\x69\x00\x00\x0f\x7e\x03\x00\x00\x00\x0a\x00\x26\
\x03\xa0\x03\xb5\x03\xc1\x03\xaf\x08\x00\x00\x00\x00\x06\x00\x00\
\x00\x06\x26\x41\x62\x6f\x75\x74\x07\x00\x00\x00\x05\x56\x61\x75\
\x6c\x74\x01\x03\x00\x00\x00\x16\x00\x26\x03\x94\x03\xb7\x03\xbc\
\x03\xb9\x03\xbf\x03\xc5\x03\xc1\x03\xb3\x03\xaf\x03\xb1\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x07\x26\x43\x72\x65\x61\x74\x65\x07\
\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x12\x00\
\x26\x03\x94\x03\xb9\x03\xb1\x03\xb3\x03\xc1\x03\xb1\x03\xc6\x03\
\xae\x08\x00\x00\x00\x00\x06\x00\x00\x00\x07\x26\x44\x65\x6c\x65\
\x74\x65\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\
\x00\x0e\x00\x26\x03\x88\x03\xbe\x03\xbf\x03\xb4\x03\xbf\x03\xc2\
\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\x26\x45\x78\x69\x74\x07\
\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x10\x00\
\x26\x03\x86\x03\xbd\x03\xbf\x03\xb9\x03\xb3\x03\xbc\x03\xb1\x08\
\x00\x00\x00\x00\x06\x00\x00\x00\x05\x26\x4f\x70\x65\x6e\x07\x00\
\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x2c\x00\x26\
\x03\x91\x03\xbd\x03\xb1\x03\xc6\x03\xad\x03\xc1\x03\xb5\x03\xc4\
\x03\xb5\x00\x20\x03\xad\x03\xbd\x03\xb1\x00\x20\x03\xc3\x03\xc6\
\x03\xac\x03\xbb\x03\xbc\x03\xb1\x00\x21\x08\x00\x00\x00\x00\x06\
\x00\x00\x00\x0e\x26\x52\x65\x70\x6f\x72\x74\x20\x61\x20\x62\x75\
\x67\x21\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\
\x02\x58\x00\x3c\x00\x62\x00\x3e\x00\x20\x00\x56\x00\x61\x00\x75\
\x00\x6c\x00\x74\x00\x20\x00\x25\x00\x31\x00\x20\x00\x3c\x00\x2f\
\x00\x62\x00\x3e\x00\x0a\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x3c\
\x00\x70\x00\x3e\x03\x94\x03\xb7\x03\xbc\x03\xb9\x03\xbf\x03\xc5\
\x03\xc1\x03\xb3\x03\xaf\x03\xb1\x00\x20\x03\xba\x03\xb1\x03\xb9\
\x00\x20\x03\xb4\x03\xb9\x03\xb1\x03\xc7\x03\xb5\x03\xaf\x03\xc1\
\x03\xb7\x03\xc3\x03\xb7\x00\x20\x03\xba\x03\xc1\x03\xc5\x03\xc0\
\x03\xc4\x03\xbf\x03\xb3\x03\xc1\x03\xb1\x03\xc6\x03\xb7\x03\xbc\
\x03\xad\x03\xbd\x03\xc9\x03\xbd\x00\x20\x00\x0a\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x3c\x00\x70\x00\x3e\x03\xc6\x03\xb1\x03\xba\
\x03\xad\x03\xbb\x03\xc9\x03\xbd\x00\x20\x03\xbc\x03\xb5\x00\x20\
\x03\xc4\x03\xb7\x03\xbd\x00\x20\x03\xc7\x03\xc1\x03\xae\x03\xc3\
\x03\xb7\x00\x20\x03\xc4\x03\xbf\x03\xc5\x00\x20\x00\x65\x00\x6e\
\x00\x63\x00\x66\x00\x73\x00\x2e\x00\x0a\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x3c\x00\x70\x00\x3e\x00\x3c\x00\x61\x00\x20\x00\x68\
\x00\x72\x00\x65\x00\x66\x00\x3d\x00\x22\x00\x25\x00\x32\x00\x22\
\x00\x3e\x00\x56\x00\x61\x00\x75\x00\x6c\x00\x74\x00\x3c\x00\x2f\
\x00\x61\x00\x3e\x00\x0a\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x3c\
\x00\x70\x00\x3e\x00\x43\x00\x6f\x00\x70\x00\x79\x00\x72\x00\x69\
\x00\x67\x00\x68\x00\x74\x00\x20\x00\x26\x00\x63\x00\x6f\x00\x70\
\x00\x79\x00\x3b\x00\x20\x03\xa7\x03\xc1\x03\xae\x03\xc3\x03\xc4\
\x03\xbf\x03\xc2\x00\x20\x03\xa4\x03\xc1\x03\xb9\x03\xb1\x03\xbd\
\x03\xc4\x03\xb1\x03\xc6\x03\xcd\x03\xbb\x03\xbb\x03\xb7\x03\xc2\
\x00\x20\x00\x20\x00\x0a\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x3c\
\x00\x62\x00\x72\x00\x3e\x00\x4c\x00\x69\x00\x63\x00\x65\x00\x6e\
\x00\x73\x00\x65\x00\x3a\x00\x20\x00\x47\x00\x4e\x00\x55\x00\x20\
\x00\x47\x00\x50\x00\x4c\x00\x33\x00\x0a\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\
\x00\x20\x00\x3c\x00\x70\x00\x3e\x00\x50\x00\x79\x00\x74\x00\x68\
\x00\x6f\x00\x6e\x00\x20\x00\x25\x00\x33\x00\x20\x00\x2d\x00\x20\
\x00\x51\x00\x74\x00\x20\x00\x25\x00\x34\x00\x20\x00\x2d\x00\x20\
\x00\x50\x00\x79\x00\x51\x00\x74\x00\x20\x00\x25\x00\x35\x00\x20\
\x00\x6f\x00\x6e\x00\x20\x00\x25\x00\x36\x08\x00\x00\x00\x00\x06\
\x00\x00\x01\x00\x3c\x62\x3e\x20\x56\x61\x75\x6c\x74\x20\x25\x31\
\x20\x3c\x2f\x62\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x3c\x70\x3e\x43\x72\x65\x61\x74\x65\x20\x61\x6e\x64\x20\
\x6d\x61\x6e\x61\x67\x65\x20\x65\x6e\x63\x72\x79\x70\x74\x65\x64\
\x20\x66\x6f\x6c\x64\x65\x72\x73\x20\x75\x73\x69\x6e\x67\x20\x65\
\x6e\x63\x66\x73\x2e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x3c\x70\x3e\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x25\x32\
\x22\x3e\x56\x61\x75\x6c\x74\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x43\x6f\x70\x79\x72\
\x69\x67\x68\x74\x20\x26\x63\x6f\x70\x79\x3b\x20\x43\x68\x72\x69\
\x73\x20\x54\x72\x69\x61\x6e\x74\x61\x66\x69\x6c\x6c\x69\x73\x20\
\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x62\
\x72\x3e\x4c\x69\x63\x65\x6e\x73\x65\x3a\x20\x47\x4e\x55\x20\x47\
\x50\x4c\x33\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x3c\x70\x3e\x50\x79\x74\x68\x6f\x6e\x20\x25\x33\x20\x2d\x20\x51\
\x74\x20\x25\x34\x20\x2d\x20\x50\x79\x51\x74\x20\x25\x35\x20\x6f\
\x6e\x20\x25\x36\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\
\x00\x00\x00\x14\x03\xa0\x03\xb5\x03\xc1\x03\xaf\x00\x20\x00\x56\
\x00\x61\x00\x75\x00\x6c\x00\x74\x08\x00\x00\x00\x00\x06\x00\x00\
\x00\x0b\x41\x62\x6f\x75\x74\x20\x56\x61\x75\x6c\x74\x07\x00\x00\
\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x66\x03\x88\x03\
\xbd\x03\xb1\x00\x20\x03\xc3\x03\xc6\x03\xac\x03\xbb\x03\xbc\x03\
\xb1\x00\x20\x03\xc0\x03\xc1\x03\xbf\x03\xad\x03\xba\x03\xc5\x03\
\xc8\x03\xb5\x00\x20\x03\xc3\x03\xc4\x03\xb7\x03\xbd\x00\x20\x03\
\xb1\x03\xc0\x03\xbf\x03\xc0\x03\xc1\x03\xbf\x03\xc3\x03\xac\x03\
\xc1\x03\xc4\x03\xb7\x03\xc3\x03\xb7\x00\x20\x03\xc4\x03\xbf\x03\
\xc5\x00\x20\x03\xc6\x03\xb1\x03\xba\x03\xad\x03\xbb\x03\xbf\x03\
\xc5\x00\x21\x08\x00\x00\x00\x00\x06\x00\x00\x00\x2b\x41\x6e\x20\
\x65\x72\x72\x6f\x72\x20\x6f\x63\x63\x75\x72\x20\x77\x68\x69\x6c\
\x65\x20\x75\x6e\x6d\x6f\x75\x6e\x74\x69\x6e\x67\x20\x74\x68\x65\
\x20\x66\x6f\x6c\x64\x65\x72\x21\x07\x00\x00\x00\x05\x56\x61\x75\
\x6c\x74\x01\x03\x00\x00\x00\x3c\x03\x95\x03\xc0\x03\xb9\x03\xbb\
\x03\xbf\x03\xb3\x03\xae\x00\x20\x03\xc6\x03\xb1\x03\xba\x03\xad\
\x03\xbb\x03\xbf\x03\xc5\x00\x20\x03\xb1\x03\xc0\x03\xcc\x00\x20\
\x03\xc4\x03\xb7\x03\xbd\x00\x20\x03\xbb\x03\xaf\x03\xc3\x03\xc4\
\x03\xb1\x00\x3a\x08\x00\x00\x00\x00\x06\x00\x00\x00\x1e\x43\x68\
\x6f\x6f\x73\x65\x20\x61\x20\x66\x6f\x6c\x64\x65\x72\x20\x66\x72\
\x6f\x6d\x20\x74\x68\x65\x20\x6c\x69\x73\x74\x3a\x07\x00\x00\x00\
\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x12\x00\x26\x03\x9a\
\x03\xbb\x03\xb5\x03\xaf\x03\xc3\x03\xb9\x03\xbc\x03\xbf\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x06\x43\x6c\x6f\x26\x73\x65\x07\x00\
\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x9c\x03\x9a\
\x03\xbb\x03\xb5\x03\xaf\x03\xc3\x03\xc4\x03\xb5\x00\x20\x03\xcc\
\x03\xbb\x03\xb1\x00\x20\x03\xc4\x03\xb1\x00\x20\x03\xc0\x03\xc1\
\x03\xbf\x03\xb3\x03\xc1\x03\xac\x03\xbc\x03\xbc\x03\xb1\x03\xc4\
\x03\xb1\x00\x20\x03\xc0\x03\xbf\x03\xc5\x00\x20\x03\xba\x03\xc1\
\x03\xb1\x03\xc4\x03\xac\x03\xbd\x03\xb5\x00\x20\x03\xc4\x03\xbf\
\x03\xbd\x00\x20\x03\xc6\x03\xac\x03\xba\x03\xb5\x03\xbb\x03\xbf\
\x00\x20\x03\xb1\x03\xc0\x03\xb1\x03\xc3\x03\xc7\x03\xbf\x03\xbb\
\x03\xb7\x03\xbc\x03\xad\x03\xbd\x03\xbf\x00\x20\x03\xba\x03\xb1\
\x03\xb9\x00\x20\x03\xc0\x03\xb1\x03\xc4\x03\xae\x03\xc3\x03\xc4\
\x03\xb5\x00\x20\x03\xbf\x03\xba\x00\x2e\x08\x00\x00\x00\x00\x06\
\x00\x00\x00\x3a\x43\x6c\x6f\x73\x65\x20\x61\x6c\x6c\x20\x70\x72\
\x6f\x67\x72\x61\x6d\x73\x20\x74\x68\x61\x74\x20\x6b\x65\x65\x70\
\x20\x74\x68\x65\x20\x66\x6f\x6c\x64\x65\x72\x20\x62\x75\x73\x79\
\x20\x61\x6e\x64\x20\x70\x72\x65\x73\x73\x20\x6f\x6b\x2e\x07\x00\
\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x20\x03\x9a\
\x03\xbb\x03\xb5\x03\xaf\x03\xc3\x03\xb9\x03\xbc\x03\xbf\x00\x20\
\x03\xc6\x03\xb1\x03\xba\x03\xad\x03\xbb\x03\xbf\x03\xc5\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x0c\x43\x6c\x6f\x73\x65\x20\x66\x6f\
\x6c\x64\x65\x72\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\
\x00\x00\x00\x10\x03\xa3\x03\xc5\x03\xbd\x03\xad\x03\xc7\x03\xb5\
\x03\xb9\x03\xb1\x08\x00\x00\x00\x00\x06\x00\x00\x00\x08\x43\x6f\
\x6e\x74\x69\x6e\x75\x65\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\
\x01\x03\x00\x00\x00\x42\x03\x94\x03\xb9\x03\xb1\x03\xb3\x03\xc1\
\x03\xb1\x03\xc6\x03\xae\x00\x20\x03\xba\x03\xc1\x03\xc5\x03\xc0\
\x03\xc1\x03\xbf\x03\xb3\x03\xc1\x03\xb1\x03\xb3\x03\xb7\x03\xbc\
\x03\xad\x03\xbd\x03\xbf\x03\xc5\x00\x20\x03\xc6\x03\xb1\x03\xba\
\x03\xad\x03\xbb\x03\xbf\x03\xc5\x08\x00\x00\x00\x00\x06\x00\x00\
\x00\x17\x44\x65\x6c\x65\x74\x65\x20\x65\x6e\x63\x72\x79\x70\x74\
\x65\x64\x20\x66\x6f\x6c\x64\x65\x72\x07\x00\x00\x00\x05\x56\x61\
\x75\x6c\x74\x01\x03\x00\x00\x00\x38\x03\x94\x03\xb9\x03\xb1\x03\
\xb3\x03\xc1\x03\xb1\x03\xc6\x03\xae\x00\x20\x03\xc3\x03\xb7\x03\
\xbc\x03\xb5\x03\xaf\x03\xbf\x03\xc5\x00\x20\x03\xc0\x03\xc1\x03\
\xbf\x03\xc3\x03\xac\x03\xc1\x03\xc4\x03\xb7\x03\xc3\x03\xb7\x03\
\xc2\x08\x00\x00\x00\x00\x06\x00\x00\x00\x12\x44\x65\x6c\x65\x74\
\x65\x20\x6d\x6f\x75\x6e\x74\x20\x70\x6f\x69\x6e\x74\x07\x00\x00\
\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x0c\x03\xa3\x03\
\xc6\x03\xac\x03\xbb\x03\xbc\x03\xb1\x08\x00\x00\x00\x00\x06\x00\
\x00\x00\x05\x45\x72\x72\x6f\x72\x07\x00\x00\x00\x05\x56\x61\x75\
\x6c\x74\x01\x03\x00\x00\x00\x3a\x03\x9f\x00\x20\x03\xc6\x03\xac\
\x03\xba\x03\xb5\x03\xbb\x03\xbf\x03\xc2\x00\x20\x03\xb5\x03\xaf\
\x03\xbd\x03\xb1\x03\xb9\x00\x20\x03\xb1\x03\xc0\x03\xb1\x03\xc3\
\x03\xc7\x03\xbf\x03\xbb\x03\xb7\x03\xbc\x03\xad\x03\xbd\x03\xbf\
\x03\xc2\x08\x00\x00\x00\x00\x06\x00\x00\x00\x0e\x46\x6f\x6c\x64\
\x65\x72\x20\x69\x73\x20\x62\x75\x73\x79\x07\x00\x00\x00\x05\x56\
\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x1c\x03\x8c\x03\xbd\x03\xbf\
\x03\xbc\x03\xb1\x00\x20\x03\xc6\x03\xb1\x03\xba\x03\xad\x03\xbb\
\x03\xbf\x03\xc5\x00\x3a\x08\x00\x00\x00\x00\x06\x00\x00\x00\x0c\
\x46\x6f\x6c\x64\x65\x72\x20\x6e\x61\x6d\x65\x3a\x07\x00\x00\x00\
\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x1a\x00\x26\x03\xa3\
\x03\xc5\x03\xbc\x03\xbc\x03\xb5\x03\xc4\x03\xad\x03\xc7\x03\xb5\
\x03\xc4\x03\xb5\x00\x21\x08\x00\x00\x00\x00\x06\x00\x00\x00\x0e\
\x47\x65\x74\x20\x26\x49\x6e\x76\x6f\x6c\x76\x65\x64\x21\x07\x00\
\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x0e\x03\x92\
\x03\xbf\x03\xae\x03\xb8\x03\xb5\x03\xb9\x03\xb1\x08\x00\x00\x00\
\x00\x06\x00\x00\x00\x04\x48\x65\x6c\x70\x07\x00\x00\x00\x05\x56\
\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x8a\x03\x91\x03\xbd\x00\x20\
\x03\xb8\x03\xad\x03\xbb\x03\xb5\x03\xc4\x03\xb5\x00\x20\x03\xbd\
\x03\xb1\x00\x20\x03\xb4\x03\xb9\x03\xb1\x03\xb3\x03\xc1\x03\xac\
\x03\xc8\x03\xb5\x03\xc4\x03\xb5\x00\x20\x03\xb1\x03\xc5\x03\xc4\
\x03\xcc\x00\x20\x03\xc4\x03\xbf\x00\x20\x03\xc6\x03\xac\x03\xba\
\x03\xb5\x03\xbb\x03\xbf\x00\x2c\x00\x20\x03\xc0\x03\xc1\x03\xad\
\x03\xc0\x03\xb5\x03\xb9\x00\x20\x03\xc0\x03\xc1\x03\xce\x03\xc4\
\x03\xb1\x00\x20\x03\xbd\x03\xb1\x00\x20\x03\xc4\x03\xbf\x03\xbd\
\x00\x20\x03\xba\x03\xbb\x03\xb5\x03\xaf\x03\xc3\x03\xb5\x03\xc4\
\x03\xb5\x00\x21\x08\x00\x00\x00\x00\x06\x00\x00\x00\x3b\x49\x66\
\x20\x79\x6f\x75\x20\x77\x61\x6e\x74\x20\x74\x6f\x20\x64\x65\x6c\
\x65\x74\x65\x20\x74\x68\x69\x73\x20\x66\x6f\x6c\x64\x65\x72\x2c\
\x20\x79\x6f\x75\x20\x6d\x75\x73\x74\x20\x63\x6c\x6f\x73\x65\x20\
\x69\x74\x20\x66\x69\x72\x73\x74\x21\x07\x00\x00\x00\x05\x56\x61\
\x75\x6c\x74\x01\x03\x00\x00\x00\x20\x03\x9a\x03\xac\x03\xc4\x03\
\xb9\x00\x20\x03\xc0\x03\xae\x03\xb3\x03\xb5\x00\x20\x03\xc3\x03\
\xc4\x03\xc1\x03\xb1\x03\xb2\x03\xac\x08\x00\x00\x00\x00\x06\x00\
\x00\x00\x12\x53\x6f\x6d\x65\x74\x68\x69\x6e\x67\x20\x69\x73\x20\
\x77\x72\x6f\x6e\x67\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\
\x03\x00\x00\x00\xb8\x03\x9a\x03\xac\x03\xc4\x03\xb9\x00\x20\x03\
\xc0\x03\xae\x03\xb3\x03\xb5\x00\x20\x03\xc3\x03\xc4\x03\xc1\x03\
\xb1\x03\xb2\x03\xac\x00\x2c\x00\x20\x03\xb5\x03\xbb\x03\xad\x03\
\xb3\x03\xbe\x03\xb5\x03\xc4\x03\xb5\x00\x20\x03\xc4\x03\xbf\x03\
\xbd\x00\x20\x03\xba\x03\xc9\x03\xb4\x03\xb9\x03\xba\x03\xcc\x00\
\x20\x03\xbe\x03\xb1\x03\xbd\x03\xac\x00\x2e\x00\x20\x03\x95\x03\
\xc0\x03\xaf\x03\xc3\x03\xb7\x03\xc2\x00\x20\x03\xb5\x03\xbb\x03\
\xad\x03\xb3\x03\xbe\x03\xb5\x03\xc4\x03\xb5\x00\x20\x03\xb1\x03\
\xbd\x00\x20\x03\xbf\x00\x20\x03\xc6\x03\xac\x03\xba\x03\xb5\x03\
\xbb\x03\xbf\x03\xc2\x00\x20\x03\xb5\x03\xaf\x03\xbd\x03\xb1\x03\
\xb9\x00\x20\x03\xae\x03\xb4\x03\xb7\x00\x20\x03\xb1\x03\xbd\x03\
\xbf\x03\xb9\x03\xc7\x03\xc4\x03\xcc\x03\xc2\x00\x2e\x08\x00\x00\
\x00\x00\x06\x00\x00\x00\x55\x53\x6f\x6d\x65\x74\x68\x69\x6e\x67\
\x20\x69\x73\x20\x77\x72\x6f\x6e\x67\x2c\x20\x63\x68\x65\x63\x6b\
\x20\x74\x68\x65\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x20\x61\x67\
\x61\x69\x6e\x2e\x20\x41\x6c\x73\x6f\x20\x63\x68\x65\x63\x6b\x20\
\x69\x66\x20\x74\x68\x65\x20\x66\x6f\x6c\x64\x65\x72\x20\x69\x73\
\x20\x73\x74\x69\x6c\x6c\x20\x6f\x70\x65\x6e\x2e\x07\x00\x00\x00\
\x05\x56\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x3c\x03\x9f\x00\x20\
\x03\xc6\x03\xac\x03\xba\x03\xb5\x03\xbb\x03\xbf\x03\xc2\x00\x20\
\x03\xb5\x03\xaf\x03\xbd\x03\xb1\x03\xb9\x00\x20\x03\xc0\x03\xc1\
\x03\xbf\x03\xc3\x03\xb1\x03\xc1\x03\xc4\x03\xb7\x03\xbc\x03\xad\
\x03\xbd\x03\xbf\x03\xc2\x00\x21\x08\x00\x00\x00\x00\x06\x00\x00\
\x00\x16\x54\x68\x65\x20\x66\x6f\x6c\x64\x65\x72\x20\x69\x73\x20\
\x6d\x6f\x75\x6e\x74\x65\x64\x21\x07\x00\x00\x00\x05\x56\x61\x75\
\x6c\x74\x01\x03\x00\x00\x00\x9c\x03\x9f\x00\x20\x03\xc6\x03\xac\
\x03\xba\x03\xb5\x03\xbb\x03\xbf\x03\xc2\x00\x20\x03\xb5\x03\xaf\
\x03\xbd\x03\xb1\x03\xb9\x00\x20\x03\xc0\x03\xb9\x03\xb8\x03\xb1\
\x03\xbd\x03\xcc\x03\xbd\x00\x20\x03\xb1\x03\xc0\x03\xb1\x03\xc3\
\x03\xc7\x03\xbf\x03\xbb\x03\xb7\x03\xbc\x03\xad\x03\xbd\x03\xbf\
\x03\xc2\x00\x2c\x00\x20\x03\xb8\x03\xad\x03\xbb\x03\xb5\x03\xc4\
\x03\xb5\x00\x20\x03\xbd\x03\xb1\x00\x20\x03\xc4\x03\xbf\x03\xbd\
\x00\x20\x03\xba\x03\xbb\x03\xb5\x03\xaf\x03\xc3\x03\xb5\x03\xc4\
\x03\xb5\x00\x20\x03\xad\x03\xc4\x03\xc3\x03\xb9\x00\x20\x03\xba\
\x03\xb1\x03\xb9\x00\x20\x03\xb1\x03\xbb\x03\xbb\x03\xb9\x03\xce\
\x03\xc2\x00\x3b\x08\x00\x00\x00\x00\x06\x00\x00\x00\x3c\x54\x68\
\x65\x20\x66\x6f\x6c\x64\x65\x72\x20\x69\x73\x20\x70\x72\x6f\x62\
\x61\x62\x6c\x79\x20\x62\x75\x73\x79\x2c\x20\x64\x6f\x20\x79\x6f\
\x75\x20\x77\x61\x6e\x74\x20\x74\x6f\x20\x63\x6c\x6f\x73\x65\x20\
\x69\x74\x20\x61\x6e\x79\x77\x61\x79\x3f\x07\x00\x00\x00\x05\x56\
\x61\x75\x6c\x74\x01\x03\x00\x00\x00\x0a\x00\x56\x00\x61\x00\x75\
\x00\x6c\x00\x74\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\x56\x61\
\x75\x6c\x74\x07\x00\x00\x00\x05\x56\x61\x75\x6c\x74\x01\x03\x00\
\x00\x00\x42\x00\x3c\x00\x62\x00\x3e\x03\x9f\x03\xb9\x00\x20\x03\
\xba\x03\xc9\x03\xb4\x03\xb9\x03\xba\x03\xbf\x03\xaf\x00\x20\x03\
\xb4\x03\xb5\x03\xbd\x00\x20\x03\xc4\x03\xb1\x03\xb9\x03\xc1\x03\
\xb9\x03\xac\x03\xb6\x03\xbf\x03\xc5\x03\xbd\x00\x21\x00\x3c\x00\
\x2f\x00\x62\x00\x3e\x08\x00\x00\x00\x00\x06\x00\x00\x00\x1e\x3c\
\x62\x3e\x50\x61\x73\x73\x77\x6f\x72\x64\x73\x20\x64\x6f\x20\x6e\
\x6f\x74\x20\x6d\x61\x74\x63\x68\x21\x3c\x2f\x62\x3e\x07\x00\x00\
\x00\x0c\x63\x72\x65\x61\x74\x65\x70\x61\x73\x73\x77\x64\x01\x03\
\x00\x00\x00\x34\x03\x95\x03\xc0\x03\xb9\x03\xb2\x03\xb5\x03\xb2\
\x03\xb1\x03\xaf\x03\xc9\x03\xc3\x03\xb7\x00\x20\x03\xba\x03\xc9\
\x03\xb4\x03\xb9\x03\xba\x03\xbf\x03\xcd\x00\x20\x00\x45\x00\x6e\
\x00\x63\x00\x46\x00\x53\x00\x3a\x08\x00\x00\x00\x00\x06\x00\x00\
\x00\x17\x43\x6f\x6e\x66\x69\x72\x6d\x20\x45\x6e\x63\x46\x53\x20\
\x70\x61\x73\x73\x77\x6f\x72\x64\x3a\x07\x00\x00\x00\x0c\x63\x72\
\x65\x61\x74\x65\x70\x61\x73\x73\x77\x64\x01\x03\x00\x00\x00\x1c\
\x03\x9a\x03\xc9\x03\xb4\x03\xb9\x03\xba\x03\xcc\x03\xc2\x00\x20\
\x00\x45\x00\x6e\x00\x63\x00\x46\x00\x53\x00\x3a\x08\x00\x00\x00\
\x00\x06\x00\x00\x00\x0f\x45\x6e\x63\x46\x53\x20\x70\x61\x73\x73\
\x77\x6f\x72\x64\x3a\x07\x00\x00\x00\x0c\x63\x72\x65\x61\x74\x65\
\x70\x61\x73\x73\x77\x64\x01\x03\x00\x00\x00\x04\x03\x9f\x03\x9a\
\x08\x00\x00\x00\x00\x06\x00\x00\x00\x02\x4f\x6b\x07\x00\x00\x00\
\x0c\x63\x72\x65\x61\x74\x65\x70\x61\x73\x73\x77\x64\x01\x03\x00\
\x00\x00\x0e\x03\x9a\x03\xc9\x03\xb4\x03\xb9\x03\xba\x03\xcc\x03\
\xc2\x08\x00\x00\x00\x00\x06\x00\x00\x00\x08\x50\x61\x73\x73\x77\
\x6f\x72\x64\x07\x00\x00\x00\x0c\x63\x72\x65\x61\x74\x65\x70\x61\
\x73\x73\x77\x64\x01\x03\x00\x00\x00\x04\x03\x9f\x03\x9a\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x02\x4f\x6b\x07\x00\x00\x00\x06\x70\
\x61\x73\x73\x77\x64\x01\x03\x00\x00\x00\x0e\x03\x9a\x03\xc9\x03\
\xb4\x03\xb9\x03\xba\x03\xcc\x03\xc2\x08\x00\x00\x00\x00\x06\x00\
\x00\x00\x08\x50\x61\x73\x73\x77\x6f\x72\x64\x07\x00\x00\x00\x06\
\x70\x61\x73\x73\x77\x64\x01\x88\x00\x00\x00\x02\x01\x01\
"
qt_resource_name = "\
\x00\x09\
\x0c\x37\xae\x47\
\x00\x76\
\x00\x61\x00\x75\x00\x6c\x00\x74\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x0b\
\x0a\xa2\xed\x1d\
\x00\x76\
\x00\x61\x00\x75\x00\x6c\x00\x74\x00\x5f\x00\x65\x00\x6c\x00\x2e\x00\x71\x00\x6d\
"
qt_resource_struct = "\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x01\
\x00\x00\x00\x18\x00\x00\x00\x00\x00\x01\x00\x01\x2b\xea\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
"
def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources()
| gpl-3.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
7337,
909,
1233,
199,
3,
199,
3,
18208,
26,
5805,
10674,
5805,
10674,
7829,
8733,
26,
1344,
26,
1196,
6029,
199,
3,
420,
701,
26,
710,
7337,
27154,
367,
14084,
334,
4238,
373,
20,
14,
23,
14,
20,
9,
199,
3,
199,
3,
14750,
1,
2900,
4493,
6326,
315,
642,
570,
911,
506,
14669,
1,
199,
199,
504,
14084,
20,
492,
10565,
199,
199,
8440,
63,
1927,
63,
576,
275,
1867,
199,
60,
88,
383,
60,
88,
614,
60,
88,
18,
66,
60,
1845,
22,
60,
199,
60,
88,
1407,
60,
199,
60,
88,
1400,
60,
88,
20,
69,
60,
88,
2417,
60,
88,
16,
68,
60,
88,
16,
65,
60,
88,
17,
65,
60,
88,
16,
65,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
16,
68,
60,
88,
1887,
60,
88,
2006,
60,
88,
1602,
60,
88,
2528,
60,
88,
383,
60,
199,
60,
88,
383,
60,
88,
614,
60,
1800,
22,
60,
88,
383,
60,
88,
383,
60,
88,
614,
60,
1800,
25,
60,
88,
2036,
60,
88,
1690,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
1812,
22,
60,
88,
1465,
60,
88,
2942,
60,
2207,
22,
60,
199,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
1643,
60,
88,
2760,
60,
88,
2006,
60,
88,
1427,
60,
88,
2898,
60,
88,
383,
60,
88,
383,
60,
88,
16,
66,
60,
88,
969,
60,
88,
383,
60,
88,
383,
60,
88,
16,
66,
60,
88,
969,
60,
199,
60,
88,
614,
60,
88,
383,
60,
88,
25,
65,
60,
88,
25,
67,
60,
88,
1085,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
1165,
60,
88,
2766,
60,
88,
2006,
60,
88,
2528,
60,
88,
20,
68,
60,
88,
383,
60,
88,
383,
60,
88,
23,
65,
60,
199,
60,
88,
821,
60,
88,
383,
60,
88,
383,
60,
88,
1257,
60,
88,
2658,
60,
88,
383,
60,
88,
383,
60,
1949,
25,
60,
3581,
60,
88,
383,
60,
88,
383,
60,
88,
1257,
60,
1845,
25,
60,
88,
383,
60,
88,
383,
60,
88,
2194,
60,
199,
60,
88,
1216,
60,
88,
383,
60,
88,
383,
60,
10656,
60,
88,
2259,
60,
88,
383,
60,
88,
383,
60,
88,
19,
65,
60,
88,
2905,
60,
88,
383,
60,
88,
383,
60,
88,
1196,
60,
88,
22,
70,
60,
88,
2942,
60,
88,
21,
70,
60,
1812,
21,
60,
199,
60,
88,
2466,
60,
88,
383,
60,
88,
614,
60,
88,
18,
66,
60,
88,
22,
67,
60,
88,
1887,
60,
88,
1602,
60,
88,
2953,
60,
88,
1477,
60,
88,
2277,
60,
11078,
60,
9542,
60,
11208,
60,
88,
1138,
60,
10323,
60,
88,
1194,
60,
199,
60,
2207,
25,
60,
88,
1427,
60,
88,
17,
69,
60,
88,
24,
69,
60,
88,
19,
70,
60,
9532,
60,
1800,
25,
60,
2207,
24,
60,
1845,
25,
60,
88,
1184,
60,
1812,
25,
60,
9932,
60,
10097,
60,
88,
1020,
60,
2207,
25,
60,
10323,
60,
199,
60,
2207,
18,
60,
88,
20,
65,
60,
88,
2260,
60,
88,
614,
60,
88,
2835,
60,
88,
709,
60,
88,
24,
65,
60,
88,
2006,
60,
88,
2260,
60,
88,
614,
60,
88,
2025,
60,
88,
2635,
60,
88,
845,
60,
88,
2942,
60,
88,
2006,
60,
88,
2260,
60,
199,
60,
88,
1257,
60,
88,
24,
67,
60,
88,
22,
68,
60,
88,
709,
60,
88,
1427,
60,
88,
1257,
60,
88,
2322,
60,
88,
708,
60,
88,
2905,
60,
1949,
16,
60,
1812,
21,
60,
88,
1344,
60,
88,
1085,
60,
88,
22,
67,
60,
88,
1216,
60,
88,
2259,
60,
199,
60,
88,
23,
69,
60,
8371,
60,
11078,
60,
88,
1690,
60,
9957,
60,
88,
21,
70,
60,
88,
16,
67,
60,
1812,
22,
60,
88,
19,
70,
60,
88,
16,
67,
60,
2207,
24,
60,
88,
966,
60,
88,
2766,
60,
88,
1717,
60,
88,
2564,
60,
2207,
18,
60,
199,
60,
1845,
22,
60,
88,
25,
67,
60,
88,
1138,
60,
88,
1465,
60,
88,
1555,
60,
88,
19,
66,
60,
88,
1153,
60,
88,
1401,
60,
1949,
21,
60,
7887,
60,
88,
1477,
60,
88,
1229,
60,
1845,
23,
60,
11208,
60,
8371,
60,
88,
3172,
60,
199,
60,
88,
20,
69,
60,
1812,
21,
60,
10183,
60,
10656,
60,
10183,
60,
10656,
60,
10719,
60,
88,
1138,
60,
88,
1272,
60,
88,
2114,
60,
1800,
22,
60,
10489,
60,
88,
23,
69,
60,
88,
23,
65,
60,
88,
22,
70,
60,
88,
20,
70,
60,
199,
60,
88,
1555,
60,
10656,
60,
10656,
60,
10656,
60,
10117,
60,
1949,
19,
60,
88,
25,
67,
60,
1845,
23,
60,
88,
1965,
60,
88,
25,
70,
60,
1949,
23,
60,
88,
23,
68,
60,
88,
1407,
60,
88,
1020,
60,
88,
2869,
60,
88,
24,
70,
60,
199,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
1812,
23,
60,
1845,
21,
60,
88,
708,
60,
88,
1602,
60,
88,
23,
68,
60,
88,
2036,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
199,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
88,
1276,
60,
88,
1216,
60,
2207,
21,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
88,
2417,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
1644,
60,
88,
2481,
60,
199,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
1690,
60,
1800,
22,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
88,
2417,
60,
199,
60,
88,
19,
68,
60,
88,
22,
65,
60,
88,
2259,
60,
10117,
60,
88,
2417,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
2207,
20,
60,
1812,
16,
60,
88,
1477,
60,
88,
24,
70
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
7337,
909,
1233,
199,
3,
199,
3,
18208,
26,
5805,
10674,
5805,
10674,
7829,
8733,
26,
1344,
26,
1196,
6029,
199,
3,
420,
701,
26,
710,
7337,
27154,
367,
14084,
334,
4238,
373,
20,
14,
23,
14,
20,
9,
199,
3,
199,
3,
14750,
1,
2900,
4493,
6326,
315,
642,
570,
911,
506,
14669,
1,
199,
199,
504,
14084,
20,
492,
10565,
199,
199,
8440,
63,
1927,
63,
576,
275,
1867,
199,
60,
88,
383,
60,
88,
614,
60,
88,
18,
66,
60,
1845,
22,
60,
199,
60,
88,
1407,
60,
199,
60,
88,
1400,
60,
88,
20,
69,
60,
88,
2417,
60,
88,
16,
68,
60,
88,
16,
65,
60,
88,
17,
65,
60,
88,
16,
65,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
16,
68,
60,
88,
1887,
60,
88,
2006,
60,
88,
1602,
60,
88,
2528,
60,
88,
383,
60,
199,
60,
88,
383,
60,
88,
614,
60,
1800,
22,
60,
88,
383,
60,
88,
383,
60,
88,
614,
60,
1800,
25,
60,
88,
2036,
60,
88,
1690,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
1812,
22,
60,
88,
1465,
60,
88,
2942,
60,
2207,
22,
60,
199,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
1643,
60,
88,
2760,
60,
88,
2006,
60,
88,
1427,
60,
88,
2898,
60,
88,
383,
60,
88,
383,
60,
88,
16,
66,
60,
88,
969,
60,
88,
383,
60,
88,
383,
60,
88,
16,
66,
60,
88,
969,
60,
199,
60,
88,
614,
60,
88,
383,
60,
88,
25,
65,
60,
88,
25,
67,
60,
88,
1085,
60,
88,
383,
60,
88,
383,
60,
88,
383,
60,
88,
1165,
60,
88,
2766,
60,
88,
2006,
60,
88,
2528,
60,
88,
20,
68,
60,
88,
383,
60,
88,
383,
60,
88,
23,
65,
60,
199,
60,
88,
821,
60,
88,
383,
60,
88,
383,
60,
88,
1257,
60,
88,
2658,
60,
88,
383,
60,
88,
383,
60,
1949,
25,
60,
3581,
60,
88,
383,
60,
88,
383,
60,
88,
1257,
60,
1845,
25,
60,
88,
383,
60,
88,
383,
60,
88,
2194,
60,
199,
60,
88,
1216,
60,
88,
383,
60,
88,
383,
60,
10656,
60,
88,
2259,
60,
88,
383,
60,
88,
383,
60,
88,
19,
65,
60,
88,
2905,
60,
88,
383,
60,
88,
383,
60,
88,
1196,
60,
88,
22,
70,
60,
88,
2942,
60,
88,
21,
70,
60,
1812,
21,
60,
199,
60,
88,
2466,
60,
88,
383,
60,
88,
614,
60,
88,
18,
66,
60,
88,
22,
67,
60,
88,
1887,
60,
88,
1602,
60,
88,
2953,
60,
88,
1477,
60,
88,
2277,
60,
11078,
60,
9542,
60,
11208,
60,
88,
1138,
60,
10323,
60,
88,
1194,
60,
199,
60,
2207,
25,
60,
88,
1427,
60,
88,
17,
69,
60,
88,
24,
69,
60,
88,
19,
70,
60,
9532,
60,
1800,
25,
60,
2207,
24,
60,
1845,
25,
60,
88,
1184,
60,
1812,
25,
60,
9932,
60,
10097,
60,
88,
1020,
60,
2207,
25,
60,
10323,
60,
199,
60,
2207,
18,
60,
88,
20,
65,
60,
88,
2260,
60,
88,
614,
60,
88,
2835,
60,
88,
709,
60,
88,
24,
65,
60,
88,
2006,
60,
88,
2260,
60,
88,
614,
60,
88,
2025,
60,
88,
2635,
60,
88,
845,
60,
88,
2942,
60,
88,
2006,
60,
88,
2260,
60,
199,
60,
88,
1257,
60,
88,
24,
67,
60,
88,
22,
68,
60,
88,
709,
60,
88,
1427,
60,
88,
1257,
60,
88,
2322,
60,
88,
708,
60,
88,
2905,
60,
1949,
16,
60,
1812,
21,
60,
88,
1344,
60,
88,
1085,
60,
88,
22,
67,
60,
88,
1216,
60,
88,
2259,
60,
199,
60,
88,
23,
69,
60,
8371,
60,
11078,
60,
88,
1690,
60,
9957,
60,
88,
21,
70,
60,
88,
16,
67,
60,
1812,
22,
60,
88,
19,
70,
60,
88,
16,
67,
60,
2207,
24,
60,
88,
966,
60,
88,
2766,
60,
88,
1717,
60,
88,
2564,
60,
2207,
18,
60,
199,
60,
1845,
22,
60,
88,
25,
67,
60,
88,
1138,
60,
88,
1465,
60,
88,
1555,
60,
88,
19,
66,
60,
88,
1153,
60,
88,
1401,
60,
1949,
21,
60,
7887,
60,
88,
1477,
60,
88,
1229,
60,
1845,
23,
60,
11208,
60,
8371,
60,
88,
3172,
60,
199,
60,
88,
20,
69,
60,
1812,
21,
60,
10183,
60,
10656,
60,
10183,
60,
10656,
60,
10719,
60,
88,
1138,
60,
88,
1272,
60,
88,
2114,
60,
1800,
22,
60,
10489,
60,
88,
23,
69,
60,
88,
23,
65,
60,
88,
22,
70,
60,
88,
20,
70,
60,
199,
60,
88,
1555,
60,
10656,
60,
10656,
60,
10656,
60,
10117,
60,
1949,
19,
60,
88,
25,
67,
60,
1845,
23,
60,
88,
1965,
60,
88,
25,
70,
60,
1949,
23,
60,
88,
23,
68,
60,
88,
1407,
60,
88,
1020,
60,
88,
2869,
60,
88,
24,
70,
60,
199,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
1812,
23,
60,
1845,
21,
60,
88,
708,
60,
88,
1602,
60,
88,
23,
68,
60,
88,
2036,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
199,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
88,
1276,
60,
88,
1216,
60,
2207,
21,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
88,
2417,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
1644,
60,
88,
2481,
60,
199,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
1690,
60,
1800,
22,
60,
88,
23,
65,
60,
2207,
20,
60,
1800,
19,
60,
88,
17,
69,
60,
1949,
21,
60,
1800,
24,
60,
88,
2417,
60,
199,
60,
88,
19,
68,
60,
88,
22,
65,
60,
88,
2259,
60,
10117,
60,
88,
2417,
60,
88,
19,
68,
60,
10656,
60,
88,
2869,
60,
88,
24,
70,
60,
88,
23,
65,
60,
2207,
20,
60,
1812,
16,
60,
88,
1477,
60,
88,
24,
70,
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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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
] |
gsvaldevieso/tempo-certo | app/node_modules/node-gyp/gyp/tools/pretty_gyp.py | 2618 | 4756 | #!/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.
"""Pretty-prints the contents of a GYP file."""
import sys
import re
# Regex to remove comments when we're counting braces.
COMMENT_RE = re.compile(r'\s*#.*')
# Regex to remove quoted strings when we're counting braces.
# It takes into account quoted quotes, and makes sure that the quotes match.
# NOTE: It does not handle quotes that span more than one line, or
# cases where an escaped quote is preceeded by an escaped backslash.
QUOTE_RE_STR = r'(?P<q>[\'"])(.*?)(?<![^\\][\\])(?P=q)'
QUOTE_RE = re.compile(QUOTE_RE_STR)
def comment_replace(matchobj):
return matchobj.group(1) + matchobj.group(2) + '#' * len(matchobj.group(3))
def mask_comments(input):
"""Mask the quoted strings so we skip braces inside quoted strings."""
search_re = re.compile(r'(.*?)(#)(.*)')
return [search_re.sub(comment_replace, line) for line in input]
def quote_replace(matchobj):
return "%s%s%s%s" % (matchobj.group(1),
matchobj.group(2),
'x'*len(matchobj.group(3)),
matchobj.group(2))
def mask_quotes(input):
"""Mask the quoted strings so we skip braces inside quoted strings."""
search_re = re.compile(r'(.*?)' + QUOTE_RE_STR)
return [search_re.sub(quote_replace, line) for line in input]
def do_split(input, masked_input, search_re):
output = []
mask_output = []
for (line, masked_line) in zip(input, masked_input):
m = search_re.match(masked_line)
while m:
split = len(m.group(1))
line = line[:split] + r'\n' + line[split:]
masked_line = masked_line[:split] + r'\n' + masked_line[split:]
m = search_re.match(masked_line)
output.extend(line.split(r'\n'))
mask_output.extend(masked_line.split(r'\n'))
return (output, mask_output)
def split_double_braces(input):
"""Masks out the quotes and comments, and then splits appropriate
lines (lines that matche the double_*_brace re's above) before
indenting them below.
These are used to split lines which have multiple braces on them, so
that the indentation looks prettier when all laid out (e.g. closing
braces make a nice diagonal line).
"""
double_open_brace_re = re.compile(r'(.*?[\[\{\(,])(\s*)([\[\{\(])')
double_close_brace_re = re.compile(r'(.*?[\]\}\)],?)(\s*)([\]\}\)])')
masked_input = mask_quotes(input)
masked_input = mask_comments(masked_input)
(output, mask_output) = do_split(input, masked_input, double_open_brace_re)
(output, mask_output) = do_split(output, mask_output, double_close_brace_re)
return output
def count_braces(line):
"""keeps track of the number of braces on a given line and returns the result.
It starts at zero and subtracts for closed braces, and adds for open braces.
"""
open_braces = ['[', '(', '{']
close_braces = [']', ')', '}']
closing_prefix_re = re.compile(r'(.*?[^\s\]\}\)]+.*?)([\]\}\)],?)\s*$')
cnt = 0
stripline = COMMENT_RE.sub(r'', line)
stripline = QUOTE_RE.sub(r"''", stripline)
for char in stripline:
for brace in open_braces:
if char == brace:
cnt += 1
for brace in close_braces:
if char == brace:
cnt -= 1
after = False
if cnt > 0:
after = True
# This catches the special case of a closing brace having something
# other than just whitespace ahead of it -- we don't want to
# unindent that until after this line is printed so it stays with
# the previous indentation level.
if cnt < 0 and closing_prefix_re.match(stripline):
after = True
return (cnt, after)
def prettyprint_input(lines):
"""Does the main work of indenting the input based on the brace counts."""
indent = 0
basic_offset = 2
last_line = ""
for line in lines:
if COMMENT_RE.match(line):
print line
else:
line = line.strip('\r\n\t ') # Otherwise doesn't strip \r on Unix.
if len(line) > 0:
(brace_diff, after) = count_braces(line)
if brace_diff != 0:
if after:
print " " * (basic_offset * indent) + line
indent += brace_diff
else:
indent += brace_diff
print " " * (basic_offset * indent) + line
else:
print " " * (basic_offset * indent) + line
else:
print ""
last_line = line
def main():
if len(sys.argv) > 1:
data = open(sys.argv[1]).read().splitlines()
else:
data = sys.stdin.read().splitlines()
# Split up the double braces.
lines = split_double_braces(data)
# Indent and print the output.
prettyprint_input(lines)
return 0
if __name__ == '__main__':
sys.exit(main())
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
1898,
334,
67,
9,
6029,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
3645,
402,
642,
1350,
1233,
365,
10413,
701,
282,
6289,
13,
2487,
4190,
626,
883,
506,
199,
3,
1911,
315,
314,
5113,
570,
14,
199,
199,
624,
27153,
13,
29593,
314,
4072,
402,
282,
25686,
570,
1041,
199,
199,
646,
984,
199,
646,
295,
421,
199,
3,
12939,
370,
2813,
6786,
1380,
781,
3984,
23190,
27158,
14,
199,
10973,
63,
907,
275,
295,
14,
2014,
8,
82,
1154,
83,
10,
3,
24915,
199,
199,
3,
12939,
370,
2813,
10999,
3326,
1380,
781,
3984,
23190,
27158,
14,
199,
3,
2779,
6181,
1901,
2933,
10999,
9344,
12,
436,
7704,
3238,
626,
314,
9344,
1336,
14,
199,
3,
6944,
26,
2779,
1630,
440,
2429,
9344,
626,
13598,
1655,
2419,
1373,
1004,
12,
503,
199,
3,
5560,
2382,
376,
11077,
6313,
365,
9222,
6133,
701,
376,
11077,
13831,
14,
199,
18495,
63,
907,
63,
3027,
275,
519,
10120,
48,
28,
81,
9514,
3985,
3135,
17140,
18168,
11230,
4735,
1103,
1527,
1103,
566,
2229,
48,
29,
81,
3171,
199,
18495,
63,
907,
275,
295,
14,
2014,
8,
18495,
63,
907,
63,
3027,
9,
421,
199,
318,
3721,
63,
1814,
8,
1431,
1113,
304,
523,
372,
1336,
1113,
14,
923,
8,
17,
9,
435,
1336,
1113,
14,
923,
8,
18,
9,
435,
19619,
627,
822,
8,
1431,
1113,
14,
923,
8,
19,
430,
421,
199,
318,
3656,
63,
6223,
8,
1210,
304,
523,
408,
5144,
314,
10999,
3326,
880,
781,
3372,
27158,
6272,
10999,
3326,
1041,
523,
2754,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
5130,
3,
5130,
2795,
5942,
523,
372,
359,
1733,
63,
264,
14,
954,
8,
3349,
63,
1814,
12,
1004,
9,
367,
1004,
315,
1324,
61,
421,
199,
318,
6313,
63,
1814,
8,
1431,
1113,
304,
523,
372,
2071,
83,
5,
83,
5,
83,
5,
83,
2,
450,
334,
1431,
1113,
14,
923,
8,
17,
395,
2432,
1336,
1113,
14,
923,
8,
18,
395,
2432,
283,
88,
16804,
552,
8,
1431,
1113,
14,
923,
8,
19,
1826,
2432,
1336,
1113,
14,
923,
8,
18,
430,
421,
199,
318,
3656,
63,
14005,
8,
1210,
304,
523,
408,
5144,
314,
10999,
3326,
880,
781,
3372,
27158,
6272,
10999,
3326,
1041,
523,
2754,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
3171,
435,
7813,
9407,
63,
907,
63,
3027,
9,
523,
372,
359,
1733,
63,
264,
14,
954,
8,
3513,
63,
1814,
12,
1004,
9,
367,
1004,
315,
1324,
61,
421,
199,
318,
886,
63,
1294,
8,
1210,
12,
9742,
63,
1210,
12,
2754,
63,
264,
304,
523,
1072,
275,
942,
523,
3656,
63,
1199,
275,
942,
523,
367,
334,
604,
12,
9742,
63,
604,
9,
315,
3482,
8,
1210,
12,
9742,
63,
1210,
304,
272,
333,
275,
2754,
63,
264,
14,
1431,
8,
11018,
63,
604,
9,
272,
1830,
333,
26,
489,
3715,
275,
822,
8,
77,
14,
923,
8,
17,
430,
489,
1004,
275,
1004,
1491,
1294,
61,
435,
519,
1154,
78,
7,
435,
1004,
59,
1294,
2938,
489,
9742,
63,
604,
275,
9742,
63,
604,
1491,
1294,
61,
435,
519,
1154,
78,
7,
435,
9742,
63,
604,
59,
1294,
2938,
489,
333,
275,
2754,
63,
264,
14,
1431,
8,
11018,
63,
604,
9,
272,
1072,
14,
2880,
8,
604,
14,
1294,
8,
82,
1154,
78,
1333,
272,
3656,
63,
1199,
14,
2880,
8,
11018,
63,
604,
14,
1294,
8,
82,
1154,
78,
1333,
523,
372,
334,
1199,
12,
3656,
63,
1199,
9,
421,
199,
318,
3715,
63,
3157,
63,
7828,
823,
8,
1210,
304,
523,
408,
5144,
83,
734,
314,
9344,
436,
6786,
12,
436,
2066,
19115,
5827,
523,
2385,
334,
1278,
626,
2530,
595,
314,
4270,
15192,
63,
22359,
295,
1159,
3432,
9,
2544,
523,
4363,
316,
3062,
5084,
14,
819,
5723,
787,
1202,
370,
3715,
2385,
1314,
1172,
3663,
27158,
641,
3062,
12,
880,
523,
626,
314,
14311,
10734,
876,
84,
13949,
1380,
1006,
1127,
344,
734,
334,
69,
14,
71,
14,
11261,
523,
27158,
1852,
282,
14213,
16788,
1004,
680,
523,
408,
523,
4270,
63,
1490,
63,
22359,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
7023,
7023,
12911,
8,
30453,
2961,
83,
13278,
16510,
7023,
12911,
8,
566,
358,
523,
4270,
63,
1600,
63,
22359,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
7023,
7272,
4988,
4360,
31,
10127,
83,
13278,
16510,
7272,
4988,
3948,
358,
819,
9742,
63,
1210,
275,
3656,
63,
14005,
8,
1210,
9,
523,
9742,
63,
1210,
275,
3656,
63,
6223,
8,
11018,
63,
1210,
9,
819,
334,
1199,
12,
3656,
63,
1199,
9,
275,
886,
63,
1294,
8,
1210,
12,
9742,
63,
1210,
12,
4270,
63,
1490,
63,
22359,
63,
264,
9,
523,
334,
1199,
12,
3656,
63,
1199,
9,
275,
886,
63,
1294,
8,
1199,
12,
3656,
63,
1199,
12,
4270,
63,
1600,
63,
22359,
63,
264,
9,
819,
372,
1072,
421,
199,
318,
2338,
63,
7828,
823,
8,
604,
304,
523,
408,
415,
8277,
4426,
402,
314,
1329,
402,
27158,
641,
282,
1627,
1004,
436,
2529,
314,
754,
14,
819,
2779,
9174,
737,
4697,
436,
1007,
1239,
3021,
367,
6876,
27158,
12,
436,
9584,
367,
1551,
27158,
14,
523,
408,
523,
1551,
63,
7828,
823,
275,
788,
59,
297,
283,
5102,
5041,
418,
523,
4002,
63,
7828,
823,
275,
359,
418,
297,
283,
3196,
28544,
418,
523,
11261,
63,
1861,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
16045,
83,
60,
7272,
4988,
1874,
11,
6697,
9,
16510,
7272,
4988,
4360,
31,
2862,
83,
10,
9988,
523,
12703,
275,
378,
523,
6202,
604,
275,
25071,
63,
907,
14,
954,
8,
82,
6448,
1004,
9,
523,
6202,
604,
275,
7813,
9407,
63,
907,
14,
954,
8,
82,
2,
891,
401,
6202,
604,
9,
523,
367,
1495,
315,
6202,
604,
26,
272,
367,
23549,
315,
1551,
63,
7828,
823,
26,
489,
340,
1495,
508,
23549,
26,
267,
12703,
847,
413,
272,
367,
23549,
315,
4002,
63,
7828,
823,
26,
489,
340,
1495,
508,
23549,
26,
267,
12703,
4862,
413,
819,
2410,
275,
756,
523,
340,
12703,
690,
378,
26,
272,
2410,
275
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
1898,
334,
67,
9,
6029,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
3645,
402,
642,
1350,
1233,
365,
10413,
701,
282,
6289,
13,
2487,
4190,
626,
883,
506,
199,
3,
1911,
315,
314,
5113,
570,
14,
199,
199,
624,
27153,
13,
29593,
314,
4072,
402,
282,
25686,
570,
1041,
199,
199,
646,
984,
199,
646,
295,
421,
199,
3,
12939,
370,
2813,
6786,
1380,
781,
3984,
23190,
27158,
14,
199,
10973,
63,
907,
275,
295,
14,
2014,
8,
82,
1154,
83,
10,
3,
24915,
199,
199,
3,
12939,
370,
2813,
10999,
3326,
1380,
781,
3984,
23190,
27158,
14,
199,
3,
2779,
6181,
1901,
2933,
10999,
9344,
12,
436,
7704,
3238,
626,
314,
9344,
1336,
14,
199,
3,
6944,
26,
2779,
1630,
440,
2429,
9344,
626,
13598,
1655,
2419,
1373,
1004,
12,
503,
199,
3,
5560,
2382,
376,
11077,
6313,
365,
9222,
6133,
701,
376,
11077,
13831,
14,
199,
18495,
63,
907,
63,
3027,
275,
519,
10120,
48,
28,
81,
9514,
3985,
3135,
17140,
18168,
11230,
4735,
1103,
1527,
1103,
566,
2229,
48,
29,
81,
3171,
199,
18495,
63,
907,
275,
295,
14,
2014,
8,
18495,
63,
907,
63,
3027,
9,
421,
199,
318,
3721,
63,
1814,
8,
1431,
1113,
304,
523,
372,
1336,
1113,
14,
923,
8,
17,
9,
435,
1336,
1113,
14,
923,
8,
18,
9,
435,
19619,
627,
822,
8,
1431,
1113,
14,
923,
8,
19,
430,
421,
199,
318,
3656,
63,
6223,
8,
1210,
304,
523,
408,
5144,
314,
10999,
3326,
880,
781,
3372,
27158,
6272,
10999,
3326,
1041,
523,
2754,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
5130,
3,
5130,
2795,
5942,
523,
372,
359,
1733,
63,
264,
14,
954,
8,
3349,
63,
1814,
12,
1004,
9,
367,
1004,
315,
1324,
61,
421,
199,
318,
6313,
63,
1814,
8,
1431,
1113,
304,
523,
372,
2071,
83,
5,
83,
5,
83,
5,
83,
2,
450,
334,
1431,
1113,
14,
923,
8,
17,
395,
2432,
1336,
1113,
14,
923,
8,
18,
395,
2432,
283,
88,
16804,
552,
8,
1431,
1113,
14,
923,
8,
19,
1826,
2432,
1336,
1113,
14,
923,
8,
18,
430,
421,
199,
318,
3656,
63,
14005,
8,
1210,
304,
523,
408,
5144,
314,
10999,
3326,
880,
781,
3372,
27158,
6272,
10999,
3326,
1041,
523,
2754,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
3171,
435,
7813,
9407,
63,
907,
63,
3027,
9,
523,
372,
359,
1733,
63,
264,
14,
954,
8,
3513,
63,
1814,
12,
1004,
9,
367,
1004,
315,
1324,
61,
421,
199,
318,
886,
63,
1294,
8,
1210,
12,
9742,
63,
1210,
12,
2754,
63,
264,
304,
523,
1072,
275,
942,
523,
3656,
63,
1199,
275,
942,
523,
367,
334,
604,
12,
9742,
63,
604,
9,
315,
3482,
8,
1210,
12,
9742,
63,
1210,
304,
272,
333,
275,
2754,
63,
264,
14,
1431,
8,
11018,
63,
604,
9,
272,
1830,
333,
26,
489,
3715,
275,
822,
8,
77,
14,
923,
8,
17,
430,
489,
1004,
275,
1004,
1491,
1294,
61,
435,
519,
1154,
78,
7,
435,
1004,
59,
1294,
2938,
489,
9742,
63,
604,
275,
9742,
63,
604,
1491,
1294,
61,
435,
519,
1154,
78,
7,
435,
9742,
63,
604,
59,
1294,
2938,
489,
333,
275,
2754,
63,
264,
14,
1431,
8,
11018,
63,
604,
9,
272,
1072,
14,
2880,
8,
604,
14,
1294,
8,
82,
1154,
78,
1333,
272,
3656,
63,
1199,
14,
2880,
8,
11018,
63,
604,
14,
1294,
8,
82,
1154,
78,
1333,
523,
372,
334,
1199,
12,
3656,
63,
1199,
9,
421,
199,
318,
3715,
63,
3157,
63,
7828,
823,
8,
1210,
304,
523,
408,
5144,
83,
734,
314,
9344,
436,
6786,
12,
436,
2066,
19115,
5827,
523,
2385,
334,
1278,
626,
2530,
595,
314,
4270,
15192,
63,
22359,
295,
1159,
3432,
9,
2544,
523,
4363,
316,
3062,
5084,
14,
819,
5723,
787,
1202,
370,
3715,
2385,
1314,
1172,
3663,
27158,
641,
3062,
12,
880,
523,
626,
314,
14311,
10734,
876,
84,
13949,
1380,
1006,
1127,
344,
734,
334,
69,
14,
71,
14,
11261,
523,
27158,
1852,
282,
14213,
16788,
1004,
680,
523,
408,
523,
4270,
63,
1490,
63,
22359,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
7023,
7023,
12911,
8,
30453,
2961,
83,
13278,
16510,
7023,
12911,
8,
566,
358,
523,
4270,
63,
1600,
63,
22359,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
7023,
7272,
4988,
4360,
31,
10127,
83,
13278,
16510,
7272,
4988,
3948,
358,
819,
9742,
63,
1210,
275,
3656,
63,
14005,
8,
1210,
9,
523,
9742,
63,
1210,
275,
3656,
63,
6223,
8,
11018,
63,
1210,
9,
819,
334,
1199,
12,
3656,
63,
1199,
9,
275,
886,
63,
1294,
8,
1210,
12,
9742,
63,
1210,
12,
4270,
63,
1490,
63,
22359,
63,
264,
9,
523,
334,
1199,
12,
3656,
63,
1199,
9,
275,
886,
63,
1294,
8,
1199,
12,
3656,
63,
1199,
12,
4270,
63,
1600,
63,
22359,
63,
264,
9,
819,
372,
1072,
421,
199,
318,
2338,
63,
7828,
823,
8,
604,
304,
523,
408,
415,
8277,
4426,
402,
314,
1329,
402,
27158,
641,
282,
1627,
1004,
436,
2529,
314,
754,
14,
819,
2779,
9174,
737,
4697,
436,
1007,
1239,
3021,
367,
6876,
27158,
12,
436,
9584,
367,
1551,
27158,
14,
523,
408,
523,
1551,
63,
7828,
823,
275,
788,
59,
297,
283,
5102,
5041,
418,
523,
4002,
63,
7828,
823,
275,
359,
418,
297,
283,
3196,
28544,
418,
523,
11261,
63,
1861,
63,
264,
275,
295,
14,
2014,
8,
82,
6774,
6697,
16045,
83,
60,
7272,
4988,
1874,
11,
6697,
9,
16510,
7272,
4988,
4360,
31,
2862,
83,
10,
9988,
523,
12703,
275,
378,
523,
6202,
604,
275,
25071,
63,
907,
14,
954,
8,
82,
6448,
1004,
9,
523,
6202,
604,
275,
7813,
9407,
63,
907,
14,
954,
8,
82,
2,
891,
401,
6202,
604,
9,
523,
367,
1495,
315,
6202,
604,
26,
272,
367,
23549,
315,
1551,
63,
7828,
823,
26,
489,
340,
1495,
508,
23549,
26,
267,
12703,
847,
413,
272,
367,
23549,
315,
4002,
63,
7828,
823,
26,
489,
340,
1495,
508,
23549,
26,
267,
12703,
4862,
413,
819,
2410,
275,
756,
523,
340,
12703,
690,
378,
26,
272,
2410,
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,
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
] |
KNMI/VERCE | verce-hpc-pe/src/networkx/algorithms/centrality/tests/test_closeness_centrality.py | 84 | 2746 | """
Tests for degree centrality.
"""
from nose.tools import *
import networkx as nx
class TestClosenessCentrality:
def setUp(self):
self.K = nx.krackhardt_kite_graph()
self.P3 = nx.path_graph(3)
self.P4 = nx.path_graph(4)
self.K5 = nx.complete_graph(5)
self.C4=nx.cycle_graph(4)
self.T=nx.balanced_tree(r=2, h=2)
self.Gb = nx.Graph()
self.Gb.add_edges_from([(0,1), (0,2), (1,3), (2,3),
(2,4), (4,5), (3,5)])
F = nx.florentine_families_graph()
self.F = F
def test_k5_closeness(self):
c=nx.closeness_centrality(self.K5)
d={0: 1.000,
1: 1.000,
2: 1.000,
3: 1.000,
4: 1.000}
for n in sorted(self.K5):
assert_almost_equal(c[n],d[n],places=3)
def test_p3_closeness(self):
c=nx.closeness_centrality(self.P3)
d={0: 0.667,
1: 1.000,
2: 0.667}
for n in sorted(self.P3):
assert_almost_equal(c[n],d[n],places=3)
def test_krackhardt_closeness(self):
c=nx.closeness_centrality(self.K)
d={0: 0.529,
1: 0.529,
2: 0.500,
3: 0.600,
4: 0.500,
5: 0.643,
6: 0.643,
7: 0.600,
8: 0.429,
9: 0.310}
for n in sorted(self.K):
assert_almost_equal(c[n],d[n],places=3)
def test_florentine_families_closeness(self):
c=nx.closeness_centrality(self.F)
d={'Acciaiuoli': 0.368,
'Albizzi': 0.483,
'Barbadori': 0.4375,
'Bischeri': 0.400,
'Castellani': 0.389,
'Ginori': 0.333,
'Guadagni': 0.467,
'Lamberteschi': 0.326,
'Medici': 0.560,
'Pazzi': 0.286,
'Peruzzi': 0.368,
'Ridolfi': 0.500,
'Salviati': 0.389,
'Strozzi': 0.4375,
'Tornabuoni': 0.483}
for n in sorted(self.F):
assert_almost_equal(c[n],d[n],places=3)
def test_weighted_closeness(self):
XG=nx.Graph()
XG.add_weighted_edges_from([('s','u',10), ('s','x',5), ('u','v',1),
('u','x',2), ('v','y',1), ('x','u',3),
('x','v',5), ('x','y',2), ('y','s',7),
('y','v',6)])
c=nx.closeness_centrality(XG,distance='weight')
d={'y': 0.200,
'x': 0.286,
's': 0.138,
'u': 0.235,
'v': 0.200}
for n in sorted(XG):
assert_almost_equal(c[n],d[n],places=3)
| mit | [
624,
199,
2925,
367,
13666,
9679,
28602,
14,
199,
624,
199,
504,
11354,
14,
2537,
492,
627,
199,
646,
24313,
465,
8484,
199,
199,
533,
1379,
4724,
4171,
18345,
28602,
26,
272,
347,
3613,
8,
277,
304,
398,
291,
14,
43,
275,
8484,
14,
75,
8085,
8726,
84,
63,
75,
1175,
63,
2180,
342,
267,
291,
14,
48,
19,
275,
8484,
14,
515,
63,
2180,
8,
19,
9,
267,
291,
14,
48,
20,
275,
8484,
14,
515,
63,
2180,
8,
20,
9,
267,
291,
14,
43,
21,
275,
8484,
14,
4883,
63,
2180,
8,
21,
9,
398,
291,
14,
35,
20,
29,
7343,
14,
7612,
63,
2180,
8,
20,
9,
267,
291,
14,
52,
29,
7343,
14,
18923,
63,
2350,
8,
82,
29,
18,
12,
394,
29,
18,
9,
267,
291,
14,
30271,
275,
8484,
14,
4578,
342,
267,
291,
14,
30271,
14,
525,
63,
6929,
63,
504,
7694,
16,
12,
17,
395,
334,
16,
12,
18,
395,
334,
17,
12,
19,
395,
334,
18,
12,
19,
395,
221,
1816,
334,
18,
12,
20,
395,
334,
20,
12,
21,
395,
334,
19,
12,
21,
3948,
7318,
481,
275,
8484,
14,
28233,
640,
1132,
63,
32337,
63,
2180,
342,
267,
291,
14,
38,
275,
481,
2378,
347,
511,
63,
75,
21,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
43,
21,
9,
267,
366,
3126,
16,
26,
413,
14,
1493,
12,
1779,
413,
26,
413,
14,
1493,
12,
1779,
499,
26,
413,
14,
1493,
12,
1779,
650,
26,
413,
14,
1493,
12,
1779,
841,
26,
413,
14,
1493,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
43,
21,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
80,
19,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
48,
19,
9,
267,
366,
3126,
16,
26,
378,
14,
14916,
12,
1779,
413,
26,
413,
14,
1493,
12,
1779,
499,
26,
378,
14,
14916,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
48,
19,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
75,
8085,
8726,
84,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
43,
9,
267,
366,
3126,
16,
26,
378,
14,
28762,
12,
1779,
413,
26,
378,
14,
28762,
12,
1779,
499,
26,
378,
14,
5783,
12,
1779,
650,
26,
378,
14,
6683,
12,
1779,
841,
26,
378,
14,
5783,
12,
1779,
959,
26,
378,
14,
14637,
12,
1779,
1227,
26,
378,
14,
14637,
12,
1779,
1520,
26,
378,
14,
6683,
12,
1779,
1695,
26,
378,
14,
14372,
12,
1779,
1749,
26,
378,
14,
18035,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
43,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
28233,
640,
1132,
63,
32337,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
38,
9,
267,
366,
3713,
1945,
559,
5789,
13780,
317,
356,
259,
378,
14,
10997,
12,
1779,
283,
2439,
66,
565,
16079,
356,
755,
378,
14,
23946,
12,
1779,
283,
5281,
4087,
16039,
356,
258,
378,
14,
20,
9946,
12,
1779,
283,
34,
374,
7641,
73,
356,
420,
378,
14,
5303,
12,
1779,
283,
35,
9209,
914,
26455,
356,
259,
378,
14,
22018,
12,
1779,
283,
39,
262,
16039,
356,
263,
378,
14,
11769,
12,
1779,
283,
39,
8346,
643,
8445,
356,
420,
378,
14,
16226,
12,
1779,
283,
44,
455,
605,
744,
13175,
356,
221,
378,
14,
8342,
12,
1779,
283,
1352,
328,
559,
356,
263,
378,
14,
15789,
12,
1779,
283,
4232,
4348,
73,
356,
260,
378,
14,
11125,
12,
1779,
283,
2623,
85,
4348,
73,
356,
755,
378,
14,
10997,
12,
1779,
283,
50,
31090,
276,
73,
356,
755,
378,
14,
5783,
12,
1779,
283,
27177,
433,
2159,
356,
420,
378,
14,
22018,
12,
1779,
283,
933,
293,
4348,
73,
356,
755,
378,
14,
20,
9946,
12,
1779,
283,
52,
6161,
371,
21615,
73,
356,
259,
378,
14,
23946,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
38,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
13522,
63,
1600,
4171,
8,
277,
304,
267,
1323,
39,
29,
7343,
14,
4578,
342,
267,
1323,
39,
14,
525,
63,
13522,
63,
6929,
63,
504,
8318,
83,
1673,
85,
297,
709,
395,
661,
83,
1673,
88,
297,
21,
395,
661,
85,
1673,
86,
297,
17,
395,
2511,
661,
85,
1673,
88,
297,
18,
395,
661,
86,
1673,
89,
297,
17,
395,
661,
88,
1673,
85,
297,
19,
395,
2511,
661,
88,
1673,
86,
297,
21,
395,
661,
88,
1673,
89,
297,
18,
395,
661,
89,
1673,
83,
297,
23,
395,
2511,
661,
89,
1673,
86,
297,
22,
3948,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
56,
39,
12,
5590,
534,
3463,
358,
267,
366,
3713,
89,
356,
378,
14,
1840,
12,
1779,
283,
88,
356,
378,
14,
11125,
12,
1779,
283,
83,
356,
378,
14,
8527,
12,
1779,
283,
85,
356,
378,
14,
8276,
12,
1779,
283,
86,
356,
378,
14,
1840,
93,
267,
367,
302,
315,
3355,
8,
56,
39,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
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
] | [
199,
2925,
367,
13666,
9679,
28602,
14,
199,
624,
199,
504,
11354,
14,
2537,
492,
627,
199,
646,
24313,
465,
8484,
199,
199,
533,
1379,
4724,
4171,
18345,
28602,
26,
272,
347,
3613,
8,
277,
304,
398,
291,
14,
43,
275,
8484,
14,
75,
8085,
8726,
84,
63,
75,
1175,
63,
2180,
342,
267,
291,
14,
48,
19,
275,
8484,
14,
515,
63,
2180,
8,
19,
9,
267,
291,
14,
48,
20,
275,
8484,
14,
515,
63,
2180,
8,
20,
9,
267,
291,
14,
43,
21,
275,
8484,
14,
4883,
63,
2180,
8,
21,
9,
398,
291,
14,
35,
20,
29,
7343,
14,
7612,
63,
2180,
8,
20,
9,
267,
291,
14,
52,
29,
7343,
14,
18923,
63,
2350,
8,
82,
29,
18,
12,
394,
29,
18,
9,
267,
291,
14,
30271,
275,
8484,
14,
4578,
342,
267,
291,
14,
30271,
14,
525,
63,
6929,
63,
504,
7694,
16,
12,
17,
395,
334,
16,
12,
18,
395,
334,
17,
12,
19,
395,
334,
18,
12,
19,
395,
221,
1816,
334,
18,
12,
20,
395,
334,
20,
12,
21,
395,
334,
19,
12,
21,
3948,
7318,
481,
275,
8484,
14,
28233,
640,
1132,
63,
32337,
63,
2180,
342,
267,
291,
14,
38,
275,
481,
2378,
347,
511,
63,
75,
21,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
43,
21,
9,
267,
366,
3126,
16,
26,
413,
14,
1493,
12,
1779,
413,
26,
413,
14,
1493,
12,
1779,
499,
26,
413,
14,
1493,
12,
1779,
650,
26,
413,
14,
1493,
12,
1779,
841,
26,
413,
14,
1493,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
43,
21,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
80,
19,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
48,
19,
9,
267,
366,
3126,
16,
26,
378,
14,
14916,
12,
1779,
413,
26,
413,
14,
1493,
12,
1779,
499,
26,
378,
14,
14916,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
48,
19,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
75,
8085,
8726,
84,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
43,
9,
267,
366,
3126,
16,
26,
378,
14,
28762,
12,
1779,
413,
26,
378,
14,
28762,
12,
1779,
499,
26,
378,
14,
5783,
12,
1779,
650,
26,
378,
14,
6683,
12,
1779,
841,
26,
378,
14,
5783,
12,
1779,
959,
26,
378,
14,
14637,
12,
1779,
1227,
26,
378,
14,
14637,
12,
1779,
1520,
26,
378,
14,
6683,
12,
1779,
1695,
26,
378,
14,
14372,
12,
1779,
1749,
26,
378,
14,
18035,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
43,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
28233,
640,
1132,
63,
32337,
63,
1600,
4171,
8,
277,
304,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
277,
14,
38,
9,
267,
366,
3713,
1945,
559,
5789,
13780,
317,
356,
259,
378,
14,
10997,
12,
1779,
283,
2439,
66,
565,
16079,
356,
755,
378,
14,
23946,
12,
1779,
283,
5281,
4087,
16039,
356,
258,
378,
14,
20,
9946,
12,
1779,
283,
34,
374,
7641,
73,
356,
420,
378,
14,
5303,
12,
1779,
283,
35,
9209,
914,
26455,
356,
259,
378,
14,
22018,
12,
1779,
283,
39,
262,
16039,
356,
263,
378,
14,
11769,
12,
1779,
283,
39,
8346,
643,
8445,
356,
420,
378,
14,
16226,
12,
1779,
283,
44,
455,
605,
744,
13175,
356,
221,
378,
14,
8342,
12,
1779,
283,
1352,
328,
559,
356,
263,
378,
14,
15789,
12,
1779,
283,
4232,
4348,
73,
356,
260,
378,
14,
11125,
12,
1779,
283,
2623,
85,
4348,
73,
356,
755,
378,
14,
10997,
12,
1779,
283,
50,
31090,
276,
73,
356,
755,
378,
14,
5783,
12,
1779,
283,
27177,
433,
2159,
356,
420,
378,
14,
22018,
12,
1779,
283,
933,
293,
4348,
73,
356,
755,
378,
14,
20,
9946,
12,
1779,
283,
52,
6161,
371,
21615,
73,
356,
259,
378,
14,
23946,
93,
267,
367,
302,
315,
3355,
8,
277,
14,
38,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
9,
339,
347,
511,
63,
13522,
63,
1600,
4171,
8,
277,
304,
267,
1323,
39,
29,
7343,
14,
4578,
342,
267,
1323,
39,
14,
525,
63,
13522,
63,
6929,
63,
504,
8318,
83,
1673,
85,
297,
709,
395,
661,
83,
1673,
88,
297,
21,
395,
661,
85,
1673,
86,
297,
17,
395,
2511,
661,
85,
1673,
88,
297,
18,
395,
661,
86,
1673,
89,
297,
17,
395,
661,
88,
1673,
85,
297,
19,
395,
2511,
661,
88,
1673,
86,
297,
21,
395,
661,
88,
1673,
89,
297,
18,
395,
661,
89,
1673,
83,
297,
23,
395,
2511,
661,
89,
1673,
86,
297,
22,
3948,
267,
286,
29,
7343,
14,
1600,
4171,
63,
2497,
28602,
8,
56,
39,
12,
5590,
534,
3463,
358,
267,
366,
3713,
89,
356,
378,
14,
1840,
12,
1779,
283,
88,
356,
378,
14,
11125,
12,
1779,
283,
83,
356,
378,
14,
8527,
12,
1779,
283,
85,
356,
378,
14,
8276,
12,
1779,
283,
86,
356,
378,
14,
1840,
93,
267,
367,
302,
315,
3355,
8,
56,
39,
304,
288,
702,
63,
4398,
63,
1452,
8,
67,
59,
78,
467,
68,
59,
78,
467,
10696,
29,
19,
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,
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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
] |
apagac/robottelo | tests/foreman/ui/test_operatingsys.py | 2 | 19232 | # -*- encoding: utf-8 -*-
"""Test class for Operating System UI"""
from ddt import ddt
from fauxfactory import gen_string
from robottelo import entities
from robottelo.common.constants import (
INSTALL_MEDIUM_URL, PARTITION_SCRIPT_DATA_FILE)
from robottelo.common.decorators import data
from robottelo.common.decorators import run_only_on, skip_if_bug_open
from robottelo.common.helpers import get_data_file
from robottelo.test import UITestCase
from robottelo.ui.factory import make_os
from robottelo.ui.locators import common_locators
from robottelo.ui.session import Session
@run_only_on('sat')
@ddt
class OperatingSys(UITestCase):
"""Implements Operating system tests from UI"""
@classmethod
def setUpClass(cls): # noqa
org_attrs = entities.Organization().create_json()
cls.org_name = org_attrs['name']
cls.org_id = org_attrs['id']
super(OperatingSys, cls).setUpClass()
def test_create_os(self):
"""@Test: Create a new OS
@Feature: OS - Positive Create
@Assert: OS is created
"""
name = gen_string("alpha", 6)
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 1)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.search(name))
@data({u'name': gen_string('alpha', 10),
u'major_version': gen_string('numeric', 1),
u'minor_version': gen_string('numeric', 1),
u'desc': gen_string('alpha', 10),
u'os_family': "Red Hat"},
{u'name': gen_string('html', 10),
u'major_version': gen_string('numeric', 4),
u'minor_version': gen_string('numeric', 4),
u'desc': gen_string('html', 10),
u'os_family': "Gentoo"},
{u'name': gen_string('utf8', 10),
u'major_version': gen_string('numeric', 5),
u'minor_version': gen_string('numeric', 16),
u'desc': gen_string('utf8', 10),
u'os_family': "SUSE"},
{u'name': gen_string('alphanumeric', 255),
u'major_version': gen_string('numeric', 5),
u'minor_version': gen_string('numeric', 1),
u'desc': gen_string('alphanumeric', 255),
u'os_family': "SUSE"})
def test_positive_create_os(self, test_data):
"""@Test: Create a new OS with different data values
@Feature: OS - Positive Create
@Assert: OS is created
@BZ: 1120568
"""
arch = "i386"
with Session(self.browser) as session:
make_os(session, name=test_data['name'],
major_version=test_data['major_version'],
minor_version=test_data['minor_version'],
description=test_data['desc'],
os_family=test_data['os_family'], archs=[arch])
self.assertIsNotNone(self.operatingsys.search
(test_data['desc'], search_key="description"))
def test_negative_create_os_1(self):
"""@Test: OS - Create a new OS with 256 characters in name
@Feature: Create a new OS - Negative
@Assert: OS is not created
@BZ: 1120181
"""
name = gen_string("alpha", 256)
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 1)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["name_haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_negative_create_os_2(self):
"""@Test: OS - Create a new OS with blank name
@Feature: Create a new OS - Negative
@Assert: OS is not created
"""
name = ""
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 1)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["name_haserror"]))
def test_negative_create_os_3(self):
"""@Test: OS - Create a new OS with description containing
256 characters
@Feature: Create a new OS - Negative
@Assert: OS is not created
"""
name = gen_string("alpha", 6)
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 1)
description = gen_string("alphanumeric", 256)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
description=description,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_negative_create_os_4(self):
"""@Test: OS - Create a new OS with long major version (More than 5
characters in major version)
@Feature: Create a new OS - Negative
@Assert: OS is not created
"""
name = gen_string("alpha", 6)
major_version = gen_string('numeric', 6)
minor_version = gen_string('numeric', 1)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_negative_create_os_5(self):
"""@Test: OS - Create a new OS with long minor version (More than 16
characters in minor version)
@Feature: Create a new OS - Negative
@Assert: OS is not created
"""
name = gen_string("alpha", 6)
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 17)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_negative_create_os_6(self):
"""@Test: OS - Create a new OS without major version
@Feature: Create a new OS - Negative
@Assert: OS is not created
"""
name = gen_string("alpha", 6)
major_version = " "
minor_version = gen_string('numeric', 6)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_negative_create_os_7(self):
"""@Test: OS - Create a new OS with -ve value of major version
@Feature: Create a new OS - Negative
@Assert: OS is not created
@BZ: 1120199
"""
name = gen_string("alpha", 6)
major_version = "-6"
minor_version = "-5"
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
@skip_if_bug_open('bugzilla', 1120985)
def test_negative_create_os_8(self):
"""@Test: OS - Create a new OS with same name and version
@Feature: Create a new OS - Negative
@Assert: OS is not created
@BZ: 1120985
"""
name = gen_string("alpha", 6)
major_version = gen_string('numeric', 1)
minor_version = gen_string('numeric', 1)
os_family = "Red Hat"
arch = "x86_64"
with Session(self.browser) as session:
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.search(name))
make_os(session, name=name,
major_version=major_version,
minor_version=minor_version,
os_family=os_family, archs=[arch])
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["haserror"]))
self.assertIsNone(self.operatingsys.search(name))
def test_remove_os(self):
"""@Test: Delete an existing OS
@Feature: OS - Positive Delete
@Assert: OS is deleted
"""
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser) as session:
session.nav.go_to_operating_systems()
self.operatingsys.delete(os_name, really=True)
self.assertIsNone(self.operatingsys.search(os_name))
@data(
{u'new_name': gen_string('alpha', 10),
u'new_major_version': gen_string('numeric', 1),
u'new_minor_version': gen_string('numeric', 1),
u'new_os_family': "Red Hat"},
{u'new_name': gen_string('html', 10),
u'new_major_version': gen_string('numeric', 4),
u'new_minor_version': gen_string('numeric', 4),
u'new_os_family': "Gentoo"},
{u'new_name': gen_string('utf8', 10),
u'new_major_version': gen_string('numeric', 5),
u'new_minor_version': gen_string('numeric', 16),
u'new_os_family': "SUSE"},
{u'new_name': gen_string('alphanumeric', 255),
u'new_major_version': gen_string('numeric', 5),
u'new_minor_version': gen_string('numeric', 1),
u'new_os_family': "SUSE"}
)
def test_update_os_1(self, test_data):
"""@Test: Update OS name, major_version, minor_version, os_family
and arch
@Feature: OS - Positive Update
@Assert: OS is updated
"""
os_name = entities.OperatingSystem().create_json()['name']
arch_name = entities.Architecture().create_json()['name']
with Session(self.browser):
self.operatingsys.update(os_name, test_data['new_name'],
test_data['new_major_version'],
test_data['new_minor_version'],
os_family=test_data['new_os_family'],
new_archs=[arch_name])
self.assertIsNotNone(self.operatingsys.search(
test_data['new_name']))
def test_update_os_medium(self):
"""@Test: Update OS medium
@Feature: OS - Positive Update
@Assert: OS is updated
"""
medium_name = gen_string("alpha", 4)
path = INSTALL_MEDIUM_URL % medium_name
entities.Media(
name=medium_name,
media_path=path,
organization=[self.org_id],
).create_json()
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser) as session:
session.nav.go_to_select_org(self.org_name)
self.operatingsys.update(os_name, new_mediums=[medium_name])
result_obj = self.operatingsys.get_os_entities(os_name, "medium")
self.assertEqual(medium_name, result_obj['medium'])
def test_update_os_partition_table(self):
"""@Test: Update OS partition table
@Feature: OS - Positive Update
@Assert: OS is updated
"""
ptable = gen_string("alpha", 4)
script_file = get_data_file(PARTITION_SCRIPT_DATA_FILE)
with open(script_file, 'r') as file_contents:
layout = file_contents.read()
entities.PartitionTable(
name=ptable,
layout=layout,
).create_json()
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
self.operatingsys.update(os_name, new_ptables=[ptable])
result_obj = self.operatingsys.get_os_entities(os_name, "ptable")
self.assertEqual(ptable, result_obj['ptable'])
def test_update_os_template(self):
"""@Test: Update provisioning template
@Feature: OS - Positive Update
@Assert: OS is updated
@BZ: 1129612
"""
os_name = gen_string("alpha", 4)
template_name = gen_string("alpha", 4)
os_attrs = entities.OperatingSystem(name=os_name).create_json()
entities.ConfigTemplate(
name=template_name,
operatingsystem=[os_attrs['id']],
organization=[self.org_id],
).create_json()
with Session(self.browser) as session:
session.nav.go_to_select_org(self.org_name)
self.operatingsys.update(os_name, template=template_name)
result_obj = self.operatingsys.get_os_entities(os_name, "template")
self.assertEqual(template_name, result_obj['template'])
def test_positive_set_os_parameter_1(self):
"""@Test: Set OS parameter
@Feature: OS - Positive Update
@Assert: OS is updated
"""
param_name = gen_string("alpha", 4)
param_value = gen_string("alpha", 3)
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
except Exception as e:
self.fail(e)
def test_positive_set_os_parameter_2(self):
"""@Test: Set OS parameter with blank value
@Feature: OS - Positive update
@Assert: Parameter is created with blank value
"""
param_name = gen_string("alpha", 4)
param_value = ""
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
except Exception as e:
self.fail(e)
def test_remove_os_parameter(self):
"""@Test: Remove selected OS parameter
@Feature: OS - Positive Update
@Assert: OS is updated
"""
param_name = gen_string("alpha", 4)
param_value = gen_string("alpha", 3)
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
self.operatingsys.remove_os_parameter(os_name, param_name)
except Exception as e:
self.fail(e)
def test_negative_set_os_parameter_1(self):
"""@Test: Set same OS parameter again as it was set earlier
@Feature: OS - Negative Update
@Assert: Proper error should be raised, Name already taken
@BZ: 1120663
"""
param_name = gen_string("alpha", 4)
param_value = gen_string("alpha", 3)
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
except Exception as e:
self.fail(e)
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["common_param_error"]))
def test_negative_set_os_parameter_2(self):
"""@Test: Set OS parameter with blank name and value
@Feature: OS - Negative Update
@Assert: Proper error should be raised, Name can't contain whitespaces
@BZ: 1120663
"""
param_name = " "
param_value = " "
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
except Exception as e:
self.fail(e)
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["common_param_error"]))
def test_negative_set_os_parameter_3(self):
"""@Test: Set OS parameter with name and value exceeding 255 characters
@Feature: OS - Negative Update
@Assert: Proper error should be raised, Name should contain a value
"""
param_name = gen_string("alpha", 256)
param_value = gen_string("alpha", 256)
os_name = entities.OperatingSystem().create_json()['name']
with Session(self.browser):
try:
self.operatingsys.set_os_parameter(os_name, param_name,
param_value)
except Exception as e:
self.fail(e)
self.assertIsNotNone(self.operatingsys.wait_until_element
(common_locators["common_param_error"]))
| gpl-3.0 | [
3,
1882,
2644,
26,
2774,
13,
24,
1882,
199,
624,
774,
1021,
367,
6654,
1958,
6187,
14041,
624,
199,
199,
504,
366,
3583,
492,
366,
3583,
199,
504,
1433,
2521,
3702,
492,
3805,
63,
875,
199,
504,
14544,
266,
320,
492,
9045,
199,
504,
14544,
266,
320,
14,
2330,
14,
5559,
492,
334,
272,
20514,
1761,
63,
9754,
2639,
63,
2632,
12,
3076,
12039,
63,
10484,
63,
3998,
63,
3817,
9,
199,
504,
14544,
266,
320,
14,
2330,
14,
11582,
492,
666,
199,
504,
14544,
266,
320,
14,
2330,
14,
11582,
492,
1255,
63,
2118,
63,
265,
12,
3372,
63,
692,
63,
1266,
63,
1490,
199,
504,
14544,
266,
320,
14,
2330,
14,
7546,
492,
664,
63,
576,
63,
493,
199,
504,
14544,
266,
320,
14,
396,
492,
738,
649,
27309,
199,
504,
14544,
266,
320,
14,
1907,
14,
3702,
492,
1852,
63,
736,
199,
504,
14544,
266,
320,
14,
1907,
14,
2102,
2750,
492,
2863,
63,
2102,
2750,
199,
504,
14544,
266,
320,
14,
1907,
14,
1730,
492,
8596,
421,
199,
32,
1065,
63,
2118,
63,
265,
360,
14997,
358,
199,
32,
11138,
199,
533,
6654,
1958,
11319,
8,
28666,
27309,
304,
272,
408,
29452,
6654,
1958,
2656,
2295,
687,
14041,
624,
339,
768,
3744,
272,
347,
18561,
8,
1886,
304,
221,
327,
8151,
267,
5981,
63,
3288,
275,
9045,
14,
15928,
1252,
981,
63,
1001,
342,
267,
843,
14,
1308,
63,
354,
275,
5981,
63,
3288,
459,
354,
418,
267,
843,
14,
1308,
63,
344,
275,
5981,
63,
3288,
459,
344,
418,
267,
1613,
8,
23699,
11319,
12,
843,
680,
27777,
342,
339,
347,
511,
63,
981,
63,
736,
8,
277,
304,
267,
408,
32,
774,
26,
2790,
282,
892,
4403,
398,
768,
5968,
26,
4403,
446,
30245,
2790,
398,
768,
9699,
26,
4403,
365,
2737,
398,
408,
398,
536,
275,
3805,
63,
875,
480,
4468,
401,
1227,
9,
267,
12160,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
12612,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
747,
63,
6606,
275,
298,
10858,
13002,
2,
267,
3819,
275,
298,
88,
1184,
63,
772,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
354,
12,
490,
12160,
63,
1023,
29,
8452,
63,
1023,
12,
490,
12612,
63,
1023,
29,
11067,
63,
1023,
12,
490,
747,
63,
6606,
29,
736,
63,
6606,
12,
32244,
1524,
1047,
566,
288,
291,
14,
10389,
8,
277,
14,
2262,
292,
780,
588,
14,
1733,
8,
354,
430,
339,
768,
576,
2561,
85,
7,
354,
356,
3805,
63,
875,
360,
4468,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
4468,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
10858,
13002,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
1360,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
841,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
841,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
1360,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
8168,
7354,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
1624,
24,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
959,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
3193,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
1624,
24,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
51,
4701,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
31119,
297,
5450,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
959,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
31119,
297,
5450,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
51,
4701,
5984,
272,
347,
511,
63,
8965,
63,
981,
63,
736,
8,
277,
12,
511,
63,
576,
304,
267,
408,
32,
774,
26,
2790,
282,
892,
4403,
543,
3365,
666,
1338,
398,
768,
5968,
26,
4403,
446,
30245,
2790,
398,
768,
9699,
26,
4403,
365,
2737,
398,
768,
21338,
26,
413,
6708,
15085,
398,
408,
398,
3819,
275,
298,
73,
8040,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
396,
63,
576,
459,
354,
995,
490,
12160,
63,
1023,
29,
396,
63,
576,
459,
8452,
63,
1023,
995,
490,
12612,
63,
1023,
29,
396,
63,
576,
459,
11067,
63,
1023,
995,
490,
1369,
29,
396,
63,
576,
459,
3257,
995,
490,
747,
63,
6606,
29,
396,
63,
576,
459,
736,
63,
6606,
995,
32244,
1524,
1047,
566,
288,
291,
14,
10389,
8,
277,
14,
2262,
292,
780,
588,
14,
1733,
639,
334,
396,
63,
576,
459,
3257,
995,
2754,
63,
498,
628,
1802,
2237,
339,
347,
511,
63,
7371,
63,
981,
63,
736,
63,
17,
8,
277,
304,
267,
408,
32,
774,
26,
4403,
446,
2790,
282,
892,
4403,
543,
7633,
4110,
315,
536,
398,
768,
5968,
26,
2790,
282,
892,
4403,
446,
32548,
398,
768,
9699,
26,
4403,
365,
440,
2737,
398,
768,
21338,
26,
20240,
614,
2835,
398,
408,
398,
536,
275,
3805,
63,
875,
480,
4468,
401,
7633,
9,
267,
12160,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
12612,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
747,
63,
6606,
275,
298,
10858,
13002,
2,
267,
3819,
275,
298,
88,
1184,
63,
772,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
354,
12,
490,
12160,
63,
1023,
29,
8452,
63,
1023,
12,
490,
12612,
63,
1023,
29,
11067,
63,
1023
] | [
1882,
2644,
26,
2774,
13,
24,
1882,
199,
624,
774,
1021,
367,
6654,
1958,
6187,
14041,
624,
199,
199,
504,
366,
3583,
492,
366,
3583,
199,
504,
1433,
2521,
3702,
492,
3805,
63,
875,
199,
504,
14544,
266,
320,
492,
9045,
199,
504,
14544,
266,
320,
14,
2330,
14,
5559,
492,
334,
272,
20514,
1761,
63,
9754,
2639,
63,
2632,
12,
3076,
12039,
63,
10484,
63,
3998,
63,
3817,
9,
199,
504,
14544,
266,
320,
14,
2330,
14,
11582,
492,
666,
199,
504,
14544,
266,
320,
14,
2330,
14,
11582,
492,
1255,
63,
2118,
63,
265,
12,
3372,
63,
692,
63,
1266,
63,
1490,
199,
504,
14544,
266,
320,
14,
2330,
14,
7546,
492,
664,
63,
576,
63,
493,
199,
504,
14544,
266,
320,
14,
396,
492,
738,
649,
27309,
199,
504,
14544,
266,
320,
14,
1907,
14,
3702,
492,
1852,
63,
736,
199,
504,
14544,
266,
320,
14,
1907,
14,
2102,
2750,
492,
2863,
63,
2102,
2750,
199,
504,
14544,
266,
320,
14,
1907,
14,
1730,
492,
8596,
421,
199,
32,
1065,
63,
2118,
63,
265,
360,
14997,
358,
199,
32,
11138,
199,
533,
6654,
1958,
11319,
8,
28666,
27309,
304,
272,
408,
29452,
6654,
1958,
2656,
2295,
687,
14041,
624,
339,
768,
3744,
272,
347,
18561,
8,
1886,
304,
221,
327,
8151,
267,
5981,
63,
3288,
275,
9045,
14,
15928,
1252,
981,
63,
1001,
342,
267,
843,
14,
1308,
63,
354,
275,
5981,
63,
3288,
459,
354,
418,
267,
843,
14,
1308,
63,
344,
275,
5981,
63,
3288,
459,
344,
418,
267,
1613,
8,
23699,
11319,
12,
843,
680,
27777,
342,
339,
347,
511,
63,
981,
63,
736,
8,
277,
304,
267,
408,
32,
774,
26,
2790,
282,
892,
4403,
398,
768,
5968,
26,
4403,
446,
30245,
2790,
398,
768,
9699,
26,
4403,
365,
2737,
398,
408,
398,
536,
275,
3805,
63,
875,
480,
4468,
401,
1227,
9,
267,
12160,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
12612,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
747,
63,
6606,
275,
298,
10858,
13002,
2,
267,
3819,
275,
298,
88,
1184,
63,
772,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
354,
12,
490,
12160,
63,
1023,
29,
8452,
63,
1023,
12,
490,
12612,
63,
1023,
29,
11067,
63,
1023,
12,
490,
747,
63,
6606,
29,
736,
63,
6606,
12,
32244,
1524,
1047,
566,
288,
291,
14,
10389,
8,
277,
14,
2262,
292,
780,
588,
14,
1733,
8,
354,
430,
339,
768,
576,
2561,
85,
7,
354,
356,
3805,
63,
875,
360,
4468,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
4468,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
10858,
13002,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
1360,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
841,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
841,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
1360,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
8168,
7354,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
1624,
24,
297,
1616,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
959,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
3193,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
1624,
24,
297,
1616,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
51,
4701,
6018,
881,
469,
85,
7,
354,
356,
3805,
63,
875,
360,
31119,
297,
5450,
395,
1779,
399,
6704,
65,
5857,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
959,
395,
1779,
399,
6704,
262,
269,
63,
1023,
356,
3805,
63,
875,
360,
6677,
297,
413,
395,
1779,
399,
5121,
19303,
356,
3805,
63,
875,
360,
31119,
297,
5450,
395,
1779,
399,
7,
736,
63,
6606,
356,
298,
51,
4701,
5984,
272,
347,
511,
63,
8965,
63,
981,
63,
736,
8,
277,
12,
511,
63,
576,
304,
267,
408,
32,
774,
26,
2790,
282,
892,
4403,
543,
3365,
666,
1338,
398,
768,
5968,
26,
4403,
446,
30245,
2790,
398,
768,
9699,
26,
4403,
365,
2737,
398,
768,
21338,
26,
413,
6708,
15085,
398,
408,
398,
3819,
275,
298,
73,
8040,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
396,
63,
576,
459,
354,
995,
490,
12160,
63,
1023,
29,
396,
63,
576,
459,
8452,
63,
1023,
995,
490,
12612,
63,
1023,
29,
396,
63,
576,
459,
11067,
63,
1023,
995,
490,
1369,
29,
396,
63,
576,
459,
3257,
995,
490,
747,
63,
6606,
29,
396,
63,
576,
459,
736,
63,
6606,
995,
32244,
1524,
1047,
566,
288,
291,
14,
10389,
8,
277,
14,
2262,
292,
780,
588,
14,
1733,
639,
334,
396,
63,
576,
459,
3257,
995,
2754,
63,
498,
628,
1802,
2237,
339,
347,
511,
63,
7371,
63,
981,
63,
736,
63,
17,
8,
277,
304,
267,
408,
32,
774,
26,
4403,
446,
2790,
282,
892,
4403,
543,
7633,
4110,
315,
536,
398,
768,
5968,
26,
2790,
282,
892,
4403,
446,
32548,
398,
768,
9699,
26,
4403,
365,
440,
2737,
398,
768,
21338,
26,
20240,
614,
2835,
398,
408,
398,
536,
275,
3805,
63,
875,
480,
4468,
401,
7633,
9,
267,
12160,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
12612,
63,
1023,
275,
3805,
63,
875,
360,
6677,
297,
413,
9,
267,
747,
63,
6606,
275,
298,
10858,
13002,
2,
267,
3819,
275,
298,
88,
1184,
63,
772,
2,
267,
543,
8596,
8,
277,
14,
5750,
9,
465,
2351,
26,
288,
1852,
63,
736,
8,
1730,
12,
536,
29,
354,
12,
490,
12160,
63,
1023,
29,
8452,
63,
1023,
12,
490,
12612,
63,
1023,
29,
11067,
63,
1023,
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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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
clovis/PhiloLogic4 | www/webApp.py | 2 | 7294 | #!/usr/bin/env python3
"""Bootstrap Web app"""
import os.path
from philologic.runtime import WebConfig
from philologic.runtime import WSGIHandler
from philologic.runtime import access_control
from philologic.utils import load_module
config = WebConfig(os.path.abspath(os.path.dirname(__file__)))
global_config = load_module("philologic4", config.global_config_location)
path = os.path.abspath(os.path.dirname(__file__))
dbname = path.strip().split("/")[-1]
config = WebConfig(os.path.abspath(os.path.dirname(__file__)))
config_location = os.path.join("app/assets/css/split/", os.path.basename(config.theme))
if os.path.realpath(os.path.abspath(config.theme)) == os.path.realpath(os.path.abspath(config_location)):
theme = config_location
elif os.path.exists(config_location) and config.production:
theme = config_location
else:
os.system("cp %s %s" % (config.theme, config_location))
theme = config_location
css_files = [
"app/assets/css/bootstrap.min.css",
"app/assets/css/split/style.css",
"app/assets/css/split/searchForm.css",
"app/assets/css/split/landingPage.css",
"app/assets/css/split/concordanceKwic.css",
"app/assets/css/split/timeSeries.css",
"app/assets/css/image_gallery/blueimp-gallery.min.css",
"app/assets/css/split/textObjectNavigation.css",
theme,
]
# External JavaScript assets
js_plugins = [
"app/assets/js/plugins/ui-utils.min.js",
"app/assets/js/plugins/ng-infinite-scroll.min.js",
"app/assets/js/plugins/jquery.tagcloud.js",
"app/assets/js/plugins/blueimp-gallery.min.js",
"app/assets/js/plugins/jquery.scrollTo.min.js",
"app/assets/js/plugins/Chart.min.js",
"app/assets/js/plugins/angular-chart.min.js",
"app/assets/js/plugins/bootstrap.min.js",
"app/assets/js/plugins/velocity.min.js",
"app/assets/js/plugins/velocity.ui.min.js",
"app/assets/js/plugins/angular-velocity.min.js",
]
# Full List of all AngularJS specific JavaScript
js_files = [
"app/bootstrapApp.js",
"app/philoLogicMain.js",
"app/routes.js",
"app/shared/directives.js",
"app/shared/services.js",
"app/shared/config.js",
"app/shared/filters.js",
"app/shared/values.js",
"app/shared/searchArguments/searchArgumentsDirective.js",
"app/shared/exportResults/exportResults.js",
"app/components/landingPage/landingPageDirectives.js",
"app/components/landingPage/landingPage.js",
"app/shared/searchForm/searchFormServices.js",
"app/shared/searchForm/searchFormFilters.js",
"app/shared/searchForm/searchFormDirectives.js",
"app/shared/searchForm/searchForm.js",
"app/components/concordanceKwic/concordanceKwicValues.js",
"app/components/concordanceKwic/concordanceKwicDirectives.js",
"app/components/concordanceKwic/facetsDirectives.js",
"app/components/concordanceKwic/concordanceKwicFilters.js",
"app/components/concordanceKwic/concordanceKwic.js",
"app/components/textNavigation/textNavigationFilters.js",
"app/components/textNavigation/textNavigationValues.js",
"app/components/textNavigation/textNavigationDirectives.js",
"app/components/textNavigation/textNavigationCtrl.js",
"app/components/tableOfContents/tableOfContents.js",
"app/components/collocation/collocationDirectives.js",
"app/components/collocation/collocation.js",
"app/components/timeSeries/timeSeriesFilters.js",
"app/components/timeSeries/timeSeriesDirectives.js",
"app/components/timeSeries/timeSeries.js",
"app/shared/accessControl/accessControlDirective.js",
"app/shared/accessControl/accessControlCtrl.js",
]
def angular(environ, start_response):
headers = [("Content-type", "text/html; charset=UTF-8"), ("Access-Control-Allow-Origin", "*")]
if not config.valid_config: # This means we have an error in the webconfig file
html = build_misconfig_page(config.traceback, "webconfig.cfg")
# TODO handle errors in db.locals.py
else:
request = WSGIHandler(environ, config)
if config.access_control:
if not request.authenticated:
token = access_control.check_access(environ, config)
if token:
h, ts = token
headers.append(("Set-Cookie", "hash=%s" % h))
headers.append(("Set-Cookie", "timestamp=%s" % ts))
html = build_html_page(config)
start_response("200 OK", headers)
return html
def build_html_page(config):
html_page = open("%s/app/index.html" % config.db_path, encoding="utf8", errors="ignore").read()
html_page = html_page.replace("$DBNAME", config.dbname)
html_page = html_page.replace("$DBURL", os.path.join(global_config.url_root, dbname))
html_page = html_page.replace("$CSS", load_CSS())
html_page = html_page.replace("$JS", load_JS())
return html_page
def build_misconfig_page(traceback, config_file):
html_page = open("%s/app/misconfiguration.html" % path, encoding="utf8", errors="ignore").read()
html_page = html_page.replace("$CSS", load_CSS())
html_page = html_page.replace("$TRACEBACK", traceback)
html_page = html_page.replace("$CONFIG_FILE", config_file)
return html_page
def load_CSS():
mainCSS = os.path.join(path, "app/assets/css/philoLogic.css")
if os.path.exists(mainCSS):
if not config.production:
css_links = concat_CSS()
else:
css_links = concat_CSS()
if config.production:
return '<link rel="stylesheet" href="app/assets/css/philoLogic.css">'
else:
return "\n".join(css_links)
def concat_CSS():
css_string, css_links = concatenate_files(css_files, "css")
output = open(os.path.join(path, "app/assets/css/philoLogic.css"), "w")
output.write(css_string)
return css_links
def load_JS():
mainJS = os.path.join(path, "app/assets/js/philoLogic.js")
if os.path.exists(mainJS):
if not config.production:
js_links, js_plugins_links = concat_JS()
else:
js_links, js_plugins_links = concat_JS()
if config.production:
scripts = '<script src="app/assets/js/plugins/philoLogicPlugins.js"></script>'
scripts += '<script src="app/assets/js/philoLogic.js"></script>'
return scripts
else:
return "\n".join(js_plugins_links + js_links)
def concat_JS():
js_plugins_string, js_plugins_links = concatenate_files(js_plugins, "js")
plugin_output = open(os.path.join(path, "app/assets/js/plugins/philoLogicPlugins.js"), "w")
plugin_output.write(js_plugins_string)
js_string, js_links = concatenate_files(js_files, "js")
output = open(os.path.join(path, "app/assets/js/philoLogic.js"), "w")
output.write(js_string)
return js_links, js_plugins_links
def concatenate_files(file_list, file_type):
string = []
links = []
for file_path in file_list:
try:
string.append(open(os.path.join(path, file_path)).read())
if not config.production:
if file_type == "css":
links.append('<link rel="stylesheet" href="%s">' % file_path)
else:
links.append('<script src="%s"></script>' % file_path)
except IOError:
pass
string = "\n".join(string)
return string, links
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
19,
199,
624,
17989,
7868,
6001,
1145,
624,
421,
199,
646,
747,
14,
515,
199,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
6001,
2028,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
9279,
2461,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
2879,
63,
2785,
199,
504,
3945,
11737,
15370,
14,
1208,
492,
2248,
63,
578,
199,
199,
888,
275,
6001,
2028,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
29658,
199,
2966,
63,
888,
275,
2248,
63,
578,
480,
10909,
320,
15370,
20,
401,
1101,
14,
2966,
63,
888,
63,
1985,
9,
199,
515,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
8964,
199,
13238,
275,
931,
14,
1913,
1252,
1294,
19031,
1988,
17,
61,
199,
199,
888,
275,
6001,
2028,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
29658,
199,
888,
63,
1985,
275,
747,
14,
515,
14,
904,
480,
571,
15,
12186,
15,
3919,
15,
1294,
10665,
747,
14,
515,
14,
4846,
8,
888,
14,
7915,
430,
199,
692,
747,
14,
515,
14,
11091,
8,
736,
14,
515,
14,
4832,
8,
888,
14,
7915,
430,
508,
747,
14,
515,
14,
11091,
8,
736,
14,
515,
14,
4832,
8,
888,
63,
1985,
2298,
272,
8879,
275,
1101,
63,
1985,
199,
4164,
747,
14,
515,
14,
2444,
8,
888,
63,
1985,
9,
436,
1101,
14,
10777,
26,
272,
8879,
275,
1101,
63,
1985,
199,
2836,
26,
272,
747,
14,
2253,
480,
1850,
450,
83,
450,
83,
2,
450,
334,
888,
14,
7915,
12,
1101,
63,
1985,
430,
272,
8879,
275,
1101,
63,
1985,
421,
199,
3919,
63,
1725,
275,
359,
272,
298,
571,
15,
12186,
15,
3919,
15,
11146,
14,
827,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
2487,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
1733,
2821,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
9688,
316,
3276,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
388,
1577,
554,
26643,
530,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
521,
9641,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1569,
63,
25372,
15,
6304,
3236,
13,
25372,
14,
827,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
505,
1692,
19617,
5360,
14,
3919,
401,
272,
8879,
12,
199,
61,
199,
199,
3,
18802,
15250,
17202,
199,
3596,
63,
5265,
275,
359,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
1907,
13,
1208,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
2753,
13,
30757,
13,
6755,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
22324,
14,
1450,
4091,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
6304,
3236,
13,
25372,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
22324,
14,
6755,
1378,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16372,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11572,
13,
9019,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11146,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16350,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16350,
14,
1907,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11572,
13,
16350,
14,
827,
14,
3596,
401,
199,
61,
199,
199,
3,
16579,
3820,
402,
1006,
1626,
71,
2238,
11378,
2488,
15250,
199,
3596,
63,
1725,
275,
359,
272,
298,
571,
15,
11146,
2640,
14,
3596,
401,
272,
298,
571,
15,
10909,
320,
32140,
6756,
14,
3596,
401,
272,
298,
571,
15,
13243,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
23216,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
5950,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
888,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
4273,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1459,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
14517,
15,
1733,
14517,
29489,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
3790,
6579,
15,
3790,
6579,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
9688,
316,
3276,
15,
9688,
316,
3276,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
9688,
316,
3276,
15,
9688,
316,
3276,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
15803,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
18053,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
6550,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
1409,
1086,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
18053,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
18053,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
6550,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
9778,
14,
3596,
401,
272
] | [
2647,
15,
1393,
15,
1813,
2366,
19,
199,
624,
17989,
7868,
6001,
1145,
624,
421,
199,
646,
747,
14,
515,
199,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
6001,
2028,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
9279,
2461,
199,
504,
3945,
11737,
15370,
14,
7726,
492,
2879,
63,
2785,
199,
504,
3945,
11737,
15370,
14,
1208,
492,
2248,
63,
578,
199,
199,
888,
275,
6001,
2028,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
29658,
199,
2966,
63,
888,
275,
2248,
63,
578,
480,
10909,
320,
15370,
20,
401,
1101,
14,
2966,
63,
888,
63,
1985,
9,
199,
515,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
8964,
199,
13238,
275,
931,
14,
1913,
1252,
1294,
19031,
1988,
17,
61,
199,
199,
888,
275,
6001,
2028,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
3460,
493,
29658,
199,
888,
63,
1985,
275,
747,
14,
515,
14,
904,
480,
571,
15,
12186,
15,
3919,
15,
1294,
10665,
747,
14,
515,
14,
4846,
8,
888,
14,
7915,
430,
199,
692,
747,
14,
515,
14,
11091,
8,
736,
14,
515,
14,
4832,
8,
888,
14,
7915,
430,
508,
747,
14,
515,
14,
11091,
8,
736,
14,
515,
14,
4832,
8,
888,
63,
1985,
2298,
272,
8879,
275,
1101,
63,
1985,
199,
4164,
747,
14,
515,
14,
2444,
8,
888,
63,
1985,
9,
436,
1101,
14,
10777,
26,
272,
8879,
275,
1101,
63,
1985,
199,
2836,
26,
272,
747,
14,
2253,
480,
1850,
450,
83,
450,
83,
2,
450,
334,
888,
14,
7915,
12,
1101,
63,
1985,
430,
272,
8879,
275,
1101,
63,
1985,
421,
199,
3919,
63,
1725,
275,
359,
272,
298,
571,
15,
12186,
15,
3919,
15,
11146,
14,
827,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
2487,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
1733,
2821,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
9688,
316,
3276,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
388,
1577,
554,
26643,
530,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
521,
9641,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1569,
63,
25372,
15,
6304,
3236,
13,
25372,
14,
827,
14,
3919,
401,
272,
298,
571,
15,
12186,
15,
3919,
15,
1294,
15,
505,
1692,
19617,
5360,
14,
3919,
401,
272,
8879,
12,
199,
61,
199,
199,
3,
18802,
15250,
17202,
199,
3596,
63,
5265,
275,
359,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
1907,
13,
1208,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
2753,
13,
30757,
13,
6755,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
22324,
14,
1450,
4091,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
6304,
3236,
13,
25372,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
22324,
14,
6755,
1378,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16372,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11572,
13,
9019,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11146,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16350,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
16350,
14,
1907,
14,
827,
14,
3596,
401,
272,
298,
571,
15,
12186,
15,
3596,
15,
5265,
15,
11572,
13,
16350,
14,
827,
14,
3596,
401,
199,
61,
199,
199,
3,
16579,
3820,
402,
1006,
1626,
71,
2238,
11378,
2488,
15250,
199,
3596,
63,
1725,
275,
359,
272,
298,
571,
15,
11146,
2640,
14,
3596,
401,
272,
298,
571,
15,
10909,
320,
32140,
6756,
14,
3596,
401,
272,
298,
571,
15,
13243,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
23216,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
5950,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
888,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
4273,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1459,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
14517,
15,
1733,
14517,
29489,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
3790,
6579,
15,
3790,
6579,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
9688,
316,
3276,
15,
9688,
316,
3276,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
9688,
316,
3276,
15,
9688,
316,
3276,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
15803,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
18053,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
5555,
15,
1733,
2821,
15,
1733,
2821,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
6550,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
1409,
1086,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
18053,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
388,
1577,
554,
26643,
530,
15,
388,
1577,
554,
26643,
530,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
18053,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
6550,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
1341,
10624,
14,
3596,
401,
272,
298,
571,
15,
4608,
15,
505,
19617,
5360,
15,
505,
19617,
5360,
9778,
14,
3596,
401,
272,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
fiuba08/robotframework | src/robot/libraries/Collections.py | 3 | 29511 | # Copyright 2008-2014 Nokia Solutions and Networks
#
# 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 robot.api import logger
from robot.utils import plural_or_not, seq2str, seq2str2, unic
from robot.utils.asserts import assert_equals
from robot.version import get_version
class _List:
def convert_to_list(self, item):
"""Converts the given `item` to a list.
Mainly useful for converting tuples and other iterable to lists.
Use `Create List` from the BuiltIn library for constructing new lists.
"""
return list(item)
def append_to_list(self, list_, *values):
"""Adds `values` to the end of `list`.
Example:
| Append To List | ${L1} | xxx | | |
| Append To List | ${L2} | x | y | z |
=>
- ${L1} = ['a', 'xxx']
- ${L2} = ['a', 'b', 'x', 'y', 'z']
"""
for value in values:
list_.append(value)
def insert_into_list(self, list_, index, value):
"""Inserts `value` into `list` to the position specified with `index`.
Index '0' adds the value into the first position, '1' to the second,
and so on. Inserting from right works with negative indices so that
'-1' is the second last position, '-2' third last, and so on. Use
`Append To List` to add items to the end of the list.
If the absolute value of the index is greater than
the length of the list, the value is added at the end
(positive index) or the beginning (negative index). An index
can be given either as an integer or a string that can be
converted to an integer.
Example:
| Insert Into List | ${L1} | 0 | xxx |
| Insert Into List | ${L2} | ${-1} | xxx |
=>
- ${L1} = ['xxx', 'a']
- ${L2} = ['a', 'xxx', 'b']
"""
list_.insert(self._index_to_int(index), value)
def combine_lists(self, *lists):
"""Combines the given `lists` together and returns the result.
The given lists are not altered by this keyword.
Example:
| ${x} = | Combine List | ${L1} | ${L2} | |
| ${y} = | Combine List | ${L1} | ${L2} | ${L1} |
=>
- ${x} = ['a', 'a', 'b']
- ${y} = ['a', 'a', 'b', 'a']
- ${L1} and ${L2} are not changed.
"""
ret = []
for item in lists:
ret.extend(item)
return ret
def set_list_value(self, list_, index, value):
"""Sets the value of `list` specified by `index` to the given `value`.
Index '0' means the first position, '1' the second and so on.
Similarly, '-1' is the last position, '-2' second last, and so on.
Using an index that does not exist on the list causes an error.
The index can be either an integer or a string that can be converted to
an integer.
Example:
| Set List Value | ${L3} | 1 | xxx |
| Set List Value | ${L3} | -1 | yyy |
=>
- ${L3} = ['a', 'xxx', 'yyy']
"""
try:
list_[self._index_to_int(index)] = value
except IndexError:
self._index_error(list_, index)
def remove_values_from_list(self, list_, *values):
"""Removes all occurences of given `values` from `list`.
It is not an error is a value does not exist in the list at all.
Example:
| Remove Values From List | ${L4} | a | c | e | f |
=>
- ${L4} = ['b', 'd']
"""
for value in values:
while value in list_:
list_.remove(value)
def remove_from_list(self, list_, index):
"""Removes and returns the value specified with an `index` from `list`.
Index '0' means the first position, '1' the second and so on.
Similarly, '-1' is the last position, '-2' the second last, and so on.
Using an index that does not exist on the list causes an error.
The index can be either an integer or a string that can be converted
to an integer.
Example:
| ${x} = | Remove From List | ${L2} | 0 |
=>
- ${x} = 'a'
- ${L2} = ['b']
"""
try:
return list_.pop(self._index_to_int(index))
except IndexError:
self._index_error(list_, index)
def remove_duplicates(self, list_):
"""Returns a list without duplicates based on the given `list`.
Creates and returns a new list that contains all items in the given
list so that one item can appear only once. Order of the items in
the new list is the same as in the original except for missing
duplicates. Number of the removed duplicates is logged.
New in Robot Framework 2.7.5.
"""
ret = []
for item in list_:
if item not in ret:
ret.append(item)
removed = len(list_) - len(ret)
logger.info('%d duplicate%s removed.' % (removed, plural_or_not(removed)))
return ret
def get_from_list(self, list_, index):
"""Returns the value specified with an `index` from `list`.
The given list is never altered by this keyword.
Index '0' means the first position, '1' the second, and so on.
Similarly, '-1' is the last position, '-2' the second last, and so on.
Using an index that does not exist on the list causes an error.
The index can be either an integer or a string that can be converted
to an integer.
Examples (including Python equivalents in comments):
| ${x} = | Get From List | ${L5} | 0 | # L5[0] |
| ${y} = | Get From List | ${L5} | -2 | # L5[-2] |
=>
- ${x} = 'a'
- ${y} = 'd'
- ${L5} is not changed
"""
try:
return list_[self._index_to_int(index)]
except IndexError:
self._index_error(list_, index)
def get_slice_from_list(self, list_, start=0, end=None):
"""Returns a slice of the given list between `start` and `end` indexes.
The given list is never altered by this keyword.
If both `start` and `end` are given, a sublist containing values from
`start` to `end` is returned. This is the same as 'list[start:end]' in
Python. To get all items from the beginning, use 0 as the start value,
and to get all items until the end, use 'None' as the end value. 'None'
is also a default value, so in this case, it is enough to give only
`start`. If only `end` is given, `start` gets the value 0.
Using `start` or `end` not found on the list is the same as using the
largest (or smallest) available index.
Examples (incl. Python equivelants in comments):
| ${x} = | Get Slice From List | ${L5} | 2 | 4 | # L5[2:4] |
| ${y} = | Get Slice From List | ${L5} | 1 | | # L5[1:None] |
| ${z} = | Get Slice From List | ${L5} | | -2 | # L5[0:-2] |
=>
- ${x} = ['c', 'd']
- ${y} = ['b', 'c', 'd', 'e']
- ${z} = ['a', 'b', 'c']
- ${L5} is not changed
"""
start = self._index_to_int(start, True)
if end is not None:
end = self._index_to_int(end)
return list_[start:end]
def count_values_in_list(self, list_, value, start=0, end=None):
"""Returns the number of occurrences of the given `value` in `list`.
The search can be narrowed to the selected sublist by the `start` and
`end` indexes having the same semantics as in the `Get Slice From List`
keyword. The given list is never altered by this keyword.
Example:
| ${x} = | Count Values In List | ${L3} | b |
=>
- ${x} = 1
- ${L3} is not changed
"""
return self.get_slice_from_list(list_, start, end).count(value)
def get_index_from_list(self, list_, value, start=0, end=None):
"""Returns the index of the first occurrence of the `value` on the list.
The search can be narrowed to the selected sublist by the `start` and
`end` indexes having the same semantics as in the `Get Slice From List`
keyword. In case the value is not found, -1 is returned. The given list
is never altered by this keyword.
Example:
| ${x} = | Get Index From List | ${L5} | d |
=>
- ${x} = 3
- ${L5} is not changed
"""
if start == '':
start = 0
list_ = self.get_slice_from_list(list_, start, end)
try:
return int(start) + list_.index(value)
except ValueError:
return -1
def copy_list(self, list_):
"""Returns a copy of the given list.
The given list is never altered by this keyword.
"""
return list_[:]
def reverse_list(self, list_):
"""Reverses the given list in place.
Note that the given list is changed and nothing is returned. Use
`Copy List` first, if you need to keep also the original order.
| Reverse List | ${L3} |
=>
- ${L3} = ['c', 'b', 'a']
"""
list_.reverse()
def sort_list(self, list_):
"""Sorts the given list in place.
The strings are sorted alphabetically and the numbers numerically.
Note that the given list is changed and nothing is returned. Use
`Copy List` first, if you need to keep also the original order.
${L} = [2,1,'a','c','b']
| Sort List | ${L} |
=>
- ${L} = [1, 2, 'a', 'b', 'c']
"""
list_.sort()
def list_should_contain_value(self, list_, value, msg=None):
"""Fails if the `value` is not found from `list`.
If `msg` is not given, the default error message "[ a | b | c ] does
not contain the value 'x'" is shown in case of a failure. Otherwise,
the given `msg` is used in case of a failure.
"""
default = "%s does not contain value '%s'." % (seq2str2(list_), value)
_verify_condition(value in list_, default, msg)
def list_should_not_contain_value(self, list_, value, msg=None):
"""Fails if the `value` is not found from `list`.
See `List Should Contain Value` for an explanation of `msg`.
"""
default = "%s contains value '%s'." % (seq2str2(list_), value)
_verify_condition(value not in list_, default, msg)
def list_should_not_contain_duplicates(self, list_, msg=None):
"""Fails if any element in the `list` is found from it more than once.
The default error message lists all the elements that were found
from the `list` multiple times, but it can be overridden by giving
a custom `msg`. All multiple times found items and their counts are
also logged.
This keyword works with all iterables that can be converted to a list.
The original iterable is never altered.
"""
if not isinstance(list_, list):
list_ = list(list_)
dupes = []
for item in list_:
if item not in dupes:
count = list_.count(item)
if count > 1:
logger.info("'%s' found %d times." % (item, count))
dupes.append(item)
if dupes:
raise AssertionError(msg or
'%s found multiple times.' % seq2str(dupes))
def lists_should_be_equal(self, list1, list2, msg=None, values=True,
names=None):
"""Fails if given lists are unequal.
The keyword first verifies that the lists have equal lengths, and then
it checks are all their values equal. Possible differences between the
values are listed in the default error message like `Index 4: ABC !=
Abc`.
The error message can be configured using `msg` and `values` arguments:
- If `msg` is not given, the default error message is used.
- If `msg` is given and `values` is either Boolean False or a string
'False' or 'No Values', the error message is simply `msg`.
- Otherwise the error message is `msg` + 'new line' + default.
Optional `names` argument (new in 2.6) can be used for naming
the indices shown in the default error message. It can either
be a list of names matching the indices in the lists or a
dictionary where keys are indices that need to be named. It is
not necessary to name all of the indices. When using a
dictionary, keys can be either integers or strings that can be
converted to integers.
Examples:
| ${names} = | Create List | First Name | Family Name | Email |
| Lists Should Be Equal | ${people1} | ${people2} | names=${names} |
| ${names} = | Create Dictionary | 0 | First Name | 2 | Email |
| Lists Should Be Equal | ${people1} | ${people2} | names=${names} |
If the items in index 2 would differ in the above examples, the error
message would contain a row like `Index 2 (email): name@foo.com !=
name@bar.com`.
"""
len1 = len(list1)
len2 = len(list2)
default = 'Lengths are different: %d != %d' % (len1, len2)
_verify_condition(len1 == len2, default, msg, values)
names = self._get_list_index_name_mapping(names, len1)
diffs = list(self._yield_list_diffs(list1, list2, names))
default = 'Lists are different:\n' + '\n'.join(diffs)
_verify_condition(diffs == [], default, msg, values)
def _get_list_index_name_mapping(self, names, list_length):
if not names:
return {}
if isinstance(names, dict):
return dict((int(index), names[index]) for index in names)
return dict(zip(range(list_length), names))
def _yield_list_diffs(self, list1, list2, names):
for index, (item1, item2) in enumerate(zip(list1, list2)):
name = ' (%s)' % names[index] if index in names else ''
try:
assert_equals(item1, item2, msg='Index %d%s' % (index, name))
except AssertionError, err:
yield unic(err)
def list_should_contain_sub_list(self, list1, list2, msg=None, values=True):
"""Fails if not all of the elements in `list2` are found in `list1`.
The order of values and the number of values are not taken into
account.
See the use of `msg` and `values` from the `Lists Should Be Equal`
keyword.
"""
diffs = ', '.join(unic(item) for item in list2 if item not in list1)
default = 'Following values were not found from first list: ' + diffs
_verify_condition(not diffs, default, msg, values)
def log_list(self, list_, level='INFO'):
"""Logs the length and contents of the `list` using given `level`.
Valid levels are TRACE, DEBUG, INFO (default), and WARN.
If you only want to the length, use keyword `Get Length` from
the BuiltIn library.
"""
logger.write('\n'.join(self._log_list(list_)), level)
def _log_list(self, list_):
if not list_:
yield 'List is empty.'
elif len(list_) == 1:
yield 'List has one item:\n%s' % list_[0]
else:
yield 'List length is %d and it contains following items:' % len(list_)
for index, item in enumerate(list_):
yield '%s: %s' % (index, item)
def _index_to_int(self, index, empty_to_zero=False):
if empty_to_zero and not index:
return 0
try:
return int(index)
except ValueError:
raise ValueError("Cannot convert index '%s' to an integer." % index)
def _index_error(self, list_, index):
raise IndexError('Given index %s is out of the range 0-%d.'
% (index, len(list_)-1))
class _Dictionary:
def create_dictionary(self, *key_value_pairs, **items):
"""Creates and returns a dictionary based on given items.
Giving items as `key_value_pairs` means giving keys and values
as separate arguments:
| ${x} = | Create Dictionary | name | value | | |
| ${y} = | Create Dictionary | a | 1 | b | ${2} |
=>
- ${x} = {'name': 'value'}
- ${y} = {'a': '1', 'b': 2}
Starting from Robot Framework 2.8.1, items can also be given as kwargs:
| ${x} = | Create Dictionary | name=value | |
| ${y} = | Create Dictionary | a=1 | b=${2} |
The latter syntax is typically more convenient to use, but it has
a limitation that keys must be strings.
"""
if len(key_value_pairs) % 2 != 0:
raise ValueError("Creating a dictionary failed. There should be "
"even number of key-value-pairs.")
return self.set_to_dictionary({}, *key_value_pairs, **items)
def set_to_dictionary(self, dictionary, *key_value_pairs, **items):
"""Adds the given `key_value_pairs` and `items`to the `dictionary`.
See `Create Dictionary` for information about giving items.
Example:
| Set To Dictionary | ${D1} | key | value |
=>
- ${D1} = {'a': 1, 'key': 'value'}
"""
if len(key_value_pairs) % 2 != 0:
raise ValueError("Adding data to a dictionary failed. There "
"should be even number of key-value-pairs.")
for i in range(0, len(key_value_pairs), 2):
dictionary[key_value_pairs[i]] = key_value_pairs[i+1]
dictionary.update(items)
return dictionary
def remove_from_dictionary(self, dictionary, *keys):
"""Removes the given `keys` from the `dictionary`.
If the given `key` cannot be found from the `dictionary`, it
is ignored.
Example:
| Remove From Dictionary | ${D3} | b | x | y |
=>
- ${D3} = {'a': 1, 'c': 3}
"""
for key in keys:
if key in dictionary:
value = dictionary.pop(key)
logger.info("Removed item with key '%s' and value '%s'." % (key, value))
else:
logger.info("Key '%s' not found." % key)
def keep_in_dictionary(self, dictionary, *keys):
"""Keeps the given `keys` in the `dictionary` and removes all other.
If the given `key` cannot be found from the `dictionary`, it
is ignored.
Example:
| Keep In Dictionary | ${D5} | b | x | d |
=>
- ${D5} = {'b': 2, 'd': 4}
"""
remove_keys = [k for k in dictionary if k not in keys]
self.remove_from_dictionary(dictionary, *remove_keys)
def copy_dictionary(self, dictionary):
"""Returns a copy of the given dictionary.
The given dictionary is never altered by this keyword.
"""
return dictionary.copy()
def get_dictionary_keys(self, dictionary):
"""Returns `keys` of the given `dictionary`.
`Keys` are returned in sorted order. The given `dictionary` is never
altered by this keyword.
Example:
| ${keys} = | Get Dictionary Keys | ${D3} |
=>
- ${keys} = ['a', 'b', 'c']
"""
return sorted(dictionary)
def get_dictionary_values(self, dictionary):
"""Returns values of the given dictionary.
Values are returned sorted according to keys. The given dictionary is
never altered by this keyword.
Example:
| ${values} = | Get Dictionary Values | ${D3} |
=>
- ${values} = [1, 2, 3]
"""
return [dictionary[k] for k in self.get_dictionary_keys(dictionary)]
def get_dictionary_items(self, dictionary):
"""Returns items of the given `dictionary`.
Items are returned sorted by keys. The given `dictionary` is not
altered by this keyword.
Example:
| ${items} = | Get Dictionary Items | ${D3} |
=>
- ${items} = ['a', 1, 'b', 2, 'c', 3]
"""
ret = []
for key in self.get_dictionary_keys(dictionary):
ret.extend((key, dictionary[key]))
return ret
def get_from_dictionary(self, dictionary, key):
"""Returns a value from the given `dictionary` based on the given `key`.
If the given `key` cannot be found from the `dictionary`, this keyword
fails.
The given dictionary is never altered by this keyword.
Example:
| ${value} = | Get From Dictionary | ${D3} | b |
=>
- ${value} = 2
"""
try:
return dictionary[key]
except KeyError:
raise RuntimeError("Dictionary does not contain key '%s'." % key)
def dictionary_should_contain_key(self, dictionary, key, msg=None):
"""Fails if `key` is not found from `dictionary`.
See `List Should Contain Value` for an explanation of `msg`.
The given dictionary is never altered by this keyword.
"""
default = "Dictionary does not contain key '%s'." % key
_verify_condition(key in dictionary, default, msg)
def dictionary_should_not_contain_key(self, dictionary, key, msg=None):
"""Fails if `key` is found from `dictionary`.
See `List Should Contain Value` for an explanation of `msg`.
The given dictionary is never altered by this keyword.
"""
default = "Dictionary contains key '%s'." % key
_verify_condition(key not in dictionary, default, msg)
def dictionary_should_contain_item(self, dictionary, key, value, msg=None):
"""An item of `key`/`value` must be found in a `dictionary`.
Value is converted to unicode for comparison.
See `Lists Should Be Equal` for an explanation of `msg`.
The given dictionary is never altered by this keyword.
"""
self.dictionary_should_contain_key(dictionary, key, msg)
actual, expected = unicode(dictionary[key]), unicode(value)
default = "Value of dictionary key '%s' does not match: %s != %s" % (key, actual, expected)
_verify_condition(actual == expected, default, msg)
def dictionary_should_contain_value(self, dictionary, value, msg=None):
"""Fails if `value` is not found from `dictionary`.
See `List Should Contain Value` for an explanation of `msg`.
The given dictionary is never altered by this keyword.
"""
default = "Dictionary does not contain value '%s'." % value
_verify_condition(value in dictionary.values(), default, msg)
def dictionary_should_not_contain_value(self, dictionary, value, msg=None):
"""Fails if `value` is found from `dictionary`.
See `List Should Contain Value` for an explanation of `msg`.
The given dictionary is never altered by this keyword.
"""
default = "Dictionary contains value '%s'." % value
_verify_condition(not value in dictionary.values(), default, msg)
def dictionaries_should_be_equal(self, dict1, dict2, msg=None, values=True):
"""Fails if the given dictionaries are not equal.
First the equality of dictionaries' keys is checked and after that all
the key value pairs. If there are differences between the values, those
are listed in the error message.
See `Lists Should Be Equal` for an explanation of `msg`.
The given dictionaries are never altered by this keyword.
"""
keys = self._keys_should_be_equal(dict1, dict2, msg, values)
self._key_values_should_be_equal(keys, dict1, dict2, msg, values)
def dictionary_should_contain_sub_dictionary(self, dict1, dict2, msg=None,
values=True):
"""Fails unless all items in `dict2` are found from `dict1`.
See `Lists Should Be Equal` for an explanation of `msg`.
The given dictionaries are never altered by this keyword.
"""
keys = self.get_dictionary_keys(dict2)
diffs = [unic(k) for k in keys if k not in dict1]
default = "Following keys missing from first dictionary: %s" \
% ', '.join(diffs)
_verify_condition(not diffs, default, msg, values)
self._key_values_should_be_equal(keys, dict1, dict2, msg, values)
def log_dictionary(self, dictionary, level='INFO'):
"""Logs the size and contents of the `dictionary` using given `level`.
Valid levels are TRACE, DEBUG, INFO (default), and WARN.
If you only want to log the size, use keyword `Get Length` from
the BuiltIn library.
"""
logger.write('\n'.join(self._log_dictionary(dictionary)), level)
def _log_dictionary(self, dictionary):
if not dictionary:
yield 'Dictionary is empty.'
elif len(dictionary) == 1:
yield 'Dictionary has one item:'
else:
yield 'Dictionary size is %d and it contains following items:' % len(dictionary)
for key in self.get_dictionary_keys(dictionary):
yield '%s: %s' % (key, dictionary[key])
def _keys_should_be_equal(self, dict1, dict2, msg, values):
keys1 = self.get_dictionary_keys(dict1)
keys2 = self.get_dictionary_keys(dict2)
miss1 = [unic(k) for k in keys2 if k not in dict1]
miss2 = [unic(k) for k in keys1 if k not in dict2]
error = []
if miss1:
error += ['Following keys missing from first dictionary: %s'
% ', '.join(miss1)]
if miss2:
error += ['Following keys missing from second dictionary: %s'
% ', '.join(miss2)]
_verify_condition(not error, '\n'.join(error), msg, values)
return keys1
def _key_values_should_be_equal(self, keys, dict1, dict2, msg, values):
diffs = list(self._yield_dict_diffs(keys, dict1, dict2))
default = 'Following keys have different values:\n' + '\n'.join(diffs)
_verify_condition(not diffs, default, msg, values)
def _yield_dict_diffs(self, keys, dict1, dict2):
for key in keys:
try:
assert_equals(dict1[key], dict2[key], msg='Key %s' % (key,))
except AssertionError, err:
yield unic(err)
class Collections(_List, _Dictionary):
"""A test library providing keywords for handling lists and dictionaries.
`Collections` is Robot Framework's standard library that provides a
set of keywords for handling Python lists and dictionaries. This
library has keywords, for example, for modifying and getting
values from lists and dictionaries (e.g. `Append To List`, `Get
From Dictionary`) and for verifying their contents (e.g. `Lists
Should Be Equal`, `Dictionary Should Contain Value`).
Following keywords from the BuiltIn library can also be used with
lists and dictionaries:
| *Keyword Name* | *Applicable With* |
| `Create List` | lists |
| `Get Length` | both |
| `Length Should Be` | both |
| `Should Be Empty` | both |
| `Should Not Be Empty` | both |
| `Should Contain` | lists |
| `Should Not Contain` | lists |
| `Should Contain X Times` | lists |
| `Should Not Contain X Times` | lists |
| `Get Count` | lists |
All list keywords expect a scalar variable (e.g. ${list}) as an
argument. It is, however, possible to use list variables
(e.g. @{list}) as scalars simply by replacing '@' with '$'.
List keywords that do not alter the given list can also be used
with tuples, and to some extend also with other iterables.
`Convert To List` can be used to convert tuples and other iterables
to lists.
-------
List related keywords use variables in format ${Lx} in their examples,
which means a list with as many alphabetic characters as specified by 'x'.
For example ${L1} means ['a'] and ${L3} means ['a', 'b', 'c'].
Dictionary keywords use similar ${Dx} variables. For example ${D1} means
{'a': 1} and ${D3} means {'a': 1, 'b': 2, 'c': 3}.
--------
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = get_version()
def _verify_condition(condition, default_msg, given_msg, include_default=False):
if not condition:
if not given_msg:
raise AssertionError(default_msg)
if _include_default_message(include_default):
raise AssertionError(given_msg + '\n' + default_msg)
raise AssertionError(given_msg)
def _include_default_message(include):
if isinstance(include, basestring):
return include.lower() not in ['no values', 'false']
return bool(include)
| apache-2.0 | [
3,
221,
1898,
9079,
13,
7280,
653,
745,
4674,
17991,
8653,
436,
17138,
199,
3,
199,
3,
221,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
221,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
221,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
221,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
221,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
221,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
221,
4204,
1334,
314,
844,
14,
199,
199,
504,
14544,
14,
1246,
492,
2512,
199,
504,
14544,
14,
1208,
492,
11718,
63,
269,
63,
1397,
12,
5412,
18,
495,
12,
5412,
18,
495,
18,
12,
625,
530,
199,
504,
14544,
14,
1208,
14,
479,
83,
492,
702,
63,
11332,
199,
504,
14544,
14,
1023,
492,
664,
63,
1023,
421,
199,
533,
485,
1296,
26,
339,
347,
3957,
63,
475,
63,
513,
8,
277,
12,
1242,
304,
267,
408,
17729,
314,
1627,
658,
1053,
64,
370,
282,
769,
14,
398,
11298,
590,
2997,
367,
13806,
6346,
436,
1163,
6076,
370,
5548,
14,
267,
3645,
658,
2499,
3820,
64,
687,
314,
4779,
4803,
607,
3555,
367,
22048,
892,
5548,
14,
267,
408,
267,
372,
769,
8,
1053,
9,
339,
347,
5666,
63,
475,
63,
513,
8,
277,
12,
769,
3131,
627,
1459,
304,
267,
408,
14995,
658,
1459,
64,
370,
314,
1284,
402,
658,
513,
2313,
398,
5679,
26,
267,
1204,
18726,
4005,
3820,
1204,
10839,
44,
17,
93,
1204,
26571,
1204,
257,
1204,
257,
1204,
267,
1204,
18726,
4005,
3820,
1204,
10839,
44,
18,
93,
1204,
671,
257,
1204,
612,
1204,
1315,
1204,
267,
9265,
267,
446,
10839,
44,
17,
93,
275,
788,
65,
297,
283,
10013,
418,
267,
446,
10839,
44,
18,
93,
275,
788,
65,
297,
283,
66,
297,
283,
88,
297,
283,
89,
297,
283,
90,
418,
267,
408,
267,
367,
574,
315,
1338,
26,
288,
769,
3754,
740,
8,
585,
9,
339,
347,
5518,
63,
9924,
63,
513,
8,
277,
12,
769,
3131,
1478,
12,
574,
304,
267,
408,
9971,
83,
658,
585,
64,
1901,
658,
513,
64,
370,
314,
3421,
2013,
543,
658,
1080,
2313,
398,
5499,
283,
16,
7,
9584,
314,
574,
1901,
314,
1642,
3421,
12,
283,
17,
7,
370,
314,
3499,
12,
267,
436,
880,
641,
14,
15496,
316,
687,
2451,
5419,
543,
6946,
4918,
880,
626,
267,
2475,
17,
7,
365,
314,
3499,
2061,
3421,
12,
2475,
18,
7,
10919,
2061,
12,
436,
880,
641,
14,
3645,
267,
658,
8310,
4005,
3820,
64,
370,
1050,
2974,
370,
314,
1284,
402,
314,
769,
14,
398,
982,
314,
3679,
574,
402,
314,
1478,
365,
8932,
2419,
267,
314,
2582,
402,
314,
769,
12,
314,
574,
365,
3483,
737,
314,
1284,
267,
334,
8965,
1478,
9,
503,
314,
9608,
334,
7371,
1478,
680,
1626,
1478,
267,
883,
506,
1627,
1902,
465,
376,
3000,
503,
282,
1059,
626,
883,
506,
267,
6702,
370,
376,
3000,
14,
398,
5679,
26,
267,
1204,
15496,
9805,
79,
3820,
1204,
10839,
44,
17,
93,
1204,
378,
258,
1204,
26571,
1204,
267,
1204,
15496,
9805,
79,
3820,
1204,
10839,
44,
18,
93,
1204,
10839,
13,
17,
93,
1204,
26571,
1204,
267,
9265,
267,
446,
10839,
44,
17,
93,
275,
788,
10013,
297,
283,
65,
418,
267,
446,
10839,
44,
18,
93,
275,
788,
65,
297,
283,
10013,
297,
283,
66,
418,
267,
408,
267,
769,
3754,
3176,
8,
277,
423,
1080,
63,
475,
63,
442,
8,
1080,
395,
574,
9,
339,
347,
13323,
63,
6717,
8,
277,
12,
627,
6717,
304,
267,
408,
17039,
397,
314,
1627,
658,
6717,
64,
10451,
436,
2529,
314,
754,
14,
398,
710,
1627,
5548,
787,
440,
29815,
701,
642,
4252,
14,
398,
5679,
26,
267,
1204,
10839,
88,
93,
275,
1204,
26353,
3820,
1204,
10839,
44,
17,
93,
1204,
10839,
44,
18,
93,
1204,
755,
1204,
267,
1204,
10839,
89,
93,
275,
1204,
26353,
3820,
1204,
10839,
44,
17,
93,
1204,
10839,
44,
18,
93,
1204,
10839,
44,
17,
93,
1204,
267,
9265,
267,
446,
10839,
88,
93,
275,
788,
65,
297,
283,
65,
297,
283,
66,
418,
267,
446,
10839,
89,
93,
275,
788,
65,
297,
283,
65,
297,
283,
66,
297,
283,
65,
418,
267,
446,
10839,
44,
17,
93,
436,
10839,
44,
18,
93,
787,
440,
2896,
14,
267,
408,
267,
2203,
275,
942,
267,
367,
1242,
315,
5548,
26,
288,
2203,
14,
2880,
8,
1053,
9,
267,
372,
2203,
339,
347,
663,
63,
513,
63,
585,
8,
277,
12,
769,
3131,
1478,
12,
574,
304,
267,
408,
9899,
314,
574,
402,
658,
513,
64,
2013,
701,
658,
1080,
64,
370,
314,
1627,
658,
585,
2313,
398,
5499,
283,
16,
7,
4910,
314,
1642,
3421,
12,
283,
17,
7,
314,
3499,
436,
880,
641,
14,
267,
20046,
590,
12,
2475,
17,
7,
365,
314,
2061,
3421,
12,
2475,
18,
7,
3499,
2061,
12,
436,
880,
641,
14,
267,
11719,
376,
1478,
626,
1630,
440,
2187,
641,
314,
769,
14486,
376,
1125,
14,
267,
710,
1478,
883,
506,
1902,
376,
3000,
503,
282,
1059,
626,
883,
506,
6702,
370,
267,
376,
3000,
14,
398,
5679,
26,
267,
1204,
2494,
3820,
1594,
1204,
10839,
44,
19,
93,
1204,
413,
221,
1204,
26571,
1204,
267,
1204,
2494,
3820,
1594,
1204,
10839,
44,
19,
93,
1204,
446,
17,
1204,
612,
7566,
1204,
267,
9265,
267,
446,
10839,
44,
19,
93,
275,
788,
65,
297,
283,
10013,
297,
283,
30917,
418,
267,
408,
267,
862,
26,
288,
769,
9925,
277,
423,
1080,
63,
475,
63,
442,
8,
1080,
1874,
275,
574,
267,
871,
7888,
26,
288,
291,
423,
1080,
63,
705,
8,
513,
3131,
1478,
9,
339,
347,
2813,
63,
1459,
63,
504,
63,
513,
8,
277,
12,
769,
3131,
627,
1459,
304,
267,
408
] | [
221,
1898,
9079,
13,
7280,
653,
745,
4674,
17991,
8653,
436,
17138,
199,
3,
199,
3,
221,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
221,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
221,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
221,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
221,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
221,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
221,
4204,
1334,
314,
844,
14,
199,
199,
504,
14544,
14,
1246,
492,
2512,
199,
504,
14544,
14,
1208,
492,
11718,
63,
269,
63,
1397,
12,
5412,
18,
495,
12,
5412,
18,
495,
18,
12,
625,
530,
199,
504,
14544,
14,
1208,
14,
479,
83,
492,
702,
63,
11332,
199,
504,
14544,
14,
1023,
492,
664,
63,
1023,
421,
199,
533,
485,
1296,
26,
339,
347,
3957,
63,
475,
63,
513,
8,
277,
12,
1242,
304,
267,
408,
17729,
314,
1627,
658,
1053,
64,
370,
282,
769,
14,
398,
11298,
590,
2997,
367,
13806,
6346,
436,
1163,
6076,
370,
5548,
14,
267,
3645,
658,
2499,
3820,
64,
687,
314,
4779,
4803,
607,
3555,
367,
22048,
892,
5548,
14,
267,
408,
267,
372,
769,
8,
1053,
9,
339,
347,
5666,
63,
475,
63,
513,
8,
277,
12,
769,
3131,
627,
1459,
304,
267,
408,
14995,
658,
1459,
64,
370,
314,
1284,
402,
658,
513,
2313,
398,
5679,
26,
267,
1204,
18726,
4005,
3820,
1204,
10839,
44,
17,
93,
1204,
26571,
1204,
257,
1204,
257,
1204,
267,
1204,
18726,
4005,
3820,
1204,
10839,
44,
18,
93,
1204,
671,
257,
1204,
612,
1204,
1315,
1204,
267,
9265,
267,
446,
10839,
44,
17,
93,
275,
788,
65,
297,
283,
10013,
418,
267,
446,
10839,
44,
18,
93,
275,
788,
65,
297,
283,
66,
297,
283,
88,
297,
283,
89,
297,
283,
90,
418,
267,
408,
267,
367,
574,
315,
1338,
26,
288,
769,
3754,
740,
8,
585,
9,
339,
347,
5518,
63,
9924,
63,
513,
8,
277,
12,
769,
3131,
1478,
12,
574,
304,
267,
408,
9971,
83,
658,
585,
64,
1901,
658,
513,
64,
370,
314,
3421,
2013,
543,
658,
1080,
2313,
398,
5499,
283,
16,
7,
9584,
314,
574,
1901,
314,
1642,
3421,
12,
283,
17,
7,
370,
314,
3499,
12,
267,
436,
880,
641,
14,
15496,
316,
687,
2451,
5419,
543,
6946,
4918,
880,
626,
267,
2475,
17,
7,
365,
314,
3499,
2061,
3421,
12,
2475,
18,
7,
10919,
2061,
12,
436,
880,
641,
14,
3645,
267,
658,
8310,
4005,
3820,
64,
370,
1050,
2974,
370,
314,
1284,
402,
314,
769,
14,
398,
982,
314,
3679,
574,
402,
314,
1478,
365,
8932,
2419,
267,
314,
2582,
402,
314,
769,
12,
314,
574,
365,
3483,
737,
314,
1284,
267,
334,
8965,
1478,
9,
503,
314,
9608,
334,
7371,
1478,
680,
1626,
1478,
267,
883,
506,
1627,
1902,
465,
376,
3000,
503,
282,
1059,
626,
883,
506,
267,
6702,
370,
376,
3000,
14,
398,
5679,
26,
267,
1204,
15496,
9805,
79,
3820,
1204,
10839,
44,
17,
93,
1204,
378,
258,
1204,
26571,
1204,
267,
1204,
15496,
9805,
79,
3820,
1204,
10839,
44,
18,
93,
1204,
10839,
13,
17,
93,
1204,
26571,
1204,
267,
9265,
267,
446,
10839,
44,
17,
93,
275,
788,
10013,
297,
283,
65,
418,
267,
446,
10839,
44,
18,
93,
275,
788,
65,
297,
283,
10013,
297,
283,
66,
418,
267,
408,
267,
769,
3754,
3176,
8,
277,
423,
1080,
63,
475,
63,
442,
8,
1080,
395,
574,
9,
339,
347,
13323,
63,
6717,
8,
277,
12,
627,
6717,
304,
267,
408,
17039,
397,
314,
1627,
658,
6717,
64,
10451,
436,
2529,
314,
754,
14,
398,
710,
1627,
5548,
787,
440,
29815,
701,
642,
4252,
14,
398,
5679,
26,
267,
1204,
10839,
88,
93,
275,
1204,
26353,
3820,
1204,
10839,
44,
17,
93,
1204,
10839,
44,
18,
93,
1204,
755,
1204,
267,
1204,
10839,
89,
93,
275,
1204,
26353,
3820,
1204,
10839,
44,
17,
93,
1204,
10839,
44,
18,
93,
1204,
10839,
44,
17,
93,
1204,
267,
9265,
267,
446,
10839,
88,
93,
275,
788,
65,
297,
283,
65,
297,
283,
66,
418,
267,
446,
10839,
89,
93,
275,
788,
65,
297,
283,
65,
297,
283,
66,
297,
283,
65,
418,
267,
446,
10839,
44,
17,
93,
436,
10839,
44,
18,
93,
787,
440,
2896,
14,
267,
408,
267,
2203,
275,
942,
267,
367,
1242,
315,
5548,
26,
288,
2203,
14,
2880,
8,
1053,
9,
267,
372,
2203,
339,
347,
663,
63,
513,
63,
585,
8,
277,
12,
769,
3131,
1478,
12,
574,
304,
267,
408,
9899,
314,
574,
402,
658,
513,
64,
2013,
701,
658,
1080,
64,
370,
314,
1627,
658,
585,
2313,
398,
5499,
283,
16,
7,
4910,
314,
1642,
3421,
12,
283,
17,
7,
314,
3499,
436,
880,
641,
14,
267,
20046,
590,
12,
2475,
17,
7,
365,
314,
2061,
3421,
12,
2475,
18,
7,
3499,
2061,
12,
436,
880,
641,
14,
267,
11719,
376,
1478,
626,
1630,
440,
2187,
641,
314,
769,
14486,
376,
1125,
14,
267,
710,
1478,
883,
506,
1902,
376,
3000,
503,
282,
1059,
626,
883,
506,
6702,
370,
267,
376,
3000,
14,
398,
5679,
26,
267,
1204,
2494,
3820,
1594,
1204,
10839,
44,
19,
93,
1204,
413,
221,
1204,
26571,
1204,
267,
1204,
2494,
3820,
1594,
1204,
10839,
44,
19,
93,
1204,
446,
17,
1204,
612,
7566,
1204,
267,
9265,
267,
446,
10839,
44,
19,
93,
275,
788,
65,
297,
283,
10013,
297,
283,
30917,
418,
267,
408,
267,
862,
26,
288,
769,
9925,
277,
423,
1080,
63,
475,
63,
442,
8,
1080,
1874,
275,
574,
267,
871,
7888,
26,
288,
291,
423,
1080,
63,
705,
8,
513,
3131,
1478,
9,
339,
347,
2813,
63,
1459,
63,
504,
63,
513,
8,
277,
12,
769,
3131,
627,
1459,
304,
267,
408,
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,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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
] |
edxnercel/edx-platform | common/djangoapps/microsite_configuration/tests/test_microsites.py | 187 | 1186 | # -*- coding: utf-8 -*-
"""
Tests microsite_configuration templatetags and helper functions.
"""
from django.test import TestCase
from django.conf import settings
from microsite_configuration.templatetags import microsite
class MicroSiteTests(TestCase):
"""
Make sure some of the helper functions work
"""
def test_breadcrumbs(self):
crumbs = ['my', 'less specific', 'Page']
expected = u'my | less specific | Page | edX'
title = microsite.page_title_breadcrumbs(*crumbs)
self.assertEqual(expected, title)
def test_unicode_title(self):
crumbs = [u'øo', u'π tastes gréât', u'驴']
expected = u'øo | π tastes gréât | 驴 | edX'
title = microsite.page_title_breadcrumbs(*crumbs)
self.assertEqual(expected, title)
def test_platform_name(self):
pname = microsite.platform_name()
self.assertEqual(pname, settings.PLATFORM_NAME)
def test_breadcrumb_tag(self):
crumbs = ['my', 'less specific', 'Page']
expected = u'my | less specific | Page | edX'
title = microsite.page_title_breadcrumbs_tag(None, *crumbs)
self.assertEqual(expected, title)
| agpl-3.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
199,
2925,
30489,
63,
4758,
1978,
2969,
436,
5922,
3423,
14,
199,
624,
199,
504,
1639,
14,
396,
492,
7640,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
30489,
63,
4758,
14,
1160,
2969,
492,
30489,
421,
199,
533,
27022,
8972,
2925,
8,
1746,
304,
272,
408,
272,
4155,
3238,
2005,
402,
314,
5922,
3423,
1736,
272,
408,
272,
347,
511,
63,
66,
25972,
23135,
8,
277,
304,
267,
2467,
23135,
275,
788,
1662,
297,
283,
2003,
2488,
297,
283,
3276,
418,
267,
1420,
275,
399,
6704,
89,
1204,
6656,
2488,
1204,
10331,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
2031,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
9,
339,
347,
511,
63,
2975,
63,
1213,
8,
277,
304,
267,
2467,
23135,
275,
359,
85,
7,
31087,
79,
297,
399,
7,
22955,
307,
305,
744,
7192,
5741,
128,
96,
84,
297,
399,
7,
166,
103,
113,
418,
267,
1420,
275,
399,
7,
31087,
79,
1204,
221,
22955,
307,
305,
744,
7192,
5741,
128,
96,
84,
1204,
10469,
103,
113,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
2031,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
9,
339,
347,
511,
63,
3246,
63,
354,
8,
277,
304,
267,
27700,
275,
30489,
14,
3246,
63,
354,
342,
267,
291,
14,
629,
8,
23346,
12,
2202,
14,
17805,
63,
2339,
9,
339,
347,
511,
63,
66,
25972,
4295,
63,
1450,
8,
277,
304,
267,
2467,
23135,
275,
788,
1662,
297,
283,
2003,
2488,
297,
283,
3276,
418,
267,
1420,
275,
399,
6704,
89,
1204,
6656,
2488,
1204,
10331,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
63,
1450,
8,
403,
12,
627,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
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
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
199,
2925,
30489,
63,
4758,
1978,
2969,
436,
5922,
3423,
14,
199,
624,
199,
504,
1639,
14,
396,
492,
7640,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
30489,
63,
4758,
14,
1160,
2969,
492,
30489,
421,
199,
533,
27022,
8972,
2925,
8,
1746,
304,
272,
408,
272,
4155,
3238,
2005,
402,
314,
5922,
3423,
1736,
272,
408,
272,
347,
511,
63,
66,
25972,
23135,
8,
277,
304,
267,
2467,
23135,
275,
788,
1662,
297,
283,
2003,
2488,
297,
283,
3276,
418,
267,
1420,
275,
399,
6704,
89,
1204,
6656,
2488,
1204,
10331,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
2031,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
9,
339,
347,
511,
63,
2975,
63,
1213,
8,
277,
304,
267,
2467,
23135,
275,
359,
85,
7,
31087,
79,
297,
399,
7,
22955,
307,
305,
744,
7192,
5741,
128,
96,
84,
297,
399,
7,
166,
103,
113,
418,
267,
1420,
275,
399,
7,
31087,
79,
1204,
221,
22955,
307,
305,
744,
7192,
5741,
128,
96,
84,
1204,
10469,
103,
113,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
2031,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
9,
339,
347,
511,
63,
3246,
63,
354,
8,
277,
304,
267,
27700,
275,
30489,
14,
3246,
63,
354,
342,
267,
291,
14,
629,
8,
23346,
12,
2202,
14,
17805,
63,
2339,
9,
339,
347,
511,
63,
66,
25972,
4295,
63,
1450,
8,
277,
304,
267,
2467,
23135,
275,
788,
1662,
297,
283,
2003,
2488,
297,
283,
3276,
418,
267,
1420,
275,
399,
6704,
89,
1204,
6656,
2488,
1204,
10331,
1204,
3988,
56,
7,
267,
2538,
275,
30489,
14,
1606,
63,
1213,
63,
66,
25972,
23135,
63,
1450,
8,
403,
12,
627,
1556,
23135,
9,
267,
291,
14,
629,
8,
2062,
12,
2538,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
ludojmj/treelud | server/paramiko/sftp_client.py | 1 | 32863 | # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of Paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
from binascii import hexlify
import errno
import os
import stat
import threading
import time
import weakref
from paramiko import util
from paramiko.channel import Channel
from paramiko.message import Message
from paramiko.common import INFO, DEBUG, o777
from paramiko.py3compat import bytestring, b, u, long, string_types, bytes_types
from paramiko.sftp import BaseSFTP, CMD_OPENDIR, CMD_HANDLE, SFTPError, CMD_READDIR, \
CMD_NAME, CMD_CLOSE, SFTP_FLAG_READ, SFTP_FLAG_WRITE, SFTP_FLAG_CREATE, \
SFTP_FLAG_TRUNC, SFTP_FLAG_APPEND, SFTP_FLAG_EXCL, CMD_OPEN, CMD_REMOVE, \
CMD_RENAME, CMD_MKDIR, CMD_RMDIR, CMD_STAT, CMD_ATTRS, CMD_LSTAT, \
CMD_SYMLINK, CMD_SETSTAT, CMD_READLINK, CMD_REALPATH, CMD_STATUS, SFTP_OK, \
SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED
from paramiko.sftp_attr import SFTPAttributes
from paramiko.ssh_exception import SSHException
from paramiko.sftp_file import SFTPFile
from paramiko.util import ClosingContextManager
def _to_unicode(s):
"""
decode a string as ascii or utf8 if possible (as required by the sftp
protocol). if neither works, just return a byte string because the server
probably doesn't know the filename's encoding.
"""
try:
return s.encode('ascii')
except (UnicodeError, AttributeError):
try:
return s.decode('utf-8')
except UnicodeError:
return s
b_slash = b'/'
class SFTPClient(BaseSFTP, ClosingContextManager):
"""
SFTP client object.
Used to open an SFTP session across an open SSH `.Transport` and perform
remote file operations.
Instances of this class may be used as context managers.
"""
def __init__(self, sock):
"""
Create an SFTP client from an existing `.Channel`. The channel
should already have requested the ``"sftp"`` subsystem.
An alternate way to create an SFTP client context is by using
`from_transport`.
:param .Channel sock: an open `.Channel` using the ``"sftp"`` subsystem
:raises SSHException: if there's an exception while negotiating
sftp
"""
BaseSFTP.__init__(self)
self.sock = sock
self.ultra_debug = False
self.request_number = 1
# lock for request_number
self._lock = threading.Lock()
self._cwd = None
# request # -> SFTPFile
self._expecting = weakref.WeakValueDictionary()
if type(sock) is Channel:
# override default logger
transport = self.sock.get_transport()
self.logger = util.get_logger(transport.get_log_channel() + '.sftp')
self.ultra_debug = transport.get_hexdump()
try:
server_version = self._send_version()
except EOFError:
raise SSHException('EOF during negotiation')
self._log(INFO, 'Opened sftp connection (server version %d)' % server_version)
def from_transport(cls, t, window_size=None, max_packet_size=None):
"""
Create an SFTP client channel from an open `.Transport`.
Setting the window and packet sizes might affect the transfer speed.
The default settings in the `.Transport` class are the same as in
OpenSSH and should work adequately for both files transfers and
interactive sessions.
:param .Transport t: an open `.Transport` which is already authenticated
:param int window_size:
optional window size for the `.SFTPClient` session.
:param int max_packet_size:
optional max packet size for the `.SFTPClient` session..
:return:
a new `.SFTPClient` object, referring to an sftp session (channel)
across the transport
.. versionchanged:: 1.15
Added the ``window_size`` and ``max_packet_size`` arguments.
"""
chan = t.open_session(window_size=window_size,
max_packet_size=max_packet_size)
if chan is None:
return None
chan.invoke_subsystem('sftp')
return cls(chan)
from_transport = classmethod(from_transport)
def _log(self, level, msg, *args):
if isinstance(msg, list):
for m in msg:
self._log(level, m, *args)
else:
# escape '%' in msg (they could come from file or directory names) before logging
msg = msg.replace('%','%%')
super(SFTPClient, self)._log(level, "[chan %s] " + msg, *([self.sock.get_name()] + list(args)))
def close(self):
"""
Close the SFTP session and its underlying channel.
.. versionadded:: 1.4
"""
self._log(INFO, 'sftp session closed.')
self.sock.close()
def get_channel(self):
"""
Return the underlying `.Channel` object for this SFTP session. This
might be useful for doing things like setting a timeout on the channel.
.. versionadded:: 1.7.1
"""
return self.sock
def listdir(self, path='.'):
"""
Return a list containing the names of the entries in the given ``path``.
The list is in arbitrary order. It does not include the special
entries ``'.'`` and ``'..'`` even if they are present in the folder.
This method is meant to mirror ``os.listdir`` as closely as possible.
For a list of full `.SFTPAttributes` objects, see `listdir_attr`.
:param str path: path to list (defaults to ``'.'``)
"""
return [f.filename for f in self.listdir_attr(path)]
def listdir_attr(self, path='.'):
"""
Return a list containing `.SFTPAttributes` objects corresponding to
files in the given ``path``. The list is in arbitrary order. It does
not include the special entries ``'.'`` and ``'..'`` even if they are
present in the folder.
The returned `.SFTPAttributes` objects will each have an additional
field: ``longname``, which may contain a formatted string of the file's
attributes, in unix format. The content of this string will probably
depend on the SFTP server implementation.
:param str path: path to list (defaults to ``'.'``)
:return: list of `.SFTPAttributes` objects
.. versionadded:: 1.2
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'listdir(%r)' % path)
t, msg = self._request(CMD_OPENDIR, path)
if t != CMD_HANDLE:
raise SFTPError('Expected handle')
handle = msg.get_binary()
filelist = []
while True:
try:
t, msg = self._request(CMD_READDIR, handle)
except EOFError:
# done with handle
break
if t != CMD_NAME:
raise SFTPError('Expected name response')
count = msg.get_int()
for i in range(count):
filename = msg.get_text()
longname = msg.get_text()
attr = SFTPAttributes._from_msg(msg, filename, longname)
if (filename != '.') and (filename != '..'):
filelist.append(attr)
self._request(CMD_CLOSE, handle)
return filelist
def listdir_iter(self, path='.', read_aheads=50):
"""
Generator version of `.listdir_attr`.
See the API docs for `.listdir_attr` for overall details.
This function adds one more kwarg on top of `.listdir_attr`:
``read_aheads``, an integer controlling how many
``SSH_FXP_READDIR`` requests are made to the server. The default of 50
should suffice for most file listings as each request/response cycle
may contain multiple files (dependant on server implementation.)
.. versionadded:: 1.15
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'listdir(%r)' % path)
t, msg = self._request(CMD_OPENDIR, path)
if t != CMD_HANDLE:
raise SFTPError('Expected handle')
handle = msg.get_string()
nums = list()
while True:
try:
# Send out a bunch of readdir requests so that we can read the
# responses later on Section 6.7 of the SSH file transfer RFC
# explains this
# http://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
for i in range(read_aheads):
num = self._async_request(type(None), CMD_READDIR, handle)
nums.append(num)
# For each of our sent requests
# Read and parse the corresponding packets
# If we're at the end of our queued requests, then fire off
# some more requests
# Exit the loop when we've reached the end of the directory
# handle
for num in nums:
t, pkt_data = self._read_packet()
msg = Message(pkt_data)
new_num = msg.get_int()
if num == new_num:
if t == CMD_STATUS:
self._convert_status(msg)
count = msg.get_int()
for i in range(count):
filename = msg.get_text()
longname = msg.get_text()
attr = SFTPAttributes._from_msg(
msg, filename, longname)
if (filename != '.') and (filename != '..'):
yield attr
# If we've hit the end of our queued requests, reset nums.
nums = list()
except EOFError:
self._request(CMD_CLOSE, handle)
return
def open(self, filename, mode='r', bufsize=-1):
"""
Open a file on the remote server. The arguments are the same as for
Python's built-in `python:file` (aka `python:open`). A file-like
object is returned, which closely mimics the behavior of a normal
Python file object, including the ability to be used as a context
manager.
The mode indicates how the file is to be opened: ``'r'`` for reading,
``'w'`` for writing (truncating an existing file), ``'a'`` for
appending, ``'r+'`` for reading/writing, ``'w+'`` for reading/writing
(truncating an existing file), ``'a+'`` for reading/appending. The
Python ``'b'`` flag is ignored, since SSH treats all files as binary.
The ``'U'`` flag is supported in a compatible way.
Since 1.5.2, an ``'x'`` flag indicates that the operation should only
succeed if the file was created and did not previously exist. This has
no direct mapping to Python's file flags, but is commonly known as the
``O_EXCL`` flag in posix.
The file will be buffered in standard Python style by default, but
can be altered with the ``bufsize`` parameter. ``0`` turns off
buffering, ``1`` uses line buffering, and any number greater than 1
(``>1``) uses that specific buffer size.
:param str filename: name of the file to open
:param str mode: mode (Python-style) to open in
:param int bufsize: desired buffering (-1 = default buffer size)
:return: an `.SFTPFile` object representing the open file
:raises IOError: if the file could not be opened.
"""
filename = self._adjust_cwd(filename)
self._log(DEBUG, 'open(%r, %r)' % (filename, mode))
imode = 0
if ('r' in mode) or ('+' in mode):
imode |= SFTP_FLAG_READ
if ('w' in mode) or ('+' in mode) or ('a' in mode):
imode |= SFTP_FLAG_WRITE
if 'w' in mode:
imode |= SFTP_FLAG_CREATE | SFTP_FLAG_TRUNC
if 'a' in mode:
imode |= SFTP_FLAG_CREATE | SFTP_FLAG_APPEND
if 'x' in mode:
imode |= SFTP_FLAG_CREATE | SFTP_FLAG_EXCL
attrblock = SFTPAttributes()
t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
if t != CMD_HANDLE:
raise SFTPError('Expected handle')
handle = msg.get_binary()
self._log(DEBUG, 'open(%r, %r) -> %s' % (filename, mode, hexlify(handle)))
return SFTPFile(self, handle, mode, bufsize)
# Python continues to vacillate about "open" vs "file"...
file = open
def remove(self, path):
"""
Remove the file at the given path. This only works on files; for
removing folders (directories), use `rmdir`.
:param str path: path (absolute or relative) of the file to remove
:raises IOError: if the path refers to a folder (directory)
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'remove(%r)' % path)
self._request(CMD_REMOVE, path)
unlink = remove
def rename(self, oldpath, newpath):
"""
Rename a file or folder from ``oldpath`` to ``newpath``.
:param str oldpath: existing name of the file or folder
:param str newpath: new name for the file or folder
:raises IOError: if ``newpath`` is a folder, or something else goes
wrong
"""
oldpath = self._adjust_cwd(oldpath)
newpath = self._adjust_cwd(newpath)
self._log(DEBUG, 'rename(%r, %r)' % (oldpath, newpath))
self._request(CMD_RENAME, oldpath, newpath)
def mkdir(self, path, mode=o777):
"""
Create a folder (directory) named ``path`` with numeric mode ``mode``.
The default mode is 0777 (octal). On some systems, mode is ignored.
Where it is used, the current umask value is first masked out.
:param str path: name of the folder to create
:param int mode: permissions (posix-style) for the newly-created folder
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'mkdir(%r, %r)' % (path, mode))
attr = SFTPAttributes()
attr.st_mode = mode
self._request(CMD_MKDIR, path, attr)
def rmdir(self, path):
"""
Remove the folder named ``path``.
:param str path: name of the folder to remove
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'rmdir(%r)' % path)
self._request(CMD_RMDIR, path)
def stat(self, path):
"""
Retrieve information about a file on the remote system. The return
value is an object whose attributes correspond to the attributes of
Python's ``stat`` structure as returned by ``os.stat``, except that it
contains fewer fields. An SFTP server may return as much or as little
info as it wants, so the results may vary from server to server.
Unlike a Python `python:stat` object, the result may not be accessed as
a tuple. This is mostly due to the author's slack factor.
The fields supported are: ``st_mode``, ``st_size``, ``st_uid``,
``st_gid``, ``st_atime``, and ``st_mtime``.
:param str path: the filename to stat
:return:
an `.SFTPAttributes` object containing attributes about the given
file
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'stat(%r)' % path)
t, msg = self._request(CMD_STAT, path)
if t != CMD_ATTRS:
raise SFTPError('Expected attributes')
return SFTPAttributes._from_msg(msg)
def lstat(self, path):
"""
Retrieve information about a file on the remote system, without
following symbolic links (shortcuts). This otherwise behaves exactly
the same as `stat`.
:param str path: the filename to stat
:return:
an `.SFTPAttributes` object containing attributes about the given
file
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'lstat(%r)' % path)
t, msg = self._request(CMD_LSTAT, path)
if t != CMD_ATTRS:
raise SFTPError('Expected attributes')
return SFTPAttributes._from_msg(msg)
def symlink(self, source, dest):
"""
Create a symbolic link (shortcut) of the ``source`` path at
``destination``.
:param str source: path of the original file
:param str dest: path of the newly created symlink
"""
dest = self._adjust_cwd(dest)
self._log(DEBUG, 'symlink(%r, %r)' % (source, dest))
source = bytestring(source)
self._request(CMD_SYMLINK, source, dest)
def chmod(self, path, mode):
"""
Change the mode (permissions) of a file. The permissions are
unix-style and identical to those used by Python's `os.chmod`
function.
:param str path: path of the file to change the permissions of
:param int mode: new permissions
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'chmod(%r, %r)' % (path, mode))
attr = SFTPAttributes()
attr.st_mode = mode
self._request(CMD_SETSTAT, path, attr)
def chown(self, path, uid, gid):
"""
Change the owner (``uid``) and group (``gid``) of a file. As with
Python's `os.chown` function, you must pass both arguments, so if you
only want to change one, use `stat` first to retrieve the current
owner and group.
:param str path: path of the file to change the owner and group of
:param int uid: new owner's uid
:param int gid: new group id
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'chown(%r, %r, %r)' % (path, uid, gid))
attr = SFTPAttributes()
attr.st_uid, attr.st_gid = uid, gid
self._request(CMD_SETSTAT, path, attr)
def utime(self, path, times):
"""
Set the access and modified times of the file specified by ``path``. If
``times`` is ``None``, then the file's access and modified times are set
to the current time. Otherwise, ``times`` must be a 2-tuple of numbers,
of the form ``(atime, mtime)``, which is used to set the access and
modified times, respectively. This bizarre API is mimicked from Python
for the sake of consistency -- I apologize.
:param str path: path of the file to modify
:param tuple times:
``None`` or a tuple of (access time, modified time) in standard
internet epoch time (seconds since 01 January 1970 GMT)
"""
path = self._adjust_cwd(path)
if times is None:
times = (time.time(), time.time())
self._log(DEBUG, 'utime(%r, %r)' % (path, times))
attr = SFTPAttributes()
attr.st_atime, attr.st_mtime = times
self._request(CMD_SETSTAT, path, attr)
def truncate(self, path, size):
"""
Change the size of the file specified by ``path``. This usually
extends or shrinks the size of the file, just like the `~file.truncate`
method on Python file objects.
:param str path: path of the file to modify
:param size: the new size of the file
:type size: int or long
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'truncate(%r, %r)' % (path, size))
attr = SFTPAttributes()
attr.st_size = size
self._request(CMD_SETSTAT, path, attr)
def readlink(self, path):
"""
Return the target of a symbolic link (shortcut). You can use
`symlink` to create these. The result may be either an absolute or
relative pathname.
:param str path: path of the symbolic link file
:return: target path, as a `str`
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'readlink(%r)' % path)
t, msg = self._request(CMD_READLINK, path)
if t != CMD_NAME:
raise SFTPError('Expected name response')
count = msg.get_int()
if count == 0:
return None
if count != 1:
raise SFTPError('Readlink returned %d results' % count)
return _to_unicode(msg.get_string())
def normalize(self, path):
"""
Return the normalized path (on the server) of a given path. This
can be used to quickly resolve symbolic links or determine what the
server is considering to be the "current folder" (by passing ``'.'``
as ``path``).
:param str path: path to be normalized
:return: normalized form of the given path (as a `str`)
:raises IOError: if the path can't be resolved on the server
"""
path = self._adjust_cwd(path)
self._log(DEBUG, 'normalize(%r)' % path)
t, msg = self._request(CMD_REALPATH, path)
if t != CMD_NAME:
raise SFTPError('Expected name response')
count = msg.get_int()
if count != 1:
raise SFTPError('Realpath returned %d results' % count)
return msg.get_text()
def chdir(self, path=None):
"""
Change the "current directory" of this SFTP session. Since SFTP
doesn't really have the concept of a current working directory, this is
emulated by Paramiko. Once you use this method to set a working
directory, all operations on this `.SFTPClient` object will be relative
to that path. You can pass in ``None`` to stop using a current working
directory.
:param str path: new current working directory
:raises IOError: if the requested path doesn't exist on the server
.. versionadded:: 1.4
"""
if path is None:
self._cwd = None
return
if not stat.S_ISDIR(self.stat(path).st_mode):
raise SFTPError(errno.ENOTDIR, "%s: %s" % (os.strerror(errno.ENOTDIR), path))
self._cwd = b(self.normalize(path))
def getcwd(self):
"""
Return the "current working directory" for this SFTP session, as
emulated by Paramiko. If no directory has been set with `chdir`,
this method will return ``None``.
.. versionadded:: 1.4
"""
return self._cwd and u(self._cwd)
def putfo(self, fl, remotepath, file_size=0, callback=None, confirm=True):
"""
Copy the contents of an open file object (``fl``) to the SFTP server as
``remotepath``. Any exception raised by operations will be passed
through.
The SFTP operations use pipelining for speed.
:param file fl: opened file or file-like object to copy
:param str remotepath: the destination path on the SFTP server
:param int file_size:
optional size parameter passed to callback. If none is specified,
size defaults to 0
:param callable callback:
optional callback function (form: ``func(int, int)``) that accepts
the bytes transferred so far and the total bytes to be transferred
(since 1.7.4)
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size (since 1.7.7)
:return:
an `.SFTPAttributes` object containing attributes about the given
file.
.. versionadded:: 1.10
"""
with self.file(remotepath, 'wb') as fr:
fr.set_pipelined(True)
size = 0
while True:
data = fl.read(32768)
fr.write(data)
size += len(data)
if callback is not None:
callback(size, file_size)
if len(data) == 0:
break
if confirm:
s = self.stat(remotepath)
if s.st_size != size:
raise IOError('size mismatch in put! %d != %d' % (s.st_size, size))
else:
s = SFTPAttributes()
return s
def put(self, localpath, remotepath, callback=None, confirm=True):
"""
Copy a local file (``localpath``) to the SFTP server as ``remotepath``.
Any exception raised by operations will be passed through. This
method is primarily provided as a convenience.
The SFTP operations use pipelining for speed.
:param str localpath: the local file to copy
:param str remotepath: the destination path on the SFTP server. Note
that the filename should be included. Only specifying a directory
may result in an error.
:param callable callback:
optional callback function (form: ``func(int, int)``) that accepts
the bytes transferred so far and the total bytes to be transferred
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size
:return: an `.SFTPAttributes` object containing attributes about the given file
.. versionadded:: 1.4
.. versionchanged:: 1.7.4
``callback`` and rich attribute return value added.
.. versionchanged:: 1.7.7
``confirm`` param added.
"""
file_size = os.stat(localpath).st_size
with open(localpath, 'rb') as fl:
return self.putfo(fl, remotepath, file_size, callback, confirm)
def getfo(self, remotepath, fl, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server and write to
an open file or file-like object, ``fl``. Any exception raised by
operations will be passed through. This method is primarily provided
as a convenience.
:param object remotepath: opened file or file-like object to copy to
:param str fl:
the destination path on the local host or open file object
:param callable callback:
optional callback function (form: ``func(int, int)``) that accepts
the bytes transferred so far and the total bytes to be transferred
:return: the `number <int>` of bytes written to the opened file object
.. versionadded:: 1.10
"""
with self.open(remotepath, 'rb') as fr:
file_size = self.stat(remotepath).st_size
fr.prefetch()
size = 0
while True:
data = fr.read(32768)
fl.write(data)
size += len(data)
if callback is not None:
callback(size, file_size)
if len(data) == 0:
break
return size
def get(self, remotepath, localpath, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server to the local
host as ``localpath``. Any exception raised by operations will be
passed through. This method is primarily provided as a convenience.
:param str remotepath: the remote file to copy
:param str localpath: the destination path on the local host
:param callable callback:
optional callback function (form: ``func(int, int)``) that accepts
the bytes transferred so far and the total bytes to be transferred
.. versionadded:: 1.4
.. versionchanged:: 1.7.4
Added the ``callback`` param
"""
file_size = self.stat(remotepath).st_size
with open(localpath, 'wb') as fl:
size = self.getfo(remotepath, fl, callback)
s = os.stat(localpath)
if s.st_size != size:
raise IOError('size mismatch in get! %d != %d' % (s.st_size, size))
### internals...
def _request(self, t, *arg):
num = self._async_request(type(None), t, *arg)
return self._read_response(num)
def _async_request(self, fileobj, t, *arg):
# this method may be called from other threads (prefetch)
self._lock.acquire()
try:
msg = Message()
msg.add_int(self.request_number)
for item in arg:
if isinstance(item, long):
msg.add_int64(item)
elif isinstance(item, int):
msg.add_int(item)
elif isinstance(item, (string_types, bytes_types)):
msg.add_string(item)
elif isinstance(item, SFTPAttributes):
item._pack(msg)
else:
raise Exception('unknown type for %r type %r' % (item, type(item)))
num = self.request_number
self._expecting[num] = fileobj
self._send_packet(t, msg)
self.request_number += 1
finally:
self._lock.release()
return num
def _read_response(self, waitfor=None):
while True:
try:
t, data = self._read_packet()
except EOFError as e:
raise SSHException('Server connection dropped: %s' % str(e))
msg = Message(data)
num = msg.get_int()
if num not in self._expecting:
# might be response for a file that was closed before responses came back
self._log(DEBUG, 'Unexpected response #%d' % (num,))
if waitfor is None:
# just doing a single check
break
continue
fileobj = self._expecting[num]
del self._expecting[num]
if num == waitfor:
# synchronous
if t == CMD_STATUS:
self._convert_status(msg)
return t, msg
if fileobj is not type(None):
fileobj._async_response(t, msg, num)
if waitfor is None:
# just doing a single check
break
return None, None
def _finish_responses(self, fileobj):
while fileobj in self._expecting.values():
self._read_response()
fileobj._check_exception()
def _convert_status(self, msg):
"""
Raises EOFError or IOError on error status; otherwise does nothing.
"""
code = msg.get_int()
text = msg.get_text()
if code == SFTP_OK:
return
elif code == SFTP_EOF:
raise EOFError(text)
elif code == SFTP_NO_SUCH_FILE:
# clever idea from john a. meinel: map the error codes to errno
raise IOError(errno.ENOENT, text)
elif code == SFTP_PERMISSION_DENIED:
raise IOError(errno.EACCES, text)
else:
raise IOError(text)
def _adjust_cwd(self, path):
"""
Return an adjusted path if we're emulating a "current working
directory" for the server.
"""
path = b(path)
if self._cwd is None:
return path
if len(path) and path[0:1] == b_slash:
# absolute path
return path
if self._cwd == b_slash:
return self._cwd + path
return self._cwd + b_slash + path
class SFTP(SFTPClient):
"""
An alias for `.SFTPClient` for backwards compatability.
"""
pass
| mit | [
3,
1898,
334,
35,
9,
13004,
13,
9488,
221,
6848,
32236,
28833,
665,
293,
32236,
3929,
32,
6799,
14,
957,
30,
202,
199,
3,
202,
199,
3,
961,
570,
365,
1777,
402,
12608,
16625,
14,
202,
199,
3,
202,
199,
3,
12608,
16625,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
652,
1334,
314,
202,
199,
3,
2895,
402,
314,
1664,
6401,
1696,
1684,
844,
465,
3267,
701,
314,
2868,
202,
199,
3,
2290,
2752,
27,
1902,
1015,
499,
14,
17,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
202,
199,
3,
1263,
2945,
1015,
14,
202,
199,
3,
202,
199,
3,
12608,
16625,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
2428,
1821,
202,
199,
3,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
3169,
503,
3092,
2381,
202,
199,
3,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
6401,
1696,
1684,
844,
367,
1655,
202,
199,
3,
2436,
14,
202,
199,
3,
202,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
6401,
1696,
1684,
844,
202,
199,
3,
3180,
543,
12608,
16625,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
202,
199,
3,
8155,
15630,
10902,
12,
14453,
13540,
12,
8226,
12,
4828,
221,
15673,
13,
13421,
221,
8217,
14,
8065,
199,
504,
14755,
492,
6318,
8209,
202,
199,
646,
7554,
202,
199,
646,
747,
202,
199,
646,
5672,
202,
199,
646,
5796,
202,
199,
646,
900,
202,
199,
646,
13852,
202,
199,
504,
26162,
492,
4884,
202,
199,
504,
26162,
14,
2775,
492,
17270,
202,
199,
504,
26162,
14,
1188,
492,
6430,
202,
199,
504,
26162,
14,
2330,
492,
24008,
12,
10990,
12,
312,
11956,
202,
199,
504,
26162,
14,
647,
19,
5819,
492,
23888,
12,
330,
12,
399,
12,
1846,
12,
1059,
63,
1313,
12,
2783,
63,
1313,
202,
199,
504,
26162,
14,
25032,
492,
3523,
51,
15123,
12,
25548,
63,
9935,
3022,
12,
25548,
63,
15885,
12,
428,
15123,
547,
12,
25548,
63,
5670,
3022,
12,
971,
1128,
25548,
63,
2339,
12,
25548,
63,
18219,
12,
428,
15123,
63,
3719,
63,
5670,
12,
428,
15123,
63,
3719,
63,
10387,
12,
428,
15123,
63,
3719,
63,
8366,
12,
971,
1128,
428,
15123,
63,
3719,
63,
22346,
12,
428,
15123,
63,
3719,
63,
25248,
12,
428,
15123,
63,
3719,
63,
29647,
12,
25548,
63,
9935,
12,
25548,
63,
25856,
12,
971,
1128,
25548,
63,
50,
11536,
12,
25548,
63,
18379,
3022,
12,
25548,
63,
11026,
3022,
12,
25548,
63,
4315,
12,
25548,
63,
27356,
12,
25548,
63,
44,
4315,
12,
971,
1128,
25548,
63,
4669,
1698,
12394,
12,
25548,
63,
3597,
4315,
12,
25548,
63,
5670,
7916,
12,
25548,
63,
15508,
3243,
12,
25548,
63,
6305,
12,
428,
15123,
63,
3593,
12,
971,
1128,
428,
15123,
63,
13178,
12,
428,
15123,
63,
2826,
63,
6195,
1244,
63,
3817,
12,
428,
15123,
63,
4227,
22320,
63,
23282,
29848,
2999,
199,
504,
26162,
14,
25032,
63,
962,
492,
428,
15123,
5379,
202,
199,
504,
26162,
14,
5510,
63,
1971,
492,
12027,
1726,
202,
199,
504,
26162,
14,
25032,
63,
493,
492,
428,
15123,
1173,
202,
199,
504,
26162,
14,
1974,
492,
5980,
1044,
2998,
2988,
8065,
199,
318,
485,
475,
63,
2975,
8,
83,
304,
1128,
408,
1128,
4849,
282,
1059,
465,
13294,
503,
2774,
24,
340,
3962,
334,
305,
1415,
701,
314,
308,
8915,
1128,
4113,
680,
221,
340,
15564,
5419,
12,
2951,
372,
282,
3696,
1059,
2952,
314,
1654,
1128,
8646,
3181,
1133,
5715,
314,
1788,
1159,
2644,
14,
1128,
408,
1128,
862,
26,
1039,
372,
308,
14,
2143,
360,
4371,
358,
1128,
871,
334,
7087,
547,
12,
4281,
304,
1039,
862,
26,
1675,
372,
308,
14,
2708,
360,
1624,
13,
24,
358,
1039,
871,
20872,
26,
1675,
372,
308,
2999,
199,
66,
63,
7001,
275,
330,
29957,
8065,
199,
533,
428,
15123,
3041,
8,
1563,
51,
15123,
12,
5980,
1044,
2998,
2988,
304,
1128,
408,
1128,
428,
15123,
1890,
909,
14,
2958,
8051,
370,
1551,
376,
428,
15123,
2351,
9371,
376,
1551,
12027,
19853,
7836,
64,
436,
5147,
1128,
3982,
570,
5331,
14,
11787,
10066,
83,
402,
642,
1021,
1443,
506,
1202,
465,
1067,
19680,
14,
1128,
408,
1128,
347,
636,
826,
721,
277,
12,
6771,
304,
1039,
408,
1039,
2790,
376,
428,
15123,
1890,
687,
376,
3411,
19853,
5358,
2313,
221,
710,
3623,
1039,
1077,
2575,
1172,
5839,
314,
25916,
25032,
31002,
1007,
2253,
14,
4341,
1626,
18034,
4340,
370,
1218,
376,
428,
15123,
1890,
1067,
365,
701,
1808,
1039,
658,
504,
63,
5545,
2313,
4341,
520,
635,
1275,
5358,
6771,
26,
376,
1551,
19853,
5358,
64,
1808,
314,
25916,
25032,
31002,
1007,
2253,
4341,
520,
3536,
12027,
1726,
26,
340,
2337,
1159,
376,
1919,
1830,
29184,
1958,
1675,
308,
8915,
1039,
408,
1039,
3523,
51,
15123,
855,
826,
721,
277,
9,
1039,
291,
14,
5096,
275,
6771,
1039,
291,
14,
427,
345,
63,
1757,
275,
756,
1039,
291,
14,
1069,
63,
1955,
275,
413,
1039,
327,
4650,
367,
1056,
63,
1955,
1039,
291,
423,
831,
275,
5796,
14,
6432,
342,
1039,
291,
423,
6525,
275,
488,
1039,
327,
1056,
327,
1035,
428,
15123,
1173,
1039,
291,
423,
4921,
316,
275,
13852,
14,
18889,
1110,
11728,
342,
1039,
340,
730,
8,
5096,
9,
365,
17270,
26,
1675,
327,
4278,
849,
2512,
1675,
7773,
275,
291,
14,
5096,
14,
362,
63,
5545,
342,
1675,
291,
14,
2921,
275,
4884,
14,
362,
63,
2921,
8,
5545,
14,
362,
63,
793,
63,
2775,
342,
435,
1987,
25032,
358,
1675,
291,
14,
427,
345,
63,
1757,
275,
7773,
14,
362,
63,
426,
2207,
1220,
342,
1039,
862,
26,
1675,
1654,
63,
1023,
275,
291,
423,
2254,
63,
1023,
342,
1039,
871,
21157,
26,
1675,
746,
12027,
1726,
360,
13178,
5309,
29184,
425,
358,
1039,
291,
423,
793,
8,
4531,
12,
283,
4299,
379,
308,
8915,
1950,
334,
1000,
1015,
450,
68,
3171,
450,
1654,
63,
1023,
9,
2958,
347,
687,
63,
5545,
8,
1886,
12,
307,
12,
4353,
63,
890,
29,
403,
12,
1390,
63,
6253,
63,
890,
29,
403,
304,
1039,
408,
1039,
2790,
376,
428,
15123,
1890,
3623,
687,
376,
1551,
19853,
7836
] | [
1898,
334,
35,
9,
13004,
13,
9488,
221,
6848,
32236,
28833,
665,
293,
32236,
3929,
32,
6799,
14,
957,
30,
202,
199,
3,
202,
199,
3,
961,
570,
365,
1777,
402,
12608,
16625,
14,
202,
199,
3,
202,
199,
3,
12608,
16625,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
652,
1334,
314,
202,
199,
3,
2895,
402,
314,
1664,
6401,
1696,
1684,
844,
465,
3267,
701,
314,
2868,
202,
199,
3,
2290,
2752,
27,
1902,
1015,
499,
14,
17,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
202,
199,
3,
1263,
2945,
1015,
14,
202,
199,
3,
202,
199,
3,
12608,
16625,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
2428,
1821,
202,
199,
3,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
3169,
503,
3092,
2381,
202,
199,
3,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
6401,
1696,
1684,
844,
367,
1655,
202,
199,
3,
2436,
14,
202,
199,
3,
202,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
6401,
1696,
1684,
844,
202,
199,
3,
3180,
543,
12608,
16625,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
202,
199,
3,
8155,
15630,
10902,
12,
14453,
13540,
12,
8226,
12,
4828,
221,
15673,
13,
13421,
221,
8217,
14,
8065,
199,
504,
14755,
492,
6318,
8209,
202,
199,
646,
7554,
202,
199,
646,
747,
202,
199,
646,
5672,
202,
199,
646,
5796,
202,
199,
646,
900,
202,
199,
646,
13852,
202,
199,
504,
26162,
492,
4884,
202,
199,
504,
26162,
14,
2775,
492,
17270,
202,
199,
504,
26162,
14,
1188,
492,
6430,
202,
199,
504,
26162,
14,
2330,
492,
24008,
12,
10990,
12,
312,
11956,
202,
199,
504,
26162,
14,
647,
19,
5819,
492,
23888,
12,
330,
12,
399,
12,
1846,
12,
1059,
63,
1313,
12,
2783,
63,
1313,
202,
199,
504,
26162,
14,
25032,
492,
3523,
51,
15123,
12,
25548,
63,
9935,
3022,
12,
25548,
63,
15885,
12,
428,
15123,
547,
12,
25548,
63,
5670,
3022,
12,
971,
1128,
25548,
63,
2339,
12,
25548,
63,
18219,
12,
428,
15123,
63,
3719,
63,
5670,
12,
428,
15123,
63,
3719,
63,
10387,
12,
428,
15123,
63,
3719,
63,
8366,
12,
971,
1128,
428,
15123,
63,
3719,
63,
22346,
12,
428,
15123,
63,
3719,
63,
25248,
12,
428,
15123,
63,
3719,
63,
29647,
12,
25548,
63,
9935,
12,
25548,
63,
25856,
12,
971,
1128,
25548,
63,
50,
11536,
12,
25548,
63,
18379,
3022,
12,
25548,
63,
11026,
3022,
12,
25548,
63,
4315,
12,
25548,
63,
27356,
12,
25548,
63,
44,
4315,
12,
971,
1128,
25548,
63,
4669,
1698,
12394,
12,
25548,
63,
3597,
4315,
12,
25548,
63,
5670,
7916,
12,
25548,
63,
15508,
3243,
12,
25548,
63,
6305,
12,
428,
15123,
63,
3593,
12,
971,
1128,
428,
15123,
63,
13178,
12,
428,
15123,
63,
2826,
63,
6195,
1244,
63,
3817,
12,
428,
15123,
63,
4227,
22320,
63,
23282,
29848,
2999,
199,
504,
26162,
14,
25032,
63,
962,
492,
428,
15123,
5379,
202,
199,
504,
26162,
14,
5510,
63,
1971,
492,
12027,
1726,
202,
199,
504,
26162,
14,
25032,
63,
493,
492,
428,
15123,
1173,
202,
199,
504,
26162,
14,
1974,
492,
5980,
1044,
2998,
2988,
8065,
199,
318,
485,
475,
63,
2975,
8,
83,
304,
1128,
408,
1128,
4849,
282,
1059,
465,
13294,
503,
2774,
24,
340,
3962,
334,
305,
1415,
701,
314,
308,
8915,
1128,
4113,
680,
221,
340,
15564,
5419,
12,
2951,
372,
282,
3696,
1059,
2952,
314,
1654,
1128,
8646,
3181,
1133,
5715,
314,
1788,
1159,
2644,
14,
1128,
408,
1128,
862,
26,
1039,
372,
308,
14,
2143,
360,
4371,
358,
1128,
871,
334,
7087,
547,
12,
4281,
304,
1039,
862,
26,
1675,
372,
308,
14,
2708,
360,
1624,
13,
24,
358,
1039,
871,
20872,
26,
1675,
372,
308,
2999,
199,
66,
63,
7001,
275,
330,
29957,
8065,
199,
533,
428,
15123,
3041,
8,
1563,
51,
15123,
12,
5980,
1044,
2998,
2988,
304,
1128,
408,
1128,
428,
15123,
1890,
909,
14,
2958,
8051,
370,
1551,
376,
428,
15123,
2351,
9371,
376,
1551,
12027,
19853,
7836,
64,
436,
5147,
1128,
3982,
570,
5331,
14,
11787,
10066,
83,
402,
642,
1021,
1443,
506,
1202,
465,
1067,
19680,
14,
1128,
408,
1128,
347,
636,
826,
721,
277,
12,
6771,
304,
1039,
408,
1039,
2790,
376,
428,
15123,
1890,
687,
376,
3411,
19853,
5358,
2313,
221,
710,
3623,
1039,
1077,
2575,
1172,
5839,
314,
25916,
25032,
31002,
1007,
2253,
14,
4341,
1626,
18034,
4340,
370,
1218,
376,
428,
15123,
1890,
1067,
365,
701,
1808,
1039,
658,
504,
63,
5545,
2313,
4341,
520,
635,
1275,
5358,
6771,
26,
376,
1551,
19853,
5358,
64,
1808,
314,
25916,
25032,
31002,
1007,
2253,
4341,
520,
3536,
12027,
1726,
26,
340,
2337,
1159,
376,
1919,
1830,
29184,
1958,
1675,
308,
8915,
1039,
408,
1039,
3523,
51,
15123,
855,
826,
721,
277,
9,
1039,
291,
14,
5096,
275,
6771,
1039,
291,
14,
427,
345,
63,
1757,
275,
756,
1039,
291,
14,
1069,
63,
1955,
275,
413,
1039,
327,
4650,
367,
1056,
63,
1955,
1039,
291,
423,
831,
275,
5796,
14,
6432,
342,
1039,
291,
423,
6525,
275,
488,
1039,
327,
1056,
327,
1035,
428,
15123,
1173,
1039,
291,
423,
4921,
316,
275,
13852,
14,
18889,
1110,
11728,
342,
1039,
340,
730,
8,
5096,
9,
365,
17270,
26,
1675,
327,
4278,
849,
2512,
1675,
7773,
275,
291,
14,
5096,
14,
362,
63,
5545,
342,
1675,
291,
14,
2921,
275,
4884,
14,
362,
63,
2921,
8,
5545,
14,
362,
63,
793,
63,
2775,
342,
435,
1987,
25032,
358,
1675,
291,
14,
427,
345,
63,
1757,
275,
7773,
14,
362,
63,
426,
2207,
1220,
342,
1039,
862,
26,
1675,
1654,
63,
1023,
275,
291,
423,
2254,
63,
1023,
342,
1039,
871,
21157,
26,
1675,
746,
12027,
1726,
360,
13178,
5309,
29184,
425,
358,
1039,
291,
423,
793,
8,
4531,
12,
283,
4299,
379,
308,
8915,
1950,
334,
1000,
1015,
450,
68,
3171,
450,
1654,
63,
1023,
9,
2958,
347,
687,
63,
5545,
8,
1886,
12,
307,
12,
4353,
63,
890,
29,
403,
12,
1390,
63,
6253,
63,
890,
29,
403,
304,
1039,
408,
1039,
2790,
376,
428,
15123,
1890,
3623,
687,
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1,
1,
1,
1,
1,
1,
1
] |
ksmaheshkumar/weevely3 | core/vectors.py | 12 | 9253 | """
The module `core.vectors` defines the following vectors classes.
* `ModuleExec` vector executes a given module with given arguments.
* `PhpCode` vector contains PHP code, executed via `shell_php` module.
* `PhpFile` vector loads PHP code from an external file, and execute it via `shell_php` module.
* `ShellCmd` vector contains a shell command, executed via `shell_sh` module.
"""
from mako.template import Template
from mako.lookup import TemplateLookup
from core.weexceptions import DevException
from core.loggers import log
from core import modules
import utils
from core import messages
import re
import os
import thread
class Os:
"""Represent the operating system vector compatibility.
It is passed as vectors `target` argument.
* `Os.ANY` if the vector is compatible with every operating system
* `Os.NIX` if the vector is compatible only with Unix/Linux enviroinments
* `Os.WIN` if the vector is compatible only with Microsoft Windows enviroinments
"""
ANY = 0
NIX = 1
WIN = 2
class ModuleExec:
"""This vector contains commands to execute other modules.
Args:
module (str): Module name.
arguments (list of str): arguments passed as command line splitted string, e.g. `[ '--optional=o', 'mandatory1, .. ]`.
name (str): This vector name.
target (Os): The operating system supported by the vector.
postprocess (func): The function which postprocess the execution result.
background (bool): Execute in a separate thread on `run()`
"""
def __init__(self, module, arguments, name = '', target = 0, postprocess = None, background = False):
self.name = name if name else utils.strings.randstr()
if isinstance(arguments, list):
self.arguments = arguments
else:
raise DevException(messages.vectors.wrong_payload_type)
if not isinstance(target, int) or not target < 3:
raise DevException(messages.vectors.wrong_target_type)
if not callable(postprocess) and postprocess is not None:
raise DevException(messages.vectors.wrong_postprocessing_type)
self.module = module
self.target = target
self.postprocess = postprocess
self.background = background
def format(self, values):
"""Format the arguments.
This format the vector payloads using Mako template.
Args:
values (dict): The values passed as arguments of Mako
`template.Template(arg[n]).render(**values)`
Returns:
A list of string containing the formatted payloads.
"""
return [ Template(arg).render(**values) for arg in self.arguments ]
def run(self, format_args = {}):
"""Run the module with the formatted payload.
Render the contained payload with mako and pass the result
as argument to the given module. The result is processed by the
`self.postprocess` method.
Args:
format_arg (dict): The dictionary to format the payload with.
Return:
Object. Contains the postprocessed result of the `run_argv`
module execution.
"""
try:
formatted = self.format(format_args)
except TypeError as e:
import traceback; log.debug(traceback.format_exc())
raise DevException(messages.vectors.wrong_arguments_type)
# The background argument is set at vector init in order
# to threadify vectors also if called by VectorList methods.
if self.background:
thread.start_new_thread(modules.loaded[self.module].run_argv, (formatted, ))
result = None
else:
result = modules.loaded[self.module].run_argv(formatted)
if self.postprocess:
result = self.postprocess(result)
return result
def load_result_or_run(self, result_name, format_args = {}):
"""Load a result stored in module session or run the module.
Return the variable stored or run the `self.run` method.
Args:
field (string): The variable name.
format_arg (dict): The dictionary to format the payload with.
Return:
Object. Contains the postprocessed result of the `run_argv`
module execution.
"""
result = modules.loaded[self.module].session[self.module]['results'].get(result_name)
if result: return result
else: return self.run(format_args)
class PhpCode(ModuleExec):
"""This vector contains PHP code.
The PHP code is executed via the module `shell_php`. Inherit `ModuleExec`.
Args:
payload (str): PHP code to execute.
name (str): This vector name.
target (Os): The operating system supported by the vector.
postprocess (func): The function which postprocess the execution result.
arguments (list of str): Additional arguments for `shell_php`
background (bool): Execute in a separate thread on `run()`
"""
def __init__(self, payload, name = None, target = 0, postprocess = None, arguments = [], background = False):
if not isinstance(payload, basestring):
raise DevException(messages.vectors.wrong_payload_type)
ModuleExec.__init__(
self,
module = 'shell_php',
arguments = [ payload ] + arguments,
name = name,
target = target,
postprocess = postprocess,
background = background
)
def format(self, values):
"""Format the payload.
This format the vector payloads using Mako template.
Args:
values (dict): The values passed as arguments of Mako
`template.Template(arg[n]).render(**values)`
Returns:
A list of string containing the formatted payloads.
"""
return [
Template(arg).render(**values)
for arg in self.arguments
]
class PhpFile(PhpCode):
"""This vector contains PHP code imported from a template.
The PHP code in the given template is executed via the module `shell_php`.
Inherit `PhpCode`.
Args:
payload_path (str): Path of the template to execute, usually placed in self.folder.
name (str): This vector name.
target (Os): The operating system supported by the vector.
postprocess (func): The function which postprocess the execution result.
arguments (list of str): Additional arguments for `shell_php`
background (bool): Execute in a separate thread on `run()`
"""
def __init__(self, payload_path, name = None, target = 0, postprocess = None, arguments = [], background = False):
if not isinstance(payload_path, basestring):
raise DevException(messages.vectors.wrong_payload_type)
try:
payload = file(payload_path, 'r').read()
except Exception as e:
raise DevException(messages.generic.error_loading_file_s_s % (payload_path, e))
self.folder, self.name = os.path.split(payload_path)
ModuleExec.__init__(
self,
module = 'shell_php',
arguments = [ payload ] + arguments,
name = name,
target = target,
postprocess = postprocess,
background = background
)
def format(self, values):
"""Format the payload.
This format the vector payloads using Mako template.
Also set a TemplateLookup to the template folder, to allow an easy
`<% include>` tag usage.
Args:
values (dict): The values passed as arguments of Mako
`template.Template(arg[n]).render(**values)`
Returns:
A list of string containing the formatted payloads.
"""
return [
Template(
text = arg,
lookup = TemplateLookup(directories = [ self.folder ])
).render(**values)
for arg in self.arguments
]
class ShellCmd(PhpCode):
"""This vector contains a shell command.
The shell command is executed via the module `shell_sh`. Inherit `ModuleExec`.
Args:
payload (str): Command line to execute.
name (str): This vector name.
target (Os): The operating system supported by the vector.
postprocess (func): The function which postprocess the execution result.
arguments (list of str): Additional arguments for `shell_php`
background (bool): Execute in a separate thread on `run()`
"""
def __init__(self, payload, name = None, target = 0, postprocess = None, arguments = [], background = False):
if not isinstance(payload, basestring):
raise DevException(messages.vectors.wrong_payload_type)
ModuleExec.__init__(
self,
module = 'shell_sh',
arguments = [ payload ] + arguments,
name = name,
target = target,
postprocess = postprocess,
background = background
)
| gpl-3.0 | [
624,
199,
1918,
859,
658,
1018,
14,
12280,
64,
7890,
314,
2569,
11102,
3992,
14,
199,
199,
10,
658,
2377,
4858,
64,
5477,
24956,
282,
1627,
859,
543,
1627,
2368,
14,
199,
10,
658,
5663,
80,
3034,
64,
5477,
3509,
510,
18635,
1233,
12,
7934,
4799,
658,
5641,
63,
8624,
64,
859,
14,
199,
10,
658,
5663,
80,
1173,
64,
5477,
14404,
510,
18635,
1233,
687,
376,
5957,
570,
12,
436,
5341,
652,
4799,
658,
5641,
63,
8624,
64,
859,
14,
199,
10,
658,
8529,
7874,
64,
5477,
3509,
282,
5218,
1414,
12,
7934,
4799,
658,
5641,
63,
609,
64,
859,
14,
199,
199,
624,
199,
199,
504,
26834,
14,
1160,
492,
5458,
199,
504,
26834,
14,
3892,
492,
5458,
7521,
199,
504,
6170,
14,
1129,
3924,
492,
29314,
1726,
199,
504,
6170,
14,
22771,
492,
943,
199,
504,
6170,
492,
4621,
199,
646,
3778,
199,
504,
6170,
492,
3788,
199,
646,
295,
199,
646,
747,
199,
646,
2462,
199,
199,
533,
593,
83,
26,
272,
408,
10755,
314,
17406,
2656,
5477,
7163,
14,
339,
2779,
365,
3032,
465,
11102,
658,
1375,
64,
1423,
14,
339,
627,
658,
24351,
14,
8974,
64,
340,
314,
5477,
365,
9025,
543,
4036,
17406,
2656,
339,
627,
658,
24351,
14,
46,
3867,
64,
340,
314,
5477,
365,
9025,
1454,
543,
13074,
15,
14091,
655,
433,
293,
262,
1470,
339,
627,
658,
24351,
14,
7941,
64,
340,
314,
5477,
365,
9025,
1454,
543,
15332,
5417,
655,
433,
293,
262,
1470,
339,
408,
272,
1821,
275,
378,
272,
653,
3867,
275,
413,
272,
20896,
275,
499,
199,
199,
533,
5673,
4858,
26,
339,
408,
2765,
5477,
3509,
3718,
370,
5341,
1163,
4621,
14,
339,
3033,
26,
267,
859,
334,
495,
304,
5673,
536,
14,
398,
2368,
334,
513,
402,
620,
304,
2368,
3032,
465,
1414,
1004,
30183,
1059,
12,
325,
14,
71,
14,
14505,
2850,
4144,
29,
79,
297,
283,
19900,
17,
12,
2508,
1622,
2313,
398,
536,
334,
495,
304,
961,
5477,
536,
14,
398,
1347,
334,
24351,
304,
710,
17406,
2656,
3748,
701,
314,
5477,
14,
398,
2963,
1412,
334,
1532,
304,
710,
805,
1314,
2963,
1412,
314,
6451,
754,
14,
398,
8020,
334,
2245,
304,
17009,
315,
282,
7396,
2462,
641,
658,
1065,
11995,
339,
408,
339,
347,
636,
826,
721,
277,
12,
859,
12,
2368,
12,
536,
275,
3260,
1347,
275,
378,
12,
2963,
1412,
275,
488,
12,
8020,
275,
756,
304,
398,
291,
14,
354,
275,
536,
340,
536,
587,
3778,
14,
5465,
14,
3759,
495,
342,
398,
340,
1228,
8,
4958,
12,
769,
304,
288,
291,
14,
4958,
275,
2368,
267,
587,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
4749,
63,
466,
9,
398,
340,
440,
1228,
8,
1375,
12,
1109,
9,
503,
440,
1347,
665,
650,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
1375,
63,
466,
9,
398,
340,
440,
4550,
8,
32238,
9,
436,
2963,
1412,
365,
440,
488,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
1932,
6338,
63,
466,
9,
398,
291,
14,
578,
275,
859,
267,
291,
14,
1375,
275,
1347,
267,
291,
14,
32238,
275,
2963,
1412,
267,
291,
14,
7451,
275,
8020,
339,
347,
1475,
8,
277,
12,
1338,
304,
267,
408,
3484,
314,
2368,
14,
398,
961,
1475,
314,
5477,
4886,
83,
1808,
603,
23564,
1978,
14,
398,
3033,
26,
288,
1338,
334,
807,
304,
710,
1338,
3032,
465,
2368,
402,
603,
23564,
288,
658,
1160,
14,
4231,
8,
1273,
59,
78,
6575,
3352,
3682,
1459,
12544,
398,
1803,
26,
288,
437,
769,
402,
1059,
3035,
314,
7871,
4886,
83,
14,
398,
408,
398,
372,
359,
5458,
8,
1273,
680,
3352,
3682,
1459,
9,
367,
1680,
315,
291,
14,
4958,
1622,
339,
347,
1255,
8,
277,
12,
1475,
63,
589,
275,
1052,
304,
267,
408,
2540,
314,
859,
543,
314,
7871,
4886,
14,
398,
17769,
314,
10470,
4886,
543,
26834,
436,
986,
314,
754,
267,
465,
1423,
370,
314,
1627,
859,
14,
710,
754,
365,
7686,
701,
314,
267,
658,
277,
14,
32238,
64,
1083,
14,
398,
3033,
26,
288,
1475,
63,
1273,
334,
807,
304,
710,
2600,
370,
1475,
314,
4886,
543,
14,
398,
1432,
26,
288,
6935,
14,
22493,
314,
2963,
7292,
754,
402,
314,
658,
1065,
63,
3020,
64,
288,
859,
6451,
14,
398,
408,
398,
862,
26,
288,
7871,
275,
291,
14,
908,
8,
908,
63,
589,
9,
267,
871,
3146,
465,
325,
26,
288,
492,
5190,
27,
943,
14,
1757,
8,
6894,
14,
908,
63,
2804,
1012,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
4958,
63,
466,
9,
398,
327,
710,
8020,
1423,
365,
663,
737,
5477,
4205,
315,
1865,
267,
327,
370,
294,
8273,
29552,
11102,
2597,
340,
2797,
701,
11388,
1296,
3102,
14,
267,
340,
291,
14,
7451,
26,
288,
2462,
14,
928,
63,
1222,
63,
2671,
8,
3112,
14,
4591,
59,
277,
14,
578,
1055,
1065,
63,
3020,
12,
334,
15317,
12,
5082,
288,
754,
275,
488,
267,
587,
26,
288,
754,
275,
4621,
14,
4591,
59,
277,
14,
578,
1055,
1065,
63,
3020,
8,
15317,
9,
398,
340,
291,
14,
32238,
26,
288,
754,
275,
291,
14,
32238,
8,
1099,
9,
398,
372,
754,
339,
347,
2248,
63,
1099,
63,
269,
63,
1065,
8,
277,
12,
754,
63,
354,
12,
1475,
63,
589,
275,
1052,
304,
267,
408,
6200,
282,
754,
5489,
315,
859,
2351,
503,
1255,
314,
859,
14,
398,
1432,
314,
1750,
5489,
503,
1255,
314,
658,
277,
14,
1065,
64,
1083,
14,
398,
3033,
26,
288,
901,
334,
875,
304,
710,
1750,
536,
14,
288,
1475,
63,
1273,
334,
807,
304,
710,
2600,
370,
1475,
314,
4886,
543,
14,
398,
1432,
26,
288,
6935,
14,
22493,
314,
2963,
7292,
754,
402,
314,
658,
1065,
63,
3020,
64,
288,
859,
6451,
14,
398,
408,
398,
754,
275,
4621,
14,
4591,
59,
277,
14,
578,
1055,
1730,
59,
277,
14,
578,
2733,
2604,
2278,
362,
8,
1099,
63,
354,
9,
398,
340,
754,
26,
372,
754,
267,
587,
26,
372,
291,
14,
1065,
8,
908,
63,
589,
9,
4388,
199,
533,
11308,
80,
3034,
8,
2377,
4858,
304
] | [
199,
1918,
859,
658,
1018,
14,
12280,
64,
7890,
314,
2569,
11102,
3992,
14,
199,
199,
10,
658,
2377,
4858,
64,
5477,
24956,
282,
1627,
859,
543,
1627,
2368,
14,
199,
10,
658,
5663,
80,
3034,
64,
5477,
3509,
510,
18635,
1233,
12,
7934,
4799,
658,
5641,
63,
8624,
64,
859,
14,
199,
10,
658,
5663,
80,
1173,
64,
5477,
14404,
510,
18635,
1233,
687,
376,
5957,
570,
12,
436,
5341,
652,
4799,
658,
5641,
63,
8624,
64,
859,
14,
199,
10,
658,
8529,
7874,
64,
5477,
3509,
282,
5218,
1414,
12,
7934,
4799,
658,
5641,
63,
609,
64,
859,
14,
199,
199,
624,
199,
199,
504,
26834,
14,
1160,
492,
5458,
199,
504,
26834,
14,
3892,
492,
5458,
7521,
199,
504,
6170,
14,
1129,
3924,
492,
29314,
1726,
199,
504,
6170,
14,
22771,
492,
943,
199,
504,
6170,
492,
4621,
199,
646,
3778,
199,
504,
6170,
492,
3788,
199,
646,
295,
199,
646,
747,
199,
646,
2462,
199,
199,
533,
593,
83,
26,
272,
408,
10755,
314,
17406,
2656,
5477,
7163,
14,
339,
2779,
365,
3032,
465,
11102,
658,
1375,
64,
1423,
14,
339,
627,
658,
24351,
14,
8974,
64,
340,
314,
5477,
365,
9025,
543,
4036,
17406,
2656,
339,
627,
658,
24351,
14,
46,
3867,
64,
340,
314,
5477,
365,
9025,
1454,
543,
13074,
15,
14091,
655,
433,
293,
262,
1470,
339,
627,
658,
24351,
14,
7941,
64,
340,
314,
5477,
365,
9025,
1454,
543,
15332,
5417,
655,
433,
293,
262,
1470,
339,
408,
272,
1821,
275,
378,
272,
653,
3867,
275,
413,
272,
20896,
275,
499,
199,
199,
533,
5673,
4858,
26,
339,
408,
2765,
5477,
3509,
3718,
370,
5341,
1163,
4621,
14,
339,
3033,
26,
267,
859,
334,
495,
304,
5673,
536,
14,
398,
2368,
334,
513,
402,
620,
304,
2368,
3032,
465,
1414,
1004,
30183,
1059,
12,
325,
14,
71,
14,
14505,
2850,
4144,
29,
79,
297,
283,
19900,
17,
12,
2508,
1622,
2313,
398,
536,
334,
495,
304,
961,
5477,
536,
14,
398,
1347,
334,
24351,
304,
710,
17406,
2656,
3748,
701,
314,
5477,
14,
398,
2963,
1412,
334,
1532,
304,
710,
805,
1314,
2963,
1412,
314,
6451,
754,
14,
398,
8020,
334,
2245,
304,
17009,
315,
282,
7396,
2462,
641,
658,
1065,
11995,
339,
408,
339,
347,
636,
826,
721,
277,
12,
859,
12,
2368,
12,
536,
275,
3260,
1347,
275,
378,
12,
2963,
1412,
275,
488,
12,
8020,
275,
756,
304,
398,
291,
14,
354,
275,
536,
340,
536,
587,
3778,
14,
5465,
14,
3759,
495,
342,
398,
340,
1228,
8,
4958,
12,
769,
304,
288,
291,
14,
4958,
275,
2368,
267,
587,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
4749,
63,
466,
9,
398,
340,
440,
1228,
8,
1375,
12,
1109,
9,
503,
440,
1347,
665,
650,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
1375,
63,
466,
9,
398,
340,
440,
4550,
8,
32238,
9,
436,
2963,
1412,
365,
440,
488,
26,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
1932,
6338,
63,
466,
9,
398,
291,
14,
578,
275,
859,
267,
291,
14,
1375,
275,
1347,
267,
291,
14,
32238,
275,
2963,
1412,
267,
291,
14,
7451,
275,
8020,
339,
347,
1475,
8,
277,
12,
1338,
304,
267,
408,
3484,
314,
2368,
14,
398,
961,
1475,
314,
5477,
4886,
83,
1808,
603,
23564,
1978,
14,
398,
3033,
26,
288,
1338,
334,
807,
304,
710,
1338,
3032,
465,
2368,
402,
603,
23564,
288,
658,
1160,
14,
4231,
8,
1273,
59,
78,
6575,
3352,
3682,
1459,
12544,
398,
1803,
26,
288,
437,
769,
402,
1059,
3035,
314,
7871,
4886,
83,
14,
398,
408,
398,
372,
359,
5458,
8,
1273,
680,
3352,
3682,
1459,
9,
367,
1680,
315,
291,
14,
4958,
1622,
339,
347,
1255,
8,
277,
12,
1475,
63,
589,
275,
1052,
304,
267,
408,
2540,
314,
859,
543,
314,
7871,
4886,
14,
398,
17769,
314,
10470,
4886,
543,
26834,
436,
986,
314,
754,
267,
465,
1423,
370,
314,
1627,
859,
14,
710,
754,
365,
7686,
701,
314,
267,
658,
277,
14,
32238,
64,
1083,
14,
398,
3033,
26,
288,
1475,
63,
1273,
334,
807,
304,
710,
2600,
370,
1475,
314,
4886,
543,
14,
398,
1432,
26,
288,
6935,
14,
22493,
314,
2963,
7292,
754,
402,
314,
658,
1065,
63,
3020,
64,
288,
859,
6451,
14,
398,
408,
398,
862,
26,
288,
7871,
275,
291,
14,
908,
8,
908,
63,
589,
9,
267,
871,
3146,
465,
325,
26,
288,
492,
5190,
27,
943,
14,
1757,
8,
6894,
14,
908,
63,
2804,
1012,
288,
746,
29314,
1726,
8,
3431,
14,
12280,
14,
10603,
63,
4958,
63,
466,
9,
398,
327,
710,
8020,
1423,
365,
663,
737,
5477,
4205,
315,
1865,
267,
327,
370,
294,
8273,
29552,
11102,
2597,
340,
2797,
701,
11388,
1296,
3102,
14,
267,
340,
291,
14,
7451,
26,
288,
2462,
14,
928,
63,
1222,
63,
2671,
8,
3112,
14,
4591,
59,
277,
14,
578,
1055,
1065,
63,
3020,
12,
334,
15317,
12,
5082,
288,
754,
275,
488,
267,
587,
26,
288,
754,
275,
4621,
14,
4591,
59,
277,
14,
578,
1055,
1065,
63,
3020,
8,
15317,
9,
398,
340,
291,
14,
32238,
26,
288,
754,
275,
291,
14,
32238,
8,
1099,
9,
398,
372,
754,
339,
347,
2248,
63,
1099,
63,
269,
63,
1065,
8,
277,
12,
754,
63,
354,
12,
1475,
63,
589,
275,
1052,
304,
267,
408,
6200,
282,
754,
5489,
315,
859,
2351,
503,
1255,
314,
859,
14,
398,
1432,
314,
1750,
5489,
503,
1255,
314,
658,
277,
14,
1065,
64,
1083,
14,
398,
3033,
26,
288,
901,
334,
875,
304,
710,
1750,
536,
14,
288,
1475,
63,
1273,
334,
807,
304,
710,
2600,
370,
1475,
314,
4886,
543,
14,
398,
1432,
26,
288,
6935,
14,
22493,
314,
2963,
7292,
754,
402,
314,
658,
1065,
63,
3020,
64,
288,
859,
6451,
14,
398,
408,
398,
754,
275,
4621,
14,
4591,
59,
277,
14,
578,
1055,
1730,
59,
277,
14,
578,
2733,
2604,
2278,
362,
8,
1099,
63,
354,
9,
398,
340,
754,
26,
372,
754,
267,
587,
26,
372,
291,
14,
1065,
8,
908,
63,
589,
9,
4388,
199,
533,
11308,
80,
3034,
8,
2377,
4858,
304,
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,
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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
] |
pigshell/nhnick | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py | 124 | 2709 | # Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys
import unittest2 as unittest
from webkitpy.common.system import outputcapture
from webkitpy.common.system import stack_utils
def current_thread_id():
thread_id, _ = sys._current_frames().items()[0]
return thread_id
class StackUtilsTest(unittest.TestCase):
def test_find_thread_stack_found(self):
thread_id = current_thread_id()
found_stack = stack_utils._find_thread_stack(thread_id)
self.assertIsNotNone(found_stack)
def test_find_thread_stack_not_found(self):
found_stack = stack_utils._find_thread_stack(0)
self.assertIsNone(found_stack)
def test_log_thread_state(self):
msgs = []
def logger(msg):
msgs.append(msg)
thread_id = current_thread_id()
stack_utils.log_thread_state(logger, "test-thread", thread_id,
"is tested")
self.assertTrue(msgs)
def test_log_traceback(self):
msgs = []
def logger(msg):
msgs.append(msg)
try:
raise ValueError
except:
stack_utils.log_traceback(logger, sys.exc_info()[2])
self.assertTrue(msgs)
| bsd-3-clause | [
3,
1898,
334,
35,
9,
7760,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
646,
984,
199,
646,
2882,
18,
465,
2882,
199,
199,
504,
18007,
14,
2330,
14,
2253,
492,
1072,
12685,
199,
504,
18007,
14,
2330,
14,
2253,
492,
3464,
63,
1208,
421,
199,
318,
1453,
63,
2671,
63,
344,
837,
272,
2462,
63,
344,
12,
485,
275,
984,
423,
1818,
63,
8444,
1252,
1744,
3430,
16,
61,
272,
372,
2462,
63,
344,
421,
199,
533,
13894,
7535,
774,
8,
2796,
14,
1746,
304,
272,
347,
511,
63,
1623,
63,
2671,
63,
2340,
63,
4214,
8,
277,
304,
267,
2462,
63,
344,
275,
1453,
63,
2671,
63,
344,
342,
267,
1911,
63,
2340,
275,
3464,
63,
1208,
423,
1623,
63,
2671,
63,
2340,
8,
2671,
63,
344,
9,
267,
291,
14,
10389,
8,
4214,
63,
2340,
9,
339,
347,
511,
63,
1623,
63,
2671,
63,
2340,
63,
1397,
63,
4214,
8,
277,
304,
267,
1911,
63,
2340,
275,
3464,
63,
1208,
423,
1623,
63,
2671,
63,
2340,
8,
16,
9,
267,
291,
14,
7702,
8,
4214,
63,
2340,
9,
339,
347,
511,
63,
793,
63,
2671,
63,
929,
8,
277,
304,
267,
17599,
275,
942,
398,
347,
2512,
8,
1328,
304,
288,
17599,
14,
740,
8,
1328,
9,
398,
2462,
63,
344,
275,
1453,
63,
2671,
63,
344,
342,
267,
3464,
63,
1208,
14,
793,
63,
2671,
63,
929,
8,
2921,
12,
298,
396,
13,
2671,
401,
2462,
63,
344,
12,
3660,
298,
374,
12470,
531,
267,
291,
14,
1815,
8,
13429,
9,
339,
347,
511,
63,
793,
63,
6894,
8,
277,
304,
267,
17599,
275,
942,
398,
347,
2512,
8,
1328,
304,
288,
17599,
14,
740,
8,
1328,
9,
398,
862,
26,
288,
746,
1722,
267,
871,
26,
288,
3464,
63,
1208,
14,
793,
63,
6894,
8,
2921,
12,
984,
14,
2804,
63,
815,
3430,
18,
566,
267,
291,
14,
1815,
8,
13429,
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
] | [
1898,
334,
35,
9,
7760,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
646,
984,
199,
646,
2882,
18,
465,
2882,
199,
199,
504,
18007,
14,
2330,
14,
2253,
492,
1072,
12685,
199,
504,
18007,
14,
2330,
14,
2253,
492,
3464,
63,
1208,
421,
199,
318,
1453,
63,
2671,
63,
344,
837,
272,
2462,
63,
344,
12,
485,
275,
984,
423,
1818,
63,
8444,
1252,
1744,
3430,
16,
61,
272,
372,
2462,
63,
344,
421,
199,
533,
13894,
7535,
774,
8,
2796,
14,
1746,
304,
272,
347,
511,
63,
1623,
63,
2671,
63,
2340,
63,
4214,
8,
277,
304,
267,
2462,
63,
344,
275,
1453,
63,
2671,
63,
344,
342,
267,
1911,
63,
2340,
275,
3464,
63,
1208,
423,
1623,
63,
2671,
63,
2340,
8,
2671,
63,
344,
9,
267,
291,
14,
10389,
8,
4214,
63,
2340,
9,
339,
347,
511,
63,
1623,
63,
2671,
63,
2340,
63,
1397,
63,
4214,
8,
277,
304,
267,
1911,
63,
2340,
275,
3464,
63,
1208,
423,
1623,
63,
2671,
63,
2340,
8,
16,
9,
267,
291,
14,
7702,
8,
4214,
63,
2340,
9,
339,
347,
511,
63,
793,
63,
2671,
63,
929,
8,
277,
304,
267,
17599,
275,
942,
398,
347,
2512,
8,
1328,
304,
288,
17599,
14,
740,
8,
1328,
9,
398,
2462,
63,
344,
275,
1453,
63,
2671,
63,
344,
342,
267,
3464,
63,
1208,
14,
793,
63,
2671,
63,
929,
8,
2921,
12,
298,
396,
13,
2671,
401,
2462,
63,
344,
12,
3660,
298,
374,
12470,
531,
267,
291,
14,
1815,
8,
13429,
9,
339,
347,
511,
63,
793,
63,
6894,
8,
277,
304,
267,
17599,
275,
942,
398,
347,
2512,
8,
1328,
304,
288,
17599,
14,
740,
8,
1328,
9,
398,
862,
26,
288,
746,
1722,
267,
871,
26,
288,
3464,
63,
1208,
14,
793,
63,
6894,
8,
2921,
12,
984,
14,
2804,
63,
815,
3430,
18,
566,
267,
291,
14,
1815,
8,
13429,
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,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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py | 15 | 4253 | from itertools import chain
import numpy as np
import scipy.signal
import mxnet as mx
class Agent(object):
def __init__(self, input_size, act_space, config):
super(Agent, self).__init__()
self.input_size = input_size
self.num_envs = config.num_envs
self.ctx = config.ctx
self.act_space = act_space
self.config = config
# Shared network.
net = mx.sym.Variable('data')
net = mx.sym.FullyConnected(
data=net, name='fc1', num_hidden=config.hidden_size, no_bias=True)
net = mx.sym.Activation(data=net, name='relu1', act_type="relu")
# Policy network.
policy_fc = mx.sym.FullyConnected(
data=net, name='policy_fc', num_hidden=act_space, no_bias=True)
policy = mx.sym.SoftmaxActivation(data=policy_fc, name='policy')
policy = mx.sym.clip(data=policy, a_min=1e-5, a_max=1 - 1e-5)
log_policy = mx.sym.log(data=policy, name='log_policy')
out_policy = mx.sym.BlockGrad(data=policy, name='out_policy')
# Negative entropy.
neg_entropy = policy * log_policy
neg_entropy = mx.sym.MakeLoss(
data=neg_entropy, grad_scale=config.entropy_wt, name='neg_entropy')
# Value network.
value = mx.sym.FullyConnected(data=net, name='value', num_hidden=1)
self.sym = mx.sym.Group([log_policy, value, neg_entropy, out_policy])
self.model = mx.mod.Module(self.sym, data_names=('data',),
label_names=None)
self.paralell_num = config.num_envs * config.t_max
self.model.bind(
data_shapes=[('data', (self.paralell_num, input_size))],
label_shapes=None,
grad_req="write")
self.model.init_params(config.init_func)
optimizer_params = {'learning_rate': config.learning_rate,
'rescale_grad': 1.0}
if config.grad_clip:
optimizer_params['clip_gradient'] = config.clip_magnitude
self.model.init_optimizer(
kvstore='local', optimizer=config.update_rule,
optimizer_params=optimizer_params)
def act(self, ps):
us = np.random.uniform(size=ps.shape[0])[:, np.newaxis]
as_ = (np.cumsum(ps, axis=1) > us).argmax(axis=1)
return as_
def train_step(self, env_xs, env_as, env_rs, env_vs):
# NOTE(reed): Reshape to set the data shape.
self.model.reshape([('data', (len(env_xs), self.input_size))])
xs = mx.nd.array(env_xs, ctx=self.ctx)
as_ = np.array(list(chain.from_iterable(env_as)))
# Compute discounted rewards and advantages.
advs = []
gamma, lambda_ = self.config.gamma, self.config.lambda_
for i in xrange(len(env_vs)):
# Compute advantages using Generalized Advantage Estimation;
# see eqn. (16) of [Schulman 2016].
delta_t = (env_rs[i] + gamma*np.array(env_vs[i][1:]) -
np.array(env_vs[i][:-1]))
advs.extend(self._discount(delta_t, gamma * lambda_))
# Negative generalized advantage estimations.
neg_advs_v = -np.asarray(advs)
# NOTE(reed): Only keeping the grads for selected actions.
neg_advs_np = np.zeros((len(advs), self.act_space), dtype=np.float32)
neg_advs_np[np.arange(neg_advs_np.shape[0]), as_] = neg_advs_v
neg_advs = mx.nd.array(neg_advs_np, ctx=self.ctx)
# NOTE(reed): The grads of values is actually negative advantages.
v_grads = mx.nd.array(self.config.vf_wt * neg_advs_v[:, np.newaxis],
ctx=self.ctx)
data_batch = mx.io.DataBatch(data=[xs], label=None)
self._forward_backward(data_batch=data_batch,
out_grads=[neg_advs, v_grads])
self._update_params()
def _discount(self, x, gamma):
return scipy.signal.lfilter([1], [1, -gamma], x[::-1], axis=0)[::-1]
def _forward_backward(self, data_batch, out_grads=None):
self.model.forward(data_batch, is_train=True)
self.model.backward(out_grads=out_grads)
def _update_params(self):
self.model.update()
self.model._sync_params_from_devices()
| apache-2.0 | [
504,
7975,
492,
6036,
199,
646,
2680,
465,
980,
199,
646,
7026,
14,
4653,
199,
646,
8728,
846,
465,
8728,
421,
199,
533,
19866,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1324,
63,
890,
12,
2454,
63,
2638,
12,
1101,
304,
267,
1613,
8,
7788,
12,
291,
2843,
826,
4533,
267,
291,
14,
1210,
63,
890,
275,
1324,
63,
890,
267,
291,
14,
1507,
63,
27900,
275,
1101,
14,
1507,
63,
27900,
267,
291,
14,
3799,
275,
1101,
14,
3799,
267,
291,
14,
2442,
63,
2638,
275,
2454,
63,
2638,
267,
291,
14,
888,
275,
1101,
398,
327,
23752,
2784,
14,
267,
1851,
275,
8728,
14,
3840,
14,
2773,
360,
576,
358,
267,
1851,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
288,
666,
29,
846,
12,
536,
534,
3003,
17,
297,
1967,
63,
5642,
29,
888,
14,
5642,
63,
890,
12,
949,
63,
8160,
29,
549,
9,
267,
1851,
275,
8728,
14,
3840,
14,
19535,
8,
576,
29,
846,
12,
536,
534,
12833,
17,
297,
2454,
63,
466,
628,
12833,
531,
398,
327,
18141,
2784,
14,
267,
4592,
63,
3003,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
288,
666,
29,
846,
12,
536,
534,
3185,
63,
3003,
297,
1967,
63,
5642,
29,
2442,
63,
2638,
12,
949,
63,
8160,
29,
549,
9,
267,
4592,
275,
8728,
14,
3840,
14,
19302,
988,
19535,
8,
576,
29,
3185,
63,
3003,
12,
536,
534,
3185,
358,
267,
4592,
275,
8728,
14,
3840,
14,
7548,
8,
576,
29,
3185,
12,
282,
63,
827,
29,
17,
69,
13,
21,
12,
282,
63,
988,
29,
17,
446,
413,
69,
13,
21,
9,
267,
943,
63,
3185,
275,
8728,
14,
3840,
14,
793,
8,
576,
29,
3185,
12,
536,
534,
793,
63,
3185,
358,
267,
734,
63,
3185,
275,
8728,
14,
3840,
14,
3142,
14812,
8,
576,
29,
3185,
12,
536,
534,
548,
63,
3185,
358,
398,
327,
32548,
19490,
14,
267,
14158,
63,
10435,
275,
4592,
627,
943,
63,
3185,
267,
14158,
63,
10435,
275,
8728,
14,
3840,
14,
5483,
8610,
8,
288,
666,
29,
8705,
63,
10435,
12,
7659,
63,
3467,
29,
888,
14,
10435,
63,
9115,
12,
536,
534,
8705,
63,
10435,
358,
398,
327,
1594,
2784,
14,
267,
574,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
576,
29,
846,
12,
536,
534,
585,
297,
1967,
63,
5642,
29,
17,
9,
398,
291,
14,
3840,
275,
8728,
14,
3840,
14,
2448,
779,
793,
63,
3185,
12,
574,
12,
14158,
63,
10435,
12,
734,
63,
3185,
566,
267,
291,
14,
1238,
275,
8728,
14,
1494,
14,
2377,
8,
277,
14,
3840,
12,
666,
63,
1247,
7782,
576,
5529,
3521,
1768,
63,
1247,
29,
403,
9,
398,
291,
14,
462,
1895,
914,
63,
1507,
275,
1101,
14,
1507,
63,
27900,
627,
1101,
14,
84,
63,
988,
267,
291,
14,
1238,
14,
3409,
8,
288,
666,
63,
9069,
11699,
576,
297,
334,
277,
14,
462,
1895,
914,
63,
1507,
12,
1324,
63,
890,
25106,
288,
1768,
63,
9069,
29,
403,
12,
288,
7659,
63,
2103,
628,
952,
531,
398,
291,
14,
1238,
14,
826,
63,
1162,
8,
888,
14,
826,
63,
1532,
9,
398,
10736,
63,
1162,
275,
791,
10546,
63,
1866,
356,
1101,
14,
10546,
63,
1866,
12,
1169,
283,
470,
2357,
63,
6017,
356,
413,
14,
16,
93,
267,
340,
1101,
14,
6017,
63,
7548,
26,
288,
10736,
63,
1162,
459,
7548,
63,
7490,
418,
275,
1101,
14,
7548,
63,
32167,
398,
291,
14,
1238,
14,
826,
63,
12290,
8,
288,
16616,
1617,
534,
1832,
297,
10736,
29,
888,
14,
873,
63,
2200,
12,
288,
10736,
63,
1162,
29,
12290,
63,
1162,
9,
339,
347,
2454,
8,
277,
12,
7347,
304,
267,
2739,
275,
980,
14,
2355,
14,
8830,
8,
890,
29,
1190,
14,
1392,
59,
16,
566,
3981,
980,
14,
14483,
61,
267,
465,
63,
275,
334,
1590,
14,
23916,
8,
1190,
12,
3114,
29,
17,
9,
690,
2739,
680,
16383,
8,
3127,
29,
17,
9,
267,
372,
465,
63,
339,
347,
3560,
63,
2926,
8,
277,
12,
2589,
63,
7977,
12,
2589,
63,
305,
12,
2589,
63,
2393,
12,
2589,
63,
3122,
304,
267,
327,
6944,
8,
3798,
304,
3591,
15221,
370,
663,
314,
666,
2215,
14,
267,
291,
14,
1238,
14,
5217,
8318,
576,
297,
334,
552,
8,
1813,
63,
7977,
395,
291,
14,
1210,
63,
890,
18229,
398,
12965,
275,
8728,
14,
977,
14,
1144,
8,
1813,
63,
7977,
12,
4027,
29,
277,
14,
3799,
9,
267,
465,
63,
275,
980,
14,
1144,
8,
513,
8,
4429,
14,
504,
63,
8147,
8,
1813,
63,
305,
1724,
398,
327,
8354,
2153,
3094,
471,
295,
4751,
436,
19396,
867,
7441,
14,
267,
1503,
3122,
275,
942,
267,
10169,
12,
2400,
63,
275,
291,
14,
888,
14,
7325,
12,
291,
14,
888,
14,
2734,
63,
267,
367,
284,
315,
4945,
8,
552,
8,
1813,
63,
3122,
2298,
288,
327,
8354,
19396,
867,
7441,
1808,
1696,
1759,
4431,
86,
25331,
15896,
8182,
27,
288,
327,
1937,
3850,
78,
14,
334,
975,
9,
402,
359,
31936,
348,
1237,
7800,
1055,
288,
5762,
63,
84,
275,
334,
1813,
63,
2393,
59,
73,
61,
435,
10169,
10,
1590,
14,
1144,
8,
1813,
63,
3122,
59,
73,
1527,
17,
5728,
446,
2432,
980,
14,
1144,
8,
1813,
63,
3122,
59,
73,
61,
4439,
17,
2459,
288,
1503,
3122,
14,
2880,
8,
277,
423,
15446,
8,
3136,
63,
84,
12,
10169,
627,
2400,
13309,
398,
327,
32548,
8605,
1759,
30268,
4347,
11744,
852,
14,
267,
14158,
63,
350,
3122,
63,
86,
275,
446,
1590,
14,
8748,
8,
350,
3122,
9,
398,
327,
6944,
8,
3798,
304,
5972,
22181,
314,
18300,
367,
4895,
5445,
14,
267,
14158,
63,
350,
3122,
63,
1590,
275,
980,
14,
4250,
1332,
552,
8,
350,
3122,
395,
291,
14,
2442,
63,
2638,
395,
2152,
29,
1590,
14,
1609,
708,
9,
267,
14158,
63,
350,
3122,
63,
1590,
59,
1590,
14,
5605,
8,
8705,
63,
350,
3122,
63,
1590,
14,
1392,
59,
16,
2522,
465,
24601,
275,
14158,
63,
350,
3122,
63,
86,
267,
14158,
63,
350,
3122,
275,
8728,
14,
977,
14,
1144,
8,
8705,
63,
350,
3122,
63,
1590,
12
] | [
7975,
492,
6036,
199,
646,
2680,
465,
980,
199,
646,
7026,
14,
4653,
199,
646,
8728,
846,
465,
8728,
421,
199,
533,
19866,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1324,
63,
890,
12,
2454,
63,
2638,
12,
1101,
304,
267,
1613,
8,
7788,
12,
291,
2843,
826,
4533,
267,
291,
14,
1210,
63,
890,
275,
1324,
63,
890,
267,
291,
14,
1507,
63,
27900,
275,
1101,
14,
1507,
63,
27900,
267,
291,
14,
3799,
275,
1101,
14,
3799,
267,
291,
14,
2442,
63,
2638,
275,
2454,
63,
2638,
267,
291,
14,
888,
275,
1101,
398,
327,
23752,
2784,
14,
267,
1851,
275,
8728,
14,
3840,
14,
2773,
360,
576,
358,
267,
1851,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
288,
666,
29,
846,
12,
536,
534,
3003,
17,
297,
1967,
63,
5642,
29,
888,
14,
5642,
63,
890,
12,
949,
63,
8160,
29,
549,
9,
267,
1851,
275,
8728,
14,
3840,
14,
19535,
8,
576,
29,
846,
12,
536,
534,
12833,
17,
297,
2454,
63,
466,
628,
12833,
531,
398,
327,
18141,
2784,
14,
267,
4592,
63,
3003,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
288,
666,
29,
846,
12,
536,
534,
3185,
63,
3003,
297,
1967,
63,
5642,
29,
2442,
63,
2638,
12,
949,
63,
8160,
29,
549,
9,
267,
4592,
275,
8728,
14,
3840,
14,
19302,
988,
19535,
8,
576,
29,
3185,
63,
3003,
12,
536,
534,
3185,
358,
267,
4592,
275,
8728,
14,
3840,
14,
7548,
8,
576,
29,
3185,
12,
282,
63,
827,
29,
17,
69,
13,
21,
12,
282,
63,
988,
29,
17,
446,
413,
69,
13,
21,
9,
267,
943,
63,
3185,
275,
8728,
14,
3840,
14,
793,
8,
576,
29,
3185,
12,
536,
534,
793,
63,
3185,
358,
267,
734,
63,
3185,
275,
8728,
14,
3840,
14,
3142,
14812,
8,
576,
29,
3185,
12,
536,
534,
548,
63,
3185,
358,
398,
327,
32548,
19490,
14,
267,
14158,
63,
10435,
275,
4592,
627,
943,
63,
3185,
267,
14158,
63,
10435,
275,
8728,
14,
3840,
14,
5483,
8610,
8,
288,
666,
29,
8705,
63,
10435,
12,
7659,
63,
3467,
29,
888,
14,
10435,
63,
9115,
12,
536,
534,
8705,
63,
10435,
358,
398,
327,
1594,
2784,
14,
267,
574,
275,
8728,
14,
3840,
14,
38,
8525,
16382,
8,
576,
29,
846,
12,
536,
534,
585,
297,
1967,
63,
5642,
29,
17,
9,
398,
291,
14,
3840,
275,
8728,
14,
3840,
14,
2448,
779,
793,
63,
3185,
12,
574,
12,
14158,
63,
10435,
12,
734,
63,
3185,
566,
267,
291,
14,
1238,
275,
8728,
14,
1494,
14,
2377,
8,
277,
14,
3840,
12,
666,
63,
1247,
7782,
576,
5529,
3521,
1768,
63,
1247,
29,
403,
9,
398,
291,
14,
462,
1895,
914,
63,
1507,
275,
1101,
14,
1507,
63,
27900,
627,
1101,
14,
84,
63,
988,
267,
291,
14,
1238,
14,
3409,
8,
288,
666,
63,
9069,
11699,
576,
297,
334,
277,
14,
462,
1895,
914,
63,
1507,
12,
1324,
63,
890,
25106,
288,
1768,
63,
9069,
29,
403,
12,
288,
7659,
63,
2103,
628,
952,
531,
398,
291,
14,
1238,
14,
826,
63,
1162,
8,
888,
14,
826,
63,
1532,
9,
398,
10736,
63,
1162,
275,
791,
10546,
63,
1866,
356,
1101,
14,
10546,
63,
1866,
12,
1169,
283,
470,
2357,
63,
6017,
356,
413,
14,
16,
93,
267,
340,
1101,
14,
6017,
63,
7548,
26,
288,
10736,
63,
1162,
459,
7548,
63,
7490,
418,
275,
1101,
14,
7548,
63,
32167,
398,
291,
14,
1238,
14,
826,
63,
12290,
8,
288,
16616,
1617,
534,
1832,
297,
10736,
29,
888,
14,
873,
63,
2200,
12,
288,
10736,
63,
1162,
29,
12290,
63,
1162,
9,
339,
347,
2454,
8,
277,
12,
7347,
304,
267,
2739,
275,
980,
14,
2355,
14,
8830,
8,
890,
29,
1190,
14,
1392,
59,
16,
566,
3981,
980,
14,
14483,
61,
267,
465,
63,
275,
334,
1590,
14,
23916,
8,
1190,
12,
3114,
29,
17,
9,
690,
2739,
680,
16383,
8,
3127,
29,
17,
9,
267,
372,
465,
63,
339,
347,
3560,
63,
2926,
8,
277,
12,
2589,
63,
7977,
12,
2589,
63,
305,
12,
2589,
63,
2393,
12,
2589,
63,
3122,
304,
267,
327,
6944,
8,
3798,
304,
3591,
15221,
370,
663,
314,
666,
2215,
14,
267,
291,
14,
1238,
14,
5217,
8318,
576,
297,
334,
552,
8,
1813,
63,
7977,
395,
291,
14,
1210,
63,
890,
18229,
398,
12965,
275,
8728,
14,
977,
14,
1144,
8,
1813,
63,
7977,
12,
4027,
29,
277,
14,
3799,
9,
267,
465,
63,
275,
980,
14,
1144,
8,
513,
8,
4429,
14,
504,
63,
8147,
8,
1813,
63,
305,
1724,
398,
327,
8354,
2153,
3094,
471,
295,
4751,
436,
19396,
867,
7441,
14,
267,
1503,
3122,
275,
942,
267,
10169,
12,
2400,
63,
275,
291,
14,
888,
14,
7325,
12,
291,
14,
888,
14,
2734,
63,
267,
367,
284,
315,
4945,
8,
552,
8,
1813,
63,
3122,
2298,
288,
327,
8354,
19396,
867,
7441,
1808,
1696,
1759,
4431,
86,
25331,
15896,
8182,
27,
288,
327,
1937,
3850,
78,
14,
334,
975,
9,
402,
359,
31936,
348,
1237,
7800,
1055,
288,
5762,
63,
84,
275,
334,
1813,
63,
2393,
59,
73,
61,
435,
10169,
10,
1590,
14,
1144,
8,
1813,
63,
3122,
59,
73,
1527,
17,
5728,
446,
2432,
980,
14,
1144,
8,
1813,
63,
3122,
59,
73,
61,
4439,
17,
2459,
288,
1503,
3122,
14,
2880,
8,
277,
423,
15446,
8,
3136,
63,
84,
12,
10169,
627,
2400,
13309,
398,
327,
32548,
8605,
1759,
30268,
4347,
11744,
852,
14,
267,
14158,
63,
350,
3122,
63,
86,
275,
446,
1590,
14,
8748,
8,
350,
3122,
9,
398,
327,
6944,
8,
3798,
304,
5972,
22181,
314,
18300,
367,
4895,
5445,
14,
267,
14158,
63,
350,
3122,
63,
1590,
275,
980,
14,
4250,
1332,
552,
8,
350,
3122,
395,
291,
14,
2442,
63,
2638,
395,
2152,
29,
1590,
14,
1609,
708,
9,
267,
14158,
63,
350,
3122,
63,
1590,
59,
1590,
14,
5605,
8,
8705,
63,
350,
3122,
63,
1590,
14,
1392,
59,
16,
2522,
465,
24601,
275,
14158,
63,
350,
3122,
63,
86,
267,
14158,
63,
350,
3122,
275,
8728,
14,
977,
14,
1144,
8,
8705,
63,
350,
3122,
63,
1590,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
vmturbo/nova | nova/config.py | 5 | 1949 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, 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 oslo_log import log
from oslo_utils import importutils
from nova.common import config
import nova.conf
from nova.db.sqlalchemy import api as sqlalchemy_api
from nova import rpc
from nova import version
profiler = importutils.try_import('osprofiler.opts')
CONF = nova.conf.CONF
def parse_args(argv, default_config_files=None, configure_db=True,
init_rpc=True):
log.register_options(CONF)
# We use the oslo.log default log levels which includes suds=INFO
# and add only the extra levels that Nova needs
if CONF.glance.debug:
extra_default_log_levels = ['glanceclient=DEBUG']
else:
extra_default_log_levels = ['glanceclient=WARN']
log.set_defaults(default_log_levels=log.get_default_log_levels() +
extra_default_log_levels)
rpc.set_defaults(control_exchange='nova')
if profiler:
profiler.set_defaults(CONF)
config.set_middleware_defaults()
CONF(argv[1:],
project='nova',
version=version.version_string(),
default_config_files=default_config_files)
if init_rpc:
rpc.init(CONF)
if configure_db:
sqlalchemy_api.configure(CONF)
| apache-2.0 | [
3,
1898,
7129,
1910,
5703,
24230,
598,
27639,
465,
11159,
701,
314,
199,
3,
30660,
402,
314,
20548,
437,
281,
265,
3844,
7769,
436,
19326,
9516,
4633,
14,
199,
3,
2900,
5924,
5702,
14,
199,
3,
1898,
6029,
9572,
13002,
12,
3277,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
504,
11258,
63,
793,
492,
943,
199,
504,
11258,
63,
1208,
492,
492,
1208,
199,
199,
504,
5913,
14,
2330,
492,
1101,
199,
646,
5913,
14,
2190,
199,
504,
5913,
14,
697,
14,
14536,
492,
2986,
465,
8335,
63,
1246,
199,
504,
5913,
492,
8985,
199,
504,
5913,
492,
1015,
199,
199,
20132,
275,
492,
1208,
14,
893,
63,
646,
360,
736,
20132,
14,
3291,
358,
421,
199,
3103,
275,
5913,
14,
2190,
14,
3103,
421,
199,
318,
2198,
63,
589,
8,
3020,
12,
849,
63,
888,
63,
1725,
29,
403,
12,
7908,
63,
697,
29,
549,
12,
2049,
4205,
63,
4354,
29,
549,
304,
272,
943,
14,
2683,
63,
1419,
8,
3103,
9,
272,
327,
2136,
675,
314,
11258,
14,
793,
849,
943,
11106,
1314,
6952,
30713,
29,
4531,
272,
327,
436,
1050,
1454,
314,
2402,
11106,
626,
28184,
4839,
272,
340,
6392,
14,
18773,
14,
1757,
26,
267,
2402,
63,
885,
63,
793,
63,
11402,
275,
788,
18773,
1258,
29,
5287,
418,
272,
587,
26,
267,
2402,
63,
885,
63,
793,
63,
11402,
275,
788,
18773,
1258,
29,
17449,
418,
272,
943,
14,
409,
63,
4322,
8,
885,
63,
793,
63,
11402,
29,
793,
14,
362,
63,
885,
63,
793,
63,
11402,
342,
435,
2151,
2402,
63,
885,
63,
793,
63,
11402,
9,
272,
8985,
14,
409,
63,
4322,
8,
2785,
63,
14197,
534,
6765,
358,
272,
340,
23173,
26,
267,
23173,
14,
409,
63,
4322,
8,
3103,
9,
272,
1101,
14,
409,
63,
5754,
63,
4322,
342,
339,
6392,
8,
3020,
59,
17,
8429,
268,
2199,
534,
6765,
297,
268,
1015,
29,
1023,
14,
1023,
63,
875,
1062,
268,
849,
63,
888,
63,
1725,
29,
885,
63,
888,
63,
1725,
9,
339,
340,
4205,
63,
4354,
26,
267,
8985,
14,
826,
8,
3103,
9,
339,
340,
7908,
63,
697,
26,
267,
8335,
63,
1246,
14,
6472,
8,
3103,
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
] | [
1898,
7129,
1910,
5703,
24230,
598,
27639,
465,
11159,
701,
314,
199,
3,
30660,
402,
314,
20548,
437,
281,
265,
3844,
7769,
436,
19326,
9516,
4633,
14,
199,
3,
2900,
5924,
5702,
14,
199,
3,
1898,
6029,
9572,
13002,
12,
3277,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
504,
11258,
63,
793,
492,
943,
199,
504,
11258,
63,
1208,
492,
492,
1208,
199,
199,
504,
5913,
14,
2330,
492,
1101,
199,
646,
5913,
14,
2190,
199,
504,
5913,
14,
697,
14,
14536,
492,
2986,
465,
8335,
63,
1246,
199,
504,
5913,
492,
8985,
199,
504,
5913,
492,
1015,
199,
199,
20132,
275,
492,
1208,
14,
893,
63,
646,
360,
736,
20132,
14,
3291,
358,
421,
199,
3103,
275,
5913,
14,
2190,
14,
3103,
421,
199,
318,
2198,
63,
589,
8,
3020,
12,
849,
63,
888,
63,
1725,
29,
403,
12,
7908,
63,
697,
29,
549,
12,
2049,
4205,
63,
4354,
29,
549,
304,
272,
943,
14,
2683,
63,
1419,
8,
3103,
9,
272,
327,
2136,
675,
314,
11258,
14,
793,
849,
943,
11106,
1314,
6952,
30713,
29,
4531,
272,
327,
436,
1050,
1454,
314,
2402,
11106,
626,
28184,
4839,
272,
340,
6392,
14,
18773,
14,
1757,
26,
267,
2402,
63,
885,
63,
793,
63,
11402,
275,
788,
18773,
1258,
29,
5287,
418,
272,
587,
26,
267,
2402,
63,
885,
63,
793,
63,
11402,
275,
788,
18773,
1258,
29,
17449,
418,
272,
943,
14,
409,
63,
4322,
8,
885,
63,
793,
63,
11402,
29,
793,
14,
362,
63,
885,
63,
793,
63,
11402,
342,
435,
2151,
2402,
63,
885,
63,
793,
63,
11402,
9,
272,
8985,
14,
409,
63,
4322,
8,
2785,
63,
14197,
534,
6765,
358,
272,
340,
23173,
26,
267,
23173,
14,
409,
63,
4322,
8,
3103,
9,
272,
1101,
14,
409,
63,
5754,
63,
4322,
342,
339,
6392,
8,
3020,
59,
17,
8429,
268,
2199,
534,
6765,
297,
268,
1015,
29,
1023,
14,
1023,
63,
875,
1062,
268,
849,
63,
888,
63,
1725,
29,
885,
63,
888,
63,
1725,
9,
339,
340,
4205,
63,
4354,
26,
267,
8985,
14,
826,
8,
3103,
9,
339,
340,
7908,
63,
697,
26,
267,
8335,
63,
1246,
14,
6472,
8,
3103,
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,
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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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
] |
peastman/deepchem | examples/tox21/tox21_IRV.py | 6 | 1286 | """
Script that trains multitask models on Tox21 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import shutil
import numpy as np
import deepchem as dc
import time
from deepchem.molnet import load_tox21
# Only for debug!
np.random.seed(123)
# Load Tox21 dataset
n_features = 1024
tox21_tasks, tox21_datasets, transformers = load_tox21()
train_dataset, valid_dataset, test_dataset = tox21_datasets
K = 10
# Fit models
metric = dc.metrics.Metric(dc.metrics.roc_auc_score, np.mean)
transformers = [dc.trans.IRVTransformer(K, len(tox21_tasks), train_dataset)]
for transformer in transformers:
train_dataset = transformer.transform(train_dataset)
valid_dataset = transformer.transform(valid_dataset)
test_dataset = transformer.transform(test_dataset)
model = dc.models.TensorflowMultitaskIRVClassifier(
len(tox21_tasks), K=K, learning_rate=0.001, penalty=0.05, batch_size=32)
# Fit trained model
model.fit(train_dataset, nb_epoch=10)
print("Evaluating model")
train_scores = model.evaluate(train_dataset, [metric], transformers)
valid_scores = model.evaluate(valid_dataset, [metric], transformers)
print("Train scores")
print(train_scores)
print("Validation scores")
print(valid_scores)
| mit | [
624,
199,
5229,
626,
3560,
83,
3510,
1765,
1709,
641,
4005,
88,
2025,
4789,
14,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
747,
199,
646,
5145,
199,
646,
2680,
465,
980,
199,
646,
13217,
24448,
465,
12326,
199,
646,
900,
199,
504,
13217,
24448,
14,
16924,
846,
492,
2248,
63,
475,
88,
2025,
199,
199,
3,
5972,
367,
3105,
1,
199,
1590,
14,
2355,
14,
5176,
8,
4288,
9,
199,
199,
3,
7190,
4005,
88,
2025,
4789,
199,
78,
63,
3179,
275,
6619,
199,
475,
88,
2025,
63,
5054,
12,
370,
88,
2025,
63,
12281,
12,
1752,
22932,
275,
2248,
63,
475,
88,
2025,
342,
199,
2834,
63,
5214,
12,
1686,
63,
5214,
12,
511,
63,
5214,
275,
370,
88,
2025,
63,
12281,
199,
43,
275,
1616,
199,
3,
25971,
1709,
199,
5165,
275,
12326,
14,
6759,
14,
11119,
8,
3833,
14,
6759,
14,
26786,
63,
19129,
63,
3397,
12,
980,
14,
3670,
9,
199,
1515,
22932,
275,
359,
3833,
14,
1515,
14,
3927,
54,
19761,
8,
43,
12,
822,
8,
475,
88,
2025,
63,
5054,
395,
3560,
63,
5214,
1874,
199,
199,
509,
21484,
315,
1752,
22932,
26,
523,
3560,
63,
5214,
275,
21484,
14,
4711,
8,
2834,
63,
5214,
9,
523,
1686,
63,
5214,
275,
21484,
14,
4711,
8,
1078,
63,
5214,
9,
523,
511,
63,
5214,
275,
21484,
14,
4711,
8,
396,
63,
5214,
9,
199,
199,
1238,
275,
12326,
14,
992,
14,
3861,
1659,
3947,
1765,
3927,
54,
8508,
8,
272,
822,
8,
475,
88,
2025,
63,
5054,
395,
1804,
29,
43,
12,
9328,
63,
1866,
29,
16,
14,
4587,
12,
21251,
29,
16,
14,
1717,
12,
3522,
63,
890,
29,
708,
9,
199,
199,
3,
25971,
28161,
1402,
199,
1238,
14,
3269,
8,
2834,
63,
5214,
12,
8526,
63,
7367,
29,
709,
9,
199,
199,
1361,
480,
10006,
85,
1958,
1402,
531,
199,
2834,
63,
7107,
275,
1402,
14,
7383,
8,
2834,
63,
5214,
12,
359,
5165,
467,
1752,
22932,
9,
199,
1078,
63,
7107,
275,
1402,
14,
7383,
8,
1078,
63,
5214,
12,
359,
5165,
467,
1752,
22932,
9,
199,
199,
1361,
480,
18591,
9342,
531,
199,
1361,
8,
2834,
63,
7107,
9,
199,
199,
1361,
480,
13816,
9342,
531,
199,
1361,
8,
1078,
63,
7107,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
199,
5229,
626,
3560,
83,
3510,
1765,
1709,
641,
4005,
88,
2025,
4789,
14,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
747,
199,
646,
5145,
199,
646,
2680,
465,
980,
199,
646,
13217,
24448,
465,
12326,
199,
646,
900,
199,
504,
13217,
24448,
14,
16924,
846,
492,
2248,
63,
475,
88,
2025,
199,
199,
3,
5972,
367,
3105,
1,
199,
1590,
14,
2355,
14,
5176,
8,
4288,
9,
199,
199,
3,
7190,
4005,
88,
2025,
4789,
199,
78,
63,
3179,
275,
6619,
199,
475,
88,
2025,
63,
5054,
12,
370,
88,
2025,
63,
12281,
12,
1752,
22932,
275,
2248,
63,
475,
88,
2025,
342,
199,
2834,
63,
5214,
12,
1686,
63,
5214,
12,
511,
63,
5214,
275,
370,
88,
2025,
63,
12281,
199,
43,
275,
1616,
199,
3,
25971,
1709,
199,
5165,
275,
12326,
14,
6759,
14,
11119,
8,
3833,
14,
6759,
14,
26786,
63,
19129,
63,
3397,
12,
980,
14,
3670,
9,
199,
1515,
22932,
275,
359,
3833,
14,
1515,
14,
3927,
54,
19761,
8,
43,
12,
822,
8,
475,
88,
2025,
63,
5054,
395,
3560,
63,
5214,
1874,
199,
199,
509,
21484,
315,
1752,
22932,
26,
523,
3560,
63,
5214,
275,
21484,
14,
4711,
8,
2834,
63,
5214,
9,
523,
1686,
63,
5214,
275,
21484,
14,
4711,
8,
1078,
63,
5214,
9,
523,
511,
63,
5214,
275,
21484,
14,
4711,
8,
396,
63,
5214,
9,
199,
199,
1238,
275,
12326,
14,
992,
14,
3861,
1659,
3947,
1765,
3927,
54,
8508,
8,
272,
822,
8,
475,
88,
2025,
63,
5054,
395,
1804,
29,
43,
12,
9328,
63,
1866,
29,
16,
14,
4587,
12,
21251,
29,
16,
14,
1717,
12,
3522,
63,
890,
29,
708,
9,
199,
199,
3,
25971,
28161,
1402,
199,
1238,
14,
3269,
8,
2834,
63,
5214,
12,
8526,
63,
7367,
29,
709,
9,
199,
199,
1361,
480,
10006,
85,
1958,
1402,
531,
199,
2834,
63,
7107,
275,
1402,
14,
7383,
8,
2834,
63,
5214,
12,
359,
5165,
467,
1752,
22932,
9,
199,
1078,
63,
7107,
275,
1402,
14,
7383,
8,
1078,
63,
5214,
12,
359,
5165,
467,
1752,
22932,
9,
199,
199,
1361,
480,
18591,
9342,
531,
199,
1361,
8,
2834,
63,
7107,
9,
199,
199,
1361,
480,
13816,
9342,
531,
199,
1361,
8,
1078,
63,
7107,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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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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
] |
endorphinl/horizon | openstack_dashboard/dashboards/project/routers/extensions/routerrules/tables.py | 51 | 2806 | # Copyright 2013, Big Switch 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.
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from openstack_dashboard.dashboards.project.routers.extensions.routerrules\
import rulemanager
from openstack_dashboard import policy
from horizon import tables
LOG = logging.getLogger(__name__)
class AddRouterRule(policy.PolicyTargetMixin, tables.LinkAction):
name = "create"
verbose_name = _("Add Router Rule")
url = "horizon:project:routers:addrouterrule"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("network", "update_router"),)
def get_link_url(self, datum=None):
router_id = self.table.kwargs['router_id']
return reverse(self.url, args=(router_id,))
class RemoveRouterRule(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Router Rule",
u"Delete Router Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Router Rule",
u"Deleted Router Rules",
count
)
failure_url = 'horizon:project:routers:detail'
policy_rules = (("network", "update_router"),)
def delete(self, request, obj_id):
router_id = self.table.kwargs['router_id']
rulemanager.remove_rules(request, [obj_id],
router_id=router_id)
class RouterRulesTable(tables.DataTable):
source = tables.Column("source", verbose_name=_("Source CIDR"))
destination = tables.Column("destination",
verbose_name=_("Destination CIDR"))
action = tables.Column("action", verbose_name=_("Action"))
nexthops = tables.Column("nexthops", verbose_name=_("Next Hops"))
def get_object_display(self, rule):
return "(%(action)s) %(source)s -> %(destination)s" % rule
class Meta(object):
name = "routerrules"
verbose_name = _("Router Rules")
table_actions = (AddRouterRule, RemoveRouterRule)
row_actions = (RemoveRouterRule, )
| apache-2.0 | [
3,
1898,
6171,
12,
221,
13123,
17711,
17138,
12,
3277,
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,
2050,
199,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
199,
504,
1639,
14,
1208,
14,
6893,
492,
26843,
63,
6395,
199,
199,
504,
13869,
63,
9743,
14,
30424,
14,
1715,
14,
17292,
14,
5359,
14,
4995,
4423,
60,
272,
492,
2332,
2609,
199,
504,
13869,
63,
9743,
492,
4592,
199,
199,
504,
21726,
492,
6716,
199,
199,
4947,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
2654,
11691,
5065,
8,
3185,
14,
4845,
4277,
4256,
12,
6716,
14,
3834,
3310,
304,
272,
536,
275,
298,
981,
2,
272,
3376,
63,
354,
275,
3824,
1123,
22708,
11949,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
17292,
26,
525,
4995,
2200,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
26360,
272,
7016,
275,
298,
6666,
2,
272,
4592,
63,
4423,
275,
19110,
1200,
401,
298,
873,
63,
4995,
1288,
9,
339,
347,
664,
63,
1073,
63,
633,
8,
277,
12,
18908,
29,
403,
304,
267,
6197,
63,
344,
275,
291,
14,
1224,
14,
958,
459,
4995,
63,
344,
418,
267,
372,
3837,
8,
277,
14,
633,
12,
1249,
2687,
4995,
63,
344,
4641,
421,
199,
533,
5852,
11691,
5065,
8,
3185,
14,
4845,
4277,
4256,
12,
6716,
14,
5392,
3310,
304,
272,
768,
4639,
272,
347,
1595,
63,
1881,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
5392,
22708,
11949,
401,
288,
399,
2,
5392,
22708,
24259,
401,
288,
2338,
267,
776,
339,
768,
4639,
272,
347,
1595,
63,
18597,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
17735,
22708,
11949,
401,
288,
399,
2,
17735,
22708,
24259,
401,
288,
2338,
267,
776,
339,
5988,
63,
633,
275,
283,
16561,
26,
1715,
26,
17292,
26,
5506,
7,
272,
4592,
63,
4423,
275,
19110,
1200,
401,
298,
873,
63,
4995,
1288,
9,
339,
347,
3145,
8,
277,
12,
1056,
12,
1559,
63,
344,
304,
267,
6197,
63,
344,
275,
291,
14,
1224,
14,
958,
459,
4995,
63,
344,
418,
267,
2332,
2609,
14,
2168,
63,
4423,
8,
1069,
12,
359,
1113,
63,
344,
467,
639,
6197,
63,
344,
29,
4995,
63,
344,
9,
421,
199,
533,
22708,
12920,
3186,
8,
5987,
14,
1451,
3186,
304,
272,
1350,
275,
6716,
14,
4547,
480,
1365,
401,
3376,
63,
354,
9384,
2980,
29215,
2237,
272,
5724,
275,
6716,
14,
4547,
480,
6881,
401,
1816,
3376,
63,
354,
9384,
13151,
29215,
2237,
272,
1595,
275,
6716,
14,
4547,
480,
1287,
401,
3376,
63,
354,
9384,
3310,
2237,
272,
22761,
273,
1483,
275,
6716,
14,
4547,
480,
14743,
273,
1483,
401,
3376,
63,
354,
9384,
5765,
869,
1483,
2237,
339,
347,
664,
63,
785,
63,
2918,
8,
277,
12,
2332,
304,
267,
372,
7340,
2840,
1287,
9,
83,
9,
2818,
1365,
9,
83,
1035,
2818,
6881,
9,
83,
2,
450,
2332,
339,
1021,
6288,
8,
785,
304,
267,
536,
275,
298,
4995,
4423,
2,
267,
3376,
63,
354,
275,
3824,
11691,
24259,
531,
267,
1817,
63,
3723,
275,
334,
1123,
11691,
5065,
12,
5852,
11691,
5065,
9,
267,
1962,
63,
3723,
275,
334,
5587,
11691,
5065,
12,
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
] | [
1898,
6171,
12,
221,
13123,
17711,
17138,
12,
3277,
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,
2050,
199,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
199,
504,
1639,
14,
1208,
14,
6893,
492,
26843,
63,
6395,
199,
199,
504,
13869,
63,
9743,
14,
30424,
14,
1715,
14,
17292,
14,
5359,
14,
4995,
4423,
60,
272,
492,
2332,
2609,
199,
504,
13869,
63,
9743,
492,
4592,
199,
199,
504,
21726,
492,
6716,
199,
199,
4947,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
2654,
11691,
5065,
8,
3185,
14,
4845,
4277,
4256,
12,
6716,
14,
3834,
3310,
304,
272,
536,
275,
298,
981,
2,
272,
3376,
63,
354,
275,
3824,
1123,
22708,
11949,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
17292,
26,
525,
4995,
2200,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
26360,
272,
7016,
275,
298,
6666,
2,
272,
4592,
63,
4423,
275,
19110,
1200,
401,
298,
873,
63,
4995,
1288,
9,
339,
347,
664,
63,
1073,
63,
633,
8,
277,
12,
18908,
29,
403,
304,
267,
6197,
63,
344,
275,
291,
14,
1224,
14,
958,
459,
4995,
63,
344,
418,
267,
372,
3837,
8,
277,
14,
633,
12,
1249,
2687,
4995,
63,
344,
4641,
421,
199,
533,
5852,
11691,
5065,
8,
3185,
14,
4845,
4277,
4256,
12,
6716,
14,
5392,
3310,
304,
272,
768,
4639,
272,
347,
1595,
63,
1881,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
5392,
22708,
11949,
401,
288,
399,
2,
5392,
22708,
24259,
401,
288,
2338,
267,
776,
339,
768,
4639,
272,
347,
1595,
63,
18597,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
17735,
22708,
11949,
401,
288,
399,
2,
17735,
22708,
24259,
401,
288,
2338,
267,
776,
339,
5988,
63,
633,
275,
283,
16561,
26,
1715,
26,
17292,
26,
5506,
7,
272,
4592,
63,
4423,
275,
19110,
1200,
401,
298,
873,
63,
4995,
1288,
9,
339,
347,
3145,
8,
277,
12,
1056,
12,
1559,
63,
344,
304,
267,
6197,
63,
344,
275,
291,
14,
1224,
14,
958,
459,
4995,
63,
344,
418,
267,
2332,
2609,
14,
2168,
63,
4423,
8,
1069,
12,
359,
1113,
63,
344,
467,
639,
6197,
63,
344,
29,
4995,
63,
344,
9,
421,
199,
533,
22708,
12920,
3186,
8,
5987,
14,
1451,
3186,
304,
272,
1350,
275,
6716,
14,
4547,
480,
1365,
401,
3376,
63,
354,
9384,
2980,
29215,
2237,
272,
5724,
275,
6716,
14,
4547,
480,
6881,
401,
1816,
3376,
63,
354,
9384,
13151,
29215,
2237,
272,
1595,
275,
6716,
14,
4547,
480,
1287,
401,
3376,
63,
354,
9384,
3310,
2237,
272,
22761,
273,
1483,
275,
6716,
14,
4547,
480,
14743,
273,
1483,
401,
3376,
63,
354,
9384,
5765,
869,
1483,
2237,
339,
347,
664,
63,
785,
63,
2918,
8,
277,
12,
2332,
304,
267,
372,
7340,
2840,
1287,
9,
83,
9,
2818,
1365,
9,
83,
1035,
2818,
6881,
9,
83,
2,
450,
2332,
339,
1021,
6288,
8,
785,
304,
267,
536,
275,
298,
4995,
4423,
2,
267,
3376,
63,
354,
275,
3824,
11691,
24259,
531,
267,
1817,
63,
3723,
275,
334,
1123,
11691,
5065,
12,
5852,
11691,
5065,
9,
267,
1962,
63,
3723,
275,
334,
5587,
11691,
5065,
12,
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,
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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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
wehkamp/ansible-modules-core | cloud/amazon/ec2_elb_lb.py | 7 | 33856 | #!/usr/bin/python
# 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: ec2_elb_lb
description:
- Returns information about the load balancer.
- Will be marked changed when called only if state is changed.
short_description: Creates or destroys Amazon ELB.
version_added: "1.5"
author: Jim Dalton
options:
state:
description:
- Create or destroy the ELB
required: true
name:
description:
- The name of the ELB
required: true
listeners:
description:
- List of ports/protocols for this ELB to listen on (see example)
required: false
purge_listeners:
description:
- Purge existing listeners on ELB that are not found in listeners
required: false
default: true
zones:
description:
- List of availability zones to enable on this ELB
required: false
purge_zones:
description:
- Purge existing availability zones on ELB that are not found in zones
required: false
default: false
security_group_ids:
description:
- A list of security groups to apply to the elb
require: false
default: None
version_added: "1.6"
health_check:
description:
- An associative array of health check configuration settings (see example)
require: false
default: None
region:
description:
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used.
required: false
aliases: ['aws_region', 'ec2_region']
subnets:
description:
- A list of VPC subnets to use when creating ELB. Zones should be empty if using this.
required: false
default: None
aliases: []
version_added: "1.7"
purge_subnets:
description:
- Purge existing subnet on ELB that are not found in subnets
required: false
default: false
version_added: "1.7"
scheme:
description:
- The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'.
required: false
default: 'internet-facing'
version_added: "1.7"
validate_certs:
description:
- When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0.
required: false
default: "yes"
choices: ["yes", "no"]
aliases: []
version_added: "1.5"
connection_draining_timeout:
description:
- Wait a specified timeout allowing connections to drain before terminating an instance
required: false
aliases: []
version_added: "1.8"
cross_az_load_balancing:
description:
- Distribute load across all configured Availability Zones
required: false
default: "no"
choices: ["yes", "no"]
aliases: []
version_added: "1.8"
stickiness:
description:
- An associative array of stickness policy settings. Policy will be applied to all listeners ( see example )
required: false
version_added: "2.0"
extends_documentation_fragment: aws
"""
EXAMPLES = """
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set.
# Basic provisioning example (non-VPC)
- local_action:
module: ec2_elb_lb
name: "test-please-delete"
state: present
zones:
- us-east-1a
- us-east-1d
listeners:
- protocol: http # options are http, https, ssl, tcp
load_balancer_port: 80
instance_port: 80
- protocol: https
load_balancer_port: 443
instance_protocol: http # optional, defaults to value of protocol setting
instance_port: 80
# ssl certificate required for https or ssl
ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert"
# Internal ELB example
- local_action:
module: ec2_elb_lb
name: "test-vpc"
scheme: internal
state: present
subnets:
- subnet-abcd1234
- subnet-1a2b3c4d
listeners:
- protocol: http # options are http, https, ssl, tcp
load_balancer_port: 80
instance_port: 80
# Configure a health check
- local_action:
module: ec2_elb_lb
name: "test-please-delete"
state: present
zones:
- us-east-1d
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
health_check:
ping_protocol: http # options are http, https, ssl, tcp
ping_port: 80
ping_path: "/index.html" # not required for tcp or ssl
response_timeout: 5 # seconds
interval: 30 # seconds
unhealthy_threshold: 2
healthy_threshold: 10
# Ensure ELB is gone
- local_action:
module: ec2_elb_lb
name: "test-please-delete"
state: absent
# Normally, this module will purge any listeners that exist on the ELB
# but aren't specified in the listeners parameter. If purge_listeners is
# false it leaves them alone
- local_action:
module: ec2_elb_lb
name: "test-please-delete"
state: present
zones:
- us-east-1a
- us-east-1d
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
purge_listeners: no
# Normally, this module will leave availability zones that are enabled
# on the ELB alone. If purge_zones is true, then any extraneous zones
# will be removed
- local_action:
module: ec2_elb_lb
name: "test-please-delete"
state: present
zones:
- us-east-1a
- us-east-1d
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
purge_zones: yes
# Creates a ELB and assigns a list of subnets to it.
- local_action:
module: ec2_elb_lb
state: present
name: 'New ELB'
security_group_ids: 'sg-123456, sg-67890'
region: us-west-2
subnets: 'subnet-123456,subnet-67890'
purge_subnets: yes
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
# Create an ELB with connection draining and cross availability
# zone load balancing
- local_action:
module: ec2_elb_lb
name: "New ELB"
state: present
connection_draining_timeout: 60
cross_az_load_balancing: "yes"
region: us-east-1
zones:
- us-east-1a
- us-east-1d
listeners:
- protocols: http
- load_balancer_port: 80
- instance_port: 80
# Create an ELB with load balanacer stickiness enabled
- local_action:
module: ec2_elb_lb
name: "New ELB"
state: present
region: us-east-1
zones:
- us-east-1a
- us-east-1d
listeners:
- protocols: http
- load_balancer_port: 80
- instance_port: 80
stickiness:
type: loadbalancer
enabled: yes
expiration: 300
# Create an ELB with application stickiness enabled
- local_action:
module: ec2_elb_lb
name: "New ELB"
state: present
region: us-east-1
zones:
- us-east-1a
- us-east-1d
listeners:
- protocols: http
- load_balancer_port: 80
- instance_port: 80
stickiness:
type: application
enabled: yes
cookie: SESSIONID
"""
try:
import boto
import boto.ec2.elb
import boto.ec2.elb.attributes
from boto.ec2.elb.healthcheck import HealthCheck
from boto.regioninfo import RegionInfo
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
class ElbManager(object):
"""Handles ELB creation and destruction"""
def __init__(self, module, name, listeners=None, purge_listeners=None,
zones=None, purge_zones=None, security_group_ids=None,
health_check=None, subnets=None, purge_subnets=None,
scheme="internet-facing", connection_draining_timeout=None,
cross_az_load_balancing=None,
stickiness=None, region=None, **aws_connect_params):
self.module = module
self.name = name
self.listeners = listeners
self.purge_listeners = purge_listeners
self.zones = zones
self.purge_zones = purge_zones
self.security_group_ids = security_group_ids
self.health_check = health_check
self.subnets = subnets
self.purge_subnets = purge_subnets
self.scheme = scheme
self.connection_draining_timeout = connection_draining_timeout
self.cross_az_load_balancing = cross_az_load_balancing
self.stickiness = stickiness
self.aws_connect_params = aws_connect_params
self.region = region
self.changed = False
self.status = 'gone'
self.elb_conn = self._get_elb_connection()
self.elb = self._get_elb()
def ensure_ok(self):
"""Create the ELB"""
if not self.elb:
# Zones and listeners will be added at creation
self._create_elb()
else:
self._set_zones()
self._set_security_groups()
self._set_elb_listeners()
self._set_subnets()
self._set_health_check()
# boto has introduced support for some ELB attributes in
# different versions, so we check first before trying to
# set them to avoid errors
if self._check_attribute_support('connection_draining'):
self._set_connection_draining_timeout()
if self._check_attribute_support('cross_zone_load_balancing'):
self._set_cross_az_load_balancing()
# add sitcky options
self.select_stickiness_policy()
def ensure_gone(self):
"""Destroy the ELB"""
if self.elb:
self._delete_elb()
def get_info(self):
try:
check_elb = self.elb_conn.get_all_load_balancers(self.name)[0]
except:
check_elb = None
if not check_elb:
info = {
'name': self.name,
'status': self.status
}
else:
try:
lb_cookie_policy = check_elb.policies.lb_cookie_stickiness_policies[0].__dict__['policy_name']
except:
lb_cookie_policy = None
try:
app_cookie_policy = check_elb.policies.app_cookie_stickiness_policies[0].__dict__['policy_name']
except:
app_cookie_policy = None
info = {
'name': check_elb.name,
'dns_name': check_elb.dns_name,
'zones': check_elb.availability_zones,
'security_group_ids': check_elb.security_groups,
'status': self.status,
'subnets': self.subnets,
'scheme': check_elb.scheme,
'hosted_zone_name': check_elb.canonical_hosted_zone_name,
'hosted_zone_id': check_elb.canonical_hosted_zone_name_id,
'lb_cookie_policy': lb_cookie_policy,
'app_cookie_policy': app_cookie_policy
}
if check_elb.health_check:
info['health_check'] = {
'target': check_elb.health_check.target,
'interval': check_elb.health_check.interval,
'timeout': check_elb.health_check.timeout,
'healthy_threshold': check_elb.health_check.healthy_threshold,
'unhealthy_threshold': check_elb.health_check.unhealthy_threshold,
}
if check_elb.listeners:
info['listeners'] = [self._api_listener_as_tuple(l)
for l in check_elb.listeners]
elif self.status == 'created':
# When creating a new ELB, listeners don't show in the
# immediately returned result, so just include the
# ones that were added
info['listeners'] = [self._listener_as_tuple(l)
for l in self.listeners]
else:
info['listeners'] = []
if self._check_attribute_support('connection_draining'):
info['connection_draining_timeout'] = self.elb_conn.get_lb_attribute(self.name, 'ConnectionDraining').timeout
if self._check_attribute_support('cross_zone_load_balancing'):
is_cross_az_lb_enabled = self.elb_conn.get_lb_attribute(self.name, 'CrossZoneLoadBalancing')
if is_cross_az_lb_enabled:
info['cross_az_load_balancing'] = 'yes'
else:
info['cross_az_load_balancing'] = 'no'
# return stickiness info?
return info
def _get_elb(self):
elbs = self.elb_conn.get_all_load_balancers()
for elb in elbs:
if self.name == elb.name:
self.status = 'ok'
return elb
def _get_elb_connection(self):
try:
return connect_to_aws(boto.ec2.elb, self.region,
**self.aws_connect_params)
except (boto.exception.NoAuthHandlerFound, StandardError), e:
self.module.fail_json(msg=str(e))
def _delete_elb(self):
# True if succeeds, exception raised if not
result = self.elb_conn.delete_load_balancer(name=self.name)
if result:
self.changed = True
self.status = 'deleted'
def _create_elb(self):
listeners = [self._listener_as_tuple(l) for l in self.listeners]
self.elb = self.elb_conn.create_load_balancer(name=self.name,
zones=self.zones,
security_groups=self.security_group_ids,
complex_listeners=listeners,
subnets=self.subnets,
scheme=self.scheme)
if self.elb:
self.changed = True
self.status = 'created'
def _create_elb_listeners(self, listeners):
"""Takes a list of listener tuples and creates them"""
# True if succeeds, exception raised if not
self.changed = self.elb_conn.create_load_balancer_listeners(self.name,
complex_listeners=listeners)
def _delete_elb_listeners(self, listeners):
"""Takes a list of listener tuples and deletes them from the elb"""
ports = [l[0] for l in listeners]
# True if succeeds, exception raised if not
self.changed = self.elb_conn.delete_load_balancer_listeners(self.name,
ports)
def _set_elb_listeners(self):
"""
Creates listeners specified by self.listeners; overwrites existing
listeners on these ports; removes extraneous listeners
"""
listeners_to_add = []
listeners_to_remove = []
listeners_to_keep = []
# Check for any listeners we need to create or overwrite
for listener in self.listeners:
listener_as_tuple = self._listener_as_tuple(listener)
# First we loop through existing listeners to see if one is
# already specified for this port
existing_listener_found = None
for existing_listener in self.elb.listeners:
# Since ELB allows only one listener on each incoming port, a
# single match on the incoming port is all we're looking for
if existing_listener[0] == listener['load_balancer_port']:
existing_listener_found = self._api_listener_as_tuple(existing_listener)
break
if existing_listener_found:
# Does it match exactly?
if listener_as_tuple != existing_listener_found:
# The ports are the same but something else is different,
# so we'll remove the existing one and add the new one
listeners_to_remove.append(existing_listener_found)
listeners_to_add.append(listener_as_tuple)
else:
# We already have this listener, so we're going to keep it
listeners_to_keep.append(existing_listener_found)
else:
# We didn't find an existing listener, so just add the new one
listeners_to_add.append(listener_as_tuple)
# Check for any extraneous listeners we need to remove, if desired
if self.purge_listeners:
for existing_listener in self.elb.listeners:
existing_listener_tuple = self._api_listener_as_tuple(existing_listener)
if existing_listener_tuple in listeners_to_remove:
# Already queued for removal
continue
if existing_listener_tuple in listeners_to_keep:
# Keep this one around
continue
# Since we're not already removing it and we don't need to keep
# it, let's get rid of it
listeners_to_remove.append(existing_listener_tuple)
if listeners_to_remove:
self._delete_elb_listeners(listeners_to_remove)
if listeners_to_add:
self._create_elb_listeners(listeners_to_add)
def _api_listener_as_tuple(self, listener):
"""Adds ssl_certificate_id to ELB API tuple if present"""
base_tuple = listener.get_complex_tuple()
if listener.ssl_certificate_id and len(base_tuple) < 5:
return base_tuple + (listener.ssl_certificate_id,)
return base_tuple
def _listener_as_tuple(self, listener):
"""Formats listener as a 4- or 5-tuples, in the order specified by the
ELB API"""
# N.B. string manipulations on protocols below (str(), upper()) is to
# ensure format matches output from ELB API
listener_list = [
listener['load_balancer_port'],
listener['instance_port'],
str(listener['protocol'].upper()),
]
# Instance protocol is not required by ELB API; it defaults to match
# load balancer protocol. We'll mimic that behavior here
if 'instance_protocol' in listener:
listener_list.append(str(listener['instance_protocol'].upper()))
else:
listener_list.append(str(listener['protocol'].upper()))
if 'ssl_certificate_id' in listener:
listener_list.append(str(listener['ssl_certificate_id']))
return tuple(listener_list)
def _enable_zones(self, zones):
try:
self.elb.enable_zones(zones)
except boto.exception.BotoServerError, e:
if "Invalid Availability Zone" in e.error_message:
self.module.fail_json(msg=e.error_message)
else:
self.module.fail_json(msg="an unknown server error occurred, please try again later")
self.changed = True
def _disable_zones(self, zones):
try:
self.elb.disable_zones(zones)
except boto.exception.BotoServerError, e:
if "Invalid Availability Zone" in e.error_message:
self.module.fail_json(msg=e.error_message)
else:
self.module.fail_json(msg="an unknown server error occurred, please try again later")
self.changed = True
def _attach_subnets(self, subnets):
self.elb_conn.attach_lb_to_subnets(self.name, subnets)
self.changed = True
def _detach_subnets(self, subnets):
self.elb_conn.detach_lb_from_subnets(self.name, subnets)
self.changed = True
def _set_subnets(self):
"""Determine which subnets need to be attached or detached on the ELB"""
if self.subnets:
if self.purge_subnets:
subnets_to_detach = list(set(self.elb.subnets) - set(self.subnets))
subnets_to_attach = list(set(self.subnets) - set(self.elb.subnets))
else:
subnets_to_detach = None
subnets_to_attach = list(set(self.subnets) - set(self.elb.subnets))
if subnets_to_attach:
self._attach_subnets(subnets_to_attach)
if subnets_to_detach:
self._detach_subnets(subnets_to_detach)
def _set_zones(self):
"""Determine which zones need to be enabled or disabled on the ELB"""
if self.zones:
if self.purge_zones:
zones_to_disable = list(set(self.elb.availability_zones) -
set(self.zones))
zones_to_enable = list(set(self.zones) -
set(self.elb.availability_zones))
else:
zones_to_disable = None
zones_to_enable = list(set(self.zones) -
set(self.elb.availability_zones))
if zones_to_enable:
self._enable_zones(zones_to_enable)
# N.B. This must come second, in case it would have removed all zones
if zones_to_disable:
self._disable_zones(zones_to_disable)
def _set_security_groups(self):
if self.security_group_ids != None and set(self.elb.security_groups) != set(self.security_group_ids):
self.elb_conn.apply_security_groups_to_lb(self.name, self.security_group_ids)
self.Changed = True
def _set_health_check(self):
"""Set health check values on ELB as needed"""
if self.health_check:
# This just makes it easier to compare each of the attributes
# and look for changes. Keys are attributes of the current
# health_check; values are desired values of new health_check
health_check_config = {
"target": self._get_health_check_target(),
"timeout": self.health_check['response_timeout'],
"interval": self.health_check['interval'],
"unhealthy_threshold": self.health_check['unhealthy_threshold'],
"healthy_threshold": self.health_check['healthy_threshold'],
}
update_health_check = False
# The health_check attribute is *not* set on newly created
# ELBs! So we have to create our own.
if not self.elb.health_check:
self.elb.health_check = HealthCheck()
for attr, desired_value in health_check_config.iteritems():
if getattr(self.elb.health_check, attr) != desired_value:
setattr(self.elb.health_check, attr, desired_value)
update_health_check = True
if update_health_check:
self.elb.configure_health_check(self.elb.health_check)
self.changed = True
def _check_attribute_support(self, attr):
return hasattr(boto.ec2.elb.attributes.LbAttributes(), attr)
def _set_cross_az_load_balancing(self):
attributes = self.elb.get_attributes()
if self.cross_az_load_balancing:
attributes.cross_zone_load_balancing.enabled = True
else:
attributes.cross_zone_load_balancing.enabled = False
self.elb_conn.modify_lb_attribute(self.name, 'CrossZoneLoadBalancing',
attributes.cross_zone_load_balancing.enabled)
def _set_connection_draining_timeout(self):
attributes = self.elb.get_attributes()
if self.connection_draining_timeout is not None:
attributes.connection_draining.enabled = True
attributes.connection_draining.timeout = self.connection_draining_timeout
self.elb_conn.modify_lb_attribute(self.name, 'ConnectionDraining', attributes.connection_draining)
else:
attributes.connection_draining.enabled = False
self.elb_conn.modify_lb_attribute(self.name, 'ConnectionDraining', attributes.connection_draining)
def _policy_name(self, policy_type):
return __file__.split('/')[-1].replace('_', '-') + '-' + policy_type
def _create_policy(self, policy_param, policy_meth, policy):
getattr(self.elb_conn, policy_meth )(policy_param, self.elb.name, policy)
def _delete_policy(self, elb_name, policy):
self.elb_conn.delete_lb_policy(elb_name, policy)
def _update_policy(self, policy_param, policy_meth, policy_attr, policy):
self._delete_policy(self.elb.name, policy)
self._create_policy(policy_param, policy_meth, policy)
def _set_listener_policy(self, listeners_dict, policy=[]):
for listener_port in listeners_dict:
if listeners_dict[listener_port].startswith('HTTP'):
self.elb_conn.set_lb_policies_of_listener(self.elb.name, listener_port, policy)
def _set_stickiness_policy(self, elb_info, listeners_dict, policy, **policy_attrs):
for p in getattr(elb_info.policies, policy_attrs['attr']):
if str(p.__dict__['policy_name']) == str(policy[0]):
if str(p.__dict__[policy_attrs['dict_key']]) != str(policy_attrs['param_value']):
self._set_listener_policy(listeners_dict)
self._update_policy(policy_attrs['param_value'], policy_attrs['method'], policy_attrs['attr'], policy[0])
self.changed = True
break
else:
self._create_policy(policy_attrs['param_value'], policy_attrs['method'], policy[0])
self.changed = True
self._set_listener_policy(listeners_dict, policy)
def select_stickiness_policy(self):
if self.stickiness:
if 'cookie' in self.stickiness and 'expiration' in self.stickiness:
self.module.fail_json(msg='\'cookie\' and \'expiration\' can not be set at the same time')
elb_info = self.elb_conn.get_all_load_balancers(self.elb.name)[0]
d = {}
for listener in elb_info.listeners:
d[listener[0]] = listener[2]
listeners_dict = d
if self.stickiness['type'] == 'loadbalancer':
policy = []
policy_type = 'LBCookieStickinessPolicyType'
if self.stickiness['enabled'] == True:
if 'expiration' not in self.stickiness:
self.module.fail_json(msg='expiration must be set when type is loadbalancer')
policy_attrs = {
'type': policy_type,
'attr': 'lb_cookie_stickiness_policies',
'method': 'create_lb_cookie_stickiness_policy',
'dict_key': 'cookie_expiration_period',
'param_value': self.stickiness['expiration']
}
policy.append(self._policy_name(policy_attrs['type']))
self._set_stickiness_policy(elb_info, listeners_dict, policy, **policy_attrs)
elif self.stickiness['enabled'] == False:
if len(elb_info.policies.lb_cookie_stickiness_policies):
if elb_info.policies.lb_cookie_stickiness_policies[0].policy_name == self._policy_name(policy_type):
self.changed = True
else:
self.changed = False
self._set_listener_policy(listeners_dict)
self._delete_policy(self.elb.name, self._policy_name(policy_type))
elif self.stickiness['type'] == 'application':
policy = []
policy_type = 'AppCookieStickinessPolicyType'
if self.stickiness['enabled'] == True:
if 'cookie' not in self.stickiness:
self.module.fail_json(msg='cookie must be set when type is application')
policy_attrs = {
'type': policy_type,
'attr': 'app_cookie_stickiness_policies',
'method': 'create_app_cookie_stickiness_policy',
'dict_key': 'cookie_name',
'param_value': self.stickiness['cookie']
}
policy.append(self._policy_name(policy_attrs['type']))
self._set_stickiness_policy(elb_info, listeners_dict, policy, **policy_attrs)
elif self.stickiness['enabled'] == False:
if len(elb_info.policies.app_cookie_stickiness_policies):
if elb_info.policies.app_cookie_stickiness_policies[0].policy_name == self._policy_name(policy_type):
self.changed = True
self._set_listener_policy(listeners_dict)
self._delete_policy(self.elb.name, self._policy_name(policy_type))
else:
self._set_listener_policy(listeners_dict)
def _get_health_check_target(self):
"""Compose target string from healthcheck parameters"""
protocol = self.health_check['ping_protocol'].upper()
path = ""
if protocol in ['HTTP', 'HTTPS'] and 'ping_path' in self.health_check:
path = self.health_check['ping_path']
return "%s:%s%s" % (protocol, self.health_check['ping_port'], path)
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
state={'required': True, 'choices': ['present', 'absent']},
name={'required': True},
listeners={'default': None, 'required': False, 'type': 'list'},
purge_listeners={'default': True, 'required': False, 'type': 'bool'},
zones={'default': None, 'required': False, 'type': 'list'},
purge_zones={'default': False, 'required': False, 'type': 'bool'},
security_group_ids={'default': None, 'required': False, 'type': 'list'},
health_check={'default': None, 'required': False, 'type': 'dict'},
subnets={'default': None, 'required': False, 'type': 'list'},
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
scheme={'default': 'internet-facing', 'required': False},
connection_draining_timeout={'default': None, 'required': False},
cross_az_load_balancing={'default': None, 'required': False},
stickiness={'default': None, 'required': False, 'type': 'dict'}
)
)
module = AnsibleModule(
argument_spec=argument_spec,
)
if not HAS_BOTO:
module.fail_json(msg='boto required for this module')
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
if not region:
module.fail_json(msg="Region must be specified as a parameter, in EC2_REGION or AWS_REGION environment variables or in boto configuration file")
name = module.params['name']
state = module.params['state']
listeners = module.params['listeners']
purge_listeners = module.params['purge_listeners']
zones = module.params['zones']
purge_zones = module.params['purge_zones']
security_group_ids = module.params['security_group_ids']
health_check = module.params['health_check']
subnets = module.params['subnets']
purge_subnets = module.params['purge_subnets']
scheme = module.params['scheme']
connection_draining_timeout = module.params['connection_draining_timeout']
cross_az_load_balancing = module.params['cross_az_load_balancing']
stickiness = module.params['stickiness']
if state == 'present' and not listeners:
module.fail_json(msg="At least one port is required for ELB creation")
if state == 'present' and not (zones or subnets):
module.fail_json(msg="At least one availability zone or subnet is required for ELB creation")
elb_man = ElbManager(module, name, listeners, purge_listeners, zones,
purge_zones, security_group_ids, health_check,
subnets, purge_subnets, scheme,
connection_draining_timeout, cross_az_load_balancing,
stickiness,
region=region, **aws_connect_params)
# check for unsupported attributes for this version of boto
if cross_az_load_balancing and not elb_man._check_attribute_support('cross_zone_load_balancing'):
module.fail_json(msg="You must install boto >= 2.18.0 to use the cross_az_load_balancing attribute")
if connection_draining_timeout and not elb_man._check_attribute_support('connection_draining'):
module.fail_json(msg="You must install boto >= 2.28.0 to use the connection_draining_timeout attribute")
if state == 'present':
elb_man.ensure_ok()
elif state == 'absent':
elb_man.ensure_gone()
ansible_facts = {'ec2_elb': 'info'}
ec2_facts_result = dict(changed=elb_man.changed,
elb=elb_man.get_info(),
ansible_facts=ansible_facts)
module.exit_json(**ec2_facts_result)
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import *
main()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1548,
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,
408,
199,
2595,
199,
578,
26,
7062,
18,
63,
17778,
63,
6374,
199,
1802,
26,
523,
446,
1803,
2556,
3595,
314,
2248,
17005,
14,
523,
446,
12823,
506,
11584,
2896,
1380,
2797,
1454,
340,
1174,
365,
2896,
14,
199,
3612,
63,
1802,
26,
10560,
503,
2053,
293,
588,
14347,
662,
11568,
14,
199,
1023,
63,
3270,
26,
298,
17,
14,
21,
2,
199,
2502,
26,
1603,
1017,
577,
279,
1860,
199,
1419,
26,
523,
1174,
26,
272,
1369,
26,
489,
446,
2790,
503,
11972,
314,
662,
11568,
272,
1415,
26,
2549,
523,
536,
26,
272,
1369,
26,
489,
446,
710,
536,
402,
314,
662,
11568,
272,
1415,
26,
2549,
523,
19946,
26,
272,
1369,
26,
489,
446,
3820,
402,
8873,
15,
16541,
367,
642,
662,
11568,
370,
6938,
641,
334,
3239,
2893,
9,
272,
1415,
26,
3055,
523,
18503,
63,
17301,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
19946,
641,
662,
11568,
626,
787,
440,
1911,
315,
19946,
272,
1415,
26,
3055,
272,
849,
26,
2549,
523,
18666,
26,
272,
1369,
26,
489,
446,
3820,
402,
14962,
18666,
370,
4756,
641,
642,
662,
11568,
272,
1415,
26,
3055,
523,
18503,
63,
13325,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
14962,
18666,
641,
662,
11568,
626,
787,
440,
1911,
315,
18666,
272,
1415,
26,
3055,
272,
849,
26,
3055,
523,
6391,
63,
923,
63,
1580,
26,
272,
1369,
26,
489,
446,
437,
769,
402,
6391,
4652,
370,
4838,
370,
314,
27770,
272,
4409,
26,
3055,
272,
849,
26,
488,
272,
1015,
63,
3270,
26,
298,
17,
14,
22,
2,
523,
13822,
63,
1074,
26,
272,
1369,
26,
489,
446,
1626,
4035,
1905,
1625,
402,
13822,
1104,
2897,
2202,
334,
3239,
2893,
9,
272,
4409,
26,
3055,
272,
849,
26,
488,
523,
4897,
26,
272,
1369,
26,
489,
446,
710,
10168,
4897,
370,
675,
14,
982,
440,
2013,
2066,
314,
574,
402,
314,
15352,
18,
63,
23030,
3734,
1750,
12,
340,
1263,
12,
365,
1202,
14,
272,
1415,
26,
3055,
272,
5481,
26,
788,
7231,
63,
4551,
297,
283,
825,
18,
63,
4551,
418,
523,
18709,
26,
272,
1369,
26,
489,
446,
437,
769,
402,
19209,
18709,
370,
675,
1380,
6425,
662,
11568,
14,
3107,
4548,
1077,
506,
2701,
340,
1808,
642,
14,
5591,
1415,
26,
3055,
272,
849,
26,
488,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
18503,
63,
14967,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
6303,
641,
662,
11568,
626,
787,
440,
1911,
315,
18709,
272,
1415,
26,
3055,
272,
849,
26,
3055,
23855,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
5687,
26,
272,
1369,
26,
489,
446,
710,
5687,
370,
675,
1380,
6425,
314,
662,
11568,
14,
2104,
282,
5726,
19209,
13,
6604,
662,
11568,
675,
283,
4672,
1370,
272,
1415,
26,
3055,
272,
849,
26,
283,
4901,
13,
32552,
7,
272,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
4107,
63,
8356,
26,
272,
1369,
26,
489,
446,
3979,
663,
370,
298,
889,
401,
7799,
14512,
911,
440,
506,
16468,
367,
6055,
5459,
2356,
499,
14,
22,
14,
16,
14,
272,
1415,
26,
3055,
272,
849,
26,
298,
5066,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
21,
2,
523,
1950,
63,
30324,
316,
63,
2593,
26,
272,
1369,
26,
489,
446,
13144,
282,
2013,
2653,
17266,
6947,
370,
366,
6322,
2544,
5537,
1958,
376,
1256,
272,
1415,
26,
3055,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
24,
2,
523,
8059,
63,
4651,
63,
912,
63,
30260,
26,
272,
1369,
26,
489,
446,
577,
5414,
266,
2248,
9371,
1006,
7526,
16599,
7615,
3107,
4548,
272,
1415,
26,
3055,
272,
849,
26,
298,
889,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
24,
2,
523,
29404,
9585,
26,
272,
1369,
26,
489,
446,
1626,
4035,
1905,
1625,
402,
410,
17437,
4592,
2202,
14,
18141,
911,
506,
6781,
370,
1006,
19946,
334,
1937,
2893,
776,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
18,
14,
16,
2,
199,
199,
11036,
63,
9970,
63,
7677,
26,
11488,
199,
624,
199,
199,
8918,
275,
408,
199,
3,
3390,
26,
488,
402,
3520,
7251,
663,
11488,
63,
2732,
63,
498,
12,
11488,
63,
4731,
63,
498,
12,
503,
4897,
14,
199,
3,
2779,
365,
10826,
626,
3932,
4877,
3734,
2860,
787,
663,
14,
199,
199,
3,
10082,
20118,
2893,
334,
2865,
13,
54,
4222,
9,
199,
199,
13,
2257,
63,
1287,
26,
272,
859,
26,
7062,
18,
63,
17778,
63,
6374,
272,
536,
26,
298,
396,
13,
27567,
13,
1807,
2,
272,
1174,
26,
3451,
272,
18666,
26,
489,
446,
2739,
13,
14346,
13,
17,
65,
489,
446,
2739,
13,
14346,
13,
17,
68,
272,
19946,
26,
489,
446,
4113,
26,
1455,
327,
1511,
787,
1455,
12,
4178,
12,
6149,
12,
14719,
267,
2248,
63,
11841,
63,
719,
26,
5939,
267,
1256,
63,
719,
26,
5939,
489,
446,
4113,
26,
4178,
267,
2248,
63,
11841,
63
] | [
2647,
15,
1393,
15,
1548,
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,
408,
199,
2595,
199,
578,
26,
7062,
18,
63,
17778,
63,
6374,
199,
1802,
26,
523,
446,
1803,
2556,
3595,
314,
2248,
17005,
14,
523,
446,
12823,
506,
11584,
2896,
1380,
2797,
1454,
340,
1174,
365,
2896,
14,
199,
3612,
63,
1802,
26,
10560,
503,
2053,
293,
588,
14347,
662,
11568,
14,
199,
1023,
63,
3270,
26,
298,
17,
14,
21,
2,
199,
2502,
26,
1603,
1017,
577,
279,
1860,
199,
1419,
26,
523,
1174,
26,
272,
1369,
26,
489,
446,
2790,
503,
11972,
314,
662,
11568,
272,
1415,
26,
2549,
523,
536,
26,
272,
1369,
26,
489,
446,
710,
536,
402,
314,
662,
11568,
272,
1415,
26,
2549,
523,
19946,
26,
272,
1369,
26,
489,
446,
3820,
402,
8873,
15,
16541,
367,
642,
662,
11568,
370,
6938,
641,
334,
3239,
2893,
9,
272,
1415,
26,
3055,
523,
18503,
63,
17301,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
19946,
641,
662,
11568,
626,
787,
440,
1911,
315,
19946,
272,
1415,
26,
3055,
272,
849,
26,
2549,
523,
18666,
26,
272,
1369,
26,
489,
446,
3820,
402,
14962,
18666,
370,
4756,
641,
642,
662,
11568,
272,
1415,
26,
3055,
523,
18503,
63,
13325,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
14962,
18666,
641,
662,
11568,
626,
787,
440,
1911,
315,
18666,
272,
1415,
26,
3055,
272,
849,
26,
3055,
523,
6391,
63,
923,
63,
1580,
26,
272,
1369,
26,
489,
446,
437,
769,
402,
6391,
4652,
370,
4838,
370,
314,
27770,
272,
4409,
26,
3055,
272,
849,
26,
488,
272,
1015,
63,
3270,
26,
298,
17,
14,
22,
2,
523,
13822,
63,
1074,
26,
272,
1369,
26,
489,
446,
1626,
4035,
1905,
1625,
402,
13822,
1104,
2897,
2202,
334,
3239,
2893,
9,
272,
4409,
26,
3055,
272,
849,
26,
488,
523,
4897,
26,
272,
1369,
26,
489,
446,
710,
10168,
4897,
370,
675,
14,
982,
440,
2013,
2066,
314,
574,
402,
314,
15352,
18,
63,
23030,
3734,
1750,
12,
340,
1263,
12,
365,
1202,
14,
272,
1415,
26,
3055,
272,
5481,
26,
788,
7231,
63,
4551,
297,
283,
825,
18,
63,
4551,
418,
523,
18709,
26,
272,
1369,
26,
489,
446,
437,
769,
402,
19209,
18709,
370,
675,
1380,
6425,
662,
11568,
14,
3107,
4548,
1077,
506,
2701,
340,
1808,
642,
14,
5591,
1415,
26,
3055,
272,
849,
26,
488,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
18503,
63,
14967,
26,
272,
1369,
26,
489,
446,
23177,
303,
3411,
6303,
641,
662,
11568,
626,
787,
440,
1911,
315,
18709,
272,
1415,
26,
3055,
272,
849,
26,
3055,
23855,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
5687,
26,
272,
1369,
26,
489,
446,
710,
5687,
370,
675,
1380,
6425,
314,
662,
11568,
14,
2104,
282,
5726,
19209,
13,
6604,
662,
11568,
675,
283,
4672,
1370,
272,
1415,
26,
3055,
272,
849,
26,
283,
4901,
13,
32552,
7,
272,
1015,
63,
3270,
26,
298,
17,
14,
23,
2,
523,
4107,
63,
8356,
26,
272,
1369,
26,
489,
446,
3979,
663,
370,
298,
889,
401,
7799,
14512,
911,
440,
506,
16468,
367,
6055,
5459,
2356,
499,
14,
22,
14,
16,
14,
272,
1415,
26,
3055,
272,
849,
26,
298,
5066,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
21,
2,
523,
1950,
63,
30324,
316,
63,
2593,
26,
272,
1369,
26,
489,
446,
13144,
282,
2013,
2653,
17266,
6947,
370,
366,
6322,
2544,
5537,
1958,
376,
1256,
272,
1415,
26,
3055,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
24,
2,
523,
8059,
63,
4651,
63,
912,
63,
30260,
26,
272,
1369,
26,
489,
446,
577,
5414,
266,
2248,
9371,
1006,
7526,
16599,
7615,
3107,
4548,
272,
1415,
26,
3055,
272,
849,
26,
298,
889,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
272,
5481,
26,
942,
272,
1015,
63,
3270,
26,
298,
17,
14,
24,
2,
523,
29404,
9585,
26,
272,
1369,
26,
489,
446,
1626,
4035,
1905,
1625,
402,
410,
17437,
4592,
2202,
14,
18141,
911,
506,
6781,
370,
1006,
19946,
334,
1937,
2893,
776,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
18,
14,
16,
2,
199,
199,
11036,
63,
9970,
63,
7677,
26,
11488,
199,
624,
199,
199,
8918,
275,
408,
199,
3,
3390,
26,
488,
402,
3520,
7251,
663,
11488,
63,
2732,
63,
498,
12,
11488,
63,
4731,
63,
498,
12,
503,
4897,
14,
199,
3,
2779,
365,
10826,
626,
3932,
4877,
3734,
2860,
787,
663,
14,
199,
199,
3,
10082,
20118,
2893,
334,
2865,
13,
54,
4222,
9,
199,
199,
13,
2257,
63,
1287,
26,
272,
859,
26,
7062,
18,
63,
17778,
63,
6374,
272,
536,
26,
298,
396,
13,
27567,
13,
1807,
2,
272,
1174,
26,
3451,
272,
18666,
26,
489,
446,
2739,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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
] |
arista-eosplus/pyeapi | test/system/test_api_ospf.py | 1 | 9101 | #
# Copyright (c) 2016, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of Arista Networks nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../lib'))
from random import randint
from systestlib import DutSystemTest
def clear_ospf_config(dut, pid=None):
if pid is None:
try:
pid = int(dut.get_config(params="section ospf")[0].split()[2])
dut.config(['no router ospf %d' % pid])
except IndexError:
'''No OSPF configured'''
pass
else:
dut.config(['no router ospf %d' % pid])
class TestApiOspf(DutSystemTest):
def test_get(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1", "router-id 1.1.1.1",
"network 2.2.2.0/24 area 0", "redistribute bgp"])
ospf_response = dut.api('ospf').get()
config = dict(router_id="1.1.1.1", ospf_process_id=1,
vrf='default',
networks=[dict(netmask='24', network="2.2.2.0",
area="0.0.0.0")],
redistributions=[dict(protocol="bgp")],
shutdown=False)
self.assertEqual(ospf_response, config)
def test_get_with_vrf(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 10 vrf test", "router-id 1.1.1.2",
"network 2.2.2.0/24 area 0", "redistribute bgp"])
ospf_response = dut.api('ospf').get()
config = dict(router_id="1.1.1.2", ospf_process_id=10, vrf='test',
networks=[dict(netmask='24', network="2.2.2.0",
area="0.0.0.0")],
redistributions=[dict(protocol="bgp")],
shutdown=False)
self.assertEqual(ospf_response, config)
clear_ospf_config(dut, 10)
def test_shutdown(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1", "network 1.1.1.1/32 area 0"])
ospf = dut.api('ospf')
response = ospf.set_shutdown()
self.assertTrue(response)
self.assertIn('shutdown', ospf.get_block("router ospf 1"))
def test_no_shutown(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 10", "network 1.1.1.0/24 area 0",
"shutdown"])
ospf = dut.api('ospf')
response = ospf.set_no_shutdown()
self.assertTrue(response)
self.assertIn('no shutdown', ospf.get_block("router ospf 10"))
def test_delete(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 10"])
ospf = dut.api("ospf")
response = ospf.delete()
self.assertTrue(response)
self.assertEqual(None, ospf.get_block("router ospf"))
def test_create_valid_id(self):
for dut in self.duts:
clear_ospf_config(dut)
pid = randint(1, 65536)
ospf = dut.api("ospf")
response = ospf.create(pid)
self.assertTrue(response)
self.assertIn("router ospf {}".format(pid), dut.get_config())
def test_create_invalid_id(self):
for dut in self.duts:
clear_ospf_config(dut)
pid = randint(70000, 100000)
with self.assertRaises(ValueError):
dut.api("ospf").create(pid)
def test_create_with_vrf(self):
for dut in self.duts:
clear_ospf_config(dut)
pid = randint(1, 65536)
ospf = dut.api("ospf")
response = ospf.create(pid, vrf='test')
self.assertTrue(response)
self.assertIn("router ospf {} vrf {}".format(pid, 'test'),
dut.get_config())
def test_configure_ospf(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1"])
ospf = dut.api("ospf")
response = ospf.configure_ospf("router-id 1.1.1.1")
self.assertTrue(response)
self.assertIn("router-id 1.1.1.1", ospf.get_block("router ospf 1"))
def test_set_router_id(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1"])
ospf = dut.api("ospf")
response = ospf.set_router_id(randint(1, 65536))
self.assertFalse(response)
response = ospf.set_router_id("2.2.2.2")
self.assertTrue(response)
self.assertIn("router-id 2.2.2.2", ospf.get_block("router ospf 1"))
response = ospf.set_router_id(default=True)
self.assertTrue(response)
self.assertIn("no router-id", ospf.get_block("router ospf 1"))
response = ospf.set_router_id(disable=True)
self.assertTrue(response)
self.assertIn("no router-id", ospf.get_block("router ospf 1"))
def test_add_network(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1"])
ospf = dut.api("ospf")
response = ospf.add_network("2.2.2.0", "24", 1234)
self.assertTrue(response)
self.assertIn("network 2.2.2.0/24 area 0.0.4.210", ospf.get_block("router ospf 1"))
response = ospf.add_network("10.10.10.0", "24")
self.assertTrue(response)
self.assertIn("network 10.10.10.0/24 area 0.0.0.0", ospf.get_block("router ospf 1"))
def test_remove_network(self):
for dut in self.duts:
clear_ospf_config(dut)
ospf_config = ["router ospf 1", "network 2.2.2.0/24 area 0.0.0.0",
"network 3.3.3.1/32 area 1.1.1.1"]
dut.config(ospf_config)
ospf = dut.api("ospf")
response = ospf.remove_network("2.2.2.0", "24")
self.assertTrue(response)
response = ospf.remove_network("3.3.3.1", "32", "1.1.1.1")
self.assertTrue(response)
for config in ospf_config:
if "router ospf" not in config:
self.assertNotIn(config, ospf.get_block("router ospf 1"))
def test_add_redistribution(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1"])
ospf = dut.api("ospf")
protos = ['bgp', 'rip', 'static', 'connected']
for proto in protos:
if randint(1, 10) % 2 == 0:
response = ospf.add_redistribution(proto, 'test')
else:
response = ospf.add_redistribution(proto)
self.assertTrue(response)
for proto in protos:
self.assertIn("redistribute {}".format(proto), ospf.get_block("router ospf 1"))
with self.assertRaises(ValueError):
ospf.add_redistribution("NOT VALID")
def test_remove_redistribution(self):
for dut in self.duts:
clear_ospf_config(dut)
dut.config(["router ospf 1", "redistribute bgp", "redistribute static route-map test"])
ospf = dut.api("ospf")
response = ospf.remove_redistribution('bgp')
self.assertTrue(response)
response = ospf.remove_redistribution('static')
self.assertTrue(response)
self.assertNotIn("redistribute", ospf.get_block("router ospf 1"))
| bsd-3-clause | [
3,
199,
3,
1898,
334,
67,
9,
7800,
12,
31153,
1207,
17138,
12,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
257,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
4245,
12,
199,
3,
257,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
199,
3,
257,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
257,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
257,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
14,
199,
3,
199,
3,
257,
11443,
314,
536,
402,
31153,
1207,
17138,
6590,
314,
1561,
402,
2399,
199,
3,
257,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
257,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
4160,
6225,
33,
18340,
8406,
51,
199,
3,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
8820,
12,
9836,
12,
1549,
199,
3,
9110,
6736,
334,
6446,
12,
5400,
2845,
5471,
2296,
12,
9838,
1634,
199,
3,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
7126,
12,
1549,
9206,
27,
1549,
199,
3,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
9815,
1634,
5603,
12,
199,
3,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
334,
6446,
9254,
199,
3,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
1634,
5749,
4141,
12,
9704,
199,
3,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
199,
646,
747,
199,
646,
984,
199,
1274,
14,
515,
14,
740,
8,
736,
14,
515,
14,
904,
8,
736,
14,
515,
14,
3475,
3460,
493,
10139,
20644,
773,
1333,
199,
199,
504,
2196,
492,
29722,
199,
504,
984,
396,
773,
492,
577,
337,
3989,
774,
421,
199,
318,
5436,
63,
18303,
63,
888,
8,
32343,
12,
4422,
29,
403,
304,
272,
340,
4422,
365,
488,
26,
267,
862,
26,
288,
4422,
275,
1109,
8,
32343,
14,
362,
63,
888,
8,
1162,
628,
2792,
26494,
9981,
16,
1055,
1294,
3430,
18,
566,
288,
366,
337,
14,
888,
2941,
889,
6197,
26494,
450,
68,
7,
450,
4422,
566,
267,
871,
7888,
26,
288,
1449,
1944,
4403,
10966,
7526,
2344,
288,
986,
272,
587,
26,
267,
366,
337,
14,
888,
2941,
889,
6197,
26494,
450,
68,
7,
450,
4422,
566,
421,
199,
533,
1379,
7394,
47,
12704,
8,
36,
337,
3989,
774,
304,
339,
347,
511,
63,
362,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
413,
401,
298,
4995,
13,
344,
413,
14,
17,
14,
17,
14,
17,
401,
717,
298,
1200,
499,
14,
18,
14,
18,
14,
16,
15,
1194,
9150,
378,
401,
298,
264,
3470,
16884,
3135,
288,
26494,
63,
1310,
275,
366,
337,
14,
1246,
360,
18303,
1959,
362,
342,
288,
1101,
275,
1211,
8,
4995,
63,
344,
628,
17,
14,
17,
14,
17,
14,
17,
401,
26494,
63,
1412,
63,
344,
29,
17,
12,
2079,
15209,
534,
885,
297,
2079,
11759,
1524,
807,
8,
14588,
534,
1194,
297,
2784,
628,
18,
14,
18,
14,
18,
14,
16,
401,
1460,
9150,
628,
16,
14,
16,
14,
16,
14,
16,
17857,
2079,
26771,
1524,
807,
8,
3922,
628,
10132,
17857,
2079,
12842,
29,
797,
9,
288,
291,
14,
629,
8,
18303,
63,
1310,
12,
1101,
9,
339,
347,
511,
63,
362,
63,
1045,
63,
11863,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
1616,
15209,
511,
401,
298,
4995,
13,
344,
413,
14,
17,
14,
17,
14,
18,
401,
717,
298,
1200,
499,
14,
18,
14,
18,
14,
16,
15,
1194,
9150,
378,
401,
298,
264,
3470,
16884,
3135,
288,
26494,
63,
1310,
275,
366,
337,
14,
1246,
360,
18303,
1959,
362,
342,
288,
1101,
275,
1211,
8,
4995,
63,
344,
628,
17,
14,
17,
14,
17,
14,
18,
401,
26494,
63,
1412,
63,
344,
29,
709,
12,
15209,
534,
396,
297,
2079,
11759,
1524,
807,
8,
14588,
534,
1194,
297,
2784,
628,
18,
14,
18,
14,
18,
14,
16,
401,
1460,
9150,
628,
16,
14,
16,
14,
16,
14,
16,
17857,
2079,
26771,
1524,
807,
8,
3922,
628,
10132,
17857,
2079,
12842,
29,
797,
9,
288,
291,
14,
629,
8,
18303,
63,
1310,
12,
1101,
9,
288,
5436,
63,
18303,
63,
888,
8,
32343,
12,
1616,
9,
339,
347,
511,
63,
8831,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
413,
401,
298,
1200,
413,
14,
17,
14,
17,
14,
17,
15,
708,
9150,
378,
3135,
288,
26494,
275,
366,
337,
14,
1246,
360,
18303,
358,
288,
1177,
275,
26494,
14,
409,
63,
8831,
342,
288,
291,
14,
1815,
8,
1310,
9,
288,
291,
14,
4080,
360,
8831,
297,
26494,
14,
362,
63,
1457,
480,
4995,
26494,
413,
2237,
339,
347,
511,
63,
889,
63,
609,
337,
944,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
1616,
401,
298,
1200,
413,
14,
17,
14,
17,
14,
16,
15,
1194,
9150,
378,
401,
2432,
298,
8831,
3135,
288,
26494,
275,
366,
337,
14,
1246,
360,
18303,
358,
288,
1177,
275,
26494,
14,
409,
63,
889,
63,
8831,
342,
288,
291,
14,
1815,
8,
1310,
9,
288,
291,
14,
4080,
360
] | [
199,
3,
1898,
334,
67,
9,
7800,
12,
31153,
1207,
17138,
12,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
257,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
4245,
12,
199,
3,
257,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
199,
3,
257,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
257,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
257,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
14,
199,
3,
199,
3,
257,
11443,
314,
536,
402,
31153,
1207,
17138,
6590,
314,
1561,
402,
2399,
199,
3,
257,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
257,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
4160,
6225,
33,
18340,
8406,
51,
199,
3,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
8820,
12,
9836,
12,
1549,
199,
3,
9110,
6736,
334,
6446,
12,
5400,
2845,
5471,
2296,
12,
9838,
1634,
199,
3,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
7126,
12,
1549,
9206,
27,
1549,
199,
3,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
9815,
1634,
5603,
12,
199,
3,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
334,
6446,
9254,
199,
3,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
1634,
5749,
4141,
12,
9704,
199,
3,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
199,
646,
747,
199,
646,
984,
199,
1274,
14,
515,
14,
740,
8,
736,
14,
515,
14,
904,
8,
736,
14,
515,
14,
3475,
3460,
493,
10139,
20644,
773,
1333,
199,
199,
504,
2196,
492,
29722,
199,
504,
984,
396,
773,
492,
577,
337,
3989,
774,
421,
199,
318,
5436,
63,
18303,
63,
888,
8,
32343,
12,
4422,
29,
403,
304,
272,
340,
4422,
365,
488,
26,
267,
862,
26,
288,
4422,
275,
1109,
8,
32343,
14,
362,
63,
888,
8,
1162,
628,
2792,
26494,
9981,
16,
1055,
1294,
3430,
18,
566,
288,
366,
337,
14,
888,
2941,
889,
6197,
26494,
450,
68,
7,
450,
4422,
566,
267,
871,
7888,
26,
288,
1449,
1944,
4403,
10966,
7526,
2344,
288,
986,
272,
587,
26,
267,
366,
337,
14,
888,
2941,
889,
6197,
26494,
450,
68,
7,
450,
4422,
566,
421,
199,
533,
1379,
7394,
47,
12704,
8,
36,
337,
3989,
774,
304,
339,
347,
511,
63,
362,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
413,
401,
298,
4995,
13,
344,
413,
14,
17,
14,
17,
14,
17,
401,
717,
298,
1200,
499,
14,
18,
14,
18,
14,
16,
15,
1194,
9150,
378,
401,
298,
264,
3470,
16884,
3135,
288,
26494,
63,
1310,
275,
366,
337,
14,
1246,
360,
18303,
1959,
362,
342,
288,
1101,
275,
1211,
8,
4995,
63,
344,
628,
17,
14,
17,
14,
17,
14,
17,
401,
26494,
63,
1412,
63,
344,
29,
17,
12,
2079,
15209,
534,
885,
297,
2079,
11759,
1524,
807,
8,
14588,
534,
1194,
297,
2784,
628,
18,
14,
18,
14,
18,
14,
16,
401,
1460,
9150,
628,
16,
14,
16,
14,
16,
14,
16,
17857,
2079,
26771,
1524,
807,
8,
3922,
628,
10132,
17857,
2079,
12842,
29,
797,
9,
288,
291,
14,
629,
8,
18303,
63,
1310,
12,
1101,
9,
339,
347,
511,
63,
362,
63,
1045,
63,
11863,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
1616,
15209,
511,
401,
298,
4995,
13,
344,
413,
14,
17,
14,
17,
14,
18,
401,
717,
298,
1200,
499,
14,
18,
14,
18,
14,
16,
15,
1194,
9150,
378,
401,
298,
264,
3470,
16884,
3135,
288,
26494,
63,
1310,
275,
366,
337,
14,
1246,
360,
18303,
1959,
362,
342,
288,
1101,
275,
1211,
8,
4995,
63,
344,
628,
17,
14,
17,
14,
17,
14,
18,
401,
26494,
63,
1412,
63,
344,
29,
709,
12,
15209,
534,
396,
297,
2079,
11759,
1524,
807,
8,
14588,
534,
1194,
297,
2784,
628,
18,
14,
18,
14,
18,
14,
16,
401,
1460,
9150,
628,
16,
14,
16,
14,
16,
14,
16,
17857,
2079,
26771,
1524,
807,
8,
3922,
628,
10132,
17857,
2079,
12842,
29,
797,
9,
288,
291,
14,
629,
8,
18303,
63,
1310,
12,
1101,
9,
288,
5436,
63,
18303,
63,
888,
8,
32343,
12,
1616,
9,
339,
347,
511,
63,
8831,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
413,
401,
298,
1200,
413,
14,
17,
14,
17,
14,
17,
15,
708,
9150,
378,
3135,
288,
26494,
275,
366,
337,
14,
1246,
360,
18303,
358,
288,
1177,
275,
26494,
14,
409,
63,
8831,
342,
288,
291,
14,
1815,
8,
1310,
9,
288,
291,
14,
4080,
360,
8831,
297,
26494,
14,
362,
63,
1457,
480,
4995,
26494,
413,
2237,
339,
347,
511,
63,
889,
63,
609,
337,
944,
8,
277,
304,
267,
367,
366,
337,
315,
291,
14,
68,
14608,
26,
288,
5436,
63,
18303,
63,
888,
8,
32343,
9,
288,
366,
337,
14,
888,
5234,
4995,
26494,
1616,
401,
298,
1200,
413,
14,
17,
14,
17,
14,
16,
15,
1194,
9150,
378,
401,
2432,
298,
8831,
3135,
288,
26494,
275,
366,
337,
14,
1246,
360,
18303,
358,
288,
1177,
275,
26494,
14,
409,
63,
889,
63,
8831,
342,
288,
291,
14,
1815,
8,
1310,
9,
288,
291,
14,
4080,
360,
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
] |
praekelt/txtalert | txtalert/apps/gateway/migrations/0002_auto__add_field_sendsms_group__add_field_pleasecallme_group.py | 1 | 4637 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# all previous data belongs to Temba Lethu Clinic
from django.contrib.auth.models import Group
group, created = Group.objects.get_or_create(name="Temba Lethu")
# Adding field 'SendSMS.group'
db.add_column('gateway_sendsms', 'group', self.gf('django.db.models.fields.related.ForeignKey')(default=group.pk, to=orm['auth.Group']), keep_default=False)
# Adding field 'PleaseCallMe.group'
db.add_column('gateway_pleasecallme', 'group', self.gf('django.db.models.fields.related.ForeignKey')(default=group.pk, related_name='gateway_pleasecallme_set', to=orm['auth.Group']), keep_default=False)
def backwards(self, orm):
# Deleting field 'SendSMS.group'
db.delete_column('gateway_sendsms', 'group_id')
# Deleting field 'PleaseCallMe.group'
db.delete_column('gateway_pleasecallme', 'group_id')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'gateway.pleasecallme': {
'Meta': {'ordering': "['created_at']", 'object_name': 'PleaseCallMe'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'gateway_pleasecallme_set'", 'to': "orm['auth.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'recipient_msisdn': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'sender_msisdn': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'sms_id': ('django.db.models.fields.CharField', [], {'max_length': '80'})
},
'gateway.sendsms': {
'Meta': {'object_name': 'SendSMS'},
'delivery': ('django.db.models.fields.DateTimeField', [], {}),
'delivery_timestamp': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'expiry': ('django.db.models.fields.DateTimeField', [], {}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'identifier': ('django.db.models.fields.CharField', [], {'max_length': '8'}),
'msisdn': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
'priority': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'receipt': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'smstext': ('django.db.models.fields.TextField', [], {}),
'status': ('django.db.models.fields.CharField', [], {'default': "'v'", 'max_length': '1'})
}
}
complete_apps = ['gateway']
| gpl-3.0 | [
3,
2644,
26,
2774,
13,
24,
199,
646,
2197,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
12919,
14,
86,
18,
492,
24765,
199,
504,
1639,
14,
697,
492,
1709,
199,
199,
533,
12090,
8,
24822,
304,
339,
347,
17465,
8,
277,
12,
9813,
304,
2728,
327,
1006,
4136,
666,
15006,
370,
5773,
887,
65,
7005,
273,
85,
445,
472,
530,
267,
687,
1639,
14,
2828,
14,
1178,
14,
992,
492,
5611,
267,
1572,
12,
2737,
275,
5611,
14,
1462,
14,
362,
63,
269,
63,
981,
8,
354,
628,
6301,
887,
65,
7005,
273,
85,
531,
2728,
327,
12934,
901,
283,
6795,
51,
3053,
14,
923,
7,
267,
1592,
14,
525,
63,
2301,
360,
7019,
63,
2464,
795,
706,
297,
283,
923,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
7533,
885,
29,
923,
14,
2051,
12,
370,
29,
1025,
459,
1178,
14,
2448,
3815,
4215,
63,
885,
29,
797,
9,
398,
327,
12934,
901,
283,
8254,
2176,
1352,
14,
923,
7,
267,
1592,
14,
525,
63,
2301,
360,
7019,
63,
27567,
1250,
278,
297,
283,
923,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
7533,
885,
29,
923,
14,
2051,
12,
4048,
63,
354,
534,
7019,
63,
27567,
1250,
278,
63,
409,
297,
370,
29,
1025,
459,
1178,
14,
2448,
3815,
4215,
63,
885,
29,
797,
9,
2378,
347,
8552,
8,
277,
12,
9813,
304,
2728,
327,
15920,
901,
283,
6795,
51,
3053,
14,
923,
7,
267,
1592,
14,
1807,
63,
2301,
360,
7019,
63,
2464,
795,
706,
297,
283,
923,
63,
344,
358,
398,
327,
15920,
901,
283,
8254,
2176,
1352,
14,
923,
7,
267,
1592,
14,
1807,
63,
2301,
360,
7019,
63,
27567,
1250,
278,
297,
283,
923,
63,
344,
358,
2378,
1709,
275,
469,
267,
283,
1178,
14,
923,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
2448,
2267,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
3235,
356,
283,
549,
297,
283,
988,
63,
1267,
356,
283,
1257,
1604,
288,
283,
6060,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
7624,
297,
990,
791,
475,
356,
298,
1025,
459,
1178,
14,
7980,
6256,
283,
10247,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
3071,
267,
1660,
267,
283,
1178,
14,
5693,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
16111,
1317,
63,
466,
363,
571,
63,
1302,
297,
283,
1317,
63,
466,
363,
1238,
297,
283,
11879,
18106,
283,
3235,
63,
6314,
356,
9510,
1317,
63,
466,
297,
283,
11879,
9878,
283,
785,
63,
354,
356,
283,
7980,
2267,
288,
283,
11879,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
1317,
63,
466,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
475,
356,
298,
1025,
459,
10778,
14,
11282,
6097,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1400,
3071,
267,
1660,
267,
283,
10778,
14,
20735,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
16111,
354,
21099,
283,
3235,
63,
6314,
356,
9510,
571,
63,
1302,
297,
283,
1238,
9878,
283,
785,
63,
354,
356,
283,
11282,
297,
283,
697,
63,
1224,
356,
3546,
1176,
63,
1317,
63,
466,
15208,
288,
283,
571,
63,
1302,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
1238,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
3071,
267,
1660,
267,
283,
7019,
14,
27567,
1250,
278,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
25280,
3966,
63,
292,
6256,
283,
785,
63,
354,
356,
283,
8254,
2176,
1352,
2267,
288,
283,
3966,
63,
292,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791,
2495,
63,
2131,
63,
525,
356,
283,
549,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
923,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
2407,
63,
354,
356,
3546,
7019,
63,
27567,
1250,
278,
63,
409,
4662,
283,
475,
356,
298,
1025,
459,
1178,
14,
2448,
6097,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
1188,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
6254,
297,
990,
791,
2500,
356,
283,
549,
1604,
288,
283,
10043,
63,
77,
2316,
4272,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2299,
1604,
288,
283,
8114,
63,
77,
2316,
4272,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2299,
1604,
288,
283,
18751,
63,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1257,
3071,
267,
1660,
267,
283,
7019,
14,
2464,
795,
706,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
6795,
51,
3053,
2267,
288,
283,
14564,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
14564,
63,
3954,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791
] | [
2644,
26,
2774,
13,
24,
199,
646,
2197,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
12919,
14,
86,
18,
492,
24765,
199,
504,
1639,
14,
697,
492,
1709,
199,
199,
533,
12090,
8,
24822,
304,
339,
347,
17465,
8,
277,
12,
9813,
304,
2728,
327,
1006,
4136,
666,
15006,
370,
5773,
887,
65,
7005,
273,
85,
445,
472,
530,
267,
687,
1639,
14,
2828,
14,
1178,
14,
992,
492,
5611,
267,
1572,
12,
2737,
275,
5611,
14,
1462,
14,
362,
63,
269,
63,
981,
8,
354,
628,
6301,
887,
65,
7005,
273,
85,
531,
2728,
327,
12934,
901,
283,
6795,
51,
3053,
14,
923,
7,
267,
1592,
14,
525,
63,
2301,
360,
7019,
63,
2464,
795,
706,
297,
283,
923,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
7533,
885,
29,
923,
14,
2051,
12,
370,
29,
1025,
459,
1178,
14,
2448,
3815,
4215,
63,
885,
29,
797,
9,
398,
327,
12934,
901,
283,
8254,
2176,
1352,
14,
923,
7,
267,
1592,
14,
525,
63,
2301,
360,
7019,
63,
27567,
1250,
278,
297,
283,
923,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
7533,
885,
29,
923,
14,
2051,
12,
4048,
63,
354,
534,
7019,
63,
27567,
1250,
278,
63,
409,
297,
370,
29,
1025,
459,
1178,
14,
2448,
3815,
4215,
63,
885,
29,
797,
9,
2378,
347,
8552,
8,
277,
12,
9813,
304,
2728,
327,
15920,
901,
283,
6795,
51,
3053,
14,
923,
7,
267,
1592,
14,
1807,
63,
2301,
360,
7019,
63,
2464,
795,
706,
297,
283,
923,
63,
344,
358,
398,
327,
15920,
901,
283,
8254,
2176,
1352,
14,
923,
7,
267,
1592,
14,
1807,
63,
2301,
360,
7019,
63,
27567,
1250,
278,
297,
283,
923,
63,
344,
358,
2378,
1709,
275,
469,
267,
283,
1178,
14,
923,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
2448,
2267,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
3235,
356,
283,
549,
297,
283,
988,
63,
1267,
356,
283,
1257,
1604,
288,
283,
6060,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
7624,
297,
990,
791,
475,
356,
298,
1025,
459,
1178,
14,
7980,
6256,
283,
10247,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
3071,
267,
1660,
267,
283,
1178,
14,
5693,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
16111,
1317,
63,
466,
363,
571,
63,
1302,
297,
283,
1317,
63,
466,
363,
1238,
297,
283,
11879,
18106,
283,
3235,
63,
6314,
356,
9510,
1317,
63,
466,
297,
283,
11879,
9878,
283,
785,
63,
354,
356,
283,
7980,
2267,
288,
283,
11879,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
1317,
63,
466,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
475,
356,
298,
1025,
459,
10778,
14,
11282,
6097,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1400,
3071,
267,
1660,
267,
283,
10778,
14,
20735,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
16111,
354,
21099,
283,
3235,
63,
6314,
356,
9510,
571,
63,
1302,
297,
283,
1238,
9878,
283,
785,
63,
354,
356,
283,
11282,
297,
283,
697,
63,
1224,
356,
3546,
1176,
63,
1317,
63,
466,
15208,
288,
283,
571,
63,
1302,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
1238,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
1604,
288,
283,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1960,
3071,
267,
1660,
267,
283,
7019,
14,
27567,
1250,
278,
356,
469,
288,
283,
3396,
356,
791,
7128,
356,
25280,
3966,
63,
292,
6256,
283,
785,
63,
354,
356,
283,
8254,
2176,
1352,
2267,
288,
283,
3966,
63,
292,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791,
2495,
63,
2131,
63,
525,
356,
283,
549,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
923,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
2407,
63,
354,
356,
3546,
7019,
63,
27567,
1250,
278,
63,
409,
4662,
283,
475,
356,
298,
1025,
459,
1178,
14,
2448,
6097,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
1188,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
6254,
297,
990,
791,
2500,
356,
283,
549,
1604,
288,
283,
10043,
63,
77,
2316,
4272,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2299,
1604,
288,
283,
8114,
63,
77,
2316,
4272,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2299,
1604,
288,
283,
18751,
63,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1257,
3071,
267,
1660,
267,
283,
7019,
14,
2464,
795,
706,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
6795,
51,
3053,
2267,
288,
283,
14564,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
14564,
63,
3954,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791,
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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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
] |
M4rtinK/pyside-android | tests/QtCore/qflags_test.py | 6 | 3405 | #!/usr/bin/python
'''Test cases for QFlags'''
import unittest
from PySide.QtCore import Qt, QTemporaryFile, QFile, QIODevice, QObject
class QFlagTest(unittest.TestCase):
'''Test case for usage of flags'''
def testCallFunction(self):
f = QTemporaryFile()
self.assertTrue(f.open())
fileName = f.fileName()
f.close()
f = QFile(fileName)
self.assertEqual(f.open(QIODevice.Truncate | QIODevice.Text | QIODevice.ReadWrite), True)
om = f.openMode()
self.assertEqual(om & QIODevice.Truncate, QIODevice.Truncate)
self.assertEqual(om & QIODevice.Text, QIODevice.Text)
self.assertEqual(om & QIODevice.ReadWrite, QIODevice.ReadWrite)
self.assertTrue(om == QIODevice.Truncate | QIODevice.Text | QIODevice.ReadWrite)
f.close()
class QFlagOperatorTest(unittest.TestCase):
'''Test case for operators in QFlags'''
def testInvert(self):
'''QFlags ~ (invert) operator'''
self.assertEqual(type(~QIODevice.ReadOnly), QIODevice.OpenMode)
def testOr(self):
'''QFlags | (or) operator'''
self.assertEqual(type(QIODevice.ReadOnly | QIODevice.WriteOnly), QIODevice.OpenMode)
def testAnd(self):
'''QFlags & (and) operator'''
self.assertEqual(type(QIODevice.ReadOnly & QIODevice.WriteOnly), QIODevice.OpenMode)
def testIOr(self):
'''QFlags |= (ior) operator'''
flag = Qt.WindowFlags()
self.assertTrue(Qt.Widget == 0)
self.assertFalse(flag & Qt.Widget)
result = flag & Qt.Widget
self.assertTrue(result == 0)
flag |= Qt.WindowMinimizeButtonHint
self.assertTrue(flag & Qt.WindowMinimizeButtonHint)
def testInvertOr(self):
'''QFlags ~ (invert) operator over the result of an | (or) operator'''
self.assertEqual(type(~(Qt.ItemIsSelectable | Qt.ItemIsEditable)), Qt.ItemFlags)
def testEqual(self):
'''QFlags == operator'''
flags = Qt.Window
flags |= Qt.WindowMinimizeButtonHint
flag_type = (flags & Qt.WindowType_Mask)
self.assertEqual(flag_type, Qt.Window)
self.assertEqual(Qt.KeyboardModifiers(Qt.ControlModifier), Qt.ControlModifier)
def testOperatorBetweenFlags(self):
'''QFlags & QFlags'''
flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable
newflags = Qt.NoItemFlags | Qt.ItemIsUserCheckable
self.assertTrue(flags & newflags)
def testOperatorDifferentOrder(self):
'''Different ordering of arguments'''
flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable
self.assertEqual(flags | Qt.ItemIsEnabled, Qt.ItemIsEnabled | flags)
class QFlagsOnQVariant(unittest.TestCase):
def testQFlagsOnQVariant(self):
o = QObject()
o.setProperty("foo", QIODevice.ReadOnly | QIODevice.WriteOnly)
self.assertEqual(type(o.property("foo")), QIODevice.OpenMode)
class QFlagsWrongType(unittest.TestCase):
def testWrongType(self):
'''Wrong type passed to QFlags binary operators'''
self.assertRaises(TypeError, Qt.NoItemFlags | '43')
self.assertRaises(TypeError, Qt.NoItemFlags & '43')
self.assertRaises(TypeError, 'jabba' & Qt.NoItemFlags)
self.assertRaises(TypeError, 'hut' & Qt.NoItemFlags)
self.assertRaises(TypeError, Qt.NoItemFlags & QObject())
if __name__ == '__main__':
unittest.main()
| lgpl-2.1 | [
3381,
2647,
15,
1393,
15,
1548,
199,
2344,
774,
5560,
367,
1413,
6381,
2344,
199,
199,
646,
2882,
199,
504,
1611,
15414,
14,
10901,
492,
3959,
12,
1413,
13271,
12,
1413,
1173,
12,
1413,
2090,
2510,
12,
1413,
1692,
199,
199,
533,
1413,
5318,
774,
8,
2796,
14,
1746,
304,
272,
1449,
774,
1930,
367,
4503,
402,
3285,
2344,
339,
347,
511,
2176,
3481,
8,
277,
304,
267,
289,
275,
1413,
13271,
342,
267,
291,
14,
1815,
8,
70,
14,
1490,
1012,
267,
18305,
275,
289,
14,
15450,
342,
267,
289,
14,
1600,
342,
398,
289,
275,
1413,
1173,
8,
15450,
9,
267,
291,
14,
629,
8,
70,
14,
1490,
8,
49,
2090,
2510,
14,
20460,
1411,
1204,
1413,
2090,
2510,
14,
1872,
1204,
1413,
2090,
2510,
14,
3284,
3534,
395,
715,
9,
267,
30511,
275,
289,
14,
1490,
1385,
342,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
20460,
1411,
12,
1413,
2090,
2510,
14,
20460,
1411,
9,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
1872,
12,
1413,
2090,
2510,
14,
1872,
9,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
3284,
3534,
12,
1413,
2090,
2510,
14,
3284,
3534,
9,
267,
291,
14,
1815,
8,
676,
508,
1413,
2090,
2510,
14,
20460,
1411,
1204,
1413,
2090,
2510,
14,
1872,
1204,
1413,
2090,
2510,
14,
3284,
3534,
9,
267,
289,
14,
1600,
342,
421,
199,
533,
1413,
5318,
7961,
774,
8,
2796,
14,
1746,
304,
272,
1449,
774,
1930,
367,
10211,
315,
1413,
6381,
2344,
339,
347,
511,
26498,
8,
277,
304,
267,
1449,
49,
6381,
6146,
334,
18957,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
26428,
49,
2090,
2510,
14,
22210,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
2844,
8,
277,
304,
267,
1449,
49,
6381,
1204,
334,
269,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
8,
49,
2090,
2510,
14,
22210,
1204,
1413,
2090,
2510,
14,
3534,
5903,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
3325,
8,
277,
304,
267,
1449,
49,
6381,
1253,
334,
460,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
8,
49,
2090,
2510,
14,
22210,
1253,
1413,
2090,
2510,
14,
3534,
5903,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
2090,
82,
8,
277,
304,
267,
1449,
49,
6381,
8901,
334,
15499,
9,
4182,
2344,
267,
3305,
275,
3959,
14,
4301,
6381,
342,
267,
291,
14,
1815,
8,
4238,
14,
3339,
508,
378,
9,
267,
291,
14,
3334,
8,
4173,
1253,
3959,
14,
3339,
9,
267,
754,
275,
3305,
1253,
3959,
14,
3339,
267,
291,
14,
1815,
8,
1099,
508,
378,
9,
267,
3305,
8901,
3959,
14,
4301,
4649,
11807,
4259,
20891,
267,
291,
14,
1815,
8,
4173,
1253,
3959,
14,
4301,
4649,
11807,
4259,
20891,
9,
339,
347,
511,
26498,
2844,
8,
277,
304,
267,
1449,
49,
6381,
6146,
334,
18957,
9,
4182,
1806,
314,
754,
402,
376,
1204,
334,
269,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
26428,
8,
4238,
14,
2081,
1831,
5446,
461,
1204,
3959,
14,
2081,
1831,
20957,
1224,
1826,
3959,
14,
2081,
6381,
9,
339,
347,
511,
591,
8,
277,
304,
267,
1449,
49,
6381,
508,
4182,
2344,
267,
3285,
275,
3959,
14,
4301,
267,
3285,
8901,
3959,
14,
4301,
4649,
11807,
4259,
20891,
267,
3305,
63,
466,
275,
334,
2469,
1253,
3959,
14,
4301,
804,
63,
5144,
9,
267,
291,
14,
629,
8,
4173,
63,
466,
12,
3959,
14,
4301,
9,
398,
291,
14,
629,
8,
4238,
14,
28377,
7469,
6069,
8,
4238,
14,
3717,
23871,
395,
3959,
14,
3717,
23871,
9,
339,
347,
511,
7961,
24472,
3109,
6381,
8,
277,
304,
267,
1449,
49,
6381,
1253,
1413,
6381,
2344,
267,
3285,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
892,
2469,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
291,
14,
1815,
8,
2469,
1253,
892,
2469,
9,
339,
347,
511,
7961,
31409,
4738,
8,
277,
304,
267,
1449,
31409,
7794,
402,
2368,
2344,
267,
3285,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
291,
14,
629,
8,
2469,
1204,
3959,
14,
2081,
1831,
6589,
12,
3959,
14,
2081,
1831,
6589,
1204,
3285,
9,
199,
199,
533,
1413,
6381,
3314,
49,
12935,
8,
2796,
14,
1746,
304,
272,
347,
511,
49,
6381,
3314,
49,
12935,
8,
277,
304,
267,
312,
275,
1413,
1692,
342,
267,
312,
14,
21173,
480,
1421,
401,
1413,
2090,
2510,
14,
22210,
1204,
1413,
2090,
2510,
14,
3534,
5903,
9,
267,
291,
14,
629,
8,
466,
8,
79,
14,
1829,
480,
1421,
8150,
1413,
2090,
2510,
14,
4299,
1385,
9,
199,
199,
533,
1413,
6381,
14858,
804,
8,
2796,
14,
1746,
304,
272,
347,
511,
14858,
804,
8,
277,
304,
267,
1449,
14858,
730,
3032,
370,
1413,
6381,
3366,
10211,
2344,
398,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1204,
283,
2824,
358,
267,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1253,
283,
2824,
358,
267,
291,
14,
1855,
8,
4333,
12,
283,
74,
371,
2470,
7,
1253,
3959,
14,
1944,
2081,
6381,
9,
267,
291,
14,
1855,
8,
4333,
12,
283,
72,
337,
7,
1253,
3959,
14,
1944,
2081,
6381,
9,
267,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1253,
1413,
1692,
1012,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
2882,
14,
973,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
2647,
15,
1393,
15,
1548,
199,
2344,
774,
5560,
367,
1413,
6381,
2344,
199,
199,
646,
2882,
199,
504,
1611,
15414,
14,
10901,
492,
3959,
12,
1413,
13271,
12,
1413,
1173,
12,
1413,
2090,
2510,
12,
1413,
1692,
199,
199,
533,
1413,
5318,
774,
8,
2796,
14,
1746,
304,
272,
1449,
774,
1930,
367,
4503,
402,
3285,
2344,
339,
347,
511,
2176,
3481,
8,
277,
304,
267,
289,
275,
1413,
13271,
342,
267,
291,
14,
1815,
8,
70,
14,
1490,
1012,
267,
18305,
275,
289,
14,
15450,
342,
267,
289,
14,
1600,
342,
398,
289,
275,
1413,
1173,
8,
15450,
9,
267,
291,
14,
629,
8,
70,
14,
1490,
8,
49,
2090,
2510,
14,
20460,
1411,
1204,
1413,
2090,
2510,
14,
1872,
1204,
1413,
2090,
2510,
14,
3284,
3534,
395,
715,
9,
267,
30511,
275,
289,
14,
1490,
1385,
342,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
20460,
1411,
12,
1413,
2090,
2510,
14,
20460,
1411,
9,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
1872,
12,
1413,
2090,
2510,
14,
1872,
9,
267,
291,
14,
629,
8,
676,
1253,
1413,
2090,
2510,
14,
3284,
3534,
12,
1413,
2090,
2510,
14,
3284,
3534,
9,
267,
291,
14,
1815,
8,
676,
508,
1413,
2090,
2510,
14,
20460,
1411,
1204,
1413,
2090,
2510,
14,
1872,
1204,
1413,
2090,
2510,
14,
3284,
3534,
9,
267,
289,
14,
1600,
342,
421,
199,
533,
1413,
5318,
7961,
774,
8,
2796,
14,
1746,
304,
272,
1449,
774,
1930,
367,
10211,
315,
1413,
6381,
2344,
339,
347,
511,
26498,
8,
277,
304,
267,
1449,
49,
6381,
6146,
334,
18957,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
26428,
49,
2090,
2510,
14,
22210,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
2844,
8,
277,
304,
267,
1449,
49,
6381,
1204,
334,
269,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
8,
49,
2090,
2510,
14,
22210,
1204,
1413,
2090,
2510,
14,
3534,
5903,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
3325,
8,
277,
304,
267,
1449,
49,
6381,
1253,
334,
460,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
8,
49,
2090,
2510,
14,
22210,
1253,
1413,
2090,
2510,
14,
3534,
5903,
395,
1413,
2090,
2510,
14,
4299,
1385,
9,
339,
347,
511,
2090,
82,
8,
277,
304,
267,
1449,
49,
6381,
8901,
334,
15499,
9,
4182,
2344,
267,
3305,
275,
3959,
14,
4301,
6381,
342,
267,
291,
14,
1815,
8,
4238,
14,
3339,
508,
378,
9,
267,
291,
14,
3334,
8,
4173,
1253,
3959,
14,
3339,
9,
267,
754,
275,
3305,
1253,
3959,
14,
3339,
267,
291,
14,
1815,
8,
1099,
508,
378,
9,
267,
3305,
8901,
3959,
14,
4301,
4649,
11807,
4259,
20891,
267,
291,
14,
1815,
8,
4173,
1253,
3959,
14,
4301,
4649,
11807,
4259,
20891,
9,
339,
347,
511,
26498,
2844,
8,
277,
304,
267,
1449,
49,
6381,
6146,
334,
18957,
9,
4182,
1806,
314,
754,
402,
376,
1204,
334,
269,
9,
4182,
2344,
267,
291,
14,
629,
8,
466,
26428,
8,
4238,
14,
2081,
1831,
5446,
461,
1204,
3959,
14,
2081,
1831,
20957,
1224,
1826,
3959,
14,
2081,
6381,
9,
339,
347,
511,
591,
8,
277,
304,
267,
1449,
49,
6381,
508,
4182,
2344,
267,
3285,
275,
3959,
14,
4301,
267,
3285,
8901,
3959,
14,
4301,
4649,
11807,
4259,
20891,
267,
3305,
63,
466,
275,
334,
2469,
1253,
3959,
14,
4301,
804,
63,
5144,
9,
267,
291,
14,
629,
8,
4173,
63,
466,
12,
3959,
14,
4301,
9,
398,
291,
14,
629,
8,
4238,
14,
28377,
7469,
6069,
8,
4238,
14,
3717,
23871,
395,
3959,
14,
3717,
23871,
9,
339,
347,
511,
7961,
24472,
3109,
6381,
8,
277,
304,
267,
1449,
49,
6381,
1253,
1413,
6381,
2344,
267,
3285,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
892,
2469,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
291,
14,
1815,
8,
2469,
1253,
892,
2469,
9,
339,
347,
511,
7961,
31409,
4738,
8,
277,
304,
267,
1449,
31409,
7794,
402,
2368,
2344,
267,
3285,
275,
3959,
14,
1944,
2081,
6381,
1204,
3959,
14,
2081,
1831,
1899,
1799,
461,
267,
291,
14,
629,
8,
2469,
1204,
3959,
14,
2081,
1831,
6589,
12,
3959,
14,
2081,
1831,
6589,
1204,
3285,
9,
199,
199,
533,
1413,
6381,
3314,
49,
12935,
8,
2796,
14,
1746,
304,
272,
347,
511,
49,
6381,
3314,
49,
12935,
8,
277,
304,
267,
312,
275,
1413,
1692,
342,
267,
312,
14,
21173,
480,
1421,
401,
1413,
2090,
2510,
14,
22210,
1204,
1413,
2090,
2510,
14,
3534,
5903,
9,
267,
291,
14,
629,
8,
466,
8,
79,
14,
1829,
480,
1421,
8150,
1413,
2090,
2510,
14,
4299,
1385,
9,
199,
199,
533,
1413,
6381,
14858,
804,
8,
2796,
14,
1746,
304,
272,
347,
511,
14858,
804,
8,
277,
304,
267,
1449,
14858,
730,
3032,
370,
1413,
6381,
3366,
10211,
2344,
398,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1204,
283,
2824,
358,
267,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1253,
283,
2824,
358,
267,
291,
14,
1855,
8,
4333,
12,
283,
74,
371,
2470,
7,
1253,
3959,
14,
1944,
2081,
6381,
9,
267,
291,
14,
1855,
8,
4333,
12,
283,
72,
337,
7,
1253,
3959,
14,
1944,
2081,
6381,
9,
267,
291,
14,
1855,
8,
4333,
12,
3959,
14,
1944,
2081,
6381,
1253,
1413,
1692,
1012,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
2882,
14,
973,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
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
] |
Azulinho/ansible | lib/ansible/utils/module_docs_fragments/openstack.py | 133 | 3961 | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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/>.
class ModuleDocFragment(object):
# Standard openstack documentation fragment
DOCUMENTATION = '''
options:
cloud:
description:
- Named cloud to operate against. Provides default values for I(auth) and
I(auth_type). This parameter is not needed if I(auth) is provided or if
OpenStack OS_* environment variables are present.
required: false
auth:
description:
- Dictionary containing auth information as needed by the cloud's auth
plugin strategy. For the default I(password) plugin, this would contain
I(auth_url), I(username), I(password), I(project_name) and any
information about domains if the cloud supports them. For other plugins,
this param will need to contain whatever parameters that auth plugin
requires. This parameter is not needed if a named cloud is provided or
OpenStack OS_* environment variables are present.
required: false
auth_type:
description:
- Name of the auth plugin to use. If the cloud uses something other than
password authentication, the name of the plugin should be indicated here
and the contents of the I(auth) parameter should be updated accordingly.
required: false
default: password
region_name:
description:
- Name of the region.
required: false
wait:
description:
- Should ansible wait until the requested resource is complete.
required: false
default: "yes"
choices: ["yes", "no"]
timeout:
description:
- How long should ansible wait for the requested resource.
required: false
default: 180
api_timeout:
description:
- How long should the socket layer wait before timing out for API calls.
If this is omitted, nothing will be passed to the requests library.
required: false
default: None
validate_certs:
description:
- Whether or not SSL API requests should be verified. Before 2.3 this defaulted to True.
required: false
default: null
aliases: ['verify']
cacert:
description:
- A path to a CA Cert bundle that can be used as part of verifying
SSL API requests.
required: false
default: None
cert:
description:
- A path to a client certificate to use as part of the SSL transaction.
required: false
default: None
key:
description:
- A path to a client key to use as part of the SSL transaction.
required: false
default: None
endpoint_type:
description:
- Endpoint URL type to fetch from the service catalog.
choices: [public, internal, admin]
required: false
default: public
requirements:
- python >= 2.7
- shade
notes:
- The standard OpenStack environment variables, such as C(OS_USERNAME)
may be used instead of providing explicit values.
- Auth information is driven by os-client-config, which means that values
can come from a yaml config file in /etc/ansible/openstack.yaml,
/etc/openstack/clouds.yaml or ~/.config/openstack/clouds.yaml, then from
standard environment variables, then finally by explicit parameters in
plays. More information can be found at
U(http://docs.openstack.org/developer/os-client-config)
'''
| gpl-3.0 | [
3,
1898,
334,
67,
9,
6927,
27849,
13,
29471,
15290,
15878,
12,
491,
14,
48,
14,
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,
421,
199,
533,
5673,
3768,
11080,
8,
785,
304,
339,
327,
9739,
13869,
3794,
7956,
272,
29970,
2594,
275,
1449,
199,
1419,
26,
523,
8002,
26,
272,
1369,
26,
489,
446,
16198,
8002,
370,
19218,
6169,
14,
21552,
849,
1338,
367,
473,
8,
1178,
9,
436,
267,
473,
8,
1178,
63,
466,
680,
961,
2725,
365,
440,
4346,
340,
473,
8,
1178,
9,
365,
2741,
503,
340,
267,
14260,
4403,
15192,
3734,
2860,
787,
3451,
14,
272,
1415,
26,
3055,
523,
1790,
26,
272,
1369,
26,
489,
446,
11932,
3035,
1790,
2556,
465,
4346,
701,
314,
8002,
1159,
1790,
267,
3589,
10054,
14,
2104,
314,
849,
473,
8,
2060,
9,
3589,
12,
642,
3955,
1395,
267,
473,
8,
1178,
63,
633,
395,
473,
8,
2473,
395,
473,
8,
2060,
395,
473,
8,
1715,
63,
354,
9,
436,
1263,
267,
2556,
3595,
14006,
340,
314,
8002,
5171,
3062,
14,
2104,
1163,
8963,
12,
267,
642,
1215,
911,
1929,
370,
1395,
15685,
2633,
626,
1790,
3589,
267,
5074,
14,
961,
2725,
365,
440,
4346,
340,
282,
4310,
8002,
365,
2741,
503,
267,
14260,
4403,
15192,
3734,
2860,
787,
3451,
14,
272,
1415,
26,
3055,
523,
1790,
63,
466,
26,
272,
1369,
26,
489,
446,
2812,
402,
314,
1790,
3589,
370,
675,
14,
982,
314,
8002,
4440,
6020,
1163,
2419,
267,
2505,
6299,
12,
314,
536,
402,
314,
3589,
1077,
506,
22141,
2348,
267,
436,
314,
4072,
402,
314,
473,
8,
1178,
9,
2725,
1077,
506,
4588,
24137,
14,
272,
1415,
26,
3055,
272,
849,
26,
2505,
523,
4897,
63,
354,
26,
272,
1369,
26,
489,
446,
2812,
402,
314,
4897,
14,
272,
1415,
26,
3055,
523,
3618,
26,
272,
1369,
26,
489,
446,
7719,
3242,
3618,
5133,
314,
5839,
2073,
365,
4890,
14,
272,
1415,
26,
3055,
272,
849,
26,
298,
5066,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
523,
2653,
26,
272,
1369,
26,
489,
446,
7494,
1846,
1077,
3242,
3618,
367,
314,
5839,
2073,
14,
272,
1415,
26,
3055,
272,
849,
26,
13576,
523,
2986,
63,
2593,
26,
272,
1369,
26,
489,
446,
7494,
1846,
1077,
314,
2838,
4045,
3618,
2544,
20542,
734,
367,
3261,
4882,
14,
267,
982,
642,
365,
11684,
12,
6548,
911,
506,
3032,
370,
314,
4145,
3555,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
4107,
63,
8356,
26,
272,
1369,
26,
489,
446,
7480,
503,
440,
7799,
3261,
4145,
1077,
506,
16317,
14,
21467,
499,
14,
19,
642,
347,
21642,
471,
370,
715,
14,
272,
1415,
26,
3055,
272,
849,
26,
2973,
272,
5481,
26,
788,
4712,
418,
523,
286,
645,
15299,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
7240,
11002,
84,
8844,
626,
883,
506,
1202,
465,
1777,
402,
31866,
267,
7799,
3261,
4145,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
6250,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
1890,
5897,
370,
675,
465,
1777,
402,
314,
7799,
6008,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
790,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
1890,
790,
370,
675,
465,
1777,
402,
314,
7799,
6008,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
6037,
63,
466,
26,
272,
1369,
26,
267,
446,
9599,
1403,
2851,
730,
370,
5267,
687,
314,
2435,
10594,
14,
272,
3415,
26,
359,
3455,
12,
5007,
12,
4628,
61,
272,
1415,
26,
3055,
272,
849,
26,
4575,
199,
7538,
26,
523,
446,
2366,
2356,
499,
14,
23,
523,
446,
32250,
199,
5983,
26,
523,
446,
710,
4465,
14260,
3734,
2860,
12,
4066,
465,
445,
8,
3100,
63,
11958,
9,
272,
1443,
506,
1202,
3140,
402,
13070,
5027,
1338,
14,
523,
446,
3590,
2556,
365,
20921,
1856,
701,
747,
13,
1258,
13,
888,
12,
1314,
4910,
626,
1338,
272,
883,
11492,
687,
282,
8864,
1101,
570,
315,
1182,
6839,
15,
4853,
15,
8512,
14,
5963,
12,
272,
1182,
6839,
15,
8512,
15,
29691,
14,
5963,
503,
25975,
888,
15,
8512,
15,
29691,
14,
5963,
12,
2066,
687,
272,
4465,
3734,
2860,
12,
2066,
3753,
701,
5027,
2633,
315,
272,
299,
9316,
14,
16917,
2556,
883,
506,
1911,
737,
272,
738,
8,
1014,
921,
4757,
14,
8512,
14,
1308,
15,
11071,
15,
736,
13,
1258,
13,
888,
9,
199,
2344,
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
] | [
1898,
334,
67,
9,
6927,
27849,
13,
29471,
15290,
15878,
12,
491,
14,
48,
14,
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,
421,
199,
533,
5673,
3768,
11080,
8,
785,
304,
339,
327,
9739,
13869,
3794,
7956,
272,
29970,
2594,
275,
1449,
199,
1419,
26,
523,
8002,
26,
272,
1369,
26,
489,
446,
16198,
8002,
370,
19218,
6169,
14,
21552,
849,
1338,
367,
473,
8,
1178,
9,
436,
267,
473,
8,
1178,
63,
466,
680,
961,
2725,
365,
440,
4346,
340,
473,
8,
1178,
9,
365,
2741,
503,
340,
267,
14260,
4403,
15192,
3734,
2860,
787,
3451,
14,
272,
1415,
26,
3055,
523,
1790,
26,
272,
1369,
26,
489,
446,
11932,
3035,
1790,
2556,
465,
4346,
701,
314,
8002,
1159,
1790,
267,
3589,
10054,
14,
2104,
314,
849,
473,
8,
2060,
9,
3589,
12,
642,
3955,
1395,
267,
473,
8,
1178,
63,
633,
395,
473,
8,
2473,
395,
473,
8,
2060,
395,
473,
8,
1715,
63,
354,
9,
436,
1263,
267,
2556,
3595,
14006,
340,
314,
8002,
5171,
3062,
14,
2104,
1163,
8963,
12,
267,
642,
1215,
911,
1929,
370,
1395,
15685,
2633,
626,
1790,
3589,
267,
5074,
14,
961,
2725,
365,
440,
4346,
340,
282,
4310,
8002,
365,
2741,
503,
267,
14260,
4403,
15192,
3734,
2860,
787,
3451,
14,
272,
1415,
26,
3055,
523,
1790,
63,
466,
26,
272,
1369,
26,
489,
446,
2812,
402,
314,
1790,
3589,
370,
675,
14,
982,
314,
8002,
4440,
6020,
1163,
2419,
267,
2505,
6299,
12,
314,
536,
402,
314,
3589,
1077,
506,
22141,
2348,
267,
436,
314,
4072,
402,
314,
473,
8,
1178,
9,
2725,
1077,
506,
4588,
24137,
14,
272,
1415,
26,
3055,
272,
849,
26,
2505,
523,
4897,
63,
354,
26,
272,
1369,
26,
489,
446,
2812,
402,
314,
4897,
14,
272,
1415,
26,
3055,
523,
3618,
26,
272,
1369,
26,
489,
446,
7719,
3242,
3618,
5133,
314,
5839,
2073,
365,
4890,
14,
272,
1415,
26,
3055,
272,
849,
26,
298,
5066,
2,
272,
3415,
26,
2097,
5066,
401,
298,
889,
937,
523,
2653,
26,
272,
1369,
26,
489,
446,
7494,
1846,
1077,
3242,
3618,
367,
314,
5839,
2073,
14,
272,
1415,
26,
3055,
272,
849,
26,
13576,
523,
2986,
63,
2593,
26,
272,
1369,
26,
489,
446,
7494,
1846,
1077,
314,
2838,
4045,
3618,
2544,
20542,
734,
367,
3261,
4882,
14,
267,
982,
642,
365,
11684,
12,
6548,
911,
506,
3032,
370,
314,
4145,
3555,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
4107,
63,
8356,
26,
272,
1369,
26,
489,
446,
7480,
503,
440,
7799,
3261,
4145,
1077,
506,
16317,
14,
21467,
499,
14,
19,
642,
347,
21642,
471,
370,
715,
14,
272,
1415,
26,
3055,
272,
849,
26,
2973,
272,
5481,
26,
788,
4712,
418,
523,
286,
645,
15299,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
7240,
11002,
84,
8844,
626,
883,
506,
1202,
465,
1777,
402,
31866,
267,
7799,
3261,
4145,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
6250,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
1890,
5897,
370,
675,
465,
1777,
402,
314,
7799,
6008,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
790,
26,
272,
1369,
26,
489,
446,
437,
931,
370,
282,
1890,
790,
370,
675,
465,
1777,
402,
314,
7799,
6008,
14,
272,
1415,
26,
3055,
272,
849,
26,
488,
523,
6037,
63,
466,
26,
272,
1369,
26,
267,
446,
9599,
1403,
2851,
730,
370,
5267,
687,
314,
2435,
10594,
14,
272,
3415,
26,
359,
3455,
12,
5007,
12,
4628,
61,
272,
1415,
26,
3055,
272,
849,
26,
4575,
199,
7538,
26,
523,
446,
2366,
2356,
499,
14,
23,
523,
446,
32250,
199,
5983,
26,
523,
446,
710,
4465,
14260,
3734,
2860,
12,
4066,
465,
445,
8,
3100,
63,
11958,
9,
272,
1443,
506,
1202,
3140,
402,
13070,
5027,
1338,
14,
523,
446,
3590,
2556,
365,
20921,
1856,
701,
747,
13,
1258,
13,
888,
12,
1314,
4910,
626,
1338,
272,
883,
11492,
687,
282,
8864,
1101,
570,
315,
1182,
6839,
15,
4853,
15,
8512,
14,
5963,
12,
272,
1182,
6839,
15,
8512,
15,
29691,
14,
5963,
503,
25975,
888,
15,
8512,
15,
29691,
14,
5963,
12,
2066,
687,
272,
4465,
3734,
2860,
12,
2066,
3753,
701,
5027,
2633,
315,
272,
299,
9316,
14,
16917,
2556,
883,
506,
1911,
737,
272,
738,
8,
1014,
921,
4757,
14,
8512,
14,
1308,
15,
11071,
15,
736,
13,
1258,
13,
888,
9,
199,
2344,
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,
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,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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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
pombredanne/MOG | tools/regression_tester.py | 14 | 3537 | #!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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.
"""Tool for checking if patch contains a regression test.
By default runs against current patch but can be set to use any gerrit review
as specified by change number (uses 'git review -d').
Idea: take tests from patch to check, and run against code from previous patch.
If new tests pass, then no regression test, if new tests fails against old code
then either
* new tests depend on new code and cannot confirm regression test is valid
(false positive)
* new tests detects the bug being fixed (detect valid regression test)
Due to the risk of false positives, the results from this need some human
interpretation.
"""
import optparse
import string
import subprocess
import sys
def run(cmd, fail_ok=False):
print "running: %s" % cmd
obj = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True)
obj.wait()
if obj.returncode != 0 and not fail_ok:
print "The above command terminated with an error."
sys.exit(obj.returncode)
return obj.stdout.read()
def main():
usage = """
Tool for checking if a patch includes a regression test.
Usage: %prog [options]"""
parser = optparse.OptionParser(usage)
parser.add_option("-r", "--review", dest="review",
help="gerrit review number to test")
(options, args) = parser.parse_args()
if options.review:
original_branch = run("git rev-parse --abbrev-ref HEAD")
run("git review -d %s" % options.review)
else:
print ("no gerrit review number specified, running on latest commit"
"on current branch.")
test_works = False
# run new tests with old code
run("git checkout HEAD^ nova")
run("git checkout HEAD nova/tests")
# identify which tests have changed
tests = run("git whatchanged --format=oneline -1 | grep \"nova/tests\" "
"| cut -f2").split()
test_list = []
for test in tests:
test_list.append(string.replace(test[0:-3], '/', '.'))
if test_list == []:
test_works = False
expect_failure = ""
else:
# run new tests, expect them to fail
expect_failure = run(("tox -epy27 %s 2>&1" % string.join(test_list)),
fail_ok=True)
if "FAILED (id=" in expect_failure:
test_works = True
# cleanup
run("git checkout HEAD nova")
if options.review:
new_branch = run("git status | head -1 | cut -d ' ' -f 4")
run("git checkout %s" % original_branch)
run("git branch -D %s" % new_branch)
print expect_failure
print ""
print "*******************************"
if test_works:
print "FOUND a regression test"
else:
print "NO regression test"
sys.exit(1)
if __name__ == "__main__":
main()
| apache-2.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6695,
26,
20849,
29,
20,
20105,
29,
20,
25966,
29,
20,
199,
199,
3,
1898,
334,
67,
9,
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,
421,
199,
624,
5157,
367,
7907,
340,
3371,
3509,
282,
10864,
511,
14,
199,
199,
2175,
849,
7858,
6169,
1453,
3371,
1325,
883,
506,
663,
370,
675,
1263,
486,
281,
11133,
11248,
199,
305,
2013,
701,
1570,
1329,
334,
5589,
283,
3187,
11248,
446,
68,
1959,
199,
199,
41,
25395,
26,
5452,
2295,
687,
3371,
370,
1104,
12,
436,
1255,
6169,
1233,
687,
4136,
3371,
14,
199,
3917,
892,
2295,
986,
12,
2066,
949,
10864,
511,
12,
340,
892,
2295,
6918,
6169,
2269,
1233,
199,
12726,
1902,
199,
10,
892,
2295,
11687,
641,
892,
1233,
436,
3913,
12679,
10864,
511,
365,
1686,
523,
334,
3910,
7317,
9,
199,
10,
892,
2295,
477,
28853,
314,
6519,
3769,
6317,
334,
13552,
1686,
10864,
511,
9,
199,
36,
310,
370,
314,
22633,
402,
3055,
27609,
12,
314,
2058,
687,
642,
1929,
2005,
11779,
199,
21533,
425,
14,
199,
624,
199,
199,
646,
8691,
199,
646,
1059,
199,
646,
3873,
199,
646,
984,
421,
199,
318,
1255,
8,
1760,
12,
2449,
63,
745,
29,
797,
304,
272,
870,
298,
5720,
26,
450,
83,
2,
450,
2088,
272,
1559,
275,
3873,
14,
7942,
8,
1760,
12,
3839,
29,
5781,
14,
6089,
12,
4635,
29,
5781,
14,
6089,
12,
2574,
5218,
29,
549,
9,
272,
1559,
14,
2573,
342,
272,
340,
1559,
14,
9913,
1137,
378,
436,
440,
2449,
63,
745,
26,
267,
870,
298,
1918,
3432,
1414,
15745,
543,
376,
1125,
2122,
267,
984,
14,
2224,
8,
1113,
14,
9913,
9,
272,
372,
1559,
14,
2703,
14,
739,
342,
421,
199,
318,
2446,
837,
272,
4503,
275,
408,
272,
15650,
367,
7907,
340,
282,
3371,
6952,
282,
10864,
511,
14,
339,
11028,
26,
450,
6595,
359,
1419,
61,
624,
272,
1798,
275,
8691,
14,
14553,
8,
3807,
9,
272,
1798,
14,
525,
63,
1422,
6096,
82,
401,
4320,
8578,
401,
2053,
628,
8578,
401,
1993,
1720,
628,
836,
11133,
11248,
1329,
370,
511,
531,
272,
334,
1419,
12,
1249,
9,
275,
1798,
14,
1122,
63,
589,
342,
272,
340,
1511,
14,
8578,
26,
267,
3379,
63,
4694,
275,
1255,
480,
3187,
6822,
13,
1122,
1553,
31349,
13,
1121,
13053,
531,
267,
1255,
480,
3187,
11248,
446,
68,
450,
83,
2,
450,
1511,
14,
8578,
9,
272,
587,
26,
267,
870,
1689,
889,
486,
281,
11133,
11248,
1329,
2013,
12,
3879,
641,
8839,
5532,
2,
2049,
298,
265,
1453,
5246,
2685,
339,
511,
63,
12243,
275,
756,
339,
327,
1255,
892,
2295,
543,
2269,
1233,
272,
1255,
480,
3187,
15243,
13053,
62,
5913,
531,
272,
1255,
480,
3187,
15243,
13053,
5913,
15,
2219,
531,
339,
327,
10405,
1314,
2295,
1172,
2896,
272,
2295,
275,
1255,
480,
3187,
704,
693,
618,
68,
1553,
908,
29,
265,
32347,
446,
17,
1204,
20595,
8441,
6765,
15,
2219,
4451,
298,
355,
15733,
10415,
446,
70,
18,
3471,
1294,
342,
272,
511,
63,
513,
275,
942,
272,
367,
511,
315,
2295,
26,
267,
511,
63,
513,
14,
740,
8,
875,
14,
1814,
8,
396,
59,
16,
6809,
19,
467,
17220,
1987,
1333,
339,
340,
511,
63,
513,
508,
18410,
267,
511,
63,
12243,
275,
756,
267,
4282,
63,
5328,
275,
3087,
272,
587,
26,
267,
327,
1255,
892,
2295,
12,
4282,
3062,
370,
2449,
267,
4282,
63,
5328,
275,
1255,
9313,
475,
88,
446,
69,
647,
1465,
450,
83,
499,
18181,
17,
2,
450,
1059,
14,
904,
8,
396,
63,
513,
1826,
2490,
2449,
63,
745,
29,
549,
9,
267,
340,
298,
12299,
334,
344,
628,
315,
4282,
63,
5328,
26,
288,
511,
63,
12243,
275,
715,
339,
327,
9058,
272,
1255,
480,
3187,
15243,
13053,
5913,
531,
272,
340,
1511,
14,
8578,
26,
267,
892,
63,
4694,
275,
1255,
480,
3187,
2004,
1204,
4854,
446,
17,
1204,
10415,
446,
68,
283,
283,
446,
70,
841,
531,
267,
1255,
480,
3187,
15243,
450,
83,
2,
450,
3379,
63,
4694,
9,
267,
1255,
480,
3187,
5246,
446,
36,
450,
83,
2,
450,
892,
63,
4694,
9,
339,
870,
4282,
63,
5328,
272,
870,
3087,
272,
870,
298,
30948,
1116,
9153,
2,
272,
340,
511,
63,
12243,
26,
267,
870,
298,
13945,
282,
10864,
511,
2,
272,
587,
26,
267,
870,
298,
2826,
10864,
511,
2,
267,
984,
14,
2224,
8,
17,
9,
421,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
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
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6695,
26,
20849,
29,
20,
20105,
29,
20,
25966,
29,
20,
199,
199,
3,
1898,
334,
67,
9,
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,
421,
199,
624,
5157,
367,
7907,
340,
3371,
3509,
282,
10864,
511,
14,
199,
199,
2175,
849,
7858,
6169,
1453,
3371,
1325,
883,
506,
663,
370,
675,
1263,
486,
281,
11133,
11248,
199,
305,
2013,
701,
1570,
1329,
334,
5589,
283,
3187,
11248,
446,
68,
1959,
199,
199,
41,
25395,
26,
5452,
2295,
687,
3371,
370,
1104,
12,
436,
1255,
6169,
1233,
687,
4136,
3371,
14,
199,
3917,
892,
2295,
986,
12,
2066,
949,
10864,
511,
12,
340,
892,
2295,
6918,
6169,
2269,
1233,
199,
12726,
1902,
199,
10,
892,
2295,
11687,
641,
892,
1233,
436,
3913,
12679,
10864,
511,
365,
1686,
523,
334,
3910,
7317,
9,
199,
10,
892,
2295,
477,
28853,
314,
6519,
3769,
6317,
334,
13552,
1686,
10864,
511,
9,
199,
36,
310,
370,
314,
22633,
402,
3055,
27609,
12,
314,
2058,
687,
642,
1929,
2005,
11779,
199,
21533,
425,
14,
199,
624,
199,
199,
646,
8691,
199,
646,
1059,
199,
646,
3873,
199,
646,
984,
421,
199,
318,
1255,
8,
1760,
12,
2449,
63,
745,
29,
797,
304,
272,
870,
298,
5720,
26,
450,
83,
2,
450,
2088,
272,
1559,
275,
3873,
14,
7942,
8,
1760,
12,
3839,
29,
5781,
14,
6089,
12,
4635,
29,
5781,
14,
6089,
12,
2574,
5218,
29,
549,
9,
272,
1559,
14,
2573,
342,
272,
340,
1559,
14,
9913,
1137,
378,
436,
440,
2449,
63,
745,
26,
267,
870,
298,
1918,
3432,
1414,
15745,
543,
376,
1125,
2122,
267,
984,
14,
2224,
8,
1113,
14,
9913,
9,
272,
372,
1559,
14,
2703,
14,
739,
342,
421,
199,
318,
2446,
837,
272,
4503,
275,
408,
272,
15650,
367,
7907,
340,
282,
3371,
6952,
282,
10864,
511,
14,
339,
11028,
26,
450,
6595,
359,
1419,
61,
624,
272,
1798,
275,
8691,
14,
14553,
8,
3807,
9,
272,
1798,
14,
525,
63,
1422,
6096,
82,
401,
4320,
8578,
401,
2053,
628,
8578,
401,
1993,
1720,
628,
836,
11133,
11248,
1329,
370,
511,
531,
272,
334,
1419,
12,
1249,
9,
275,
1798,
14,
1122,
63,
589,
342,
272,
340,
1511,
14,
8578,
26,
267,
3379,
63,
4694,
275,
1255,
480,
3187,
6822,
13,
1122,
1553,
31349,
13,
1121,
13053,
531,
267,
1255,
480,
3187,
11248,
446,
68,
450,
83,
2,
450,
1511,
14,
8578,
9,
272,
587,
26,
267,
870,
1689,
889,
486,
281,
11133,
11248,
1329,
2013,
12,
3879,
641,
8839,
5532,
2,
2049,
298,
265,
1453,
5246,
2685,
339,
511,
63,
12243,
275,
756,
339,
327,
1255,
892,
2295,
543,
2269,
1233,
272,
1255,
480,
3187,
15243,
13053,
62,
5913,
531,
272,
1255,
480,
3187,
15243,
13053,
5913,
15,
2219,
531,
339,
327,
10405,
1314,
2295,
1172,
2896,
272,
2295,
275,
1255,
480,
3187,
704,
693,
618,
68,
1553,
908,
29,
265,
32347,
446,
17,
1204,
20595,
8441,
6765,
15,
2219,
4451,
298,
355,
15733,
10415,
446,
70,
18,
3471,
1294,
342,
272,
511,
63,
513,
275,
942,
272,
367,
511,
315,
2295,
26,
267,
511,
63,
513,
14,
740,
8,
875,
14,
1814,
8,
396,
59,
16,
6809,
19,
467,
17220,
1987,
1333,
339,
340,
511,
63,
513,
508,
18410,
267,
511,
63,
12243,
275,
756,
267,
4282,
63,
5328,
275,
3087,
272,
587,
26,
267,
327,
1255,
892,
2295,
12,
4282,
3062,
370,
2449,
267,
4282,
63,
5328,
275,
1255,
9313,
475,
88,
446,
69,
647,
1465,
450,
83,
499,
18181,
17,
2,
450,
1059,
14,
904,
8,
396,
63,
513,
1826,
2490,
2449,
63,
745,
29,
549,
9,
267,
340,
298,
12299,
334,
344,
628,
315,
4282,
63,
5328,
26,
288,
511,
63,
12243,
275,
715,
339,
327,
9058,
272,
1255,
480,
3187,
15243,
13053,
5913,
531,
272,
340,
1511,
14,
8578,
26,
267,
892,
63,
4694,
275,
1255,
480,
3187,
2004,
1204,
4854,
446,
17,
1204,
10415,
446,
68,
283,
283,
446,
70,
841,
531,
267,
1255,
480,
3187,
15243,
450,
83,
2,
450,
3379,
63,
4694,
9,
267,
1255,
480,
3187,
5246,
446,
36,
450,
83,
2,
450,
892,
63,
4694,
9,
339,
870,
4282,
63,
5328,
272,
870,
3087,
272,
870,
298,
30948,
1116,
9153,
2,
272,
340,
511,
63,
12243,
26,
267,
870,
298,
13945,
282,
10864,
511,
2,
272,
587,
26,
267,
870,
298,
2826,
10864,
511,
2,
267,
984,
14,
2224,
8,
17,
9,
421,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
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,
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,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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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
rghe/ansible | test/runner/lib/sanity/sanity_docs.py | 78 | 1312 | """Sanity test for documentation of sanity tests."""
from __future__ import absolute_import, print_function
import os
from lib.sanity import (
SanitySingleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
sanity_get_tests,
)
from lib.config import (
SanityConfig,
)
class SanityDocsTest(SanitySingleVersion):
"""Sanity test for documentation of sanity tests."""
# noinspection PyUnusedLocal
def test(self, args, targets): # pylint: disable=locally-disabled, unused-argument
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: TestResult
"""
sanity_dir = 'docs/docsite/rst/dev_guide/testing/sanity'
sanity_docs = set(part[0] for part in (os.path.splitext(name) for name in os.listdir(sanity_dir)) if part[1] == '.rst')
sanity_tests = set(sanity_test.name for sanity_test in sanity_get_tests())
missing = sanity_tests - sanity_docs
results = []
results += [SanityMessage(
message='missing docs for ansible-test sanity --test %s' % r,
path=os.path.join(sanity_dir, '%s.rst' % r),
) for r in sorted(missing)]
if results:
return SanityFailure(self.name, messages=results)
return SanitySuccess(self.name)
| gpl-3.0 | [
624,
25901,
511,
367,
3794,
402,
16740,
2295,
1041,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
870,
63,
1593,
199,
199,
646,
747,
199,
199,
504,
1973,
14,
21614,
492,
334,
272,
22111,
7200,
3353,
12,
272,
22111,
2209,
12,
272,
22111,
6782,
12,
272,
22111,
8300,
12,
272,
16740,
63,
362,
63,
2219,
12,
199,
9,
199,
199,
504,
1973,
14,
888,
492,
334,
272,
22111,
2028,
12,
199,
9,
421,
199,
533,
22111,
3768,
26935,
8,
25901,
7200,
3353,
304,
272,
408,
25901,
511,
367,
3794,
402,
16740,
2295,
1041,
272,
327,
30870,
1611,
20782,
5339,
272,
347,
511,
8,
277,
12,
1249,
12,
4545,
304,
221,
327,
4287,
26,
3507,
29,
31294,
13,
7011,
12,
9563,
13,
2094,
267,
408,
267,
520,
466,
1249,
26,
22111,
2028,
267,
520,
466,
4545,
26,
22111,
14126,
267,
520,
4500,
26,
23795,
267,
408,
267,
16740,
63,
694,
275,
283,
4757,
15,
1301,
2124,
15,
8332,
15,
2374,
63,
17348,
15,
4776,
15,
21614,
7,
267,
16740,
63,
4757,
275,
663,
8,
2064,
59,
16,
61,
367,
1777,
315,
334,
736,
14,
515,
14,
7973,
8,
354,
9,
367,
536,
315,
747,
14,
7374,
8,
21614,
63,
694,
430,
340,
1777,
59,
17,
61,
508,
1987,
8332,
358,
267,
16740,
63,
2219,
275,
663,
8,
21614,
63,
396,
14,
354,
367,
16740,
63,
396,
315,
16740,
63,
362,
63,
2219,
1012,
398,
4124,
275,
16740,
63,
2219,
446,
16740,
63,
4757,
398,
2058,
275,
942,
398,
2058,
847,
359,
25901,
2209,
8,
288,
1245,
534,
4752,
9149,
367,
3242,
13,
396,
16740,
1553,
396,
450,
83,
7,
450,
519,
12,
288,
931,
29,
736,
14,
515,
14,
904,
8,
21614,
63,
694,
12,
1543,
83,
14,
8332,
7,
450,
519,
395,
267,
776,
367,
519,
315,
3355,
8,
4752,
1874,
398,
340,
2058,
26,
288,
372,
22111,
6782,
8,
277,
14,
354,
12,
3788,
29,
2604,
9,
398,
372,
22111,
8300,
8,
277,
14,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
25901,
511,
367,
3794,
402,
16740,
2295,
1041,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
870,
63,
1593,
199,
199,
646,
747,
199,
199,
504,
1973,
14,
21614,
492,
334,
272,
22111,
7200,
3353,
12,
272,
22111,
2209,
12,
272,
22111,
6782,
12,
272,
22111,
8300,
12,
272,
16740,
63,
362,
63,
2219,
12,
199,
9,
199,
199,
504,
1973,
14,
888,
492,
334,
272,
22111,
2028,
12,
199,
9,
421,
199,
533,
22111,
3768,
26935,
8,
25901,
7200,
3353,
304,
272,
408,
25901,
511,
367,
3794,
402,
16740,
2295,
1041,
272,
327,
30870,
1611,
20782,
5339,
272,
347,
511,
8,
277,
12,
1249,
12,
4545,
304,
221,
327,
4287,
26,
3507,
29,
31294,
13,
7011,
12,
9563,
13,
2094,
267,
408,
267,
520,
466,
1249,
26,
22111,
2028,
267,
520,
466,
4545,
26,
22111,
14126,
267,
520,
4500,
26,
23795,
267,
408,
267,
16740,
63,
694,
275,
283,
4757,
15,
1301,
2124,
15,
8332,
15,
2374,
63,
17348,
15,
4776,
15,
21614,
7,
267,
16740,
63,
4757,
275,
663,
8,
2064,
59,
16,
61,
367,
1777,
315,
334,
736,
14,
515,
14,
7973,
8,
354,
9,
367,
536,
315,
747,
14,
7374,
8,
21614,
63,
694,
430,
340,
1777,
59,
17,
61,
508,
1987,
8332,
358,
267,
16740,
63,
2219,
275,
663,
8,
21614,
63,
396,
14,
354,
367,
16740,
63,
396,
315,
16740,
63,
362,
63,
2219,
1012,
398,
4124,
275,
16740,
63,
2219,
446,
16740,
63,
4757,
398,
2058,
275,
942,
398,
2058,
847,
359,
25901,
2209,
8,
288,
1245,
534,
4752,
9149,
367,
3242,
13,
396,
16740,
1553,
396,
450,
83,
7,
450,
519,
12,
288,
931,
29,
736,
14,
515,
14,
904,
8,
21614,
63,
694,
12,
1543,
83,
14,
8332,
7,
450,
519,
395,
267,
776,
367,
519,
315,
3355,
8,
4752,
1874,
398,
340,
2058,
26,
288,
372,
22111,
6782,
8,
277,
14,
354,
12,
3788,
29,
2604,
9,
398,
372,
22111,
8300,
8,
277,
14,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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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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
] |
DazWorrall/ansible | hacking/report.py | 46 | 6657 | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""A tool to aggregate data about Ansible source and testing into a sqlite DB for reporting."""
from __future__ import (absolute_import, print_function)
import argparse
import os
import requests
import sqlite3
import sys
DATABASE_PATH = os.path.expanduser('~/.ansible/report.db')
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) + '/'
ANSIBLE_PATH = os.path.join(BASE_PATH, 'lib')
ANSIBLE_TEST_PATH = os.path.join(BASE_PATH, 'test/runner')
if ANSIBLE_PATH not in sys.path:
sys.path.insert(0, ANSIBLE_PATH)
if ANSIBLE_TEST_PATH not in sys.path:
sys.path.insert(0, ANSIBLE_TEST_PATH)
from ansible.parsing.metadata import extract_metadata
from lib.target import walk_integration_targets
def main():
os.chdir(BASE_PATH)
args = parse_args()
args.func()
def parse_args():
try:
import argcomplete
except ImportError:
argcomplete = None
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(metavar='COMMAND')
subparsers.required = True # work-around for python 3 bug which makes subparsers optional
populate = subparsers.add_parser('populate',
help='populate report database')
populate.set_defaults(func=populate_database)
query = subparsers.add_parser('query',
help='query report database')
query.set_defaults(func=query_database)
if argcomplete:
argcomplete.autocomplete(parser)
args = parser.parse_args()
return args
def query_database():
if not os.path.exists(DATABASE_PATH):
exit('error: Database not found. Did you run `report.py populate` first?')
os.execvp('sqlite3', ('sqlite3', DATABASE_PATH))
def populate_database():
populate_modules()
populate_coverage()
populate_integration_targets()
def populate_modules():
module_dir = os.path.join(BASE_PATH, 'lib/ansible/modules/')
modules_rows = []
module_statuses_rows = []
for root, dir_names, file_names in os.walk(module_dir):
for file_name in file_names:
module, extension = os.path.splitext(file_name)
if module == '__init__' or extension != '.py':
continue
if module.startswith('_'):
module = module[1:]
namespace = os.path.join(root.replace(module_dir, '')).replace('/', '.')
path = os.path.join(root, file_name)
with open(path, 'rb') as module_fd:
module_data = module_fd.read()
result = extract_metadata(module_data=module_data)
metadata = result[0]
if not metadata:
if module == 'async_wrapper':
continue
raise Exception('no metadata for: %s' % path)
modules_rows.append(dict(
module=module,
namespace=namespace,
path=path.replace(BASE_PATH, ''),
supported_by=metadata['supported_by'],
))
for status in metadata['status']:
module_statuses_rows.append(dict(
module=module,
status=status,
))
populate_data(dict(
modules=dict(
rows=modules_rows,
schema=(
('module', 'TEXT'),
('namespace', 'TEXT'),
('path', 'TEXT'),
('supported_by', 'TEXT'),
)),
module_statuses=dict(
rows=module_statuses_rows,
schema=(
('module', 'TEXT'),
('status', 'TEXT'),
)),
))
def populate_coverage():
response = requests.get('https://codecov.io/api/gh/ansible/ansible/tree/devel/?src=extension')
data = response.json()
files = data['commit']['report']['files']
coverage_rows = []
for path, data in files.items():
report = data['t']
coverage_rows.append(dict(
path=path,
coverage=float(report['c']),
lines=report['n'],
hit=report['h'],
partial=report['p'],
missed=report['m'],
))
populate_data(dict(
coverage=dict(
rows=coverage_rows,
schema=(
('path', 'TEXT'),
('coverage', 'REAL'),
('lines', 'INTEGER'),
('hit', 'INTEGER'),
('partial', 'INTEGER'),
('missed', 'INTEGER'),
)),
))
def populate_integration_targets():
targets = list(walk_integration_targets())
integration_targets_rows = [dict(
target=target.name,
type=target.type,
path=target.path,
script_path=target.script_path,
) for target in targets]
integration_target_aliases_rows = [dict(
target=target.name,
alias=alias,
) for target in targets for alias in target.aliases]
integration_target_modules_rows = [dict(
target=target.name,
module=module,
) for target in targets for module in target.modules]
populate_data(dict(
integration_targets=dict(
rows=integration_targets_rows,
schema=(
('target', 'TEXT'),
('type', 'TEXT'),
('path', 'TEXT'),
('script_path', 'TEXT'),
)),
integration_target_aliases=dict(
rows=integration_target_aliases_rows,
schema=(
('target', 'TEXT'),
('alias', 'TEXT'),
)),
integration_target_modules=dict(
rows=integration_target_modules_rows,
schema=(
('target', 'TEXT'),
('module', 'TEXT'),
)),
))
def create_table(cursor, name, columns):
schema = ', '.join('%s %s' % column for column in columns)
cursor.execute('DROP TABLE IF EXISTS %s' % name)
cursor.execute('CREATE TABLE %s (%s)' % (name, schema))
def populate_table(cursor, rows, name, columns):
create_table(cursor, name, columns)
values = ', '.join([':%s' % column[0] for column in columns])
for row in rows:
cursor.execute('INSERT INTO %s VALUES (%s)' % (name, values), row)
def populate_data(data):
connection = sqlite3.connect(DATABASE_PATH)
cursor = connection.cursor()
for table in data:
populate_table(cursor, data[table]['rows'], table, data[table]['schema'])
connection.commit()
connection.close()
if __name__ == '__main__':
main()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
18280,
63,
11611,
15558,
63,
3593,
199,
624,
33,
4744,
370,
9531,
666,
3595,
2622,
1350,
436,
5343,
1901,
282,
11723,
6249,
367,
17290,
1041,
199,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
870,
63,
1593,
9,
199,
199,
646,
7534,
199,
646,
747,
199,
646,
4145,
199,
646,
11723,
19,
199,
646,
984,
199,
199,
17873,
63,
3243,
275,
747,
14,
515,
14,
12131,
21114,
8083,
4853,
15,
3070,
14,
697,
358,
199,
5825,
63,
3243,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
904,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
22159,
11541,
1333,
435,
7324,
199,
8490,
63,
3243,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
773,
358,
199,
8490,
63,
2864,
63,
3243,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
396,
15,
5933,
358,
199,
199,
692,
32271,
7187,
63,
3243,
440,
315,
984,
14,
515,
26,
272,
984,
14,
515,
14,
3176,
8,
16,
12,
32271,
7187,
63,
3243,
9,
199,
199,
692,
32271,
7187,
63,
2864,
63,
3243,
440,
315,
984,
14,
515,
26,
272,
984,
14,
515,
14,
3176,
8,
16,
12,
32271,
7187,
63,
2864,
63,
3243,
9,
199,
199,
504,
3242,
14,
11059,
14,
2343,
492,
5536,
63,
2343,
199,
504,
1973,
14,
1375,
492,
12778,
63,
15092,
63,
4684,
421,
199,
318,
2446,
837,
272,
747,
14,
8563,
8,
5825,
63,
3243,
9,
339,
1249,
275,
2198,
63,
589,
342,
272,
1249,
14,
1532,
342,
421,
199,
318,
2198,
63,
589,
837,
272,
862,
26,
267,
492,
1680,
4883,
272,
871,
3545,
26,
267,
1680,
4883,
275,
488,
339,
1798,
275,
7534,
14,
10730,
342,
339,
26763,
275,
1798,
14,
525,
63,
954,
11531,
8,
23303,
534,
10761,
358,
272,
26763,
14,
2427,
275,
715,
221,
327,
1736,
13,
11659,
367,
2366,
650,
6519,
1314,
7704,
26763,
2716,
339,
13904,
275,
26763,
14,
525,
63,
2087,
360,
13817,
297,
3660,
1720,
534,
13817,
3622,
3050,
358,
339,
13904,
14,
409,
63,
4322,
8,
1532,
29,
13817,
63,
4659,
9,
339,
1827,
275,
26763,
14,
525,
63,
2087,
360,
1131,
297,
3303,
1720,
534,
1131,
3622,
3050,
358,
339,
1827,
14,
409,
63,
4322,
8,
1532,
29,
1131,
63,
4659,
9,
339,
340,
1680,
4883,
26,
267,
1680,
4883,
14,
29695,
8,
2087,
9,
339,
1249,
275,
1798,
14,
1122,
63,
589,
342,
339,
372,
1249,
421,
199,
318,
1827,
63,
4659,
837,
272,
340,
440,
747,
14,
515,
14,
2444,
8,
17873,
63,
3243,
304,
267,
4458,
360,
705,
26,
8692,
440,
1911,
14,
29503,
1265,
1255,
658,
3070,
14,
647,
13904,
64,
1642,
18478,
339,
747,
14,
1628,
11702,
360,
10659,
19,
297,
661,
10659,
19,
297,
31705,
63,
3243,
430,
421,
199,
318,
13904,
63,
4659,
837,
272,
13904,
63,
3112,
342,
272,
13904,
63,
10828,
342,
272,
13904,
63,
15092,
63,
4684,
342,
421,
199,
318,
13904,
63,
3112,
837,
272,
859,
63,
694,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
773,
15,
4853,
15,
3112,
6217,
339,
4621,
63,
3838,
275,
942,
272,
859,
63,
17084,
63,
3838,
275,
942,
339,
367,
1738,
12,
2935,
63,
1247,
12,
570,
63,
1247,
315,
747,
14,
7757,
8,
578,
63,
694,
304,
267,
367,
570,
63,
354,
315,
570,
63,
1247,
26,
288,
859,
12,
3329,
275,
747,
14,
515,
14,
7973,
8,
493,
63,
354,
9,
953,
340,
859,
508,
2560,
826,
12217,
503,
3329,
1137,
1987,
647,
356,
355,
1980,
953,
340,
859,
14,
2460,
30018,
355,
859,
275,
859,
59,
17,
2938,
953,
3231,
275,
747,
14,
515,
14,
904,
8,
1231,
14,
1814,
8,
578,
63,
694,
12,
4074,
680,
1814,
10998,
20093,
953,
931,
275,
747,
14,
515,
14,
904,
8,
1231,
12,
570,
63,
354,
9,
953,
543,
1551,
8,
515,
12,
283,
4848,
358,
465,
859,
63,
2592,
26,
355,
859,
63,
576,
275,
859,
63,
2592,
14,
739,
342,
953,
754,
275,
5536,
63,
2343,
8,
578,
63,
576,
29,
578,
63,
576,
9,
953,
3341,
275,
754,
59,
16,
61,
953,
340,
440,
3341,
26,
355,
340,
859,
508,
283,
4146,
63,
5029,
356,
490,
1980,
2234,
746,
2186,
360,
889,
3341,
367,
26,
450,
83,
7,
450,
931,
9,
953,
4621,
63,
3838,
14,
740,
8,
807,
8,
355,
859,
29,
578,
12,
355,
3231,
29,
3251,
12,
355,
931,
29,
515,
14,
1814,
8,
5825,
63,
3243,
12,
9929,
355,
3748,
63,
991,
29,
2343,
459,
4946,
63,
991,
995,
288,
5082,
953,
367,
2004,
315,
3341,
459,
1205,
2565,
355,
859,
63,
17084,
63,
3838,
14,
740,
8,
807,
8,
490,
859,
29,
578,
12,
490,
2004,
29,
1205,
12,
355,
5082,
339,
13904,
63,
576,
8,
807,
8,
267,
4621,
29,
807,
8,
288,
4730,
29,
3112,
63,
3838,
12,
288,
4177,
2687,
355,
661,
578,
297,
283,
3876,
659,
355,
661,
3251,
297,
283,
3876,
659,
355,
661,
515,
297,
283,
3876,
659,
355,
661,
4946,
63,
991,
297,
283,
3876,
659,
288,
22583,
267,
859,
63,
17084,
29,
807,
8,
288,
4730,
29,
578,
63,
17084,
63,
3838,
12,
288,
4177,
2687,
355,
661,
578,
297,
283,
3876,
659,
355,
661,
1205,
297,
283,
3876,
659,
288,
22583,
272,
5082,
421,
199,
318,
13904,
63,
10828,
837,
272,
1177,
275,
4145,
14,
362,
360,
2859,
921,
600,
8695,
14,
2308,
15,
1246,
15,
3561,
15,
4853,
15,
4853,
15,
2350,
15,
27870,
10197,
2164,
29,
3435,
358,
272,
666,
275,
1177,
14,
1001,
342,
272,
1584,
275,
666,
459,
3543,
2545,
3070,
2545,
1725,
418,
272,
11745,
63,
3838,
275,
942,
339,
367,
931,
12,
666,
315,
1584,
14,
1744,
837,
267,
3622,
275,
666,
459,
84,
418,
267,
11745,
63,
3838,
14,
740,
8,
807,
8,
288,
931,
29,
515,
12,
288,
11745,
29,
1609,
8,
3070,
459,
67,
3815,
288,
2385,
29,
3070,
459,
78,
995,
288,
9793,
29,
3070,
459,
72,
995,
288,
7417,
29,
3070,
459,
80,
995,
288,
3201,
939,
29,
3070,
459,
77
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
3,
18280,
63,
11611,
15558,
63,
3593,
199,
624,
33,
4744,
370,
9531,
666,
3595,
2622,
1350,
436,
5343,
1901,
282,
11723,
6249,
367,
17290,
1041,
199,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
870,
63,
1593,
9,
199,
199,
646,
7534,
199,
646,
747,
199,
646,
4145,
199,
646,
11723,
19,
199,
646,
984,
199,
199,
17873,
63,
3243,
275,
747,
14,
515,
14,
12131,
21114,
8083,
4853,
15,
3070,
14,
697,
358,
199,
5825,
63,
3243,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
904,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
22159,
11541,
1333,
435,
7324,
199,
8490,
63,
3243,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
773,
358,
199,
8490,
63,
2864,
63,
3243,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
396,
15,
5933,
358,
199,
199,
692,
32271,
7187,
63,
3243,
440,
315,
984,
14,
515,
26,
272,
984,
14,
515,
14,
3176,
8,
16,
12,
32271,
7187,
63,
3243,
9,
199,
199,
692,
32271,
7187,
63,
2864,
63,
3243,
440,
315,
984,
14,
515,
26,
272,
984,
14,
515,
14,
3176,
8,
16,
12,
32271,
7187,
63,
2864,
63,
3243,
9,
199,
199,
504,
3242,
14,
11059,
14,
2343,
492,
5536,
63,
2343,
199,
504,
1973,
14,
1375,
492,
12778,
63,
15092,
63,
4684,
421,
199,
318,
2446,
837,
272,
747,
14,
8563,
8,
5825,
63,
3243,
9,
339,
1249,
275,
2198,
63,
589,
342,
272,
1249,
14,
1532,
342,
421,
199,
318,
2198,
63,
589,
837,
272,
862,
26,
267,
492,
1680,
4883,
272,
871,
3545,
26,
267,
1680,
4883,
275,
488,
339,
1798,
275,
7534,
14,
10730,
342,
339,
26763,
275,
1798,
14,
525,
63,
954,
11531,
8,
23303,
534,
10761,
358,
272,
26763,
14,
2427,
275,
715,
221,
327,
1736,
13,
11659,
367,
2366,
650,
6519,
1314,
7704,
26763,
2716,
339,
13904,
275,
26763,
14,
525,
63,
2087,
360,
13817,
297,
3660,
1720,
534,
13817,
3622,
3050,
358,
339,
13904,
14,
409,
63,
4322,
8,
1532,
29,
13817,
63,
4659,
9,
339,
1827,
275,
26763,
14,
525,
63,
2087,
360,
1131,
297,
3303,
1720,
534,
1131,
3622,
3050,
358,
339,
1827,
14,
409,
63,
4322,
8,
1532,
29,
1131,
63,
4659,
9,
339,
340,
1680,
4883,
26,
267,
1680,
4883,
14,
29695,
8,
2087,
9,
339,
1249,
275,
1798,
14,
1122,
63,
589,
342,
339,
372,
1249,
421,
199,
318,
1827,
63,
4659,
837,
272,
340,
440,
747,
14,
515,
14,
2444,
8,
17873,
63,
3243,
304,
267,
4458,
360,
705,
26,
8692,
440,
1911,
14,
29503,
1265,
1255,
658,
3070,
14,
647,
13904,
64,
1642,
18478,
339,
747,
14,
1628,
11702,
360,
10659,
19,
297,
661,
10659,
19,
297,
31705,
63,
3243,
430,
421,
199,
318,
13904,
63,
4659,
837,
272,
13904,
63,
3112,
342,
272,
13904,
63,
10828,
342,
272,
13904,
63,
15092,
63,
4684,
342,
421,
199,
318,
13904,
63,
3112,
837,
272,
859,
63,
694,
275,
747,
14,
515,
14,
904,
8,
5825,
63,
3243,
12,
283,
773,
15,
4853,
15,
3112,
6217,
339,
4621,
63,
3838,
275,
942,
272,
859,
63,
17084,
63,
3838,
275,
942,
339,
367,
1738,
12,
2935,
63,
1247,
12,
570,
63,
1247,
315,
747,
14,
7757,
8,
578,
63,
694,
304,
267,
367,
570,
63,
354,
315,
570,
63,
1247,
26,
288,
859,
12,
3329,
275,
747,
14,
515,
14,
7973,
8,
493,
63,
354,
9,
953,
340,
859,
508,
2560,
826,
12217,
503,
3329,
1137,
1987,
647,
356,
355,
1980,
953,
340,
859,
14,
2460,
30018,
355,
859,
275,
859,
59,
17,
2938,
953,
3231,
275,
747,
14,
515,
14,
904,
8,
1231,
14,
1814,
8,
578,
63,
694,
12,
4074,
680,
1814,
10998,
20093,
953,
931,
275,
747,
14,
515,
14,
904,
8,
1231,
12,
570,
63,
354,
9,
953,
543,
1551,
8,
515,
12,
283,
4848,
358,
465,
859,
63,
2592,
26,
355,
859,
63,
576,
275,
859,
63,
2592,
14,
739,
342,
953,
754,
275,
5536,
63,
2343,
8,
578,
63,
576,
29,
578,
63,
576,
9,
953,
3341,
275,
754,
59,
16,
61,
953,
340,
440,
3341,
26,
355,
340,
859,
508,
283,
4146,
63,
5029,
356,
490,
1980,
2234,
746,
2186,
360,
889,
3341,
367,
26,
450,
83,
7,
450,
931,
9,
953,
4621,
63,
3838,
14,
740,
8,
807,
8,
355,
859,
29,
578,
12,
355,
3231,
29,
3251,
12,
355,
931,
29,
515,
14,
1814,
8,
5825,
63,
3243,
12,
9929,
355,
3748,
63,
991,
29,
2343,
459,
4946,
63,
991,
995,
288,
5082,
953,
367,
2004,
315,
3341,
459,
1205,
2565,
355,
859,
63,
17084,
63,
3838,
14,
740,
8,
807,
8,
490,
859,
29,
578,
12,
490,
2004,
29,
1205,
12,
355,
5082,
339,
13904,
63,
576,
8,
807,
8,
267,
4621,
29,
807,
8,
288,
4730,
29,
3112,
63,
3838,
12,
288,
4177,
2687,
355,
661,
578,
297,
283,
3876,
659,
355,
661,
3251,
297,
283,
3876,
659,
355,
661,
515,
297,
283,
3876,
659,
355,
661,
4946,
63,
991,
297,
283,
3876,
659,
288,
22583,
267,
859,
63,
17084,
29,
807,
8,
288,
4730,
29,
578,
63,
17084,
63,
3838,
12,
288,
4177,
2687,
355,
661,
578,
297,
283,
3876,
659,
355,
661,
1205,
297,
283,
3876,
659,
288,
22583,
272,
5082,
421,
199,
318,
13904,
63,
10828,
837,
272,
1177,
275,
4145,
14,
362,
360,
2859,
921,
600,
8695,
14,
2308,
15,
1246,
15,
3561,
15,
4853,
15,
4853,
15,
2350,
15,
27870,
10197,
2164,
29,
3435,
358,
272,
666,
275,
1177,
14,
1001,
342,
272,
1584,
275,
666,
459,
3543,
2545,
3070,
2545,
1725,
418,
272,
11745,
63,
3838,
275,
942,
339,
367,
931,
12,
666,
315,
1584,
14,
1744,
837,
267,
3622,
275,
666,
459,
84,
418,
267,
11745,
63,
3838,
14,
740,
8,
807,
8,
288,
931,
29,
515,
12,
288,
11745,
29,
1609,
8,
3070,
459,
67,
3815,
288,
2385,
29,
3070,
459,
78,
995,
288,
9793,
29,
3070,
459,
72,
995,
288,
7417,
29,
3070,
459,
80,
995,
288,
3201,
939,
29,
3070,
459,
77,
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,
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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
] |
nohe427/developer-support | arcsde-sql/python/create-sdo-geometry-golden-ratio/golden.py | 10 | 2731 | """
In Oracle 12c, using the SDO Geometry type, this script will create the
polygons from the golden ratio spiral.
Authors:
Danny B
-- original concept and code
-- added and subtracted coordinates to generate new polygons
Ashley S
-- cleared up rough spots by using phi to create perfect squares
-- translated code to use SDO Geometry instead of arcpy geometry
Tested in Python 2.7 32 bit
"""
#Change these two parameters
uin ="golden" #Table name
connection ="connectionstring" #connection, i.e. "dataowner/dataowner@instance/sid
import cx_Oracle
print("Creating connection and cursor")
db = cx_Oracle.connect(connection)
cursor = db.cursor();
print("Creating table")
cursor.execute("""
CREATE TABLE {0}(
FID INTEGER GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1,
SHAPE SDO_GEOMETRY)
""".format(uin))
m = 100
phi0 = (1 + 5 ** 0.5) /2
feature_info = [[[0,0], [0,1*m], [1*m, 1*m], [1*m, 0]]]
count = 1
exponent = 1
print("Doing some math")
for i in range(24):
phi = (1.0/(phi0**exponent))*m
a, b = feature_info[-1][2]
a_plus = a + phi
a_minus = a - phi
b_plus = b + phi
b_minus = b - phi
if count == 1:
coord = [[a, b], [a_plus, b], [a_plus, b_minus], [a, b_minus]]
elif count == 2:
coord = [[a, b], [a, b_minus], [a_minus, b_minus], [a_minus, b]]
elif count == 3:
coord = [[a, b], [a_minus, b], [a_minus, b_plus], [a, b_plus]]
else:
coord = [[a, b], [a, b_plus], [a_plus, b_plus], [a_plus, b]]
feature_info.append(coord)
count += 1
exponent += 1
if count == 5: count = 1
print("Inserting coordinates")
for coord in feature_info:
coord2 = "{0},{1}, {2},{3}, {4},{5}, {6},{7}, {0},{1}".format(
coord[0][0], coord[0][1], coord[1][0], coord[1][1], coord[2][0],
coord[2][1], coord[3][0], coord[3][1])
sdogeometry = """SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_ORDINATE_ARRAY({0}))""".format(coord2)
statement = "INSERT INTO {0} ( SHAPE ) VALUES ( {1} )".format(uin, sdogeometry)
cursor.execute(statement)
db.commit()
print("Adding to user_sdo_geom_metadata")
cursor.execute("""
INSERT INTO user_sdo_geom_metadata
(TABLE_NAME,
COLUMN_NAME,
DIMINFO,
SRID)
VALUES ('{0}', 'shape',
SDO_DIM_ARRAY( -- 600X600 grid
SDO_DIM_ELEMENT('X', 0, 200, 0.0000001),
SDO_DIM_ELEMENT('Y', 0, 200, 0.0000001)
),
NULL)
""".format(uin))
print("Making the spatial index")
cursor.execute("""CREATE INDEX {0}_spatial_idx ON {0}(SHAPE) INDEXTYPE IS MDSYS.SPATIAL_INDEX""".format(uin))
db.commit()
cursor.close()
db.close()
print("Check the table!")
| apache-2.0 | [
624,
199,
607,
15309,
3144,
67,
12,
1808,
314,
428,
1649,
10579,
730,
12,
642,
2884,
911,
1218,
314,
199,
2515,
18067,
687,
314,
17631,
10463,
2249,
723,
279,
14,
199,
199,
2817,
1384,
26,
272,
577,
1189,
89,
699,
267,
1553,
3379,
19834,
436,
1233,
267,
1553,
3483,
436,
1007,
1239,
1522,
8983,
370,
3550,
892,
30658,
272,
437,
609,
15515,
428,
267,
1553,
20518,
1536,
28568,
2249,
16673,
701,
1808,
14524,
370,
1218,
23668,
26170,
267,
1553,
14598,
1233,
370,
675,
428,
1649,
10579,
3140,
402,
31302,
3400,
199,
199,
52,
3505,
315,
2018,
499,
14,
23,
4337,
4546,
199,
624,
199,
199,
3,
4001,
3520,
2877,
2633,
199,
85,
262,
29049,
19440,
2,
327,
3186,
536,
199,
2105,
29049,
2105,
875,
2,
327,
2105,
12,
284,
14,
69,
14,
298,
576,
4597,
15,
576,
4597,
32,
842,
15,
4148,
199,
199,
646,
17280,
63,
21202,
199,
199,
1361,
480,
14380,
1950,
436,
3920,
531,
199,
697,
275,
17280,
63,
21202,
14,
2242,
8,
2105,
9,
199,
3937,
275,
1592,
14,
3937,
7303,
199,
199,
1361,
480,
14380,
1817,
531,
199,
3937,
14,
2526,
4852,
272,
16999,
9934,
469,
16,
22999,
267,
481,
998,
17086,
29087,
6989,
12112,
26194,
4319,
2870,
13630,
13910,
1663,
413,
1621,
31431,
6515,
413,
12,
267,
4410,
25380,
428,
1649,
63,
28472,
9,
272,
30512,
908,
8,
85,
262,
430,
199,
199,
77,
275,
2948,
199,
10909,
16,
275,
334,
17,
435,
959,
1011,
378,
14,
21,
9,
1182,
18,
199,
4445,
63,
815,
275,
19819,
16,
12,
16,
467,
359,
16,
12,
17,
10,
77,
467,
359,
17,
10,
77,
12,
413,
10,
77,
467,
359,
17,
10,
77,
12,
378,
20737,
199,
199,
835,
275,
413,
199,
23475,
275,
413,
199,
1361,
480,
2585,
316,
2005,
3473,
531,
199,
509,
284,
315,
1425,
8,
1194,
304,
272,
14524,
275,
334,
17,
14,
16,
7985,
10909,
16,
538,
23475,
19198,
77,
272,
282,
12,
330,
275,
3878,
63,
815,
1988,
17,
1527,
18,
61,
272,
282,
63,
6666,
275,
282,
435,
14524,
272,
282,
63,
13084,
275,
282,
446,
14524,
272,
330,
63,
6666,
275,
330,
435,
14524,
272,
330,
63,
13084,
275,
330,
446,
14524,
339,
340,
2338,
508,
413,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
63,
6666,
12,
330,
467,
359,
65,
63,
6666,
12,
330,
63,
13084,
467,
359,
65,
12,
330,
63,
13084,
2677,
272,
916,
2338,
508,
499,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
12,
330,
63,
13084,
467,
359,
65,
63,
13084,
12,
330,
63,
13084,
467,
359,
65,
63,
13084,
12,
330,
2677,
272,
916,
2338,
508,
650,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
63,
13084,
12,
330,
467,
359,
65,
63,
13084,
12,
330,
63,
6666,
467,
359,
65,
12,
330,
63,
6666,
2677,
272,
587,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
12,
330,
63,
6666,
467,
359,
65,
63,
6666,
12,
330,
63,
6666,
467,
359,
65,
63,
6666,
12,
330,
2677,
339,
3878,
63,
815,
14,
740,
8,
7988,
9,
339,
2338,
847,
413,
272,
16588,
847,
413,
339,
340,
2338,
508,
959,
26,
2338,
275,
413,
199,
199,
1361,
480,
9971,
316,
8983,
531,
199,
509,
11021,
315,
3878,
63,
815,
26,
339,
11021,
18,
275,
5310,
16,
31016,
17,
1386,
469,
18,
31016,
19,
1386,
469,
20,
31016,
21,
1386,
469,
22,
31016,
23,
1386,
469,
16,
31016,
17,
5469,
908,
8,
272,
11021,
59,
16,
1527,
16,
467,
11021,
59,
16,
1527,
17,
467,
11021,
59,
17,
1527,
16,
467,
11021,
59,
17,
1527,
17,
467,
11021,
59,
18,
1527,
16,
467,
272,
11021,
59,
18,
1527,
17,
467,
11021,
59,
19,
1527,
16,
467,
11021,
59,
19,
1527,
17,
566,
339,
308,
1117,
7660,
275,
408,
24399,
63,
28472,
8,
17919,
12,
8084,
12,
8084,
12,
24399,
63,
37,
25847,
63,
4531,
63,
12322,
8,
17,
12,
1960,
19,
12,
17,
395,
24399,
63,
3731,
568,
1951,
63,
12322,
2561,
16,
12466,
23045,
908,
8,
7988,
18,
9,
339,
5164,
275,
298,
10258,
12872,
469,
16,
93,
334,
4410,
25380,
776,
13992,
334,
469,
17,
93,
776,
1674,
908,
8,
85,
262,
12,
308,
1117,
7660,
9,
339,
3920,
14,
2526,
8,
6242,
9,
272,
1592,
14,
3543,
342,
199,
199,
1361,
480,
20897,
370,
922,
63,
83,
1117,
63,
6481,
63,
2343,
531,
199,
199,
3937,
14,
2526,
4852,
272,
22542,
12872,
922,
63,
83,
1117,
63,
6481,
63,
2343,
267,
334,
8723,
63,
2339,
12,
267,
29955,
63,
2339,
12,
267,
577,
1469,
4531,
12,
267,
22425,
9,
272,
13992,
661,
91,
16,
7293,
283,
1392,
297,
272,
428,
1649,
63,
19080,
63,
12322,
8,
257,
1553,
11624,
56,
6683,
6068,
267,
428,
1649,
63,
19080,
63,
12535,
360,
56,
297,
378,
12,
1926,
12,
378,
14,
3273,
17,
395,
267,
428,
1649,
63,
19080,
63,
12535,
360,
57,
297,
378,
12,
1926,
12,
378,
14,
3273,
17,
9,
267,
2318,
272,
5962,
9,
272,
30512,
908,
8,
85,
262,
430,
199,
199,
1361,
480,
45,
11124,
314,
11469,
1478,
531,
199,
199,
3937,
14,
2526,
4852,
8366,
17055,
469,
16,
12585,
11679,
63,
2996,
5258,
469,
16,
22999,
3234,
25380,
9,
17055,
2711,
2281,
603,
3177,
20238,
14,
51,
2805,
4938,
63,
10215,
23045,
908,
8,
85,
262,
430,
199,
199,
697,
14,
3543,
342,
199,
3937,
14,
1600,
342,
199,
697,
14,
1600,
342,
199,
199,
1361,
480,
1799,
314,
1817,
9124,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
199,
607,
15309,
3144,
67,
12,
1808,
314,
428,
1649,
10579,
730,
12,
642,
2884,
911,
1218,
314,
199,
2515,
18067,
687,
314,
17631,
10463,
2249,
723,
279,
14,
199,
199,
2817,
1384,
26,
272,
577,
1189,
89,
699,
267,
1553,
3379,
19834,
436,
1233,
267,
1553,
3483,
436,
1007,
1239,
1522,
8983,
370,
3550,
892,
30658,
272,
437,
609,
15515,
428,
267,
1553,
20518,
1536,
28568,
2249,
16673,
701,
1808,
14524,
370,
1218,
23668,
26170,
267,
1553,
14598,
1233,
370,
675,
428,
1649,
10579,
3140,
402,
31302,
3400,
199,
199,
52,
3505,
315,
2018,
499,
14,
23,
4337,
4546,
199,
624,
199,
199,
3,
4001,
3520,
2877,
2633,
199,
85,
262,
29049,
19440,
2,
327,
3186,
536,
199,
2105,
29049,
2105,
875,
2,
327,
2105,
12,
284,
14,
69,
14,
298,
576,
4597,
15,
576,
4597,
32,
842,
15,
4148,
199,
199,
646,
17280,
63,
21202,
199,
199,
1361,
480,
14380,
1950,
436,
3920,
531,
199,
697,
275,
17280,
63,
21202,
14,
2242,
8,
2105,
9,
199,
3937,
275,
1592,
14,
3937,
7303,
199,
199,
1361,
480,
14380,
1817,
531,
199,
3937,
14,
2526,
4852,
272,
16999,
9934,
469,
16,
22999,
267,
481,
998,
17086,
29087,
6989,
12112,
26194,
4319,
2870,
13630,
13910,
1663,
413,
1621,
31431,
6515,
413,
12,
267,
4410,
25380,
428,
1649,
63,
28472,
9,
272,
30512,
908,
8,
85,
262,
430,
199,
199,
77,
275,
2948,
199,
10909,
16,
275,
334,
17,
435,
959,
1011,
378,
14,
21,
9,
1182,
18,
199,
4445,
63,
815,
275,
19819,
16,
12,
16,
467,
359,
16,
12,
17,
10,
77,
467,
359,
17,
10,
77,
12,
413,
10,
77,
467,
359,
17,
10,
77,
12,
378,
20737,
199,
199,
835,
275,
413,
199,
23475,
275,
413,
199,
1361,
480,
2585,
316,
2005,
3473,
531,
199,
509,
284,
315,
1425,
8,
1194,
304,
272,
14524,
275,
334,
17,
14,
16,
7985,
10909,
16,
538,
23475,
19198,
77,
272,
282,
12,
330,
275,
3878,
63,
815,
1988,
17,
1527,
18,
61,
272,
282,
63,
6666,
275,
282,
435,
14524,
272,
282,
63,
13084,
275,
282,
446,
14524,
272,
330,
63,
6666,
275,
330,
435,
14524,
272,
330,
63,
13084,
275,
330,
446,
14524,
339,
340,
2338,
508,
413,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
63,
6666,
12,
330,
467,
359,
65,
63,
6666,
12,
330,
63,
13084,
467,
359,
65,
12,
330,
63,
13084,
2677,
272,
916,
2338,
508,
499,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
12,
330,
63,
13084,
467,
359,
65,
63,
13084,
12,
330,
63,
13084,
467,
359,
65,
63,
13084,
12,
330,
2677,
272,
916,
2338,
508,
650,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
63,
13084,
12,
330,
467,
359,
65,
63,
13084,
12,
330,
63,
6666,
467,
359,
65,
12,
330,
63,
6666,
2677,
272,
587,
26,
267,
11021,
275,
3474,
65,
12,
330,
467,
359,
65,
12,
330,
63,
6666,
467,
359,
65,
63,
6666,
12,
330,
63,
6666,
467,
359,
65,
63,
6666,
12,
330,
2677,
339,
3878,
63,
815,
14,
740,
8,
7988,
9,
339,
2338,
847,
413,
272,
16588,
847,
413,
339,
340,
2338,
508,
959,
26,
2338,
275,
413,
199,
199,
1361,
480,
9971,
316,
8983,
531,
199,
509,
11021,
315,
3878,
63,
815,
26,
339,
11021,
18,
275,
5310,
16,
31016,
17,
1386,
469,
18,
31016,
19,
1386,
469,
20,
31016,
21,
1386,
469,
22,
31016,
23,
1386,
469,
16,
31016,
17,
5469,
908,
8,
272,
11021,
59,
16,
1527,
16,
467,
11021,
59,
16,
1527,
17,
467,
11021,
59,
17,
1527,
16,
467,
11021,
59,
17,
1527,
17,
467,
11021,
59,
18,
1527,
16,
467,
272,
11021,
59,
18,
1527,
17,
467,
11021,
59,
19,
1527,
16,
467,
11021,
59,
19,
1527,
17,
566,
339,
308,
1117,
7660,
275,
408,
24399,
63,
28472,
8,
17919,
12,
8084,
12,
8084,
12,
24399,
63,
37,
25847,
63,
4531,
63,
12322,
8,
17,
12,
1960,
19,
12,
17,
395,
24399,
63,
3731,
568,
1951,
63,
12322,
2561,
16,
12466,
23045,
908,
8,
7988,
18,
9,
339,
5164,
275,
298,
10258,
12872,
469,
16,
93,
334,
4410,
25380,
776,
13992,
334,
469,
17,
93,
776,
1674,
908,
8,
85,
262,
12,
308,
1117,
7660,
9,
339,
3920,
14,
2526,
8,
6242,
9,
272,
1592,
14,
3543,
342,
199,
199,
1361,
480,
20897,
370,
922,
63,
83,
1117,
63,
6481,
63,
2343,
531,
199,
199,
3937,
14,
2526,
4852,
272,
22542,
12872,
922,
63,
83,
1117,
63,
6481,
63,
2343,
267,
334,
8723,
63,
2339,
12,
267,
29955,
63,
2339,
12,
267,
577,
1469,
4531,
12,
267,
22425,
9,
272,
13992,
661,
91,
16,
7293,
283,
1392,
297,
272,
428,
1649,
63,
19080,
63,
12322,
8,
257,
1553,
11624,
56,
6683,
6068,
267,
428,
1649,
63,
19080,
63,
12535,
360,
56,
297,
378,
12,
1926,
12,
378,
14,
3273,
17,
395,
267,
428,
1649,
63,
19080,
63,
12535,
360,
57,
297,
378,
12,
1926,
12,
378,
14,
3273,
17,
9,
267,
2318,
272,
5962,
9,
272,
30512,
908,
8,
85,
262,
430,
199,
199,
1361,
480,
45,
11124,
314,
11469,
1478,
531,
199,
199,
3937,
14,
2526,
4852,
8366,
17055,
469,
16,
12585,
11679,
63,
2996,
5258,
469,
16,
22999,
3234,
25380,
9,
17055,
2711,
2281,
603,
3177,
20238,
14,
51,
2805,
4938,
63,
10215,
23045,
908,
8,
85,
262,
430,
199,
199,
697,
14,
3543,
342,
199,
3937,
14,
1600,
342,
199,
697,
14,
1600,
342,
199,
199,
1361,
480,
1799,
314,
1817,
9124,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
self.build_lib = build_lib
self.build_temp = build_tmp
class install_lib(_install_lib):
def finalize_options(self):
_install_lib.finalize_options(self)
self.build_dir = build_lib
cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
cflags += getenv('CFLAGS', '').split()
build_lib = getenv('PYTHON_EXTBUILD_LIB')
build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
liblk = getenv('LIBLK')
ext_sources = [f.strip() for f in file('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#']
perf = Extension('perf',
sources = ext_sources,
include_dirs = ['util/include'],
extra_compile_args = cflags,
extra_objects = [libtraceevent, liblk],
)
setup(name='perf',
version='0.1',
description='Interface with the Linux profiling infrastructure',
author='Arnaldo Carvalho de Melo',
author_email='acme@redhat.com',
license='GPLv2',
url='http://perf.wiki.kernel.org',
ext_modules=[perf],
cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
| gpl-2.0 | [
3381,
2647,
15,
1393,
15,
1548,
18,
199,
199,
504,
7065,
14,
1018,
492,
3272,
12,
13282,
199,
504,
747,
492,
29626,
199,
199,
504,
7065,
14,
1531,
14,
1506,
63,
832,
257,
492,
1900,
63,
832,
257,
465,
485,
1506,
63,
832,
199,
504,
7065,
14,
1531,
14,
3174,
63,
773,
492,
3907,
63,
773,
465,
485,
3174,
63,
773,
199,
199,
533,
1900,
63,
832,
1547,
1506,
63,
832,
304,
272,
347,
17284,
63,
1419,
8,
277,
304,
267,
485,
1506,
63,
832,
14,
14450,
63,
1419,
8,
277,
9,
267,
291,
14,
1506,
63,
773,
221,
275,
1900,
63,
773,
267,
291,
14,
1506,
63,
808,
275,
1900,
63,
2791,
199,
199,
533,
3907,
63,
773,
1547,
3174,
63,
773,
304,
272,
347,
17284,
63,
1419,
8,
277,
304,
267,
485,
3174,
63,
773,
14,
14450,
63,
1419,
8,
277,
9,
267,
291,
14,
1506,
63,
694,
275,
1900,
63,
773,
421,
199,
14002,
275,
11573,
70,
889,
13,
4768,
13,
3620,
316,
297,
2475,
55,
889,
13,
952,
13,
5465,
418,
199,
14002,
847,
29626,
360,
14804,
297,
12548,
1294,
342,
199,
199,
1506,
63,
773,
275,
29626,
360,
11720,
63,
2472,
8248,
63,
5617,
358,
199,
1506,
63,
2791,
275,
29626,
360,
11720,
63,
2472,
8248,
63,
17983,
358,
199,
773,
3446,
1430,
275,
29626,
360,
5617,
20112,
8193,
358,
199,
773,
23333,
275,
29626,
360,
5617,
44,
43,
358,
199,
199,
832,
63,
4553,
275,
359,
70,
14,
1913,
342,
367,
289,
315,
570,
360,
1974,
15,
1548,
13,
832,
13,
4553,
358,
1585,
198,
692,
822,
8,
70,
14,
1913,
1012,
690,
378,
436,
289,
59,
16,
61,
1137,
3943,
418,
199,
199,
9452,
275,
13282,
360,
9452,
297,
29294,
5274,
275,
1599,
63,
4553,
12,
29294,
2387,
63,
3220,
275,
788,
1974,
15,
2613,
995,
29294,
2402,
63,
2014,
63,
589,
275,
13426,
12,
29294,
2402,
63,
1462,
275,
359,
773,
3446,
1430,
12,
1973,
23333,
467,
326,
776,
199,
199,
2758,
8,
354,
534,
9452,
297,
489,
1015,
534,
16,
14,
17,
297,
489,
1369,
534,
4267,
543,
314,
10130,
30238,
28890,
6976,
297,
489,
4132,
534,
20498,
279,
1117,
14243,
637,
526,
477,
3194,
320,
297,
489,
4132,
63,
2123,
534,
18107,
32,
17164,
14,
957,
297,
489,
4190,
534,
28863,
18,
297,
489,
1166,
534,
1014,
921,
9452,
14,
6797,
14,
4989,
14,
1308,
297,
489,
1599,
63,
3112,
1524,
9452,
467,
489,
2088,
533,
3713,
1506,
63,
832,
356,
1900,
63,
832,
12,
283,
3174,
63,
773,
356,
3907,
63,
773,
1552,
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
] | [
2647,
15,
1393,
15,
1548,
18,
199,
199,
504,
7065,
14,
1018,
492,
3272,
12,
13282,
199,
504,
747,
492,
29626,
199,
199,
504,
7065,
14,
1531,
14,
1506,
63,
832,
257,
492,
1900,
63,
832,
257,
465,
485,
1506,
63,
832,
199,
504,
7065,
14,
1531,
14,
3174,
63,
773,
492,
3907,
63,
773,
465,
485,
3174,
63,
773,
199,
199,
533,
1900,
63,
832,
1547,
1506,
63,
832,
304,
272,
347,
17284,
63,
1419,
8,
277,
304,
267,
485,
1506,
63,
832,
14,
14450,
63,
1419,
8,
277,
9,
267,
291,
14,
1506,
63,
773,
221,
275,
1900,
63,
773,
267,
291,
14,
1506,
63,
808,
275,
1900,
63,
2791,
199,
199,
533,
3907,
63,
773,
1547,
3174,
63,
773,
304,
272,
347,
17284,
63,
1419,
8,
277,
304,
267,
485,
3174,
63,
773,
14,
14450,
63,
1419,
8,
277,
9,
267,
291,
14,
1506,
63,
694,
275,
1900,
63,
773,
421,
199,
14002,
275,
11573,
70,
889,
13,
4768,
13,
3620,
316,
297,
2475,
55,
889,
13,
952,
13,
5465,
418,
199,
14002,
847,
29626,
360,
14804,
297,
12548,
1294,
342,
199,
199,
1506,
63,
773,
275,
29626,
360,
11720,
63,
2472,
8248,
63,
5617,
358,
199,
1506,
63,
2791,
275,
29626,
360,
11720,
63,
2472,
8248,
63,
17983,
358,
199,
773,
3446,
1430,
275,
29626,
360,
5617,
20112,
8193,
358,
199,
773,
23333,
275,
29626,
360,
5617,
44,
43,
358,
199,
199,
832,
63,
4553,
275,
359,
70,
14,
1913,
342,
367,
289,
315,
570,
360,
1974,
15,
1548,
13,
832,
13,
4553,
358,
1585,
198,
692,
822,
8,
70,
14,
1913,
1012,
690,
378,
436,
289,
59,
16,
61,
1137,
3943,
418,
199,
199,
9452,
275,
13282,
360,
9452,
297,
29294,
5274,
275,
1599,
63,
4553,
12,
29294,
2387,
63,
3220,
275,
788,
1974,
15,
2613,
995,
29294,
2402,
63,
2014,
63,
589,
275,
13426,
12,
29294,
2402,
63,
1462,
275,
359,
773,
3446,
1430,
12,
1973,
23333,
467,
326,
776,
199,
199,
2758,
8,
354,
534,
9452,
297,
489,
1015,
534,
16,
14,
17,
297,
489,
1369,
534,
4267,
543,
314,
10130,
30238,
28890,
6976,
297,
489,
4132,
534,
20498,
279,
1117,
14243,
637,
526,
477,
3194,
320,
297,
489,
4132,
63,
2123,
534,
18107,
32,
17164,
14,
957,
297,
489,
4190,
534,
28863,
18,
297,
489,
1166,
534,
1014,
921,
9452,
14,
6797,
14,
4989,
14,
1308,
297,
489,
1599,
63,
3112,
1524,
9452,
467,
489,
2088,
533,
3713,
1506,
63,
832,
356,
1900,
63,
832,
12,
283,
3174,
63,
773,
356,
3907,
63,
773,
1552,
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,
32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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
plotly/plotly.py | packages/python/plotly/plotly/validators/mesh3d/__init__.py | 1 | 6255 | import sys
if sys.version_info < (3, 7):
from ._zsrc import ZsrcValidator
from ._zhoverformat import ZhoverformatValidator
from ._zcalendar import ZcalendarValidator
from ._z import ZValidator
from ._ysrc import YsrcValidator
from ._yhoverformat import YhoverformatValidator
from ._ycalendar import YcalendarValidator
from ._y import YValidator
from ._xsrc import XsrcValidator
from ._xhoverformat import XhoverformatValidator
from ._xcalendar import XcalendarValidator
from ._x import XValidator
from ._visible import VisibleValidator
from ._vertexcolorsrc import VertexcolorsrcValidator
from ._vertexcolor import VertexcolorValidator
from ._uirevision import UirevisionValidator
from ._uid import UidValidator
from ._textsrc import TextsrcValidator
from ._text import TextValidator
from ._stream import StreamValidator
from ._showscale import ShowscaleValidator
from ._showlegend import ShowlegendValidator
from ._scene import SceneValidator
from ._reversescale import ReversescaleValidator
from ._opacity import OpacityValidator
from ._name import NameValidator
from ._metasrc import MetasrcValidator
from ._meta import MetaValidator
from ._lightposition import LightpositionValidator
from ._lighting import LightingValidator
from ._legendrank import LegendrankValidator
from ._legendgrouptitle import LegendgrouptitleValidator
from ._legendgroup import LegendgroupValidator
from ._ksrc import KsrcValidator
from ._k import KValidator
from ._jsrc import JsrcValidator
from ._j import JValidator
from ._isrc import IsrcValidator
from ._intensitysrc import IntensitysrcValidator
from ._intensitymode import IntensitymodeValidator
from ._intensity import IntensityValidator
from ._idssrc import IdssrcValidator
from ._ids import IdsValidator
from ._i import IValidator
from ._hovertextsrc import HovertextsrcValidator
from ._hovertext import HovertextValidator
from ._hovertemplatesrc import HovertemplatesrcValidator
from ._hovertemplate import HovertemplateValidator
from ._hoverlabel import HoverlabelValidator
from ._hoverinfosrc import HoverinfosrcValidator
from ._hoverinfo import HoverinfoValidator
from ._flatshading import FlatshadingValidator
from ._facecolorsrc import FacecolorsrcValidator
from ._facecolor import FacecolorValidator
from ._delaunayaxis import DelaunayaxisValidator
from ._customdatasrc import CustomdatasrcValidator
from ._customdata import CustomdataValidator
from ._contour import ContourValidator
from ._colorscale import ColorscaleValidator
from ._colorbar import ColorbarValidator
from ._coloraxis import ColoraxisValidator
from ._color import ColorValidator
from ._cmin import CminValidator
from ._cmid import CmidValidator
from ._cmax import CmaxValidator
from ._cauto import CautoValidator
from ._autocolorscale import AutocolorscaleValidator
from ._alphahull import AlphahullValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
[],
[
"._zsrc.ZsrcValidator",
"._zhoverformat.ZhoverformatValidator",
"._zcalendar.ZcalendarValidator",
"._z.ZValidator",
"._ysrc.YsrcValidator",
"._yhoverformat.YhoverformatValidator",
"._ycalendar.YcalendarValidator",
"._y.YValidator",
"._xsrc.XsrcValidator",
"._xhoverformat.XhoverformatValidator",
"._xcalendar.XcalendarValidator",
"._x.XValidator",
"._visible.VisibleValidator",
"._vertexcolorsrc.VertexcolorsrcValidator",
"._vertexcolor.VertexcolorValidator",
"._uirevision.UirevisionValidator",
"._uid.UidValidator",
"._textsrc.TextsrcValidator",
"._text.TextValidator",
"._stream.StreamValidator",
"._showscale.ShowscaleValidator",
"._showlegend.ShowlegendValidator",
"._scene.SceneValidator",
"._reversescale.ReversescaleValidator",
"._opacity.OpacityValidator",
"._name.NameValidator",
"._metasrc.MetasrcValidator",
"._meta.MetaValidator",
"._lightposition.LightpositionValidator",
"._lighting.LightingValidator",
"._legendrank.LegendrankValidator",
"._legendgrouptitle.LegendgrouptitleValidator",
"._legendgroup.LegendgroupValidator",
"._ksrc.KsrcValidator",
"._k.KValidator",
"._jsrc.JsrcValidator",
"._j.JValidator",
"._isrc.IsrcValidator",
"._intensitysrc.IntensitysrcValidator",
"._intensitymode.IntensitymodeValidator",
"._intensity.IntensityValidator",
"._idssrc.IdssrcValidator",
"._ids.IdsValidator",
"._i.IValidator",
"._hovertextsrc.HovertextsrcValidator",
"._hovertext.HovertextValidator",
"._hovertemplatesrc.HovertemplatesrcValidator",
"._hovertemplate.HovertemplateValidator",
"._hoverlabel.HoverlabelValidator",
"._hoverinfosrc.HoverinfosrcValidator",
"._hoverinfo.HoverinfoValidator",
"._flatshading.FlatshadingValidator",
"._facecolorsrc.FacecolorsrcValidator",
"._facecolor.FacecolorValidator",
"._delaunayaxis.DelaunayaxisValidator",
"._customdatasrc.CustomdatasrcValidator",
"._customdata.CustomdataValidator",
"._contour.ContourValidator",
"._colorscale.ColorscaleValidator",
"._colorbar.ColorbarValidator",
"._coloraxis.ColoraxisValidator",
"._color.ColorValidator",
"._cmin.CminValidator",
"._cmid.CmidValidator",
"._cmax.CmaxValidator",
"._cauto.CautoValidator",
"._autocolorscale.AutocolorscaleValidator",
"._alphahull.AlphahullValidator",
],
)
| mit | [
646,
984,
199,
199,
692,
984,
14,
1023,
63,
815,
665,
334,
19,
12,
1520,
304,
272,
687,
13653,
90,
2164,
492,
3107,
2164,
8640,
272,
687,
13653,
90,
22797,
908,
492,
3107,
22797,
908,
8640,
272,
687,
13653,
90,
8183,
492,
3107,
8183,
8640,
272,
687,
13653,
90,
492,
3107,
8640,
272,
687,
13653,
588,
1195,
492,
1488,
2164,
8640,
272,
687,
13653,
89,
22797,
908,
492,
1488,
22797,
908,
8640,
272,
687,
13653,
89,
8183,
492,
1488,
8183,
8640,
272,
687,
13653,
89,
492,
1488,
8640,
272,
687,
13653,
88,
2164,
492,
1323,
2164,
8640,
272,
687,
13653,
88,
22797,
908,
492,
1323,
22797,
908,
8640,
272,
687,
13653,
88,
8183,
492,
1323,
8183,
8640,
272,
687,
13653,
88,
492,
1323,
8640,
272,
687,
13653,
6604,
492,
6561,
1164,
8640,
272,
687,
13653,
11417,
7120,
1195,
492,
5444,
3858,
7120,
1195,
8640,
272,
687,
13653,
11417,
2326,
492,
5444,
3858,
2326,
8640,
272,
687,
13653,
1907,
5792,
492,
738,
3621,
2317,
8640,
272,
687,
13653,
1535,
492,
738,
344,
8640,
272,
687,
13653,
505,
2164,
492,
4516,
2164,
8640,
272,
687,
13653,
505,
492,
4516,
8640,
272,
687,
13653,
1745,
492,
8271,
8640,
272,
687,
13653,
2384,
3467,
492,
12968,
3467,
8640,
272,
687,
13653,
2384,
10231,
492,
12968,
10231,
8640,
272,
687,
13653,
10436,
492,
18055,
69,
8640,
272,
687,
13653,
4471,
3467,
492,
22734,
3467,
8640,
272,
687,
13653,
21861,
492,
593,
6192,
8640,
272,
687,
13653,
354,
492,
2812,
8640,
272,
687,
13653,
10207,
305,
1195,
492,
10072,
305,
1195,
8640,
272,
687,
13653,
2024,
492,
6288,
8640,
272,
687,
13653,
4040,
3124,
492,
29684,
3124,
8640,
272,
687,
13653,
4040,
316,
492,
29684,
316,
8640,
272,
687,
13653,
10231,
4648,
492,
26357,
4648,
8640,
272,
687,
13653,
10231,
923,
1213,
492,
26357,
923,
1213,
8640,
272,
687,
13653,
10231,
923,
492,
26357,
923,
8640,
272,
687,
13653,
75,
2164,
492,
1804,
2164,
8640,
272,
687,
13653,
75,
492,
1804,
8640,
272,
687,
13653,
74,
2164,
492,
1603,
2164,
8640,
272,
687,
13653,
74,
492,
1603,
8640,
272,
687,
13653,
374,
1195,
492,
473,
2164,
8640,
272,
687,
13653,
27203,
2164,
492,
1010,
16686,
2164,
8640,
272,
687,
13653,
27203,
632,
492,
1010,
16686,
632,
8640,
272,
687,
13653,
27203,
492,
1010,
16686,
8640,
272,
687,
13653,
344,
32231,
492,
15418,
32231,
8640,
272,
687,
13653,
1580,
492,
473,
795,
8640,
272,
687,
13653,
73,
492,
473,
8640,
272,
687,
13653,
22797,
505,
2164,
492,
869,
1883,
505,
2164,
8640,
272,
687,
13653,
22797,
505,
492,
869,
1883,
505,
8640,
272,
687,
13653,
22797,
1160,
2164,
492,
869,
1883,
1160,
2164,
8640,
272,
687,
13653,
22797,
1160,
492,
869,
1883,
1160,
8640,
272,
687,
13653,
22797,
1302,
492,
869,
1883,
1302,
8640,
272,
687,
13653,
22797,
815,
2164,
492,
869,
1883,
815,
2164,
8640,
272,
687,
13653,
22797,
815,
492,
869,
1883,
815,
8640,
272,
687,
13653,
7088,
609,
5384,
492,
19005,
609,
5384,
8640,
272,
687,
13653,
1409,
7120,
1195,
492,
21459,
7120,
1195,
8640,
272,
687,
13653,
1409,
2326,
492,
21459,
2326,
8640,
272,
687,
13653,
271,
416,
324,
1187,
3127,
492,
18464,
65,
324,
1187,
3127,
8640,
272,
687,
13653,
4229,
11563,
1195,
492,
8388,
11563,
1195,
8640,
272,
687,
13653,
4229,
576,
492,
8388,
576,
8640,
272,
687,
13653,
17798,
492,
1448,
10808,
8640,
272,
687,
13653,
2326,
3467,
492,
11581,
3467,
8640,
272,
687,
13653,
30995,
492,
11581,
1700,
8640,
272,
687,
13653,
2326,
3127,
492,
11581,
3127,
8640,
272,
687,
13653,
2326,
492,
11581,
8640,
272,
687,
13653,
67,
827,
492,
445,
827,
8640,
272,
687,
13653,
4400,
344,
492,
445,
8523,
8640,
272,
687,
13653,
67,
988,
492,
445,
988,
8640,
272,
687,
13653,
696,
1283,
492,
445,
2495,
8640,
272,
687,
13653,
2495,
2326,
3467,
492,
9195,
2326,
3467,
8640,
272,
687,
13653,
4468,
72,
979,
492,
32657,
72,
979,
8640,
199,
2836,
26,
272,
687,
485,
2798,
590,
63,
1208,
14,
3236,
27568,
492,
3847,
63,
646,
339,
636,
452,
3108,
636,
5675,
3108,
636,
694,
363,
275,
3847,
63,
646,
8,
267,
636,
354,
3108,
267,
990,
267,
359,
288,
298,
423,
90,
2164,
14,
58,
2164,
8640,
401,
288,
298,
423,
90,
22797,
908,
14,
58,
22797,
908,
8640,
401,
288,
298,
423,
90,
8183,
14,
58,
8183,
8640,
401,
288,
298,
423,
90,
14,
58,
8640,
401,
288,
298,
423,
588,
1195,
14,
57,
2164,
8640,
401,
288,
298,
423,
89,
22797,
908,
14,
57,
22797,
908,
8640,
401,
288,
298,
423,
89,
8183,
14,
57,
8183,
8640,
401,
288,
298,
423,
89,
14,
57,
8640,
401,
288,
298,
423,
88,
2164,
14,
56,
2164,
8640,
401,
288,
298,
423,
88,
22797,
908,
14,
56,
22797,
908,
8640,
401,
288,
298,
423,
88,
8183,
14,
56,
8183,
8640,
401,
288,
298,
423,
88,
14,
56,
8640,
401,
288,
298,
423,
6604,
14,
14917,
8640,
401,
288,
298,
423,
11417,
7120,
1195,
14,
9787,
7120,
1195,
8640,
401,
288,
298,
423,
11417,
2326,
14,
9787,
2326,
8640,
401,
288,
298,
423,
1907,
5792,
14,
53,
3621,
2317,
8640,
401,
288,
298,
423,
1535,
14,
18326,
8640,
401,
288,
298,
423,
505,
2164,
14,
1872,
2164,
8640,
401,
288,
298,
423,
505,
14,
1872,
8640,
401,
288,
298,
423,
1745,
14,
3296,
8640,
401,
288,
298,
423,
2384,
3467,
14,
6824,
3467,
8640,
401,
288,
298,
423,
2384,
10231,
14,
6824,
10231,
8640,
401,
288,
298,
423,
10436,
14,
14216,
8640,
401,
288,
298,
423,
4471,
3467,
14,
14987,
3467,
8640,
401,
288,
298,
423,
21861,
14,
47,
6192,
8640,
401,
288,
298,
423,
354,
14,
985,
8640,
401,
288,
298,
423,
10207,
305,
1195,
14,
4015,
305,
1195,
8640,
401,
288,
298,
423,
2024,
14,
3396,
8640,
401,
288,
298,
423,
4040,
3124,
14,
16393,
3124,
8640,
401,
288,
298,
423,
4040,
316,
14,
16393,
316,
8640,
401,
288,
298,
423,
10231,
4648,
14,
23439,
4648,
8640,
401,
288,
298,
423,
10231,
923,
1213,
14,
23439,
923,
1213,
8640,
401,
288,
298,
423,
10231,
923,
14,
23439,
923,
8640,
401,
288,
298,
423,
75,
2164,
14,
43,
2164,
8640,
401,
288,
298,
423,
75,
14,
43,
8640,
401
] | [
984,
199,
199,
692,
984,
14,
1023,
63,
815,
665,
334,
19,
12,
1520,
304,
272,
687,
13653,
90,
2164,
492,
3107,
2164,
8640,
272,
687,
13653,
90,
22797,
908,
492,
3107,
22797,
908,
8640,
272,
687,
13653,
90,
8183,
492,
3107,
8183,
8640,
272,
687,
13653,
90,
492,
3107,
8640,
272,
687,
13653,
588,
1195,
492,
1488,
2164,
8640,
272,
687,
13653,
89,
22797,
908,
492,
1488,
22797,
908,
8640,
272,
687,
13653,
89,
8183,
492,
1488,
8183,
8640,
272,
687,
13653,
89,
492,
1488,
8640,
272,
687,
13653,
88,
2164,
492,
1323,
2164,
8640,
272,
687,
13653,
88,
22797,
908,
492,
1323,
22797,
908,
8640,
272,
687,
13653,
88,
8183,
492,
1323,
8183,
8640,
272,
687,
13653,
88,
492,
1323,
8640,
272,
687,
13653,
6604,
492,
6561,
1164,
8640,
272,
687,
13653,
11417,
7120,
1195,
492,
5444,
3858,
7120,
1195,
8640,
272,
687,
13653,
11417,
2326,
492,
5444,
3858,
2326,
8640,
272,
687,
13653,
1907,
5792,
492,
738,
3621,
2317,
8640,
272,
687,
13653,
1535,
492,
738,
344,
8640,
272,
687,
13653,
505,
2164,
492,
4516,
2164,
8640,
272,
687,
13653,
505,
492,
4516,
8640,
272,
687,
13653,
1745,
492,
8271,
8640,
272,
687,
13653,
2384,
3467,
492,
12968,
3467,
8640,
272,
687,
13653,
2384,
10231,
492,
12968,
10231,
8640,
272,
687,
13653,
10436,
492,
18055,
69,
8640,
272,
687,
13653,
4471,
3467,
492,
22734,
3467,
8640,
272,
687,
13653,
21861,
492,
593,
6192,
8640,
272,
687,
13653,
354,
492,
2812,
8640,
272,
687,
13653,
10207,
305,
1195,
492,
10072,
305,
1195,
8640,
272,
687,
13653,
2024,
492,
6288,
8640,
272,
687,
13653,
4040,
3124,
492,
29684,
3124,
8640,
272,
687,
13653,
4040,
316,
492,
29684,
316,
8640,
272,
687,
13653,
10231,
4648,
492,
26357,
4648,
8640,
272,
687,
13653,
10231,
923,
1213,
492,
26357,
923,
1213,
8640,
272,
687,
13653,
10231,
923,
492,
26357,
923,
8640,
272,
687,
13653,
75,
2164,
492,
1804,
2164,
8640,
272,
687,
13653,
75,
492,
1804,
8640,
272,
687,
13653,
74,
2164,
492,
1603,
2164,
8640,
272,
687,
13653,
74,
492,
1603,
8640,
272,
687,
13653,
374,
1195,
492,
473,
2164,
8640,
272,
687,
13653,
27203,
2164,
492,
1010,
16686,
2164,
8640,
272,
687,
13653,
27203,
632,
492,
1010,
16686,
632,
8640,
272,
687,
13653,
27203,
492,
1010,
16686,
8640,
272,
687,
13653,
344,
32231,
492,
15418,
32231,
8640,
272,
687,
13653,
1580,
492,
473,
795,
8640,
272,
687,
13653,
73,
492,
473,
8640,
272,
687,
13653,
22797,
505,
2164,
492,
869,
1883,
505,
2164,
8640,
272,
687,
13653,
22797,
505,
492,
869,
1883,
505,
8640,
272,
687,
13653,
22797,
1160,
2164,
492,
869,
1883,
1160,
2164,
8640,
272,
687,
13653,
22797,
1160,
492,
869,
1883,
1160,
8640,
272,
687,
13653,
22797,
1302,
492,
869,
1883,
1302,
8640,
272,
687,
13653,
22797,
815,
2164,
492,
869,
1883,
815,
2164,
8640,
272,
687,
13653,
22797,
815,
492,
869,
1883,
815,
8640,
272,
687,
13653,
7088,
609,
5384,
492,
19005,
609,
5384,
8640,
272,
687,
13653,
1409,
7120,
1195,
492,
21459,
7120,
1195,
8640,
272,
687,
13653,
1409,
2326,
492,
21459,
2326,
8640,
272,
687,
13653,
271,
416,
324,
1187,
3127,
492,
18464,
65,
324,
1187,
3127,
8640,
272,
687,
13653,
4229,
11563,
1195,
492,
8388,
11563,
1195,
8640,
272,
687,
13653,
4229,
576,
492,
8388,
576,
8640,
272,
687,
13653,
17798,
492,
1448,
10808,
8640,
272,
687,
13653,
2326,
3467,
492,
11581,
3467,
8640,
272,
687,
13653,
30995,
492,
11581,
1700,
8640,
272,
687,
13653,
2326,
3127,
492,
11581,
3127,
8640,
272,
687,
13653,
2326,
492,
11581,
8640,
272,
687,
13653,
67,
827,
492,
445,
827,
8640,
272,
687,
13653,
4400,
344,
492,
445,
8523,
8640,
272,
687,
13653,
67,
988,
492,
445,
988,
8640,
272,
687,
13653,
696,
1283,
492,
445,
2495,
8640,
272,
687,
13653,
2495,
2326,
3467,
492,
9195,
2326,
3467,
8640,
272,
687,
13653,
4468,
72,
979,
492,
32657,
72,
979,
8640,
199,
2836,
26,
272,
687,
485,
2798,
590,
63,
1208,
14,
3236,
27568,
492,
3847,
63,
646,
339,
636,
452,
3108,
636,
5675,
3108,
636,
694,
363,
275,
3847,
63,
646,
8,
267,
636,
354,
3108,
267,
990,
267,
359,
288,
298,
423,
90,
2164,
14,
58,
2164,
8640,
401,
288,
298,
423,
90,
22797,
908,
14,
58,
22797,
908,
8640,
401,
288,
298,
423,
90,
8183,
14,
58,
8183,
8640,
401,
288,
298,
423,
90,
14,
58,
8640,
401,
288,
298,
423,
588,
1195,
14,
57,
2164,
8640,
401,
288,
298,
423,
89,
22797,
908,
14,
57,
22797,
908,
8640,
401,
288,
298,
423,
89,
8183,
14,
57,
8183,
8640,
401,
288,
298,
423,
89,
14,
57,
8640,
401,
288,
298,
423,
88,
2164,
14,
56,
2164,
8640,
401,
288,
298,
423,
88,
22797,
908,
14,
56,
22797,
908,
8640,
401,
288,
298,
423,
88,
8183,
14,
56,
8183,
8640,
401,
288,
298,
423,
88,
14,
56,
8640,
401,
288,
298,
423,
6604,
14,
14917,
8640,
401,
288,
298,
423,
11417,
7120,
1195,
14,
9787,
7120,
1195,
8640,
401,
288,
298,
423,
11417,
2326,
14,
9787,
2326,
8640,
401,
288,
298,
423,
1907,
5792,
14,
53,
3621,
2317,
8640,
401,
288,
298,
423,
1535,
14,
18326,
8640,
401,
288,
298,
423,
505,
2164,
14,
1872,
2164,
8640,
401,
288,
298,
423,
505,
14,
1872,
8640,
401,
288,
298,
423,
1745,
14,
3296,
8640,
401,
288,
298,
423,
2384,
3467,
14,
6824,
3467,
8640,
401,
288,
298,
423,
2384,
10231,
14,
6824,
10231,
8640,
401,
288,
298,
423,
10436,
14,
14216,
8640,
401,
288,
298,
423,
4471,
3467,
14,
14987,
3467,
8640,
401,
288,
298,
423,
21861,
14,
47,
6192,
8640,
401,
288,
298,
423,
354,
14,
985,
8640,
401,
288,
298,
423,
10207,
305,
1195,
14,
4015,
305,
1195,
8640,
401,
288,
298,
423,
2024,
14,
3396,
8640,
401,
288,
298,
423,
4040,
3124,
14,
16393,
3124,
8640,
401,
288,
298,
423,
4040,
316,
14,
16393,
316,
8640,
401,
288,
298,
423,
10231,
4648,
14,
23439,
4648,
8640,
401,
288,
298,
423,
10231,
923,
1213,
14,
23439,
923,
1213,
8640,
401,
288,
298,
423,
10231,
923,
14,
23439,
923,
8640,
401,
288,
298,
423,
75,
2164,
14,
43,
2164,
8640,
401,
288,
298,
423,
75,
14,
43,
8640,
401,
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
] |
lizardsystem/freq | freq/lizard_connector.py | 1 | 30266 | import copy
import datetime as dt
import json
import logging
from pprint import pprint # left here for debugging purposes
from time import time
from time import sleep
import urllib
import numpy as np
import django.core.exceptions
from freq import jsdatetime
try:
from django.conf import settings
USR, PWD = settings.USR, settings.PWD
except django.core.exceptions.ImproperlyConfigured:
print('WARNING: no USR and PWD found in settings. USR and PWD should have'
'been set beforehand')
USR = None
PWD = None
# When you use this script stand alone, please set your login information here:
# USR = ****** # Replace the stars with your user name.
# PWD = ****** # Replace the stars with your password.
logger = logging.getLogger(__name__)
def join_urls(*args):
return '/'.join(args)
class LizardApiError(Exception):
pass
class Base(object):
"""
Base class to connect to the different endpoints of the lizard-api.
:param data_type: endpoint of the lizard-api one wishes to connect to.
:param username: login username
:param password: login password
:param use_header: no login and password is send with the query when set
to False
:param extra_queries: In case one wishes to set default queries for a
certain data type this is the plase.
:param max_results:
"""
username = USR
password = PWD
max_results = 1000
@property
def extra_queries(self):
"""
Overwrite class to add queries
:return: dictionary with extra queries
"""
return {}
def organisation_query(self, organisation, add_query_string='location__'):
org_query = {}
if isinstance(organisation, str):
org_query.update({add_query_string + "organisation__unique_id":
organisation})
elif organisation:
org_query.update({
add_query_string + "organisation__unique_id": ','.join(
org for org in organisation)
})
if org_query:
return dict([urllib.parse.urlencode(org_query).split('=')])
else:
return {}
def __init__(self, base="https://ggmn.lizard.net", use_header=False,
data_type=None):
"""
:param base: the site one wishes to connect to. Defaults to the
Lizard ggmn production site.
"""
if data_type:
self.data_type = data_type
self.use_header = use_header
self.queries = {}
self.results = []
if base.startswith('http'):
self.base = base
else:
self.base = join_urls('https:/', base)
# without extra '/' ^^, this is added in join_urls
self.base_url = join_urls(self.base, 'api/v2', self.data_type) + '/'
def get(self, count=True, uuid=None, **queries):
"""
Query the api.
For possible queries see: https://nxt.staging.lizard.net/doc/api.html
Stores the api-response as a dict in the results attribute.
:param queries: all keyword arguments are used as queries.
:return: a dictionary of the api-response.
"""
if self.max_results:
queries.update({'page_size': self.max_results, 'format': 'json'})
queries.update(self.extra_queries)
queries.update(getattr(self, "queries", {}))
query = '?' + '&'.join(str(key) + '=' +
(('&' + str(key) + '=').join(value)
if isinstance(value, list) else str(value))
for key, value in queries.items())
url = urllib.parse.urljoin(self.base_url, str(uuid)) if uuid else \
self.base_url + query
try:
self.fetch(url)
except urllib.error.HTTPError: # TODO remove hack to prevent 420 error
self.json = {'results': [], 'count': 0}
try:
logger.debug('Number found %s : %s with URL: %s', self.data_type,
self.json.get('count', 0), url)
except (KeyError, AttributeError):
logger.debug('Got results from %s with URL: %s',
self.data_type, url)
self.parse()
return self.results
def fetch(self, url):
"""
GETs parameters from the api based on an url in a JSON format.
Stores the JSON response in the json attribute.
:param url: full query url: should be of the form:
[base_url]/api/v2/[endpoint]/?[query_key]=[query_value]&...
:return: the JSON from the response
"""
if self.use_header:
request_obj = urllib.request.Request(url, headers=self.header)
else:
request_obj = urllib.request.Request(url)
try:
with urllib.request.urlopen(request_obj) as resp:
encoding = resp.headers.get_content_charset()
encoding = encoding if encoding else 'UTF-8'
content = resp.read().decode(encoding)
self.json = json.loads(content)
except Exception:
logger.exception("got error from: %s", url)
raise
return self.json
def parse(self):
"""
Parse the json attribute and store it to the results attribute.
All pages of a query are parsed. If the max_results attribute is
exceeded an ApiError is raised.
"""
while True:
try:
if self.json['count'] > self.max_results:
raise LizardApiError(
'Too many results: {} found, while max {} are '
'accepted'.format(self.json['count'], self.max_results)
)
self.results += self.json['results']
next_url = self.json.get('next')
if next_url:
self.fetch(next_url)
else:
break
except KeyError:
self.results += [self.json]
break
except IndexError:
break
def parse_elements(self, element):
"""
Get a list of a certain element from the root of the results attribute.
:param element: the element you wish to get.
:return: A list of all elements in the root of the results attribute.
"""
self.parse()
return [x[element] for x in self.results]
@property
def header(self):
"""
The header with credentials for the api.
"""
if self.use_header:
return {
"username": self.username,
"password": self.password
}
return {}
class Organisations(Base):
"""
Makes a connection to the organisations endpoint of the lizard api.
"""
data_type = 'organisations'
def all(self, organisation=None):
"""
:return: a list of organisations belonging one has access to
(with the credentials from the header attribute)
"""
if organisation:
self.get(unique_id=organisation)
else:
self.get()
self.parse()
return self.parse_elements('unique_id')
class Locations(Base):
"""
Makes a connection to the locations endpoint of the lizard api.
"""
def __init__(self, base="https://ggmn.lizard.net", use_header=False):
self.data_type = 'locations'
self.uuids = []
super().__init__(base, use_header)
def bbox(self, south_west, north_east, organisation=None):
"""
Find all locations within a certain bounding box.
returns records within bounding box using Bounding Box format (min Lon,
min Lat, max Lon, max Lat). Also returns features with overlapping
geometry.
:param south_west: lattitude and longtitude of the south-western point
:param north_east: lattitude and longtitude of the north-eastern point
:return: a dictionary of the api-response.
"""
min_lat, min_lon = south_west
max_lat, max_lon = north_east
coords = self.commaify(min_lon, min_lat, max_lon, max_lat)
org_query = self.organisation_query(organisation, '')
self.get(in_bbox=coords, **org_query)
def distance_to_point(self, distance, lat, lon, organisation=None):
"""
Returns records with distance meters from point. Distance in meters
is converted to WGS84 degrees and thus an approximation.
:param distance: meters from point
:param lon: longtitude of point
:param lat: latitude of point
:return: a dictionary of the api-response.
"""
coords = self.commaify(lon, lat)
org_query = self.organisation_query(organisation, '')
self.get(distance=distance, point=coords, **org_query)
def commaify(self, *args):
"""
:return: a comma-seperated string of the given arguments
"""
return ','.join(str(x) for x in args)
def coord_uuid_name(self):
"""
Filters out the coordinates UUIDs and names of locations in results.
Use after a query is made.
:return: a dictionary with coordinates, UUIDs and names
"""
result = {}
for x in self.results:
if x['uuid'] not in self.uuids:
geom = x.get('geometry') or {}
result[x['uuid']] = {
'coordinates': geom.get(
'coordinates', ['','']),
'name': x['name']
}
self.uuids.append(x['uuid'])
return result
class TaskAPI(Base):
data_type = 'tasks'
def poll(self, url=None):
if url is None or not url.startswith('http'):
return
self.fetch(url)
@property
def status(self):
try:
logger.debug('Task status: %s', self.json.get("task_status"))
status = self.json.get("task_status")
if status is None:
logger.debug('Task status: NONE')
return "NONE"
return status
except AttributeError:
logger.debug('Task status: NONE')
return "NONE"
def timeseries_csv(self, organisation, extra_queries_ts):
if self.status != "SUCCESS":
raise LizardApiError('Download not ready.')
url = self.json.get("result_url")
self.fetch(url)
self.results = []
self.parse()
csv = (
[result['name'], result['uuid'],
jsdatetime.js_to_datestring(event['timestamp']), event['max']]
for result in self.results for event in result['events']
)
loc = Locations(use_header=self.use_header)
extra_queries = {
key if not key.startswith("location__") else key[10:]: value
for key, value in extra_queries_ts.items()
}
org_query = self.organisation_query(organisation, '')
extra_queries.update(**org_query)
loc.get(**extra_queries)
coords = loc.coord_uuid_name()
headers = (
[
r['uuid'], r['name'], coords[r['location']['uuid']]['name'],
coords[r['location']['uuid']]['coordinates'][0],
coords[r['location']['uuid']]['coordinates'][1]
]
for r in self.results
)
return headers, csv
class TimeSeries(Base):
"""
Makes a connection to the timeseries endpoint of the lizard api.
"""
def __init__(self, base="https://ggmn.lizard.net", use_header=False):
self.data_type = 'timeseries'
self.uuids = []
self.statistic = None
super().__init__(base, use_header)
def location_name(self, name, organisation=None):
"""
Returns time series metadata for a location by name.
:param name: name of a location
:return: a dictionary of with nested location, aquo quantities and
events.
"""
org_query = self.organisation_query(organisation)
return self.get(location__name=name, **org_query)
def location_uuid(self, loc_uuid, start='0001-01-01T00:00:00Z', end=None,
organisation=None):
"""
Returns time series for a location by location-UUID.
:param loc_uuid: name of a location
:param start: start timestamp in ISO 8601 format
:param end: end timestamp in ISO 8601 format, defaults to now
:return: a dictionary of with nested location, aquo quantities and
events.
"""
org_query = self.organisation_query(organisation)
self.get(location__uuid=loc_uuid, **org_query)
timeseries_uuids = [x['uuid'] for x in self.results]
self.results = []
for ts_uuid in timeseries_uuids:
ts = TimeSeries(self.base, use_header=self.use_header)
ts.uuid(ts_uuid, start, end, organisation)
self.results += ts.results
return self.results
def uuid(self, ts_uuid, start='0001-01-01T00:00:00Z', end=None,
organisation=None):
"""
Returns time series for a timeseries by timeseries-UUID.
:param ts_uuid: uuid of a timeseries
:param start: start timestamp in ISO 8601 format
:param end: end timestamp in ISO 8601 format
:return: a dictionary of with nested location, aquo quantities and
events.
"""
if not end:
end = jsdatetime.now_iso()
old_base_url = self.base_url
self.base_url += ts_uuid + "/"
org_query = self.organisation_query(organisation)
self.get(start=start, end=end, **org_query)
self.base_url = old_base_url
def start_csv_task(self, start='0001-01-01T00:00:00Z', end=None,
organisation=None):
if not end:
end = jsdatetime.now_iso()
if isinstance(start, int):
start -= 10000
if isinstance(end, int):
end += 10000
org_query = self.organisation_query(organisation)
poll_url = self.get(
start=start,
end=end,
async="true",
format="json",
**org_query
)[0]['url']
logger.debug("Async task url %s", poll_url)
return poll_url, self.extra_queries
def bbox(self, south_west, north_east, statistic=None,
start='0001-01-01T00:00:00Z', end=None, organisation=None):
"""
Find all timeseries within a certain bounding box.
Returns records within bounding box using Bounding Box format (min Lon,
min Lat, max Lon, max Lat). Also returns features with overlapping
geometry.
:param south_west: lattitude and longtitude of the south-western point
:param north_east: lattitude and longtitude of the north-eastern point
:param start_: start timestamp in ISO 8601 format
:param end: end timestamp in ISO 8601 format
:return: a dictionary of the api-response.
"""
if not end:
end = jsdatetime.now_iso()
if isinstance(start, int):
start -= 10000
if isinstance(end, int):
end += 10000
min_lat, min_lon = south_west
max_lat, max_lon = north_east
polygon_coordinates = [
[min_lon, min_lat],
[min_lon, max_lat],
[max_lon, max_lat],
[max_lon, min_lat],
[min_lon, min_lat],
]
points = [' '.join([str(x), str(y)]) for x, y in polygon_coordinates]
geom_within = {'a': 'POLYGON ((' + ', '.join(points) + '))'}
geom_within = urllib.parse.urlencode(geom_within).split('=')[1]
org_query = self.organisation_query(organisation)
self.statistic = statistic
if statistic == 'mean':
statistic = ['count', 'sum']
elif not statistic:
statistic = ['min', 'max', 'count', 'sum']
self.statistic = None
elif statistic == 'range (max - min)':
statistic = ['min', 'max']
elif statistic == 'difference (last - first)':
statistic = 'count'
elif statistic == 'difference (mean last - first year)':
year = dt.timedelta(days=366)
first_end = jsdatetime.datetime_to_js(jsdatetime.js_to_datetime(start) + year)
last_start = jsdatetime.datetime_to_js(jsdatetime.js_to_datetime(end) - year)
self.get(
start=start,
end=first_end,
min_points=1,
fields=['count', 'sum'],
location__geom_within=geom_within,
**org_query
)
first_year = {}
for r in self.results:
try:
first_year[r['location']['uuid']] = {
'first_value_timestamp': r['first_value_timestamp'],
'mean': r['events'][0]['sum'] / r['events'][0]['count']
}
except IndexError:
first_year[r['location']['uuid']] = {
'first_value_timestamp': np.nan,
'mean': np.nan
}
self.results = []
self.get(
start=last_start,
end=end,
min_points=1,
fields=['count', 'sum'],
location__geom_within=geom_within,
**org_query
)
for r in self.results:
try:
r['events'][0]['difference (mean last - first year)'] = \
r['events'][0]['sum'] / r['events'][0]['count'] - \
first_year[r['location']['uuid']]['mean']
r['first_value_timestamp'] = \
first_year[
r['location']['uuid']]['first_value_timestamp']
except IndexError:
r['events'] = [{
'difference (mean last - first year)': np.nan}]
r['first_value_timestamp'] = np.nan
r['last_value_timestamp'] = np.nan
return
self.get(
start=start,
end=end,
min_points=1,
fields=statistic,
location__geom_within=geom_within,
**org_query
)
def ts_to_dict(self, statistic=None, values=None,
start_date=None, end_date=None, date_time='js'):
"""
:param date_time: default: js. Several options:
'js': javascript integer datetime representation
'dt': python datetime object
'str': date in date format (dutch representation)
"""
if len(self.results) == 0:
self.response = {}
return self.response
if values:
values = values
else:
values = {}
if not statistic and self.statistic:
statistic = self.statistic
# np array with cols: 'min', 'max', 'sum', 'count', 'first', 'last'
if not statistic:
stats1 = ('min', 'max', 'sum', 'count')
stats2 = (
(0, 'min'),
(1, 'max'),
(2, 'mean'),
(3, 'range (max - min)'),
(4, 'difference (last - first)'),
(5, 'difference (mean last - first year)')
)
start_index = 6
else:
if statistic == 'mean':
stats1 = ('sum', 'count')
elif statistic == 'range (max - min)':
stats1 = ('min', 'max')
else:
stats1 = (statistic, )
stats2 = ((0, statistic), )
start_index = int(statistic == 'mean') + 1
ts = []
for result in self.results:
try:
timestamps = [int(result['first_value_timestamp']),
int(result['last_value_timestamp'])]
except (ValueError, TypeError):
timestamps = [np.nan, np.nan]
except TypeError:
# int(None)
timestamps = [np.nan, np.nan]
if not len(result['events']):
y = 2 if statistic == 'difference (mean last - first year)' \
else 0
ts.append(
[np.nan for _ in range(len(stats1) + y)] + timestamps)
else:
ts.append([float(result['events'][0][s]) for s in stats1] +
timestamps)
npts = np.array(ts)
if statistic:
if statistic == 'mean':
stat = (npts[:, 0] / npts[:, 1]).reshape(-1, 1)
elif statistic == 'range (max - min)':
stat = (npts[:, 1] - npts[:, 0]).reshape(-1, 1)
elif statistic == 'difference (last - first)':
stat = (npts[:, 1] - npts[:, 0]).reshape(-1, 1)
else:
stat = npts[:, 0].reshape(-1, 1)
npts_calculated = np.hstack(
(stat, npts[:, slice(start_index, -1)]))
else:
npts_calculated = np.hstack((
npts[:, 0:2],
(npts[:, 2] / npts[:, 3]).reshape(-1, 1),
(npts[:, 1] - npts[:, 0]).reshape(-1, 1),
npts[:, 4:]
))
for i, row in enumerate(npts_calculated):
location_uuid = self.results[i]['location']['uuid']
loc_dict = values.get(location_uuid, {})
loc_dict.update({stat: 'NaN' if np.isnan(row[i]) else row[i]
for i, stat in stats2})
loc_dict['timeseries_uuid'] = self.results[i]['uuid']
values[location_uuid] = loc_dict
npts_min = np.nanmin(npts_calculated, 0)
npts_max = np.nanmax(npts_calculated, 0)
extremes = {
stat: {
'min': npts_min[i] if not np.isnan(npts_min[i]) else 0,
'max': npts_max[i] if not np.isnan(npts_max[i]) else 0
} for i, stat in stats2
}
dt_conversion = {
'js': lambda x: x,
'dt': jsdatetime.js_to_datetime,
'str': jsdatetime.js_to_datestring
}[date_time]
if statistic != 'difference (mean last - first year)':
start = dt_conversion(max(jsdatetime.round_js_to_date(start_date),
jsdatetime.round_js_to_date(npts_min[-2])))
end = dt_conversion(min(jsdatetime.round_js_to_date(end_date),
jsdatetime.round_js_to_date(npts_max[-1])))
else:
start = dt_conversion(jsdatetime.round_js_to_date(start_date))
end = dt_conversion(jsdatetime.round_js_to_date(end_date))
self.response = {
"extremes": extremes,
"dates": {
"start": start,
"end": end
},
"values": values
}
return self.response
class GroundwaterLocations(Locations):
"""
Makes a connection to the locations endpoint of the lizard api.
Only selects GroundwaterStations.
"""
@property
def extra_queries(self):
return {
"object_type__model": 'filter'
}
class GroundwaterTimeSeries(TimeSeries):
"""
Makes a connection to the timeseries endpoint of the lizard api.
Only selects GroundwaterStations.
"""
@property
def extra_queries(self):
return {
"location__object_type__model": 'filter'
}
class GroundwaterTimeSeriesAndLocations(object):
def __init__(self):
self.locs = GroundwaterLocations()
self.ts = GroundwaterTimeSeries()
self.values = {}
def bbox(self, south_west, north_east, start='0001-01-01T00:00:00Z',
end=None, groundwater_type="GWmMSL"):
if not end:
self.end = jsdatetime.now_iso()
else:
self.end = end
self.start = start
self.ts.queries = {"name": groundwater_type}
self.locs.bbox(south_west, north_east)
self.ts.bbox(south_west=south_west, north_east=north_east,
start=start, end=self.end)
def locs_to_dict(self, values=None):
if values:
self.values = values
for loc in self.locs.results:
self.values.get(loc['uuid'], {}).update({
'coordinates': loc['geometry']['coordinates'],
'name': loc['name']
})
self.response = self.values
def results_to_dict(self):
self.locs_to_dict()
self.ts.ts_to_dict(values=self.values)
return self.ts.response
class RasterFeatureInfo(Base):
data_type = 'raster-aggregates'
def wms(self, lat, lng, layername, extra_params=None):
if 'igrac' in layername:
self.base_url = "https://raster.lizard.net/wms"
lat_f = float(lat)
lng_f = float(lng)
self.get(
request="getfeatureinfo",
layers=layername,
width=1,
height=1,
i=0,
j=0,
srs="epsg:4326",
bbox=','.join(
[lng, lat, str(lng_f+0.00001), str(lat_f+0.00001)]),
index="world"
)
try:
self.results = {"data": [self.results[1]]}
except IndexError:
self.results = {"data": ['null']}
elif layername == 'aquifers':
self.base_url = "https://ggis.un-igrac.org/geoserver/tbamap2015/wms"
extra_params.update({
'request': 'GetFeatureInfo',
'service': 'WMS',
'srs': 'EPSG:4326',
'info_format': 'application/json'
})
self.get(**extra_params)
self.results = {
'data': self.results['features'][0]['properties']['aq_name']}
else:
self.get(
agg='curve',
geom='POINT(' + lng + '+' + lat + ')',
srs='EPSG:4326',
raster_names=layername,
count=False
)
return self.results
def parse(self):
self.results = self.json
class RasterLimits(Base):
data_type = 'wms'
def __init__(self, base="https://raster.lizard.net",
use_header=False):
super().__init__(base, use_header)
self.base_url = join_urls(base, self.data_type)
self.max_results = None
def get_limits(self, layername, bbox):
try:
return self.get(
request='getlimits',
layers=layername,
bbox=bbox,
width=16,
height=16,
srs='epsg:4326'
)
except urllib.error.HTTPError:
return [[-1000, 1000]]
def parse(self):
self.results = self.json
class Filters(Base):
data_type = "filters"
def from_timeseries_uuid(self, uuid):
# We know the timeseries uuid. Timeseries are connected to locations
# and the locations are connected to the filters that contain the
# relevant information.
# first get the location uuid from the timeseries.
ts = Base(use_header=self.use_header, data_type='timeseries')
location_data = ts.get(uuid=uuid)[0]['location']
location_uuid = location_data.get('uuid')
# surface_level is stored in the extra_metadata field of a location
try:
surface_level = str(location_data.get("extra_metadata")
.get("surface_level")) + " (m)"
except AttributeError:
surface_level = None
# next get the location for the filter id
location = Base(use_header=self.use_header, data_type='locations')
try:
filter_id = location.get(uuid=location_uuid)[0].get(
'object').get('id')
except TypeError:
# the location doesn't connect to a filter, return empty
return {}
if filter_id:
# next get and return the filter metadata
gw_filter = Base(use_header=self.use_header, data_type='filters')
result = gw_filter.get(uuid=filter_id)[0]
result.update({
"surface_level": surface_level
})
return result
return {}
class Users(Base):
data_type = "users"
def get_organisations(self, username):
self.get(username=username)
if len(self.results) > 1 or len(self.results) == 0:
if len(self.results):
raise LizardApiError("Username is not unique")
raise LizardApiError("Username not found")
organisations_url = self.results[0].get("organisations_url")
organisations = {
org['name']: org['unique_id'] for org in
self.fetch(organisations_url)
}
logger.debug('Found %d organisations for url: %s', len(organisations),
organisations_url)
if settings.DEFAULT_ORGANISATION_NAME in organisations.keys():
default_org = [(
settings.DEFAULT_ORGANISATION_NAME,
organisations[settings.DEFAULT_ORGANISATION_NAME])
]
del organisations[settings.DEFAULT_ORGANISATION_NAME]
return default_org + sorted(organisations.items())
return sorted(organisations.items())
if __name__ == '__main__':
end = "1452470400000"
start = "-2208988800000"
start_time = time()
GWinfo = GroundwaterTimeSeriesAndLocations()
GWinfo.bbox(south_west=[-65.80277639340238, -223.9453125], north_east=[
81.46626086056541, 187.3828125], start=start, end=end)
x = GWinfo.results_to_dict()
print(time() - start_time)
pprint(x)
| gpl-3.0 | [
646,
1331,
199,
646,
2197,
465,
4487,
199,
646,
2022,
199,
646,
2050,
199,
504,
10933,
492,
10933,
221,
327,
3602,
2348,
367,
10201,
12901,
199,
504,
900,
492,
900,
199,
504,
900,
492,
9435,
199,
646,
4011,
199,
199,
646,
2680,
465,
980,
199,
646,
1639,
14,
1018,
14,
3924,
199,
199,
504,
9220,
492,
8586,
2083,
199,
893,
26,
272,
687,
1639,
14,
2190,
492,
2202,
272,
738,
5943,
12,
510,
16698,
275,
2202,
14,
22592,
12,
2202,
14,
10780,
36,
199,
2590,
1639,
14,
1018,
14,
3924,
14,
8499,
10951,
26,
272,
870,
360,
9171,
26,
949,
738,
5943,
436,
510,
16698,
1911,
315,
2202,
14,
738,
5943,
436,
510,
16698,
1077,
1172,
7,
881,
283,
1235,
287,
663,
2544,
6868,
358,
272,
738,
5943,
275,
488,
272,
510,
16698,
275,
488,
199,
199,
3,
3979,
1265,
675,
642,
2884,
10584,
23016,
12,
8749,
663,
2195,
4676,
2556,
2348,
26,
199,
3,
738,
5943,
275,
1011,
1116,
221,
327,
14402,
314,
410,
4291,
543,
2195,
922,
536,
14,
199,
3,
510,
16698,
275,
1011,
1116,
221,
327,
14402,
314,
410,
4291,
543,
2195,
2505,
14,
421,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
318,
4263,
63,
3603,
2031,
589,
304,
272,
372,
20538,
904,
8,
589,
9,
421,
199,
533,
491,
6281,
7394,
547,
8,
1726,
304,
272,
986,
421,
199,
533,
3523,
8,
785,
304,
272,
408,
272,
3523,
1021,
370,
4907,
370,
314,
3365,
16173,
402,
314,
1212,
90,
1005,
13,
1246,
14,
272,
520,
635,
666,
63,
466,
26,
6037,
402,
314,
1212,
90,
1005,
13,
1246,
1373,
13809,
397,
370,
4907,
370,
14,
272,
520,
635,
3434,
26,
4676,
3434,
272,
520,
635,
2505,
26,
4676,
2505,
272,
520,
635,
675,
63,
1291,
26,
949,
4676,
436,
2505,
365,
3222,
543,
314,
1827,
1380,
663,
2432,
370,
756,
272,
520,
635,
2402,
63,
10590,
26,
1010,
1930,
1373,
13809,
397,
370,
663,
849,
9212,
367,
282,
2079,
9842,
666,
730,
642,
365,
314,
299,
416,
261,
14,
272,
520,
635,
1390,
63,
2604,
26,
272,
408,
272,
3434,
275,
738,
5943,
272,
2505,
275,
510,
16698,
272,
1390,
63,
2604,
275,
5198,
339,
768,
1829,
272,
347,
2402,
63,
10590,
8,
277,
304,
267,
408,
267,
7259,
952,
1021,
370,
1050,
9212,
267,
520,
1107,
26,
2600,
543,
2402,
9212,
267,
408,
267,
372,
1052,
339,
347,
5981,
13181,
63,
1131,
8,
277,
12,
5981,
13181,
12,
1050,
63,
1131,
63,
875,
534,
1985,
12168,
267,
5981,
63,
1131,
275,
1052,
267,
340,
1228,
8,
17425,
12,
620,
304,
288,
5981,
63,
1131,
14,
873,
2561,
525,
63,
1131,
63,
875,
435,
298,
17425,
363,
3235,
63,
344,
582,
2892,
5981,
13181,
1552,
267,
916,
5981,
13181,
26,
288,
5981,
63,
1131,
14,
873,
2561,
355,
1050,
63,
1131,
63,
875,
435,
298,
17425,
363,
3235,
63,
344,
582,
12814,
904,
8,
490,
5981,
367,
5981,
315,
5981,
13181,
9,
288,
3828,
267,
340,
5981,
63,
1131,
26,
288,
372,
1211,
779,
4078,
14,
1122,
14,
10738,
8,
1308,
63,
1131,
680,
1294,
26800,
2023,
267,
587,
26,
288,
372,
1052,
339,
347,
636,
826,
721,
277,
12,
1300,
628,
2859,
921,
2721,
10344,
14,
19030,
1005,
14,
846,
401,
675,
63,
1291,
29,
797,
12,
326,
666,
63,
466,
29,
403,
304,
267,
408,
267,
520,
635,
1300,
26,
314,
4770,
1373,
13809,
397,
370,
4907,
370,
14,
7827,
370,
314,
2151,
491,
6281,
486,
71,
10344,
9920,
4770,
14,
267,
408,
267,
340,
666,
63,
466,
26,
288,
291,
14,
576,
63,
466,
275,
666,
63,
466,
267,
291,
14,
1180,
63,
1291,
275,
675,
63,
1291,
267,
291,
14,
10590,
275,
1052,
267,
291,
14,
2604,
275,
942,
267,
340,
1300,
14,
2460,
360,
1014,
735,
288,
291,
14,
1095,
275,
1300,
267,
587,
26,
288,
291,
14,
1095,
275,
4263,
63,
3603,
360,
2859,
26,
3678,
1300,
9,
288,
327,
1928,
2402,
7324,
7167,
62,
12,
642,
365,
3483,
315,
4263,
63,
3603,
267,
291,
14,
1095,
63,
633,
275,
4263,
63,
3603,
8,
277,
14,
1095,
12,
283,
1246,
15,
86,
18,
297,
291,
14,
576,
63,
466,
9,
435,
7324,
339,
347,
664,
8,
277,
12,
2338,
29,
549,
12,
5377,
29,
403,
12,
1011,
10590,
304,
267,
408,
267,
8133,
314,
2986,
14,
267,
2104,
3962,
9212,
1937,
26,
4178,
921,
78,
400,
14,
26840,
14,
19030,
1005,
14,
846,
15,
1301,
15,
1246,
14,
1360,
267,
31299,
314,
2986,
13,
1310,
465,
282,
1211,
315,
314,
2058,
2225,
14,
267,
520,
635,
9212,
26,
1006,
4252,
2368,
787,
1202,
465,
9212,
14,
267,
520,
1107,
26,
282,
2600,
402,
314,
2986,
13,
1310,
14,
267,
408,
267,
340,
291,
14,
988,
63,
2604,
26,
288,
9212,
14,
873,
3252,
1606,
63,
890,
356,
291,
14,
988,
63,
2604,
12,
283,
908,
356,
283,
1001,
3071,
267,
9212,
14,
873,
8,
277,
14,
2911,
63,
10590,
9,
267,
9212,
14,
873,
8,
5675,
8,
277,
12,
298,
10590,
401,
17003,
267,
1827,
275,
15539,
435,
7673,
1370,
904,
8,
495,
8,
498,
9,
435,
14051,
435,
3044,
13636,
6,
7,
435,
620,
8,
498,
9,
435,
26143,
1959,
904,
8,
585,
9,
3044,
340,
1228,
8,
585,
12,
769,
9,
587,
620,
8,
585,
430,
3044,
367,
790,
12,
574,
315,
9212,
14,
1744,
1012,
267,
1166,
275,
4011,
14,
1122,
14,
17755,
8,
277,
14,
1095,
63,
633,
12,
620,
8,
2580,
430,
340,
5377,
587,
971,
288,
291,
14,
1095,
63,
633,
435,
1827,
267,
862,
26,
288,
291,
14,
3535,
8,
633,
9,
267,
871,
4011,
14,
705,
14,
12815,
26,
221,
327,
3254,
2813,
11176,
370,
7981,
841,
1165,
1125,
288,
291,
14,
1001,
275,
791,
2604,
356,
990,
283,
835,
356,
378,
93,
267,
862,
26,
288,
2512,
14,
1757,
360,
3259,
1911,
450,
83,
520,
450,
83,
543,
2851,
26,
450,
83,
297,
291,
14,
576,
63,
466,
12,
586,
291,
14,
1001,
14,
362,
360,
835,
297,
378,
395,
1166,
9,
267,
871,
334,
10230,
12,
4281,
304,
288,
2512,
14,
1757,
360,
13662,
2058,
687,
450,
83,
543
] | [
1331,
199,
646,
2197,
465,
4487,
199,
646,
2022,
199,
646,
2050,
199,
504,
10933,
492,
10933,
221,
327,
3602,
2348,
367,
10201,
12901,
199,
504,
900,
492,
900,
199,
504,
900,
492,
9435,
199,
646,
4011,
199,
199,
646,
2680,
465,
980,
199,
646,
1639,
14,
1018,
14,
3924,
199,
199,
504,
9220,
492,
8586,
2083,
199,
893,
26,
272,
687,
1639,
14,
2190,
492,
2202,
272,
738,
5943,
12,
510,
16698,
275,
2202,
14,
22592,
12,
2202,
14,
10780,
36,
199,
2590,
1639,
14,
1018,
14,
3924,
14,
8499,
10951,
26,
272,
870,
360,
9171,
26,
949,
738,
5943,
436,
510,
16698,
1911,
315,
2202,
14,
738,
5943,
436,
510,
16698,
1077,
1172,
7,
881,
283,
1235,
287,
663,
2544,
6868,
358,
272,
738,
5943,
275,
488,
272,
510,
16698,
275,
488,
199,
199,
3,
3979,
1265,
675,
642,
2884,
10584,
23016,
12,
8749,
663,
2195,
4676,
2556,
2348,
26,
199,
3,
738,
5943,
275,
1011,
1116,
221,
327,
14402,
314,
410,
4291,
543,
2195,
922,
536,
14,
199,
3,
510,
16698,
275,
1011,
1116,
221,
327,
14402,
314,
410,
4291,
543,
2195,
2505,
14,
421,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
318,
4263,
63,
3603,
2031,
589,
304,
272,
372,
20538,
904,
8,
589,
9,
421,
199,
533,
491,
6281,
7394,
547,
8,
1726,
304,
272,
986,
421,
199,
533,
3523,
8,
785,
304,
272,
408,
272,
3523,
1021,
370,
4907,
370,
314,
3365,
16173,
402,
314,
1212,
90,
1005,
13,
1246,
14,
272,
520,
635,
666,
63,
466,
26,
6037,
402,
314,
1212,
90,
1005,
13,
1246,
1373,
13809,
397,
370,
4907,
370,
14,
272,
520,
635,
3434,
26,
4676,
3434,
272,
520,
635,
2505,
26,
4676,
2505,
272,
520,
635,
675,
63,
1291,
26,
949,
4676,
436,
2505,
365,
3222,
543,
314,
1827,
1380,
663,
2432,
370,
756,
272,
520,
635,
2402,
63,
10590,
26,
1010,
1930,
1373,
13809,
397,
370,
663,
849,
9212,
367,
282,
2079,
9842,
666,
730,
642,
365,
314,
299,
416,
261,
14,
272,
520,
635,
1390,
63,
2604,
26,
272,
408,
272,
3434,
275,
738,
5943,
272,
2505,
275,
510,
16698,
272,
1390,
63,
2604,
275,
5198,
339,
768,
1829,
272,
347,
2402,
63,
10590,
8,
277,
304,
267,
408,
267,
7259,
952,
1021,
370,
1050,
9212,
267,
520,
1107,
26,
2600,
543,
2402,
9212,
267,
408,
267,
372,
1052,
339,
347,
5981,
13181,
63,
1131,
8,
277,
12,
5981,
13181,
12,
1050,
63,
1131,
63,
875,
534,
1985,
12168,
267,
5981,
63,
1131,
275,
1052,
267,
340,
1228,
8,
17425,
12,
620,
304,
288,
5981,
63,
1131,
14,
873,
2561,
525,
63,
1131,
63,
875,
435,
298,
17425,
363,
3235,
63,
344,
582,
2892,
5981,
13181,
1552,
267,
916,
5981,
13181,
26,
288,
5981,
63,
1131,
14,
873,
2561,
355,
1050,
63,
1131,
63,
875,
435,
298,
17425,
363,
3235,
63,
344,
582,
12814,
904,
8,
490,
5981,
367,
5981,
315,
5981,
13181,
9,
288,
3828,
267,
340,
5981,
63,
1131,
26,
288,
372,
1211,
779,
4078,
14,
1122,
14,
10738,
8,
1308,
63,
1131,
680,
1294,
26800,
2023,
267,
587,
26,
288,
372,
1052,
339,
347,
636,
826,
721,
277,
12,
1300,
628,
2859,
921,
2721,
10344,
14,
19030,
1005,
14,
846,
401,
675,
63,
1291,
29,
797,
12,
326,
666,
63,
466,
29,
403,
304,
267,
408,
267,
520,
635,
1300,
26,
314,
4770,
1373,
13809,
397,
370,
4907,
370,
14,
7827,
370,
314,
2151,
491,
6281,
486,
71,
10344,
9920,
4770,
14,
267,
408,
267,
340,
666,
63,
466,
26,
288,
291,
14,
576,
63,
466,
275,
666,
63,
466,
267,
291,
14,
1180,
63,
1291,
275,
675,
63,
1291,
267,
291,
14,
10590,
275,
1052,
267,
291,
14,
2604,
275,
942,
267,
340,
1300,
14,
2460,
360,
1014,
735,
288,
291,
14,
1095,
275,
1300,
267,
587,
26,
288,
291,
14,
1095,
275,
4263,
63,
3603,
360,
2859,
26,
3678,
1300,
9,
288,
327,
1928,
2402,
7324,
7167,
62,
12,
642,
365,
3483,
315,
4263,
63,
3603,
267,
291,
14,
1095,
63,
633,
275,
4263,
63,
3603,
8,
277,
14,
1095,
12,
283,
1246,
15,
86,
18,
297,
291,
14,
576,
63,
466,
9,
435,
7324,
339,
347,
664,
8,
277,
12,
2338,
29,
549,
12,
5377,
29,
403,
12,
1011,
10590,
304,
267,
408,
267,
8133,
314,
2986,
14,
267,
2104,
3962,
9212,
1937,
26,
4178,
921,
78,
400,
14,
26840,
14,
19030,
1005,
14,
846,
15,
1301,
15,
1246,
14,
1360,
267,
31299,
314,
2986,
13,
1310,
465,
282,
1211,
315,
314,
2058,
2225,
14,
267,
520,
635,
9212,
26,
1006,
4252,
2368,
787,
1202,
465,
9212,
14,
267,
520,
1107,
26,
282,
2600,
402,
314,
2986,
13,
1310,
14,
267,
408,
267,
340,
291,
14,
988,
63,
2604,
26,
288,
9212,
14,
873,
3252,
1606,
63,
890,
356,
291,
14,
988,
63,
2604,
12,
283,
908,
356,
283,
1001,
3071,
267,
9212,
14,
873,
8,
277,
14,
2911,
63,
10590,
9,
267,
9212,
14,
873,
8,
5675,
8,
277,
12,
298,
10590,
401,
17003,
267,
1827,
275,
15539,
435,
7673,
1370,
904,
8,
495,
8,
498,
9,
435,
14051,
435,
3044,
13636,
6,
7,
435,
620,
8,
498,
9,
435,
26143,
1959,
904,
8,
585,
9,
3044,
340,
1228,
8,
585,
12,
769,
9,
587,
620,
8,
585,
430,
3044,
367,
790,
12,
574,
315,
9212,
14,
1744,
1012,
267,
1166,
275,
4011,
14,
1122,
14,
17755,
8,
277,
14,
1095,
63,
633,
12,
620,
8,
2580,
430,
340,
5377,
587,
971,
288,
291,
14,
1095,
63,
633,
435,
1827,
267,
862,
26,
288,
291,
14,
3535,
8,
633,
9,
267,
871,
4011,
14,
705,
14,
12815,
26,
221,
327,
3254,
2813,
11176,
370,
7981,
841,
1165,
1125,
288,
291,
14,
1001,
275,
791,
2604,
356,
990,
283,
835,
356,
378,
93,
267,
862,
26,
288,
2512,
14,
1757,
360,
3259,
1911,
450,
83,
520,
450,
83,
543,
2851,
26,
450,
83,
297,
291,
14,
576,
63,
466,
12,
586,
291,
14,
1001,
14,
362,
360,
835,
297,
378,
395,
1166,
9,
267,
871,
334,
10230,
12,
4281,
304,
288,
2512,
14,
1757,
360,
13662,
2058,
687,
450,
83,
543,
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,
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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
] |
heyavery/lopenr | venv/lib/python2.7/site-packages/django/contrib/gis/db/models/aggregates.py | 414 | 2395 | from django.contrib.gis.db.models.fields import ExtentField
from django.db.models.aggregates import Aggregate
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']
class GeoAggregate(Aggregate):
function = None
is_extent = False
def as_sql(self, compiler, connection):
# this will be called again in parent, but it's needed now - before
# we get the spatial_aggregate_name
connection.ops.check_expression_support(self)
self.function = connection.ops.spatial_aggregate_name(self.name)
return super(GeoAggregate, self).as_sql(compiler, connection)
def as_oracle(self, compiler, connection):
if not hasattr(self, 'tolerance'):
self.tolerance = 0.05
self.extra['tolerance'] = self.tolerance
if not self.is_extent:
self.template = '%(function)s(SDOAGGRTYPE(%(expressions)s,%(tolerance)s))'
return self.as_sql(compiler, connection)
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
c = super(GeoAggregate, self).resolve_expression(query, allow_joins, reuse, summarize, for_save)
for expr in c.get_source_expressions():
if not hasattr(expr.field, 'geom_type'):
raise ValueError('Geospatial aggregates only allowed on geometry fields.')
return c
def convert_value(self, value, expression, connection, context):
return connection.ops.convert_geom(value, self.output_field)
class Collect(GeoAggregate):
name = 'Collect'
class Extent(GeoAggregate):
name = 'Extent'
is_extent = '2D'
def __init__(self, expression, **extra):
super(Extent, self).__init__(expression, output_field=ExtentField(), **extra)
def convert_value(self, value, expression, connection, context):
return connection.ops.convert_extent(value, context.get('transformed_srid'))
class Extent3D(GeoAggregate):
name = 'Extent3D'
is_extent = '3D'
def __init__(self, expression, **extra):
super(Extent3D, self).__init__(expression, output_field=ExtentField(), **extra)
def convert_value(self, value, expression, connection, context):
return connection.ops.convert_extent3d(value, context.get('transformed_srid'))
class MakeLine(GeoAggregate):
name = 'MakeLine'
class Union(GeoAggregate):
name = 'Union'
| mit | [
504,
1639,
14,
2828,
14,
5668,
14,
697,
14,
992,
14,
955,
492,
1316,
767,
792,
199,
504,
1639,
14,
697,
14,
992,
14,
21622,
492,
29397,
199,
199,
363,
452,
363,
275,
788,
25023,
297,
283,
19808,
297,
283,
19808,
19,
36,
297,
283,
5483,
3049,
297,
283,
15540,
418,
421,
199,
533,
8875,
10170,
8,
10170,
304,
272,
805,
275,
488,
272,
365,
63,
11599,
275,
756,
339,
347,
465,
63,
3009,
8,
277,
12,
6365,
12,
1950,
304,
267,
327,
642,
911,
506,
2797,
4020,
315,
1676,
12,
1325,
652,
1159,
4346,
3063,
446,
2544,
267,
327,
781,
664,
314,
11469,
63,
7516,
63,
354,
267,
1950,
14,
1483,
14,
1074,
63,
5599,
63,
4058,
8,
277,
9,
267,
291,
14,
1593,
275,
1950,
14,
1483,
14,
11679,
63,
7516,
63,
354,
8,
277,
14,
354,
9,
267,
372,
1613,
8,
10748,
10170,
12,
291,
680,
305,
63,
3009,
8,
5772,
12,
1950,
9,
339,
347,
465,
63,
16404,
8,
277,
12,
6365,
12,
1950,
304,
267,
340,
440,
2688,
8,
277,
12,
283,
16312,
735,
288,
291,
14,
16312,
275,
378,
14,
1717,
267,
291,
14,
2911,
459,
16312,
418,
275,
291,
14,
16312,
267,
340,
440,
291,
14,
374,
63,
11599,
26,
288,
291,
14,
1160,
275,
9487,
1593,
9,
83,
8,
24399,
1254,
3975,
2711,
12473,
15264,
9,
83,
12,
2840,
16312,
9,
83,
23089,
267,
372,
291,
14,
305,
63,
3009,
8,
5772,
12,
1950,
9,
339,
347,
7512,
63,
5599,
8,
277,
12,
1827,
29,
403,
12,
2040,
63,
20155,
29,
549,
12,
12598,
29,
403,
12,
22301,
29,
797,
12,
367,
63,
2117,
29,
797,
304,
267,
286,
275,
1613,
8,
10748,
10170,
12,
291,
680,
6983,
63,
5599,
8,
1131,
12,
2040,
63,
20155,
12,
12598,
12,
22301,
12,
367,
63,
2117,
9,
267,
367,
5348,
315,
286,
14,
362,
63,
1365,
63,
15264,
837,
288,
340,
440,
2688,
8,
3684,
14,
698,
12,
283,
6481,
63,
466,
735,
355,
746,
1722,
360,
4240,
736,
9491,
27535,
1454,
4370,
641,
3400,
1504,
2659,
267,
372,
286,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
6481,
8,
585,
12,
291,
14,
1199,
63,
698,
9,
421,
199,
533,
19649,
8,
10748,
10170,
304,
272,
536,
275,
283,
25023,
7,
421,
199,
533,
1316,
767,
8,
10748,
10170,
304,
272,
536,
275,
283,
19808,
7,
272,
365,
63,
11599,
275,
283,
18,
36,
7,
339,
347,
636,
826,
721,
277,
12,
3965,
12,
1011,
2911,
304,
267,
1613,
8,
19808,
12,
291,
2843,
826,
721,
5599,
12,
1072,
63,
698,
29,
19808,
792,
1062,
1011,
2911,
9,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
11599,
8,
585,
12,
1067,
14,
362,
360,
20209,
63,
10498,
1333,
421,
199,
533,
1316,
767,
19,
36,
8,
10748,
10170,
304,
272,
536,
275,
283,
19808,
19,
36,
7,
272,
365,
63,
11599,
275,
283,
19,
36,
7,
339,
347,
636,
826,
721,
277,
12,
3965,
12,
1011,
2911,
304,
267,
1613,
8,
19808,
19,
36,
12,
291,
2843,
826,
721,
5599,
12,
1072,
63,
698,
29,
19808,
792,
1062,
1011,
2911,
9,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
11599,
19,
68,
8,
585,
12,
1067,
14,
362,
360,
20209,
63,
10498,
1333,
421,
199,
533,
4155,
3049,
8,
10748,
10170,
304,
272,
536,
275,
283,
5483,
3049,
7,
421,
199,
533,
15961,
8,
10748,
10170,
304,
272,
536,
275,
283,
15540,
7,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
1639,
14,
2828,
14,
5668,
14,
697,
14,
992,
14,
955,
492,
1316,
767,
792,
199,
504,
1639,
14,
697,
14,
992,
14,
21622,
492,
29397,
199,
199,
363,
452,
363,
275,
788,
25023,
297,
283,
19808,
297,
283,
19808,
19,
36,
297,
283,
5483,
3049,
297,
283,
15540,
418,
421,
199,
533,
8875,
10170,
8,
10170,
304,
272,
805,
275,
488,
272,
365,
63,
11599,
275,
756,
339,
347,
465,
63,
3009,
8,
277,
12,
6365,
12,
1950,
304,
267,
327,
642,
911,
506,
2797,
4020,
315,
1676,
12,
1325,
652,
1159,
4346,
3063,
446,
2544,
267,
327,
781,
664,
314,
11469,
63,
7516,
63,
354,
267,
1950,
14,
1483,
14,
1074,
63,
5599,
63,
4058,
8,
277,
9,
267,
291,
14,
1593,
275,
1950,
14,
1483,
14,
11679,
63,
7516,
63,
354,
8,
277,
14,
354,
9,
267,
372,
1613,
8,
10748,
10170,
12,
291,
680,
305,
63,
3009,
8,
5772,
12,
1950,
9,
339,
347,
465,
63,
16404,
8,
277,
12,
6365,
12,
1950,
304,
267,
340,
440,
2688,
8,
277,
12,
283,
16312,
735,
288,
291,
14,
16312,
275,
378,
14,
1717,
267,
291,
14,
2911,
459,
16312,
418,
275,
291,
14,
16312,
267,
340,
440,
291,
14,
374,
63,
11599,
26,
288,
291,
14,
1160,
275,
9487,
1593,
9,
83,
8,
24399,
1254,
3975,
2711,
12473,
15264,
9,
83,
12,
2840,
16312,
9,
83,
23089,
267,
372,
291,
14,
305,
63,
3009,
8,
5772,
12,
1950,
9,
339,
347,
7512,
63,
5599,
8,
277,
12,
1827,
29,
403,
12,
2040,
63,
20155,
29,
549,
12,
12598,
29,
403,
12,
22301,
29,
797,
12,
367,
63,
2117,
29,
797,
304,
267,
286,
275,
1613,
8,
10748,
10170,
12,
291,
680,
6983,
63,
5599,
8,
1131,
12,
2040,
63,
20155,
12,
12598,
12,
22301,
12,
367,
63,
2117,
9,
267,
367,
5348,
315,
286,
14,
362,
63,
1365,
63,
15264,
837,
288,
340,
440,
2688,
8,
3684,
14,
698,
12,
283,
6481,
63,
466,
735,
355,
746,
1722,
360,
4240,
736,
9491,
27535,
1454,
4370,
641,
3400,
1504,
2659,
267,
372,
286,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
6481,
8,
585,
12,
291,
14,
1199,
63,
698,
9,
421,
199,
533,
19649,
8,
10748,
10170,
304,
272,
536,
275,
283,
25023,
7,
421,
199,
533,
1316,
767,
8,
10748,
10170,
304,
272,
536,
275,
283,
19808,
7,
272,
365,
63,
11599,
275,
283,
18,
36,
7,
339,
347,
636,
826,
721,
277,
12,
3965,
12,
1011,
2911,
304,
267,
1613,
8,
19808,
12,
291,
2843,
826,
721,
5599,
12,
1072,
63,
698,
29,
19808,
792,
1062,
1011,
2911,
9,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
11599,
8,
585,
12,
1067,
14,
362,
360,
20209,
63,
10498,
1333,
421,
199,
533,
1316,
767,
19,
36,
8,
10748,
10170,
304,
272,
536,
275,
283,
19808,
19,
36,
7,
272,
365,
63,
11599,
275,
283,
19,
36,
7,
339,
347,
636,
826,
721,
277,
12,
3965,
12,
1011,
2911,
304,
267,
1613,
8,
19808,
19,
36,
12,
291,
2843,
826,
721,
5599,
12,
1072,
63,
698,
29,
19808,
792,
1062,
1011,
2911,
9,
339,
347,
3957,
63,
585,
8,
277,
12,
574,
12,
3965,
12,
1950,
12,
1067,
304,
267,
372,
1950,
14,
1483,
14,
3916,
63,
11599,
19,
68,
8,
585,
12,
1067,
14,
362,
360,
20209,
63,
10498,
1333,
421,
199,
533,
4155,
3049,
8,
10748,
10170,
304,
272,
536,
275,
283,
5483,
3049,
7,
421,
199,
533,
15961,
8,
10748,
10170,
304,
272,
536,
275,
283,
15540,
7,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
steventimberman/masterDebater | env/lib/python2.7/site-packages/django/db/backends/base/operations.py | 44 | 23686 | import datetime
import decimal
import warnings
from importlib import import_module
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends import utils
from django.utils import six, timezone
from django.utils.dateparse import parse_duration
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text
class BaseDatabaseOperations(object):
"""
This class encapsulates all backend-specific differences, such as the way
a backend performs ordering or calculates the ID of a recently-inserted
row.
"""
compiler_module = "django.db.models.sql.compiler"
# Integer field safe ranges by `internal_type` as documented
# in docs/ref/models/fields.txt.
integer_field_ranges = {
'SmallIntegerField': (-32768, 32767),
'IntegerField': (-2147483648, 2147483647),
'BigIntegerField': (-9223372036854775808, 9223372036854775807),
'PositiveSmallIntegerField': (0, 32767),
'PositiveIntegerField': (0, 2147483647),
}
set_operators = {
'union': 'UNION',
'intersection': 'INTERSECT',
'difference': 'EXCEPT',
}
def __init__(self, connection):
self.connection = connection
self._cache = None
def autoinc_sql(self, table, column):
"""
Returns any SQL needed to support auto-incrementing primary keys, or
None if no SQL is necessary.
This SQL is executed when a table is created.
"""
return None
def bulk_batch_size(self, fields, objs):
"""
Returns the maximum allowed batch size for the backend. The fields
are the fields going to be inserted in the batch, the objs contains
all the objects to be inserted.
"""
return len(objs)
def cache_key_culling_sql(self):
"""
Returns an SQL query that retrieves the first cache key greater than the
n smallest.
This is used by the 'db' cache backend to determine where to start
culling.
"""
return "SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s"
def unification_cast_sql(self, output_field):
"""
Given a field instance, returns the SQL necessary to cast the result of
a union to that type. Note that the resulting string should contain a
'%s' placeholder for the expression being cast.
"""
return '%s'
def date_extract_sql(self, lookup_type, field_name):
"""
Given a lookup_type of 'year', 'month' or 'day', returns the SQL that
extracts a value from the given date field field_name.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a date_extract_sql() method')
def date_interval_sql(self, timedelta):
"""
Implements the date interval functionality for expressions
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a date_interval_sql() method')
def date_trunc_sql(self, lookup_type, field_name):
"""
Given a lookup_type of 'year', 'month' or 'day', returns the SQL that
truncates the given date field field_name to a date object with only
the given specificity.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetrunc_sql() method')
def datetime_cast_date_sql(self, field_name, tzname):
"""
Returns the SQL necessary to cast a datetime value to date value.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_cast_date() method')
def datetime_cast_time_sql(self, field_name, tzname):
"""
Returns the SQL necessary to cast a datetime value to time value.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_cast_time_sql() method')
def datetime_extract_sql(self, lookup_type, field_name, tzname):
"""
Given a lookup_type of 'year', 'month', 'day', 'hour', 'minute' or
'second', returns the SQL that extracts a value from the given
datetime field field_name, and a tuple of parameters.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_extract_sql() method')
def datetime_trunc_sql(self, lookup_type, field_name, tzname):
"""
Given a lookup_type of 'year', 'month', 'day', 'hour', 'minute' or
'second', returns the SQL that truncates the given datetime field
field_name to a datetime object with only the given specificity, and
a tuple of parameters.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_trunk_sql() method')
def time_trunc_sql(self, lookup_type, field_name):
"""
Given a lookup_type of 'hour', 'minute' or 'second', returns the SQL
that truncates the given time field field_name to a time object with
only the given specificity.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a time_trunc_sql() method')
def time_extract_sql(self, lookup_type, field_name):
"""
Given a lookup_type of 'hour', 'minute' or 'second', returns the SQL
that extracts a value from the given time field field_name.
"""
return self.date_extract_sql(lookup_type, field_name)
def deferrable_sql(self):
"""
Returns the SQL necessary to make a constraint "initially deferred"
during a CREATE TABLE statement.
"""
return ''
def distinct_sql(self, fields):
"""
Returns an SQL DISTINCT clause which removes duplicate rows from the
result set. If any fields are given, only the given fields are being
checked for duplicates.
"""
if fields:
raise NotImplementedError('DISTINCT ON fields is not supported by this database backend')
else:
return 'DISTINCT'
def fetch_returned_insert_id(self, cursor):
"""
Given a cursor object that has just performed an INSERT...RETURNING
statement into a table that has an auto-incrementing ID, returns the
newly created ID.
"""
return cursor.fetchone()[0]
def field_cast_sql(self, db_type, internal_type):
"""
Given a column type (e.g. 'BLOB', 'VARCHAR'), and an internal type
(e.g. 'GenericIPAddressField'), returns the SQL necessary to cast it
before using it in a WHERE statement. Note that the resulting string
should contain a '%s' placeholder for the column being searched against.
"""
return '%s'
def force_no_ordering(self):
"""
Returns a list used in the "ORDER BY" clause to force no ordering at
all. Returning an empty list means that nothing will be included in the
ordering.
"""
return []
def for_update_sql(self, nowait=False, skip_locked=False):
"""
Returns the FOR UPDATE SQL clause to lock rows for an update operation.
"""
if nowait:
return 'FOR UPDATE NOWAIT'
elif skip_locked:
return 'FOR UPDATE SKIP LOCKED'
else:
return 'FOR UPDATE'
def fulltext_search_sql(self, field_name):
"""
Returns the SQL WHERE clause to use in order to perform a full-text
search of the given field_name. Note that the resulting string should
contain a '%s' placeholder for the value being searched against.
"""
# RemovedInDjango20Warning
raise NotImplementedError('Full-text search is not implemented for this database backend')
def last_executed_query(self, cursor, sql, params):
"""
Returns a string of the query last executed by the given cursor, with
placeholders replaced with actual values.
`sql` is the raw query containing placeholders, and `params` is the
sequence of parameters. These are used by default, but this method
exists for database backends to provide a better implementation
according to their own quoting schemes.
"""
# Convert params to contain Unicode values.
def to_unicode(s):
return force_text(s, strings_only=True, errors='replace')
if isinstance(params, (list, tuple)):
u_params = tuple(to_unicode(val) for val in params)
elif params is None:
u_params = ()
else:
u_params = {to_unicode(k): to_unicode(v) for k, v in params.items()}
return six.text_type("QUERY = %r - PARAMS = %r") % (sql, u_params)
def last_insert_id(self, cursor, table_name, pk_name):
"""
Given a cursor object that has just performed an INSERT statement into
a table that has an auto-incrementing ID, returns the newly created ID.
This method also receives the table name and the name of the primary-key
column.
"""
return cursor.lastrowid
def lookup_cast(self, lookup_type, internal_type=None):
"""
Returns the string to use in a query when performing lookups
("contains", "like", etc.). The resulting string should contain a '%s'
placeholder for the column being searched against.
"""
return "%s"
def max_in_list_size(self):
"""
Returns the maximum number of items that can be passed in a single 'IN'
list condition, or None if the backend does not impose a limit.
"""
return None
def max_name_length(self):
"""
Returns the maximum length of table and column names, or None if there
is no limit.
"""
return None
def no_limit_value(self):
"""
Returns the value to use for the LIMIT when we are wanting "LIMIT
infinity". Returns None if the limit clause can be omitted in this case.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a no_limit_value() method')
def pk_default_value(self):
"""
Returns the value to use during an INSERT statement to specify that
the field should use its default value.
"""
return 'DEFAULT'
def prepare_sql_script(self, sql):
"""
Takes an SQL script that may contain multiple lines and returns a list
of statements to feed to successive cursor.execute() calls.
Since few databases are able to process raw SQL scripts in a single
cursor.execute() call and PEP 249 doesn't talk about this use case,
the default implementation is conservative.
"""
try:
import sqlparse
except ImportError:
raise ImproperlyConfigured(
"sqlparse is required if you don't split your SQL "
"statements manually."
)
else:
return [sqlparse.format(statement, strip_comments=True)
for statement in sqlparse.split(sql) if statement]
def process_clob(self, value):
"""
Returns the value of a CLOB column, for backends that return a locator
object that requires additional processing.
"""
return value
def return_insert_id(self):
"""
For backends that support returning the last insert ID as part
of an insert query, this method returns the SQL and params to
append to the INSERT query. The returned fragment should
contain a format string to hold the appropriate column.
"""
pass
def compiler(self, compiler_name):
"""
Returns the SQLCompiler class corresponding to the given name,
in the namespace corresponding to the `compiler_module` attribute
on this backend.
"""
if self._cache is None:
self._cache = import_module(self.compiler_module)
return getattr(self._cache, compiler_name)
def quote_name(self, name):
"""
Returns a quoted version of the given table, index or column name. Does
not quote the given name if it's already been quoted.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a quote_name() method')
def random_function_sql(self):
"""
Returns an SQL expression that returns a random value.
"""
return 'RANDOM()'
def regex_lookup(self, lookup_type):
"""
Returns the string to use in a query when performing regular expression
lookups (using "regex" or "iregex"). The resulting string should
contain a '%s' placeholder for the column being searched against.
If the feature is not supported (or part of it is not supported), a
NotImplementedError exception can be raised.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations may require a regex_lookup() method')
def savepoint_create_sql(self, sid):
"""
Returns the SQL for starting a new savepoint. Only required if the
"uses_savepoints" feature is True. The "sid" parameter is a string
for the savepoint id.
"""
return "SAVEPOINT %s" % self.quote_name(sid)
def savepoint_commit_sql(self, sid):
"""
Returns the SQL for committing the given savepoint.
"""
return "RELEASE SAVEPOINT %s" % self.quote_name(sid)
def savepoint_rollback_sql(self, sid):
"""
Returns the SQL for rolling back the given savepoint.
"""
return "ROLLBACK TO SAVEPOINT %s" % self.quote_name(sid)
def set_time_zone_sql(self):
"""
Returns the SQL that will set the connection's time zone.
Returns '' if the backend doesn't support time zones.
"""
return ''
def sql_flush(self, style, tables, sequences, allow_cascade=False):
"""
Returns a list of SQL statements required to remove all data from
the given database tables (without actually removing the tables
themselves).
The returned value also includes SQL statements required to reset DB
sequences passed in :param sequences:.
The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.
The `allow_cascade` argument determines whether truncation may cascade
to tables with foreign keys pointing the tables being truncated.
PostgreSQL requires a cascade even if these tables are empty.
"""
raise NotImplementedError('subclasses of BaseDatabaseOperations must provide an sql_flush() method')
def sequence_reset_by_name_sql(self, style, sequences):
"""
Returns a list of the SQL statements required to reset sequences
passed in :param sequences:.
The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.
"""
return []
def sequence_reset_sql(self, style, model_list):
"""
Returns a list of the SQL statements required to reset sequences for
the given models.
The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.
"""
return [] # No sequence reset required by default.
def start_transaction_sql(self):
"""
Returns the SQL statement required to start a transaction.
"""
return "BEGIN;"
def end_transaction_sql(self, success=True):
"""
Returns the SQL statement required to end a transaction.
"""
if not success:
return "ROLLBACK;"
return "COMMIT;"
def tablespace_sql(self, tablespace, inline=False):
"""
Returns the SQL that will be used in a query to define the tablespace.
Returns '' if the backend doesn't support tablespaces.
If inline is True, the SQL is appended to a row; otherwise it's appended
to the entire CREATE TABLE or CREATE INDEX statement.
"""
return ''
def prep_for_like_query(self, x):
"""Prepares a value for use in a LIKE query."""
return force_text(x).replace("\\", "\\\\").replace("%", r"\%").replace("_", r"\_")
# Same as prep_for_like_query(), but called for "iexact" matches, which
# need not necessarily be implemented using "LIKE" in the backend.
prep_for_iexact_query = prep_for_like_query
def validate_autopk_value(self, value):
"""
Certain backends do not accept some values for "serial" fields
(for example zero in MySQL). This method will raise a ValueError
if the value is invalid, otherwise returns validated value.
"""
return value
def adapt_unknown_value(self, value):
"""
Transforms a value to something compatible with the backend driver.
This method only depends on the type of the value. It's designed for
cases where the target type isn't known, such as .raw() SQL queries.
As a consequence it may not work perfectly in all circumstances.
"""
if isinstance(value, datetime.datetime): # must be before date
return self.adapt_datetimefield_value(value)
elif isinstance(value, datetime.date):
return self.adapt_datefield_value(value)
elif isinstance(value, datetime.time):
return self.adapt_timefield_value(value)
elif isinstance(value, decimal.Decimal):
return self.adapt_decimalfield_value(value)
else:
return value
def adapt_datefield_value(self, value):
"""
Transforms a date value to an object compatible with what is expected
by the backend driver for date columns.
"""
if value is None:
return None
return six.text_type(value)
def adapt_datetimefield_value(self, value):
"""
Transforms a datetime value to an object compatible with what is expected
by the backend driver for datetime columns.
"""
if value is None:
return None
return six.text_type(value)
def adapt_timefield_value(self, value):
"""
Transforms a time value to an object compatible with what is expected
by the backend driver for time columns.
"""
if value is None:
return None
if timezone.is_aware(value):
raise ValueError("Django does not support timezone-aware times.")
return six.text_type(value)
def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
"""
Transforms a decimal.Decimal value to an object compatible with what is
expected by the backend driver for decimal (numeric) columns.
"""
return utils.format_number(value, max_digits, decimal_places)
def adapt_ipaddressfield_value(self, value):
"""
Transforms a string representation of an IP address into the expected
type for the backend driver.
"""
return value or None
def year_lookup_bounds_for_date_field(self, value):
"""
Returns a two-elements list with the lower and upper bound to be used
with a BETWEEN operator to query a DateField value using a year
lookup.
`value` is an int, containing the looked-up year.
"""
first = datetime.date(value, 1, 1)
second = datetime.date(value, 12, 31)
first = self.adapt_datefield_value(first)
second = self.adapt_datefield_value(second)
return [first, second]
def year_lookup_bounds_for_datetime_field(self, value):
"""
Returns a two-elements list with the lower and upper bound to be used
with a BETWEEN operator to query a DateTimeField value using a year
lookup.
`value` is an int, containing the looked-up year.
"""
first = datetime.datetime(value, 1, 1)
second = datetime.datetime(value, 12, 31, 23, 59, 59, 999999)
if settings.USE_TZ:
tz = timezone.get_current_timezone()
first = timezone.make_aware(first, tz)
second = timezone.make_aware(second, tz)
first = self.adapt_datetimefield_value(first)
second = self.adapt_datetimefield_value(second)
return [first, second]
def get_db_converters(self, expression):
"""
Get a list of functions needed to convert field data.
Some field types on some backends do not provide data in the correct
format, this is the hook for converter functions.
"""
return []
def convert_durationfield_value(self, value, expression, connection, context):
if value is not None:
value = str(decimal.Decimal(value) / decimal.Decimal(1000000))
value = parse_duration(value)
return value
def check_aggregate_support(self, aggregate_func):
warnings.warn(
"check_aggregate_support has been deprecated. Use "
"check_expression_support instead.",
RemovedInDjango20Warning, stacklevel=2)
return self.check_expression_support(aggregate_func)
def check_expression_support(self, expression):
"""
Check that the backend supports the provided expression.
This is used on specific backends to rule out known expressions
that have problematic or nonexistent implementations. If the
expression has a known problem, the backend should raise
NotImplementedError.
"""
pass
def combine_expression(self, connector, sub_expressions):
"""Combine a list of subexpressions into a single expression, using
the provided connecting operator. This is required because operators
can vary between backends (e.g., Oracle with %% and &) and between
subexpression types (e.g., date expressions)
"""
conn = ' %s ' % connector
return conn.join(sub_expressions)
def combine_duration_expression(self, connector, sub_expressions):
return self.combine_expression(connector, sub_expressions)
def binary_placeholder_sql(self, value):
"""
Some backends require special syntax to insert binary content (MySQL
for example uses '_binary %s').
"""
return '%s'
def modify_insert_params(self, placeholder, params):
"""Allow modification of insert parameters. Needed for Oracle Spatial
backend due to #10888.
"""
return params
def integer_field_range(self, internal_type):
"""
Given an integer field internal type (e.g. 'PositiveIntegerField'),
returns a tuple of the (min_value, max_value) form representing the
range of the column type bound to the field.
"""
return self.integer_field_ranges[internal_type]
def subtract_temporals(self, internal_type, lhs, rhs):
if self.connection.features.supports_temporal_subtraction:
lhs_sql, lhs_params = lhs
rhs_sql, rhs_params = rhs
return "(%s - %s)" % (lhs_sql, rhs_sql), lhs_params + rhs_params
raise NotImplementedError("This backend does not support %s subtraction." % internal_type)
| mit | [
646,
2197,
199,
646,
6107,
199,
646,
3598,
199,
504,
14802,
492,
492,
63,
578,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
14,
3924,
492,
11897,
199,
504,
1639,
14,
697,
14,
7765,
492,
3778,
199,
504,
1639,
14,
1208,
492,
3816,
12,
7137,
199,
504,
1639,
14,
1208,
14,
602,
1122,
492,
2198,
63,
5553,
199,
504,
1639,
14,
1208,
14,
15383,
492,
23687,
1165,
3849,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
505,
421,
199,
533,
29103,
12929,
8,
785,
304,
272,
408,
272,
961,
1021,
22667,
15409,
1006,
4865,
13,
6100,
15109,
12,
4066,
465,
314,
4340,
272,
282,
4865,
18628,
7794,
503,
6966,
2335,
314,
2870,
402,
282,
23568,
13,
28565,
272,
1962,
14,
272,
408,
272,
6365,
63,
578,
275,
298,
1176,
14,
697,
14,
992,
14,
3009,
14,
5772,
2,
339,
327,
7225,
901,
5048,
12271,
701,
658,
4672,
63,
466,
64,
465,
22751,
272,
327,
315,
9149,
15,
1121,
15,
992,
15,
955,
14,
2424,
14,
272,
3000,
63,
698,
63,
8404,
275,
469,
267,
283,
14640,
356,
5868,
708,
14408,
12,
20939,
1822,
395,
267,
283,
3901,
356,
5868,
22519,
10552,
12,
21237,
16809,
8557,
395,
267,
283,
25175,
356,
5868,
23861,
32417,
11292,
12,
1749,
1081,
32417,
11369,
395,
267,
283,
25197,
356,
334,
16,
12,
20939,
1822,
395,
267,
283,
8591,
356,
334,
16,
12,
21237,
16809,
8557,
395,
272,
789,
272,
663,
63,
12688,
275,
469,
267,
283,
8888,
356,
283,
1734,
1075,
297,
267,
283,
12569,
356,
283,
3843,
32379,
297,
267,
283,
9196,
356,
283,
11764,
297,
272,
789,
339,
347,
636,
826,
721,
277,
12,
1950,
304,
267,
291,
14,
2105,
275,
1950,
267,
291,
423,
1637,
275,
488,
339,
347,
2599,
6559,
63,
3009,
8,
277,
12,
1817,
12,
2763,
304,
267,
408,
267,
1803,
1263,
5385,
4346,
370,
2291,
2599,
13,
9728,
316,
5062,
2883,
12,
503,
267,
488,
340,
949,
5385,
365,
5784,
14,
398,
961,
5385,
365,
7934,
1380,
282,
1817,
365,
2737,
14,
267,
408,
267,
372,
488,
339,
347,
13137,
63,
2912,
63,
890,
8,
277,
12,
1504,
12,
13474,
304,
267,
408,
267,
1803,
314,
5696,
4370,
3522,
1568,
367,
314,
4865,
14,
710,
1504,
267,
787,
314,
1504,
9995,
370,
506,
11788,
315,
314,
3522,
12,
314,
13474,
3509,
267,
1006,
314,
2251,
370,
506,
11788,
14,
267,
408,
267,
372,
822,
8,
8718,
9,
339,
347,
2581,
63,
498,
63,
67,
979,
316,
63,
3009,
8,
277,
304,
267,
408,
267,
1803,
376,
5385,
1827,
626,
9619,
2310,
314,
1642,
2581,
790,
8932,
2419,
314,
267,
302,
18604,
14,
398,
961,
365,
1202,
701,
314,
283,
697,
7,
2581,
4865,
370,
6705,
2382,
370,
1343,
267,
286,
979,
316,
14,
267,
408,
267,
372,
298,
4859,
2581,
63,
498,
4442,
450,
83,
16044,
6515,
2581,
63,
498,
5138,
413,
32633,
3597,
11539,
83,
2,
339,
347,
625,
7313,
63,
2931,
63,
3009,
8,
277,
12,
1072,
63,
698,
304,
267,
408,
267,
9138,
282,
901,
1256,
12,
2529,
314,
5385,
5784,
370,
9106,
314,
754,
402,
267,
282,
13629,
370,
626,
730,
14,
3390,
626,
314,
9183,
1059,
1077,
1395,
282,
267,
1543,
83,
7,
10069,
367,
314,
3965,
3769,
9106,
14,
267,
408,
267,
372,
1543,
83,
7,
339,
347,
1434,
63,
5005,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
7,
503,
283,
2977,
297,
2529,
314,
5385,
626,
267,
5536,
83,
282,
574,
687,
314,
1627,
1434,
901,
901,
63,
354,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
63,
5005,
63,
3009,
342,
1083,
358,
339,
347,
1434,
63,
4284,
63,
3009,
8,
277,
12,
6871,
304,
267,
408,
267,
24664,
314,
1434,
6252,
9330,
367,
8455,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
63,
4284,
63,
3009,
342,
1083,
358,
339,
347,
1434,
63,
8208,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
7,
503,
283,
2977,
297,
2529,
314,
5385,
626,
267,
14547,
83,
314,
1627,
1434,
901,
901,
63,
354,
370,
282,
1434,
909,
543,
1454,
267,
314,
1627,
1106,
329,
3690,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
8208,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
2931,
63,
602,
63,
3009,
8,
277,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
1803,
314,
5385,
5784,
370,
9106,
282,
2197,
574,
370,
1434,
574,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
2931,
63,
602,
342,
1083,
358,
339,
347,
2197,
63,
2931,
63,
521,
63,
3009,
8,
277,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
1803,
314,
5385,
5784,
370,
9106,
282,
2197,
574,
370,
900,
574,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
2931,
63,
521,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
5005,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
297,
283,
2977,
297,
283,
5180,
297,
283,
10698,
7,
503,
267,
283,
4375,
297,
2529,
314,
5385,
626,
5536,
83,
282,
574,
687,
314,
1627,
267,
2197,
901,
901,
63,
354,
12,
436,
282,
2008,
402,
2633,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
5005,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
8208,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
297,
283,
2977,
297,
283,
5180,
297,
283,
10698,
7,
503,
267,
283,
4375,
297,
2529,
314,
5385,
626,
14547,
83,
314,
1627,
2197,
901,
267,
901,
63,
354,
370
] | [
2197,
199,
646,
6107,
199,
646,
3598,
199,
504,
14802,
492,
492,
63,
578,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
14,
3924,
492,
11897,
199,
504,
1639,
14,
697,
14,
7765,
492,
3778,
199,
504,
1639,
14,
1208,
492,
3816,
12,
7137,
199,
504,
1639,
14,
1208,
14,
602,
1122,
492,
2198,
63,
5553,
199,
504,
1639,
14,
1208,
14,
15383,
492,
23687,
1165,
3849,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
505,
421,
199,
533,
29103,
12929,
8,
785,
304,
272,
408,
272,
961,
1021,
22667,
15409,
1006,
4865,
13,
6100,
15109,
12,
4066,
465,
314,
4340,
272,
282,
4865,
18628,
7794,
503,
6966,
2335,
314,
2870,
402,
282,
23568,
13,
28565,
272,
1962,
14,
272,
408,
272,
6365,
63,
578,
275,
298,
1176,
14,
697,
14,
992,
14,
3009,
14,
5772,
2,
339,
327,
7225,
901,
5048,
12271,
701,
658,
4672,
63,
466,
64,
465,
22751,
272,
327,
315,
9149,
15,
1121,
15,
992,
15,
955,
14,
2424,
14,
272,
3000,
63,
698,
63,
8404,
275,
469,
267,
283,
14640,
356,
5868,
708,
14408,
12,
20939,
1822,
395,
267,
283,
3901,
356,
5868,
22519,
10552,
12,
21237,
16809,
8557,
395,
267,
283,
25175,
356,
5868,
23861,
32417,
11292,
12,
1749,
1081,
32417,
11369,
395,
267,
283,
25197,
356,
334,
16,
12,
20939,
1822,
395,
267,
283,
8591,
356,
334,
16,
12,
21237,
16809,
8557,
395,
272,
789,
272,
663,
63,
12688,
275,
469,
267,
283,
8888,
356,
283,
1734,
1075,
297,
267,
283,
12569,
356,
283,
3843,
32379,
297,
267,
283,
9196,
356,
283,
11764,
297,
272,
789,
339,
347,
636,
826,
721,
277,
12,
1950,
304,
267,
291,
14,
2105,
275,
1950,
267,
291,
423,
1637,
275,
488,
339,
347,
2599,
6559,
63,
3009,
8,
277,
12,
1817,
12,
2763,
304,
267,
408,
267,
1803,
1263,
5385,
4346,
370,
2291,
2599,
13,
9728,
316,
5062,
2883,
12,
503,
267,
488,
340,
949,
5385,
365,
5784,
14,
398,
961,
5385,
365,
7934,
1380,
282,
1817,
365,
2737,
14,
267,
408,
267,
372,
488,
339,
347,
13137,
63,
2912,
63,
890,
8,
277,
12,
1504,
12,
13474,
304,
267,
408,
267,
1803,
314,
5696,
4370,
3522,
1568,
367,
314,
4865,
14,
710,
1504,
267,
787,
314,
1504,
9995,
370,
506,
11788,
315,
314,
3522,
12,
314,
13474,
3509,
267,
1006,
314,
2251,
370,
506,
11788,
14,
267,
408,
267,
372,
822,
8,
8718,
9,
339,
347,
2581,
63,
498,
63,
67,
979,
316,
63,
3009,
8,
277,
304,
267,
408,
267,
1803,
376,
5385,
1827,
626,
9619,
2310,
314,
1642,
2581,
790,
8932,
2419,
314,
267,
302,
18604,
14,
398,
961,
365,
1202,
701,
314,
283,
697,
7,
2581,
4865,
370,
6705,
2382,
370,
1343,
267,
286,
979,
316,
14,
267,
408,
267,
372,
298,
4859,
2581,
63,
498,
4442,
450,
83,
16044,
6515,
2581,
63,
498,
5138,
413,
32633,
3597,
11539,
83,
2,
339,
347,
625,
7313,
63,
2931,
63,
3009,
8,
277,
12,
1072,
63,
698,
304,
267,
408,
267,
9138,
282,
901,
1256,
12,
2529,
314,
5385,
5784,
370,
9106,
314,
754,
402,
267,
282,
13629,
370,
626,
730,
14,
3390,
626,
314,
9183,
1059,
1077,
1395,
282,
267,
1543,
83,
7,
10069,
367,
314,
3965,
3769,
9106,
14,
267,
408,
267,
372,
1543,
83,
7,
339,
347,
1434,
63,
5005,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
7,
503,
283,
2977,
297,
2529,
314,
5385,
626,
267,
5536,
83,
282,
574,
687,
314,
1627,
1434,
901,
901,
63,
354,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
63,
5005,
63,
3009,
342,
1083,
358,
339,
347,
1434,
63,
4284,
63,
3009,
8,
277,
12,
6871,
304,
267,
408,
267,
24664,
314,
1434,
6252,
9330,
367,
8455,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
63,
4284,
63,
3009,
342,
1083,
358,
339,
347,
1434,
63,
8208,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
7,
503,
283,
2977,
297,
2529,
314,
5385,
626,
267,
14547,
83,
314,
1627,
1434,
901,
901,
63,
354,
370,
282,
1434,
909,
543,
1454,
267,
314,
1627,
1106,
329,
3690,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
1434,
8208,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
2931,
63,
602,
63,
3009,
8,
277,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
1803,
314,
5385,
5784,
370,
9106,
282,
2197,
574,
370,
1434,
574,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
2931,
63,
602,
342,
1083,
358,
339,
347,
2197,
63,
2931,
63,
521,
63,
3009,
8,
277,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
1803,
314,
5385,
5784,
370,
9106,
282,
2197,
574,
370,
900,
574,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
2931,
63,
521,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
5005,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
297,
283,
2977,
297,
283,
5180,
297,
283,
10698,
7,
503,
267,
283,
4375,
297,
2529,
314,
5385,
626,
5536,
83,
282,
574,
687,
314,
1627,
267,
2197,
901,
901,
63,
354,
12,
436,
282,
2008,
402,
2633,
14,
267,
408,
267,
746,
4279,
360,
19094,
402,
29103,
12929,
1443,
4409,
282,
2197,
63,
5005,
63,
3009,
342,
1083,
358,
339,
347,
2197,
63,
8208,
63,
3009,
8,
277,
12,
4237,
63,
466,
12,
901,
63,
354,
12,
28054,
304,
267,
408,
267,
9138,
282,
4237,
63,
466,
402,
283,
3403,
297,
283,
4482,
297,
283,
2977,
297,
283,
5180,
297,
283,
10698,
7,
503,
267,
283,
4375,
297,
2529,
314,
5385,
626,
14547,
83,
314,
1627,
2197,
901,
267,
901,
63,
354,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
brothaedhung/external_chromium | net/tools/testserver/asn1der.py | 67 | 1324 | #!/usr/bin/python2.5
# Copyright (c) 2011 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.
"""Helper module for ASN.1/DER encoding."""
import binascii
import struct
# Tags as defined by ASN.1.
INTEGER = 2
BIT_STRING = 3
NULL = 5
OBJECT_IDENTIFIER = 6
SEQUENCE = 0x30
def Data(tag, data):
"""Generic type-length-value encoder.
Args:
tag: the tag.
data: the data for the given tag.
Returns:
encoded TLV value.
"""
if len(data) == 0:
return struct.pack(">BB", tag, 0);
assert len(data) <= 0xffff;
return struct.pack(">BBH", tag, 0x82, len(data)) + data;
def Integer(value):
"""Encodes an integer.
Args:
value: the long value.
Returns:
encoded TLV value.
"""
data = '%x' % value
return Data(INTEGER, binascii.unhexlify('00' + '0' * (len(data) % 2) + data))
def Bitstring(value):
"""Encodes a bit string.
Args:
value: a string holding the binary data.
Returns:
encoded TLV value.
"""
return Data(BIT_STRING, '\x00' + value)
def Sequence(values):
"""Encodes a sequence of other values.
Args:
values: the list of values, must be strings holding already encoded data.
Returns:
encoded TLV value.
"""
return Data(SEQUENCE, ''.join(values))
| bsd-3-clause | [
3381,
2647,
15,
1393,
15,
1548,
18,
14,
21,
199,
3,
1898,
334,
67,
9,
7760,
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,
4433,
859,
367,
31139,
14,
17,
15,
11733,
2644,
1041,
199,
199,
646,
14755,
199,
646,
2702,
199,
199,
3,
25204,
465,
3247,
701,
31139,
14,
17,
14,
199,
9596,
275,
499,
199,
11970,
63,
5353,
275,
650,
199,
8084,
275,
959,
199,
9868,
63,
22698,
275,
1227,
199,
16585,
275,
378,
88,
1216,
199,
199,
318,
3918,
8,
1450,
12,
666,
304,
523,
408,
9417,
730,
13,
1267,
13,
585,
10295,
14,
819,
3033,
26,
272,
1947,
26,
314,
1947,
14,
272,
666,
26,
314,
666,
367,
314,
1627,
1947,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
340,
822,
8,
576,
9,
508,
378,
26,
272,
372,
2702,
14,
1389,
19651,
5342,
401,
1947,
12,
378,
2736,
523,
702,
822,
8,
576,
9,
2695,
378,
27581,
27,
523,
372,
2702,
14,
1389,
19651,
5342,
40,
401,
1947,
12,
378,
88,
2564,
12,
822,
8,
576,
430,
435,
666,
27,
199,
199,
318,
7225,
8,
585,
304,
523,
408,
1327,
6021,
376,
3000,
14,
819,
3033,
26,
272,
574,
26,
314,
1846,
574,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
666,
275,
1543,
88,
7,
450,
574,
523,
372,
3918,
8,
9596,
12,
14755,
14,
324,
20677,
360,
383,
7,
435,
283,
16,
7,
627,
334,
552,
8,
576,
9,
450,
499,
9,
435,
666,
430,
199,
199,
318,
10199,
875,
8,
585,
304,
523,
408,
1327,
6021,
282,
4546,
1059,
14,
819,
3033,
26,
272,
574,
26,
282,
1059,
17573,
314,
3366,
666,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
372,
3918,
8,
11970,
63,
5353,
12,
1557,
88,
383,
7,
435,
574,
9,
199,
199,
318,
10975,
8,
1459,
304,
523,
408,
1327,
6021,
282,
3414,
402,
1163,
1338,
14,
819,
3033,
26,
272,
1338,
26,
314,
769,
402,
1338,
12,
1471,
506,
3326,
17573,
2575,
5737,
666,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
372,
3918,
8,
16585,
12,
6522,
904,
8,
1459,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
2647,
15,
1393,
15,
1548,
18,
14,
21,
199,
3,
1898,
334,
67,
9,
7760,
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,
4433,
859,
367,
31139,
14,
17,
15,
11733,
2644,
1041,
199,
199,
646,
14755,
199,
646,
2702,
199,
199,
3,
25204,
465,
3247,
701,
31139,
14,
17,
14,
199,
9596,
275,
499,
199,
11970,
63,
5353,
275,
650,
199,
8084,
275,
959,
199,
9868,
63,
22698,
275,
1227,
199,
16585,
275,
378,
88,
1216,
199,
199,
318,
3918,
8,
1450,
12,
666,
304,
523,
408,
9417,
730,
13,
1267,
13,
585,
10295,
14,
819,
3033,
26,
272,
1947,
26,
314,
1947,
14,
272,
666,
26,
314,
666,
367,
314,
1627,
1947,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
340,
822,
8,
576,
9,
508,
378,
26,
272,
372,
2702,
14,
1389,
19651,
5342,
401,
1947,
12,
378,
2736,
523,
702,
822,
8,
576,
9,
2695,
378,
27581,
27,
523,
372,
2702,
14,
1389,
19651,
5342,
40,
401,
1947,
12,
378,
88,
2564,
12,
822,
8,
576,
430,
435,
666,
27,
199,
199,
318,
7225,
8,
585,
304,
523,
408,
1327,
6021,
376,
3000,
14,
819,
3033,
26,
272,
574,
26,
314,
1846,
574,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
666,
275,
1543,
88,
7,
450,
574,
523,
372,
3918,
8,
9596,
12,
14755,
14,
324,
20677,
360,
383,
7,
435,
283,
16,
7,
627,
334,
552,
8,
576,
9,
450,
499,
9,
435,
666,
430,
199,
199,
318,
10199,
875,
8,
585,
304,
523,
408,
1327,
6021,
282,
4546,
1059,
14,
819,
3033,
26,
272,
574,
26,
282,
1059,
17573,
314,
3366,
666,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
372,
3918,
8,
11970,
63,
5353,
12,
1557,
88,
383,
7,
435,
574,
9,
199,
199,
318,
10975,
8,
1459,
304,
523,
408,
1327,
6021,
282,
3414,
402,
1163,
1338,
14,
819,
3033,
26,
272,
1338,
26,
314,
769,
402,
1338,
12,
1471,
506,
3326,
17573,
2575,
5737,
666,
14,
523,
1803,
26,
272,
5737,
377,
18750,
574,
14,
523,
408,
523,
372,
3918,
8,
16585,
12,
6522,
904,
8,
1459,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,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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
] |
lucashmorais/x-Bench | mozmill-env/python/Lib/site-packages/mercurial/sshpeer.py | 90 | 7356 | # sshpeer.py - ssh repository proxy class for mercurial
#
# Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import re
from i18n import _
import util, error, wireproto
class remotelock(object):
def __init__(self, repo):
self.repo = repo
def release(self):
self.repo.unlock()
self.repo = None
def __del__(self):
if self.repo:
self.release()
def _serverquote(s):
'''quote a string for the remote shell ... which we assume is sh'''
if re.match('[a-zA-Z0-9@%_+=:,./-]*$', s):
return s
return "'%s'" % s.replace("'", "'\\''")
class sshpeer(wireproto.wirepeer):
def __init__(self, ui, path, create=False):
self._url = path
self.ui = ui
self.pipeo = self.pipei = self.pipee = None
u = util.url(path, parsequery=False, parsefragment=False)
if u.scheme != 'ssh' or not u.host or u.path is None:
self._abort(error.RepoError(_("couldn't parse location %s") % path))
self.user = u.user
if u.passwd is not None:
self._abort(error.RepoError(_("password in URL not supported")))
self.host = u.host
self.port = u.port
self.path = u.path or "."
sshcmd = self.ui.config("ui", "ssh", "ssh")
remotecmd = self.ui.config("ui", "remotecmd", "hg")
args = util.sshargs(sshcmd, self.host, self.user, self.port)
if create:
cmd = '%s %s %s' % (sshcmd, args,
util.shellquote("%s init %s" %
(_serverquote(remotecmd), _serverquote(self.path))))
ui.note(_('running %s\n') % cmd)
res = util.system(cmd)
if res != 0:
self._abort(error.RepoError(_("could not create remote repo")))
self.validate_repo(ui, sshcmd, args, remotecmd)
def url(self):
return self._url
def validate_repo(self, ui, sshcmd, args, remotecmd):
# cleanup up previous run
self.cleanup()
cmd = '%s %s %s' % (sshcmd, args,
util.shellquote("%s -R %s serve --stdio" %
(_serverquote(remotecmd), _serverquote(self.path))))
ui.note(_('running %s\n') % cmd)
cmd = util.quotecommand(cmd)
# while self.subprocess isn't used, having it allows the subprocess to
# to clean up correctly later
self.pipeo, self.pipei, self.pipee, self.subprocess = util.popen4(cmd)
# skip any noise generated by remote shell
self._callstream("hello")
r = self._callstream("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
lines = ["", "dummy"]
max_noise = 500
while lines[-1] and max_noise:
l = r.readline()
self.readerr()
if lines[-1] == "1\n" and l == "\n":
break
if l:
ui.debug("remote: ", l)
lines.append(l)
max_noise -= 1
else:
self._abort(error.RepoError(_('no suitable response from '
'remote hg')))
self._caps = set()
for l in reversed(lines):
if l.startswith("capabilities:"):
self._caps.update(l[:-1].split(":")[1].split())
break
def _capabilities(self):
return self._caps
def readerr(self):
while True:
size = util.fstat(self.pipee).st_size
if size == 0:
break
s = self.pipee.read(size)
if not s:
break
for l in s.splitlines():
self.ui.status(_("remote: "), l, '\n')
def _abort(self, exception):
self.cleanup()
raise exception
def cleanup(self):
if self.pipeo is None:
return
self.pipeo.close()
self.pipei.close()
try:
# read the error descriptor until EOF
for l in self.pipee:
self.ui.status(_("remote: "), l)
except (IOError, ValueError):
pass
self.pipee.close()
__del__ = cleanup
def _callstream(self, cmd, **args):
self.ui.debug("sending %s command\n" % cmd)
self.pipeo.write("%s\n" % cmd)
_func, names = wireproto.commands[cmd]
keys = names.split()
wireargs = {}
for k in keys:
if k == '*':
wireargs['*'] = args
break
else:
wireargs[k] = args[k]
del args[k]
for k, v in sorted(wireargs.iteritems()):
self.pipeo.write("%s %d\n" % (k, len(v)))
if isinstance(v, dict):
for dk, dv in v.iteritems():
self.pipeo.write("%s %d\n" % (dk, len(dv)))
self.pipeo.write(dv)
else:
self.pipeo.write(v)
self.pipeo.flush()
return self.pipei
def _call(self, cmd, **args):
self._callstream(cmd, **args)
return self._recv()
def _callpush(self, cmd, fp, **args):
r = self._call(cmd, **args)
if r:
return '', r
while True:
d = fp.read(4096)
if not d:
break
self._send(d)
self._send("", flush=True)
r = self._recv()
if r:
return '', r
return self._recv(), ''
def _decompress(self, stream):
return stream
def _recv(self):
l = self.pipei.readline()
if l == '\n':
err = []
while True:
line = self.pipee.readline()
if line == '-\n':
break
err.extend([line])
if len(err) > 0:
# strip the trailing newline added to the last line server-side
err[-1] = err[-1][:-1]
self._abort(error.OutOfBandError(*err))
self.readerr()
try:
l = int(l)
except ValueError:
self._abort(error.ResponseError(_("unexpected response:"), l))
return self.pipei.read(l)
def _send(self, data, flush=False):
self.pipeo.write("%d\n" % len(data))
if data:
self.pipeo.write(data)
if flush:
self.pipeo.flush()
self.readerr()
def lock(self):
self._call("lock")
return remotelock(self)
def unlock(self):
self._call("unlock")
def addchangegroup(self, cg, source, url, lock=None):
'''Send a changegroup to the remote server. Return an integer
similar to unbundle(). DEPRECATED, since it requires locking the
remote.'''
d = self._call("addchangegroup")
if d:
self._abort(error.RepoError(_("push refused: %s") % d))
while True:
d = cg.read(4096)
if not d:
break
self.pipeo.write(d)
self.readerr()
self.pipeo.flush()
self.readerr()
r = self._recv()
if not r:
return 1
try:
return int(r)
except ValueError:
self._abort(error.ResponseError(_("unexpected response:"), r))
instance = sshpeer
| mit | [
3,
8635,
7866,
14,
647,
446,
8635,
7611,
4566,
1021,
367,
4004,
18977,
199,
3,
199,
3,
1898,
11811,
12,
8315,
31653,
603,
564,
452,
665,
311,
77,
32,
261,
552,
530,
14,
957,
30,
199,
3,
199,
3,
961,
2032,
1443,
506,
1202,
436,
1854,
7182,
370,
314,
2895,
402,
314,
199,
3,
1664,
1696,
1684,
844,
1015,
499,
503,
1263,
2945,
1015,
14,
199,
199,
646,
295,
199,
504,
284,
1085,
78,
492,
485,
199,
646,
4884,
12,
1125,
12,
11799,
2625,
199,
199,
533,
3982,
831,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
3831,
304,
267,
291,
14,
3417,
275,
3831,
272,
347,
4683,
8,
277,
304,
267,
291,
14,
3417,
14,
17966,
342,
267,
291,
14,
3417,
275,
488,
272,
347,
636,
2264,
721,
277,
304,
267,
340,
291,
14,
3417,
26,
288,
291,
14,
3221,
342,
199,
199,
318,
485,
1000,
3513,
8,
83,
304,
272,
1449,
3513,
282,
1059,
367,
314,
3982,
5218,
2263,
1314,
781,
5534,
365,
1033,
2344,
272,
340,
295,
14,
1431,
11894,
65,
13,
6353,
13,
58,
16,
13,
25,
19437,
63,
10365,
11941,
13186,
13,
3672,
4268,
308,
304,
267,
372,
308,
272,
372,
17648,
83,
4065,
450,
308,
14,
1814,
27769,
3546,
1103,
891,
531,
199,
199,
533,
8635,
7866,
8,
11239,
2625,
14,
11239,
7866,
304,
272,
347,
636,
826,
721,
277,
12,
8574,
12,
931,
12,
1218,
29,
797,
304,
267,
291,
423,
633,
275,
931,
267,
291,
14,
1907,
275,
8574,
267,
291,
14,
4990,
79,
275,
291,
14,
4990,
73,
275,
291,
14,
4990,
69,
275,
488,
398,
399,
275,
4884,
14,
633,
8,
515,
12,
2198,
1131,
29,
797,
12,
2198,
7677,
29,
797,
9,
267,
340,
399,
14,
5512,
1137,
283,
5510,
7,
503,
440,
399,
14,
1102,
503,
399,
14,
515,
365,
488,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
15153,
78,
1133,
2198,
2909,
450,
83,
531,
450,
931,
430,
398,
291,
14,
751,
275,
399,
14,
751,
267,
340,
399,
14,
12671,
365,
440,
488,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
2060,
315,
2851,
440,
3748,
13324,
267,
291,
14,
1102,
275,
399,
14,
1102,
267,
291,
14,
719,
275,
399,
14,
719,
267,
291,
14,
515,
275,
399,
14,
515,
503,
14530,
398,
8635,
1760,
275,
291,
14,
1907,
14,
888,
480,
1907,
401,
298,
5510,
401,
298,
5510,
531,
267,
3982,
1760,
275,
291,
14,
1907,
14,
888,
480,
1907,
401,
298,
3846,
1760,
401,
298,
9208,
531,
398,
1249,
275,
4884,
14,
5510,
589,
8,
5510,
1760,
12,
291,
14,
1102,
12,
291,
14,
751,
12,
291,
14,
719,
9,
398,
340,
1218,
26,
288,
2088,
275,
1543,
83,
450,
83,
450,
83,
7,
450,
334,
5510,
1760,
12,
1249,
12,
355,
4884,
14,
5641,
3513,
3647,
83,
4205,
450,
83,
2,
450,
490,
6110,
1000,
3513,
8,
3846,
1760,
395,
485,
1000,
3513,
8,
277,
14,
515,
7845,
288,
8574,
14,
4610,
6723,
5720,
450,
83,
60,
78,
358,
450,
2088,
9,
288,
522,
275,
4884,
14,
2253,
8,
1760,
9,
288,
340,
522,
1137,
378,
26,
355,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
15153,
440,
1218,
3982,
3831,
13324,
398,
291,
14,
3502,
63,
3417,
8,
1907,
12,
8635,
1760,
12,
1249,
12,
3982,
1760,
9,
339,
347,
1166,
8,
277,
304,
267,
372,
291,
423,
633,
339,
347,
4107,
63,
3417,
8,
277,
12,
8574,
12,
8635,
1760,
12,
1249,
12,
3982,
1760,
304,
267,
327,
9058,
1536,
4136,
1255,
267,
291,
14,
7661,
342,
398,
2088,
275,
1543,
83,
450,
83,
450,
83,
7,
450,
334,
5510,
1760,
12,
1249,
12,
288,
4884,
14,
5641,
3513,
3647,
83,
446,
50,
450,
83,
14062,
1553,
32011,
2,
450,
355,
6110,
1000,
3513,
8,
3846,
1760,
395,
485,
1000,
3513,
8,
277,
14,
515,
7845,
267,
8574,
14,
4610,
6723,
5720,
450,
83,
60,
78,
358,
450,
2088,
9,
267,
2088,
275,
4884,
14,
3513,
1531,
8,
1760,
9,
398,
327,
1830,
291,
14,
5781,
5712,
1133,
1202,
12,
9445,
652,
6127,
314,
3873,
370,
267,
327,
370,
3633,
1536,
6657,
2945,
267,
291,
14,
4990,
79,
12,
291,
14,
4990,
73,
12,
291,
14,
4990,
69,
12,
291,
14,
5781,
275,
4884,
14,
12207,
20,
8,
1760,
9,
398,
327,
3372,
1263,
11145,
4046,
701,
3982,
5218,
267,
291,
423,
1250,
1745,
480,
5006,
531,
267,
519,
275,
291,
423,
1250,
1745,
480,
13007,
401,
6342,
29,
3647,
83,
3295,
83,
2,
450,
1689,
16,
31761,
2167,
12,
298,
16,
31761,
2167,
1724,
267,
2385,
275,
359,
5151,
298,
5869,
937,
267,
1390,
63,
11838,
275,
6891,
267,
1830,
2385,
1988,
17,
61,
436,
1390,
63,
11838,
26,
288,
634,
275,
519,
14,
6407,
342,
288,
291,
14,
5503,
82,
342,
288,
340,
2385,
1988,
17,
61,
508,
298,
17,
60,
78,
2,
436,
634,
508,
1867,
78,
582,
355,
2059,
288,
340,
634,
26,
355,
8574,
14,
1757,
480,
3846,
26,
3872,
634,
9,
288,
2385,
14,
740,
8,
76,
9,
288,
1390,
63,
11838,
4862,
413,
267,
587,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6723,
889,
11233,
1177,
687,
283,
5101,
283,
3846,
18016,
7058,
398,
291,
423,
12029,
275,
663,
342,
267,
367,
634,
315,
10822,
8,
1278,
304,
288,
340,
634,
14,
2460,
480,
10732,
26,
2349,
355,
291,
423,
12029,
14,
873,
8,
76,
4439,
17,
1055,
1294,
20063,
59,
17,
1055,
1294,
1012,
355,
2059,
339,
347,
485,
10732,
8,
277,
304,
267,
372,
291,
423,
12029,
339,
347,
7002,
82,
8,
277,
304,
267,
1830,
715,
26,
288,
1568,
275,
4884,
14,
32127,
8,
277,
14,
4990,
69,
680,
270,
63,
890,
288,
340,
1568,
508,
378,
26,
355,
2059,
288,
308,
275,
291,
14,
4990,
69,
14,
739,
8,
890,
9,
288,
340,
440,
308,
26,
355,
2059,
288,
367,
634,
315,
308,
14,
7644,
837,
355,
291,
14,
1907,
14,
1205,
6115,
3846,
26,
26261,
634,
12,
1557,
78,
358,
339,
347,
485,
13845,
8,
277,
12,
1919,
304,
267,
291,
14,
7661,
342,
267,
746,
1919,
339,
347
] | [
8635,
7866,
14,
647,
446,
8635,
7611,
4566,
1021,
367,
4004,
18977,
199,
3,
199,
3,
1898,
11811,
12,
8315,
31653,
603,
564,
452,
665,
311,
77,
32,
261,
552,
530,
14,
957,
30,
199,
3,
199,
3,
961,
2032,
1443,
506,
1202,
436,
1854,
7182,
370,
314,
2895,
402,
314,
199,
3,
1664,
1696,
1684,
844,
1015,
499,
503,
1263,
2945,
1015,
14,
199,
199,
646,
295,
199,
504,
284,
1085,
78,
492,
485,
199,
646,
4884,
12,
1125,
12,
11799,
2625,
199,
199,
533,
3982,
831,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
3831,
304,
267,
291,
14,
3417,
275,
3831,
272,
347,
4683,
8,
277,
304,
267,
291,
14,
3417,
14,
17966,
342,
267,
291,
14,
3417,
275,
488,
272,
347,
636,
2264,
721,
277,
304,
267,
340,
291,
14,
3417,
26,
288,
291,
14,
3221,
342,
199,
199,
318,
485,
1000,
3513,
8,
83,
304,
272,
1449,
3513,
282,
1059,
367,
314,
3982,
5218,
2263,
1314,
781,
5534,
365,
1033,
2344,
272,
340,
295,
14,
1431,
11894,
65,
13,
6353,
13,
58,
16,
13,
25,
19437,
63,
10365,
11941,
13186,
13,
3672,
4268,
308,
304,
267,
372,
308,
272,
372,
17648,
83,
4065,
450,
308,
14,
1814,
27769,
3546,
1103,
891,
531,
199,
199,
533,
8635,
7866,
8,
11239,
2625,
14,
11239,
7866,
304,
272,
347,
636,
826,
721,
277,
12,
8574,
12,
931,
12,
1218,
29,
797,
304,
267,
291,
423,
633,
275,
931,
267,
291,
14,
1907,
275,
8574,
267,
291,
14,
4990,
79,
275,
291,
14,
4990,
73,
275,
291,
14,
4990,
69,
275,
488,
398,
399,
275,
4884,
14,
633,
8,
515,
12,
2198,
1131,
29,
797,
12,
2198,
7677,
29,
797,
9,
267,
340,
399,
14,
5512,
1137,
283,
5510,
7,
503,
440,
399,
14,
1102,
503,
399,
14,
515,
365,
488,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
15153,
78,
1133,
2198,
2909,
450,
83,
531,
450,
931,
430,
398,
291,
14,
751,
275,
399,
14,
751,
267,
340,
399,
14,
12671,
365,
440,
488,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
2060,
315,
2851,
440,
3748,
13324,
267,
291,
14,
1102,
275,
399,
14,
1102,
267,
291,
14,
719,
275,
399,
14,
719,
267,
291,
14,
515,
275,
399,
14,
515,
503,
14530,
398,
8635,
1760,
275,
291,
14,
1907,
14,
888,
480,
1907,
401,
298,
5510,
401,
298,
5510,
531,
267,
3982,
1760,
275,
291,
14,
1907,
14,
888,
480,
1907,
401,
298,
3846,
1760,
401,
298,
9208,
531,
398,
1249,
275,
4884,
14,
5510,
589,
8,
5510,
1760,
12,
291,
14,
1102,
12,
291,
14,
751,
12,
291,
14,
719,
9,
398,
340,
1218,
26,
288,
2088,
275,
1543,
83,
450,
83,
450,
83,
7,
450,
334,
5510,
1760,
12,
1249,
12,
355,
4884,
14,
5641,
3513,
3647,
83,
4205,
450,
83,
2,
450,
490,
6110,
1000,
3513,
8,
3846,
1760,
395,
485,
1000,
3513,
8,
277,
14,
515,
7845,
288,
8574,
14,
4610,
6723,
5720,
450,
83,
60,
78,
358,
450,
2088,
9,
288,
522,
275,
4884,
14,
2253,
8,
1760,
9,
288,
340,
522,
1137,
378,
26,
355,
291,
423,
13845,
8,
705,
14,
11334,
547,
6115,
15153,
440,
1218,
3982,
3831,
13324,
398,
291,
14,
3502,
63,
3417,
8,
1907,
12,
8635,
1760,
12,
1249,
12,
3982,
1760,
9,
339,
347,
1166,
8,
277,
304,
267,
372,
291,
423,
633,
339,
347,
4107,
63,
3417,
8,
277,
12,
8574,
12,
8635,
1760,
12,
1249,
12,
3982,
1760,
304,
267,
327,
9058,
1536,
4136,
1255,
267,
291,
14,
7661,
342,
398,
2088,
275,
1543,
83,
450,
83,
450,
83,
7,
450,
334,
5510,
1760,
12,
1249,
12,
288,
4884,
14,
5641,
3513,
3647,
83,
446,
50,
450,
83,
14062,
1553,
32011,
2,
450,
355,
6110,
1000,
3513,
8,
3846,
1760,
395,
485,
1000,
3513,
8,
277,
14,
515,
7845,
267,
8574,
14,
4610,
6723,
5720,
450,
83,
60,
78,
358,
450,
2088,
9,
267,
2088,
275,
4884,
14,
3513,
1531,
8,
1760,
9,
398,
327,
1830,
291,
14,
5781,
5712,
1133,
1202,
12,
9445,
652,
6127,
314,
3873,
370,
267,
327,
370,
3633,
1536,
6657,
2945,
267,
291,
14,
4990,
79,
12,
291,
14,
4990,
73,
12,
291,
14,
4990,
69,
12,
291,
14,
5781,
275,
4884,
14,
12207,
20,
8,
1760,
9,
398,
327,
3372,
1263,
11145,
4046,
701,
3982,
5218,
267,
291,
423,
1250,
1745,
480,
5006,
531,
267,
519,
275,
291,
423,
1250,
1745,
480,
13007,
401,
6342,
29,
3647,
83,
3295,
83,
2,
450,
1689,
16,
31761,
2167,
12,
298,
16,
31761,
2167,
1724,
267,
2385,
275,
359,
5151,
298,
5869,
937,
267,
1390,
63,
11838,
275,
6891,
267,
1830,
2385,
1988,
17,
61,
436,
1390,
63,
11838,
26,
288,
634,
275,
519,
14,
6407,
342,
288,
291,
14,
5503,
82,
342,
288,
340,
2385,
1988,
17,
61,
508,
298,
17,
60,
78,
2,
436,
634,
508,
1867,
78,
582,
355,
2059,
288,
340,
634,
26,
355,
8574,
14,
1757,
480,
3846,
26,
3872,
634,
9,
288,
2385,
14,
740,
8,
76,
9,
288,
1390,
63,
11838,
4862,
413,
267,
587,
26,
288,
291,
423,
13845,
8,
705,
14,
11334,
547,
6723,
889,
11233,
1177,
687,
283,
5101,
283,
3846,
18016,
7058,
398,
291,
423,
12029,
275,
663,
342,
267,
367,
634,
315,
10822,
8,
1278,
304,
288,
340,
634,
14,
2460,
480,
10732,
26,
2349,
355,
291,
423,
12029,
14,
873,
8,
76,
4439,
17,
1055,
1294,
20063,
59,
17,
1055,
1294,
1012,
355,
2059,
339,
347,
485,
10732,
8,
277,
304,
267,
372,
291,
423,
12029,
339,
347,
7002,
82,
8,
277,
304,
267,
1830,
715,
26,
288,
1568,
275,
4884,
14,
32127,
8,
277,
14,
4990,
69,
680,
270,
63,
890,
288,
340,
1568,
508,
378,
26,
355,
2059,
288,
308,
275,
291,
14,
4990,
69,
14,
739,
8,
890,
9,
288,
340,
440,
308,
26,
355,
2059,
288,
367,
634,
315,
308,
14,
7644,
837,
355,
291,
14,
1907,
14,
1205,
6115,
3846,
26,
26261,
634,
12,
1557,
78,
358,
339,
347,
485,
13845,
8,
277,
12,
1919,
304,
267,
291,
14,
7661,
342,
267,
746,
1919,
339,
347,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
j0nathan33/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/kickstarter.py | 9 | 2230 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class KickStarterIE(InfoExtractor):
_VALID_URL = r'https?://www\.kickstarter\.com/projects/(?P<id>[^/]*)/.*'
_TESTS = [{
'url': 'https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant?ref=home_location',
'md5': 'c81addca81327ffa66c642b5d8b08cab',
'info_dict': {
'id': '1404461844',
'ext': 'mp4',
'title': 'Intersection: The Story of Josh Grant by Kyle Cowling',
'description': 'A unique motocross documentary that examines the '
'life and mind of one of sports most elite athletes: Josh Grant.',
},
}, {
'note': 'Embedded video (not using the native kickstarter video service)',
'url': 'https://www.kickstarter.com/projects/597507018/pebble-e-paper-watch-for-iphone-and-android/posts/659178',
'playlist': [
{
'info_dict': {
'id': '78704821',
'ext': 'mp4',
'uploader_id': 'pebble',
'uploader': 'Pebble Technology',
'title': 'Pebble iOS Notifications',
}
}
],
}]
def _real_extract(self, url):
m = re.match(self._VALID_URL, url)
video_id = m.group('id')
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(
r'<title>\s*(.*?)(?:\s*— Kickstarter)?\s*</title>',
webpage, 'title')
video_url = self._search_regex(
r'data-video-url="(.*?)"',
webpage, 'video URL', default=None)
if video_url is None: # No native kickstarter, look for embedded videos
return {
'_type': 'url_transparent',
'ie_key': 'Generic',
'url': url,
'title': title,
}
return {
'id': video_id,
'url': video_url,
'title': title,
'description': self._og_search_description(webpage),
'thumbnail': self._og_search_thumbnail(webpage),
}
| gpl-3.0 | [
3,
2644,
26,
2774,
13,
24,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
295,
199,
199,
504,
1275,
2330,
492,
21298,
421,
199,
533,
1804,
2000,
933,
16972,
4332,
8,
18283,
304,
272,
485,
5600,
63,
2632,
275,
519,
7,
2859,
14144,
1544,
4537,
31257,
7848,
351,
4537,
957,
15,
6776,
9448,
48,
28,
344,
13489,
15,
3672,
2447,
25737,
272,
485,
7569,
275,
8910,
267,
283,
633,
356,
283,
2859,
921,
1544,
14,
31257,
7848,
351,
14,
957,
15,
6776,
15,
1079,
26846,
1085,
1602,
15,
12569,
13,
1589,
13,
17372,
13,
1618,
13,
743,
609,
13,
17362,
31,
1121,
29,
4219,
63,
1985,
297,
267,
283,
1064,
21,
356,
283,
67,
2835,
525,
696,
2835,
11754,
556,
65,
1272,
67,
15463,
66,
21,
68,
24,
66,
2036,
26481,
297,
267,
283,
815,
63,
807,
356,
469,
288,
283,
344,
356,
283,
1079,
26846,
1085,
1602,
297,
288,
283,
832,
356,
283,
311,
20,
297,
288,
283,
1213,
356,
283,
29821,
26,
710,
1933,
1089,
402,
7135,
609,
598,
17633,
701,
1804,
1775,
445,
583,
2983,
297,
288,
283,
1802,
356,
283,
33,
3747,
333,
357,
679,
3685,
2213,
695,
626,
15735,
3746,
314,
283,
355,
283,
13602,
436,
25169,
402,
1373,
402,
308,
5203,
4750,
325,
5333,
282,
273,
274,
744,
26,
7135,
609,
598,
17633,
3130,
267,
1660,
272,
1660,
469,
267,
283,
4610,
356,
283,
27395,
3991,
334,
1397,
1808,
314,
5438,
29898,
7848,
351,
3991,
2435,
3196,
267,
283,
633,
356,
283,
2859,
921,
1544,
14,
31257,
7848,
351,
14,
957,
15,
6776,
15,
15459,
13583,
12549,
15,
321,
20541,
13,
69,
13,
10443,
13,
6821,
13,
509,
13,
28303,
13,
460,
13,
6238,
15,
18084,
15,
31485,
11175,
297,
267,
283,
10411,
356,
359,
288,
469,
355,
283,
815,
63,
807,
356,
469,
490,
283,
344,
356,
283,
32363,
9941,
2025,
297,
490,
283,
832,
356,
283,
311,
20,
297,
490,
283,
13671,
63,
344,
356,
283,
321,
20541,
297,
490,
283,
13671,
356,
283,
48,
2871,
830,
21580,
297,
490,
283,
1213,
356,
283,
48,
2871,
830,
284,
3100,
23362,
83,
297,
355,
789,
288,
789,
267,
2156,
272,
14877,
339,
347,
485,
3093,
63,
5005,
8,
277,
12,
1166,
304,
267,
333,
275,
295,
14,
1431,
8,
277,
423,
5600,
63,
2632,
12,
1166,
9,
267,
3991,
63,
344,
275,
333,
14,
923,
360,
344,
358,
267,
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,
288,
519,
7601,
1213,
3072,
83,
5830,
6697,
9,
15840,
83,
10,
6,
1064,
1119,
27,
1804,
2000,
7848,
351,
5547,
60,
83,
10,
1108,
1213,
4206,
288,
9248,
12,
283,
1213,
358,
267,
3991,
63,
633,
275,
291,
423,
1733,
63,
3821,
8,
288,
519,
5121,
419,
13,
3722,
13,
633,
628,
17140,
32691,
288,
9248,
12,
283,
3722,
2851,
297,
849,
29,
403,
9,
267,
340,
3991,
63,
633,
365,
488,
26,
221,
327,
3091,
5438,
29898,
7848,
351,
12,
3648,
367,
12169,
22010,
288,
372,
469,
355,
2513,
466,
356,
283,
633,
63,
24420,
297,
355,
283,
1873,
63,
498,
356,
283,
9417,
297,
355,
283,
633,
356,
1166,
12,
355,
283,
1213,
356,
2538,
12,
288,
789,
398,
372,
469,
288,
283,
344,
356,
3991,
63,
344,
12,
288,
283,
633,
356,
3991,
63,
633,
12,
288,
283,
1213,
356,
2538,
12,
288,
283,
1802,
356,
291,
423,
974,
63,
1733,
63,
1802,
8,
12022,
395,
288,
283,
8311,
356,
291,
423,
974,
63,
1733,
63,
8311,
8,
12022,
395,
267,
789,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
2644,
26,
2774,
13,
24,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
295,
199,
199,
504,
1275,
2330,
492,
21298,
421,
199,
533,
1804,
2000,
933,
16972,
4332,
8,
18283,
304,
272,
485,
5600,
63,
2632,
275,
519,
7,
2859,
14144,
1544,
4537,
31257,
7848,
351,
4537,
957,
15,
6776,
9448,
48,
28,
344,
13489,
15,
3672,
2447,
25737,
272,
485,
7569,
275,
8910,
267,
283,
633,
356,
283,
2859,
921,
1544,
14,
31257,
7848,
351,
14,
957,
15,
6776,
15,
1079,
26846,
1085,
1602,
15,
12569,
13,
1589,
13,
17372,
13,
1618,
13,
743,
609,
13,
17362,
31,
1121,
29,
4219,
63,
1985,
297,
267,
283,
1064,
21,
356,
283,
67,
2835,
525,
696,
2835,
11754,
556,
65,
1272,
67,
15463,
66,
21,
68,
24,
66,
2036,
26481,
297,
267,
283,
815,
63,
807,
356,
469,
288,
283,
344,
356,
283,
1079,
26846,
1085,
1602,
297,
288,
283,
832,
356,
283,
311,
20,
297,
288,
283,
1213,
356,
283,
29821,
26,
710,
1933,
1089,
402,
7135,
609,
598,
17633,
701,
1804,
1775,
445,
583,
2983,
297,
288,
283,
1802,
356,
283,
33,
3747,
333,
357,
679,
3685,
2213,
695,
626,
15735,
3746,
314,
283,
355,
283,
13602,
436,
25169,
402,
1373,
402,
308,
5203,
4750,
325,
5333,
282,
273,
274,
744,
26,
7135,
609,
598,
17633,
3130,
267,
1660,
272,
1660,
469,
267,
283,
4610,
356,
283,
27395,
3991,
334,
1397,
1808,
314,
5438,
29898,
7848,
351,
3991,
2435,
3196,
267,
283,
633,
356,
283,
2859,
921,
1544,
14,
31257,
7848,
351,
14,
957,
15,
6776,
15,
15459,
13583,
12549,
15,
321,
20541,
13,
69,
13,
10443,
13,
6821,
13,
509,
13,
28303,
13,
460,
13,
6238,
15,
18084,
15,
31485,
11175,
297,
267,
283,
10411,
356,
359,
288,
469,
355,
283,
815,
63,
807,
356,
469,
490,
283,
344,
356,
283,
32363,
9941,
2025,
297,
490,
283,
832,
356,
283,
311,
20,
297,
490,
283,
13671,
63,
344,
356,
283,
321,
20541,
297,
490,
283,
13671,
356,
283,
48,
2871,
830,
21580,
297,
490,
283,
1213,
356,
283,
48,
2871,
830,
284,
3100,
23362,
83,
297,
355,
789,
288,
789,
267,
2156,
272,
14877,
339,
347,
485,
3093,
63,
5005,
8,
277,
12,
1166,
304,
267,
333,
275,
295,
14,
1431,
8,
277,
423,
5600,
63,
2632,
12,
1166,
9,
267,
3991,
63,
344,
275,
333,
14,
923,
360,
344,
358,
267,
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,
288,
519,
7601,
1213,
3072,
83,
5830,
6697,
9,
15840,
83,
10,
6,
1064,
1119,
27,
1804,
2000,
7848,
351,
5547,
60,
83,
10,
1108,
1213,
4206,
288,
9248,
12,
283,
1213,
358,
267,
3991,
63,
633,
275,
291,
423,
1733,
63,
3821,
8,
288,
519,
5121,
419,
13,
3722,
13,
633,
628,
17140,
32691,
288,
9248,
12,
283,
3722,
2851,
297,
849,
29,
403,
9,
267,
340,
3991,
63,
633,
365,
488,
26,
221,
327,
3091,
5438,
29898,
7848,
351,
12,
3648,
367,
12169,
22010,
288,
372,
469,
355,
2513,
466,
356,
283,
633,
63,
24420,
297,
355,
283,
1873,
63,
498,
356,
283,
9417,
297,
355,
283,
633,
356,
1166,
12,
355,
283,
1213,
356,
2538,
12,
288,
789,
398,
372,
469,
288,
283,
344,
356,
3991,
63,
344,
12,
288,
283,
633,
356,
3991,
63,
633,
12,
288,
283,
1213,
356,
2538,
12,
288,
283,
1802,
356,
291,
423,
974,
63,
1733,
63,
1802,
8,
12022,
395,
288,
283,
8311,
356,
291,
423,
974,
63,
1733,
63,
8311,
8,
12022,
395,
267,
789,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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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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
] |
mne-tools/mne-python | mne/preprocessing/realign.py | 1 | 4237 | # -*- coding: utf-8 -*-
# Authors: Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import numpy as np
from numpy.polynomial.polynomial import Polynomial
from ..io import BaseRaw
from ..utils import _validate_type, warn, logger, verbose
@verbose
def realign_raw(raw, other, t_raw, t_other, verbose=None):
"""Realign two simultaneous recordings.
Due to clock drift, recordings at a given same sample rate made by two
separate devices simultaneously can become out of sync over time. This
function uses event times captured by both acquisition devices to resample
``other`` to match ``raw``.
Parameters
----------
raw : instance of Raw
The first raw instance.
other : instance of Raw
The second raw instance. It will be resampled to match ``raw``.
t_raw : array-like, shape (n_events,)
The times of shared events in ``raw`` relative to ``raw.times[0]`` (0).
Typically these could be events on some TTL channel like
``find_events(raw)[:, 0] - raw.first_event``.
t_other : array-like, shape (n_events,)
The times of shared events in ``other`` relative to ``other.times[0]``.
%(verbose)s
Notes
-----
This function operates inplace. It will:
1. Estimate the zero-order (start offset) and first-order (clock drift)
correction.
2. Crop the start of ``raw`` or ``other``, depending on which started
recording first.
3. Resample ``other`` to match ``raw`` based on the clock drift.
4. Crop the end of ``raw`` or ``other``, depending on which stopped
recording first (and the clock drift rate).
This function is primarily designed to work on recordings made at the same
sample rate, but it can also operate on recordings made at different
sample rates to resample and deal with clock drift simultaneously.
.. versionadded:: 0.22
"""
from scipy import stats
_validate_type(raw, BaseRaw, 'raw')
_validate_type(other, BaseRaw, 'other')
t_raw = np.array(t_raw, float)
t_other = np.array(t_other, float)
if t_raw.ndim != 1 or t_raw.shape != t_other.shape:
raise ValueError('t_raw and t_other must be 1D with the same shape, '
f'got shapes {t_raw.shape} and {t_other.shape}')
if len(t_raw) < 20:
warn('Fewer than 20 times passed, results may be unreliable')
# 1. Compute correction factors
poly = Polynomial.fit(x=t_other, y=t_raw, deg=1)
converted = poly.convert(domain=(-1, 1))
[zero_ord, first_ord] = converted.coef
logger.info(f'Zero order coefficient: {zero_ord} \n'
f'First order coefficient: {first_ord}')
r, p = stats.pearsonr(t_other, t_raw)
msg = f'Linear correlation computed as R={r:0.3f} and p={p:0.2e}'
if p > 0.05 or r <= 0:
raise ValueError(msg + ', cannot resample safely')
if p > 1e-6:
warn(msg + ', results may be unreliable')
else:
logger.info(msg)
dr_ms_s = 1000 * abs(1 - first_ord)
logger.info(
f'Drift rate: {1000 * dr_ms_s:0.1f} μs/sec '
f'(total drift over {raw.times[-1]:0.1f} sec recording: '
f'{raw.times[-1] * dr_ms_s:0.1f} ms)')
# 2. Crop start of recordings to match using the zero-order term
msg = f'Cropping {zero_ord:0.3f} sec from the start of '
if zero_ord > 0: # need to crop start of raw to match other
logger.info(msg + 'raw')
raw.crop(zero_ord, None)
t_raw -= zero_ord
else: # need to crop start of other to match raw
logger.info(msg + 'other')
other.crop(-zero_ord, None)
t_other += zero_ord
# 3. Resample data using the first-order term
logger.info('Resampling other')
sfreq_new = raw.info['sfreq'] * first_ord
other.load_data().resample(sfreq_new, verbose=True)
other.info['sfreq'] = raw.info['sfreq']
# 4. Crop the end of one of the recordings if necessary
delta = raw.times[-1] - other.times[-1]
msg = f'Cropping {abs(delta):0.3f} sec from the end of '
if delta > 0:
logger.info(msg + 'raw')
raw.crop(0, other.times[-1])
elif delta < 0:
logger.info(msg + 'other')
other.crop(0, raw.times[-1])
| bsd-3-clause | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
6642,
26,
662,
1567,
491,
285,
834,
665,
9828,
834,
14,
281,
530,
14,
68,
32,
6799,
14,
957,
30,
199,
199,
3,
844,
26,
6289,
334,
19,
13,
8501,
9,
199,
199,
646,
2680,
465,
980,
199,
504,
2680,
14,
22104,
14,
22104,
492,
8467,
8887,
199,
199,
504,
2508,
2308,
492,
3523,
7963,
199,
504,
2508,
1208,
492,
485,
3502,
63,
466,
12,
7987,
12,
2512,
12,
3376,
421,
199,
32,
3832,
199,
318,
3363,
1030,
63,
1773,
8,
1773,
12,
1163,
12,
307,
63,
1773,
12,
307,
63,
1848,
12,
3376,
29,
403,
304,
272,
408,
497,
5743,
2877,
27008,
2777,
780,
14,
339,
25855,
370,
12516,
366,
6501,
12,
2777,
780,
737,
282,
1627,
2011,
2690,
6634,
6326,
701,
2877,
272,
7396,
7256,
27008,
590,
883,
8649,
734,
402,
7604,
1806,
900,
14,
961,
272,
805,
4440,
1566,
5431,
17487,
701,
3865,
1066,
21523,
7256,
370,
31744,
272,
1124,
1848,
1040,
370,
1336,
1124,
1773,
4345,
339,
3897,
272,
4143,
272,
3066,
520,
1256,
402,
13480,
267,
710,
1642,
3066,
1256,
14,
272,
1163,
520,
1256,
402,
13480,
267,
710,
3499,
3066,
1256,
14,
2779,
911,
506,
31744,
68,
370,
1336,
1124,
1773,
4345,
272,
307,
63,
1773,
520,
1625,
13,
2930,
12,
2215,
334,
78,
63,
4368,
4258,
267,
710,
5431,
402,
5709,
4474,
315,
1124,
1773,
1040,
3847,
370,
1124,
1773,
14,
4508,
59,
16,
21133,
334,
16,
680,
267,
26914,
3520,
4293,
506,
4474,
641,
2005,
30822,
3623,
2839,
267,
1124,
1623,
63,
4368,
8,
1773,
24517,
378,
61,
446,
3066,
14,
2246,
63,
1430,
4345,
272,
307,
63,
1848,
520,
1625,
13,
2930,
12,
2215,
334,
78,
63,
4368,
4258,
267,
710,
5431,
402,
5709,
4474,
315,
1124,
1848,
1040,
3847,
370,
1124,
1848,
14,
4508,
59,
16,
30029,
272,
2818,
3832,
9,
83,
339,
8144,
272,
9063,
272,
961,
805,
1758,
2335,
16304,
14,
2779,
911,
26,
339,
413,
14,
15896,
6897,
314,
4697,
13,
1648,
334,
928,
3268,
9,
436,
1642,
13,
1648,
334,
9597,
366,
6501,
9,
2126,
21940,
14,
272,
499,
14,
445,
2675,
314,
1343,
402,
1124,
1773,
1040,
503,
1124,
1848,
4542,
10298,
641,
1314,
8239,
2126,
20952,
1642,
14,
272,
650,
14,
3591,
865,
1124,
1848,
1040,
370,
1336,
1124,
1773,
1040,
4079,
641,
314,
12516,
366,
6501,
14,
272,
841,
14,
445,
2675,
314,
1284,
402,
1124,
1773,
1040,
503,
1124,
1848,
4542,
10298,
641,
1314,
15248,
2126,
20952,
1642,
334,
460,
314,
12516,
366,
6501,
6634,
680,
339,
961,
805,
365,
1979,
30468,
19829,
370,
1736,
641,
2777,
780,
6326,
737,
314,
2011,
272,
2690,
6634,
12,
1325,
652,
883,
2597,
19218,
641,
2777,
780,
6326,
737,
3365,
272,
2690,
24434,
370,
31744,
436,
7962,
543,
12516,
366,
6501,
27008,
590,
14,
339,
2508,
7445,
447,
378,
14,
1081,
272,
408,
272,
687,
7026,
492,
5020,
272,
485,
3502,
63,
466,
8,
1773,
12,
3523,
7963,
12,
283,
1773,
358,
272,
485,
3502,
63,
466,
8,
1848,
12,
3523,
7963,
12,
283,
1848,
358,
272,
307,
63,
1773,
275,
980,
14,
1144,
8,
84,
63,
1773,
12,
2069,
9,
272,
307,
63,
1848,
275,
980,
14,
1144,
8,
84,
63,
1848,
12,
2069,
9,
272,
340,
307,
63,
1773,
14,
8322,
1137,
413,
503,
307,
63,
1773,
14,
1392,
1137,
307,
63,
1848,
14,
1392,
26,
267,
746,
1722,
360,
84,
63,
1773,
436,
307,
63,
1848,
1471,
506,
413,
36,
543,
314,
2011,
2215,
12,
283,
586,
289,
7,
7808,
11751,
469,
84,
63,
1773,
14,
1392,
93,
436,
469,
84,
63,
1848,
14,
1392,
12216,
272,
340,
822,
8,
84,
63,
1773,
9,
665,
3388,
26,
267,
7987,
360,
38,
546,
281,
2419,
3388,
5431,
3032,
12,
2058,
1443,
506,
625,
26557,
461,
358,
339,
327,
413,
14,
8354,
21940,
17704,
272,
8446,
275,
8467,
8887,
14,
3269,
8,
88,
29,
84,
63,
1848,
12,
612,
29,
84,
63,
1773,
12,
7926,
29,
17,
9,
272,
6702,
275,
8446,
14,
3916,
8,
2261,
26154,
17,
12,
413,
430,
272,
359,
4262,
63,
2181,
12,
1642,
63,
2181,
61,
275,
6702,
14,
8009,
272,
2512,
14,
815,
8,
70,
7,
8681,
1865,
9421,
26,
469,
4262,
63,
2181,
93,
971,
78,
7,
355,
289,
7,
7147,
1865,
9421,
26,
469,
2246,
63,
2181,
12216,
272,
519,
12,
299,
275,
5020,
14,
16343,
834,
82,
8,
84,
63,
1848,
12,
307,
63,
1773,
9,
272,
1499,
275,
289,
7,
10608,
21280,
9235,
465,
820,
3126,
82,
26,
16,
14,
19,
70,
93,
436,
299,
3126,
80,
26,
16,
14,
18,
69,
6834,
272,
340,
299,
690,
378,
14,
1717,
503,
519,
2695,
378,
26,
267,
746,
1722,
8,
1328,
435,
1656,
3913,
31744,
19353,
358,
272,
340,
299,
690,
413,
69,
13,
22,
26,
267,
7987,
8,
1328,
435,
1656,
2058,
1443,
506,
625,
26557,
461,
358,
272,
587,
26,
267,
2512,
14,
815,
8,
1328,
9,
272,
16642,
63,
706,
63,
83,
275,
5198,
627,
2853,
8,
17,
446,
1642,
63,
2181,
9,
272,
2512,
14,
815,
8,
267,
289,
7,
36,
6501,
6634,
26,
469,
5279,
627,
16642,
63,
706,
63,
83,
26,
16,
14,
17,
70,
93,
19123,
121,
83,
15,
3321,
283,
267,
289,
6774,
2923,
366,
6501,
1806,
469,
1773,
14,
4508,
1988,
17,
2189,
16,
14,
17,
70,
93,
6513,
20952,
26,
283,
267,
289,
16019,
1773,
14,
4508,
1988,
17,
61,
627,
16642,
63,
706,
63,
83,
26,
16,
14,
17,
70,
93,
6605,
5942,
339,
327,
499,
14,
445,
2675,
1343,
402,
2777,
780,
370,
1336,
1808,
314,
4697,
13,
1648,
6707,
272,
1499,
275,
289,
7,
35,
20148,
469,
4262,
63,
2181,
26,
16,
14,
19,
70,
93,
6513,
687,
314,
1343,
402,
283,
272,
340,
4697,
63,
2181,
690,
378,
26,
221,
327,
1929,
370,
18366,
1343,
402,
3066,
370,
1336,
1163,
267,
2512,
14,
815,
8,
1328,
435,
283,
1773,
358,
267,
3066,
14,
15816,
8,
4262,
63,
2181,
12,
488,
9,
267,
307,
63,
1773,
4862,
4697,
63,
2181,
272,
587,
26,
221,
327,
1929,
370,
18366,
1343,
402,
1163,
370,
1336,
3066,
267,
2512
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
6642,
26,
662,
1567,
491,
285,
834,
665,
9828,
834,
14,
281,
530,
14,
68,
32,
6799,
14,
957,
30,
199,
199,
3,
844,
26,
6289,
334,
19,
13,
8501,
9,
199,
199,
646,
2680,
465,
980,
199,
504,
2680,
14,
22104,
14,
22104,
492,
8467,
8887,
199,
199,
504,
2508,
2308,
492,
3523,
7963,
199,
504,
2508,
1208,
492,
485,
3502,
63,
466,
12,
7987,
12,
2512,
12,
3376,
421,
199,
32,
3832,
199,
318,
3363,
1030,
63,
1773,
8,
1773,
12,
1163,
12,
307,
63,
1773,
12,
307,
63,
1848,
12,
3376,
29,
403,
304,
272,
408,
497,
5743,
2877,
27008,
2777,
780,
14,
339,
25855,
370,
12516,
366,
6501,
12,
2777,
780,
737,
282,
1627,
2011,
2690,
6634,
6326,
701,
2877,
272,
7396,
7256,
27008,
590,
883,
8649,
734,
402,
7604,
1806,
900,
14,
961,
272,
805,
4440,
1566,
5431,
17487,
701,
3865,
1066,
21523,
7256,
370,
31744,
272,
1124,
1848,
1040,
370,
1336,
1124,
1773,
4345,
339,
3897,
272,
4143,
272,
3066,
520,
1256,
402,
13480,
267,
710,
1642,
3066,
1256,
14,
272,
1163,
520,
1256,
402,
13480,
267,
710,
3499,
3066,
1256,
14,
2779,
911,
506,
31744,
68,
370,
1336,
1124,
1773,
4345,
272,
307,
63,
1773,
520,
1625,
13,
2930,
12,
2215,
334,
78,
63,
4368,
4258,
267,
710,
5431,
402,
5709,
4474,
315,
1124,
1773,
1040,
3847,
370,
1124,
1773,
14,
4508,
59,
16,
21133,
334,
16,
680,
267,
26914,
3520,
4293,
506,
4474,
641,
2005,
30822,
3623,
2839,
267,
1124,
1623,
63,
4368,
8,
1773,
24517,
378,
61,
446,
3066,
14,
2246,
63,
1430,
4345,
272,
307,
63,
1848,
520,
1625,
13,
2930,
12,
2215,
334,
78,
63,
4368,
4258,
267,
710,
5431,
402,
5709,
4474,
315,
1124,
1848,
1040,
3847,
370,
1124,
1848,
14,
4508,
59,
16,
30029,
272,
2818,
3832,
9,
83,
339,
8144,
272,
9063,
272,
961,
805,
1758,
2335,
16304,
14,
2779,
911,
26,
339,
413,
14,
15896,
6897,
314,
4697,
13,
1648,
334,
928,
3268,
9,
436,
1642,
13,
1648,
334,
9597,
366,
6501,
9,
2126,
21940,
14,
272,
499,
14,
445,
2675,
314,
1343,
402,
1124,
1773,
1040,
503,
1124,
1848,
4542,
10298,
641,
1314,
8239,
2126,
20952,
1642,
14,
272,
650,
14,
3591,
865,
1124,
1848,
1040,
370,
1336,
1124,
1773,
1040,
4079,
641,
314,
12516,
366,
6501,
14,
272,
841,
14,
445,
2675,
314,
1284,
402,
1124,
1773,
1040,
503,
1124,
1848,
4542,
10298,
641,
1314,
15248,
2126,
20952,
1642,
334,
460,
314,
12516,
366,
6501,
6634,
680,
339,
961,
805,
365,
1979,
30468,
19829,
370,
1736,
641,
2777,
780,
6326,
737,
314,
2011,
272,
2690,
6634,
12,
1325,
652,
883,
2597,
19218,
641,
2777,
780,
6326,
737,
3365,
272,
2690,
24434,
370,
31744,
436,
7962,
543,
12516,
366,
6501,
27008,
590,
14,
339,
2508,
7445,
447,
378,
14,
1081,
272,
408,
272,
687,
7026,
492,
5020,
272,
485,
3502,
63,
466,
8,
1773,
12,
3523,
7963,
12,
283,
1773,
358,
272,
485,
3502,
63,
466,
8,
1848,
12,
3523,
7963,
12,
283,
1848,
358,
272,
307,
63,
1773,
275,
980,
14,
1144,
8,
84,
63,
1773,
12,
2069,
9,
272,
307,
63,
1848,
275,
980,
14,
1144,
8,
84,
63,
1848,
12,
2069,
9,
272,
340,
307,
63,
1773,
14,
8322,
1137,
413,
503,
307,
63,
1773,
14,
1392,
1137,
307,
63,
1848,
14,
1392,
26,
267,
746,
1722,
360,
84,
63,
1773,
436,
307,
63,
1848,
1471,
506,
413,
36,
543,
314,
2011,
2215,
12,
283,
586,
289,
7,
7808,
11751,
469,
84,
63,
1773,
14,
1392,
93,
436,
469,
84,
63,
1848,
14,
1392,
12216,
272,
340,
822,
8,
84,
63,
1773,
9,
665,
3388,
26,
267,
7987,
360,
38,
546,
281,
2419,
3388,
5431,
3032,
12,
2058,
1443,
506,
625,
26557,
461,
358,
339,
327,
413,
14,
8354,
21940,
17704,
272,
8446,
275,
8467,
8887,
14,
3269,
8,
88,
29,
84,
63,
1848,
12,
612,
29,
84,
63,
1773,
12,
7926,
29,
17,
9,
272,
6702,
275,
8446,
14,
3916,
8,
2261,
26154,
17,
12,
413,
430,
272,
359,
4262,
63,
2181,
12,
1642,
63,
2181,
61,
275,
6702,
14,
8009,
272,
2512,
14,
815,
8,
70,
7,
8681,
1865,
9421,
26,
469,
4262,
63,
2181,
93,
971,
78,
7,
355,
289,
7,
7147,
1865,
9421,
26,
469,
2246,
63,
2181,
12216,
272,
519,
12,
299,
275,
5020,
14,
16343,
834,
82,
8,
84,
63,
1848,
12,
307,
63,
1773,
9,
272,
1499,
275,
289,
7,
10608,
21280,
9235,
465,
820,
3126,
82,
26,
16,
14,
19,
70,
93,
436,
299,
3126,
80,
26,
16,
14,
18,
69,
6834,
272,
340,
299,
690,
378,
14,
1717,
503,
519,
2695,
378,
26,
267,
746,
1722,
8,
1328,
435,
1656,
3913,
31744,
19353,
358,
272,
340,
299,
690,
413,
69,
13,
22,
26,
267,
7987,
8,
1328,
435,
1656,
2058,
1443,
506,
625,
26557,
461,
358,
272,
587,
26,
267,
2512,
14,
815,
8,
1328,
9,
272,
16642,
63,
706,
63,
83,
275,
5198,
627,
2853,
8,
17,
446,
1642,
63,
2181,
9,
272,
2512,
14,
815,
8,
267,
289,
7,
36,
6501,
6634,
26,
469,
5279,
627,
16642,
63,
706,
63,
83,
26,
16,
14,
17,
70,
93,
19123,
121,
83,
15,
3321,
283,
267,
289,
6774,
2923,
366,
6501,
1806,
469,
1773,
14,
4508,
1988,
17,
2189,
16,
14,
17,
70,
93,
6513,
20952,
26,
283,
267,
289,
16019,
1773,
14,
4508,
1988,
17,
61,
627,
16642,
63,
706,
63,
83,
26,
16,
14,
17,
70,
93,
6605,
5942,
339,
327,
499,
14,
445,
2675,
1343,
402,
2777,
780,
370,
1336,
1808,
314,
4697,
13,
1648,
6707,
272,
1499,
275,
289,
7,
35,
20148,
469,
4262,
63,
2181,
26,
16,
14,
19,
70,
93,
6513,
687,
314,
1343,
402,
283,
272,
340,
4697,
63,
2181,
690,
378,
26,
221,
327,
1929,
370,
18366,
1343,
402,
3066,
370,
1336,
1163,
267,
2512,
14,
815,
8,
1328,
435,
283,
1773,
358,
267,
3066,
14,
15816,
8,
4262,
63,
2181,
12,
488,
9,
267,
307,
63,
1773,
4862,
4697,
63,
2181,
272,
587,
26,
221,
327,
1929,
370,
18366,
1343,
402,
1163,
370,
1336,
3066,
267,
2512,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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py | 342 | 1066 | from django.template.defaultfilters import dictsortreversed
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_sort(self):
sorted_dicts = dictsortreversed(
[{'age': 23, 'name': 'Barbara-Ann'},
{'age': 63, 'name': 'Ra Ra Rasputin'},
{'name': 'Jonny B Goode', 'age': 18}],
'age',
)
self.assertEqual(
[sorted(dict.items()) for dict in sorted_dicts],
[[('age', 63), ('name', 'Ra Ra Rasputin')],
[('age', 23), ('name', 'Barbara-Ann')],
[('age', 18), ('name', 'Jonny B Goode')]],
)
def test_invalid_values(self):
"""
If dictsortreversed is passed something other than a list of
dictionaries, fail silently.
"""
self.assertEqual(dictsortreversed([1, 2, 3], 'age'), '')
self.assertEqual(dictsortreversed('Hello!', 'age'), '')
self.assertEqual(dictsortreversed({'a': 1}, 'age'), '')
self.assertEqual(dictsortreversed(1, 'age'), '')
| bsd-3-clause | [
504,
1639,
14,
1160,
14,
885,
4273,
492,
1211,
3191,
13501,
199,
504,
1639,
14,
396,
492,
24424,
421,
199,
533,
6801,
2925,
8,
17968,
304,
339,
347,
511,
63,
3191,
8,
277,
304,
267,
3355,
63,
7892,
275,
1211,
3191,
13501,
8,
288,
9016,
474,
356,
6546,
12,
283,
354,
356,
283,
5281,
1700,
65,
13,
2493,
78,
2267,
1467,
791,
474,
356,
13668,
12,
283,
354,
356,
283,
1537,
3898,
820,
305,
524,
262,
2267,
1467,
791,
354,
356,
283,
42,
265,
9745,
699,
3971,
380,
297,
283,
474,
356,
6155,
22140,
288,
283,
474,
297,
267,
776,
398,
291,
14,
629,
8,
288,
359,
5917,
8,
807,
14,
1744,
1012,
367,
1211,
315,
3355,
63,
7892,
467,
288,
3474,
360,
474,
297,
13668,
395,
661,
354,
297,
283,
1537,
3898,
820,
305,
524,
262,
2665,
1467,
4274,
474,
297,
6546,
395,
661,
354,
297,
283,
5281,
1700,
65,
13,
2493,
78,
2665,
1467,
4274,
474,
297,
6155,
395,
661,
354,
297,
283,
42,
265,
9745,
699,
3971,
380,
7385,
267,
776,
339,
347,
511,
63,
3197,
63,
1459,
8,
277,
304,
267,
408,
267,
982,
1211,
3191,
13501,
365,
3032,
6020,
1163,
2419,
282,
769,
402,
267,
11196,
12,
2449,
18030,
14,
267,
408,
267,
291,
14,
629,
8,
807,
3191,
13501,
779,
17,
12,
499,
12,
650,
467,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
360,
6257,
12389,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
3252,
65,
356,
413,
1386,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
8,
17,
12,
283,
474,
659,
4074,
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
] | [
1639,
14,
1160,
14,
885,
4273,
492,
1211,
3191,
13501,
199,
504,
1639,
14,
396,
492,
24424,
421,
199,
533,
6801,
2925,
8,
17968,
304,
339,
347,
511,
63,
3191,
8,
277,
304,
267,
3355,
63,
7892,
275,
1211,
3191,
13501,
8,
288,
9016,
474,
356,
6546,
12,
283,
354,
356,
283,
5281,
1700,
65,
13,
2493,
78,
2267,
1467,
791,
474,
356,
13668,
12,
283,
354,
356,
283,
1537,
3898,
820,
305,
524,
262,
2267,
1467,
791,
354,
356,
283,
42,
265,
9745,
699,
3971,
380,
297,
283,
474,
356,
6155,
22140,
288,
283,
474,
297,
267,
776,
398,
291,
14,
629,
8,
288,
359,
5917,
8,
807,
14,
1744,
1012,
367,
1211,
315,
3355,
63,
7892,
467,
288,
3474,
360,
474,
297,
13668,
395,
661,
354,
297,
283,
1537,
3898,
820,
305,
524,
262,
2665,
1467,
4274,
474,
297,
6546,
395,
661,
354,
297,
283,
5281,
1700,
65,
13,
2493,
78,
2665,
1467,
4274,
474,
297,
6155,
395,
661,
354,
297,
283,
42,
265,
9745,
699,
3971,
380,
7385,
267,
776,
339,
347,
511,
63,
3197,
63,
1459,
8,
277,
304,
267,
408,
267,
982,
1211,
3191,
13501,
365,
3032,
6020,
1163,
2419,
282,
769,
402,
267,
11196,
12,
2449,
18030,
14,
267,
408,
267,
291,
14,
629,
8,
807,
3191,
13501,
779,
17,
12,
499,
12,
650,
467,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
360,
6257,
12389,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
3252,
65,
356,
413,
1386,
283,
474,
659,
4074,
267,
291,
14,
629,
8,
807,
3191,
13501,
8,
17,
12,
283,
474,
659,
4074,
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,
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
] |
asmacdo/pulp-automation | tests/general_tests/test_06_roles.py | 2 | 6147 | import unittest, json
from tests import pulp_test
from pulp_auto import Pulp
from pulp_auto.role import Role
from pulp_auto.user import User
from pulp_auto.repo import Repo
def setUpModule():
pass
class RoleTest(pulp_test.PulpTest):
@classmethod
def setUpClass(cls):
super(RoleTest, cls).setUpClass()
# create roles
with cls.pulp.asserting(True):
response = Role.create(cls.pulp, data={'role_id': cls.__name__ + "_role"})
cls.role = Role.from_response(response)
with cls.pulp.asserting(True):
response2 = Role.create(cls.pulp, data={'role_id': cls.__name__ + "_role2"})
cls.role2 = Role.from_response(response2)
with cls.pulp.asserting(True):
response3 = Role.create(cls.pulp, data={'role_id': cls.__name__ + "_role3"})
cls.role3 = Role.from_response(response3)
# users
cls.user = User(data={"login": cls.__name__ + "_user", "name": cls.__name__, "password": cls.__name__})
cls.user2 = User(data={"login": cls.__name__ + "_user2", "name": cls.__name__, "password": cls.__name__})
# a new session has to be created for the user as auth credeantials of admin are used by default
cls.user_pulp = Pulp(cls.pulp.url, auth=(cls.user.data['login'], cls.user.data['password']))
cls.user_pulp2 = Pulp(cls.pulp.url, auth=(cls.user2.data['login'], cls.user2.data['password']))
@classmethod
def tearDownClass(cls):
# delete users
with cls.pulp.asserting(True):
cls.user.delete(cls.pulp)
with cls.pulp.asserting(True):
cls.user2.delete(cls.pulp)
# delete roles
with cls.pulp.asserting(True):
cls.role2.delete(cls.pulp)
class SimpleRoleTest(RoleTest):
def test_01_no_dupl_role(self):
Role.create(self.pulp, data={'role_id': self.role.id})
self.assertPulp(code=409)
def test_02_get_role(self):
self.assertEqual(self.role, Role.get(self.pulp, self.role.id))
self.assertEqual(self.role2, Role.get(self.pulp, self.role2.id))
def test_03_get_unexistant_role(self):
with self.assertRaises(AssertionError):
Role.get(self.pulp, 'some_id')
self.assertPulp(code=404)
def test_04_list_roles(self):
self.assertIn(self.role, Role.list(self.pulp))
self.assertIn(self.role2, Role.list(self.pulp))
def test_05_update_role(self):
display_name = 'A %s role' % self.__class__.__name__
self.role |= {'display_name': display_name}
self.role.delta_update(self.pulp)
self.assertPulp(code=200)
self.assertEqual(Role.get(self.pulp, self.role.id).data['display_name'], display_name)
def test_05_update_role_permission_bz1066040(self):
# https://bugzilla.redhat.com/show_bug.cgi?id=1066040
self.role.data["permissions"] = {"/":["CREATE","DELETE"]}
self.role.delta_update(self.pulp)
self.assertPulp(code=400)
def test_06_update_unexistant_role(self):
self.role3.delete(self.pulp)
display_name = 'A %s role' % self.__class__.__name__
self.role3 |= {'display_name': display_name}
with self.assertRaises(AssertionError):
self.role3.delta_update(self.pulp)
self.assertPulp(code=404)
def test_07_add_user(self):
# create user
self.user.create(self.pulp)
self.assertPulpOK()
# add user to the role
self.role.add_user(
self.pulp,
self.user.id
)
self.assertPulp(code=200)
self.assertEqual(Role.get(self.pulp, self.role.id).data['users'], [self.user.id])
def test_08_add_unexistant_user_1116825(self):
# https://bugzilla.redhat.com/show_bug.cgi?id=1116825
# add user to the role
self.role.add_user(
self.pulp,
"Unexistant_user"
)
self.assertPulp(code=400)
def test_09_remove_user(self):
# remove user from the role
self.role.remove_user(
self.pulp,
self.user.id
)
self.assertPulp(code=200)
self.assertEqual(Role.get(self.pulp, self.role.id).data['users'], [])
def test_10_add_2_users(self):
# create second user
self.user2.create(self.pulp)
self.assertPulpOK()
# add users to the role
self.role.add_user(
self.pulp,
self.user.id
)
self.assertPulp(code=200)
self.role.add_user(
self.pulp,
self.user2.id
)
self.assertPulp(code=200)
self.assertEqual(Role.get(self.pulp, self.role.id).data['users'], [self.user.id, self.user2.id])
def test_11_add_role_perm(self):
self.role.grant_permission(self.pulp, self.role.id, "/", ["READ", "EXECUTE"])
self.role.grant_permission(self.pulp, self.role.id, "/repositories/", ["READ", "EXECUTE"])
self.assertPulpOK()
def test_12_check_user_perm(self):
with self.user_pulp.asserting(True):
Repo.list(self.user_pulp)
with self.user_pulp2.asserting(True):
Repo.list(self.user_pulp2)
def test_13_remove_user(self):
# remove user from the role
self.role.remove_user(
self.pulp,
self.user2.id
)
self.assertPulp(code=200)
def test_14_check_bindings_removed(self):
#check that after user2 removal from role user binding are also removed
with self.assertRaises(AssertionError):
with self.user_pulp2.asserting(True):
Repo.list(self.user_pulp2)
def test_15_check_bindings_removed(self):
self.role.delete(self.pulp)
self.assertPulpOK()
#check that after role deletion user binding are also removed
with self.assertRaises(AssertionError):
with self.user_pulp.asserting(True):
Repo.list(self.user_pulp)
def test_16_delete_unexistant_role(self):
#check you cannot delete role twice
self.role.delete(self.pulp)
self.assertPulp(code=404)
| gpl-2.0 | [
646,
2882,
12,
2022,
199,
504,
2295,
492,
299,
15513,
63,
396,
199,
504,
299,
15513,
63,
2495,
492,
510,
15513,
199,
504,
299,
15513,
63,
2495,
14,
3756,
492,
18033,
199,
504,
299,
15513,
63,
2495,
14,
751,
492,
2876,
199,
504,
299,
15513,
63,
2495,
14,
3417,
492,
20069,
421,
199,
318,
3613,
2377,
837,
272,
986,
421,
199,
533,
18033,
774,
8,
80,
15513,
63,
396,
14,
48,
15513,
774,
304,
272,
768,
3744,
272,
347,
18561,
8,
1886,
304,
267,
1613,
8,
7422,
774,
12,
843,
680,
27777,
342,
267,
327,
1218,
11689,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
5984,
267,
843,
14,
3756,
275,
18033,
14,
504,
63,
1310,
8,
1310,
9,
398,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
18,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
18,
5984,
267,
843,
14,
3756,
18,
275,
18033,
14,
504,
63,
1310,
8,
1310,
18,
9,
398,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
19,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
19,
5984,
267,
843,
14,
3756,
19,
275,
18033,
14,
504,
63,
1310,
8,
1310,
19,
9,
398,
327,
4390,
267,
843,
14,
751,
275,
2876,
8,
576,
8871,
2886,
582,
843,
855,
354,
363,
435,
2668,
751,
401,
298,
354,
582,
843,
855,
354,
3108,
298,
2060,
582,
843,
855,
354,
363,
1552,
267,
843,
14,
751,
18,
275,
2876,
8,
576,
8871,
2886,
582,
843,
855,
354,
363,
435,
2668,
751,
18,
401,
298,
354,
582,
843,
855,
354,
3108,
298,
2060,
582,
843,
855,
354,
363,
1552,
267,
327,
282,
892,
2351,
965,
370,
506,
2737,
367,
314,
922,
465,
1790,
2837,
271,
290,
1009,
83,
402,
4628,
787,
1202,
701,
849,
267,
843,
14,
751,
63,
80,
15513,
275,
510,
15513,
8,
1886,
14,
80,
15513,
14,
633,
12,
1790,
2687,
1886,
14,
751,
14,
576,
459,
2886,
995,
843,
14,
751,
14,
576,
459,
2060,
5156,
267,
843,
14,
751,
63,
80,
15513,
18,
275,
510,
15513,
8,
1886,
14,
80,
15513,
14,
633,
12,
1790,
2687,
1886,
14,
751,
18,
14,
576,
459,
2886,
995,
843,
14,
751,
18,
14,
576,
459,
2060,
5156,
339,
768,
3744,
272,
347,
24468,
8,
1886,
304,
267,
327,
3145,
4390,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
751,
14,
1807,
8,
1886,
14,
80,
15513,
9,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
751,
18,
14,
1807,
8,
1886,
14,
80,
15513,
9,
398,
327,
3145,
11689,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
3756,
18,
14,
1807,
8,
1886,
14,
80,
15513,
9,
421,
199,
533,
5870,
7422,
774,
8,
7422,
774,
304,
339,
347,
511,
63,
614,
63,
889,
63,
11048,
76,
63,
3756,
8,
277,
304,
267,
18033,
14,
981,
8,
277,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
291,
14,
3756,
14,
344,
1552,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
12443,
9,
339,
347,
511,
63,
996,
63,
362,
63,
3756,
8,
277,
304,
267,
291,
14,
629,
8,
277,
14,
3756,
12,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
14,
344,
430,
267,
291,
14,
629,
8,
277,
14,
3756,
18,
12,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
18,
14,
344,
430,
339,
347,
511,
63,
1644,
63,
362,
63,
324,
4494,
867,
63,
3756,
8,
277,
304,
267,
543,
291,
14,
1855,
8,
14844,
304,
288,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
283,
3972,
63,
344,
358,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5188,
9,
339,
347,
511,
63,
966,
63,
513,
63,
8050,
8,
277,
304,
267,
291,
14,
4080,
8,
277,
14,
3756,
12,
18033,
14,
513,
8,
277,
14,
80,
15513,
430,
267,
291,
14,
4080,
8,
277,
14,
3756,
18,
12,
18033,
14,
513,
8,
277,
14,
80,
15513,
430,
339,
347,
511,
63,
1717,
63,
873,
63,
3756,
8,
277,
304,
267,
2929,
63,
354,
275,
283,
33,
450,
83,
4719,
7,
450,
291,
855,
533,
4914,
354,
363,
267,
291,
14,
3756,
8901,
791,
2918,
63,
354,
356,
2929,
63,
354,
93,
267,
291,
14,
3756,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
1840,
9,
267,
291,
14,
629,
8,
7422,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
14,
344,
680,
576,
459,
2918,
63,
354,
995,
2929,
63,
354,
9,
339,
347,
511,
63,
1717,
63,
873,
63,
3756,
63,
5693,
63,
10582,
709,
1272,
11189,
8,
277,
304,
267,
327,
4178,
921,
29220,
14,
17164,
14,
957,
15,
2384,
63,
1266,
14,
13814,
31,
344,
29,
709,
1272,
11189,
4960,
291,
14,
3756,
14,
576,
905,
6060,
937,
275,
2420,
15,
582,
905,
8366,
2266,
7014,
27635,
267,
291,
14,
3756,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5303,
9,
339,
347,
511,
63,
1690,
63,
873,
63,
324,
4494,
867,
63,
3756,
8,
277,
304,
267,
291,
14,
3756,
19,
14,
1807,
8,
277,
14,
80,
15513,
9,
267,
2929,
63,
354,
275,
283,
33,
450,
83,
4719,
7,
450,
291,
855,
533,
4914,
354,
363,
267,
291,
14,
3756,
19,
8901,
791,
2918,
63,
354,
356,
2929,
63,
354,
93,
267,
543,
291,
14,
1855,
8,
14844,
304,
288,
291,
14,
3756,
19,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5188,
9,
339,
347,
511,
63,
1780
] | [
2882,
12,
2022,
199,
504,
2295,
492,
299,
15513,
63,
396,
199,
504,
299,
15513,
63,
2495,
492,
510,
15513,
199,
504,
299,
15513,
63,
2495,
14,
3756,
492,
18033,
199,
504,
299,
15513,
63,
2495,
14,
751,
492,
2876,
199,
504,
299,
15513,
63,
2495,
14,
3417,
492,
20069,
421,
199,
318,
3613,
2377,
837,
272,
986,
421,
199,
533,
18033,
774,
8,
80,
15513,
63,
396,
14,
48,
15513,
774,
304,
272,
768,
3744,
272,
347,
18561,
8,
1886,
304,
267,
1613,
8,
7422,
774,
12,
843,
680,
27777,
342,
267,
327,
1218,
11689,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
5984,
267,
843,
14,
3756,
275,
18033,
14,
504,
63,
1310,
8,
1310,
9,
398,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
18,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
18,
5984,
267,
843,
14,
3756,
18,
275,
18033,
14,
504,
63,
1310,
8,
1310,
18,
9,
398,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
1177,
19,
275,
18033,
14,
981,
8,
1886,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
843,
855,
354,
363,
435,
2668,
3756,
19,
5984,
267,
843,
14,
3756,
19,
275,
18033,
14,
504,
63,
1310,
8,
1310,
19,
9,
398,
327,
4390,
267,
843,
14,
751,
275,
2876,
8,
576,
8871,
2886,
582,
843,
855,
354,
363,
435,
2668,
751,
401,
298,
354,
582,
843,
855,
354,
3108,
298,
2060,
582,
843,
855,
354,
363,
1552,
267,
843,
14,
751,
18,
275,
2876,
8,
576,
8871,
2886,
582,
843,
855,
354,
363,
435,
2668,
751,
18,
401,
298,
354,
582,
843,
855,
354,
3108,
298,
2060,
582,
843,
855,
354,
363,
1552,
267,
327,
282,
892,
2351,
965,
370,
506,
2737,
367,
314,
922,
465,
1790,
2837,
271,
290,
1009,
83,
402,
4628,
787,
1202,
701,
849,
267,
843,
14,
751,
63,
80,
15513,
275,
510,
15513,
8,
1886,
14,
80,
15513,
14,
633,
12,
1790,
2687,
1886,
14,
751,
14,
576,
459,
2886,
995,
843,
14,
751,
14,
576,
459,
2060,
5156,
267,
843,
14,
751,
63,
80,
15513,
18,
275,
510,
15513,
8,
1886,
14,
80,
15513,
14,
633,
12,
1790,
2687,
1886,
14,
751,
18,
14,
576,
459,
2886,
995,
843,
14,
751,
18,
14,
576,
459,
2060,
5156,
339,
768,
3744,
272,
347,
24468,
8,
1886,
304,
267,
327,
3145,
4390,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
751,
14,
1807,
8,
1886,
14,
80,
15513,
9,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
751,
18,
14,
1807,
8,
1886,
14,
80,
15513,
9,
398,
327,
3145,
11689,
267,
543,
843,
14,
80,
15513,
14,
479,
316,
8,
549,
304,
288,
843,
14,
3756,
18,
14,
1807,
8,
1886,
14,
80,
15513,
9,
421,
199,
533,
5870,
7422,
774,
8,
7422,
774,
304,
339,
347,
511,
63,
614,
63,
889,
63,
11048,
76,
63,
3756,
8,
277,
304,
267,
18033,
14,
981,
8,
277,
14,
80,
15513,
12,
666,
3713,
3756,
63,
344,
356,
291,
14,
3756,
14,
344,
1552,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
12443,
9,
339,
347,
511,
63,
996,
63,
362,
63,
3756,
8,
277,
304,
267,
291,
14,
629,
8,
277,
14,
3756,
12,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
14,
344,
430,
267,
291,
14,
629,
8,
277,
14,
3756,
18,
12,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
18,
14,
344,
430,
339,
347,
511,
63,
1644,
63,
362,
63,
324,
4494,
867,
63,
3756,
8,
277,
304,
267,
543,
291,
14,
1855,
8,
14844,
304,
288,
18033,
14,
362,
8,
277,
14,
80,
15513,
12,
283,
3972,
63,
344,
358,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5188,
9,
339,
347,
511,
63,
966,
63,
513,
63,
8050,
8,
277,
304,
267,
291,
14,
4080,
8,
277,
14,
3756,
12,
18033,
14,
513,
8,
277,
14,
80,
15513,
430,
267,
291,
14,
4080,
8,
277,
14,
3756,
18,
12,
18033,
14,
513,
8,
277,
14,
80,
15513,
430,
339,
347,
511,
63,
1717,
63,
873,
63,
3756,
8,
277,
304,
267,
2929,
63,
354,
275,
283,
33,
450,
83,
4719,
7,
450,
291,
855,
533,
4914,
354,
363,
267,
291,
14,
3756,
8901,
791,
2918,
63,
354,
356,
2929,
63,
354,
93,
267,
291,
14,
3756,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
1840,
9,
267,
291,
14,
629,
8,
7422,
14,
362,
8,
277,
14,
80,
15513,
12,
291,
14,
3756,
14,
344,
680,
576,
459,
2918,
63,
354,
995,
2929,
63,
354,
9,
339,
347,
511,
63,
1717,
63,
873,
63,
3756,
63,
5693,
63,
10582,
709,
1272,
11189,
8,
277,
304,
267,
327,
4178,
921,
29220,
14,
17164,
14,
957,
15,
2384,
63,
1266,
14,
13814,
31,
344,
29,
709,
1272,
11189,
4960,
291,
14,
3756,
14,
576,
905,
6060,
937,
275,
2420,
15,
582,
905,
8366,
2266,
7014,
27635,
267,
291,
14,
3756,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5303,
9,
339,
347,
511,
63,
1690,
63,
873,
63,
324,
4494,
867,
63,
3756,
8,
277,
304,
267,
291,
14,
3756,
19,
14,
1807,
8,
277,
14,
80,
15513,
9,
267,
2929,
63,
354,
275,
283,
33,
450,
83,
4719,
7,
450,
291,
855,
533,
4914,
354,
363,
267,
291,
14,
3756,
19,
8901,
791,
2918,
63,
354,
356,
2929,
63,
354,
93,
267,
543,
291,
14,
1855,
8,
14844,
304,
288,
291,
14,
3756,
19,
14,
3136,
63,
873,
8,
277,
14,
80,
15513,
9,
267,
291,
14,
479,
48,
15513,
8,
600,
29,
5188,
9,
339,
347,
511,
63,
1780,
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,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
jamii/inkling | jottinks/src/NoteTree2.py | 1 | 4804 | """
Copyright 2008 Jamie Brandon, Mark Haines
This file is part of jottinKs.
JottinKs 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.
JottinKs 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 jottinKs. If not, see <http://www.gnu.org/licenses/>.
"""
import sys
from Note import *
import Utils
from Writing import *
from PyKDE4.kdecore import *
from PyKDE4.kdeui import *
from PyQt4 import uic
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import cPickle
import pickle
class NoteTree(QTreeWidget):
def __init__(self, root=None):
QTreeWidget.__init__(self)
self.header().hide()
self.setColumnCount(1)
if root:
self.root = root
else:
self.root = NoteTreeRoot()
self.addTopLevelItem(self.root)
self.root.setTitle()
self.connect(self,SIGNAL("itemClicked (QTreeWidgetItem *,int)"),self.treeItemClicked)
self.actionList = None
self.selectedItem = self.root.next()
def treeItemClicked(self,item,column):
print "Got click", item.noteData.title
self.clearSelection()
self.selectedItem = item
item.setSelected(True)
self.scrollToItem(item)
self.showNote(item.noteData)
item.setTitle()
def showNote(self,noteData):
self.emit(SIGNAL("showNote(PyQt_PyObject)"),noteData)
def click(self,item):
print "Sent click", item.noteData.title
self.emit(SIGNAL("itemClicked (QTreeWidgetItem *,int)"),item,0)
# !!! Do I need this?
def addNote(self,note):
self.root.addChild(NoteTreeItem(note))
def newNote(self):
item = NoteTreeItem(Writing())
self.selectedItem.parent().insertChild(self.selectedItem.index()+1,item)
item.setTitle()
self.click(item)
print "added" , item, item.parent()
def newSubNote(self):
item = NoteTreeItem(Writing())
self.selectedItem.addChild(item)
item.setTitle()
self.click(item)
def deleteNote(self):
print "Will delete:", self.selectedItem
print "Parent is:" , self.selectedItem.parent()
deletee = self.selectedItem
self.click(deletee.previousItem())
deletee.remove()
def actions(self):
if not self.actionList:
newNote = KAction(KIcon("new"),i18n("New note"), self)
self.connect(newNote,SIGNAL("triggered()"),self.newNote)
newSubNote = KAction(KIcon("new"),i18n("New subnote"), self)
self.connect(newSubNote,SIGNAL("triggered()"),self.newSubNote)
deleteNote = KAction(KIcon("delete"),i18n("Delete note"), self)
self.connect(deleteNote,SIGNAL("triggered()"),self.deleteNote)
self.actionList = [newNote, newSubNote, deleteNote]
return self.actionList
def topLevelItems(self):
i = 0
length = self.root.childCount()
while i<length:
yield self.root.child(i)
i += 1
def __reduce__(self):
(NoteTree,(self.root,))
def __reduce_ex__(self,i):
return self.__reduce__()
class NoteTreeItem(QTreeWidgetItem):
def __init__(self, noteData=None, children = []):
QTreeWidgetItem.__init__(self)
self.noteData = noteData
for child in children:
self.addChild(child)
# Cant call this until the item has been added to the tree
def setTitle(self):
self.treeWidget().setItemWidget(self,0,QLabel("Bugger"))
for child in self.children():
child.setTitle()
def children(self):
children = []
for i in range(0,self.childCount()):
children.append(self.child(i))
return children
def index(self):
return self.parent().indexOfChild(self)
def previousItem(self):
i = self.index()
if i==0:
return self.parent()
else:
return self.parent().child(i-1)
def nextItem(self):
i = self.index()
if i+1 == self.parent().childCount():
return self.parent().nextItem()
else:
return self.parent().child(i+1)
def remove(self):
self.parent().removeChild(self)
def __reduce__(self):
return (NoteTreeItem,(self.noteData,self.children()))
class NoteTreeRoot(NoteTreeItem):
def __init__(self,children=[]):
NoteTreeItem.__init__(self,Writing(),children)
self.setText(0,"Root")
def parent(self):
return self
# This makes the new note function work.
# If we use index anywhere else it may cause some pain
def index(self):
return self.childCount() - 1
def previous(self):
return self
def next(self):
if self.childCount():
return self.child(0)
else:
return self
def remove(self):
pass
def __reduce__(self):
return (NoteTreeRoot,(self.children(),)) | gpl-3.0 | [
624,
199,
7384,
9079,
1603,
455,
1873,
699,
3759,
265,
12,
7173,
869,
1581,
397,
199,
199,
2765,
570,
365,
1777,
402,
1335,
357,
1346,
43,
83,
14,
339,
1603,
357,
1346,
43,
83,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
272,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
272,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
272,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
339,
1603,
357,
1346,
43,
83,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
272,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
272,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
272,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
339,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
272,
3180,
543,
1335,
357,
1346,
43,
83,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
646,
984,
199,
199,
504,
3390,
492,
627,
199,
646,
17397,
199,
504,
12859,
1337,
492,
627,
199,
199,
504,
1611,
43,
1093,
20,
14,
29461,
1018,
492,
627,
199,
504,
1611,
43,
1093,
20,
14,
29461,
1907,
492,
627,
199,
199,
504,
14084,
20,
492,
399,
530,
199,
504,
14084,
20,
14,
10604,
492,
627,
199,
504,
14084,
20,
14,
10901,
492,
627,
199,
199,
646,
17572,
199,
646,
5927,
421,
199,
533,
3390,
3987,
8,
49,
3987,
3339,
304,
199,
198,
318,
636,
826,
721,
277,
12,
1738,
29,
403,
304,
507,
198,
49,
3987,
3339,
855,
826,
721,
277,
9,
507,
198,
277,
14,
1291,
1252,
8191,
342,
507,
198,
277,
14,
409,
4547,
2353,
8,
17,
9,
9068,
198,
692,
1738,
26,
686,
198,
277,
14,
1231,
275,
1738,
507,
198,
2836,
26,
686,
198,
277,
14,
1231,
275,
3390,
3987,
6405,
342,
507,
198,
277,
14,
525,
6105,
4670,
2081,
8,
277,
14,
1231,
9,
507,
198,
277,
14,
1231,
14,
31675,
342,
1585,
507,
198,
277,
14,
2242,
8,
277,
12,
16496,
480,
1053,
31483,
334,
49,
3987,
29035,
9889,
442,
13185,
277,
14,
2350,
2081,
31483,
9,
1585,
507,
198,
277,
14,
1287,
1296,
275,
488,
507,
198,
277,
14,
5511,
2081,
275,
291,
14,
1231,
14,
2184,
342,
18118,
198,
318,
3123,
2081,
31483,
8,
277,
12,
1053,
12,
2301,
304,
507,
198,
1361,
298,
13662,
8968,
401,
1242,
14,
4610,
1451,
14,
1213,
507,
198,
277,
14,
3584,
7713,
342,
507,
198,
277,
14,
5511,
2081,
275,
1242,
507,
198,
1053,
14,
409,
12461,
8,
549,
9,
507,
198,
277,
14,
6755,
1378,
2081,
8,
1053,
9,
507,
198,
277,
14,
2384,
7443,
8,
1053,
14,
4610,
1451,
9,
507,
198,
1053,
14,
31675,
342,
18118,
198,
318,
2498,
7443,
8,
277,
12,
4610,
1451,
304,
507,
198,
277,
14,
8159,
8,
16496,
480,
2384,
7443,
8,
24107,
63,
19999,
13185,
4610,
1451,
9,
18118,
198,
318,
8968,
8,
277,
12,
1053,
304,
507,
198,
1361,
298,
17367,
8968,
401,
1242,
14,
4610,
1451,
14,
1213,
507,
198,
277,
14,
8159,
8,
16496,
480,
1053,
31483,
334,
49,
3987,
29035,
9889,
442,
13185,
1053,
12,
16,
9,
18118,
198,
3,
221,
21512,
4226,
473,
1929,
642,
31,
199,
198,
318,
1050,
7443,
8,
277,
12,
4610,
304,
507,
198,
277,
14,
1231,
14,
23897,
8,
7443,
3987,
2081,
8,
4610,
430,
18118,
198,
318,
892,
7443,
8,
277,
304,
507,
198,
1053,
275,
3390,
3987,
2081,
8,
16646,
1012,
507,
198,
277,
14,
5511,
2081,
14,
1708,
1252,
3176,
3493,
8,
277,
14,
5511,
2081,
14,
1080,
24543,
17,
12,
1053,
9,
507,
198,
1053,
14,
31675,
342,
507,
198,
277,
14,
4891,
8,
1053,
9,
507,
198,
1361,
298,
3270,
2,
2360,
1242,
12,
1242,
14,
1708,
342,
18118,
198,
318,
892,
2610,
7443,
8,
277,
304,
507,
198,
1053,
275,
3390,
3987,
2081,
8,
16646,
1012,
507,
198,
277,
14,
5511,
2081,
14,
23897,
8,
1053,
9,
507,
198,
1053,
14,
31675,
342,
507,
198,
277,
14,
4891,
8,
1053,
9,
18118,
198,
318,
3145,
7443,
8,
277,
304,
507,
198,
1361,
298,
20326,
3145,
6783,
291,
14,
5511,
2081,
507,
198,
1361,
298,
6652,
365,
5424,
2360,
291,
14,
5511,
2081,
14,
1708,
342,
507,
198,
1807,
69,
275,
291,
14,
5511,
2081,
507,
198,
277,
14,
4891,
8,
1807,
69,
14,
6352,
2081,
1012,
507,
198,
1807,
69,
14,
2168,
342,
18118,
198,
318,
5445,
8,
277,
304,
507,
198,
692,
440,
291,
14,
1287,
1296,
26,
686,
198,
1222,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1222,
1288,
73,
1085,
78,
480,
4665,
5317,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1222,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1222,
7443,
9,
26140,
198,
1222,
2610,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1222,
1288,
73,
1085,
78,
480,
4665,
1007,
4610,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1222,
2610,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1222,
2610,
7443,
9,
26140,
198,
1807,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1807,
1288,
73,
1085,
78,
480,
5392,
5317,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1807,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1807,
7443,
9,
26140,
198,
277,
14,
1287,
1296,
275,
359,
1222,
7443,
12,
892,
2610,
7443,
12,
3145,
7443,
61,
507,
198,
1107,
291,
14,
1287,
1296,
18118,
198,
318,
2746,
4670,
7412,
8,
277,
304,
507,
198,
73,
275,
378,
507,
198,
1267,
275,
291,
14,
1231,
14,
1739,
2353,
342,
507,
198,
6710,
284,
28,
1267,
26,
686,
198,
11481,
291,
14,
1231,
14,
1739,
8,
73,
9,
686,
198,
73,
847,
413,
1585,
199,
198,
318,
636,
5270,
721,
277,
304,
507,
198,
8,
7443,
3987,
12803,
277,
14,
1231,
4641,
18118,
198,
318,
636,
5270,
63,
476,
721,
277,
12,
73,
304,
507,
198,
1107,
291,
855,
5270,
4533,
686,
199,
533,
3390,
3987,
2081,
8,
49,
3987,
29035,
304,
199,
198,
318,
636,
826,
721,
277,
12,
5317,
1451,
29,
403
] | [
199,
7384,
9079,
1603,
455,
1873,
699,
3759,
265,
12,
7173,
869,
1581,
397,
199,
199,
2765,
570,
365,
1777,
402,
1335,
357,
1346,
43,
83,
14,
339,
1603,
357,
1346,
43,
83,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
272,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
272,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
272,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
339,
1603,
357,
1346,
43,
83,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
272,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
272,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
272,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
339,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
272,
3180,
543,
1335,
357,
1346,
43,
83,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
646,
984,
199,
199,
504,
3390,
492,
627,
199,
646,
17397,
199,
504,
12859,
1337,
492,
627,
199,
199,
504,
1611,
43,
1093,
20,
14,
29461,
1018,
492,
627,
199,
504,
1611,
43,
1093,
20,
14,
29461,
1907,
492,
627,
199,
199,
504,
14084,
20,
492,
399,
530,
199,
504,
14084,
20,
14,
10604,
492,
627,
199,
504,
14084,
20,
14,
10901,
492,
627,
199,
199,
646,
17572,
199,
646,
5927,
421,
199,
533,
3390,
3987,
8,
49,
3987,
3339,
304,
199,
198,
318,
636,
826,
721,
277,
12,
1738,
29,
403,
304,
507,
198,
49,
3987,
3339,
855,
826,
721,
277,
9,
507,
198,
277,
14,
1291,
1252,
8191,
342,
507,
198,
277,
14,
409,
4547,
2353,
8,
17,
9,
9068,
198,
692,
1738,
26,
686,
198,
277,
14,
1231,
275,
1738,
507,
198,
2836,
26,
686,
198,
277,
14,
1231,
275,
3390,
3987,
6405,
342,
507,
198,
277,
14,
525,
6105,
4670,
2081,
8,
277,
14,
1231,
9,
507,
198,
277,
14,
1231,
14,
31675,
342,
1585,
507,
198,
277,
14,
2242,
8,
277,
12,
16496,
480,
1053,
31483,
334,
49,
3987,
29035,
9889,
442,
13185,
277,
14,
2350,
2081,
31483,
9,
1585,
507,
198,
277,
14,
1287,
1296,
275,
488,
507,
198,
277,
14,
5511,
2081,
275,
291,
14,
1231,
14,
2184,
342,
18118,
198,
318,
3123,
2081,
31483,
8,
277,
12,
1053,
12,
2301,
304,
507,
198,
1361,
298,
13662,
8968,
401,
1242,
14,
4610,
1451,
14,
1213,
507,
198,
277,
14,
3584,
7713,
342,
507,
198,
277,
14,
5511,
2081,
275,
1242,
507,
198,
1053,
14,
409,
12461,
8,
549,
9,
507,
198,
277,
14,
6755,
1378,
2081,
8,
1053,
9,
507,
198,
277,
14,
2384,
7443,
8,
1053,
14,
4610,
1451,
9,
507,
198,
1053,
14,
31675,
342,
18118,
198,
318,
2498,
7443,
8,
277,
12,
4610,
1451,
304,
507,
198,
277,
14,
8159,
8,
16496,
480,
2384,
7443,
8,
24107,
63,
19999,
13185,
4610,
1451,
9,
18118,
198,
318,
8968,
8,
277,
12,
1053,
304,
507,
198,
1361,
298,
17367,
8968,
401,
1242,
14,
4610,
1451,
14,
1213,
507,
198,
277,
14,
8159,
8,
16496,
480,
1053,
31483,
334,
49,
3987,
29035,
9889,
442,
13185,
1053,
12,
16,
9,
18118,
198,
3,
221,
21512,
4226,
473,
1929,
642,
31,
199,
198,
318,
1050,
7443,
8,
277,
12,
4610,
304,
507,
198,
277,
14,
1231,
14,
23897,
8,
7443,
3987,
2081,
8,
4610,
430,
18118,
198,
318,
892,
7443,
8,
277,
304,
507,
198,
1053,
275,
3390,
3987,
2081,
8,
16646,
1012,
507,
198,
277,
14,
5511,
2081,
14,
1708,
1252,
3176,
3493,
8,
277,
14,
5511,
2081,
14,
1080,
24543,
17,
12,
1053,
9,
507,
198,
1053,
14,
31675,
342,
507,
198,
277,
14,
4891,
8,
1053,
9,
507,
198,
1361,
298,
3270,
2,
2360,
1242,
12,
1242,
14,
1708,
342,
18118,
198,
318,
892,
2610,
7443,
8,
277,
304,
507,
198,
1053,
275,
3390,
3987,
2081,
8,
16646,
1012,
507,
198,
277,
14,
5511,
2081,
14,
23897,
8,
1053,
9,
507,
198,
1053,
14,
31675,
342,
507,
198,
277,
14,
4891,
8,
1053,
9,
18118,
198,
318,
3145,
7443,
8,
277,
304,
507,
198,
1361,
298,
20326,
3145,
6783,
291,
14,
5511,
2081,
507,
198,
1361,
298,
6652,
365,
5424,
2360,
291,
14,
5511,
2081,
14,
1708,
342,
507,
198,
1807,
69,
275,
291,
14,
5511,
2081,
507,
198,
277,
14,
4891,
8,
1807,
69,
14,
6352,
2081,
1012,
507,
198,
1807,
69,
14,
2168,
342,
18118,
198,
318,
5445,
8,
277,
304,
507,
198,
692,
440,
291,
14,
1287,
1296,
26,
686,
198,
1222,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1222,
1288,
73,
1085,
78,
480,
4665,
5317,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1222,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1222,
7443,
9,
26140,
198,
1222,
2610,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1222,
1288,
73,
1085,
78,
480,
4665,
1007,
4610,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1222,
2610,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1222,
2610,
7443,
9,
26140,
198,
1807,
7443,
275,
1804,
3310,
8,
43,
8954,
480,
1807,
1288,
73,
1085,
78,
480,
5392,
5317,
1288,
291,
9,
686,
198,
277,
14,
2242,
8,
1807,
7443,
12,
16496,
480,
21142,
26322,
277,
14,
1807,
7443,
9,
26140,
198,
277,
14,
1287,
1296,
275,
359,
1222,
7443,
12,
892,
2610,
7443,
12,
3145,
7443,
61,
507,
198,
1107,
291,
14,
1287,
1296,
18118,
198,
318,
2746,
4670,
7412,
8,
277,
304,
507,
198,
73,
275,
378,
507,
198,
1267,
275,
291,
14,
1231,
14,
1739,
2353,
342,
507,
198,
6710,
284,
28,
1267,
26,
686,
198,
11481,
291,
14,
1231,
14,
1739,
8,
73,
9,
686,
198,
73,
847,
413,
1585,
199,
198,
318,
636,
5270,
721,
277,
304,
507,
198,
8,
7443,
3987,
12803,
277,
14,
1231,
4641,
18118,
198,
318,
636,
5270,
63,
476,
721,
277,
12,
73,
304,
507,
198,
1107,
291,
855,
5270,
4533,
686,
199,
533,
3390,
3987,
2081,
8,
49,
3987,
29035,
304,
199,
198,
318,
636,
826,
721,
277,
12,
5317,
1451,
29,
403,
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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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
] |
ovnicraft/edx-platform | lms/djangoapps/instructor_task/models.py | 24 | 16357 | """
WE'RE USING MIGRATIONS!
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py schemamigration instructor_task --auto description_of_your_change
3. Add the migration file created in edx-platform/lms/djangoapps/instructor_task/migrations/
ASSUMPTIONS: modules have unique IDs, even across different module_types
"""
from cStringIO import StringIO
from gzip import GzipFile
from uuid import uuid4
import csv
import json
import hashlib
import os.path
import urllib
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models, transaction
from xmodule_django.models import CourseKeyField
# define custom states used by InstructorTask
QUEUING = 'QUEUING'
PROGRESS = 'PROGRESS'
class InstructorTask(models.Model):
"""
Stores information about background tasks that have been submitted to
perform work by an instructor (or course staff).
Examples include grading and rescoring.
`task_type` identifies the kind of task being performed, e.g. rescoring.
`course_id` uses the course run's unique id to identify the course.
`task_key` stores relevant input arguments encoded into key value for testing to see
if the task is already running (together with task_type and course_id).
`task_input` stores input arguments as JSON-serialized dict, for reporting purposes.
Examples include url of problem being rescored, id of student if only one student being rescored.
`task_id` stores the id used by celery for the background task.
`task_state` stores the last known state of the celery task
`task_output` stores the output of the celery task.
Format is a JSON-serialized dict. Content varies by task_type and task_state.
`requester` stores id of user who submitted the task
`created` stores date that entry was first created
`updated` stores date that entry was last modified
"""
task_type = models.CharField(max_length=50, db_index=True)
course_id = CourseKeyField(max_length=255, db_index=True)
task_key = models.CharField(max_length=255, db_index=True)
task_input = models.CharField(max_length=255)
task_id = models.CharField(max_length=255, db_index=True) # max_length from celery_taskmeta
task_state = models.CharField(max_length=50, null=True, db_index=True) # max_length from celery_taskmeta
task_output = models.CharField(max_length=1024, null=True)
requester = models.ForeignKey(User, db_index=True)
created = models.DateTimeField(auto_now_add=True, null=True)
updated = models.DateTimeField(auto_now=True)
subtasks = models.TextField(blank=True) # JSON dictionary
def __repr__(self):
return 'InstructorTask<%r>' % ({
'task_type': self.task_type,
'course_id': self.course_id,
'task_input': self.task_input,
'task_id': self.task_id,
'task_state': self.task_state,
'task_output': self.task_output,
},)
def __unicode__(self):
return unicode(repr(self))
@classmethod
def create(cls, course_id, task_type, task_key, task_input, requester):
"""
Create an instance of InstructorTask.
"""
# create the task_id here, and pass it into celery:
task_id = str(uuid4())
json_task_input = json.dumps(task_input)
# check length of task_input, and return an exception if it's too long:
if len(json_task_input) > 255:
fmt = 'Task input longer than 255: "{input}" for "{task}" of "{course}"'
msg = fmt.format(input=json_task_input, task=task_type, course=course_id)
raise ValueError(msg)
# create the task, then save it:
instructor_task = cls(
course_id=course_id,
task_type=task_type,
task_id=task_id,
task_key=task_key,
task_input=json_task_input,
task_state=QUEUING,
requester=requester
)
instructor_task.save_now()
return instructor_task
@transaction.atomic
def save_now(self):
"""
Writes InstructorTask immediately, ensuring the transaction is committed.
"""
self.save()
@staticmethod
def create_output_for_success(returned_result):
"""
Converts successful result to output format.
Raises a ValueError exception if the output is too long.
"""
# In future, there should be a check here that the resulting JSON
# will fit in the column. In the meantime, just return an exception.
json_output = json.dumps(returned_result)
if len(json_output) > 1023:
raise ValueError("Length of task output is too long: {0}".format(json_output))
return json_output
@staticmethod
def create_output_for_failure(exception, traceback_string):
"""
Converts failed result information to output format.
Traceback information is truncated or not included if it would result in an output string
that would not fit in the database. If the output is still too long, then the
exception message is also truncated.
Truncation is indicated by adding "..." to the end of the value.
"""
tag = '...'
task_progress = {'exception': type(exception).__name__, 'message': unicode(exception.message)}
if traceback_string is not None:
# truncate any traceback that goes into the InstructorTask model:
task_progress['traceback'] = traceback_string
json_output = json.dumps(task_progress)
# if the resulting output is too long, then first shorten the
# traceback, and then the message, until it fits.
too_long = len(json_output) - 1023
if too_long > 0:
if traceback_string is not None:
if too_long >= len(traceback_string) - len(tag):
# remove the traceback entry entirely (so no key or value)
del task_progress['traceback']
too_long -= (len(traceback_string) + len('traceback'))
else:
# truncate the traceback:
task_progress['traceback'] = traceback_string[:-(too_long + len(tag))] + tag
too_long = 0
if too_long > 0:
# we need to shorten the message:
task_progress['message'] = task_progress['message'][:-(too_long + len(tag))] + tag
json_output = json.dumps(task_progress)
return json_output
@staticmethod
def create_output_for_revoked():
"""Creates standard message to store in output format for revoked tasks."""
return json.dumps({'message': 'Task revoked before running'})
class ReportStore(object):
"""
Simple abstraction layer that can fetch and store CSV files for reports
download. Should probably refactor later to create a ReportFile object that
can simply be appended to for the sake of memory efficiency, rather than
passing in the whole dataset. Doing that for now just because it's simpler.
"""
@classmethod
def from_config(cls, config_name):
"""
Return one of the ReportStore subclasses depending on django
configuration. Look at subclasses for expected configuration.
"""
storage_type = getattr(settings, config_name).get("STORAGE_TYPE")
if storage_type.lower() == "s3":
return S3ReportStore.from_config(config_name)
elif storage_type.lower() == "localfs":
return LocalFSReportStore.from_config(config_name)
def _get_utf8_encoded_rows(self, rows):
"""
Given a list of `rows` containing unicode strings, return a
new list of rows with those strings encoded as utf-8 for CSV
compatibility.
"""
for row in rows:
yield [unicode(item).encode('utf-8') for item in row]
class S3ReportStore(ReportStore):
"""
Reports store backed by S3. The directory structure we use to store things
is::
`{bucket}/{root_path}/{sha1 hash of course_id}/filename`
We might later use subdirectories or metadata to do more intelligent
grouping and querying, but right now it simply depends on its own
conventions on where files are stored to know what to display. Clients using
this class can name the final file whatever they want.
"""
def __init__(self, bucket_name, root_path):
self.root_path = root_path
conn = S3Connection(
settings.AWS_ACCESS_KEY_ID,
settings.AWS_SECRET_ACCESS_KEY
)
self.bucket = conn.get_bucket(bucket_name)
@classmethod
def from_config(cls, config_name):
"""
The expected configuration for an `S3ReportStore` is to have a
`GRADES_DOWNLOAD` dict in settings with the following fields::
STORAGE_TYPE : "s3"
BUCKET : Your bucket name, e.g. "reports-bucket"
ROOT_PATH : The path you want to store all course files under. Do not
use a leading or trailing slash. e.g. "staging" or
"staging/2013", not "/staging", or "/staging/"
Since S3 access relies on boto, you must also define `AWS_ACCESS_KEY_ID`
and `AWS_SECRET_ACCESS_KEY` in settings.
"""
return cls(
getattr(settings, config_name).get("BUCKET"),
getattr(settings, config_name).get("ROOT_PATH")
)
def key_for(self, course_id, filename):
"""Return the S3 key we would use to store and retrieve the data for the
given filename."""
hashed_course_id = hashlib.sha1(course_id.to_deprecated_string())
key = Key(self.bucket)
key.key = "{}/{}/{}".format(
self.root_path,
hashed_course_id.hexdigest(),
filename
)
return key
def store(self, course_id, filename, buff, config=None):
"""
Store the contents of `buff` in a directory determined by hashing
`course_id`, and name the file `filename`. `buff` is typically a
`StringIO`, but can be anything that implements `.getvalue()`.
This method assumes that the contents of `buff` are gzip-encoded (it
will add the appropriate headers to S3 to make the decompression
transparent via the browser). Filenames should end in whatever
suffix makes sense for the original file, so `.txt` instead of `.gz`
"""
key = self.key_for(course_id, filename)
_config = config if config else {}
content_type = _config.get('content_type', 'text/csv')
content_encoding = _config.get('content_encoding', 'gzip')
data = buff.getvalue()
key.size = len(data)
key.content_encoding = content_encoding
key.content_type = content_type
# Just setting the content encoding and type above should work
# according to the docs, but when experimenting, this was necessary for
# it to actually take.
key.set_contents_from_string(
data,
headers={
"Content-Encoding": content_encoding,
"Content-Length": len(data),
"Content-Type": content_type,
}
)
def store_rows(self, course_id, filename, rows):
"""
Given a `course_id`, `filename`, and `rows` (each row is an iterable of
strings), create a buffer that is a gzip'd csv file, and then `store()`
that buffer.
Even though we store it in gzip format, browsers will transparently
download and decompress it. Filenames should end in `.csv`, not `.gz`.
"""
output_buffer = StringIO()
gzip_file = GzipFile(fileobj=output_buffer, mode="wb")
csvwriter = csv.writer(gzip_file)
csvwriter.writerows(self._get_utf8_encoded_rows(rows))
gzip_file.close()
self.store(course_id, filename, output_buffer)
def links_for(self, course_id):
"""
For a given `course_id`, return a list of `(filename, url)` tuples. `url`
can be plugged straight into an href
"""
course_dir = self.key_for(course_id, '')
return [
(key.key.split("/")[-1], key.generate_url(expires_in=300))
for key in sorted(self.bucket.list(prefix=course_dir.key), reverse=True, key=lambda k: k.last_modified)
]
class LocalFSReportStore(ReportStore):
"""
LocalFS implementation of a ReportStore. This is meant for debugging
purposes and is *absolutely not for production use*. Use S3ReportStore for
that. We use this in tests and for local development. When it generates
links, it will make file:/// style links. That means you actually have to
copy them and open them in a separate browser window, for security reasons.
This lets us do the cheap thing locally for debugging without having to open
up a separate URL that would only be used to send files in dev.
"""
def __init__(self, root_path):
"""
Initialize with root_path where we're going to store our files. We
will build a directory structure under this for each course.
"""
self.root_path = root_path
if not os.path.exists(root_path):
os.makedirs(root_path)
@classmethod
def from_config(cls, config_name):
"""
Generate an instance of this object from Django settings. It assumes
that there is a dict in settings named GRADES_DOWNLOAD and that it has
a ROOT_PATH that maps to an absolute file path that the web app has
write permissions to. `LocalFSReportStore` will create any intermediate
directories as needed. Example::
STORAGE_TYPE : "localfs"
ROOT_PATH : /tmp/edx/report-downloads/
"""
return cls(getattr(settings, config_name).get("ROOT_PATH"))
def path_to(self, course_id, filename):
"""Return the full path to a given file for a given course."""
return os.path.join(self.root_path, urllib.quote(course_id.to_deprecated_string(), safe=''), filename)
def store(self, course_id, filename, buff, config=None): # pylint: disable=unused-argument
"""
Given the `course_id` and `filename`, store the contents of `buff` in
that file. Overwrite anything that was there previously. `buff` is
assumed to be a StringIO objecd (or anything that can flush its contents
to string using `.getvalue()`).
"""
full_path = self.path_to(course_id, filename)
directory = os.path.dirname(full_path)
if not os.path.exists(directory):
os.mkdir(directory)
with open(full_path, "wb") as f:
f.write(buff.getvalue())
def store_rows(self, course_id, filename, rows):
"""
Given a course_id, filename, and rows (each row is an iterable of strings),
write this data out.
"""
output_buffer = StringIO()
csvwriter = csv.writer(output_buffer)
csvwriter.writerows(self._get_utf8_encoded_rows(rows))
self.store(course_id, filename, output_buffer)
def links_for(self, course_id):
"""
For a given `course_id`, return a list of `(filename, url)` tuples. `url`
can be plugged straight into an href. Note that `LocalFSReportStore`
will generate `file://` type URLs, so you'll need to copy the URL and
open it in a new browser window. Again, this class is only meant for
local development.
"""
course_dir = self.path_to(course_id, '')
if not os.path.exists(course_dir):
return []
files = [(filename, os.path.join(course_dir, filename)) for filename in os.listdir(course_dir)]
files.sort(key=lambda (filename, full_path): os.path.getmtime(full_path), reverse=True)
return [
(filename, ("file://" + urllib.quote(full_path)))
for filename, full_path in files
]
| agpl-3.0 | [
624,
199,
5408,
7,
907,
32210,
603,
1277,
50,
12969,
1,
199,
199,
3917,
1265,
1852,
4493,
370,
642,
1402,
12,
506,
3238,
370,
1218,
376,
5827,
8367,
199,
493,
436,
1104,
652,
315,
737,
314,
2011,
900,
465,
2195,
1402,
4493,
14,
4005,
886,
626,
12,
199,
199,
17,
14,
3971,
370,
314,
22435,
13,
3246,
2935,
199,
18,
14,
16605,
9053,
14,
647,
4177,
8998,
17724,
63,
1765,
1553,
2495,
1369,
63,
1618,
63,
12695,
63,
1461,
199,
19,
14,
2654,
314,
8367,
570,
2737,
315,
22435,
13,
3246,
15,
15807,
15,
16432,
15,
14891,
63,
1765,
15,
7685,
15,
421,
199,
3755,
22759,
52,
2823,
26,
4621,
1172,
3747,
11449,
12,
2755,
9371,
3365,
859,
63,
1313,
199,
199,
624,
199,
504,
15073,
492,
5228,
199,
504,
11756,
492,
598,
3065,
1173,
199,
504,
5377,
492,
5377,
20,
199,
646,
7392,
199,
646,
2022,
199,
646,
8337,
199,
646,
747,
14,
515,
199,
646,
4011,
199,
199,
504,
6055,
14,
83,
19,
14,
2105,
492,
428,
19,
3225,
199,
504,
6055,
14,
83,
19,
14,
498,
492,
2606,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
2828,
14,
1178,
14,
992,
492,
2876,
199,
504,
1639,
14,
697,
492,
1709,
12,
6008,
199,
199,
504,
9872,
63,
1176,
14,
992,
492,
22574,
792,
421,
199,
3,
5627,
3537,
6363,
1202,
701,
31606,
199,
10526,
53,
1206,
275,
283,
10526,
53,
1206,
7,
199,
24547,
275,
283,
24547,
7,
421,
199,
533,
31606,
8,
992,
14,
1685,
304,
272,
408,
272,
31299,
2556,
3595,
8020,
6527,
626,
1172,
2757,
16930,
370,
272,
5147,
1736,
701,
376,
17724,
334,
269,
2518,
12622,
680,
272,
6058,
2387,
22815,
436,
522,
20624,
14,
339,
658,
1765,
63,
466,
64,
22975,
314,
4928,
402,
2120,
3769,
10585,
12,
325,
14,
71,
14,
522,
20624,
14,
272,
658,
1972,
63,
344,
64,
4440,
314,
2518,
1255,
1159,
3747,
1305,
370,
10405,
314,
2518,
14,
272,
658,
1765,
63,
498,
64,
14086,
12082,
1324,
2368,
5737,
1901,
790,
574,
367,
5343,
370,
1937,
1779,
340,
314,
2120,
365,
2575,
3879,
334,
6314,
543,
2120,
63,
466,
436,
2518,
63,
344,
680,
272,
658,
1765,
63,
1210,
64,
14086,
1324,
2368,
465,
4840,
13,
8397,
1211,
12,
367,
17290,
12901,
14,
267,
6058,
2387,
1166,
402,
5160,
3769,
522,
331,
581,
12,
1305,
402,
6474,
340,
1454,
1373,
6474,
3769,
522,
331,
581,
14,
339,
658,
1765,
63,
344,
64,
14086,
314,
1305,
1202,
701,
22748,
367,
314,
8020,
2120,
14,
272,
658,
1765,
63,
929,
64,
14086,
314,
2061,
6040,
1174,
402,
314,
22748,
2120,
272,
658,
1765,
63,
1199,
64,
14086,
314,
1072,
402,
314,
22748,
2120,
14,
267,
9701,
365,
282,
4840,
13,
8397,
1211,
14,
221,
6646,
373,
3433,
701,
2120,
63,
466,
436,
2120,
63,
929,
14,
339,
658,
24199,
64,
14086,
1305,
402,
922,
3963,
16930,
314,
2120,
272,
658,
3966,
64,
14086,
1434,
626,
2397,
1990,
1642,
2737,
272,
658,
5334,
64,
14086,
1434,
626,
2397,
1990,
2061,
6042,
272,
408,
272,
2120,
63,
466,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
1400,
12,
1592,
63,
1080,
29,
549,
9,
272,
2518,
63,
344,
275,
22574,
792,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
272,
2120,
63,
498,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
272,
2120,
63,
1210,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
9,
272,
2120,
63,
344,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
221,
327,
1390,
63,
1267,
687,
22748,
63,
1765,
2024,
272,
2120,
63,
929,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
1400,
12,
2973,
29,
549,
12,
1592,
63,
1080,
29,
549,
9,
221,
327,
1390,
63,
1267,
687,
22748,
63,
1765,
2024,
272,
2120,
63,
1199,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
7727,
12,
2973,
29,
549,
9,
272,
295,
18246,
275,
1709,
14,
3190,
8,
1899,
12,
1592,
63,
1080,
29,
549,
9,
272,
2737,
275,
1709,
14,
4626,
8,
2495,
63,
2131,
63,
525,
29,
549,
12,
2973,
29,
549,
9,
272,
4588,
275,
1709,
14,
4626,
8,
2495,
63,
2131,
29,
549,
9,
272,
1007,
5054,
275,
1709,
14,
6254,
8,
2500,
29,
549,
9,
221,
327,
4840,
2600,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
283,
30742,
4476,
21110,
82,
3524,
450,
11459,
288,
283,
1765,
63,
466,
356,
291,
14,
1765,
63,
466,
12,
288,
283,
1972,
63,
344,
356,
291,
14,
1972,
63,
344,
12,
288,
283,
1765,
63,
1210,
356,
291,
14,
1765,
63,
1210,
12,
288,
283,
1765,
63,
344,
356,
291,
14,
1765,
63,
344,
12,
288,
283,
1765,
63,
929,
356,
291,
14,
1765,
63,
929,
12,
288,
283,
1765,
63,
1199,
356,
291,
14,
1765,
63,
1199,
12,
267,
1660,
9,
339,
347,
636,
2975,
721,
277,
304,
267,
372,
2649,
8,
2722,
8,
277,
430,
339,
768,
3744,
272,
347,
1218,
8,
1886,
12,
2518,
63,
344,
12,
2120,
63,
466,
12,
2120,
63,
498,
12,
2120,
63,
1210,
12,
295,
18246,
304,
267,
408,
267,
2790,
376,
1256,
402,
31606,
14,
267,
408,
267,
327,
1218,
314,
2120,
63,
344,
2348,
12,
436,
986,
652,
1901,
22748,
26,
267,
2120,
63,
344,
275,
620,
8,
2580,
20,
1012,
398,
2022,
63,
1765,
63,
1210,
275,
2022,
14,
4180,
8,
1765,
63,
1210,
9,
398,
327,
1104,
2582,
402,
2120,
63,
1210,
12,
436,
372,
376,
1919,
340,
652,
1159,
4634,
1846,
26,
267,
340,
822,
8,
1001,
63,
1765,
63,
1210,
9,
690,
5450,
26,
288,
7104,
275,
283,
4476,
1324,
8088,
2419,
5450,
26,
5310,
1210,
7063,
367,
5310,
1765,
7063,
402,
5310,
1972,
93,
4507,
288,
1499,
275,
7104,
14,
908,
8,
1210,
29,
1001,
63,
1765,
63,
1210,
12,
2120,
29,
1765,
63,
466,
12,
2518,
29,
1972,
63,
344,
9,
288,
746,
1722,
8,
1328,
9,
398,
327,
1218,
314,
2120,
12,
2066,
3354,
652,
26,
267,
17724,
63,
1765,
275,
843,
8,
288
] | [
199,
5408,
7,
907,
32210,
603,
1277,
50,
12969,
1,
199,
199,
3917,
1265,
1852,
4493,
370,
642,
1402,
12,
506,
3238,
370,
1218,
376,
5827,
8367,
199,
493,
436,
1104,
652,
315,
737,
314,
2011,
900,
465,
2195,
1402,
4493,
14,
4005,
886,
626,
12,
199,
199,
17,
14,
3971,
370,
314,
22435,
13,
3246,
2935,
199,
18,
14,
16605,
9053,
14,
647,
4177,
8998,
17724,
63,
1765,
1553,
2495,
1369,
63,
1618,
63,
12695,
63,
1461,
199,
19,
14,
2654,
314,
8367,
570,
2737,
315,
22435,
13,
3246,
15,
15807,
15,
16432,
15,
14891,
63,
1765,
15,
7685,
15,
421,
199,
3755,
22759,
52,
2823,
26,
4621,
1172,
3747,
11449,
12,
2755,
9371,
3365,
859,
63,
1313,
199,
199,
624,
199,
504,
15073,
492,
5228,
199,
504,
11756,
492,
598,
3065,
1173,
199,
504,
5377,
492,
5377,
20,
199,
646,
7392,
199,
646,
2022,
199,
646,
8337,
199,
646,
747,
14,
515,
199,
646,
4011,
199,
199,
504,
6055,
14,
83,
19,
14,
2105,
492,
428,
19,
3225,
199,
504,
6055,
14,
83,
19,
14,
498,
492,
2606,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
2828,
14,
1178,
14,
992,
492,
2876,
199,
504,
1639,
14,
697,
492,
1709,
12,
6008,
199,
199,
504,
9872,
63,
1176,
14,
992,
492,
22574,
792,
421,
199,
3,
5627,
3537,
6363,
1202,
701,
31606,
199,
10526,
53,
1206,
275,
283,
10526,
53,
1206,
7,
199,
24547,
275,
283,
24547,
7,
421,
199,
533,
31606,
8,
992,
14,
1685,
304,
272,
408,
272,
31299,
2556,
3595,
8020,
6527,
626,
1172,
2757,
16930,
370,
272,
5147,
1736,
701,
376,
17724,
334,
269,
2518,
12622,
680,
272,
6058,
2387,
22815,
436,
522,
20624,
14,
339,
658,
1765,
63,
466,
64,
22975,
314,
4928,
402,
2120,
3769,
10585,
12,
325,
14,
71,
14,
522,
20624,
14,
272,
658,
1972,
63,
344,
64,
4440,
314,
2518,
1255,
1159,
3747,
1305,
370,
10405,
314,
2518,
14,
272,
658,
1765,
63,
498,
64,
14086,
12082,
1324,
2368,
5737,
1901,
790,
574,
367,
5343,
370,
1937,
1779,
340,
314,
2120,
365,
2575,
3879,
334,
6314,
543,
2120,
63,
466,
436,
2518,
63,
344,
680,
272,
658,
1765,
63,
1210,
64,
14086,
1324,
2368,
465,
4840,
13,
8397,
1211,
12,
367,
17290,
12901,
14,
267,
6058,
2387,
1166,
402,
5160,
3769,
522,
331,
581,
12,
1305,
402,
6474,
340,
1454,
1373,
6474,
3769,
522,
331,
581,
14,
339,
658,
1765,
63,
344,
64,
14086,
314,
1305,
1202,
701,
22748,
367,
314,
8020,
2120,
14,
272,
658,
1765,
63,
929,
64,
14086,
314,
2061,
6040,
1174,
402,
314,
22748,
2120,
272,
658,
1765,
63,
1199,
64,
14086,
314,
1072,
402,
314,
22748,
2120,
14,
267,
9701,
365,
282,
4840,
13,
8397,
1211,
14,
221,
6646,
373,
3433,
701,
2120,
63,
466,
436,
2120,
63,
929,
14,
339,
658,
24199,
64,
14086,
1305,
402,
922,
3963,
16930,
314,
2120,
272,
658,
3966,
64,
14086,
1434,
626,
2397,
1990,
1642,
2737,
272,
658,
5334,
64,
14086,
1434,
626,
2397,
1990,
2061,
6042,
272,
408,
272,
2120,
63,
466,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
1400,
12,
1592,
63,
1080,
29,
549,
9,
272,
2518,
63,
344,
275,
22574,
792,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
272,
2120,
63,
498,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
272,
2120,
63,
1210,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
9,
272,
2120,
63,
344,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
2299,
12,
1592,
63,
1080,
29,
549,
9,
221,
327,
1390,
63,
1267,
687,
22748,
63,
1765,
2024,
272,
2120,
63,
929,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
1400,
12,
2973,
29,
549,
12,
1592,
63,
1080,
29,
549,
9,
221,
327,
1390,
63,
1267,
687,
22748,
63,
1765,
2024,
272,
2120,
63,
1199,
275,
1709,
14,
2183,
8,
988,
63,
1267,
29,
7727,
12,
2973,
29,
549,
9,
272,
295,
18246,
275,
1709,
14,
3190,
8,
1899,
12,
1592,
63,
1080,
29,
549,
9,
272,
2737,
275,
1709,
14,
4626,
8,
2495,
63,
2131,
63,
525,
29,
549,
12,
2973,
29,
549,
9,
272,
4588,
275,
1709,
14,
4626,
8,
2495,
63,
2131,
29,
549,
9,
272,
1007,
5054,
275,
1709,
14,
6254,
8,
2500,
29,
549,
9,
221,
327,
4840,
2600,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
283,
30742,
4476,
21110,
82,
3524,
450,
11459,
288,
283,
1765,
63,
466,
356,
291,
14,
1765,
63,
466,
12,
288,
283,
1972,
63,
344,
356,
291,
14,
1972,
63,
344,
12,
288,
283,
1765,
63,
1210,
356,
291,
14,
1765,
63,
1210,
12,
288,
283,
1765,
63,
344,
356,
291,
14,
1765,
63,
344,
12,
288,
283,
1765,
63,
929,
356,
291,
14,
1765,
63,
929,
12,
288,
283,
1765,
63,
1199,
356,
291,
14,
1765,
63,
1199,
12,
267,
1660,
9,
339,
347,
636,
2975,
721,
277,
304,
267,
372,
2649,
8,
2722,
8,
277,
430,
339,
768,
3744,
272,
347,
1218,
8,
1886,
12,
2518,
63,
344,
12,
2120,
63,
466,
12,
2120,
63,
498,
12,
2120,
63,
1210,
12,
295,
18246,
304,
267,
408,
267,
2790,
376,
1256,
402,
31606,
14,
267,
408,
267,
327,
1218,
314,
2120,
63,
344,
2348,
12,
436,
986,
652,
1901,
22748,
26,
267,
2120,
63,
344,
275,
620,
8,
2580,
20,
1012,
398,
2022,
63,
1765,
63,
1210,
275,
2022,
14,
4180,
8,
1765,
63,
1210,
9,
398,
327,
1104,
2582,
402,
2120,
63,
1210,
12,
436,
372,
376,
1919,
340,
652,
1159,
4634,
1846,
26,
267,
340,
822,
8,
1001,
63,
1765,
63,
1210,
9,
690,
5450,
26,
288,
7104,
275,
283,
4476,
1324,
8088,
2419,
5450,
26,
5310,
1210,
7063,
367,
5310,
1765,
7063,
402,
5310,
1972,
93,
4507,
288,
1499,
275,
7104,
14,
908,
8,
1210,
29,
1001,
63,
1765,
63,
1210,
12,
2120,
29,
1765,
63,
466,
12,
2518,
29,
1972,
63,
344,
9,
288,
746,
1722,
8,
1328,
9,
398,
327,
1218,
314,
2120,
12,
2066,
3354,
652,
26,
267,
17724,
63,
1765,
275,
843,
8,
288,
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,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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
] |
LuminateWireless/grpc | src/python/grpcio_tests/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py | 23 | 25112 | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Test code for the Face layer of RPC Framework."""
from __future__ import division
import abc
import contextlib
import itertools
import threading
import unittest
from concurrent import futures
import six
# test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import future
from grpc.framework.foundation import logging_pool
from grpc.framework.interfaces.face import face
from tests.unit.framework.common import test_constants
from tests.unit.framework.common import test_control
from tests.unit.framework.common import test_coverage
from tests.unit.framework.interfaces.face import _3069_test_constant
from tests.unit.framework.interfaces.face import _digest
from tests.unit.framework.interfaces.face import _stock_service
from tests.unit.framework.interfaces.face import test_interfaces # pylint: disable=unused-import
class _PauseableIterator(object):
def __init__(self, upstream):
self._upstream = upstream
self._condition = threading.Condition()
self._paused = False
@contextlib.contextmanager
def pause(self):
with self._condition:
self._paused = True
yield
with self._condition:
self._paused = False
self._condition.notify_all()
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while self._paused:
self._condition.wait()
return next(self._upstream)
class _Callback(object):
def __init__(self):
self._condition = threading.Condition()
self._called = False
self._passed_future = None
self._passed_other_stuff = None
def __call__(self, *args, **kwargs):
with self._condition:
self._called = True
if args:
self._passed_future = args[0]
if 1 < len(args) or kwargs:
self._passed_other_stuff = tuple(args[1:]), dict(kwargs)
self._condition.notify_all()
def future(self):
with self._condition:
while True:
if self._passed_other_stuff is not None:
raise ValueError(
'Test callback passed unexpected values: %s',
self._passed_other_stuff)
elif self._called:
return self._passed_future
else:
self._condition.wait()
class TestCase(
six.with_metaclass(abc.ABCMeta, test_coverage.Coverage,
unittest.TestCase)):
"""A test of the Face layer of RPC Framework.
Concrete subclasses must have an "implementation" attribute of type
test_interfaces.Implementation and an "invoker_constructor" attribute of type
_invocation.InvokerConstructor.
"""
NAME = 'FutureInvocationAsynchronousEventServiceTest'
def setUp(self):
"""See unittest.TestCase.setUp for full specification.
Overriding implementations must call this implementation.
"""
self._control = test_control.PauseFailControl()
self._digest_pool = logging_pool.pool(test_constants.POOL_SIZE)
self._digest = _digest.digest(_stock_service.STOCK_TEST_SERVICE,
self._control, self._digest_pool)
generic_stub, dynamic_stubs, self._memo = self.implementation.instantiate(
self._digest.methods, self._digest.event_method_implementations,
None)
self._invoker = self.invoker_constructor.construct_invoker(
generic_stub, dynamic_stubs, self._digest.methods)
def tearDown(self):
"""See unittest.TestCase.tearDown for full specification.
Overriding implementations must call this implementation.
"""
self._invoker = None
self.implementation.destantiate(self._memo)
self._digest_pool.shutdown(wait=True)
def testSuccessfulUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
response_future = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
response_future.add_done_callback(callback)
response = response_future.result()
test_messages.verify(request, response, self)
self.assertIs(callback.future(), response_future)
self.assertIsNone(response_future.exception())
self.assertIsNone(response_future.traceback())
def testSuccessfulUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
response_iterator = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
responses = list(response_iterator)
test_messages.verify(request, responses, self)
def testSuccessfulStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
callback = _Callback()
# Use of a paused iterator of requests allows us to test that control is
# returned to calling code before the iterator yields any requests.
with request_iterator.pause():
response_future = self._invoker.future(group, method)(
request_iterator, test_constants.LONG_TIMEOUT)
response_future.add_done_callback(callback)
future_passed_to_callback = callback.future()
response = future_passed_to_callback.result()
test_messages.verify(requests, response, self)
self.assertIs(future_passed_to_callback, response_future)
self.assertIsNone(response_future.exception())
self.assertIsNone(response_future.traceback())
def testSuccessfulStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
# Use of a paused iterator of requests allows us to test that control is
# returned to calling code before the iterator yields any requests.
with request_iterator.pause():
response_iterator = self._invoker.future(group, method)(
request_iterator, test_constants.LONG_TIMEOUT)
responses = list(response_iterator)
test_messages.verify(requests, responses, self)
def testSequentialInvocations(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
first_response_future = self._invoker.future(group, method)(
first_request, test_constants.LONG_TIMEOUT)
first_response = first_response_future.result()
test_messages.verify(first_request, first_response, self)
second_response_future = self._invoker.future(group, method)(
second_request, test_constants.LONG_TIMEOUT)
second_response = second_response_future.result()
test_messages.verify(second_request, second_response, self)
def testParallelInvocations(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
first_response_future = self._invoker.future(group, method)(
first_request, test_constants.LONG_TIMEOUT)
second_response_future = self._invoker.future(group, method)(
second_request, test_constants.LONG_TIMEOUT)
first_response = first_response_future.result()
second_response = second_response_future.result()
test_messages.verify(first_request, first_response, self)
test_messages.verify(second_request, second_response, self)
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures = []
for _ in range(test_constants.THREAD_CONCURRENCY):
request = test_messages.request()
response_future = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
requests.append(request)
response_futures.append(response_future)
responses = [
response_future.result()
for response_future in response_futures
]
for request, response in zip(requests, responses):
test_messages.verify(request, response, self)
def testWaitingForSomeButNotAllParallelInvocations(self):
pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY)
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures_to_indices = {}
for index in range(test_constants.THREAD_CONCURRENCY):
request = test_messages.request()
inner_response_future = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
outer_response_future = pool.submit(
inner_response_future.result)
requests.append(request)
response_futures_to_indices[outer_response_future] = index
some_completed_response_futures_iterator = itertools.islice(
futures.as_completed(response_futures_to_indices),
test_constants.THREAD_CONCURRENCY // 2)
for response_future in some_completed_response_futures_iterator:
index = response_futures_to_indices[response_future]
test_messages.verify(requests[index],
response_future.result(), self)
pool.shutdown(wait=True)
def testCancelledUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
with self._control.pause():
response_future = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
response_future.add_done_callback(callback)
cancel_method_return_value = response_future.cancel()
self.assertIs(callback.future(), response_future)
self.assertFalse(cancel_method_return_value)
self.assertTrue(response_future.cancelled())
with self.assertRaises(future.CancelledError):
response_future.result()
with self.assertRaises(future.CancelledError):
response_future.exception()
with self.assertRaises(future.CancelledError):
response_future.traceback()
def testCancelledUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
with self._control.pause():
response_iterator = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
response_iterator.cancel()
with self.assertRaises(face.CancellationError):
next(response_iterator)
def testCancelledStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
with self._control.pause():
response_future = self._invoker.future(group, method)(
iter(requests), test_constants.LONG_TIMEOUT)
response_future.add_done_callback(callback)
cancel_method_return_value = response_future.cancel()
self.assertIs(callback.future(), response_future)
self.assertFalse(cancel_method_return_value)
self.assertTrue(response_future.cancelled())
with self.assertRaises(future.CancelledError):
response_future.result()
with self.assertRaises(future.CancelledError):
response_future.exception()
with self.assertRaises(future.CancelledError):
response_future.traceback()
def testCancelledStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
with self._control.pause():
response_iterator = self._invoker.future(group, method)(
iter(requests), test_constants.LONG_TIMEOUT)
response_iterator.cancel()
with self.assertRaises(face.CancellationError):
next(response_iterator)
def testExpiredUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
with self._control.pause():
response_future = self._invoker.future(group, method)(
request, _3069_test_constant.REALLY_SHORT_TIMEOUT)
response_future.add_done_callback(callback)
self.assertIs(callback.future(), response_future)
self.assertIsInstance(response_future.exception(),
face.ExpirationError)
with self.assertRaises(face.ExpirationError):
response_future.result()
self.assertIsInstance(response_future.exception(),
face.AbortionError)
self.assertIsNotNone(response_future.traceback())
def testExpiredUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
with self._control.pause():
response_iterator = self._invoker.future(group, method)(
request, _3069_test_constant.REALLY_SHORT_TIMEOUT)
with self.assertRaises(face.ExpirationError):
list(response_iterator)
def testExpiredStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
with self._control.pause():
response_future = self._invoker.future(group, method)(
iter(requests),
_3069_test_constant.REALLY_SHORT_TIMEOUT)
response_future.add_done_callback(callback)
self.assertIs(callback.future(), response_future)
self.assertIsInstance(response_future.exception(),
face.ExpirationError)
with self.assertRaises(face.ExpirationError):
response_future.result()
self.assertIsInstance(response_future.exception(),
face.AbortionError)
self.assertIsNotNone(response_future.traceback())
def testExpiredStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
with self._control.pause():
response_iterator = self._invoker.future(group, method)(
iter(requests),
_3069_test_constant.REALLY_SHORT_TIMEOUT)
with self.assertRaises(face.ExpirationError):
list(response_iterator)
def testFailedUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
abortion_callback = _Callback()
with self._control.fail():
response_future = self._invoker.future(group, method)(
request, _3069_test_constant.REALLY_SHORT_TIMEOUT)
response_future.add_done_callback(callback)
response_future.add_abortion_callback(abortion_callback)
self.assertIs(callback.future(), response_future)
# Because the servicer fails outside of the thread from which the
# servicer-side runtime called into it its failure is
# indistinguishable from simply not having called its
# response_callback before the expiration of the RPC.
self.assertIsInstance(response_future.exception(),
face.ExpirationError)
with self.assertRaises(face.ExpirationError):
response_future.result()
self.assertIsNotNone(response_future.traceback())
self.assertIsNotNone(abortion_callback.future())
def testFailedUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
# Because the servicer fails outside of the thread from which the
# servicer-side runtime called into it its failure is indistinguishable
# from simply not having called its response_consumer before the
# expiration of the RPC.
with self._control.fail(), self.assertRaises(
face.ExpirationError):
response_iterator = self._invoker.future(group, method)(
request, _3069_test_constant.REALLY_SHORT_TIMEOUT)
list(response_iterator)
def testFailedStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
abortion_callback = _Callback()
with self._control.fail():
response_future = self._invoker.future(group, method)(
iter(requests),
_3069_test_constant.REALLY_SHORT_TIMEOUT)
response_future.add_done_callback(callback)
response_future.add_abortion_callback(abortion_callback)
self.assertIs(callback.future(), response_future)
# Because the servicer fails outside of the thread from which the
# servicer-side runtime called into it its failure is
# indistinguishable from simply not having called its
# response_callback before the expiration of the RPC.
self.assertIsInstance(response_future.exception(),
face.ExpirationError)
with self.assertRaises(face.ExpirationError):
response_future.result()
self.assertIsNotNone(response_future.traceback())
self.assertIsNotNone(abortion_callback.future())
def testFailedStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
# Because the servicer fails outside of the thread from which the
# servicer-side runtime called into it its failure is indistinguishable
# from simply not having called its response_consumer before the
# expiration of the RPC.
with self._control.fail(), self.assertRaises(
face.ExpirationError):
response_iterator = self._invoker.future(group, method)(
iter(requests),
_3069_test_constant.REALLY_SHORT_TIMEOUT)
list(response_iterator)
| bsd-3-clause | [
3,
1898,
6900,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
624,
774,
1233,
367,
314,
21459,
4045,
402,
11785,
22545,
1041,
199,
199,
504,
636,
2443,
363,
492,
4629,
199,
199,
646,
13022,
199,
646,
15502,
199,
646,
7975,
199,
646,
5796,
199,
646,
2882,
199,
504,
23002,
492,
27471,
199,
199,
646,
3816,
199,
199,
3,
511,
63,
7436,
365,
11812,
687,
8929,
315,
642,
859,
14,
199,
504,
19753,
14,
4857,
14,
4214,
425,
492,
6466,
199,
504,
19753,
14,
4857,
14,
4214,
425,
492,
2050,
63,
2293,
199,
504,
19753,
14,
4857,
14,
7436,
14,
1409,
492,
8870,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
5559,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
2785,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
10828,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
1216,
1876,
63,
396,
63,
4083,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
5671,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
6088,
63,
1364,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
511,
63,
7436,
221,
327,
4287,
26,
3507,
29,
8618,
13,
646,
421,
199,
533,
485,
30851,
461,
3585,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
18932,
304,
267,
291,
423,
20099,
275,
18932,
267,
291,
423,
5394,
275,
5796,
14,
9558,
342,
267,
291,
423,
22478,
275,
756,
339,
768,
23464,
14,
14237,
272,
347,
16834,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
22478,
275,
715,
267,
1995,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
22478,
275,
756,
288,
291,
423,
5394,
14,
6814,
63,
452,
342,
339,
347,
636,
1661,
721,
277,
304,
267,
372,
291,
339,
347,
636,
2184,
721,
277,
304,
267,
372,
291,
14,
2184,
342,
339,
347,
2163,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
1830,
291,
423,
22478,
26,
355,
291,
423,
5394,
14,
2573,
342,
267,
372,
2163,
8,
277,
423,
20099,
9,
421,
199,
533,
485,
2806,
8,
785,
304,
339,
347,
636,
826,
721,
277,
304,
267,
291,
423,
5394,
275,
5796,
14,
9558,
342,
267,
291,
423,
3527,
275,
756,
267,
291,
423,
12070,
63,
2443,
275,
488,
267,
291,
423,
12070,
63,
1848,
63,
14573,
275,
488,
339,
347,
636,
1250,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
3527,
275,
715,
288,
340,
1249,
26,
355,
291,
423,
12070,
63,
2443,
275,
1249,
59,
16,
61,
288,
340,
413,
665,
822,
8,
589,
9,
503,
2074,
26,
355,
291,
423,
12070,
63,
1848,
63,
14573,
275,
2008,
8,
589,
59,
17,
26,
2522,
1211,
8,
958,
9,
288,
291,
423,
5394,
14,
6814,
63,
452,
342,
339,
347,
6466,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
1830,
715,
26,
355,
340,
291,
423,
12070,
63,
1848,
63,
14573,
365,
440,
488,
26,
490,
746,
1722,
8,
717,
283,
774,
3233,
3032,
10537,
1338,
26,
450,
83,
297,
717,
291,
423,
12070,
63,
1848,
63,
14573,
9,
355,
916,
291,
423,
3527,
26,
490,
372,
291,
423,
12070,
63,
2443,
355,
587,
26,
490,
291,
423,
5394,
14,
2573,
342,
421,
199,
533,
7640,
8,
267,
3816,
14,
1045,
63,
6577,
8,
3175,
14,
22254,
12,
511,
63,
10828,
14,
27444,
12,
2574,
2882,
14,
1746,
2298,
272,
408,
33,
511,
402,
314,
21459,
4045,
402,
11785,
22545,
14,
819,
1448,
7564,
9180,
1471,
1172,
376,
298,
12236,
2,
2225,
402,
730,
523,
511,
63,
7436,
14,
7921,
436,
376,
298,
5350,
26790,
63,
1880,
2,
2225,
402,
730,
523,
485,
30158,
14,
14883,
26790,
11447,
14,
523,
408,
339,
13637,
275,
283,
14224,
14883,
13364,
2822,
9865,
2390,
3167,
774,
7,
339,
347,
3613,
8,
277,
304,
267,
408,
9295,
2882,
14,
1746,
14,
5996,
367,
2615,
8929,
14,
339,
7259,
15526,
12591,
1471,
1240,
642,
4514,
14,
272,
408,
267,
291,
423,
2785,
275,
511,
63,
2785,
14,
30851,
4874,
3717,
342,
267,
291,
423,
5671,
63,
2293,
275,
2050,
63,
2293,
14,
2293,
8,
396,
63,
5559,
14,
19693,
63,
4305
] | [
1898,
6900,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
624,
774,
1233,
367,
314,
21459,
4045,
402,
11785,
22545,
1041,
199,
199,
504,
636,
2443,
363,
492,
4629,
199,
199,
646,
13022,
199,
646,
15502,
199,
646,
7975,
199,
646,
5796,
199,
646,
2882,
199,
504,
23002,
492,
27471,
199,
199,
646,
3816,
199,
199,
3,
511,
63,
7436,
365,
11812,
687,
8929,
315,
642,
859,
14,
199,
504,
19753,
14,
4857,
14,
4214,
425,
492,
6466,
199,
504,
19753,
14,
4857,
14,
4214,
425,
492,
2050,
63,
2293,
199,
504,
19753,
14,
4857,
14,
7436,
14,
1409,
492,
8870,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
5559,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
2785,
199,
504,
2295,
14,
3248,
14,
4857,
14,
2330,
492,
511,
63,
10828,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
1216,
1876,
63,
396,
63,
4083,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
5671,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
485,
6088,
63,
1364,
199,
504,
2295,
14,
3248,
14,
4857,
14,
7436,
14,
1409,
492,
511,
63,
7436,
221,
327,
4287,
26,
3507,
29,
8618,
13,
646,
421,
199,
533,
485,
30851,
461,
3585,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
18932,
304,
267,
291,
423,
20099,
275,
18932,
267,
291,
423,
5394,
275,
5796,
14,
9558,
342,
267,
291,
423,
22478,
275,
756,
339,
768,
23464,
14,
14237,
272,
347,
16834,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
22478,
275,
715,
267,
1995,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
22478,
275,
756,
288,
291,
423,
5394,
14,
6814,
63,
452,
342,
339,
347,
636,
1661,
721,
277,
304,
267,
372,
291,
339,
347,
636,
2184,
721,
277,
304,
267,
372,
291,
14,
2184,
342,
339,
347,
2163,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
1830,
291,
423,
22478,
26,
355,
291,
423,
5394,
14,
2573,
342,
267,
372,
2163,
8,
277,
423,
20099,
9,
421,
199,
533,
485,
2806,
8,
785,
304,
339,
347,
636,
826,
721,
277,
304,
267,
291,
423,
5394,
275,
5796,
14,
9558,
342,
267,
291,
423,
3527,
275,
756,
267,
291,
423,
12070,
63,
2443,
275,
488,
267,
291,
423,
12070,
63,
1848,
63,
14573,
275,
488,
339,
347,
636,
1250,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
543,
291,
423,
5394,
26,
288,
291,
423,
3527,
275,
715,
288,
340,
1249,
26,
355,
291,
423,
12070,
63,
2443,
275,
1249,
59,
16,
61,
288,
340,
413,
665,
822,
8,
589,
9,
503,
2074,
26,
355,
291,
423,
12070,
63,
1848,
63,
14573,
275,
2008,
8,
589,
59,
17,
26,
2522,
1211,
8,
958,
9,
288,
291,
423,
5394,
14,
6814,
63,
452,
342,
339,
347,
6466,
8,
277,
304,
267,
543,
291,
423,
5394,
26,
288,
1830,
715,
26,
355,
340,
291,
423,
12070,
63,
1848,
63,
14573,
365,
440,
488,
26,
490,
746,
1722,
8,
717,
283,
774,
3233,
3032,
10537,
1338,
26,
450,
83,
297,
717,
291,
423,
12070,
63,
1848,
63,
14573,
9,
355,
916,
291,
423,
3527,
26,
490,
372,
291,
423,
12070,
63,
2443,
355,
587,
26,
490,
291,
423,
5394,
14,
2573,
342,
421,
199,
533,
7640,
8,
267,
3816,
14,
1045,
63,
6577,
8,
3175,
14,
22254,
12,
511,
63,
10828,
14,
27444,
12,
2574,
2882,
14,
1746,
2298,
272,
408,
33,
511,
402,
314,
21459,
4045,
402,
11785,
22545,
14,
819,
1448,
7564,
9180,
1471,
1172,
376,
298,
12236,
2,
2225,
402,
730,
523,
511,
63,
7436,
14,
7921,
436,
376,
298,
5350,
26790,
63,
1880,
2,
2225,
402,
730,
523,
485,
30158,
14,
14883,
26790,
11447,
14,
523,
408,
339,
13637,
275,
283,
14224,
14883,
13364,
2822,
9865,
2390,
3167,
774,
7,
339,
347,
3613,
8,
277,
304,
267,
408,
9295,
2882,
14,
1746,
14,
5996,
367,
2615,
8929,
14,
339,
7259,
15526,
12591,
1471,
1240,
642,
4514,
14,
272,
408,
267,
291,
423,
2785,
275,
511,
63,
2785,
14,
30851,
4874,
3717,
342,
267,
291,
423,
5671,
63,
2293,
275,
2050,
63,
2293,
14,
2293,
8,
396,
63,
5559,
14,
19693,
63,
4305,
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,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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
] |
raphaelmerx/django | tests/view_tests/tests/test_debug.py | 99 | 40145 | # -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import unicode_literals
import importlib
import inspect
import os
import re
import sys
import tempfile
from unittest import skipIf
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.db import DatabaseError, connection
from django.template import TemplateDoesNotExist
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.utils import LoggingCaptureMixin
from django.utils import six
from django.utils.encoding import force_bytes, force_text
from django.utils.functional import SimpleLazyObject
from django.views.debug import (
CallableSettingWrapper, ExceptionReporter, technical_500_response,
)
from .. import BrokenException, except_args
from ..views import (
custom_exception_reporter_filter_view, multivalue_dict_key_error,
non_sensitive_view, paranoid_view, sensitive_args_function_caller,
sensitive_kwargs_function_caller, sensitive_method_view, sensitive_view,
)
if six.PY3:
from .py3_test_debug import Py3ExceptionReporterTests # NOQA
class CallableSettingWrapperTests(SimpleTestCase):
""" Unittests for CallableSettingWrapper
"""
def test_repr(self):
class WrappedCallable(object):
def __repr__(self):
return "repr from the wrapped callable"
def __call__(self):
pass
actual = repr(CallableSettingWrapper(WrappedCallable()))
self.assertEqual(actual, "repr from the wrapped callable")
@override_settings(DEBUG=True, ROOT_URLCONF="view_tests.urls")
class DebugViewTests(LoggingCaptureMixin, SimpleTestCase):
def test_files(self):
response = self.client.get('/raises/')
self.assertEqual(response.status_code, 500)
data = {
'file_data.txt': SimpleUploadedFile('file_data.txt', b'haha'),
}
response = self.client.post('/raises/', data)
self.assertContains(response, 'file_data.txt', status_code=500)
self.assertNotContains(response, 'haha', status_code=500)
def test_400(self):
# Ensure that when DEBUG=True, technical_500_template() is called.
response = self.client.get('/raises400/')
self.assertContains(response, '<div class="context" id="', status_code=400)
# Ensure no 403.html template exists to test the default case.
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
}])
def test_403(self):
response = self.client.get('/raises403/')
self.assertContains(response, '<h1>403 Forbidden</h1>', status_code=403)
# Set up a test 403.html template.
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'loaders': [
('django.template.loaders.locmem.Loader', {
'403.html': 'This is a test template for a 403 error ({{ exception }}).',
}),
],
},
}])
def test_403_template(self):
response = self.client.get('/raises403/')
self.assertContains(response, 'test template', status_code=403)
self.assertContains(response, '(Insufficient Permissions).', status_code=403)
def test_404(self):
response = self.client.get('/raises404/')
self.assertEqual(response.status_code, 404)
def test_raised_404(self):
response = self.client.get('/views/raises404/')
self.assertContains(response, "<code>not-in-urls</code>, didn't match", status_code=404)
def test_404_not_in_urls(self):
response = self.client.get('/not-in-urls')
self.assertNotContains(response, "Raised by:", status_code=404)
self.assertContains(response, "<code>not-in-urls</code>, didn't match", status_code=404)
def test_technical_404(self):
response = self.client.get('/views/technical404/')
self.assertContains(response, "Raised by:", status_code=404)
self.assertContains(response, "view_tests.views.technical404", status_code=404)
def test_classbased_technical_404(self):
response = self.client.get('/views/classbased404/')
self.assertContains(response, "Raised by:", status_code=404)
self.assertContains(response, "view_tests.views.Http404View", status_code=404)
def test_view_exceptions(self):
for n in range(len(except_args)):
self.assertRaises(BrokenException, self.client.get,
reverse('view_exception', args=(n,)))
def test_non_l10ned_numeric_ids(self):
"""
Numeric IDs and fancy traceback context blocks line numbers shouldn't be localized.
"""
with self.settings(DEBUG=True, USE_L10N=True):
response = self.client.get('/raises500/')
# We look for a HTML fragment of the form
# '<div class="context" id="c38123208">', not '<div class="context" id="c38,123,208"'
self.assertContains(response, '<div class="context" id="', status_code=500)
match = re.search(b'<div class="context" id="(?P<id>[^"]+)">', response.content)
self.assertIsNotNone(match)
id_repr = match.group('id')
self.assertFalse(re.search(b'[^c0-9]', id_repr),
"Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr)
def test_template_exceptions(self):
for n in range(len(except_args)):
try:
self.client.get(reverse('template_exception', args=(n,)))
except Exception:
raising_loc = inspect.trace()[-1][-2][0].strip()
self.assertNotEqual(raising_loc.find('raise BrokenException'), -1,
"Failed to find 'raise BrokenException' in last frame of traceback, instead found: %s" %
raising_loc)
def test_template_loader_postmortem(self):
"""Tests for not existing file"""
template_name = "notfound.html"
with tempfile.NamedTemporaryFile(prefix=template_name) as tmpfile:
tempdir = os.path.dirname(tmpfile.name)
template_path = os.path.join(tempdir, template_name)
with override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [tempdir],
}]):
response = self.client.get(reverse('raises_template_does_not_exist', kwargs={"path": template_name}))
self.assertContains(response, "%s (Source does not exist)" % template_path, status_code=500, count=2)
def test_no_template_source_loaders(self):
"""
Make sure if you don't specify a template, the debug view doesn't blow up.
"""
self.assertRaises(TemplateDoesNotExist, self.client.get, '/render_no_template/')
@override_settings(ROOT_URLCONF='view_tests.default_urls')
def test_default_urlconf_template(self):
"""
Make sure that the default urlconf template is shown shown instead
of the technical 404 page, if the user has not altered their
url conf yet.
"""
response = self.client.get('/')
self.assertContains(
response,
"<h2>Congratulations on your first Django-powered page.</h2>"
)
@override_settings(ROOT_URLCONF='view_tests.regression_21530_urls')
def test_regression_21530(self):
"""
Regression test for bug #21530.
If the admin app include is replaced with exactly one url
pattern, then the technical 404 template should be displayed.
The bug here was that an AttributeError caused a 500 response.
"""
response = self.client.get('/')
self.assertContains(
response,
"Page not found <span>(404)</span>",
status_code=404
)
class DebugViewQueriesAllowedTests(SimpleTestCase):
# May need a query to initialize MySQL connection
allow_database_queries = True
def test_handle_db_exception(self):
"""
Ensure the debug view works when a database exception is raised by
performing an invalid query and passing the exception to the debug view.
"""
with connection.cursor() as cursor:
try:
cursor.execute('INVALID SQL')
except DatabaseError:
exc_info = sys.exc_info()
rf = RequestFactory()
response = technical_500_response(rf.get('/'), *exc_info)
self.assertContains(response, 'OperationalError at /', status_code=500)
@override_settings(
DEBUG=True,
ROOT_URLCONF="view_tests.urls",
# No template directories are configured, so no templates will be found.
TEMPLATES=[{
'BACKEND': 'django.template.backends.dummy.TemplateStrings',
}],
)
class NonDjangoTemplatesDebugViewTests(SimpleTestCase):
def test_400(self):
# Ensure that when DEBUG=True, technical_500_template() is called.
response = self.client.get('/raises400/')
self.assertContains(response, '<div class="context" id="', status_code=400)
def test_403(self):
response = self.client.get('/raises403/')
self.assertContains(response, '<h1>403 Forbidden</h1>', status_code=403)
def test_404(self):
response = self.client.get('/raises404/')
self.assertEqual(response.status_code, 404)
def test_template_not_found_error(self):
# Raises a TemplateDoesNotExist exception and shows the debug view.
url = reverse('raises_template_does_not_exist', kwargs={"path": "notfound.html"})
response = self.client.get(url)
self.assertContains(response, '<div class="context" id="', status_code=500)
class ExceptionReporterTests(SimpleTestCase):
rf = RequestFactory()
def test_request_and_exception(self):
"A simple exception report can be generated"
try:
request = self.rf.get('/test_view/')
raise ValueError("Can't find my keys")
except ValueError:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('<h1>ValueError at /test_view/</h1>', html)
self.assertIn('<pre class="exception_value">Can't find my keys</pre>', html)
self.assertIn('<th>Request Method:</th>', html)
self.assertIn('<th>Request URL:</th>', html)
self.assertIn('<th>Exception Type:</th>', html)
self.assertIn('<th>Exception Value:</th>', html)
self.assertIn('<h2>Traceback ', html)
self.assertIn('<h2>Request information</h2>', html)
self.assertNotIn('<p>Request data not supplied</p>', html)
def test_no_request(self):
"An exception report can be generated without request"
try:
raise ValueError("Can't find my keys")
except ValueError:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('<h1>ValueError</h1>', html)
self.assertIn('<pre class="exception_value">Can't find my keys</pre>', html)
self.assertNotIn('<th>Request Method:</th>', html)
self.assertNotIn('<th>Request URL:</th>', html)
self.assertIn('<th>Exception Type:</th>', html)
self.assertIn('<th>Exception Value:</th>', html)
self.assertIn('<h2>Traceback ', html)
self.assertIn('<h2>Request information</h2>', html)
self.assertIn('<p>Request data not supplied</p>', html)
def test_eol_support(self):
"""Test that the ExceptionReporter supports Unix, Windows and Macintosh EOL markers"""
LINES = list('print %d' % i for i in range(1, 6))
reporter = ExceptionReporter(None, None, None, None)
for newline in ['\n', '\r\n', '\r']:
fd, filename = tempfile.mkstemp(text=False)
os.write(fd, force_bytes(newline.join(LINES) + newline))
os.close(fd)
try:
self.assertEqual(
reporter._get_lines_from_file(filename, 3, 2),
(1, LINES[1:3], LINES[3], LINES[4:])
)
finally:
os.unlink(filename)
def test_no_exception(self):
"An exception report can be generated for just a request"
request = self.rf.get('/test_view/')
reporter = ExceptionReporter(request, None, None, None)
html = reporter.get_traceback_html()
self.assertIn('<h1>Report at /test_view/</h1>', html)
self.assertIn('<pre class="exception_value">No exception message supplied</pre>', html)
self.assertIn('<th>Request Method:</th>', html)
self.assertIn('<th>Request URL:</th>', html)
self.assertNotIn('<th>Exception Type:</th>', html)
self.assertNotIn('<th>Exception Value:</th>', html)
self.assertNotIn('<h2>Traceback ', html)
self.assertIn('<h2>Request information</h2>', html)
self.assertNotIn('<p>Request data not supplied</p>', html)
def test_request_and_message(self):
"A message can be provided in addition to a request"
request = self.rf.get('/test_view/')
reporter = ExceptionReporter(request, None, "I'm a little teapot", None)
html = reporter.get_traceback_html()
self.assertIn('<h1>Report at /test_view/</h1>', html)
self.assertIn('<pre class="exception_value">I'm a little teapot</pre>', html)
self.assertIn('<th>Request Method:</th>', html)
self.assertIn('<th>Request URL:</th>', html)
self.assertNotIn('<th>Exception Type:</th>', html)
self.assertNotIn('<th>Exception Value:</th>', html)
self.assertNotIn('<h2>Traceback ', html)
self.assertIn('<h2>Request information</h2>', html)
self.assertNotIn('<p>Request data not supplied</p>', html)
def test_message_only(self):
reporter = ExceptionReporter(None, None, "I'm a little teapot", None)
html = reporter.get_traceback_html()
self.assertIn('<h1>Report</h1>', html)
self.assertIn('<pre class="exception_value">I'm a little teapot</pre>', html)
self.assertNotIn('<th>Request Method:</th>', html)
self.assertNotIn('<th>Request URL:</th>', html)
self.assertNotIn('<th>Exception Type:</th>', html)
self.assertNotIn('<th>Exception Value:</th>', html)
self.assertNotIn('<h2>Traceback ', html)
self.assertIn('<h2>Request information</h2>', html)
self.assertIn('<p>Request data not supplied</p>', html)
def test_non_utf8_values_handling(self):
"Non-UTF-8 exceptions/values should not make the output generation choke."
try:
class NonUtf8Output(Exception):
def __repr__(self):
return b'EXC\xe9EXC'
somevar = b'VAL\xe9VAL' # NOQA
raise NonUtf8Output()
except Exception:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('VAL\\xe9VAL', html)
self.assertIn('EXC\\xe9EXC', html)
def test_unprintable_values_handling(self):
"Unprintable values should not make the output generation choke."
try:
class OomOutput(object):
def __repr__(self):
raise MemoryError('OOM')
oomvalue = OomOutput() # NOQA
raise ValueError()
except Exception:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('<td class="code"><pre>Error in formatting', html)
def test_too_large_values_handling(self):
"Large values should not create a large HTML."
large = 256 * 1024
repr_of_str_adds = len(repr(''))
try:
class LargeOutput(object):
def __repr__(self):
return repr('A' * large)
largevalue = LargeOutput() # NOQA
raise ValueError()
except Exception:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertEqual(len(html) // 1024 // 128, 0) # still fit in 128Kb
self.assertIn('<trimmed %d bytes string>' % (large + repr_of_str_adds,), html)
@skipIf(six.PY2, 'Bug manifests on PY3 only')
def test_unfrozen_importlib(self):
"""
importlib is not a frozen app, but its loader thinks it's frozen which
results in an ImportError on Python 3. Refs #21443.
"""
try:
request = self.rf.get('/test_view/')
importlib.import_module('abc.def.invalid.name')
except Exception:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('<h1>ImportError at /test_view/</h1>', html)
def test_ignore_traceback_evaluation_exceptions(self):
"""
Don't trip over exceptions generated by crafted objects when
evaluating them while cleansing (#24455).
"""
class BrokenEvaluation(Exception):
pass
def broken_setup():
raise BrokenEvaluation
request = self.rf.get('/test_view/')
broken_lazy = SimpleLazyObject(broken_setup)
try:
bool(broken_lazy)
except BrokenEvaluation:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
try:
html = reporter.get_traceback_html()
except BrokenEvaluation:
self.fail("Broken evaluation in traceback is not caught.")
self.assertIn(
"BrokenEvaluation",
html,
"Evaluation exception reason not mentioned in traceback"
)
@override_settings(ALLOWED_HOSTS='example.com')
def test_disallowed_host(self):
"An exception report can be generated even for a disallowed host."
request = self.rf.get('/', HTTP_HOST='evil.com')
reporter = ExceptionReporter(request, None, None, None)
html = reporter.get_traceback_html()
self.assertIn("http://evil.com/", html)
class PlainTextReportTests(SimpleTestCase):
rf = RequestFactory()
def test_request_and_exception(self):
"A simple exception report can be generated"
try:
request = self.rf.get('/test_view/')
raise ValueError("Can't find my keys")
except ValueError:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
text = reporter.get_traceback_text()
self.assertIn('ValueError at /test_view/', text)
self.assertIn("Can't find my keys", text)
self.assertIn('Request Method:', text)
self.assertIn('Request URL:', text)
self.assertIn('Exception Type:', text)
self.assertIn('Exception Value:', text)
self.assertIn('Traceback:', text)
self.assertIn('Request information:', text)
self.assertNotIn('Request data not supplied', text)
def test_no_request(self):
"An exception report can be generated without request"
try:
raise ValueError("Can't find my keys")
except ValueError:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
text = reporter.get_traceback_text()
self.assertIn('ValueError', text)
self.assertIn("Can't find my keys", text)
self.assertNotIn('Request Method:', text)
self.assertNotIn('Request URL:', text)
self.assertIn('Exception Type:', text)
self.assertIn('Exception Value:', text)
self.assertIn('Traceback:', text)
self.assertIn('Request data not supplied', text)
def test_no_exception(self):
"An exception report can be generated for just a request"
request = self.rf.get('/test_view/')
reporter = ExceptionReporter(request, None, None, None)
reporter.get_traceback_text()
def test_request_and_message(self):
"A message can be provided in addition to a request"
request = self.rf.get('/test_view/')
reporter = ExceptionReporter(request, None, "I'm a little teapot", None)
reporter.get_traceback_text()
def test_message_only(self):
reporter = ExceptionReporter(None, None, "I'm a little teapot", None)
reporter.get_traceback_text()
@override_settings(ALLOWED_HOSTS='example.com')
def test_disallowed_host(self):
"An exception report can be generated even for a disallowed host."
request = self.rf.get('/', HTTP_HOST='evil.com')
reporter = ExceptionReporter(request, None, None, None)
text = reporter.get_traceback_text()
self.assertIn("http://evil.com/", text)
class ExceptionReportTestMixin(object):
# Mixin used in the ExceptionReporterFilterTests and
# AjaxResponseExceptionReporterFilter tests below
breakfast_data = {'sausage-key': 'sausage-value',
'baked-beans-key': 'baked-beans-value',
'hash-brown-key': 'hash-brown-value',
'bacon-key': 'bacon-value'}
def verify_unsafe_response(self, view, check_for_vars=True,
check_for_POST_params=True):
"""
Asserts that potentially sensitive info are displayed in the response.
"""
request = self.rf.post('/some_url/', self.breakfast_data)
response = view(request)
if check_for_vars:
# All variables are shown.
self.assertContains(response, 'cooked_eggs', status_code=500)
self.assertContains(response, 'scrambled', status_code=500)
self.assertContains(response, 'sauce', status_code=500)
self.assertContains(response, 'worcestershire', status_code=500)
if check_for_POST_params:
for k, v in self.breakfast_data.items():
# All POST parameters are shown.
self.assertContains(response, k, status_code=500)
self.assertContains(response, v, status_code=500)
def verify_safe_response(self, view, check_for_vars=True,
check_for_POST_params=True):
"""
Asserts that certain sensitive info are not displayed in the response.
"""
request = self.rf.post('/some_url/', self.breakfast_data)
response = view(request)
if check_for_vars:
# Non-sensitive variable's name and value are shown.
self.assertContains(response, 'cooked_eggs', status_code=500)
self.assertContains(response, 'scrambled', status_code=500)
# Sensitive variable's name is shown but not its value.
self.assertContains(response, 'sauce', status_code=500)
self.assertNotContains(response, 'worcestershire', status_code=500)
if check_for_POST_params:
for k, v in self.breakfast_data.items():
# All POST parameters' names are shown.
self.assertContains(response, k, status_code=500)
# Non-sensitive POST parameters' values are shown.
self.assertContains(response, 'baked-beans-value', status_code=500)
self.assertContains(response, 'hash-brown-value', status_code=500)
# Sensitive POST parameters' values are not shown.
self.assertNotContains(response, 'sausage-value', status_code=500)
self.assertNotContains(response, 'bacon-value', status_code=500)
def verify_paranoid_response(self, view, check_for_vars=True,
check_for_POST_params=True):
"""
Asserts that no variables or POST parameters are displayed in the response.
"""
request = self.rf.post('/some_url/', self.breakfast_data)
response = view(request)
if check_for_vars:
# Show variable names but not their values.
self.assertContains(response, 'cooked_eggs', status_code=500)
self.assertNotContains(response, 'scrambled', status_code=500)
self.assertContains(response, 'sauce', status_code=500)
self.assertNotContains(response, 'worcestershire', status_code=500)
if check_for_POST_params:
for k, v in self.breakfast_data.items():
# All POST parameters' names are shown.
self.assertContains(response, k, status_code=500)
# No POST parameters' values are shown.
self.assertNotContains(response, v, status_code=500)
def verify_unsafe_email(self, view, check_for_POST_params=True):
"""
Asserts that potentially sensitive info are displayed in the email report.
"""
with self.settings(ADMINS=[('Admin', 'admin@fattie-breakie.com')]):
mail.outbox = [] # Empty outbox
request = self.rf.post('/some_url/', self.breakfast_data)
view(request)
self.assertEqual(len(mail.outbox), 1)
email = mail.outbox[0]
# Frames vars are never shown in plain text email reports.
body_plain = force_text(email.body)
self.assertNotIn('cooked_eggs', body_plain)
self.assertNotIn('scrambled', body_plain)
self.assertNotIn('sauce', body_plain)
self.assertNotIn('worcestershire', body_plain)
# Frames vars are shown in html email reports.
body_html = force_text(email.alternatives[0][0])
self.assertIn('cooked_eggs', body_html)
self.assertIn('scrambled', body_html)
self.assertIn('sauce', body_html)
self.assertIn('worcestershire', body_html)
if check_for_POST_params:
for k, v in self.breakfast_data.items():
# All POST parameters are shown.
self.assertIn(k, body_plain)
self.assertIn(v, body_plain)
self.assertIn(k, body_html)
self.assertIn(v, body_html)
def verify_safe_email(self, view, check_for_POST_params=True):
"""
Asserts that certain sensitive info are not displayed in the email report.
"""
with self.settings(ADMINS=[('Admin', 'admin@fattie-breakie.com')]):
mail.outbox = [] # Empty outbox
request = self.rf.post('/some_url/', self.breakfast_data)
view(request)
self.assertEqual(len(mail.outbox), 1)
email = mail.outbox[0]
# Frames vars are never shown in plain text email reports.
body_plain = force_text(email.body)
self.assertNotIn('cooked_eggs', body_plain)
self.assertNotIn('scrambled', body_plain)
self.assertNotIn('sauce', body_plain)
self.assertNotIn('worcestershire', body_plain)
# Frames vars are shown in html email reports.
body_html = force_text(email.alternatives[0][0])
self.assertIn('cooked_eggs', body_html)
self.assertIn('scrambled', body_html)
self.assertIn('sauce', body_html)
self.assertNotIn('worcestershire', body_html)
if check_for_POST_params:
for k, v in self.breakfast_data.items():
# All POST parameters' names are shown.
self.assertIn(k, body_plain)
# Non-sensitive POST parameters' values are shown.
self.assertIn('baked-beans-value', body_plain)
self.assertIn('hash-brown-value', body_plain)
self.assertIn('baked-beans-value', body_html)
self.assertIn('hash-brown-value', body_html)
# Sensitive POST parameters' values are not shown.
self.assertNotIn('sausage-value', body_plain)
self.assertNotIn('bacon-value', body_plain)
self.assertNotIn('sausage-value', body_html)
self.assertNotIn('bacon-value', body_html)
def verify_paranoid_email(self, view):
"""
Asserts that no variables or POST parameters are displayed in the email report.
"""
with self.settings(ADMINS=[('Admin', 'admin@fattie-breakie.com')]):
mail.outbox = [] # Empty outbox
request = self.rf.post('/some_url/', self.breakfast_data)
view(request)
self.assertEqual(len(mail.outbox), 1)
email = mail.outbox[0]
# Frames vars are never shown in plain text email reports.
body = force_text(email.body)
self.assertNotIn('cooked_eggs', body)
self.assertNotIn('scrambled', body)
self.assertNotIn('sauce', body)
self.assertNotIn('worcestershire', body)
for k, v in self.breakfast_data.items():
# All POST parameters' names are shown.
self.assertIn(k, body)
# No POST parameters' values are shown.
self.assertNotIn(v, body)
@override_settings(ROOT_URLCONF='view_tests.urls')
class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin, SimpleTestCase):
"""
Ensure that sensitive information can be filtered out of error reports.
Refs #14614.
"""
rf = RequestFactory()
def test_non_sensitive_request(self):
"""
Ensure that everything (request info and frame variables) can bee seen
in the default error reports for non-sensitive requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(non_sensitive_view)
self.verify_unsafe_email(non_sensitive_view)
with self.settings(DEBUG=False):
self.verify_unsafe_response(non_sensitive_view)
self.verify_unsafe_email(non_sensitive_view)
def test_sensitive_request(self):
"""
Ensure that sensitive POST parameters and frame variables cannot be
seen in the default error reports for sensitive requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_view)
self.verify_unsafe_email(sensitive_view)
with self.settings(DEBUG=False):
self.verify_safe_response(sensitive_view)
self.verify_safe_email(sensitive_view)
def test_paranoid_request(self):
"""
Ensure that no POST parameters and frame variables can be seen in the
default error reports for "paranoid" requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(paranoid_view)
self.verify_unsafe_email(paranoid_view)
with self.settings(DEBUG=False):
self.verify_paranoid_response(paranoid_view)
self.verify_paranoid_email(paranoid_view)
def test_multivalue_dict_key_error(self):
"""
#21098 -- Ensure that sensitive POST parameters cannot be seen in the
error reports for if request.POST['nonexistent_key'] throws an error.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(multivalue_dict_key_error)
self.verify_unsafe_email(multivalue_dict_key_error)
with self.settings(DEBUG=False):
self.verify_safe_response(multivalue_dict_key_error)
self.verify_safe_email(multivalue_dict_key_error)
def test_custom_exception_reporter_filter(self):
"""
Ensure that it's possible to assign an exception reporter filter to
the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(custom_exception_reporter_filter_view)
self.verify_unsafe_email(custom_exception_reporter_filter_view)
with self.settings(DEBUG=False):
self.verify_unsafe_response(custom_exception_reporter_filter_view)
self.verify_unsafe_email(custom_exception_reporter_filter_view)
def test_sensitive_method(self):
"""
Ensure that the sensitive_variables decorator works with object
methods.
Refs #18379.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_method_view,
check_for_POST_params=False)
self.verify_unsafe_email(sensitive_method_view,
check_for_POST_params=False)
with self.settings(DEBUG=False):
self.verify_safe_response(sensitive_method_view,
check_for_POST_params=False)
self.verify_safe_email(sensitive_method_view,
check_for_POST_params=False)
def test_sensitive_function_arguments(self):
"""
Ensure that sensitive variables don't leak in the sensitive_variables
decorator's frame, when those variables are passed as arguments to the
decorated function.
Refs #19453.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_args_function_caller)
self.verify_unsafe_email(sensitive_args_function_caller)
with self.settings(DEBUG=False):
self.verify_safe_response(sensitive_args_function_caller, check_for_POST_params=False)
self.verify_safe_email(sensitive_args_function_caller, check_for_POST_params=False)
def test_sensitive_function_keyword_arguments(self):
"""
Ensure that sensitive variables don't leak in the sensitive_variables
decorator's frame, when those variables are passed as keyword arguments
to the decorated function.
Refs #19453.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_kwargs_function_caller)
self.verify_unsafe_email(sensitive_kwargs_function_caller)
with self.settings(DEBUG=False):
self.verify_safe_response(sensitive_kwargs_function_caller, check_for_POST_params=False)
self.verify_safe_email(sensitive_kwargs_function_caller, check_for_POST_params=False)
def test_callable_settings(self):
"""
Callable settings should not be evaluated in the debug page (#21345).
"""
def callable_setting():
return "This should not be displayed"
with self.settings(DEBUG=True, FOOBAR=callable_setting):
response = self.client.get('/raises500/')
self.assertNotContains(response, "This should not be displayed", status_code=500)
def test_callable_settings_forbidding_to_set_attributes(self):
"""
Callable settings which forbid to set attributes should not break
the debug page (#23070).
"""
class CallableSettingWithSlots(object):
__slots__ = []
def __call__(self):
return "This should not be displayed"
with self.settings(DEBUG=True, WITH_SLOTS=CallableSettingWithSlots()):
response = self.client.get('/raises500/')
self.assertNotContains(response, "This should not be displayed", status_code=500)
def test_dict_setting_with_non_str_key(self):
"""
A dict setting containing a non-string key should not break the
debug page (#12744).
"""
with self.settings(DEBUG=True, FOOBAR={42: None}):
response = self.client.get('/raises500/')
self.assertContains(response, 'FOOBAR', status_code=500)
def test_sensitive_settings(self):
"""
The debug page should not show some sensitive settings
(password, secret key, ...).
"""
sensitive_settings = [
'SECRET_KEY',
'PASSWORD',
'API_KEY',
'AUTH_TOKEN',
]
for setting in sensitive_settings:
with self.settings(DEBUG=True, **{setting: "should not be displayed"}):
response = self.client.get('/raises500/')
self.assertNotContains(response, 'should not be displayed', status_code=500)
def test_settings_with_sensitive_keys(self):
"""
The debug page should filter out some sensitive information found in
dict settings.
"""
sensitive_settings = [
'SECRET_KEY',
'PASSWORD',
'API_KEY',
'AUTH_TOKEN',
]
for setting in sensitive_settings:
FOOBAR = {
setting: "should not be displayed",
'recursive': {setting: "should not be displayed"},
}
with self.settings(DEBUG=True, FOOBAR=FOOBAR):
response = self.client.get('/raises500/')
self.assertNotContains(response, 'should not be displayed', status_code=500)
class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptureMixin, SimpleTestCase):
"""
Ensure that sensitive information can be filtered out of error reports.
Here we specifically test the plain text 500 debug-only error page served
when it has been detected the request was sent by JS code. We don't check
for (non)existence of frames vars in the traceback information section of
the response content because we don't include them in these error pages.
Refs #14614.
"""
rf = RequestFactory(HTTP_X_REQUESTED_WITH='XMLHttpRequest')
def test_non_sensitive_request(self):
"""
Ensure that request info can bee seen in the default error reports for
non-sensitive requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(non_sensitive_view, check_for_vars=False)
with self.settings(DEBUG=False):
self.verify_unsafe_response(non_sensitive_view, check_for_vars=False)
def test_sensitive_request(self):
"""
Ensure that sensitive POST parameters cannot be seen in the default
error reports for sensitive requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_view, check_for_vars=False)
with self.settings(DEBUG=False):
self.verify_safe_response(sensitive_view, check_for_vars=False)
def test_paranoid_request(self):
"""
Ensure that no POST parameters can be seen in the default error reports
for "paranoid" requests.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(paranoid_view, check_for_vars=False)
with self.settings(DEBUG=False):
self.verify_paranoid_response(paranoid_view, check_for_vars=False)
def test_custom_exception_reporter_filter(self):
"""
Ensure that it's possible to assign an exception reporter filter to
the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(custom_exception_reporter_filter_view,
check_for_vars=False)
with self.settings(DEBUG=False):
self.verify_unsafe_response(custom_exception_reporter_filter_view,
check_for_vars=False)
| bsd-3-clause | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
961,
2803,
1406,
365,
16474,
367,
2295,
12,
465,
314,
3105,
2455,
365,
6057,
199,
3,
1584,
370,
2754,
367,
4066,
282,
1406,
370,
4849,
314,
1350,
570,
1564,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
14802,
199,
646,
6485,
199,
646,
747,
199,
646,
295,
199,
646,
984,
199,
646,
5549,
199,
504,
2882,
492,
3372,
3917,
199,
199,
504,
1639,
14,
1018,
492,
6016,
199,
504,
1639,
14,
1018,
14,
1725,
14,
19044,
493,
492,
5870,
24665,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
697,
492,
27728,
12,
1950,
199,
504,
1639,
14,
1160,
492,
27193,
199,
504,
1639,
14,
396,
492,
18638,
12,
24424,
12,
4278,
63,
1751,
199,
504,
1639,
14,
396,
14,
1208,
492,
19928,
16640,
4256,
199,
504,
1639,
14,
1208,
492,
3816,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
2394,
12,
3542,
63,
505,
199,
504,
1639,
14,
1208,
14,
15481,
492,
5870,
14269,
1692,
199,
504,
1639,
14,
4196,
14,
1757,
492,
334,
272,
16975,
7776,
4590,
12,
2186,
15891,
12,
32742,
63,
5783,
63,
1310,
12,
199,
9,
199,
199,
504,
2508,
492,
23804,
1726,
12,
871,
63,
589,
199,
504,
2508,
4196,
492,
334,
272,
3537,
63,
1971,
63,
12222,
63,
1541,
63,
1345,
12,
3510,
585,
63,
807,
63,
498,
63,
705,
12,
272,
2222,
63,
7361,
63,
1345,
12,
623,
290,
1170,
63,
1345,
12,
18423,
63,
589,
63,
1593,
63,
11219,
12,
272,
18423,
63,
958,
63,
1593,
63,
11219,
12,
18423,
63,
765,
63,
1345,
12,
18423,
63,
1345,
12,
199,
9,
199,
199,
692,
3816,
14,
4521,
19,
26,
272,
687,
1275,
647,
19,
63,
396,
63,
1757,
492,
1611,
19,
1726,
15891,
2925,
221,
327,
20432,
421,
199,
533,
16975,
7776,
4590,
2925,
8,
17968,
304,
272,
408,
1910,
1770,
83,
367,
16975,
7776,
4590,
272,
408,
272,
347,
511,
63,
2722,
8,
277,
304,
267,
1021,
20322,
1915,
16410,
8,
785,
304,
288,
347,
636,
2722,
721,
277,
304,
355,
372,
298,
2722,
687,
314,
8072,
4550,
2,
953,
347,
636,
1250,
721,
277,
304,
355,
986,
398,
3503,
275,
4700,
8,
16410,
7776,
4590,
8,
15991,
1915,
16410,
4059,
267,
291,
14,
629,
8,
6514,
12,
298,
2722,
687,
314,
8072,
4550,
531,
421,
199,
32,
4415,
63,
1751,
8,
5287,
29,
549,
12,
16547,
63,
18125,
628,
1345,
63,
2219,
14,
3603,
531,
199,
533,
14245,
2768,
2925,
8,
14054,
16640,
4256,
12,
24424,
304,
339,
347,
511,
63,
1725,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
6217,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
6891,
9,
398,
666,
275,
469,
288,
283,
493,
63,
576,
14,
2424,
356,
5870,
24665,
360,
493,
63,
576,
14,
2424,
297,
330,
7,
2411,
2411,
659,
267,
789,
267,
1177,
275,
291,
14,
1258,
14,
1932,
2336,
3536,
3678,
666,
9,
267,
291,
14,
9535,
8,
1310,
12,
283,
493,
63,
576,
14,
2424,
297,
2004,
63,
600,
29,
5783,
9,
267,
291,
14,
23218,
8,
1310,
12,
283,
2411,
2411,
297,
2004,
63,
600,
29,
5783,
9,
339,
347,
511,
63,
5303,
8,
277,
304,
267,
327,
7523,
626,
1380,
10990,
29,
549,
12,
32742,
63,
5783,
63,
1160,
342,
365,
2797,
14,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
5303,
6217,
267,
291,
14,
9535,
8,
1310,
12,
2650,
3015,
1021,
628,
1100,
2,
1305,
628,
297,
2004,
63,
600,
29,
5303,
9,
339,
327,
7523,
949,
13269,
14,
1360,
1978,
3495,
370,
511,
314,
849,
1930,
14,
272,
768,
4415,
63,
1751,
8,
25437,
1524,
91,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
272,
789,
566,
272,
347,
511,
63,
13353,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
13353,
6217,
267,
291,
14,
9535,
8,
1310,
12,
2650,
72,
17,
30,
13353,
2104,
10912,
1108,
72,
17,
4206,
2004,
63,
600,
29,
13353,
9,
339,
327,
2494,
1536,
282,
511,
13269,
14,
1360,
1978,
14,
272,
768,
4415,
63,
1751,
8,
25437,
1524,
91,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
267,
283,
8808,
356,
469,
288,
283,
16370,
356,
359,
355,
661,
1176,
14,
1160,
14,
16370,
14,
2102,
5286,
14,
5455,
297,
469,
490,
283,
13353,
14,
1360,
356,
283,
2765,
365,
282,
511,
1978,
367,
282,
13269,
1125,
334,
3638,
1919,
3586,
680,
297,
355,
9998,
288,
2156,
267,
1660,
272,
789,
566,
272,
347,
511,
63,
13353,
63,
1160,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
13353,
6217,
267,
291,
14,
9535,
8,
1310,
12,
283,
396,
1978,
297,
2004,
63,
600,
29,
13353,
9,
267,
291,
14,
9535,
8,
1310,
12,
8189,
13962,
12983,
28260,
680,
297,
2004,
63,
600,
29,
13353,
9,
339,
347,
511,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
5188,
6217,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
7901,
9,
339,
347,
511,
63,
21597,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
4196,
15,
3536,
5188,
6217,
267,
291,
14,
9535,
8,
1310,
12,
3886,
600,
30,
1397,
13,
262,
13,
3603,
1108,
600,
6244,
9980,
1133,
1336,
401,
2004,
63,
600,
29,
5188,
9,
339,
347,
511,
63,
5188,
63,
1397,
63,
262,
63,
3603,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
1397,
13,
262,
13,
3603,
358,
267,
291,
14,
23218,
8,
1310,
12,
298,
16894,
701,
6783,
2004,
63,
600,
29,
5188,
9,
267,
291,
14,
9535,
8,
1310,
12,
3886,
600,
30,
1397,
13,
262,
13,
3603,
1108,
600,
6244,
9980,
1133,
1336,
401,
2004,
63,
600,
29,
5188,
9,
339,
347,
511,
63,
266,
28836,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
4196,
15,
266,
28836,
5188,
6217,
267,
291,
14,
9535,
8
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
961,
2803,
1406,
365,
16474,
367,
2295,
12,
465,
314,
3105,
2455,
365,
6057,
199,
3,
1584,
370,
2754,
367,
4066,
282,
1406,
370,
4849,
314,
1350,
570,
1564,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
14802,
199,
646,
6485,
199,
646,
747,
199,
646,
295,
199,
646,
984,
199,
646,
5549,
199,
504,
2882,
492,
3372,
3917,
199,
199,
504,
1639,
14,
1018,
492,
6016,
199,
504,
1639,
14,
1018,
14,
1725,
14,
19044,
493,
492,
5870,
24665,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
697,
492,
27728,
12,
1950,
199,
504,
1639,
14,
1160,
492,
27193,
199,
504,
1639,
14,
396,
492,
18638,
12,
24424,
12,
4278,
63,
1751,
199,
504,
1639,
14,
396,
14,
1208,
492,
19928,
16640,
4256,
199,
504,
1639,
14,
1208,
492,
3816,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
2394,
12,
3542,
63,
505,
199,
504,
1639,
14,
1208,
14,
15481,
492,
5870,
14269,
1692,
199,
504,
1639,
14,
4196,
14,
1757,
492,
334,
272,
16975,
7776,
4590,
12,
2186,
15891,
12,
32742,
63,
5783,
63,
1310,
12,
199,
9,
199,
199,
504,
2508,
492,
23804,
1726,
12,
871,
63,
589,
199,
504,
2508,
4196,
492,
334,
272,
3537,
63,
1971,
63,
12222,
63,
1541,
63,
1345,
12,
3510,
585,
63,
807,
63,
498,
63,
705,
12,
272,
2222,
63,
7361,
63,
1345,
12,
623,
290,
1170,
63,
1345,
12,
18423,
63,
589,
63,
1593,
63,
11219,
12,
272,
18423,
63,
958,
63,
1593,
63,
11219,
12,
18423,
63,
765,
63,
1345,
12,
18423,
63,
1345,
12,
199,
9,
199,
199,
692,
3816,
14,
4521,
19,
26,
272,
687,
1275,
647,
19,
63,
396,
63,
1757,
492,
1611,
19,
1726,
15891,
2925,
221,
327,
20432,
421,
199,
533,
16975,
7776,
4590,
2925,
8,
17968,
304,
272,
408,
1910,
1770,
83,
367,
16975,
7776,
4590,
272,
408,
272,
347,
511,
63,
2722,
8,
277,
304,
267,
1021,
20322,
1915,
16410,
8,
785,
304,
288,
347,
636,
2722,
721,
277,
304,
355,
372,
298,
2722,
687,
314,
8072,
4550,
2,
953,
347,
636,
1250,
721,
277,
304,
355,
986,
398,
3503,
275,
4700,
8,
16410,
7776,
4590,
8,
15991,
1915,
16410,
4059,
267,
291,
14,
629,
8,
6514,
12,
298,
2722,
687,
314,
8072,
4550,
531,
421,
199,
32,
4415,
63,
1751,
8,
5287,
29,
549,
12,
16547,
63,
18125,
628,
1345,
63,
2219,
14,
3603,
531,
199,
533,
14245,
2768,
2925,
8,
14054,
16640,
4256,
12,
24424,
304,
339,
347,
511,
63,
1725,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
6217,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
6891,
9,
398,
666,
275,
469,
288,
283,
493,
63,
576,
14,
2424,
356,
5870,
24665,
360,
493,
63,
576,
14,
2424,
297,
330,
7,
2411,
2411,
659,
267,
789,
267,
1177,
275,
291,
14,
1258,
14,
1932,
2336,
3536,
3678,
666,
9,
267,
291,
14,
9535,
8,
1310,
12,
283,
493,
63,
576,
14,
2424,
297,
2004,
63,
600,
29,
5783,
9,
267,
291,
14,
23218,
8,
1310,
12,
283,
2411,
2411,
297,
2004,
63,
600,
29,
5783,
9,
339,
347,
511,
63,
5303,
8,
277,
304,
267,
327,
7523,
626,
1380,
10990,
29,
549,
12,
32742,
63,
5783,
63,
1160,
342,
365,
2797,
14,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
5303,
6217,
267,
291,
14,
9535,
8,
1310,
12,
2650,
3015,
1021,
628,
1100,
2,
1305,
628,
297,
2004,
63,
600,
29,
5303,
9,
339,
327,
7523,
949,
13269,
14,
1360,
1978,
3495,
370,
511,
314,
849,
1930,
14,
272,
768,
4415,
63,
1751,
8,
25437,
1524,
91,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
272,
789,
566,
272,
347,
511,
63,
13353,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
13353,
6217,
267,
291,
14,
9535,
8,
1310,
12,
2650,
72,
17,
30,
13353,
2104,
10912,
1108,
72,
17,
4206,
2004,
63,
600,
29,
13353,
9,
339,
327,
2494,
1536,
282,
511,
13269,
14,
1360,
1978,
14,
272,
768,
4415,
63,
1751,
8,
25437,
1524,
91,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
267,
283,
8808,
356,
469,
288,
283,
16370,
356,
359,
355,
661,
1176,
14,
1160,
14,
16370,
14,
2102,
5286,
14,
5455,
297,
469,
490,
283,
13353,
14,
1360,
356,
283,
2765,
365,
282,
511,
1978,
367,
282,
13269,
1125,
334,
3638,
1919,
3586,
680,
297,
355,
9998,
288,
2156,
267,
1660,
272,
789,
566,
272,
347,
511,
63,
13353,
63,
1160,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
13353,
6217,
267,
291,
14,
9535,
8,
1310,
12,
283,
396,
1978,
297,
2004,
63,
600,
29,
13353,
9,
267,
291,
14,
9535,
8,
1310,
12,
8189,
13962,
12983,
28260,
680,
297,
2004,
63,
600,
29,
13353,
9,
339,
347,
511,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
3536,
5188,
6217,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
7901,
9,
339,
347,
511,
63,
21597,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
4196,
15,
3536,
5188,
6217,
267,
291,
14,
9535,
8,
1310,
12,
3886,
600,
30,
1397,
13,
262,
13,
3603,
1108,
600,
6244,
9980,
1133,
1336,
401,
2004,
63,
600,
29,
5188,
9,
339,
347,
511,
63,
5188,
63,
1397,
63,
262,
63,
3603,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
1397,
13,
262,
13,
3603,
358,
267,
291,
14,
23218,
8,
1310,
12,
298,
16894,
701,
6783,
2004,
63,
600,
29,
5188,
9,
267,
291,
14,
9535,
8,
1310,
12,
3886,
600,
30,
1397,
13,
262,
13,
3603,
1108,
600,
6244,
9980,
1133,
1336,
401,
2004,
63,
600,
29,
5188,
9,
339,
347,
511,
63,
266,
28836,
63,
5188,
8,
277,
304,
267,
1177,
275,
291,
14,
1258,
14,
362,
2336,
4196,
15,
266,
28836,
5188,
6217,
267,
291,
14,
9535,
8,
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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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
] |
sharad/calibre | src/calibre/ebooks/metadata/sources/big_book_search.py | 8 | 2177 | #!/usr/bin/env python
# vim:fileencoding=UTF-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.ebooks.metadata.sources.base import Source, Option
def get_urls(br, tokens):
from urllib import quote_plus
from mechanize import Request
from lxml import html
escaped = [quote_plus(x.encode('utf-8')) for x in tokens if x and x.strip()]
q = b'+'.join(escaped)
url = 'http://bigbooksearch.com/books/'+q
br.open(url).read()
req = Request('http://bigbooksearch.com/query.php?SearchIndex=books&Keywords=%s&ItemPage=1'%q)
req.add_header('X-Requested-With', 'XMLHttpRequest')
req.add_header('Referer', url)
raw = br.open(req).read()
root = html.fromstring(raw.decode('utf-8'))
urls = [i.get('src') for i in root.xpath('//img[@src]')]
return urls
class BigBookSearch(Source):
name = 'Big Book Search'
description = _('Downloads multiple book covers from Amazon. Useful to find alternate covers.')
capabilities = frozenset(['cover'])
config_help_message = _('Configure the Big Book Search plugin')
can_get_multiple_covers = True
options = (Option('max_covers', 'number', 5, _('Maximum number of covers to get'),
_('The maximum number of covers to process from the search result')),
)
supports_gzip_transfer_encoding = True
def download_cover(self, log, result_queue, abort,
title=None, authors=None, identifiers={}, timeout=30, get_best_cover=False):
if not title:
return
br = self.browser
tokens = tuple(self.get_title_tokens(title)) + tuple(self.get_author_tokens(authors))
urls = get_urls(br, tokens)
self.download_multiple_covers(title, authors, urls, get_best_cover, timeout, result_queue, abort, log)
def test():
from calibre import browser
import pprint
br = browser()
urls = get_urls(br, ['consider', 'phlebas', 'banks'])
pprint.pprint(urls)
if __name__ == '__main__':
test()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6695,
26,
493,
2991,
29,
6610,
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,
257,
275,
283,
12006,
373,
19,
7,
199,
363,
7307,
363,
275,
283,
6965,
12,
1804,
79,
5017,
3971,
31876,
665,
7697,
5017,
32,
7697,
5017,
1939,
31876,
14,
846,
3524,
199,
363,
21841,
363,
275,
283,
26854,
655,
7,
199,
199,
504,
19238,
14,
69,
8858,
14,
2343,
14,
4553,
14,
1095,
492,
5800,
12,
3207,
199,
199,
318,
664,
63,
3603,
8,
3289,
12,
4645,
304,
272,
687,
4011,
492,
6313,
63,
6666,
272,
687,
562,
11984,
794,
492,
4784,
272,
687,
14490,
492,
3517,
272,
11077,
275,
359,
3513,
63,
6666,
8,
88,
14,
2143,
360,
1624,
13,
24,
1333,
367,
671,
315,
4645,
340,
671,
436,
671,
14,
1913,
5106,
272,
1894,
275,
330,
6828,
1370,
904,
8,
13572,
9,
272,
1166,
275,
283,
1014,
921,
5076,
2706,
1733,
14,
957,
15,
8858,
19047,
81,
272,
11665,
14,
1490,
8,
633,
680,
739,
342,
272,
2648,
275,
4784,
360,
1014,
921,
5076,
2706,
1733,
14,
957,
15,
1131,
14,
8624,
31,
5278,
2681,
29,
8858,
6,
23611,
2458,
83,
6,
2081,
3276,
29,
17,
5956,
81,
9,
272,
2648,
14,
525,
63,
1291,
360,
56,
13,
17935,
13,
3007,
297,
283,
4317,
10441,
358,
272,
2648,
14,
525,
63,
1291,
360,
28900,
297,
1166,
9,
272,
3066,
275,
11665,
14,
1490,
8,
2103,
680,
739,
342,
272,
1738,
275,
3517,
14,
13521,
8,
1773,
14,
2708,
360,
1624,
13,
24,
1333,
272,
8187,
275,
359,
73,
14,
362,
360,
2164,
358,
367,
284,
315,
1738,
14,
8006,
15079,
4060,
14251,
2164,
61,
5440,
272,
372,
8187,
199,
199,
533,
13123,
8696,
5278,
8,
2980,
304,
339,
536,
275,
283,
7279,
8944,
8730,
7,
272,
1369,
275,
4018,
3514,
3640,
3663,
6719,
25858,
687,
14347,
14,
18491,
370,
2342,
18034,
25858,
2659,
272,
14918,
275,
9522,
2941,
5899,
1105,
272,
1101,
63,
3437,
63,
1188,
275,
4018,
17324,
314,
13123,
8944,
8730,
3589,
358,
272,
883,
63,
362,
63,
6048,
63,
5899,
83,
275,
715,
272,
1511,
275,
334,
2602,
360,
988,
63,
5899,
83,
297,
283,
1955,
297,
959,
12,
4018,
10915,
1329,
402,
25858,
370,
664,
659,
1993,
4018,
1918,
5696,
1329,
402,
25858,
370,
2112,
687,
314,
2754,
754,
3855,
272,
776,
272,
5171,
63,
12256,
63,
9609,
63,
2991,
275,
715,
339,
347,
5235,
63,
5899,
8,
277,
12,
943,
12,
754,
63,
1825,
12,
12004,
12,
288,
2538,
29,
403,
12,
11462,
29,
403,
12,
14154,
10324,
2653,
29,
1216,
12,
664,
63,
7010,
63,
5899,
29,
797,
304,
267,
340,
440,
2538,
26,
288,
372,
267,
11665,
275,
291,
14,
5750,
267,
4645,
275,
2008,
8,
277,
14,
362,
63,
1213,
63,
4504,
8,
1213,
430,
435,
2008,
8,
277,
14,
362,
63,
2502,
63,
4504,
8,
8149,
430,
267,
8187,
275,
664,
63,
3603,
8,
3289,
12,
4645,
9,
267,
291,
14,
4249,
63,
6048,
63,
5899,
83,
8,
1213,
12,
11462,
12,
8187,
12,
664,
63,
7010,
63,
5899,
12,
2653,
12,
754,
63,
1825,
12,
12004,
12,
943,
9,
199,
199,
318,
511,
837,
272,
687,
19238,
492,
7042,
272,
492,
10933,
272,
11665,
275,
7042,
342,
272,
8187,
275,
664,
63,
3603,
8,
3289,
12,
788,
388,
16994,
297,
283,
838,
274,
31917,
297,
283,
9860,
83,
1105,
272,
10933,
14,
15380,
8,
3603,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
511,
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
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6695,
26,
493,
2991,
29,
6610,
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,
257,
275,
283,
12006,
373,
19,
7,
199,
363,
7307,
363,
275,
283,
6965,
12,
1804,
79,
5017,
3971,
31876,
665,
7697,
5017,
32,
7697,
5017,
1939,
31876,
14,
846,
3524,
199,
363,
21841,
363,
275,
283,
26854,
655,
7,
199,
199,
504,
19238,
14,
69,
8858,
14,
2343,
14,
4553,
14,
1095,
492,
5800,
12,
3207,
199,
199,
318,
664,
63,
3603,
8,
3289,
12,
4645,
304,
272,
687,
4011,
492,
6313,
63,
6666,
272,
687,
562,
11984,
794,
492,
4784,
272,
687,
14490,
492,
3517,
272,
11077,
275,
359,
3513,
63,
6666,
8,
88,
14,
2143,
360,
1624,
13,
24,
1333,
367,
671,
315,
4645,
340,
671,
436,
671,
14,
1913,
5106,
272,
1894,
275,
330,
6828,
1370,
904,
8,
13572,
9,
272,
1166,
275,
283,
1014,
921,
5076,
2706,
1733,
14,
957,
15,
8858,
19047,
81,
272,
11665,
14,
1490,
8,
633,
680,
739,
342,
272,
2648,
275,
4784,
360,
1014,
921,
5076,
2706,
1733,
14,
957,
15,
1131,
14,
8624,
31,
5278,
2681,
29,
8858,
6,
23611,
2458,
83,
6,
2081,
3276,
29,
17,
5956,
81,
9,
272,
2648,
14,
525,
63,
1291,
360,
56,
13,
17935,
13,
3007,
297,
283,
4317,
10441,
358,
272,
2648,
14,
525,
63,
1291,
360,
28900,
297,
1166,
9,
272,
3066,
275,
11665,
14,
1490,
8,
2103,
680,
739,
342,
272,
1738,
275,
3517,
14,
13521,
8,
1773,
14,
2708,
360,
1624,
13,
24,
1333,
272,
8187,
275,
359,
73,
14,
362,
360,
2164,
358,
367,
284,
315,
1738,
14,
8006,
15079,
4060,
14251,
2164,
61,
5440,
272,
372,
8187,
199,
199,
533,
13123,
8696,
5278,
8,
2980,
304,
339,
536,
275,
283,
7279,
8944,
8730,
7,
272,
1369,
275,
4018,
3514,
3640,
3663,
6719,
25858,
687,
14347,
14,
18491,
370,
2342,
18034,
25858,
2659,
272,
14918,
275,
9522,
2941,
5899,
1105,
272,
1101,
63,
3437,
63,
1188,
275,
4018,
17324,
314,
13123,
8944,
8730,
3589,
358,
272,
883,
63,
362,
63,
6048,
63,
5899,
83,
275,
715,
272,
1511,
275,
334,
2602,
360,
988,
63,
5899,
83,
297,
283,
1955,
297,
959,
12,
4018,
10915,
1329,
402,
25858,
370,
664,
659,
1993,
4018,
1918,
5696,
1329,
402,
25858,
370,
2112,
687,
314,
2754,
754,
3855,
272,
776,
272,
5171,
63,
12256,
63,
9609,
63,
2991,
275,
715,
339,
347,
5235,
63,
5899,
8,
277,
12,
943,
12,
754,
63,
1825,
12,
12004,
12,
288,
2538,
29,
403,
12,
11462,
29,
403,
12,
14154,
10324,
2653,
29,
1216,
12,
664,
63,
7010,
63,
5899,
29,
797,
304,
267,
340,
440,
2538,
26,
288,
372,
267,
11665,
275,
291,
14,
5750,
267,
4645,
275,
2008,
8,
277,
14,
362,
63,
1213,
63,
4504,
8,
1213,
430,
435,
2008,
8,
277,
14,
362,
63,
2502,
63,
4504,
8,
8149,
430,
267,
8187,
275,
664,
63,
3603,
8,
3289,
12,
4645,
9,
267,
291,
14,
4249,
63,
6048,
63,
5899,
83,
8,
1213,
12,
11462,
12,
8187,
12,
664,
63,
7010,
63,
5899,
12,
2653,
12,
754,
63,
1825,
12,
12004,
12,
943,
9,
199,
199,
318,
511,
837,
272,
687,
19238,
492,
7042,
272,
492,
10933,
272,
11665,
275,
7042,
342,
272,
8187,
275,
664,
63,
3603,
8,
3289,
12,
788,
388,
16994,
297,
283,
838,
274,
31917,
297,
283,
9860,
83,
1105,
272,
10933,
14,
15380,
8,
3603,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
511,
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,
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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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
] |
fidomason/kbengine | kbe/src/lib/python/Lib/contextlib.py | 83 | 11648 | """Utilities for with-statement contexts. See PEP 343."""
import sys
from collections import deque
from functools import wraps
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack",
"redirect_stdout", "suppress"]
class ContextDecorator(object):
"A base class or mixin that enables context managers to work as decorators."
def _recreate_cm(self):
"""Return a recreated instance of self.
Allows an otherwise one-shot context manager like
_GeneratorContextManager to support use as
a decorator via implicit recreation.
This is a private interface just for _GeneratorContextManager.
See issue #11647 for details.
"""
return self
def __call__(self, func):
@wraps(func)
def inner(*args, **kwds):
with self._recreate_cm():
return func(*args, **kwds)
return inner
class _GeneratorContextManager(ContextDecorator):
"""Helper for @contextmanager decorator."""
def __init__(self, func, *args, **kwds):
self.gen = func(*args, **kwds)
self.func, self.args, self.kwds = func, args, kwds
# Issue 19330: ensure context manager instances have good docstrings
doc = getattr(func, "__doc__", None)
if doc is None:
doc = type(self).__doc__
self.__doc__ = doc
# Unfortunately, this still doesn't provide good help output when
# inspecting the created context manager instances, since pydoc
# currently bypasses the instance docstring and shows the docstring
# for the class instead.
# See http://bugs.python.org/issue19404 for more details.
def _recreate_cm(self):
# _GCM instances are one-shot context managers, so the
# CM must be recreated each time a decorated function is
# called
return self.__class__(self.func, *self.args, **self.kwds)
def __enter__(self):
try:
return next(self.gen)
except StopIteration:
raise RuntimeError("generator didn't yield") from None
def __exit__(self, type, value, traceback):
if type is None:
try:
next(self.gen)
except StopIteration:
return
else:
raise RuntimeError("generator didn't stop")
else:
if value is None:
# Need to force instantiation so we can reliably
# tell if we get the same exception back
value = type()
try:
self.gen.throw(type, value, traceback)
raise RuntimeError("generator didn't stop after throw()")
except StopIteration as exc:
# Suppress the exception *unless* it's the same exception that
# was passed to throw(). This prevents a StopIteration
# raised inside the "with" statement from being suppressed
return exc is not value
except:
# only re-raise if it's *not* the exception that was
# passed to throw(), because __exit__() must not raise
# an exception unless __exit__() itself failed. But throw()
# has to raise the exception to signal propagation, so this
# fixes the impedance mismatch between the throw() protocol
# and the __exit__() protocol.
#
if sys.exc_info()[1] is not value:
raise
def contextmanager(func):
"""@contextmanager decorator.
Typical usage:
@contextmanager
def some_generator(<arguments>):
<setup>
try:
yield <value>
finally:
<cleanup>
This makes this:
with some_generator(<arguments>) as <variable>:
<body>
equivalent to this:
<setup>
try:
<variable> = <value>
<body>
finally:
<cleanup>
"""
@wraps(func)
def helper(*args, **kwds):
return _GeneratorContextManager(func, *args, **kwds)
return helper
class closing(object):
"""Context to automatically close something at the end of a block.
Code like this:
with closing(<module>.open(<arguments>)) as f:
<block>
is equivalent to this:
f = <module>.open(<arguments>)
try:
<block>
finally:
f.close()
"""
def __init__(self, thing):
self.thing = thing
def __enter__(self):
return self.thing
def __exit__(self, *exc_info):
self.thing.close()
class redirect_stdout:
"""Context manager for temporarily redirecting stdout to another file
# How to send help() to stderr
with redirect_stdout(sys.stderr):
help(dir)
# How to write help() to a file
with open('help.txt', 'w') as f:
with redirect_stdout(f):
help(pow)
"""
def __init__(self, new_target):
self._new_target = new_target
# We use a list of old targets to make this CM re-entrant
self._old_targets = []
def __enter__(self):
self._old_targets.append(sys.stdout)
sys.stdout = self._new_target
return self._new_target
def __exit__(self, exctype, excinst, exctb):
sys.stdout = self._old_targets.pop()
class suppress:
"""Context manager to suppress specified exceptions
After the exception is suppressed, execution proceeds with the next
statement following the with statement.
with suppress(FileNotFoundError):
os.remove(somefile)
# Execution still resumes here if the file was already removed
"""
def __init__(self, *exceptions):
self._exceptions = exceptions
def __enter__(self):
pass
def __exit__(self, exctype, excinst, exctb):
# Unlike isinstance and issubclass, CPython exception handling
# currently only looks at the concrete type hierarchy (ignoring
# the instance and subclass checking hooks). While Guido considers
# that a bug rather than a feature, it's a fairly hard one to fix
# due to various internal implementation details. suppress provides
# the simpler issubclass based semantics, rather than trying to
# exactly reproduce the limitations of the CPython interpreter.
#
# See http://bugs.python.org/issue12029 for more details
return exctype is not None and issubclass(exctype, self._exceptions)
# Inspired by discussions on http://bugs.python.org/issue13585
class ExitStack(object):
"""Context manager for dynamic management of a stack of exit callbacks
For example:
with ExitStack() as stack:
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
# the with statement, even if attempts to open files later
# in the list raise an exception
"""
def __init__(self):
self._exit_callbacks = deque()
def pop_all(self):
"""Preserve the context stack by transferring it to a new instance"""
new_stack = type(self)()
new_stack._exit_callbacks = self._exit_callbacks
self._exit_callbacks = deque()
return new_stack
def _push_cm_exit(self, cm, cm_exit):
"""Helper to correctly register callbacks to __exit__ methods"""
def _exit_wrapper(*exc_details):
return cm_exit(cm, *exc_details)
_exit_wrapper.__self__ = cm
self.push(_exit_wrapper)
def push(self, exit):
"""Registers a callback with the standard __exit__ method signature
Can suppress exceptions the same way __exit__ methods can.
Also accepts any object with an __exit__ method (registering a call
to the method instead of the object itself)
"""
# We use an unbound method rather than a bound method to follow
# the standard lookup behaviour for special methods
_cb_type = type(exit)
try:
exit_method = _cb_type.__exit__
except AttributeError:
# Not a context manager, so assume its a callable
self._exit_callbacks.append(exit)
else:
self._push_cm_exit(exit, exit_method)
return exit # Allow use as a decorator
def callback(self, callback, *args, **kwds):
"""Registers an arbitrary callback and arguments.
Cannot suppress exceptions.
"""
def _exit_wrapper(exc_type, exc, tb):
callback(*args, **kwds)
# We changed the signature, so using @wraps is not appropriate, but
# setting __wrapped__ may still help with introspection
_exit_wrapper.__wrapped__ = callback
self.push(_exit_wrapper)
return callback # Allow use as a decorator
def enter_context(self, cm):
"""Enters the supplied context manager
If successful, also pushes its __exit__ method as a callback and
returns the result of the __enter__ method.
"""
# We look up the special methods on the type to match the with statement
_cm_type = type(cm)
_exit = _cm_type.__exit__
result = _cm_type.__enter__(cm)
self._push_cm_exit(cm, _exit)
return result
def close(self):
"""Immediately unwind the context stack"""
self.__exit__(None, None, None)
def __enter__(self):
return self
def __exit__(self, *exc_details):
received_exc = exc_details[0] is not None
# We manipulate the exception state so it behaves as though
# we were actually nesting multiple with statements
frame_exc = sys.exc_info()[1]
def _fix_exception_context(new_exc, old_exc):
# Context may not be correct, so find the end of the chain
while 1:
exc_context = new_exc.__context__
if exc_context is old_exc:
# Context is already set correctly (see issue 20317)
return
if exc_context is None or exc_context is frame_exc:
break
new_exc = exc_context
# Change the end of the chain to point to the exception
# we expect it to reference
new_exc.__context__ = old_exc
# Callbacks are invoked in LIFO order to match the behaviour of
# nested context managers
suppressed_exc = False
pending_raise = False
while self._exit_callbacks:
cb = self._exit_callbacks.pop()
try:
if cb(*exc_details):
suppressed_exc = True
pending_raise = False
exc_details = (None, None, None)
except:
new_exc_details = sys.exc_info()
# simulate the stack of exceptions by setting the context
_fix_exception_context(new_exc_details[1], exc_details[1])
pending_raise = True
exc_details = new_exc_details
if pending_raise:
try:
# bare "raise exc_details[1]" replaces our carefully
# set-up context
fixed_ctx = exc_details[1].__context__
raise exc_details[1]
except BaseException:
exc_details[1].__context__ = fixed_ctx
raise
return received_exc and suppressed_exc
| lgpl-3.0 | [
624,
22905,
367,
543,
13,
6242,
18191,
14,
221,
1666,
13663,
650,
2824,
1041,
199,
199,
646,
984,
199,
504,
5055,
492,
15782,
199,
504,
9143,
492,
14018,
199,
199,
363,
452,
363,
275,
2097,
14237,
401,
298,
11707,
401,
298,
2998,
14946,
401,
298,
6699,
4851,
401,
1779,
298,
4876,
63,
2703,
401,
298,
17381,
937,
421,
199,
533,
9470,
14946,
8,
785,
304,
272,
298,
33,
1300,
1021,
503,
20048,
626,
22741,
1067,
19680,
370,
1736,
465,
20419,
2122,
339,
347,
485,
264,
981,
63,
4400,
8,
277,
304,
267,
408,
1767,
282,
295,
3966,
1256,
402,
291,
14,
398,
22819,
376,
4257,
1373,
13,
2782,
1067,
5256,
2839,
267,
485,
7599,
2998,
2988,
370,
2291,
675,
465,
267,
282,
7531,
4799,
9227,
295,
8782,
14,
398,
961,
365,
282,
5726,
3217,
2951,
367,
485,
7599,
2998,
2988,
14,
267,
1666,
4976,
327,
845,
8557,
367,
2436,
14,
267,
408,
267,
372,
291,
339,
347,
636,
1250,
721,
277,
12,
2562,
304,
267,
768,
13582,
8,
1532,
9,
267,
347,
6506,
2031,
589,
12,
1011,
10340,
304,
288,
543,
291,
423,
264,
981,
63,
4400,
837,
355,
372,
2562,
2031,
589,
12,
1011,
10340,
9,
267,
372,
6506,
421,
199,
533,
485,
7599,
2998,
2988,
8,
2998,
14946,
304,
272,
408,
4433,
367,
768,
14237,
7531,
1041,
339,
347,
636,
826,
721,
277,
12,
2562,
12,
627,
589,
12,
1011,
10340,
304,
267,
291,
14,
2268,
275,
2562,
2031,
589,
12,
1011,
10340,
9,
267,
291,
14,
1532,
12,
291,
14,
589,
12,
291,
14,
10340,
275,
2562,
12,
1249,
12,
16286,
267,
327,
13383,
5851,
14137,
26,
4868,
1067,
5256,
4454,
1172,
6954,
20964,
267,
1382,
275,
2519,
8,
1532,
12,
4396,
1301,
13915,
488,
9,
267,
340,
1382,
365,
488,
26,
288,
1382,
275,
730,
8,
277,
2843,
1301,
363,
267,
291,
855,
1301,
363,
275,
1382,
267,
327,
31076,
12,
642,
5139,
3181,
1133,
5647,
6954,
1720,
1072,
1380,
267,
327,
6485,
316,
314,
2737,
1067,
5256,
4454,
12,
3967,
29164,
267,
327,
5544,
701,
16027,
314,
1256,
9214,
436,
13703,
314,
9214,
267,
327,
367,
314,
1021,
3140,
14,
267,
327,
1666,
1455,
921,
13017,
14,
1548,
14,
1308,
15,
5237,
1167,
5188,
367,
1655,
2436,
14,
339,
347,
485,
264,
981,
63,
4400,
8,
277,
304,
267,
327,
485,
29009,
4454,
787,
1373,
13,
2782,
1067,
19680,
12,
880,
314,
267,
327,
445,
45,
1471,
506,
295,
3966,
1924,
900,
282,
16225,
805,
365,
267,
327,
2797,
267,
372,
291,
855,
533,
721,
277,
14,
1532,
12,
627,
277,
14,
589,
12,
1011,
277,
14,
10340,
9,
339,
347,
636,
4200,
721,
277,
304,
267,
862,
26,
288,
372,
2163,
8,
277,
14,
2268,
9,
267,
871,
10852,
26,
288,
746,
6064,
480,
4679,
9980,
1133,
1995,
531,
687,
488,
339,
347,
636,
2224,
721,
277,
12,
730,
12,
574,
12,
5190,
304,
267,
340,
730,
365,
488,
26,
288,
862,
26,
355,
2163,
8,
277,
14,
2268,
9,
288,
871,
10852,
26,
355,
372,
288,
587,
26,
355,
746,
6064,
480,
4679,
9980,
1133,
3631,
531,
267,
587,
26,
288,
340,
574,
365,
488,
26,
355,
327,
14012,
370,
3542,
26621,
880,
781,
883,
16492,
6665,
355,
327,
11480,
340,
781,
664,
314,
2011,
1919,
1771,
355,
574,
275,
730,
342,
288,
862,
26,
355,
291,
14,
2268,
14,
11964,
8,
466,
12,
574,
12,
5190,
9,
355,
746,
6064,
480,
4679,
9980,
1133,
3631,
2410,
7978,
16060,
288,
871,
10852,
465,
3178,
26,
355,
327,
26602,
314,
1919,
627,
18447,
10,
652,
1159,
314,
2011,
1919,
626,
355,
327,
1990,
3032,
370,
7978,
1252,
221,
961,
21925,
282,
10852,
355,
327,
4915,
6272,
314,
298,
1045,
2,
5164,
687,
3769,
30581,
355,
372,
3178,
365,
440,
574,
288,
871,
26,
355,
327,
1454,
295,
13,
3730,
340,
652,
1159,
627,
1397,
10,
314,
1919,
626,
1990,
355,
327,
3032,
370,
7978,
1062,
2952,
636,
2224,
4533,
1471,
440,
746,
355,
327,
376,
1919,
7444,
636,
2224,
4533,
6337,
3405,
14,
221,
11017,
7978,
342,
355,
327,
965,
370,
746,
314,
1919,
370,
4673,
17012,
12,
880,
642,
355,
327,
25079,
314,
1742,
379,
554,
15015,
3382,
314,
7978,
342,
4113,
355,
327,
436,
314,
636,
2224,
4533,
4113,
14,
355,
327,
355,
340,
984,
14,
2804,
63,
815,
3430,
17,
61,
365,
440,
574,
26,
490,
746,
421,
199,
318,
27608,
8,
1532,
304,
272,
408,
32,
14237,
7531,
14,
339,
29267,
4503,
26,
398,
768,
14237,
267,
347,
2005,
63,
4679,
27530,
4958,
30,
304,
288,
665,
2758,
30,
288,
862,
26,
355,
1995,
665,
585,
30,
288,
3753,
26,
355,
665,
7661,
30,
339,
961,
7704,
642,
26,
398,
543,
2005,
63,
4679,
27530,
4958,
18956,
465,
665,
1975,
20020,
288,
665,
2030,
30,
339,
7353,
370,
642,
26,
398,
665,
2758,
30,
267,
862,
26,
288,
665,
1975,
30,
275,
665,
585,
30,
288,
665,
2030,
30,
267,
3753,
26,
288,
665,
7661,
30,
339,
408,
272,
768,
13582,
8,
1532,
9,
272,
347,
5922,
2031,
589,
12,
1011,
10340,
304,
267,
372,
485,
7599,
2998,
2988,
8,
1532,
12,
627,
589,
12,
1011,
10340,
9,
272,
372,
5922,
421,
199,
533,
11261,
8,
785,
304,
272,
408,
2998,
370,
5847,
4002,
6020,
737,
314,
1284,
402,
282,
1853,
14,
339,
5495,
2839,
642,
26,
398,
543,
11261,
27530,
578,
10827,
1490,
27530,
4958,
30,
430,
465,
289,
26,
288,
665,
1457,
30,
339,
365,
7353,
370,
642,
26,
398,
289,
275,
665,
578,
10827,
1490,
27530,
4958,
18956,
267,
862,
26,
288,
665,
1457,
30,
267,
3753,
26,
288,
289,
14,
1600,
342,
339,
408,
272,
347,
636,
826,
721,
277,
12,
8377,
304,
267,
291,
14,
2127,
275,
8377,
272,
347,
636,
4200,
721,
277,
304,
267,
372,
291,
14,
2127,
272,
347,
636,
2224,
721,
277,
12,
627,
2804,
63,
815,
304,
267,
291,
14,
2127,
14,
1600,
342,
199,
199,
533,
4660,
63,
2703,
26,
272,
408,
2998,
5256,
367,
22256,
4660,
316,
3839,
370,
4573,
570,
398,
327,
7494,
370,
3222,
1720,
342,
370,
4635,
267,
543,
4660,
63,
2703,
8,
1274,
14,
3083,
304,
288,
1720
] | [
22905,
367,
543,
13,
6242,
18191,
14,
221,
1666,
13663,
650,
2824,
1041,
199,
199,
646,
984,
199,
504,
5055,
492,
15782,
199,
504,
9143,
492,
14018,
199,
199,
363,
452,
363,
275,
2097,
14237,
401,
298,
11707,
401,
298,
2998,
14946,
401,
298,
6699,
4851,
401,
1779,
298,
4876,
63,
2703,
401,
298,
17381,
937,
421,
199,
533,
9470,
14946,
8,
785,
304,
272,
298,
33,
1300,
1021,
503,
20048,
626,
22741,
1067,
19680,
370,
1736,
465,
20419,
2122,
339,
347,
485,
264,
981,
63,
4400,
8,
277,
304,
267,
408,
1767,
282,
295,
3966,
1256,
402,
291,
14,
398,
22819,
376,
4257,
1373,
13,
2782,
1067,
5256,
2839,
267,
485,
7599,
2998,
2988,
370,
2291,
675,
465,
267,
282,
7531,
4799,
9227,
295,
8782,
14,
398,
961,
365,
282,
5726,
3217,
2951,
367,
485,
7599,
2998,
2988,
14,
267,
1666,
4976,
327,
845,
8557,
367,
2436,
14,
267,
408,
267,
372,
291,
339,
347,
636,
1250,
721,
277,
12,
2562,
304,
267,
768,
13582,
8,
1532,
9,
267,
347,
6506,
2031,
589,
12,
1011,
10340,
304,
288,
543,
291,
423,
264,
981,
63,
4400,
837,
355,
372,
2562,
2031,
589,
12,
1011,
10340,
9,
267,
372,
6506,
421,
199,
533,
485,
7599,
2998,
2988,
8,
2998,
14946,
304,
272,
408,
4433,
367,
768,
14237,
7531,
1041,
339,
347,
636,
826,
721,
277,
12,
2562,
12,
627,
589,
12,
1011,
10340,
304,
267,
291,
14,
2268,
275,
2562,
2031,
589,
12,
1011,
10340,
9,
267,
291,
14,
1532,
12,
291,
14,
589,
12,
291,
14,
10340,
275,
2562,
12,
1249,
12,
16286,
267,
327,
13383,
5851,
14137,
26,
4868,
1067,
5256,
4454,
1172,
6954,
20964,
267,
1382,
275,
2519,
8,
1532,
12,
4396,
1301,
13915,
488,
9,
267,
340,
1382,
365,
488,
26,
288,
1382,
275,
730,
8,
277,
2843,
1301,
363,
267,
291,
855,
1301,
363,
275,
1382,
267,
327,
31076,
12,
642,
5139,
3181,
1133,
5647,
6954,
1720,
1072,
1380,
267,
327,
6485,
316,
314,
2737,
1067,
5256,
4454,
12,
3967,
29164,
267,
327,
5544,
701,
16027,
314,
1256,
9214,
436,
13703,
314,
9214,
267,
327,
367,
314,
1021,
3140,
14,
267,
327,
1666,
1455,
921,
13017,
14,
1548,
14,
1308,
15,
5237,
1167,
5188,
367,
1655,
2436,
14,
339,
347,
485,
264,
981,
63,
4400,
8,
277,
304,
267,
327,
485,
29009,
4454,
787,
1373,
13,
2782,
1067,
19680,
12,
880,
314,
267,
327,
445,
45,
1471,
506,
295,
3966,
1924,
900,
282,
16225,
805,
365,
267,
327,
2797,
267,
372,
291,
855,
533,
721,
277,
14,
1532,
12,
627,
277,
14,
589,
12,
1011,
277,
14,
10340,
9,
339,
347,
636,
4200,
721,
277,
304,
267,
862,
26,
288,
372,
2163,
8,
277,
14,
2268,
9,
267,
871,
10852,
26,
288,
746,
6064,
480,
4679,
9980,
1133,
1995,
531,
687,
488,
339,
347,
636,
2224,
721,
277,
12,
730,
12,
574,
12,
5190,
304,
267,
340,
730,
365,
488,
26,
288,
862,
26,
355,
2163,
8,
277,
14,
2268,
9,
288,
871,
10852,
26,
355,
372,
288,
587,
26,
355,
746,
6064,
480,
4679,
9980,
1133,
3631,
531,
267,
587,
26,
288,
340,
574,
365,
488,
26,
355,
327,
14012,
370,
3542,
26621,
880,
781,
883,
16492,
6665,
355,
327,
11480,
340,
781,
664,
314,
2011,
1919,
1771,
355,
574,
275,
730,
342,
288,
862,
26,
355,
291,
14,
2268,
14,
11964,
8,
466,
12,
574,
12,
5190,
9,
355,
746,
6064,
480,
4679,
9980,
1133,
3631,
2410,
7978,
16060,
288,
871,
10852,
465,
3178,
26,
355,
327,
26602,
314,
1919,
627,
18447,
10,
652,
1159,
314,
2011,
1919,
626,
355,
327,
1990,
3032,
370,
7978,
1252,
221,
961,
21925,
282,
10852,
355,
327,
4915,
6272,
314,
298,
1045,
2,
5164,
687,
3769,
30581,
355,
372,
3178,
365,
440,
574,
288,
871,
26,
355,
327,
1454,
295,
13,
3730,
340,
652,
1159,
627,
1397,
10,
314,
1919,
626,
1990,
355,
327,
3032,
370,
7978,
1062,
2952,
636,
2224,
4533,
1471,
440,
746,
355,
327,
376,
1919,
7444,
636,
2224,
4533,
6337,
3405,
14,
221,
11017,
7978,
342,
355,
327,
965,
370,
746,
314,
1919,
370,
4673,
17012,
12,
880,
642,
355,
327,
25079,
314,
1742,
379,
554,
15015,
3382,
314,
7978,
342,
4113,
355,
327,
436,
314,
636,
2224,
4533,
4113,
14,
355,
327,
355,
340,
984,
14,
2804,
63,
815,
3430,
17,
61,
365,
440,
574,
26,
490,
746,
421,
199,
318,
27608,
8,
1532,
304,
272,
408,
32,
14237,
7531,
14,
339,
29267,
4503,
26,
398,
768,
14237,
267,
347,
2005,
63,
4679,
27530,
4958,
30,
304,
288,
665,
2758,
30,
288,
862,
26,
355,
1995,
665,
585,
30,
288,
3753,
26,
355,
665,
7661,
30,
339,
961,
7704,
642,
26,
398,
543,
2005,
63,
4679,
27530,
4958,
18956,
465,
665,
1975,
20020,
288,
665,
2030,
30,
339,
7353,
370,
642,
26,
398,
665,
2758,
30,
267,
862,
26,
288,
665,
1975,
30,
275,
665,
585,
30,
288,
665,
2030,
30,
267,
3753,
26,
288,
665,
7661,
30,
339,
408,
272,
768,
13582,
8,
1532,
9,
272,
347,
5922,
2031,
589,
12,
1011,
10340,
304,
267,
372,
485,
7599,
2998,
2988,
8,
1532,
12,
627,
589,
12,
1011,
10340,
9,
272,
372,
5922,
421,
199,
533,
11261,
8,
785,
304,
272,
408,
2998,
370,
5847,
4002,
6020,
737,
314,
1284,
402,
282,
1853,
14,
339,
5495,
2839,
642,
26,
398,
543,
11261,
27530,
578,
10827,
1490,
27530,
4958,
30,
430,
465,
289,
26,
288,
665,
1457,
30,
339,
365,
7353,
370,
642,
26,
398,
289,
275,
665,
578,
10827,
1490,
27530,
4958,
18956,
267,
862,
26,
288,
665,
1457,
30,
267,
3753,
26,
288,
289,
14,
1600,
342,
339,
408,
272,
347,
636,
826,
721,
277,
12,
8377,
304,
267,
291,
14,
2127,
275,
8377,
272,
347,
636,
4200,
721,
277,
304,
267,
372,
291,
14,
2127,
272,
347,
636,
2224,
721,
277,
12,
627,
2804,
63,
815,
304,
267,
291,
14,
2127,
14,
1600,
342,
199,
199,
533,
4660,
63,
2703,
26,
272,
408,
2998,
5256,
367,
22256,
4660,
316,
3839,
370,
4573,
570,
398,
327,
7494,
370,
3222,
1720,
342,
370,
4635,
267,
543,
4660,
63,
2703,
8,
1274,
14,
3083,
304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1,
1,
1,
1,
1
] |
brianjimenez/lightdock | lightdock/scoring/dfire2/driver.py | 1 | 7814 | """DFIRE2 potential scoring function
Yuedong Yang, Yaoqi Zhou. Ab initio folding of terminal segments with secondary structures
reveals the fine difference between two closely related all-atom statistical energy functions.
Protein Science,17:1212-1219(2008)
"""
import os
import numpy as np
from lightdock.structure.model import DockingModel
from lightdock.scoring.functions import ModelAdapter, ScoringFunction
from lightdock.structure.space import SpacePoints
from lightdock.scoring.dfire2.c.cdfire2 import calculate_dfire2
from lightdock.constants import DEFAULT_CONTACT_RESTRAINTS_CUTOFF
# Potential constants
atom_type_number = 167
bin_number = 30
DFIRE2_ATOM_TYPES = {'GLY CA': 40, 'HIS C': 45, 'VAL O': 137, 'GLY O': 42, 'GLY N': 39, 'HIS O': 46, 'HIS N': 43,
'TRP CE3': 151, 'GLY C': 41, 'TRP CE2': 150, 'LYS NZ': 69, 'MET C': 80, 'VAL N': 134, 'PRO CA': 95,
'MET O': 81, 'MET N': 78, 'SER OG': 126, 'ARG NH2': 120, 'VAL C': 136, 'THR CG2': 133, 'ALA CB': 4,
'ALA CA': 1, 'TRP CG': 146, 'TRP CA': 142, 'TRP CB': 145, 'ALA N': 0, 'ILE CB': 57, 'ILE CA': 54,
'TRP CH2': 154, 'GLU CA': 20, 'GLU CB': 23, 'GLU CD': 25, 'GLU CG': 24, 'HIS CG': 48,
'ASP OD1': 17, 'HIS CA': 44, 'CYS N': 5, 'CYS O': 8, 'HIS CE1': 51, 'TYR CG': 160, 'TYR CA': 156,
'TYR CB': 159, 'CYS C': 7, 'ARG CB': 114, 'LYS C': 63, 'ARG CG': 115, 'ARG CD': 116,
'THR OG1': 132, 'LYS O': 64, 'LYS N': 61, 'SER C': 123, 'ILE CD1': 60, 'PRO CB': 98, 'PRO CD': 100,
'PRO CG': 99, 'ARG CZ': 118, 'SER O': 124, 'SER N': 121, 'PHE CD1': 34, 'PHE CD2': 35,
'THR CA': 128, 'HIS CD2': 50, 'THR CB': 131, 'PRO C': 96, 'PRO N': 94, 'PRO O': 97, 'PHE CA': 29,
'MET CE': 85, 'MET CG': 83, 'MET CA': 79, 'ILE C': 55, 'MET CB': 82, 'TRP CD2': 148,
'TRP CD1': 147, 'GLN CD': 107, 'ILE CG1': 58, 'ILE CG2': 59, 'PHE CE2': 37, 'PHE CE1': 36,
'GLU OE1': 26, 'GLU OE2': 27, 'ASP CG': 16, 'ASP CB': 15, 'ASP CA': 12, 'THR O': 130, 'THR N': 127,
'SER CA': 122, 'SER CB': 125, 'PHE CG': 33, 'GLU O': 22, 'GLU N': 19, 'PHE CB': 32, 'VAL CG1': 139,
'GLU C': 21, 'ILE O': 56, 'ILE N': 53, 'GLN CA': 102, 'GLN CB': 105, 'ASN C': 88, 'VAL CG2': 140,
'TRP CZ2': 152, 'TRP CZ3': 153, 'PHE CZ': 38, 'TRP O': 144, 'TRP N': 141, 'LEU CB': 74,
'GLN N': 101, 'GLN O': 104, 'LEU O': 73, 'GLN C': 103, 'TRP C': 143, 'HIS CB': 47, 'GLN NE2': 109,
'LEU CD2': 77, 'ASP OD2': 18, 'LEU CD1': 76, 'VAL CA': 135, 'ASN OD1': 92, 'ALA O': 3,
'MET SD': 84, 'ALA C': 2, 'THR C': 129, 'TYR CD1': 161, 'ARG NH1': 119, 'TYR CD2': 162,
'ASN ND2': 93, 'TRP NE1': 149, 'HIS ND1': 49, 'LEU C': 72, 'ASN O': 89, 'ASN N': 86, 'ASP C': 13,
'LEU CA': 71, 'ASP O': 14, 'ASP N': 11, 'CYS CB': 9, 'LEU N': 70, 'LEU CG': 75, 'CYS CA': 6,
'TYR OH': 166, 'ASN CA': 87, 'ASN CB': 90, 'ASN CG': 91, 'TYR CE2': 164, 'ARG C': 112,
'TYR CE1': 163, 'HIS NE2': 52, 'ARG O': 113, 'ARG N': 110, 'TYR C': 157, 'GLN CG': 106,
'ARG CA': 111, 'TYR N': 155, 'TYR O': 158, 'CYS SG': 10, 'TYR CZ': 165, 'ARG NE': 117,
'VAL CB': 138, 'LYS CB': 65, 'LYS CA': 62, 'PHE C': 30, 'LYS CG': 66, 'LYS CE': 68, 'LYS CD': 67,
'GLN OE1': 108, 'PHE N': 28, 'PHE O': 31}
class DFIRE2Potential(object):
"""Loads DFIRE2 potentials information"""
def __init__(self):
data_path = os.path.dirname(os.path.realpath(__file__)) + '/data/'
self.energy = np.load(data_path + 'dfire2_energies.npy').ravel()
class DFIRE2Object(object):
def __init__(self, residue_index, atom_index):
self.residue_index = residue_index
self.atom_index = atom_index
class DFIRE2Adapter(ModelAdapter, DFIRE2Potential):
"""Adapts a given Complex to a DockingModel object suitable for this
DFIRE2 scoring function.
"""
def _get_docking_model(self, molecule, restraints):
"""Builds a suitable docking model for this scoring function"""
objects = []
coordinates = []
parsed_restraints = {}
atom_index = 0
for residue in molecule.residues:
for rec_atom in residue.atoms:
rec_atom_type = rec_atom.residue_name + ' ' + rec_atom.name
if rec_atom_type in DFIRE2_ATOM_TYPES:
objects.append(DFIRE2Object(residue.number, DFIRE2_ATOM_TYPES[rec_atom_type]))
coordinates.append([rec_atom.x, rec_atom.y, rec_atom.z])
# Restraints support
res_id = "%s.%s.%s" % (rec_atom.chain_id, residue.name, str(residue.number))
if restraints and res_id in restraints:
try:
parsed_restraints[res_id].append(atom_index)
except:
parsed_restraints[res_id] = [atom_index]
atom_index += 1
try:
return DockingModel(objects, SpacePoints(coordinates), parsed_restraints, n_modes=molecule.n_modes.copy())
except AttributeError:
return DockingModel(objects, SpacePoints(coordinates), parsed_restraints)
class DFIRE2(ScoringFunction):
"""Implements DFIRE2 potential"""
def __init__(self, weight=1.0):
super(DFIRE2, self).__init__(weight)
self.cached = False
self.potential = DFIRE2Potential()
def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
if not self.cached:
self.res_index = []
self.atom_index = []
for o in receptor.objects:
self.res_index.append(o.residue_index)
self.atom_index.append(o.atom_index)
last = self.res_index[-1]
for o in ligand.objects:
self.res_index.append(o.residue_index + last)
self.atom_index.append(o.atom_index)
self.res_index = np.array(self.res_index, dtype=np.int32)
self.atom_index = np.array(self.atom_index, dtype=np.int32)
self.molecule_length = len(self.res_index)
self.cached = True
return self.evaluate_energy(receptor, receptor_coordinates, ligand, ligand_coordinates)
def evaluate_energy(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
coordinates = np.append(receptor_coordinates.coordinates, ligand_coordinates.coordinates).reshape((-1, 3))
energy, interface_receptor, interface_ligand = calculate_dfire2(self.res_index,
self.atom_index,
coordinates,
self.potential.energy,
self.molecule_length,
DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
# Code to consider contacts in the interface
perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, set(interface_receptor))
perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, set(interface_ligand))
return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
# Needed to dynamically load the scoring functions from command line
DefinedScoringFunction = DFIRE2
DefinedModelAdapter = DFIRE2Adapter
| gpl-3.0 | [
624,
36,
1976,
907,
18,
12330,
24153,
805,
199,
199,
57,
11158,
951,
1488,
621,
12,
1488,
8035,
23104,
3107,
11586,
14,
8351,
20364,
4538,
1699,
1098,
402,
11167,
11998,
543,
13851,
13955,
199,
30496,
2551,
314,
15701,
8865,
3382,
2877,
4002,
590,
4048,
1006,
13,
4188,
8753,
270,
2652,
12304,
3423,
14,
199,
919,
15859,
27491,
12,
1196,
26,
25481,
13,
713,
1167,
8,
9300,
9,
199,
624,
199,
199,
646,
747,
199,
646,
2680,
465,
980,
199,
504,
10540,
21103,
14,
6976,
14,
1238,
492,
577,
766,
316,
1685,
199,
504,
10540,
21103,
14,
27128,
14,
5777,
492,
5822,
10200,
12,
428,
20624,
3481,
199,
504,
10540,
21103,
14,
6976,
14,
2638,
492,
19326,
10225,
199,
504,
10540,
21103,
14,
27128,
14,
68,
8935,
18,
14,
67,
14,
2866,
8935,
18,
492,
8671,
63,
68,
8935,
18,
199,
504,
10540,
21103,
14,
5559,
492,
6186,
63,
5801,
3036,
63,
15740,
20029,
51,
63,
24678,
7517,
199,
199,
3,
4376,
9443,
5262,
199,
4188,
63,
466,
63,
1955,
275,
31650,
199,
1393,
63,
1955,
275,
4233,
199,
199,
36,
1976,
907,
18,
63,
22479,
63,
7893,
275,
791,
2226,
57,
7240,
356,
6335,
12,
283,
40,
1311,
445,
356,
10416,
12,
283,
3204,
593,
356,
27750,
12,
283,
2226,
57,
593,
356,
5685,
12,
283,
2226,
57,
653,
356,
10551,
12,
283,
40,
1311,
593,
356,
12426,
12,
283,
40,
1311,
653,
356,
11851,
12,
2151,
283,
1766,
48,
19392,
19,
356,
413,
2869,
12,
283,
2226,
57,
445,
356,
13385,
12,
283,
1766,
48,
19392,
18,
356,
14711,
12,
283,
6084,
51,
653,
58,
356,
14610,
12,
283,
3940,
445,
356,
5939,
12,
283,
3204,
653,
356,
25956,
12,
283,
2514,
7240,
356,
16102,
12,
2151,
283,
3940,
593,
356,
19071,
12,
283,
3940,
653,
356,
14679,
12,
283,
3279,
19746,
356,
21572,
12,
283,
11611,
653,
40,
18,
356,
13960,
12,
283,
3204,
445,
356,
27208,
12,
283,
2080,
50,
18657,
18,
356,
28416,
12,
283,
26674,
445,
34,
356,
841,
12,
2151,
283,
26674,
7240,
356,
413,
12,
283,
1766,
48,
18657,
356,
31263,
12,
283,
1766,
48,
7240,
356,
31308,
12,
283,
1766,
48,
445,
34,
356,
28818,
12,
283,
26674,
653,
356,
378,
12,
283,
8453,
445,
34,
356,
12699,
12,
283,
8453,
7240,
356,
13470,
12,
2151,
283,
1766,
48,
6624,
18,
356,
31693,
12,
283,
20935,
7240,
356,
3388,
12,
283,
20935,
445,
34,
356,
6546,
12,
283,
20935,
445,
36,
356,
5661,
12,
283,
20935,
18657,
356,
5504,
12,
283,
40,
1311,
18657,
356,
9615,
12,
2151,
283,
1179,
48,
593,
36,
17,
356,
5557,
12,
283,
40,
1311,
7240,
356,
10868,
12,
283,
15068,
51,
653,
356,
959,
12,
283,
15068,
51,
593,
356,
1695,
12,
283,
40,
1311,
19392,
17,
356,
8026,
12,
283,
2099,
50,
18657,
356,
21235,
12,
283,
2099,
50,
7240,
356,
32609,
12,
2151,
283,
2099,
50,
445,
34,
356,
413,
1427,
12,
283,
15068,
51,
445,
356,
1520,
12,
283,
11611,
445,
34,
356,
23510,
12,
283,
6084,
51,
445,
356,
13668,
12,
283,
11611,
18657,
356,
22560,
12,
283,
11611,
445,
36,
356,
25186,
12,
2151,
283,
2080,
50,
19746,
17,
356,
27207,
12,
283,
6084,
51,
593,
356,
5049,
12,
283,
6084,
51,
653,
356,
17017,
12,
283,
3279,
445,
356,
11869,
12,
283,
8453,
445,
36,
17,
356,
5212,
12,
283,
2514,
445,
34,
356,
16096,
12,
283,
2514,
445,
36,
356,
2948,
12,
2151,
283,
2514,
18657,
356,
8806,
12,
283,
11611,
445,
58,
356,
25760,
12,
283,
3279,
593,
356,
25442,
12,
283,
3279,
653,
356,
26228,
12,
283,
48,
1645,
445,
36,
17,
356,
8177,
12,
283,
48,
1645,
445,
36,
18,
356,
8685,
12,
2151,
283,
2080,
50,
7240,
356,
7960,
12,
283,
40,
1311,
445,
36,
18,
356,
5238,
12,
283,
2080,
50,
445,
34,
356,
30542,
12,
283,
2514,
445,
356,
15580,
12,
283,
2514,
653,
356,
18729,
12,
283,
2514,
593,
356,
15997,
12,
283,
48,
1645,
7240,
356,
7349,
12,
2151,
283,
3940,
19392,
356,
16412,
12,
283,
3940,
18657,
356,
20582,
12,
283,
3940,
7240,
356,
13734,
12,
283,
8453,
445,
356,
12766,
12,
283,
3940,
445,
34,
356,
18051,
12,
283,
1766,
48,
445,
36,
18,
356,
30300,
12,
2151,
283,
1766,
48,
445,
36,
17,
356,
28513,
12,
283,
2226,
46,
445,
36,
356,
23543,
12,
283,
8453,
18657,
17,
356,
13713,
12,
283,
8453,
18657,
18,
356,
8155,
12,
283,
48,
1645,
19392,
18,
356,
6877,
12,
283,
48,
1645,
19392,
17,
356,
8780,
12,
2151,
283,
20935,
593,
37,
17,
356,
7875,
12,
283,
20935,
593,
37,
18,
356,
8087,
12,
283,
1179,
48,
18657,
356,
3193,
12,
283,
1179,
48,
445,
34,
356,
4114,
12,
283,
1179,
48,
7240,
356,
3144,
12,
283,
2080,
50,
593,
356,
21334,
12,
283,
2080,
50,
653,
356,
12792,
12,
2151,
283,
3279,
7240,
356,
24557,
12,
283,
3279,
445,
34,
356,
19163,
12,
283,
48,
1645,
18657,
356,
9404,
12,
283,
20935,
593,
356,
6928,
12,
283,
20935,
653,
356,
5851,
12,
283,
48,
1645,
445,
34,
356,
4337,
12,
283,
3204,
18657,
17,
356,
22317,
12,
2151,
283,
20935,
445,
356,
7829,
12,
283,
8453,
593,
356,
12001,
12,
283,
8453,
653,
356,
13564,
12,
283,
2226,
46,
7240,
356,
12996,
12,
283,
2226,
46,
445,
34,
356,
20462,
12,
283,
21696,
445,
356,
10523,
12,
283,
3204,
18657,
18,
356,
22796,
12,
2151,
283,
1766,
48,
445,
58,
18,
356,
413,
2528,
12,
283,
1766,
48,
445,
58,
19,
356,
25828,
12,
283,
48,
1645,
445,
58,
356,
10448,
12,
283,
1766,
48,
593,
356,
21771,
12,
283,
1766,
48,
653,
356,
413,
2953,
12,
283,
23391,
445,
34,
356,
9720,
12,
2151,
283,
2226,
46,
653,
356,
14313,
12,
283,
2226,
46,
593,
356,
21083,
12,
283,
23391,
593,
356,
18525,
12,
283,
2226,
46,
445,
356,
22363,
12,
283,
1766,
48,
445,
356,
29235,
12,
283,
40,
1311,
445,
34,
356,
10954,
12,
283,
2226,
46,
7110,
18,
356,
24058,
12,
2151,
283,
23391,
445,
36,
18,
356,
8375,
12,
283,
1179,
48,
593,
36,
18,
356,
6155,
12,
283
] | [
36,
1976,
907,
18,
12330,
24153,
805,
199,
199,
57,
11158,
951,
1488,
621,
12,
1488,
8035,
23104,
3107,
11586,
14,
8351,
20364,
4538,
1699,
1098,
402,
11167,
11998,
543,
13851,
13955,
199,
30496,
2551,
314,
15701,
8865,
3382,
2877,
4002,
590,
4048,
1006,
13,
4188,
8753,
270,
2652,
12304,
3423,
14,
199,
919,
15859,
27491,
12,
1196,
26,
25481,
13,
713,
1167,
8,
9300,
9,
199,
624,
199,
199,
646,
747,
199,
646,
2680,
465,
980,
199,
504,
10540,
21103,
14,
6976,
14,
1238,
492,
577,
766,
316,
1685,
199,
504,
10540,
21103,
14,
27128,
14,
5777,
492,
5822,
10200,
12,
428,
20624,
3481,
199,
504,
10540,
21103,
14,
6976,
14,
2638,
492,
19326,
10225,
199,
504,
10540,
21103,
14,
27128,
14,
68,
8935,
18,
14,
67,
14,
2866,
8935,
18,
492,
8671,
63,
68,
8935,
18,
199,
504,
10540,
21103,
14,
5559,
492,
6186,
63,
5801,
3036,
63,
15740,
20029,
51,
63,
24678,
7517,
199,
199,
3,
4376,
9443,
5262,
199,
4188,
63,
466,
63,
1955,
275,
31650,
199,
1393,
63,
1955,
275,
4233,
199,
199,
36,
1976,
907,
18,
63,
22479,
63,
7893,
275,
791,
2226,
57,
7240,
356,
6335,
12,
283,
40,
1311,
445,
356,
10416,
12,
283,
3204,
593,
356,
27750,
12,
283,
2226,
57,
593,
356,
5685,
12,
283,
2226,
57,
653,
356,
10551,
12,
283,
40,
1311,
593,
356,
12426,
12,
283,
40,
1311,
653,
356,
11851,
12,
2151,
283,
1766,
48,
19392,
19,
356,
413,
2869,
12,
283,
2226,
57,
445,
356,
13385,
12,
283,
1766,
48,
19392,
18,
356,
14711,
12,
283,
6084,
51,
653,
58,
356,
14610,
12,
283,
3940,
445,
356,
5939,
12,
283,
3204,
653,
356,
25956,
12,
283,
2514,
7240,
356,
16102,
12,
2151,
283,
3940,
593,
356,
19071,
12,
283,
3940,
653,
356,
14679,
12,
283,
3279,
19746,
356,
21572,
12,
283,
11611,
653,
40,
18,
356,
13960,
12,
283,
3204,
445,
356,
27208,
12,
283,
2080,
50,
18657,
18,
356,
28416,
12,
283,
26674,
445,
34,
356,
841,
12,
2151,
283,
26674,
7240,
356,
413,
12,
283,
1766,
48,
18657,
356,
31263,
12,
283,
1766,
48,
7240,
356,
31308,
12,
283,
1766,
48,
445,
34,
356,
28818,
12,
283,
26674,
653,
356,
378,
12,
283,
8453,
445,
34,
356,
12699,
12,
283,
8453,
7240,
356,
13470,
12,
2151,
283,
1766,
48,
6624,
18,
356,
31693,
12,
283,
20935,
7240,
356,
3388,
12,
283,
20935,
445,
34,
356,
6546,
12,
283,
20935,
445,
36,
356,
5661,
12,
283,
20935,
18657,
356,
5504,
12,
283,
40,
1311,
18657,
356,
9615,
12,
2151,
283,
1179,
48,
593,
36,
17,
356,
5557,
12,
283,
40,
1311,
7240,
356,
10868,
12,
283,
15068,
51,
653,
356,
959,
12,
283,
15068,
51,
593,
356,
1695,
12,
283,
40,
1311,
19392,
17,
356,
8026,
12,
283,
2099,
50,
18657,
356,
21235,
12,
283,
2099,
50,
7240,
356,
32609,
12,
2151,
283,
2099,
50,
445,
34,
356,
413,
1427,
12,
283,
15068,
51,
445,
356,
1520,
12,
283,
11611,
445,
34,
356,
23510,
12,
283,
6084,
51,
445,
356,
13668,
12,
283,
11611,
18657,
356,
22560,
12,
283,
11611,
445,
36,
356,
25186,
12,
2151,
283,
2080,
50,
19746,
17,
356,
27207,
12,
283,
6084,
51,
593,
356,
5049,
12,
283,
6084,
51,
653,
356,
17017,
12,
283,
3279,
445,
356,
11869,
12,
283,
8453,
445,
36,
17,
356,
5212,
12,
283,
2514,
445,
34,
356,
16096,
12,
283,
2514,
445,
36,
356,
2948,
12,
2151,
283,
2514,
18657,
356,
8806,
12,
283,
11611,
445,
58,
356,
25760,
12,
283,
3279,
593,
356,
25442,
12,
283,
3279,
653,
356,
26228,
12,
283,
48,
1645,
445,
36,
17,
356,
8177,
12,
283,
48,
1645,
445,
36,
18,
356,
8685,
12,
2151,
283,
2080,
50,
7240,
356,
7960,
12,
283,
40,
1311,
445,
36,
18,
356,
5238,
12,
283,
2080,
50,
445,
34,
356,
30542,
12,
283,
2514,
445,
356,
15580,
12,
283,
2514,
653,
356,
18729,
12,
283,
2514,
593,
356,
15997,
12,
283,
48,
1645,
7240,
356,
7349,
12,
2151,
283,
3940,
19392,
356,
16412,
12,
283,
3940,
18657,
356,
20582,
12,
283,
3940,
7240,
356,
13734,
12,
283,
8453,
445,
356,
12766,
12,
283,
3940,
445,
34,
356,
18051,
12,
283,
1766,
48,
445,
36,
18,
356,
30300,
12,
2151,
283,
1766,
48,
445,
36,
17,
356,
28513,
12,
283,
2226,
46,
445,
36,
356,
23543,
12,
283,
8453,
18657,
17,
356,
13713,
12,
283,
8453,
18657,
18,
356,
8155,
12,
283,
48,
1645,
19392,
18,
356,
6877,
12,
283,
48,
1645,
19392,
17,
356,
8780,
12,
2151,
283,
20935,
593,
37,
17,
356,
7875,
12,
283,
20935,
593,
37,
18,
356,
8087,
12,
283,
1179,
48,
18657,
356,
3193,
12,
283,
1179,
48,
445,
34,
356,
4114,
12,
283,
1179,
48,
7240,
356,
3144,
12,
283,
2080,
50,
593,
356,
21334,
12,
283,
2080,
50,
653,
356,
12792,
12,
2151,
283,
3279,
7240,
356,
24557,
12,
283,
3279,
445,
34,
356,
19163,
12,
283,
48,
1645,
18657,
356,
9404,
12,
283,
20935,
593,
356,
6928,
12,
283,
20935,
653,
356,
5851,
12,
283,
48,
1645,
445,
34,
356,
4337,
12,
283,
3204,
18657,
17,
356,
22317,
12,
2151,
283,
20935,
445,
356,
7829,
12,
283,
8453,
593,
356,
12001,
12,
283,
8453,
653,
356,
13564,
12,
283,
2226,
46,
7240,
356,
12996,
12,
283,
2226,
46,
445,
34,
356,
20462,
12,
283,
21696,
445,
356,
10523,
12,
283,
3204,
18657,
18,
356,
22796,
12,
2151,
283,
1766,
48,
445,
58,
18,
356,
413,
2528,
12,
283,
1766,
48,
445,
58,
19,
356,
25828,
12,
283,
48,
1645,
445,
58,
356,
10448,
12,
283,
1766,
48,
593,
356,
21771,
12,
283,
1766,
48,
653,
356,
413,
2953,
12,
283,
23391,
445,
34,
356,
9720,
12,
2151,
283,
2226,
46,
653,
356,
14313,
12,
283,
2226,
46,
593,
356,
21083,
12,
283,
23391,
593,
356,
18525,
12,
283,
2226,
46,
445,
356,
22363,
12,
283,
1766,
48,
445,
356,
29235,
12,
283,
40,
1311,
445,
34,
356,
10954,
12,
283,
2226,
46,
7110,
18,
356,
24058,
12,
2151,
283,
23391,
445,
36,
18,
356,
8375,
12,
283,
1179,
48,
593,
36,
18,
356,
6155,
12,
283,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
Osokorn/tgstation | tools/midi2piano/pyperclip/windows.py | 110 | 5405 | """
This module implements clipboard handling on Windows using ctypes.
"""
import time
import contextlib
import ctypes
from ctypes import c_size_t, sizeof, c_wchar_p, get_errno, c_wchar
from .exceptions import PyperclipWindowsException
class CheckedCall(object):
def __init__(self, f):
super(CheckedCall, self).__setattr__("f", f)
def __call__(self, *args):
ret = self.f(*args)
if not ret and get_errno():
raise PyperclipWindowsException("Error calling " + self.f.__name__)
return ret
def __setattr__(self, key, value):
setattr(self.f, key, value)
def init_windows_clipboard():
from ctypes.wintypes import (HGLOBAL, LPVOID, DWORD, LPCSTR, INT, HWND,
HINSTANCE, HMENU, BOOL, UINT, HANDLE)
windll = ctypes.windll
safeCreateWindowExA = CheckedCall(windll.user32.CreateWindowExA)
safeCreateWindowExA.argtypes = [DWORD, LPCSTR, LPCSTR, DWORD, INT, INT,
INT, INT, HWND, HMENU, HINSTANCE, LPVOID]
safeCreateWindowExA.restype = HWND
safeDestroyWindow = CheckedCall(windll.user32.DestroyWindow)
safeDestroyWindow.argtypes = [HWND]
safeDestroyWindow.restype = BOOL
OpenClipboard = windll.user32.OpenClipboard
OpenClipboard.argtypes = [HWND]
OpenClipboard.restype = BOOL
safeCloseClipboard = CheckedCall(windll.user32.CloseClipboard)
safeCloseClipboard.argtypes = []
safeCloseClipboard.restype = BOOL
safeEmptyClipboard = CheckedCall(windll.user32.EmptyClipboard)
safeEmptyClipboard.argtypes = []
safeEmptyClipboard.restype = BOOL
safeGetClipboardData = CheckedCall(windll.user32.GetClipboardData)
safeGetClipboardData.argtypes = [UINT]
safeGetClipboardData.restype = HANDLE
safeSetClipboardData = CheckedCall(windll.user32.SetClipboardData)
safeSetClipboardData.argtypes = [UINT, HANDLE]
safeSetClipboardData.restype = HANDLE
safeGlobalAlloc = CheckedCall(windll.kernel32.GlobalAlloc)
safeGlobalAlloc.argtypes = [UINT, c_size_t]
safeGlobalAlloc.restype = HGLOBAL
safeGlobalLock = CheckedCall(windll.kernel32.GlobalLock)
safeGlobalLock.argtypes = [HGLOBAL]
safeGlobalLock.restype = LPVOID
safeGlobalUnlock = CheckedCall(windll.kernel32.GlobalUnlock)
safeGlobalUnlock.argtypes = [HGLOBAL]
safeGlobalUnlock.restype = BOOL
GMEM_MOVEABLE = 0x0002
CF_UNICODETEXT = 13
@contextlib.contextmanager
def window():
"""
Context that provides a valid Windows hwnd.
"""
# we really just need the hwnd, so setting "STATIC"
# as predefined lpClass is just fine.
hwnd = safeCreateWindowExA(0, b"STATIC", None, 0, 0, 0, 0, 0,
None, None, None, None)
try:
yield hwnd
finally:
safeDestroyWindow(hwnd)
@contextlib.contextmanager
def clipboard(hwnd):
"""
Context manager that opens the clipboard and prevents
other applications from modifying the clipboard content.
"""
# We may not get the clipboard handle immediately because
# some other application is accessing it (?)
# We try for at least 500ms to get the clipboard.
t = time.time() + 0.5
success = False
while time.time() < t:
success = OpenClipboard(hwnd)
if success:
break
time.sleep(0.01)
if not success:
raise PyperclipWindowsException("Error calling OpenClipboard")
try:
yield
finally:
safeCloseClipboard()
def copy_windows(text):
# This function is heavily based on
# http://msdn.com/ms649016#_win32_Copying_Information_to_the_Clipboard
with window() as hwnd:
# http://msdn.com/ms649048
# If an application calls OpenClipboard with hwnd set to NULL,
# EmptyClipboard sets the clipboard owner to NULL;
# this causes SetClipboardData to fail.
# => We need a valid hwnd to copy something.
with clipboard(hwnd):
safeEmptyClipboard()
if text:
# http://msdn.com/ms649051
# If the hMem parameter identifies a memory object,
# the object must have been allocated using the
# function with the GMEM_MOVEABLE flag.
count = len(text) + 1
handle = safeGlobalAlloc(GMEM_MOVEABLE,
count * sizeof(c_wchar))
locked_handle = safeGlobalLock(handle)
ctypes.memmove(c_wchar_p(locked_handle), c_wchar_p(text), count * sizeof(c_wchar))
safeGlobalUnlock(handle)
safeSetClipboardData(CF_UNICODETEXT, handle)
def paste_windows():
with clipboard(None):
handle = safeGetClipboardData(CF_UNICODETEXT)
if not handle:
# GetClipboardData may return NULL with errno == NO_ERROR
# if the clipboard is empty.
# (Also, it may return a handle to an empty buffer,
# but technically that's not empty)
return ""
return c_wchar_p(handle).value
return copy_windows, paste_windows
| agpl-3.0 | [
624,
199,
2765,
859,
9031,
11353,
3576,
7252,
641,
5417,
1808,
5577,
14,
199,
624,
199,
646,
900,
199,
646,
15502,
199,
646,
5577,
199,
504,
5577,
492,
286,
63,
890,
63,
84,
12,
13855,
12,
286,
63,
23118,
63,
80,
12,
664,
63,
7931,
12,
286,
63,
23118,
199,
504,
1275,
3924,
492,
1611,
529,
7548,
8647,
1726,
421,
199,
533,
2670,
379,
2176,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
289,
304,
267,
1613,
8,
14627,
2176,
12,
291,
2843,
10202,
29093,
70,
401,
289,
9,
339,
347,
636,
1250,
721,
277,
12,
627,
589,
304,
267,
2203,
275,
291,
14,
70,
2031,
589,
9,
267,
340,
440,
2203,
436,
664,
63,
7931,
837,
288,
746,
1611,
529,
7548,
8647,
1726,
480,
547,
6358,
298,
435,
291,
14,
70,
855,
354,
3368,
267,
372,
2203,
339,
347,
636,
10202,
721,
277,
12,
790,
12,
574,
304,
267,
5371,
8,
277,
14,
70,
12,
790,
12,
574,
9,
421,
199,
318,
4205,
63,
8258,
63,
7548,
3576,
837,
272,
687,
5577,
14,
27171,
492,
334,
40,
13808,
12,
21738,
17510,
12,
13936,
12,
491,
4222,
3027,
12,
16429,
12,
869,
30597,
12,
639,
869,
18235,
12,
869,
18223,
12,
25849,
12,
30151,
12,
23276,
906,
9,
339,
22350,
275,
5577,
14,
25522,
339,
5048,
2499,
4301,
920,
33,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
2499,
4301,
920,
33,
9,
272,
5048,
2499,
4301,
920,
33,
14,
10025,
275,
359,
24754,
12,
491,
4222,
3027,
12,
491,
4222,
3027,
12,
13936,
12,
16429,
12,
16429,
12,
2511,
16429,
12,
16429,
12,
869,
30597,
12,
869,
18223,
12,
869,
18235,
12,
21738,
17510,
61,
272,
5048,
2499,
4301,
920,
33,
14,
9990,
275,
869,
30597,
339,
5048,
14704,
4301,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
14704,
4301,
9,
272,
5048,
14704,
4301,
14,
10025,
275,
359,
40,
30597,
61,
272,
5048,
14704,
4301,
14,
9990,
275,
25849,
339,
3232,
28459,
275,
22350,
14,
751,
708,
14,
4299,
28459,
272,
3232,
28459,
14,
10025,
275,
359,
40,
30597,
61,
272,
3232,
28459,
14,
9990,
275,
25849,
339,
5048,
4724,
28459,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
4724,
28459,
9,
272,
5048,
4724,
28459,
14,
10025,
275,
942,
272,
5048,
4724,
28459,
14,
9990,
275,
25849,
339,
5048,
4699,
28459,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
4699,
28459,
9,
272,
5048,
4699,
28459,
14,
10025,
275,
942,
272,
5048,
4699,
28459,
14,
9990,
275,
25849,
339,
5048,
1002,
28459,
1451,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
1002,
28459,
1451,
9,
272,
5048,
1002,
28459,
1451,
14,
10025,
275,
359,
17459,
61,
272,
5048,
1002,
28459,
1451,
14,
9990,
275,
23276,
906,
339,
5048,
1084,
28459,
1451,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
1084,
28459,
1451,
9,
272,
5048,
1084,
28459,
1451,
14,
10025,
275,
359,
17459,
12,
23276,
906,
61,
272,
5048,
1084,
28459,
1451,
14,
9990,
275,
23276,
906,
339,
5048,
7025,
2439,
2102,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
2439,
2102,
9,
272,
5048,
7025,
2439,
2102,
14,
10025,
275,
359,
17459,
12,
286,
63,
890,
63,
84,
61,
272,
5048,
7025,
2439,
2102,
14,
9990,
275,
869,
13808,
339,
5048,
7025,
6432,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
6432,
9,
272,
5048,
7025,
6432,
14,
10025,
275,
359,
40,
13808,
61,
272,
5048,
7025,
6432,
14,
9990,
275,
21738,
17510,
339,
5048,
7025,
1358,
831,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
1358,
831,
9,
272,
5048,
7025,
1358,
831,
14,
10025,
275,
359,
40,
13808,
61,
272,
5048,
7025,
1358,
831,
14,
9990,
275,
25849,
339,
598,
10293,
63,
16207,
2617,
275,
378,
88,
9425,
272,
6035,
63,
11580,
47,
17442,
2472,
275,
4944,
339,
768,
23464,
14,
14237,
272,
347,
4353,
837,
267,
408,
267,
9470,
626,
6571,
282,
1686,
5417,
12073,
977,
14,
267,
408,
267,
327,
781,
7710,
2951,
1929,
314,
12073,
977,
12,
880,
4260,
298,
10449,
2,
267,
327,
465,
27684,
13204,
2543,
365,
2951,
15701,
14,
267,
12073,
977,
275,
5048,
2499,
4301,
920,
33,
8,
16,
12,
330,
2,
10449,
401,
488,
12,
378,
12,
378,
12,
378,
12,
378,
12,
378,
12,
3521,
488,
12,
488,
12,
488,
12,
488,
9,
267,
862,
26,
288,
1995,
12073,
977,
267,
3753,
26,
288,
5048,
14704,
4301,
8,
8090,
977,
9,
339,
768,
23464,
14,
14237,
272,
347,
11353,
3576,
8,
8090,
977,
304,
267,
408,
267,
9470,
5256,
626,
30848,
314,
11353,
3576,
436,
21925,
267,
1163,
13103,
687,
24662,
314,
11353,
3576,
1564,
14,
267,
408,
267,
327,
2136,
1443,
440,
664,
314,
11353,
3576,
2429,
9939,
2952,
267,
327,
2005,
1163,
4223,
365,
18549,
652,
7558,
9,
267,
327,
2136,
862,
367,
737,
5210,
6891,
706,
370,
664,
314,
11353,
3576,
14,
267,
307,
275,
900,
14,
521,
342,
435,
378,
14,
21,
267,
3182,
275,
756,
267,
1830,
900,
14,
521,
342,
665,
307,
26,
288,
3182,
275,
3232,
28459,
8,
8090,
977,
9,
288,
340,
3182,
26,
355,
2059,
288,
900,
14,
4532,
8,
16,
14,
614,
9,
267,
340,
440,
3182,
26,
288,
746,
1611,
529,
7548,
8647,
1726,
480,
547,
6358,
3232,
28459,
531,
398,
862,
26,
288,
1995,
267,
3753,
26,
288,
5048,
4724,
28459,
342,
339,
347,
1331,
63,
8258,
8,
505,
304,
267,
327,
961,
805,
365,
946,
1214,
3444,
4079,
641,
267,
327,
1455,
921,
706,
4272,
14,
957,
15,
706,
11228,
10882,
20930,
2676,
708,
63,
32596,
63,
4935,
63,
475,
63,
1589,
63,
28459,
267,
543,
4353,
342,
465,
12073,
977,
26,
288,
327,
1455,
921,
706,
4272,
14,
957,
15,
706,
11228,
9941,
288,
327,
982,
376,
4223,
4882,
3232,
28459,
543,
12073,
977,
663,
370,
5962,
12,
288,
327,
9630,
28459,
5951,
314,
11353,
3576,
5771,
370,
5962,
27,
288,
327,
642,
14486,
2494,
28459,
1451,
370,
2449,
14,
288,
327,
9265,
2136,
1929,
282,
1686,
12073,
977,
370,
1331,
6020,
14,
288,
543,
11353,
3576,
8,
8090,
977,
304,
355
] | [
199,
2765,
859,
9031,
11353,
3576,
7252,
641,
5417,
1808,
5577,
14,
199,
624,
199,
646,
900,
199,
646,
15502,
199,
646,
5577,
199,
504,
5577,
492,
286,
63,
890,
63,
84,
12,
13855,
12,
286,
63,
23118,
63,
80,
12,
664,
63,
7931,
12,
286,
63,
23118,
199,
504,
1275,
3924,
492,
1611,
529,
7548,
8647,
1726,
421,
199,
533,
2670,
379,
2176,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
289,
304,
267,
1613,
8,
14627,
2176,
12,
291,
2843,
10202,
29093,
70,
401,
289,
9,
339,
347,
636,
1250,
721,
277,
12,
627,
589,
304,
267,
2203,
275,
291,
14,
70,
2031,
589,
9,
267,
340,
440,
2203,
436,
664,
63,
7931,
837,
288,
746,
1611,
529,
7548,
8647,
1726,
480,
547,
6358,
298,
435,
291,
14,
70,
855,
354,
3368,
267,
372,
2203,
339,
347,
636,
10202,
721,
277,
12,
790,
12,
574,
304,
267,
5371,
8,
277,
14,
70,
12,
790,
12,
574,
9,
421,
199,
318,
4205,
63,
8258,
63,
7548,
3576,
837,
272,
687,
5577,
14,
27171,
492,
334,
40,
13808,
12,
21738,
17510,
12,
13936,
12,
491,
4222,
3027,
12,
16429,
12,
869,
30597,
12,
639,
869,
18235,
12,
869,
18223,
12,
25849,
12,
30151,
12,
23276,
906,
9,
339,
22350,
275,
5577,
14,
25522,
339,
5048,
2499,
4301,
920,
33,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
2499,
4301,
920,
33,
9,
272,
5048,
2499,
4301,
920,
33,
14,
10025,
275,
359,
24754,
12,
491,
4222,
3027,
12,
491,
4222,
3027,
12,
13936,
12,
16429,
12,
16429,
12,
2511,
16429,
12,
16429,
12,
869,
30597,
12,
869,
18223,
12,
869,
18235,
12,
21738,
17510,
61,
272,
5048,
2499,
4301,
920,
33,
14,
9990,
275,
869,
30597,
339,
5048,
14704,
4301,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
14704,
4301,
9,
272,
5048,
14704,
4301,
14,
10025,
275,
359,
40,
30597,
61,
272,
5048,
14704,
4301,
14,
9990,
275,
25849,
339,
3232,
28459,
275,
22350,
14,
751,
708,
14,
4299,
28459,
272,
3232,
28459,
14,
10025,
275,
359,
40,
30597,
61,
272,
3232,
28459,
14,
9990,
275,
25849,
339,
5048,
4724,
28459,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
4724,
28459,
9,
272,
5048,
4724,
28459,
14,
10025,
275,
942,
272,
5048,
4724,
28459,
14,
9990,
275,
25849,
339,
5048,
4699,
28459,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
4699,
28459,
9,
272,
5048,
4699,
28459,
14,
10025,
275,
942,
272,
5048,
4699,
28459,
14,
9990,
275,
25849,
339,
5048,
1002,
28459,
1451,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
1002,
28459,
1451,
9,
272,
5048,
1002,
28459,
1451,
14,
10025,
275,
359,
17459,
61,
272,
5048,
1002,
28459,
1451,
14,
9990,
275,
23276,
906,
339,
5048,
1084,
28459,
1451,
275,
2670,
379,
2176,
8,
25522,
14,
751,
708,
14,
1084,
28459,
1451,
9,
272,
5048,
1084,
28459,
1451,
14,
10025,
275,
359,
17459,
12,
23276,
906,
61,
272,
5048,
1084,
28459,
1451,
14,
9990,
275,
23276,
906,
339,
5048,
7025,
2439,
2102,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
2439,
2102,
9,
272,
5048,
7025,
2439,
2102,
14,
10025,
275,
359,
17459,
12,
286,
63,
890,
63,
84,
61,
272,
5048,
7025,
2439,
2102,
14,
9990,
275,
869,
13808,
339,
5048,
7025,
6432,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
6432,
9,
272,
5048,
7025,
6432,
14,
10025,
275,
359,
40,
13808,
61,
272,
5048,
7025,
6432,
14,
9990,
275,
21738,
17510,
339,
5048,
7025,
1358,
831,
275,
2670,
379,
2176,
8,
25522,
14,
4989,
708,
14,
7025,
1358,
831,
9,
272,
5048,
7025,
1358,
831,
14,
10025,
275,
359,
40,
13808,
61,
272,
5048,
7025,
1358,
831,
14,
9990,
275,
25849,
339,
598,
10293,
63,
16207,
2617,
275,
378,
88,
9425,
272,
6035,
63,
11580,
47,
17442,
2472,
275,
4944,
339,
768,
23464,
14,
14237,
272,
347,
4353,
837,
267,
408,
267,
9470,
626,
6571,
282,
1686,
5417,
12073,
977,
14,
267,
408,
267,
327,
781,
7710,
2951,
1929,
314,
12073,
977,
12,
880,
4260,
298,
10449,
2,
267,
327,
465,
27684,
13204,
2543,
365,
2951,
15701,
14,
267,
12073,
977,
275,
5048,
2499,
4301,
920,
33,
8,
16,
12,
330,
2,
10449,
401,
488,
12,
378,
12,
378,
12,
378,
12,
378,
12,
378,
12,
3521,
488,
12,
488,
12,
488,
12,
488,
9,
267,
862,
26,
288,
1995,
12073,
977,
267,
3753,
26,
288,
5048,
14704,
4301,
8,
8090,
977,
9,
339,
768,
23464,
14,
14237,
272,
347,
11353,
3576,
8,
8090,
977,
304,
267,
408,
267,
9470,
5256,
626,
30848,
314,
11353,
3576,
436,
21925,
267,
1163,
13103,
687,
24662,
314,
11353,
3576,
1564,
14,
267,
408,
267,
327,
2136,
1443,
440,
664,
314,
11353,
3576,
2429,
9939,
2952,
267,
327,
2005,
1163,
4223,
365,
18549,
652,
7558,
9,
267,
327,
2136,
862,
367,
737,
5210,
6891,
706,
370,
664,
314,
11353,
3576,
14,
267,
307,
275,
900,
14,
521,
342,
435,
378,
14,
21,
267,
3182,
275,
756,
267,
1830,
900,
14,
521,
342,
665,
307,
26,
288,
3182,
275,
3232,
28459,
8,
8090,
977,
9,
288,
340,
3182,
26,
355,
2059,
288,
900,
14,
4532,
8,
16,
14,
614,
9,
267,
340,
440,
3182,
26,
288,
746,
1611,
529,
7548,
8647,
1726,
480,
547,
6358,
3232,
28459,
531,
398,
862,
26,
288,
1995,
267,
3753,
26,
288,
5048,
4724,
28459,
342,
339,
347,
1331,
63,
8258,
8,
505,
304,
267,
327,
961,
805,
365,
946,
1214,
3444,
4079,
641,
267,
327,
1455,
921,
706,
4272,
14,
957,
15,
706,
11228,
10882,
20930,
2676,
708,
63,
32596,
63,
4935,
63,
475,
63,
1589,
63,
28459,
267,
543,
4353,
342,
465,
12073,
977,
26,
288,
327,
1455,
921,
706,
4272,
14,
957,
15,
706,
11228,
9941,
288,
327,
982,
376,
4223,
4882,
3232,
28459,
543,
12073,
977,
663,
370,
5962,
12,
288,
327,
9630,
28459,
5951,
314,
11353,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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
] |
MediaBrowser/MediaBrowser.Kodi | default.py | 2 | 1454 | '''
@document : default.py
@package : XBMB3C add-on
@authors : xnappo, null_pointer, im85288
@copyleft : 2013, xnappo
@license : Gnu General Public License - see LICENSE.TXT
@description: XBMB3C XBMC add-on
This file is part of the XBMC XBMB3C Plugin.
XBMB3C Plugin 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.
XBMB3C Plugin 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 XBMB3C Plugin. If not, see <http://www.gnu.org/licenses/>.
Thanks to Hippojay for the PleXBMC plugin this is derived from
'''
import xbmcgui
import xbmcaddon
import os
__settings__ = xbmcaddon.Addon(id='plugin.video.xbmb3c')
__cwd__ = __settings__.getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) )
sys.path.append(BASE_RESOURCE_PATH)
import MainModule
try:
MainModule.MainEntryPoint()
except Exception, msg:
xbmcgui.Dialog().ok("Error", str(msg))
raise
| gpl-2.0 | [
2344,
272,
768,
3554,
257,
520,
849,
14,
647,
272,
768,
2491,
259,
520,
1323,
34,
4567,
19,
35,
1050,
13,
265,
272,
768,
8149,
259,
520,
671,
2542,
555,
12,
2973,
63,
3929,
12,
3416,
2426,
10740,
272,
768,
1574,
3039,
257,
520,
6171,
12,
671,
2542,
555,
339,
768,
1682,
259,
520,
598,
4850,
1696,
1684,
844,
446,
1937,
5113,
14,
17715,
272,
768,
1802,
26,
1323,
34,
4567,
19,
35,
1323,
28994,
1050,
13,
265,
339,
961,
570,
365,
1777,
402,
314,
1323,
28994,
1323,
34,
4567,
19,
35,
11349,
14,
339,
1323,
34,
4567,
19,
35,
11349,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
272,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
272,
314,
2868,
2290,
2752,
12,
1902,
1015,
499,
402,
314,
844,
12,
503,
272,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
339,
1323,
34,
4567,
19,
35,
11349,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
272,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
272,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
272,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
339,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
272,
3180,
543,
1323,
34,
4567,
19,
35,
11349,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
2286,
3868,
25088,
370,
869,
711,
555,
74,
1187,
367,
314,
510,
274,
20806,
7608,
3589,
642,
365,
7131,
687,
199,
199,
2344,
199,
199,
646,
26418,
199,
646,
11709,
9291,
199,
646,
747,
199,
199,
363,
1751,
363,
275,
11709,
9291,
14,
19654,
8,
344,
534,
2718,
14,
3722,
14,
1774,
887,
19,
67,
358,
199,
363,
6525,
363,
275,
636,
1751,
4343,
362,
19654,
2354,
360,
515,
358,
199,
5825,
63,
14110,
63,
3243,
275,
11709,
14,
5275,
2042,
8,
747,
14,
515,
14,
904,
8,
636,
6525,
3108,
283,
4435,
297,
283,
773,
7,
776,
776,
199,
1274,
14,
515,
14,
740,
8,
5825,
63,
14110,
63,
3243,
9,
199,
199,
646,
11298,
2377,
199,
199,
893,
26,
272,
11298,
2377,
14,
6756,
30485,
342,
199,
2590,
2186,
12,
1499,
26,
272,
26418,
14,
5619,
1252,
745,
480,
547,
401,
620,
8,
1328,
430,
3322,
272,
746,
26339,
1362,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] | [
272,
768,
3554,
257,
520,
849,
14,
647,
272,
768,
2491,
259,
520,
1323,
34,
4567,
19,
35,
1050,
13,
265,
272,
768,
8149,
259,
520,
671,
2542,
555,
12,
2973,
63,
3929,
12,
3416,
2426,
10740,
272,
768,
1574,
3039,
257,
520,
6171,
12,
671,
2542,
555,
339,
768,
1682,
259,
520,
598,
4850,
1696,
1684,
844,
446,
1937,
5113,
14,
17715,
272,
768,
1802,
26,
1323,
34,
4567,
19,
35,
1323,
28994,
1050,
13,
265,
339,
961,
570,
365,
1777,
402,
314,
1323,
28994,
1323,
34,
4567,
19,
35,
11349,
14,
339,
1323,
34,
4567,
19,
35,
11349,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
272,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
272,
314,
2868,
2290,
2752,
12,
1902,
1015,
499,
402,
314,
844,
12,
503,
272,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
339,
1323,
34,
4567,
19,
35,
11349,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
272,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
272,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
272,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
339,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
272,
3180,
543,
1323,
34,
4567,
19,
35,
11349,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
2286,
3868,
25088,
370,
869,
711,
555,
74,
1187,
367,
314,
510,
274,
20806,
7608,
3589,
642,
365,
7131,
687,
199,
199,
2344,
199,
199,
646,
26418,
199,
646,
11709,
9291,
199,
646,
747,
199,
199,
363,
1751,
363,
275,
11709,
9291,
14,
19654,
8,
344,
534,
2718,
14,
3722,
14,
1774,
887,
19,
67,
358,
199,
363,
6525,
363,
275,
636,
1751,
4343,
362,
19654,
2354,
360,
515,
358,
199,
5825,
63,
14110,
63,
3243,
275,
11709,
14,
5275,
2042,
8,
747,
14,
515,
14,
904,
8,
636,
6525,
3108,
283,
4435,
297,
283,
773,
7,
776,
776,
199,
1274,
14,
515,
14,
740,
8,
5825,
63,
14110,
63,
3243,
9,
199,
199,
646,
11298,
2377,
199,
199,
893,
26,
272,
11298,
2377,
14,
6756,
30485,
342,
199,
2590,
2186,
12,
1499,
26,
272,
26418,
14,
5619,
1252,
745,
480,
547,
401,
620,
8,
1328,
430,
3322,
272,
746,
26339,
1362,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,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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
] |
moraesnicol/scrapy | scrapy/settings/deprecated.py | 160 | 1383 | import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
DEPRECATED_SETTINGS = [
('TRACK_REFS', 'no longer needed (trackref is always enabled)'),
('RESPONSE_CLASSES', 'no longer supported'),
('DEFAULT_RESPONSE_ENCODING', 'no longer supported'),
('BOT_VERSION', 'no longer used (user agent defaults to Scrapy now)'),
('ENCODING_ALIASES', 'no longer needed (encoding discovery uses w3lib now)'),
('STATS_ENABLED', 'no longer supported (change STATS_CLASS instead)'),
('SQLITE_DB', 'no longer supported'),
('SELECTORS_BACKEND', 'use SCRAPY_SELECTORS_BACKEND environment variable instead'),
('AUTOTHROTTLE_MIN_DOWNLOAD_DELAY', 'use DOWNLOAD_DELAY instead'),
('AUTOTHROTTLE_MAX_CONCURRENCY', 'use CONCURRENT_REQUESTS_PER_DOMAIN instead'),
('AUTOTHROTTLE_MAX_CONCURRENCY', 'use CONCURRENT_REQUESTS_PER_DOMAIN instead'),
('REDIRECT_MAX_METAREFRESH_DELAY', 'use METAREFRESH_MAXDELAY instead'),
]
def check_deprecated_settings(settings):
deprecated = [x for x in DEPRECATED_SETTINGS if settings[x[0]] is not None]
if deprecated:
msg = "You are using the following settings which are deprecated or obsolete"
msg += " (ask scrapy-users@googlegroups.com for alternatives):"
msg = msg + "\n " + "\n ".join("%s: %s" % x for x in deprecated)
warnings.warn(msg, ScrapyDeprecationWarning)
| bsd-3-clause | [
646,
3598,
199,
504,
18918,
14,
3924,
492,
13916,
345,
647,
15561,
199,
199,
25832,
63,
13931,
275,
359,
272,
661,
19755,
63,
907,
7079,
297,
283,
889,
8088,
4346,
334,
3885,
1121,
365,
3544,
5223,
11218,
272,
661,
12801,
63,
13748,
297,
283,
889,
8088,
3748,
659,
272,
661,
3472,
63,
12801,
63,
16314,
297,
283,
889,
8088,
3748,
659,
272,
661,
11372,
63,
4612,
297,
283,
889,
8088,
1202,
334,
751,
6631,
4243,
370,
13916,
345,
647,
3063,
11218,
272,
661,
16314,
63,
12644,
654,
297,
283,
889,
8088,
4346,
334,
2991,
13172,
4440,
336,
19,
773,
3063,
11218,
272,
661,
19202,
63,
15704,
297,
283,
889,
8088,
3748,
334,
1461,
13146,
51,
63,
6885,
3140,
11218,
272,
661,
4657,
4427,
63,
2846,
297,
283,
889,
8088,
3748,
659,
272,
661,
4859,
4149,
63,
18145,
297,
283,
1180,
428,
2944,
1282,
57,
63,
4859,
4149,
63,
18145,
3734,
1750,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4896,
63,
24930,
63,
18616,
297,
283,
1180,
10163,
7405,
63,
18616,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4283,
63,
1864,
7013,
24861,
297,
283,
1180,
1868,
14211,
63,
6780,
51,
63,
4227,
63,
7378,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4283,
63,
1864,
7013,
24861,
297,
283,
1180,
1868,
14211,
63,
6780,
51,
63,
4227,
63,
7378,
3140,
659,
272,
661,
19747,
63,
4283,
63,
3940,
8693,
38,
15098,
63,
18616,
297,
283,
1180,
19357,
8693,
38,
15098,
63,
4283,
18616,
3140,
659,
199,
61,
421,
199,
318,
1104,
63,
6667,
63,
1751,
8,
1751,
304,
272,
5906,
275,
359,
88,
367,
671,
315,
31404,
63,
13931,
340,
2202,
59,
88,
59,
16,
2677,
365,
440,
488,
61,
272,
340,
5906,
26,
267,
1499,
275,
298,
5556,
787,
1808,
314,
2569,
2202,
1314,
787,
5906,
503,
24985,
2,
267,
1499,
847,
298,
334,
813,
18918,
13,
3707,
32,
3098,
2634,
14,
957,
367,
8679,
10661,
304,
2,
267,
1499,
275,
1499,
435,
1867,
78,
259,
298,
435,
1867,
78,
259,
3680,
904,
3647,
83,
26,
450,
83,
2,
450,
671,
367,
671,
315,
5906,
9,
267,
3598,
14,
4050,
8,
1328,
12,
13916,
345,
647,
15561,
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
] | [
3598,
199,
504,
18918,
14,
3924,
492,
13916,
345,
647,
15561,
199,
199,
25832,
63,
13931,
275,
359,
272,
661,
19755,
63,
907,
7079,
297,
283,
889,
8088,
4346,
334,
3885,
1121,
365,
3544,
5223,
11218,
272,
661,
12801,
63,
13748,
297,
283,
889,
8088,
3748,
659,
272,
661,
3472,
63,
12801,
63,
16314,
297,
283,
889,
8088,
3748,
659,
272,
661,
11372,
63,
4612,
297,
283,
889,
8088,
1202,
334,
751,
6631,
4243,
370,
13916,
345,
647,
3063,
11218,
272,
661,
16314,
63,
12644,
654,
297,
283,
889,
8088,
4346,
334,
2991,
13172,
4440,
336,
19,
773,
3063,
11218,
272,
661,
19202,
63,
15704,
297,
283,
889,
8088,
3748,
334,
1461,
13146,
51,
63,
6885,
3140,
11218,
272,
661,
4657,
4427,
63,
2846,
297,
283,
889,
8088,
3748,
659,
272,
661,
4859,
4149,
63,
18145,
297,
283,
1180,
428,
2944,
1282,
57,
63,
4859,
4149,
63,
18145,
3734,
1750,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4896,
63,
24930,
63,
18616,
297,
283,
1180,
10163,
7405,
63,
18616,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4283,
63,
1864,
7013,
24861,
297,
283,
1180,
1868,
14211,
63,
6780,
51,
63,
4227,
63,
7378,
3140,
659,
272,
661,
10774,
22949,
1092,
1481,
906,
63,
4283,
63,
1864,
7013,
24861,
297,
283,
1180,
1868,
14211,
63,
6780,
51,
63,
4227,
63,
7378,
3140,
659,
272,
661,
19747,
63,
4283,
63,
3940,
8693,
38,
15098,
63,
18616,
297,
283,
1180,
19357,
8693,
38,
15098,
63,
4283,
18616,
3140,
659,
199,
61,
421,
199,
318,
1104,
63,
6667,
63,
1751,
8,
1751,
304,
272,
5906,
275,
359,
88,
367,
671,
315,
31404,
63,
13931,
340,
2202,
59,
88,
59,
16,
2677,
365,
440,
488,
61,
272,
340,
5906,
26,
267,
1499,
275,
298,
5556,
787,
1808,
314,
2569,
2202,
1314,
787,
5906,
503,
24985,
2,
267,
1499,
847,
298,
334,
813,
18918,
13,
3707,
32,
3098,
2634,
14,
957,
367,
8679,
10661,
304,
2,
267,
1499,
275,
1499,
435,
1867,
78,
259,
298,
435,
1867,
78,
259,
3680,
904,
3647,
83,
26,
450,
83,
2,
450,
671,
367,
671,
315,
5906,
9,
267,
3598,
14,
4050,
8,
1328,
12,
13916,
345,
647,
15561,
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,
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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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
liaorubei/depot_tools | third_party/pylint/checkers/similar.py | 64 | 14174 | # pylint: disable=W0622
# Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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.
"""a similarities / code duplication command line tool and pylint checker
"""
from __future__ import print_function
import sys
from collections import defaultdict
from logilab.common.ureports import Table
from pylint.interfaces import IRawChecker
from pylint.checkers import BaseChecker, table_lines_from_stats
import six
from six.moves import zip
class Similar(object):
"""finds copy-pasted lines of code in a project"""
def __init__(self, min_lines=4, ignore_comments=False,
ignore_docstrings=False, ignore_imports=False):
self.min_lines = min_lines
self.ignore_comments = ignore_comments
self.ignore_docstrings = ignore_docstrings
self.ignore_imports = ignore_imports
self.linesets = []
def append_stream(self, streamid, stream, encoding=None):
"""append a file to search for similarities"""
if encoding is None:
readlines = stream.readlines
else:
readlines = lambda: [line.decode(encoding) for line in stream]
try:
self.linesets.append(LineSet(streamid,
readlines(),
self.ignore_comments,
self.ignore_docstrings,
self.ignore_imports))
except UnicodeDecodeError:
pass
def run(self):
"""start looking for similarities and display results on stdout"""
self._display_sims(self._compute_sims())
def _compute_sims(self):
"""compute similarities in appended files"""
no_duplicates = defaultdict(list)
for num, lineset1, idx1, lineset2, idx2 in self._iter_sims():
duplicate = no_duplicates[num]
for couples in duplicate:
if (lineset1, idx1) in couples or (lineset2, idx2) in couples:
couples.add((lineset1, idx1))
couples.add((lineset2, idx2))
break
else:
duplicate.append(set([(lineset1, idx1), (lineset2, idx2)]))
sims = []
for num, ensembles in six.iteritems(no_duplicates):
for couples in ensembles:
sims.append((num, couples))
sims.sort()
sims.reverse()
return sims
def _display_sims(self, sims):
"""display computed similarities on stdout"""
nb_lignes_dupliquees = 0
for num, couples in sims:
print()
print(num, "similar lines in", len(couples), "files")
couples = sorted(couples)
for lineset, idx in couples:
print("==%s:%s" % (lineset.name, idx))
# pylint: disable=W0631
for line in lineset._real_lines[idx:idx+num]:
print(" ", line.rstrip())
nb_lignes_dupliquees += num * (len(couples)-1)
nb_total_lignes = sum([len(lineset) for lineset in self.linesets])
print("TOTAL lines=%s duplicates=%s percent=%.2f" \
% (nb_total_lignes, nb_lignes_dupliquees,
nb_lignes_dupliquees*100. / nb_total_lignes))
def _find_common(self, lineset1, lineset2):
"""find similarities in the two given linesets"""
lines1 = lineset1.enumerate_stripped
lines2 = lineset2.enumerate_stripped
find = lineset2.find
index1 = 0
min_lines = self.min_lines
while index1 < len(lineset1):
skip = 1
num = 0
for index2 in find(lineset1[index1]):
non_blank = 0
for num, ((_, line1), (_, line2)) in enumerate(
zip(lines1(index1), lines2(index2))):
if line1 != line2:
if non_blank > min_lines:
yield num, lineset1, index1, lineset2, index2
skip = max(skip, num)
break
if line1:
non_blank += 1
else:
# we may have reach the end
num += 1
if non_blank > min_lines:
yield num, lineset1, index1, lineset2, index2
skip = max(skip, num)
index1 += skip
def _iter_sims(self):
"""iterate on similarities among all files, by making a cartesian
product
"""
for idx, lineset in enumerate(self.linesets[:-1]):
for lineset2 in self.linesets[idx+1:]:
for sim in self._find_common(lineset, lineset2):
yield sim
def stripped_lines(lines, ignore_comments, ignore_docstrings, ignore_imports):
"""return lines with leading/trailing whitespace and any ignored code
features removed
"""
strippedlines = []
docstring = None
for line in lines:
line = line.strip()
if ignore_docstrings:
if not docstring and \
(line.startswith('"""') or line.startswith("'''")):
docstring = line[:3]
line = line[3:]
if docstring:
if line.endswith(docstring):
docstring = None
line = ''
if ignore_imports:
if line.startswith("import ") or line.startswith("from "):
line = ''
if ignore_comments:
# XXX should use regex in checkers/format to avoid cutting
# at a "#" in a string
line = line.split('#', 1)[0].strip()
strippedlines.append(line)
return strippedlines
class LineSet(object):
"""Holds and indexes all the lines of a single source file"""
def __init__(self, name, lines, ignore_comments=False,
ignore_docstrings=False, ignore_imports=False):
self.name = name
self._real_lines = lines
self._stripped_lines = stripped_lines(lines, ignore_comments,
ignore_docstrings,
ignore_imports)
self._index = self._mk_index()
def __str__(self):
return '<Lineset for %s>' % self.name
def __len__(self):
return len(self._real_lines)
def __getitem__(self, index):
return self._stripped_lines[index]
def __lt__(self, other):
return self.name < other.name
def __hash__(self):
return id(self)
def enumerate_stripped(self, start_at=0):
"""return an iterator on stripped lines, starting from a given index
if specified, else 0
"""
idx = start_at
if start_at:
lines = self._stripped_lines[start_at:]
else:
lines = self._stripped_lines
for line in lines:
#if line:
yield idx, line
idx += 1
def find(self, stripped_line):
"""return positions of the given stripped line in this set"""
return self._index.get(stripped_line, ())
def _mk_index(self):
"""create the index for this set"""
index = defaultdict(list)
for line_no, line in enumerate(self._stripped_lines):
if line:
index[line].append(line_no)
return index
MSGS = {'R0801': ('Similar lines in %s files\n%s',
'duplicate-code',
'Indicates that a set of similar lines has been detected \
among multiple file. This usually means that the code should \
be refactored to avoid this duplication.')}
def report_similarities(sect, stats, old_stats):
"""make a layout with some stats about duplication"""
lines = ['', 'now', 'previous', 'difference']
lines += table_lines_from_stats(stats, old_stats,
('nb_duplicated_lines',
'percent_duplicated_lines'))
sect.append(Table(children=lines, cols=4, rheaders=1, cheaders=1))
# wrapper to get a pylint checker from the similar class
class SimilarChecker(BaseChecker, Similar):
"""checks for similarities and duplicated code. This computation may be
memory / CPU intensive, so you should disable it if you experiment some
problems.
"""
__implements__ = (IRawChecker,)
# configuration section name
name = 'similarities'
# messages
msgs = MSGS
# configuration options
# for available dict keys/values see the optik parser 'add_option' method
options = (('min-similarity-lines',
{'default' : 4, 'type' : "int", 'metavar' : '<int>',
'help' : 'Minimum lines number of a similarity.'}),
('ignore-comments',
{'default' : True, 'type' : 'yn', 'metavar' : '<y or n>',
'help': 'Ignore comments when computing similarities.'}
),
('ignore-docstrings',
{'default' : True, 'type' : 'yn', 'metavar' : '<y or n>',
'help': 'Ignore docstrings when computing similarities.'}
),
('ignore-imports',
{'default' : False, 'type' : 'yn', 'metavar' : '<y or n>',
'help': 'Ignore imports when computing similarities.'}
),
)
# reports
reports = (('RP0801', 'Duplication', report_similarities),)
def __init__(self, linter=None):
BaseChecker.__init__(self, linter)
Similar.__init__(self, min_lines=4,
ignore_comments=True, ignore_docstrings=True)
self.stats = None
def set_option(self, optname, value, action=None, optdict=None):
"""method called to set an option (registered in the options list)
overridden to report options setting to Similar
"""
BaseChecker.set_option(self, optname, value, action, optdict)
if optname == 'min-similarity-lines':
self.min_lines = self.config.min_similarity_lines
elif optname == 'ignore-comments':
self.ignore_comments = self.config.ignore_comments
elif optname == 'ignore-docstrings':
self.ignore_docstrings = self.config.ignore_docstrings
elif optname == 'ignore-imports':
self.ignore_imports = self.config.ignore_imports
def open(self):
"""init the checkers: reset linesets and statistics information"""
self.linesets = []
self.stats = self.linter.add_stats(nb_duplicated_lines=0,
percent_duplicated_lines=0)
def process_module(self, node):
"""process a module
the module's content is accessible via the stream object
stream must implement the readlines method
"""
with node.stream() as stream:
self.append_stream(self.linter.current_name,
stream,
node.file_encoding)
def close(self):
"""compute and display similarities on closing (i.e. end of parsing)"""
total = sum([len(lineset) for lineset in self.linesets])
duplicated = 0
stats = self.stats
for num, couples in self._compute_sims():
msg = []
for lineset, idx in couples:
msg.append("==%s:%s" % (lineset.name, idx))
msg.sort()
# pylint: disable=W0631
for line in lineset._real_lines[idx:idx+num]:
msg.append(line.rstrip())
self.add_message('R0801', args=(len(couples), '\n'.join(msg)))
duplicated += num * (len(couples) - 1)
stats['nb_duplicated_lines'] = duplicated
stats['percent_duplicated_lines'] = total and duplicated * 100. / total
def register(linter):
"""required method to auto register this checker """
linter.register_checker(SimilarChecker(linter))
def usage(status=0):
"""display command line usage information"""
print("finds copy pasted blocks in a set of files")
print()
print('Usage: symilar [-d|--duplicates min_duplicated_lines] \
[-i|--ignore-comments] [--ignore-docstrings] [--ignore-imports] file1...')
sys.exit(status)
def Run(argv=None):
"""standalone command line access point"""
if argv is None:
argv = sys.argv[1:]
from getopt import getopt
s_opts = 'hdi'
l_opts = ('help', 'duplicates=', 'ignore-comments', 'ignore-imports',
'ignore-docstrings')
min_lines = 4
ignore_comments = False
ignore_docstrings = False
ignore_imports = False
opts, args = getopt(argv, s_opts, l_opts)
for opt, val in opts:
if opt in ('-d', '--duplicates'):
min_lines = int(val)
elif opt in ('-h', '--help'):
usage()
elif opt in ('-i', '--ignore-comments'):
ignore_comments = True
elif opt in ('--ignore-docstrings',):
ignore_docstrings = True
elif opt in ('--ignore-imports',):
ignore_imports = True
if not args:
usage(1)
sim = Similar(min_lines, ignore_comments, ignore_docstrings, ignore_imports)
for filename in args:
with open(filename) as stream:
sim.append_stream(filename, stream)
sim.run()
sys.exit(0)
if __name__ == '__main__':
Run()
| bsd-3-clause | [
3,
4287,
26,
3507,
29,
55,
1690,
1081,
199,
3,
1898,
334,
67,
9,
8353,
13,
6965,
5051,
1193,
1217,
428,
14,
33,
14,
334,
1262,
374,
12,
28671,
7140,
680,
199,
3,
1455,
921,
1544,
14,
793,
24142,
14,
4391,
15,
1553,
6016,
475,
26,
7811,
32,
793,
24142,
14,
4391,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
652,
1334,
199,
3,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
314,
2868,
2290,
199,
3,
2752,
27,
1902,
1015,
499,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
199,
3,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
2428,
199,
3,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
3169,
503,
3092,
199,
3,
2381,
437,
3115,
3104,
14,
1666,
314,
1664,
1696,
1684,
844,
367,
1655,
2436,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
3180,
543,
199,
3,
642,
2240,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
199,
3,
8026,
11236,
14259,
12,
12066,
11844,
12,
8226,
12,
4828,
11315,
13,
10067,
12,
8217,
14,
199,
624,
65,
4389,
382,
27894,
1182,
1233,
11866,
1863,
1414,
1004,
4744,
436,
4287,
7739,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
646,
984,
199,
504,
5055,
492,
10018,
199,
199,
504,
943,
24142,
14,
2330,
14,
608,
5203,
492,
6957,
199,
199,
504,
4287,
14,
7436,
492,
473,
7963,
3048,
199,
504,
4287,
14,
32514,
492,
3523,
3048,
12,
1817,
63,
1278,
63,
504,
63,
3200,
199,
199,
646,
3816,
199,
504,
3816,
14,
4912,
492,
3482,
421,
199,
533,
20046,
8,
785,
304,
272,
408,
1623,
83,
1331,
13,
15534,
471,
2385,
402,
1233,
315,
282,
2199,
624,
339,
347,
636,
826,
721,
277,
12,
1748,
63,
1278,
29,
20,
12,
3686,
63,
6223,
29,
797,
12,
326,
3686,
63,
1301,
5465,
29,
797,
12,
3686,
63,
12775,
29,
797,
304,
267,
291,
14,
827,
63,
1278,
275,
1748,
63,
1278,
267,
291,
14,
4247,
63,
6223,
275,
3686,
63,
6223,
267,
291,
14,
4247,
63,
1301,
5465,
275,
3686,
63,
1301,
5465,
267,
291,
14,
4247,
63,
12775,
275,
3686,
63,
12775,
267,
291,
14,
604,
2193,
275,
942,
339,
347,
5666,
63,
1745,
8,
277,
12,
2547,
344,
12,
2547,
12,
2644,
29,
403,
304,
267,
408,
740,
282,
570,
370,
2754,
367,
4389,
382,
27894,
624,
267,
340,
2644,
365,
488,
26,
288,
1586,
1278,
275,
2547,
14,
9684,
267,
587,
26,
288,
1586,
1278,
275,
2400,
26,
359,
604,
14,
2708,
8,
2991,
9,
367,
1004,
315,
2547,
61,
267,
862,
26,
288,
291,
14,
604,
2193,
14,
740,
8,
3049,
1084,
8,
1745,
344,
12,
1460,
1586,
1278,
1062,
1460,
291,
14,
4247,
63,
6223,
12,
1460,
291,
14,
4247,
63,
1301,
5465,
12,
1460,
291,
14,
4247,
63,
12775,
430,
267,
871,
18965,
26,
288,
986,
339,
347,
1255,
8,
277,
304,
267,
408,
928,
10023,
367,
4389,
382,
27894,
436,
2929,
2058,
641,
3839,
624,
267,
291,
423,
2918,
63,
338,
706,
8,
277,
423,
3357,
63,
338,
706,
1012,
339,
347,
485,
3357,
63,
338,
706,
8,
277,
304,
267,
408,
3357,
4389,
382,
27894,
315,
11544,
1584,
624,
267,
949,
63,
18563,
275,
10018,
8,
513,
9,
267,
367,
1967,
12,
1004,
409,
17,
12,
4280,
17,
12,
1004,
409,
18,
12,
4280,
18,
315,
291,
423,
1661,
63,
338,
706,
837,
288,
9250,
275,
949,
63,
18563,
59,
1507,
61,
288,
367,
17535,
83,
315,
9250,
26,
355,
340,
334,
604,
409,
17,
12,
4280,
17,
9,
315,
17535,
83,
503,
334,
604,
409,
18,
12,
4280,
18,
9,
315,
17535,
83,
26,
490,
17535,
83,
14,
525,
1332,
604,
409,
17,
12,
4280,
17,
430,
490,
17535,
83,
14,
525,
1332,
604,
409,
18,
12,
4280,
18,
430,
490,
2059,
288,
587,
26,
355,
9250,
14,
740,
8,
409,
7694,
604,
409,
17,
12,
4280,
17,
395,
334,
604,
409,
18,
12,
4280,
18,
19563,
267,
308,
11171,
275,
942,
267,
367,
1967,
12,
19965,
83,
315,
3816,
14,
4611,
8,
889,
63,
18563,
304,
288,
367,
17535,
83,
315,
19965,
83,
26,
355,
308,
11171,
14,
740,
1332,
1507,
12,
17535,
83,
430,
267,
308,
11171,
14,
3191,
342,
267,
308,
11171,
14,
4471,
342,
267,
372,
308,
11171,
339,
347,
485,
2918,
63,
338,
706,
8,
277,
12,
308,
11171,
304,
267,
408,
2918,
9235,
4389,
382,
27894,
641,
3839,
624,
267,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
275,
378,
267,
367,
1967,
12,
17535,
83,
315,
308,
11171,
26,
288,
870,
342,
288,
870,
8,
1507,
12,
298,
23079,
2385,
315,
401,
822,
8,
17600,
83,
395,
298,
1725,
531,
288,
17535,
83,
275,
3355,
8,
17600,
83,
9,
288,
367,
1004,
409,
12,
4280,
315,
17535,
83,
26,
355,
870,
480,
389,
5,
83,
2689,
83,
2,
450,
334,
604,
409,
14,
354,
12,
4280,
430,
288,
327,
4287,
26,
3507,
29,
55,
1690,
2192,
288,
367,
1004,
315,
1004,
409,
423,
3093,
63,
1278,
59,
2996,
26,
2996,
11,
1507,
2189,
355,
870,
480,
221,
3872,
1004,
14,
6735,
1012,
288,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
847,
1967,
627,
334,
552,
8,
17600,
83,
7216,
17,
9,
267,
8526,
63,
2923,
63,
317,
784,
397,
275,
3089,
779,
552,
8,
604,
409,
9,
367,
1004,
409,
315,
291,
14,
604,
2193,
566,
267,
870,
480,
15386,
2385,
2458,
83,
15755,
2458,
83,
8878,
2458,
14,
18,
70,
2,
971,
288,
450,
334,
4994,
63,
2923,
63,
317,
784,
397,
12,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
12,
2049,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
10,
1960,
14,
1182,
8526,
63,
2923,
63,
317,
784,
397,
430,
339,
347,
485,
1623,
63,
2330,
8,
277,
12,
1004,
409,
17,
12,
1004,
409,
18,
304,
267,
408,
1623,
4389,
382,
27894,
315
] | [
4287,
26,
3507,
29,
55,
1690,
1081,
199,
3,
1898,
334,
67,
9,
8353,
13,
6965,
5051,
1193,
1217,
428,
14,
33,
14,
334,
1262,
374,
12,
28671,
7140,
680,
199,
3,
1455,
921,
1544,
14,
793,
24142,
14,
4391,
15,
1553,
6016,
475,
26,
7811,
32,
793,
24142,
14,
4391,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
652,
1334,
199,
3,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
314,
2868,
2290,
199,
3,
2752,
27,
1902,
1015,
499,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
199,
3,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
2428,
199,
3,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
3169,
503,
3092,
199,
3,
2381,
437,
3115,
3104,
14,
1666,
314,
1664,
1696,
1684,
844,
367,
1655,
2436,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
3180,
543,
199,
3,
642,
2240,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
199,
3,
8026,
11236,
14259,
12,
12066,
11844,
12,
8226,
12,
4828,
11315,
13,
10067,
12,
8217,
14,
199,
624,
65,
4389,
382,
27894,
1182,
1233,
11866,
1863,
1414,
1004,
4744,
436,
4287,
7739,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
646,
984,
199,
504,
5055,
492,
10018,
199,
199,
504,
943,
24142,
14,
2330,
14,
608,
5203,
492,
6957,
199,
199,
504,
4287,
14,
7436,
492,
473,
7963,
3048,
199,
504,
4287,
14,
32514,
492,
3523,
3048,
12,
1817,
63,
1278,
63,
504,
63,
3200,
199,
199,
646,
3816,
199,
504,
3816,
14,
4912,
492,
3482,
421,
199,
533,
20046,
8,
785,
304,
272,
408,
1623,
83,
1331,
13,
15534,
471,
2385,
402,
1233,
315,
282,
2199,
624,
339,
347,
636,
826,
721,
277,
12,
1748,
63,
1278,
29,
20,
12,
3686,
63,
6223,
29,
797,
12,
326,
3686,
63,
1301,
5465,
29,
797,
12,
3686,
63,
12775,
29,
797,
304,
267,
291,
14,
827,
63,
1278,
275,
1748,
63,
1278,
267,
291,
14,
4247,
63,
6223,
275,
3686,
63,
6223,
267,
291,
14,
4247,
63,
1301,
5465,
275,
3686,
63,
1301,
5465,
267,
291,
14,
4247,
63,
12775,
275,
3686,
63,
12775,
267,
291,
14,
604,
2193,
275,
942,
339,
347,
5666,
63,
1745,
8,
277,
12,
2547,
344,
12,
2547,
12,
2644,
29,
403,
304,
267,
408,
740,
282,
570,
370,
2754,
367,
4389,
382,
27894,
624,
267,
340,
2644,
365,
488,
26,
288,
1586,
1278,
275,
2547,
14,
9684,
267,
587,
26,
288,
1586,
1278,
275,
2400,
26,
359,
604,
14,
2708,
8,
2991,
9,
367,
1004,
315,
2547,
61,
267,
862,
26,
288,
291,
14,
604,
2193,
14,
740,
8,
3049,
1084,
8,
1745,
344,
12,
1460,
1586,
1278,
1062,
1460,
291,
14,
4247,
63,
6223,
12,
1460,
291,
14,
4247,
63,
1301,
5465,
12,
1460,
291,
14,
4247,
63,
12775,
430,
267,
871,
18965,
26,
288,
986,
339,
347,
1255,
8,
277,
304,
267,
408,
928,
10023,
367,
4389,
382,
27894,
436,
2929,
2058,
641,
3839,
624,
267,
291,
423,
2918,
63,
338,
706,
8,
277,
423,
3357,
63,
338,
706,
1012,
339,
347,
485,
3357,
63,
338,
706,
8,
277,
304,
267,
408,
3357,
4389,
382,
27894,
315,
11544,
1584,
624,
267,
949,
63,
18563,
275,
10018,
8,
513,
9,
267,
367,
1967,
12,
1004,
409,
17,
12,
4280,
17,
12,
1004,
409,
18,
12,
4280,
18,
315,
291,
423,
1661,
63,
338,
706,
837,
288,
9250,
275,
949,
63,
18563,
59,
1507,
61,
288,
367,
17535,
83,
315,
9250,
26,
355,
340,
334,
604,
409,
17,
12,
4280,
17,
9,
315,
17535,
83,
503,
334,
604,
409,
18,
12,
4280,
18,
9,
315,
17535,
83,
26,
490,
17535,
83,
14,
525,
1332,
604,
409,
17,
12,
4280,
17,
430,
490,
17535,
83,
14,
525,
1332,
604,
409,
18,
12,
4280,
18,
430,
490,
2059,
288,
587,
26,
355,
9250,
14,
740,
8,
409,
7694,
604,
409,
17,
12,
4280,
17,
395,
334,
604,
409,
18,
12,
4280,
18,
19563,
267,
308,
11171,
275,
942,
267,
367,
1967,
12,
19965,
83,
315,
3816,
14,
4611,
8,
889,
63,
18563,
304,
288,
367,
17535,
83,
315,
19965,
83,
26,
355,
308,
11171,
14,
740,
1332,
1507,
12,
17535,
83,
430,
267,
308,
11171,
14,
3191,
342,
267,
308,
11171,
14,
4471,
342,
267,
372,
308,
11171,
339,
347,
485,
2918,
63,
338,
706,
8,
277,
12,
308,
11171,
304,
267,
408,
2918,
9235,
4389,
382,
27894,
641,
3839,
624,
267,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
275,
378,
267,
367,
1967,
12,
17535,
83,
315,
308,
11171,
26,
288,
870,
342,
288,
870,
8,
1507,
12,
298,
23079,
2385,
315,
401,
822,
8,
17600,
83,
395,
298,
1725,
531,
288,
17535,
83,
275,
3355,
8,
17600,
83,
9,
288,
367,
1004,
409,
12,
4280,
315,
17535,
83,
26,
355,
870,
480,
389,
5,
83,
2689,
83,
2,
450,
334,
604,
409,
14,
354,
12,
4280,
430,
288,
327,
4287,
26,
3507,
29,
55,
1690,
2192,
288,
367,
1004,
315,
1004,
409,
423,
3093,
63,
1278,
59,
2996,
26,
2996,
11,
1507,
2189,
355,
870,
480,
221,
3872,
1004,
14,
6735,
1012,
288,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
847,
1967,
627,
334,
552,
8,
17600,
83,
7216,
17,
9,
267,
8526,
63,
2923,
63,
317,
784,
397,
275,
3089,
779,
552,
8,
604,
409,
9,
367,
1004,
409,
315,
291,
14,
604,
2193,
566,
267,
870,
480,
15386,
2385,
2458,
83,
15755,
2458,
83,
8878,
2458,
14,
18,
70,
2,
971,
288,
450,
334,
4994,
63,
2923,
63,
317,
784,
397,
12,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
12,
2049,
8526,
63,
317,
784,
397,
63,
11048,
317,
544,
397,
10,
1960,
14,
1182,
8526,
63,
2923,
63,
317,
784,
397,
430,
339,
347,
485,
1623,
63,
2330,
8,
277,
12,
1004,
409,
17,
12,
1004,
409,
18,
304,
267,
408,
1623,
4389,
382,
27894,
315,
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,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
Tesora/tesora-tempest | tempest/tests/test_list_tests.py | 34 | 1824 | # Copyright 2013 IBM Corp.
#
# 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 os
import re
import six
import subprocess
from tempest.tests import base
class TestTestList(base.TestCase):
def test_testr_list_tests_no_errors(self):
# Remove unit test discover path from env to test tempest tests
test_env = os.environ.copy()
test_env.pop('OS_TEST_PATH')
import_failures = []
p = subprocess.Popen(['testr', 'list-tests'], stdout=subprocess.PIPE,
env=test_env)
ids, err = p.communicate()
self.assertEqual(0, p.returncode,
"test discovery failed, one or more files cause an "
"error on import %s" % ids)
ids = six.text_type(ids).split('\n')
for test_id in ids:
if re.match('(\w+\.){3}\w+', test_id):
if not test_id.startswith('tempest.'):
parts = test_id.partition('tempest')
fail_id = parts[1] + parts[2]
import_failures.append(fail_id)
error_message = ("The following tests have import failures and aren't"
" being run with test filters %s" % import_failures)
self.assertFalse(import_failures, error_message)
| apache-2.0 | [
3,
1898,
6171,
26202,
22304,
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,
747,
199,
646,
295,
199,
646,
3816,
199,
646,
3873,
199,
199,
504,
24076,
14,
2219,
492,
1300,
421,
199,
533,
1379,
774,
1296,
8,
1095,
14,
1746,
304,
339,
347,
511,
63,
28792,
63,
513,
63,
2219,
63,
889,
63,
2550,
8,
277,
304,
267,
327,
5852,
4137,
511,
20131,
931,
687,
2589,
370,
511,
24076,
2295,
267,
511,
63,
1813,
275,
747,
14,
2314,
14,
1574,
342,
267,
511,
63,
1813,
14,
1935,
360,
3100,
63,
2864,
63,
3243,
358,
267,
492,
63,
9968,
275,
942,
267,
299,
275,
3873,
14,
7942,
2941,
28792,
297,
283,
513,
13,
2219,
995,
3839,
29,
5781,
14,
6089,
12,
2490,
2589,
29,
396,
63,
1813,
9,
267,
2762,
12,
2329,
275,
299,
14,
10664,
342,
267,
291,
14,
629,
8,
16,
12,
299,
14,
9913,
12,
586,
298,
396,
13172,
3405,
12,
1373,
503,
1655,
1584,
7675,
376,
298,
586,
298,
705,
641,
492,
450,
83,
2,
450,
2762,
9,
267,
2762,
275,
3816,
14,
505,
63,
466,
8,
1580,
680,
1294,
2258,
78,
358,
267,
367,
511,
63,
344,
315,
2762,
26,
288,
340,
295,
14,
1431,
360,
2961,
87,
11,
4537,
11224,
19,
4988,
87,
7386,
511,
63,
344,
304,
355,
340,
440,
511,
63,
344,
14,
2460,
360,
808,
597,
30194,
490,
4184,
275,
511,
63,
344,
14,
5312,
360,
808,
597,
358,
490,
2449,
63,
344,
275,
4184,
59,
17,
61,
435,
4184,
59,
18,
61,
490,
492,
63,
9968,
14,
740,
8,
1633,
63,
344,
9,
267,
1125,
63,
1188,
275,
1689,
1918,
2569,
2295,
1172,
492,
9081,
436,
10621,
1133,
2,
586,
298,
3769,
1255,
543,
511,
4766,
450,
83,
2,
450,
492,
63,
9968,
9,
267,
291,
14,
3334,
8,
646,
63,
9968,
12,
1125,
63,
1188,
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
] | [
1898,
6171,
26202,
22304,
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,
747,
199,
646,
295,
199,
646,
3816,
199,
646,
3873,
199,
199,
504,
24076,
14,
2219,
492,
1300,
421,
199,
533,
1379,
774,
1296,
8,
1095,
14,
1746,
304,
339,
347,
511,
63,
28792,
63,
513,
63,
2219,
63,
889,
63,
2550,
8,
277,
304,
267,
327,
5852,
4137,
511,
20131,
931,
687,
2589,
370,
511,
24076,
2295,
267,
511,
63,
1813,
275,
747,
14,
2314,
14,
1574,
342,
267,
511,
63,
1813,
14,
1935,
360,
3100,
63,
2864,
63,
3243,
358,
267,
492,
63,
9968,
275,
942,
267,
299,
275,
3873,
14,
7942,
2941,
28792,
297,
283,
513,
13,
2219,
995,
3839,
29,
5781,
14,
6089,
12,
2490,
2589,
29,
396,
63,
1813,
9,
267,
2762,
12,
2329,
275,
299,
14,
10664,
342,
267,
291,
14,
629,
8,
16,
12,
299,
14,
9913,
12,
586,
298,
396,
13172,
3405,
12,
1373,
503,
1655,
1584,
7675,
376,
298,
586,
298,
705,
641,
492,
450,
83,
2,
450,
2762,
9,
267,
2762,
275,
3816,
14,
505,
63,
466,
8,
1580,
680,
1294,
2258,
78,
358,
267,
367,
511,
63,
344,
315,
2762,
26,
288,
340,
295,
14,
1431,
360,
2961,
87,
11,
4537,
11224,
19,
4988,
87,
7386,
511,
63,
344,
304,
355,
340,
440,
511,
63,
344,
14,
2460,
360,
808,
597,
30194,
490,
4184,
275,
511,
63,
344,
14,
5312,
360,
808,
597,
358,
490,
2449,
63,
344,
275,
4184,
59,
17,
61,
435,
4184,
59,
18,
61,
490,
492,
63,
9968,
14,
740,
8,
1633,
63,
344,
9,
267,
1125,
63,
1188,
275,
1689,
1918,
2569,
2295,
1172,
492,
9081,
436,
10621,
1133,
2,
586,
298,
3769,
1255,
543,
511,
4766,
450,
83,
2,
450,
492,
63,
9968,
9,
267,
291,
14,
3334,
8,
646,
63,
9968,
12,
1125,
63,
1188,
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,
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,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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
] |
mvaled/sentry | src/sentry/message_filters.py | 1 | 16944 | # TODO RaduW 8.06.2019 remove the sentry.filters package and rename this module to filters
from __future__ import absolute_import
import collections
from collections import namedtuple
import re
from sentry.models.projectoption import ProjectOption
from sentry.utils.data_filters import FilterStatKeys
from rest_framework import serializers
from sentry.api.fields.multiplechoice import MultipleChoiceField
from six.moves.urllib.parse import urlparse
from sentry.utils.safe import get_path
from ua_parser.user_agent_parser import Parse
from sentry.signals import inbound_filter_toggled
EventFilteredRet = namedtuple("EventFilteredRet", "should_filter reason")
def should_filter_event(project_config, data):
"""
Checks if an event should be filtered
:param project_config: relay config for the request (for the project really)
:param data: the event data
:return: an EventFilteredRet explaining if the event should be filtered and, if it should the reason
for filtering
"""
for event_filter in get_all_filters():
if _is_filter_enabled(project_config, event_filter) and event_filter(project_config, data):
return EventFilteredRet(should_filter=True, reason=event_filter.spec.id)
return EventFilteredRet(should_filter=False, reason=None)
def get_all_filters():
"""
Returns a list of the existing event filters
An event filter is a function that receives a project_config and an event data payload and returns a tuple
(should_filter:bool, filter_reason: string | None) representing
:return: list of registered event filters
"""
return (
_localhost_filter,
_browser_extensions_filter,
_legacy_browsers_filter,
_web_crawlers_filter,
)
def set_filter_state(filter_id, project, state):
flt = _filter_from_filter_id(filter_id)
if flt is None:
raise FilterNotRegistered(filter_id)
if flt == _legacy_browsers_filter:
if state is None:
state = {}
option_val = "0"
if "active" in state:
if state["active"]:
option_val = "1"
elif "subfilters" in state and len(state["subfilters"]) > 0:
option_val = set(state["subfilters"])
ProjectOption.objects.set_value(
project=project, key=u"filters:{}".format(filter_id), value=option_val
)
return option_val
else:
# all boolean filters
if state is None:
state = {"active": True}
ProjectOption.objects.set_value(
project=project,
key=u"filters:{}".format(filter_id),
value="1" if state.get("active", False) else "0",
)
if state:
inbound_filter_toggled.send(project=project, sender=flt)
return state.get("active", False)
def get_filter_state(filter_id, project):
"""
Returns the filter state
IMPORTANT: this function accesses the database, it should NEVER be used by the ingestion pipe.
This api is used by the ProjectFilterDetails and ProjectFilters endpoints
:param filter_id: the filter Id
:param project: the project for which we want the filter state
:return: True if the filter is enabled False otherwise
:raises: ValueError if filter id not registered
"""
flt = _filter_from_filter_id(filter_id)
if flt is None:
raise FilterNotRegistered(filter_id)
filter_state = ProjectOption.objects.get_value(
project=project, key=u"filters:{}".format(flt.spec.id)
)
if filter_state is None:
raise ValueError(
"Could not find filter state for filter {0}."
" You need to register default filter state in projectoptions.defaults.".format(
filter_id
)
)
if flt == _legacy_browsers_filter:
# special handling for legacy browser state
if filter_state == "1":
return True
if filter_state == "0":
return False
return filter_state
else:
return filter_state == "1"
class FilterNotRegistered(Exception):
pass
def _filter_from_filter_id(filter_id):
"""
Returns the corresponding filter for a filter id or None if no filter with the given id found
"""
for flt in get_all_filters():
if flt.spec.id == filter_id:
return flt
return None
class _FilterSerializer(serializers.Serializer):
active = serializers.BooleanField()
class _FilterSpec(object):
"""
Data associated with a filter, it defines its name, id, default enable state and how its state is serialized
in the database
"""
def __init__(self, id, name, description, serializer_cls=None):
self.id = id
self.name = name
self.description = description
if serializer_cls is None:
self.serializer_cls = _FilterSerializer
else:
self.serializer_cls = serializer_cls
def _get_filter_settings(project_config, flt):
"""
Gets the filter options from the relay config or the default option if not specified in the relay config
:param project_config: the relay config for the request
:param flt: the filter
:return: the options for the filter
"""
filter_settings = project_config.config.get("filter_settings", {})
return filter_settings.get(get_filter_key(flt), None)
def _is_filter_enabled(project_config, flt):
filter_options = _get_filter_settings(project_config, flt)
if filter_options is None:
raise ValueError("unknown filter", flt.spec.id)
return filter_options["is_enabled"]
def get_filter_key(flt):
return flt.spec.id.replace("-", "_")
# ************* local host filter *************
_LOCAL_IPS = frozenset(["127.0.0.1", "::1"])
_LOCAL_DOMAINS = frozenset(["127.0.0.1", "localhost"])
def _localhost_filter(project_config, data):
ip_address = get_path(data, "user", "ip_address") or ""
url = get_path(data, "request", "url") or ""
domain = urlparse(url).hostname
return ip_address in _LOCAL_IPS or domain in _LOCAL_DOMAINS
_localhost_filter.spec = _FilterSpec(
id=FilterStatKeys.LOCALHOST,
name="Filter out events coming from localhost",
description="This applies to both IPv4 (``127.0.0.1``) and IPv6 (``::1``) addresses.",
)
# ************* browser extensions filter *************
_EXTENSION_EXC_VALUES = re.compile(
"|".join(
(
re.escape(x)
for x in (
# Random plugins/extensions
"top.GLOBALS",
# See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
"originalCreateNotification",
"canvas.contentDocument",
"MyApp_RemoveAllHighlights",
"http://tt.epicplay.com",
"Can't find variable: ZiteReader",
"jigsaw is not defined",
"ComboSearch is not defined",
"http://loading.retry.widdit.com/",
"atomicFindClose",
# Facebook borked
"fb_xd_fragment",
# ISP "optimizing" proxy - `Cache-Control: no-transform` seems to
# reduce this. (thanks @acdha)
# See http://stackoverflow.com/questions/4113268
"bmi_SafeAddOnload",
"EBCallBackMessageReceived",
# See
# https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/7VU0_VvC7mE
"_gCrWeb",
# See http://toolbar.conduit.com/Debveloper/HtmlAndGadget/Methods/JSInjection.aspx
"conduitPage",
# Google Search app (iOS)
# See: https://github.com/getsentry/raven-js/issues/756
"null is not an object (evaluating 'elt.parentNode')",
# Dragon Web Extension from Nuance Communications
# See: https://forum.sentry.io/t/error-in-raven-js-plugin-setsuspendstate/481/
"plugin.setSuspendState is not a function",
# lastpass
"should_do_lastpass_here",
# google translate
# see https://medium.com/@amir.harel/a-b-target-classname-indexof-is-not-a-function-at-least-not-mine-8e52f7be64ca
"a[b].target.className.indexOf is not a function",
)
)
),
re.I,
)
_EXTENSION_EXC_SOURCES = re.compile(
"|".join(
(
# Facebook flakiness
r"graph\.facebook\.com",
# Facebook blocked
r"connect\.facebook\.net",
# Woopra flakiness
r"eatdifferent\.com\.woopra-ns\.com",
r"static\.woopra\.com\/js\/woopra\.js",
# Chrome extensions
r"^chrome(?:-extension)?:\/\/",
# Cacaoweb
r"127\.0\.0\.1:4001\/isrunning",
# Other
r"webappstoolbarba\.texthelp\.com\/",
r"metrics\.itunes\.apple\.com\.edgesuite\.net\/",
# Kaspersky Protection browser extension
r"kaspersky-labs\.com",
# Google ad server (see http://whois.domaintools.com/2mdn.net)
r"2mdn\.net",
)
),
re.I,
)
def _browser_extensions_filter(project_config, data):
if data.get("platform") != "javascript":
return False
# get exception value
try:
exc_value = data["exception"]["values"][0]["value"]
except (LookupError, TypeError):
exc_value = ""
if exc_value:
if _EXTENSION_EXC_VALUES.search(exc_value):
return True
# get exception source
try:
exc_source = data["exception"]["values"][0]["stacktrace"]["frames"][-1]["abs_path"]
except (LookupError, TypeError):
exc_source = ""
if exc_source:
if _EXTENSION_EXC_SOURCES.search(exc_source):
return True
return False
_browser_extensions_filter.spec = _FilterSpec(
id=FilterStatKeys.BROWSER_EXTENSION,
name="Filter out errors known to be caused by browser extensions",
description="Certain browser extensions will inject inline scripts and are known to cause errors.",
)
# ************* legacy browsers filter *************
MIN_VERSIONS = {
"Chrome": 0,
"IE": 10,
"Firefox": 0,
"Safari": 6,
"Edge": 0,
"Opera": 15,
"Android": 4,
"Opera Mini": 8,
}
def _legacy_browsers_filter(project_config, data):
def get_user_agent(data):
try:
for key, value in get_path(data, "request", "headers", filter=True) or ():
if key.lower() == "user-agent":
return value
except LookupError:
return ""
if data.get("platform") != "javascript":
return False
value = get_user_agent(data)
if not value:
return False
ua = Parse(value)
if not ua:
return False
browser = ua["user_agent"]
if not browser["family"]:
return False
# IE Desktop and IE Mobile use the same engines, therefore we can treat them as one
if browser["family"] == "IE Mobile":
browser["family"] = "IE"
filter_settings = _get_filter_settings(project_config, _legacy_browsers_filter)
# handle old style config
if filter_settings is None:
return _filter_default(browser)
enabled_sub_filters = filter_settings.get("options")
if isinstance(enabled_sub_filters, collections.Sequence):
for sub_filter_name in enabled_sub_filters:
sub_filter = _legacy_browsers_sub_filters.get(sub_filter_name)
if sub_filter is not None and sub_filter(browser):
return True
return False
class _LegacyBrowserFilterSerializer(serializers.Serializer):
active = serializers.BooleanField()
subfilters = MultipleChoiceField(
choices=[
"ie_pre_9",
"ie9",
"ie10",
"opera_pre_15",
"android_pre_4",
"safari_pre_6",
"opera_mini_pre_8",
]
)
_legacy_browsers_filter.spec = _FilterSpec(
id=FilterStatKeys.LEGACY_BROWSER,
name="Filter out known errors from legacy browsers",
description="Older browsers often give less accurate information, and while they may report valid issues, "
"the context to understand them is incorrect or missing.",
serializer_cls=_LegacyBrowserFilterSerializer,
)
def _filter_default(browser):
"""
Legacy filter - new users specify individual filters
"""
try:
minimum_version = MIN_VERSIONS[browser["family"]]
except KeyError:
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
if minimum_version > major_browser_version:
return True
return False
def _filter_opera_pre_15(browser):
if not browser["family"] == "Opera":
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
if major_browser_version < 15:
return True
return False
def _filter_safari_pre_6(browser):
if not browser["family"] == "Safari":
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
if major_browser_version < 6:
return True
return False
def _filter_android_pre_4(browser):
if not browser["family"] == "Android":
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
if major_browser_version < 4:
return True
return False
def _filter_opera_mini_pre_8(browser):
if not browser["family"] == "Opera Mini":
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
if major_browser_version < 8:
return True
return False
def _filter_ie10(browser):
return _filter_ie_internal(browser, lambda major_ver: major_ver == 10)
def _filter_ie9(browser):
return _filter_ie_internal(browser, lambda major_ver: major_ver == 9)
def _filter_ie_pre_9(browser):
return _filter_ie_internal(browser, lambda major_ver: major_ver <= 8)
def _filter_ie_internal(browser, compare_version):
if not browser["family"] == "IE":
return False
try:
major_browser_version = int(browser["major"])
except (TypeError, ValueError):
return False
return compare_version(major_browser_version)
# list all browser specific sub filters that should be called
_legacy_browsers_sub_filters = {
"default": _filter_default,
"opera_pre_15": _filter_opera_pre_15,
"safari_pre_6": _filter_safari_pre_6,
"android_pre_4": _filter_android_pre_4,
"opera_mini_pre_8": _filter_opera_mini_pre_8,
"ie9": _filter_ie9,
"ie10": _filter_ie10,
"ie_pre_9": _filter_ie_pre_9,
}
# ************* web crawler filter *************
# not all of these agents are guaranteed to execute JavaScript, but to avoid
# overhead of identifying which ones do, and which ones will over time we simply
# target all of the major ones
_CRAWLERS = re.compile(
r"|".join(
(
# Google spiders (Adsense and others)
# https://support.google.com/webmasters/answer/1061943?hl=en
r"Mediapartners\-Google",
r"AdsBot\-Google",
r"Googlebot",
r"FeedFetcher\-Google",
# Bing search
r"BingBot",
r"BingPreview",
# Baidu search
r"Baiduspider",
# Yahoo
r"Slurp",
# Sogou
r"Sogou",
# facebook
r"facebook",
# Alexa
r"ia_archiver",
# Generic bot
r"bots?[\/\s\)\;]",
# Generic spider
r"spider[\/\s\)\;]",
# Slack - see https://api.slack.com/robots
r"Slack",
# Google indexing bot
r"Calypso AppCrawler",
# Pingdom
r"pingdom",
# Lytics
r"lyticsbot",
)
),
re.I,
)
def _web_crawlers_filter(project_config, data):
try:
for key, value in get_path(data, "request", "headers", filter=True) or ():
if key.lower() == "user-agent":
if not value:
return False
return bool(_CRAWLERS.search(value))
return False
except LookupError:
return False
_web_crawlers_filter.spec = _FilterSpec(
id=FilterStatKeys.WEB_CRAWLER,
name="Filter out known web crawlers",
description="Some crawlers may execute pages in incompatible ways which then cause errors that"
" are unlikely to be seen by a normal user.",
)
| bsd-3-clause | [
3,
3254,
820,
350,
85,
55,
1695,
14,
1690,
14,
14982,
2813,
314,
26230,
14,
4273,
2559,
436,
11441,
642,
859,
370,
4766,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
199,
646,
5055,
199,
504,
5055,
492,
12863,
199,
646,
295,
199,
199,
504,
26230,
14,
992,
14,
1715,
1422,
492,
7290,
2602,
199,
504,
26230,
14,
1208,
14,
576,
63,
4273,
492,
9388,
11232,
6340,
199,
504,
4618,
63,
4857,
492,
12506,
199,
504,
26230,
14,
1246,
14,
955,
14,
6048,
5095,
492,
14326,
15792,
199,
199,
504,
3816,
14,
4912,
14,
4078,
14,
1122,
492,
7097,
199,
504,
26230,
14,
1208,
14,
3489,
492,
664,
63,
515,
199,
504,
18500,
63,
2087,
14,
751,
63,
4054,
63,
2087,
492,
6077,
199,
504,
26230,
14,
10458,
492,
30819,
63,
1541,
63,
31695,
199,
199,
2390,
13079,
3014,
6816,
275,
12863,
480,
2390,
13079,
3014,
6816,
401,
298,
5626,
63,
1541,
4499,
531,
421,
199,
318,
1077,
63,
1541,
63,
1430,
8,
1715,
63,
888,
12,
666,
304,
272,
408,
272,
13813,
340,
376,
1566,
1077,
506,
9806,
339,
520,
635,
2199,
63,
888,
26,
25931,
1101,
367,
314,
1056,
334,
509,
314,
2199,
7710,
9,
272,
520,
635,
666,
26,
314,
1566,
666,
272,
520,
1107,
26,
376,
6763,
13079,
3014,
6816,
27797,
316,
340,
314,
1566,
1077,
506,
9806,
436,
12,
340,
652,
1077,
314,
4499,
267,
367,
14545,
272,
408,
272,
367,
1566,
63,
1541,
315,
664,
63,
452,
63,
4273,
837,
267,
340,
485,
374,
63,
1541,
63,
3827,
8,
1715,
63,
888,
12,
1566,
63,
1541,
9,
436,
1566,
63,
1541,
8,
1715,
63,
888,
12,
666,
304,
288,
372,
6763,
13079,
3014,
6816,
8,
5626,
63,
1541,
29,
549,
12,
4499,
29,
1430,
63,
1541,
14,
1650,
14,
344,
9,
339,
372,
6763,
13079,
3014,
6816,
8,
5626,
63,
1541,
29,
797,
12,
4499,
29,
403,
9,
421,
199,
318,
664,
63,
452,
63,
4273,
837,
272,
408,
272,
1803,
282,
769,
402,
314,
3411,
1566,
4766,
339,
1626,
1566,
2457,
365,
282,
805,
626,
23192,
282,
2199,
63,
888,
436,
376,
1566,
666,
4886,
436,
2529,
282,
2008,
272,
334,
5626,
63,
1541,
26,
2245,
12,
2457,
63,
5764,
26,
1059,
1204,
488,
9,
6144,
339,
520,
1107,
26,
769,
402,
7264,
1566,
4766,
272,
408,
272,
372,
334,
267,
485,
5967,
63,
1541,
12,
267,
485,
5750,
63,
5359,
63,
1541,
12,
267,
485,
10000,
63,
5750,
83,
63,
1541,
12,
267,
485,
2520,
63,
23972,
83,
63,
1541,
12,
272,
776,
421,
199,
318,
663,
63,
1541,
63,
929,
8,
1541,
63,
344,
12,
2199,
12,
1174,
304,
272,
17166,
275,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
9,
272,
340,
17166,
365,
488,
26,
267,
746,
9388,
1763,
20341,
8,
1541,
63,
344,
9,
339,
340,
17166,
508,
485,
10000,
63,
5750,
83,
63,
1541,
26,
267,
340,
1174,
365,
488,
26,
288,
1174,
275,
1052,
398,
945,
63,
637,
275,
298,
16,
2,
267,
340,
298,
2682,
2,
315,
1174,
26,
288,
340,
1174,
905,
2682,
6229,
355,
945,
63,
637,
275,
298,
17,
2,
267,
916,
298,
954,
4273,
2,
315,
1174,
436,
822,
8,
929,
905,
954,
4273,
3135,
690,
378,
26,
288,
945,
63,
637,
275,
663,
8,
929,
905,
954,
4273,
3135,
398,
7290,
2602,
14,
1462,
14,
409,
63,
585,
8,
288,
2199,
29,
1715,
12,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
1541,
63,
344,
395,
574,
29,
1422,
63,
637,
267,
776,
398,
372,
945,
63,
637,
339,
587,
26,
267,
327,
1006,
5046,
4766,
267,
340,
1174,
365,
488,
26,
288,
1174,
275,
2420,
2682,
582,
715,
93,
398,
7290,
2602,
14,
1462,
14,
409,
63,
585,
8,
288,
2199,
29,
1715,
12,
288,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
1541,
63,
344,
395,
288,
574,
628,
17,
2,
340,
1174,
14,
362,
480,
2682,
401,
756,
9,
587,
298,
16,
401,
267,
776,
398,
340,
1174,
26,
288,
30819,
63,
1541,
63,
31695,
14,
2254,
8,
1715,
29,
1715,
12,
8904,
29,
26057,
9,
398,
372,
1174,
14,
362,
480,
2682,
401,
756,
9,
421,
199,
318,
664,
63,
1541,
63,
929,
8,
1541,
63,
344,
12,
2199,
304,
272,
408,
272,
1803,
314,
2457,
1174,
339,
5025,
2596,
1441,
26,
642,
805,
1066,
5804,
314,
3050,
12,
652,
1077,
7110,
2111,
506,
1202,
701,
314,
315,
3199,
1636,
5200,
14,
272,
961,
2986,
365,
1202,
701,
314,
7290,
4131,
11347,
436,
7290,
18053,
16173,
272,
520,
635,
2457,
63,
344,
26,
314,
2457,
15418,
272,
520,
635,
2199,
26,
314,
2199,
367,
1314,
781,
2934,
314,
2457,
1174,
272,
520,
1107,
26,
715,
340,
314,
2457,
365,
5223,
756,
4257,
272,
520,
3536,
26,
1722,
340,
2457,
1305,
440,
7264,
272,
408,
272,
17166,
275,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
9,
272,
340,
17166,
365,
488,
26,
267,
746,
9388,
1763,
20341,
8,
1541,
63,
344,
9,
339,
2457,
63,
929,
275,
7290,
2602,
14,
1462,
14,
362,
63,
585,
8,
267,
2199,
29,
1715,
12,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
26057,
14,
1650,
14,
344,
9,
272,
776,
339,
340,
2457,
63,
929,
365,
488,
26,
267,
746,
1722,
8,
288,
298,
6531,
440,
2342,
2457,
1174,
367,
2457,
469,
16,
93,
2122,
288,
298,
2047,
1929,
370,
2274,
849,
2457,
1174,
315,
2199,
1419,
14,
4322,
15848,
908,
8,
355,
2457,
63,
344,
288,
776,
267,
776,
339,
340,
17166,
508,
485,
10000,
63,
5750,
83,
63,
1541,
26,
267,
327,
4539,
7252,
367,
12139,
7042,
1174,
267,
340,
2457,
63,
929,
508,
298,
17,
582,
288,
372,
715,
267,
340,
2457,
63,
929,
508,
298,
16,
582,
288,
372,
756,
267,
372,
2457,
63,
929,
272,
587,
26,
267,
372,
2457,
63,
929,
508,
298,
17,
2,
421,
199,
533,
9388,
1763,
20341,
8,
1726,
304,
272,
986,
421,
199,
318,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
304,
272,
408,
272,
1803,
314,
5226,
2457,
367,
282,
2457,
1305,
503
] | [
3254,
820,
350,
85,
55,
1695,
14,
1690,
14,
14982,
2813,
314,
26230,
14,
4273,
2559,
436,
11441,
642,
859,
370,
4766,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
199,
646,
5055,
199,
504,
5055,
492,
12863,
199,
646,
295,
199,
199,
504,
26230,
14,
992,
14,
1715,
1422,
492,
7290,
2602,
199,
504,
26230,
14,
1208,
14,
576,
63,
4273,
492,
9388,
11232,
6340,
199,
504,
4618,
63,
4857,
492,
12506,
199,
504,
26230,
14,
1246,
14,
955,
14,
6048,
5095,
492,
14326,
15792,
199,
199,
504,
3816,
14,
4912,
14,
4078,
14,
1122,
492,
7097,
199,
504,
26230,
14,
1208,
14,
3489,
492,
664,
63,
515,
199,
504,
18500,
63,
2087,
14,
751,
63,
4054,
63,
2087,
492,
6077,
199,
504,
26230,
14,
10458,
492,
30819,
63,
1541,
63,
31695,
199,
199,
2390,
13079,
3014,
6816,
275,
12863,
480,
2390,
13079,
3014,
6816,
401,
298,
5626,
63,
1541,
4499,
531,
421,
199,
318,
1077,
63,
1541,
63,
1430,
8,
1715,
63,
888,
12,
666,
304,
272,
408,
272,
13813,
340,
376,
1566,
1077,
506,
9806,
339,
520,
635,
2199,
63,
888,
26,
25931,
1101,
367,
314,
1056,
334,
509,
314,
2199,
7710,
9,
272,
520,
635,
666,
26,
314,
1566,
666,
272,
520,
1107,
26,
376,
6763,
13079,
3014,
6816,
27797,
316,
340,
314,
1566,
1077,
506,
9806,
436,
12,
340,
652,
1077,
314,
4499,
267,
367,
14545,
272,
408,
272,
367,
1566,
63,
1541,
315,
664,
63,
452,
63,
4273,
837,
267,
340,
485,
374,
63,
1541,
63,
3827,
8,
1715,
63,
888,
12,
1566,
63,
1541,
9,
436,
1566,
63,
1541,
8,
1715,
63,
888,
12,
666,
304,
288,
372,
6763,
13079,
3014,
6816,
8,
5626,
63,
1541,
29,
549,
12,
4499,
29,
1430,
63,
1541,
14,
1650,
14,
344,
9,
339,
372,
6763,
13079,
3014,
6816,
8,
5626,
63,
1541,
29,
797,
12,
4499,
29,
403,
9,
421,
199,
318,
664,
63,
452,
63,
4273,
837,
272,
408,
272,
1803,
282,
769,
402,
314,
3411,
1566,
4766,
339,
1626,
1566,
2457,
365,
282,
805,
626,
23192,
282,
2199,
63,
888,
436,
376,
1566,
666,
4886,
436,
2529,
282,
2008,
272,
334,
5626,
63,
1541,
26,
2245,
12,
2457,
63,
5764,
26,
1059,
1204,
488,
9,
6144,
339,
520,
1107,
26,
769,
402,
7264,
1566,
4766,
272,
408,
272,
372,
334,
267,
485,
5967,
63,
1541,
12,
267,
485,
5750,
63,
5359,
63,
1541,
12,
267,
485,
10000,
63,
5750,
83,
63,
1541,
12,
267,
485,
2520,
63,
23972,
83,
63,
1541,
12,
272,
776,
421,
199,
318,
663,
63,
1541,
63,
929,
8,
1541,
63,
344,
12,
2199,
12,
1174,
304,
272,
17166,
275,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
9,
272,
340,
17166,
365,
488,
26,
267,
746,
9388,
1763,
20341,
8,
1541,
63,
344,
9,
339,
340,
17166,
508,
485,
10000,
63,
5750,
83,
63,
1541,
26,
267,
340,
1174,
365,
488,
26,
288,
1174,
275,
1052,
398,
945,
63,
637,
275,
298,
16,
2,
267,
340,
298,
2682,
2,
315,
1174,
26,
288,
340,
1174,
905,
2682,
6229,
355,
945,
63,
637,
275,
298,
17,
2,
267,
916,
298,
954,
4273,
2,
315,
1174,
436,
822,
8,
929,
905,
954,
4273,
3135,
690,
378,
26,
288,
945,
63,
637,
275,
663,
8,
929,
905,
954,
4273,
3135,
398,
7290,
2602,
14,
1462,
14,
409,
63,
585,
8,
288,
2199,
29,
1715,
12,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
1541,
63,
344,
395,
574,
29,
1422,
63,
637,
267,
776,
398,
372,
945,
63,
637,
339,
587,
26,
267,
327,
1006,
5046,
4766,
267,
340,
1174,
365,
488,
26,
288,
1174,
275,
2420,
2682,
582,
715,
93,
398,
7290,
2602,
14,
1462,
14,
409,
63,
585,
8,
288,
2199,
29,
1715,
12,
288,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
1541,
63,
344,
395,
288,
574,
628,
17,
2,
340,
1174,
14,
362,
480,
2682,
401,
756,
9,
587,
298,
16,
401,
267,
776,
398,
340,
1174,
26,
288,
30819,
63,
1541,
63,
31695,
14,
2254,
8,
1715,
29,
1715,
12,
8904,
29,
26057,
9,
398,
372,
1174,
14,
362,
480,
2682,
401,
756,
9,
421,
199,
318,
664,
63,
1541,
63,
929,
8,
1541,
63,
344,
12,
2199,
304,
272,
408,
272,
1803,
314,
2457,
1174,
339,
5025,
2596,
1441,
26,
642,
805,
1066,
5804,
314,
3050,
12,
652,
1077,
7110,
2111,
506,
1202,
701,
314,
315,
3199,
1636,
5200,
14,
272,
961,
2986,
365,
1202,
701,
314,
7290,
4131,
11347,
436,
7290,
18053,
16173,
272,
520,
635,
2457,
63,
344,
26,
314,
2457,
15418,
272,
520,
635,
2199,
26,
314,
2199,
367,
1314,
781,
2934,
314,
2457,
1174,
272,
520,
1107,
26,
715,
340,
314,
2457,
365,
5223,
756,
4257,
272,
520,
3536,
26,
1722,
340,
2457,
1305,
440,
7264,
272,
408,
272,
17166,
275,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
9,
272,
340,
17166,
365,
488,
26,
267,
746,
9388,
1763,
20341,
8,
1541,
63,
344,
9,
339,
2457,
63,
929,
275,
7290,
2602,
14,
1462,
14,
362,
63,
585,
8,
267,
2199,
29,
1715,
12,
790,
29,
85,
2,
4273,
26,
13536,
908,
8,
26057,
14,
1650,
14,
344,
9,
272,
776,
339,
340,
2457,
63,
929,
365,
488,
26,
267,
746,
1722,
8,
288,
298,
6531,
440,
2342,
2457,
1174,
367,
2457,
469,
16,
93,
2122,
288,
298,
2047,
1929,
370,
2274,
849,
2457,
1174,
315,
2199,
1419,
14,
4322,
15848,
908,
8,
355,
2457,
63,
344,
288,
776,
267,
776,
339,
340,
17166,
508,
485,
10000,
63,
5750,
83,
63,
1541,
26,
267,
327,
4539,
7252,
367,
12139,
7042,
1174,
267,
340,
2457,
63,
929,
508,
298,
17,
582,
288,
372,
715,
267,
340,
2457,
63,
929,
508,
298,
16,
582,
288,
372,
756,
267,
372,
2457,
63,
929,
272,
587,
26,
267,
372,
2457,
63,
929,
508,
298,
17,
2,
421,
199,
533,
9388,
1763,
20341,
8,
1726,
304,
272,
986,
421,
199,
318,
485,
1541,
63,
504,
63,
1541,
63,
344,
8,
1541,
63,
344,
304,
272,
408,
272,
1803,
314,
5226,
2457,
367,
282,
2457,
1305,
503,
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
] |
eResearchSA/reporting-storage-hcp | ersa_storage_hcp/__init__.py | 1 | 5549 | #!/usr/bin/python3
"""Application and persistence management."""
# pylint: disable=no-member, import-error, no-init, too-few-public-methods
# pylint: disable=cyclic-import, no-name-in-module, invalid-name
import os
from flask import Flask
from flask.ext import restful
from flask.ext.cors import CORS
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
from sqlalchemy.dialects.postgresql import UUID
app = Flask("storage-hcp")
cors = CORS(app)
restapi = restful.Api(app)
app.config["ERSA_STORAGE_HCP_TOKEN"] = os.getenv("ERSA_STORAGE_HCP_TOKEN")
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("ERSA_STORAGE_HCP_DATABASE")
db = SQLAlchemy(app)
def _id_column():
"""Generate a UUID column."""
return db.Column(UUID,
server_default=text("uuid_generate_v4()"),
primary_key=True)
class Allocation(db.Model):
"""Storage Allocation"""
id = _id_column()
allocation = db.Column(db.Integer, unique=True, nullable=False)
tenants = db.relationship("Tenant", backref="allocation")
namespaces = db.relationship("Namespace", backref="allocation")
def json(self):
"""Jsonify"""
return {"id": self.id, "allocation": self.allocation}
class Snapshot(db.Model):
"""Storage Snapshot"""
id = _id_column()
ts = db.Column(db.Integer, nullable=False)
usage = db.relationship("Usage", backref="snapshot")
def json(self):
"""Jsonify"""
return {"id": self.id, "ts": self.ts}
class Tenant(db.Model):
"""HCP Tenant"""
id = _id_column()
name = db.Column(db.String(256), unique=True, nullable=False)
namespaces = db.relationship("Namespace", backref="tenant")
allocation_id = db.Column(None, db.ForeignKey("allocation.id"))
def json(self, namespaces=True):
"""Jsonify"""
result = {"id": self.id, "name": self.name}
if self.allocation:
result["allocation"] = self.allocation.json()
if namespaces:
result["namespaces"] = [namespace.json(tenants=False)
for namespace in self.namespaces]
return result
class Namespace(db.Model):
"""HCP Namespace"""
id = _id_column()
name = db.Column(db.String(256), nullable=False)
usage = db.relationship("Usage", backref="namespace")
tenant_id = db.Column(None,
db.ForeignKey("tenant.id"),
index=True,
nullable=False)
allocation_id = db.Column(None, db.ForeignKey("allocation.id"))
def json(self, tenants=True):
"""Jsonify"""
result = {"id": self.id, "name": self.name}
if self.allocation:
result["allocation"] = self.allocation.json()
if tenants:
result["tenant"] = self.tenant.json(namespaces=False)
return result
class Usage(db.Model):
"""HCP Usage"""
id = _id_column()
start_time = db.Column(db.Integer, index=True, nullable=False)
end_time = db.Column(db.Integer, index=True, nullable=False)
ingested_bytes = db.Column(db.BigInteger, nullable=False)
raw_bytes = db.Column(db.BigInteger, nullable=False)
reads = db.Column(db.BigInteger, nullable=False)
writes = db.Column(db.BigInteger, nullable=False)
deletes = db.Column(db.BigInteger, nullable=False)
objects = db.Column(db.BigInteger, nullable=False)
bytes_in = db.Column(db.BigInteger, nullable=False)
bytes_out = db.Column(db.BigInteger, nullable=False)
metadata_only_objects = db.Column(db.BigInteger, nullable=False)
metadata_only_bytes = db.Column(db.BigInteger, nullable=False)
tiered_objects = db.Column(db.BigInteger, nullable=False)
tiered_bytes = db.Column(db.BigInteger, nullable=False)
snapshot_id = db.Column(None,
db.ForeignKey("snapshot.id"),
index=True,
nullable=False)
namespace_id = db.Column(None,
db.ForeignKey("namespace.id"),
index=True,
nullable=False)
def json(self):
"""Jsonify"""
return {
"start_time": self.start_time,
"end_time": self.end_time,
"ingested_bytes": self.ingested_bytes,
"raw_bytes": self.raw_bytes,
"reads": self.reads,
"writes": self.writes,
"deletes": self.deletes,
"objects": self.objects,
"bytes_in": self.bytes_in,
"bytes_out": self.bytes_out,
"metadata_only_objects": self.metadata_only_objects,
"metadata_only_bytes": self.metadata_only_bytes,
"tiered_objects": self.tiered_objects,
"tiered_bytes": self.tiered_bytes,
"snapshot": self.snapshot.json(),
"namespace": {
"id": self.namespace.id,
"name": self.namespace.name
}
}
def run():
"""Let's roll."""
db.engine.execute("create extension if not exists \"uuid-ossp\";")
db.create_all()
from ersa_storage_hcp import api
restapi.add_resource(api.PingResource, "/ping")
restapi.add_resource(api.AllocationResource, "/allocation")
restapi.add_resource(api.StorageResource, "/storage")
restapi.add_resource(api.SnapshotResource, "/snapshot")
restapi.add_resource(api.UsageResource, "/usage")
app.run(host="127.0.0.1", port=int(os.getenv("ERSA_STORAGE_HCP_PORT")))
| apache-2.0 | [
3381,
2647,
15,
1393,
15,
1548,
19,
199,
624,
5039,
436,
26882,
10041,
1041,
199,
199,
3,
4287,
26,
3507,
29,
889,
13,
1114,
12,
492,
13,
705,
12,
949,
13,
826,
12,
4634,
13,
70,
546,
13,
3455,
13,
2474,
199,
3,
4287,
26,
3507,
29,
31268,
13,
646,
12,
949,
13,
354,
13,
262,
13,
578,
12,
3866,
13,
354,
199,
199,
646,
747,
199,
199,
504,
7209,
492,
16704,
199,
504,
7209,
14,
832,
492,
4618,
1893,
199,
504,
7209,
14,
832,
14,
30967,
492,
445,
4149,
199,
504,
7209,
14,
832,
14,
14536,
492,
14303,
199,
199,
504,
8335,
14,
3009,
492,
1318,
199,
504,
8335,
14,
11072,
83,
14,
15437,
492,
11134,
199,
199,
571,
275,
16704,
480,
3494,
13,
14968,
531,
199,
30967,
275,
445,
4149,
8,
571,
9,
199,
3911,
1246,
275,
4618,
1893,
14,
7394,
8,
571,
9,
199,
199,
571,
14,
888,
905,
3960,
33,
63,
17467,
63,
40,
2890,
63,
8803,
937,
275,
747,
14,
12959,
480,
3960,
33,
63,
17467,
63,
40,
2890,
63,
8803,
531,
199,
571,
14,
888,
905,
4657,
748,
1244,
2769,
57,
63,
17873,
63,
7639,
937,
275,
747,
14,
12959,
480,
3960,
33,
63,
17467,
63,
40,
2890,
63,
17873,
531,
199,
199,
697,
275,
14303,
8,
571,
9,
421,
199,
318,
485,
344,
63,
2301,
837,
272,
408,
6864,
282,
11134,
2763,
1041,
272,
372,
1592,
14,
4547,
8,
8757,
12,
2151,
1654,
63,
885,
29,
505,
480,
2580,
63,
4208,
63,
86,
20,
26322,
2151,
5062,
63,
498,
29,
549,
9,
421,
199,
533,
4580,
1985,
8,
697,
14,
1685,
304,
272,
408,
6408,
4580,
1985,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
18723,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
3747,
29,
549,
12,
7854,
29,
797,
9,
272,
16685,
2285,
275,
1592,
14,
11704,
480,
27807,
401,
23412,
628,
14940,
531,
272,
10747,
275,
1592,
14,
11704,
480,
8814,
401,
23412,
628,
14940,
531,
339,
347,
2022,
8,
277,
304,
267,
408,
9653,
2021,
624,
398,
372,
2420,
344,
582,
291,
14,
344,
12,
298,
14940,
582,
291,
14,
14940,
93,
421,
199,
533,
23896,
8,
697,
14,
1685,
304,
272,
408,
6408,
23896,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
6714,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
7854,
29,
797,
9,
272,
4503,
275,
1592,
14,
11704,
480,
7692,
401,
23412,
628,
4753,
531,
339,
347,
2022,
8,
277,
304,
267,
408,
9653,
2021,
624,
267,
372,
2420,
344,
582,
291,
14,
344,
12,
298,
1086,
582,
291,
14,
1086,
93,
421,
199,
533,
377,
287,
867,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
377,
287,
867,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
536,
275,
1592,
14,
4547,
8,
697,
14,
1558,
8,
3912,
395,
3747,
29,
549,
12,
7854,
29,
797,
9,
272,
10747,
275,
1592,
14,
11704,
480,
8814,
401,
23412,
628,
4647,
531,
272,
18723,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
1592,
14,
3190,
480,
14940,
14,
344,
2237,
339,
347,
2022,
8,
277,
12,
10747,
29,
549,
304,
267,
408,
9653,
2021,
624,
398,
754,
275,
2420,
344,
582,
291,
14,
344,
12,
298,
354,
582,
291,
14,
354,
93,
398,
340,
291,
14,
14940,
26,
288,
754,
905,
14940,
937,
275,
291,
14,
14940,
14,
1001,
342,
398,
340,
10747,
26,
288,
754,
905,
9247,
937,
275,
359,
3251,
14,
1001,
8,
25021,
29,
797,
9,
2511,
367,
3231,
315,
291,
14,
9247,
61,
398,
372,
754,
421,
199,
533,
19317,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
19317,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
536,
275,
1592,
14,
4547,
8,
697,
14,
1558,
8,
3912,
395,
7854,
29,
797,
9,
272,
4503,
275,
1592,
14,
11704,
480,
7692,
401,
23412,
628,
3251,
531,
272,
8261,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
2079,
1592,
14,
3190,
480,
4647,
14,
344,
1288,
2079,
1478,
29,
549,
12,
2079,
7854,
29,
797,
9,
272,
18723,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
1592,
14,
3190,
480,
14940,
14,
344,
2237,
339,
347,
2022,
8,
277,
12,
16685,
2285,
29,
549,
304,
267,
408,
9653,
2021,
624,
398,
754,
275,
2420,
344,
582,
291,
14,
344,
12,
298,
354,
582,
291,
14,
354,
93,
398,
340,
291,
14,
14940,
26,
288,
754,
905,
14940,
937,
275,
291,
14,
14940,
14,
1001,
342,
398,
340,
16685,
2285,
26,
288,
754,
905,
4647,
937,
275,
291,
14,
4647,
14,
1001,
8,
9247,
29,
797,
9,
398,
372,
754,
421,
199,
533,
11028,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
11028,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
1343,
63,
521,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
1478,
29,
549,
12,
7854,
29,
797,
9,
272,
1284,
63,
521,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
1478,
29,
549,
12,
7854,
29,
797,
9,
272,
315,
16663,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3066,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
11597,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
14511,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
21812,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2251,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2783,
63,
262,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2783,
63,
548,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3341,
63,
2118,
63,
1462,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3341,
63,
2118,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3367,
16179,
63,
1462,
275,
1592,
14,
4547,
8,
697,
14
] | [
2647,
15,
1393,
15,
1548,
19,
199,
624,
5039,
436,
26882,
10041,
1041,
199,
199,
3,
4287,
26,
3507,
29,
889,
13,
1114,
12,
492,
13,
705,
12,
949,
13,
826,
12,
4634,
13,
70,
546,
13,
3455,
13,
2474,
199,
3,
4287,
26,
3507,
29,
31268,
13,
646,
12,
949,
13,
354,
13,
262,
13,
578,
12,
3866,
13,
354,
199,
199,
646,
747,
199,
199,
504,
7209,
492,
16704,
199,
504,
7209,
14,
832,
492,
4618,
1893,
199,
504,
7209,
14,
832,
14,
30967,
492,
445,
4149,
199,
504,
7209,
14,
832,
14,
14536,
492,
14303,
199,
199,
504,
8335,
14,
3009,
492,
1318,
199,
504,
8335,
14,
11072,
83,
14,
15437,
492,
11134,
199,
199,
571,
275,
16704,
480,
3494,
13,
14968,
531,
199,
30967,
275,
445,
4149,
8,
571,
9,
199,
3911,
1246,
275,
4618,
1893,
14,
7394,
8,
571,
9,
199,
199,
571,
14,
888,
905,
3960,
33,
63,
17467,
63,
40,
2890,
63,
8803,
937,
275,
747,
14,
12959,
480,
3960,
33,
63,
17467,
63,
40,
2890,
63,
8803,
531,
199,
571,
14,
888,
905,
4657,
748,
1244,
2769,
57,
63,
17873,
63,
7639,
937,
275,
747,
14,
12959,
480,
3960,
33,
63,
17467,
63,
40,
2890,
63,
17873,
531,
199,
199,
697,
275,
14303,
8,
571,
9,
421,
199,
318,
485,
344,
63,
2301,
837,
272,
408,
6864,
282,
11134,
2763,
1041,
272,
372,
1592,
14,
4547,
8,
8757,
12,
2151,
1654,
63,
885,
29,
505,
480,
2580,
63,
4208,
63,
86,
20,
26322,
2151,
5062,
63,
498,
29,
549,
9,
421,
199,
533,
4580,
1985,
8,
697,
14,
1685,
304,
272,
408,
6408,
4580,
1985,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
18723,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
3747,
29,
549,
12,
7854,
29,
797,
9,
272,
16685,
2285,
275,
1592,
14,
11704,
480,
27807,
401,
23412,
628,
14940,
531,
272,
10747,
275,
1592,
14,
11704,
480,
8814,
401,
23412,
628,
14940,
531,
339,
347,
2022,
8,
277,
304,
267,
408,
9653,
2021,
624,
398,
372,
2420,
344,
582,
291,
14,
344,
12,
298,
14940,
582,
291,
14,
14940,
93,
421,
199,
533,
23896,
8,
697,
14,
1685,
304,
272,
408,
6408,
23896,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
6714,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
7854,
29,
797,
9,
272,
4503,
275,
1592,
14,
11704,
480,
7692,
401,
23412,
628,
4753,
531,
339,
347,
2022,
8,
277,
304,
267,
408,
9653,
2021,
624,
267,
372,
2420,
344,
582,
291,
14,
344,
12,
298,
1086,
582,
291,
14,
1086,
93,
421,
199,
533,
377,
287,
867,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
377,
287,
867,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
536,
275,
1592,
14,
4547,
8,
697,
14,
1558,
8,
3912,
395,
3747,
29,
549,
12,
7854,
29,
797,
9,
272,
10747,
275,
1592,
14,
11704,
480,
8814,
401,
23412,
628,
4647,
531,
272,
18723,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
1592,
14,
3190,
480,
14940,
14,
344,
2237,
339,
347,
2022,
8,
277,
12,
10747,
29,
549,
304,
267,
408,
9653,
2021,
624,
398,
754,
275,
2420,
344,
582,
291,
14,
344,
12,
298,
354,
582,
291,
14,
354,
93,
398,
340,
291,
14,
14940,
26,
288,
754,
905,
14940,
937,
275,
291,
14,
14940,
14,
1001,
342,
398,
340,
10747,
26,
288,
754,
905,
9247,
937,
275,
359,
3251,
14,
1001,
8,
25021,
29,
797,
9,
2511,
367,
3231,
315,
291,
14,
9247,
61,
398,
372,
754,
421,
199,
533,
19317,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
19317,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
536,
275,
1592,
14,
4547,
8,
697,
14,
1558,
8,
3912,
395,
7854,
29,
797,
9,
272,
4503,
275,
1592,
14,
11704,
480,
7692,
401,
23412,
628,
3251,
531,
272,
8261,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
2079,
1592,
14,
3190,
480,
4647,
14,
344,
1288,
2079,
1478,
29,
549,
12,
2079,
7854,
29,
797,
9,
272,
18723,
63,
344,
275,
1592,
14,
4547,
8,
403,
12,
1592,
14,
3190,
480,
14940,
14,
344,
2237,
339,
347,
2022,
8,
277,
12,
16685,
2285,
29,
549,
304,
267,
408,
9653,
2021,
624,
398,
754,
275,
2420,
344,
582,
291,
14,
344,
12,
298,
354,
582,
291,
14,
354,
93,
398,
340,
291,
14,
14940,
26,
288,
754,
905,
14940,
937,
275,
291,
14,
14940,
14,
1001,
342,
398,
340,
16685,
2285,
26,
288,
754,
905,
4647,
937,
275,
291,
14,
4647,
14,
1001,
8,
9247,
29,
797,
9,
398,
372,
754,
421,
199,
533,
11028,
8,
697,
14,
1685,
304,
272,
408,
40,
2890,
11028,
624,
272,
1305,
275,
485,
344,
63,
2301,
342,
272,
1343,
63,
521,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
1478,
29,
549,
12,
7854,
29,
797,
9,
272,
1284,
63,
521,
275,
1592,
14,
4547,
8,
697,
14,
2674,
12,
1478,
29,
549,
12,
7854,
29,
797,
9,
272,
315,
16663,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3066,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
11597,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
14511,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
21812,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2251,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2783,
63,
262,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
2783,
63,
548,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3341,
63,
2118,
63,
1462,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3341,
63,
2118,
63,
2394,
275,
1592,
14,
4547,
8,
697,
14,
7279,
2674,
12,
7854,
29,
797,
9,
272,
3367,
16179,
63,
1462,
275,
1592,
14,
4547,
8,
697,
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1,
1,
1
] |
Elico-Corp/odoo_OCB | addons/l10n_multilang/l10n_multilang.py | 10 | 5981 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models, SUPERUSER_ID
import logging
_logger = logging.getLogger(__name__)
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
@api.multi
def process_translations(self, langs, in_field, in_ids, out_ids):
"""
This method copies translations values of templates into new Accounts/Taxes/Journals for languages selected
:param langs: List of languages to load for new records
:param in_field: Name of the translatable field of source templates
:param in_ids: Recordset of ids of source object
:param out_ids: Recordset of ids of destination object
:return: True
"""
xlat_obj = self.env['ir.translation']
#find the source from Account Template
for lang in langs:
#find the value from Translation
value = xlat_obj._get_ids(in_ids._name + ',' + in_field, 'model', lang, in_ids.ids)
counter = 0
for element in in_ids.with_context(lang=None):
if value[element.id]:
#copy Translation from Source to Destination object
xlat_obj.create({
'name': out_ids._name + ',' + in_field,
'type': 'model',
'res_id': out_ids[counter].id,
'lang': lang,
'src': element.name,
'value': value[element.id],
})
else:
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' %(lang, element.name))
counter += 1
return True
@api.multi
def process_coa_translations(self):
installed_lang_ids = self.env['res.lang'].search([])
installed_langs = [x.code for x in installed_lang_ids]
company_obj = self.env['res.company']
for chart_template_id in self:
langs = []
if chart_template_id.spoken_languages:
for lang in chart_template_id.spoken_languages.split(';'):
if lang not in installed_langs:
# the language is not installed, so we don't need to load its translations
continue
else:
langs.append(lang)
if langs:
company_ids = company_obj.search([('chart_template_id', '=', chart_template_id.id)])
for company in company_ids:
# write account.account translations in the real COA
chart_template_id._process_accounts_translations(company.id, langs, 'name')
# copy account.tax name translations
chart_template_id._process_taxes_translations(company.id, langs, 'name')
# copy account.tax description translations
chart_template_id._process_taxes_translations(company.id, langs, 'description')
# copy account.fiscal.position translations
chart_template_id._process_fiscal_pos_translations(company.id, langs, 'name')
return True
@api.multi
def _process_accounts_translations(self, company_id, langs, field):
in_ids = self.env['account.account.template'].search([('chart_template_id', '=', self.id)], order='id')
out_ids = self.env['account.account'].search([('company_id', '=', company_id)], order='id')
return self.process_translations(langs, field, in_ids, out_ids)
@api.multi
def _process_taxes_translations(self, company_id, langs, field):
in_ids = self.env['account.tax.template'].search([('chart_template_id', '=', self.id)], order='id')
out_ids = self.env['account.tax'].search([('company_id', '=', company_id)], order='id')
return self.process_translations(langs, field, in_ids, out_ids)
@api.multi
def _process_fiscal_pos_translations(self, company_id, langs, field):
in_ids = self.env['account.fiscal.position.template'].search([('chart_template_id', '=', self.id)], order='id')
out_ids = self.env['account.fiscal.position'].search([('company_id', '=', company_id)], order='id')
return self.process_translations(langs, field, in_ids, out_ids)
class base_language_install(models.TransientModel):
""" Install Language"""
_inherit = "base.language.install"
@api.multi
def lang_install(self):
self.ensure_one()
already_installed = self.env['res.lang'].search_count([('code', '=', self.lang)])
res = super(base_language_install, self).lang_install()
if already_installed:
# update of translations instead of new installation
# skip to avoid duplicating the translations
return res
# CoA in multilang mode
for coa in self.env['account.chart.template'].search([('spoken_languages', '!=', False)]):
if self.lang in coa.spoken_languages.split(';'):
# companies on which it is installed
for company in self.env['res.company'].search([('chart_template_id', '=', coa.id)]):
# write account.account translations in the real COA
coa._process_accounts_translations(company.id, [self.lang], 'name')
# copy account.tax name translations
coa._process_taxes_translations(company.id, [self.lang], 'name')
# copy account.tax description translations
coa._process_taxes_translations(company.id, [self.lang], 'description')
# copy account.fiscal.position translations
coa._process_fiscal_pos_translations(company.id, [self.lang], 'name')
return res
| agpl-3.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
14320,
402,
28935,
14,
1666,
5113,
570,
367,
2615,
4248,
436,
32572,
2436,
14,
199,
199,
504,
5166,
492,
2986,
12,
1709,
12,
12824,
63,
998,
199,
646,
2050,
199,
63,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
199,
533,
9973,
16372,
4231,
8,
992,
14,
1685,
304,
272,
485,
6486,
275,
283,
2048,
14,
9019,
14,
1160,
7,
339,
768,
1246,
14,
3029,
272,
347,
2112,
63,
13982,
8,
277,
12,
31769,
12,
315,
63,
698,
12,
315,
63,
1580,
12,
734,
63,
1580,
304,
267,
408,
267,
961,
1083,
6866,
15547,
1338,
402,
7009,
1901,
892,
4473,
6851,
15,
52,
6402,
15,
5691,
31212,
367,
10815,
4895,
398,
520,
635,
31769,
26,
3820,
402,
10815,
370,
2248,
367,
892,
5767,
267,
520,
635,
315,
63,
698,
26,
2812,
402,
314,
1752,
25099,
901,
402,
1350,
7009,
267,
520,
635,
315,
63,
1580,
26,
12651,
409,
402,
2762,
402,
1350,
909,
267,
520,
635,
734,
63,
1580,
26,
12651,
409,
402,
2762,
402,
5724,
909,
398,
520,
1107,
26,
715,
267,
408,
267,
671,
4452,
63,
1113,
275,
291,
14,
1813,
459,
723,
14,
6893,
418,
267,
327,
1623,
314,
1350,
687,
9973,
5458,
267,
367,
6339,
315,
31769,
26,
288,
327,
1623,
314,
574,
687,
25224,
288,
574,
275,
671,
4452,
63,
1113,
423,
362,
63,
1580,
8,
262,
63,
1580,
423,
354,
435,
13647,
435,
315,
63,
698,
12,
283,
1238,
297,
6339,
12,
315,
63,
1580,
14,
1580,
9,
288,
7055,
275,
378,
288,
367,
1819,
315,
315,
63,
1580,
14,
1045,
63,
1100,
8,
4159,
29,
403,
304,
355,
340,
574,
59,
2108,
14,
344,
2189,
490,
327,
1574,
25224,
687,
5800,
370,
28505,
909,
490,
671,
4452,
63,
1113,
14,
981,
2561,
717,
283,
354,
356,
734,
63,
1580,
423,
354,
435,
13647,
435,
315,
63,
698,
12,
717,
283,
466,
356,
283,
1238,
297,
717,
283,
470,
63,
344,
356,
734,
63,
1580,
59,
5337,
1055,
344,
12,
717,
283,
4159,
356,
6339,
12,
717,
283,
2164,
356,
1819,
14,
354,
12,
717,
283,
585,
356,
574,
59,
2108,
14,
344,
467,
490,
3828,
355,
587,
26,
490,
485,
2921,
14,
815,
360,
8493,
26,
450,
83,
14,
25224,
687,
1978,
26,
2337,
365,
949,
7761,
2808,
367,
450,
83,
11213,
2818,
4159,
12,
221,
1819,
14,
354,
430,
355,
7055,
847,
413,
267,
372,
715,
339,
768,
1246,
14,
3029,
272,
347,
2112,
63,
331,
65,
63,
13982,
8,
277,
304,
267,
4903,
63,
4159,
63,
1580,
275,
291,
14,
1813,
459,
470,
14,
4159,
2278,
1733,
4157,
267,
4903,
63,
28182,
275,
359,
88,
14,
600,
367,
671,
315,
4903,
63,
4159,
63,
1580,
61,
267,
7233,
63,
1113,
275,
291,
14,
1813,
459,
470,
14,
4627,
418,
267,
367,
10943,
63,
1160,
63,
344,
315,
291,
26,
288,
31769,
275,
942,
288,
340,
10943,
63,
1160,
63,
344,
14,
22522,
917,
63,
13209,
26,
355,
367,
6339,
315,
10943,
63,
1160,
63,
344,
14,
22522,
917,
63,
13209,
14,
1294,
25282,
735,
490,
340,
6339,
440,
315,
4903,
63,
28182,
26,
717,
327,
314,
2637,
365,
440,
4903,
12,
880,
781,
2793,
1133,
1929,
370,
2248,
2399,
15547,
717,
1980,
490,
587,
26,
717,
31769,
14,
740,
8,
4159,
9,
355,
340,
31769,
26,
490,
7233,
63,
1580,
275,
7233,
63,
1113,
14,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
10943,
63,
1160,
63,
344,
14,
344,
3948,
490,
367,
7233,
315,
7233,
63,
1580,
26,
717,
327,
2218,
2933,
14,
2048,
15547,
315,
314,
3363,
5099,
33,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
8370,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
717,
327,
1331,
2933,
14,
5530,
536,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
22272,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
717,
327,
1331,
2933,
14,
5530,
1369,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
22272,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
1802,
358,
717,
327,
1331,
2933,
14,
18646,
14,
3124,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
18646,
63,
1712,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
267,
372,
715,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
8370,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
2048,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
2048,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63,
13982,
8,
28182,
12,
901,
12,
315,
63,
1580,
12,
734,
63,
1580,
9,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
22272,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
5530,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
5530,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63,
13982,
8,
28182,
12,
901,
12,
315,
63,
1580,
12,
734,
63,
1580,
9,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
18646,
63,
1712,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
18646,
14,
3124,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
18646,
14,
3124,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
14320,
402,
28935,
14,
1666,
5113,
570,
367,
2615,
4248,
436,
32572,
2436,
14,
199,
199,
504,
5166,
492,
2986,
12,
1709,
12,
12824,
63,
998,
199,
646,
2050,
199,
63,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
199,
533,
9973,
16372,
4231,
8,
992,
14,
1685,
304,
272,
485,
6486,
275,
283,
2048,
14,
9019,
14,
1160,
7,
339,
768,
1246,
14,
3029,
272,
347,
2112,
63,
13982,
8,
277,
12,
31769,
12,
315,
63,
698,
12,
315,
63,
1580,
12,
734,
63,
1580,
304,
267,
408,
267,
961,
1083,
6866,
15547,
1338,
402,
7009,
1901,
892,
4473,
6851,
15,
52,
6402,
15,
5691,
31212,
367,
10815,
4895,
398,
520,
635,
31769,
26,
3820,
402,
10815,
370,
2248,
367,
892,
5767,
267,
520,
635,
315,
63,
698,
26,
2812,
402,
314,
1752,
25099,
901,
402,
1350,
7009,
267,
520,
635,
315,
63,
1580,
26,
12651,
409,
402,
2762,
402,
1350,
909,
267,
520,
635,
734,
63,
1580,
26,
12651,
409,
402,
2762,
402,
5724,
909,
398,
520,
1107,
26,
715,
267,
408,
267,
671,
4452,
63,
1113,
275,
291,
14,
1813,
459,
723,
14,
6893,
418,
267,
327,
1623,
314,
1350,
687,
9973,
5458,
267,
367,
6339,
315,
31769,
26,
288,
327,
1623,
314,
574,
687,
25224,
288,
574,
275,
671,
4452,
63,
1113,
423,
362,
63,
1580,
8,
262,
63,
1580,
423,
354,
435,
13647,
435,
315,
63,
698,
12,
283,
1238,
297,
6339,
12,
315,
63,
1580,
14,
1580,
9,
288,
7055,
275,
378,
288,
367,
1819,
315,
315,
63,
1580,
14,
1045,
63,
1100,
8,
4159,
29,
403,
304,
355,
340,
574,
59,
2108,
14,
344,
2189,
490,
327,
1574,
25224,
687,
5800,
370,
28505,
909,
490,
671,
4452,
63,
1113,
14,
981,
2561,
717,
283,
354,
356,
734,
63,
1580,
423,
354,
435,
13647,
435,
315,
63,
698,
12,
717,
283,
466,
356,
283,
1238,
297,
717,
283,
470,
63,
344,
356,
734,
63,
1580,
59,
5337,
1055,
344,
12,
717,
283,
4159,
356,
6339,
12,
717,
283,
2164,
356,
1819,
14,
354,
12,
717,
283,
585,
356,
574,
59,
2108,
14,
344,
467,
490,
3828,
355,
587,
26,
490,
485,
2921,
14,
815,
360,
8493,
26,
450,
83,
14,
25224,
687,
1978,
26,
2337,
365,
949,
7761,
2808,
367,
450,
83,
11213,
2818,
4159,
12,
221,
1819,
14,
354,
430,
355,
7055,
847,
413,
267,
372,
715,
339,
768,
1246,
14,
3029,
272,
347,
2112,
63,
331,
65,
63,
13982,
8,
277,
304,
267,
4903,
63,
4159,
63,
1580,
275,
291,
14,
1813,
459,
470,
14,
4159,
2278,
1733,
4157,
267,
4903,
63,
28182,
275,
359,
88,
14,
600,
367,
671,
315,
4903,
63,
4159,
63,
1580,
61,
267,
7233,
63,
1113,
275,
291,
14,
1813,
459,
470,
14,
4627,
418,
267,
367,
10943,
63,
1160,
63,
344,
315,
291,
26,
288,
31769,
275,
942,
288,
340,
10943,
63,
1160,
63,
344,
14,
22522,
917,
63,
13209,
26,
355,
367,
6339,
315,
10943,
63,
1160,
63,
344,
14,
22522,
917,
63,
13209,
14,
1294,
25282,
735,
490,
340,
6339,
440,
315,
4903,
63,
28182,
26,
717,
327,
314,
2637,
365,
440,
4903,
12,
880,
781,
2793,
1133,
1929,
370,
2248,
2399,
15547,
717,
1980,
490,
587,
26,
717,
31769,
14,
740,
8,
4159,
9,
355,
340,
31769,
26,
490,
7233,
63,
1580,
275,
7233,
63,
1113,
14,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
10943,
63,
1160,
63,
344,
14,
344,
3948,
490,
367,
7233,
315,
7233,
63,
1580,
26,
717,
327,
2218,
2933,
14,
2048,
15547,
315,
314,
3363,
5099,
33,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
8370,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
717,
327,
1331,
2933,
14,
5530,
536,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
22272,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
717,
327,
1331,
2933,
14,
5530,
1369,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
22272,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
1802,
358,
717,
327,
1331,
2933,
14,
18646,
14,
3124,
15547,
717,
10943,
63,
1160,
63,
344,
423,
1412,
63,
18646,
63,
1712,
63,
13982,
8,
4627,
14,
344,
12,
31769,
12,
283,
354,
358,
267,
372,
715,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
8370,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
2048,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
2048,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63,
13982,
8,
28182,
12,
901,
12,
315,
63,
1580,
12,
734,
63,
1580,
9,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
22272,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
5530,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
5530,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63,
13982,
8,
28182,
12,
901,
12,
315,
63,
1580,
12,
734,
63,
1580,
9,
339,
768,
1246,
14,
3029,
272,
347,
485,
1412,
63,
18646,
63,
1712,
63,
13982,
8,
277,
12,
7233,
63,
344,
12,
31769,
12,
901,
304,
267,
315,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
18646,
14,
3124,
14,
1160,
2278,
1733,
8318,
9019,
63,
1160,
63,
344,
297,
6291,
291,
14,
344,
4360,
1865,
534,
344,
358,
267,
734,
63,
1580,
275,
291,
14,
1813,
459,
2048,
14,
18646,
14,
3124,
2278,
1733,
8318,
4627,
63,
344,
297,
6291,
7233,
63,
344,
4360,
1865,
534,
344,
358,
267,
372,
291,
14,
1412,
63,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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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
] |
analurandis/Tur | backend/venv/Lib/site-packages/Cheetah/Tools/CGITemplate.py | 15 | 2200 | # $Id: CGITemplate.py,v 1.6 2006/01/29 02:09:59 tavis_rudd Exp $
"""A subclass of Cheetah.Template for use in CGI scripts.
Usage in a template:
#extends Cheetah.Tools.CGITemplate
#implements respond
$cgiHeaders#slurp
Usage in a template inheriting a Python class:
1. The template
#extends MyPythonClass
#implements respond
$cgiHeaders#slurp
2. The Python class
from Cheetah.Tools import CGITemplate
class MyPythonClass(CGITemplate):
def cgiHeadersHook(self):
return "Content-Type: text/html; charset=koi8-r\n\n"
To read GET/POST variables, use the .webInput method defined in
Cheetah.Utils.WebInputMixin (available in all templates without importing
anything), use Python's 'cgi' module, or make your own arrangements.
This class inherits from Cheetah.Template to make it usable in Cheetah's
single-inheritance model.
Meta-Data
================================================================================
Author: Mike Orr <iron@mso.oz.net>
License: This software is released for unlimited distribution under the
terms of the MIT license. See the LICENSE file.
Version: $Revision: 1.6 $
Start Date: 2001/10/03
Last Revision Date: $Date: 2006/01/29 02:09:59 $
"""
__author__ = "Mike Orr <iron@mso.oz.net>"
__revision__ = "$Revision: 1.6 $"[11:-2]
import os
from Cheetah.Template import Template
class CGITemplate(Template):
"""Methods useful in CGI scripts.
Any class that inherits this mixin must also inherit Cheetah.Servlet.
"""
def cgiHeaders(self):
"""Outputs the CGI headers if this is a CGI script.
Usage: $cgiHeaders#slurp
Override .cgiHeadersHook() if you want to customize the headers.
"""
if self.isCgi():
return self.cgiHeadersHook()
def cgiHeadersHook(self):
"""Override if you want to customize the CGI headers.
"""
return "Content-type: text/html\n\n"
def isCgi(self):
"""Is this a CGI script?
"""
env = 'REQUEST_METHOD' in os.environ
wk = self._CHEETAH__isControlledByWebKit
return env and not wk
# vim: shiftwidth=4 tabstop=4 expandtab
| mit | [
3,
2672,
1304,
26,
18657,
649,
3051,
14,
647,
12,
86,
413,
14,
22,
8315,
15,
614,
15,
1398,
12497,
26,
1643,
26,
1427,
307,
1214,
374,
63,
6558,
617,
7910,
2672,
199,
624,
33,
5516,
402,
445,
426,
1841,
72,
14,
4231,
367,
675,
315,
28716,
10554,
14,
199,
199,
7692,
315,
282,
1978,
26,
272,
327,
11036,
445,
426,
1841,
72,
14,
11654,
14,
4064,
649,
3051,
272,
327,
24900,
22722,
272,
2672,
13814,
9883,
3,
2482,
300,
80,
199,
199,
7692,
315,
282,
1978,
29927,
282,
2018,
1021,
26,
199,
17,
14,
710,
1978,
272,
327,
11036,
4932,
4718,
2543,
272,
327,
24900,
22722,
272,
2672,
13814,
9883,
3,
2482,
300,
80,
199,
199,
18,
14,
710,
2018,
1021,
272,
687,
445,
426,
1841,
72,
14,
11654,
492,
18657,
649,
3051,
272,
1021,
4932,
4718,
2543,
8,
4064,
649,
3051,
304,
267,
347,
16004,
9883,
8481,
8,
277,
304,
288,
372,
298,
2714,
13,
804,
26,
1318,
15,
1360,
27,
5960,
29,
7697,
73,
24,
13,
82,
60,
78,
60,
78,
2,
199,
199,
1378,
1586,
9576,
15,
4030,
2860,
12,
675,
314,
1275,
2520,
3205,
1083,
3247,
315,
199,
20335,
1841,
72,
14,
7535,
14,
5926,
3205,
4256,
334,
4561,
315,
1006,
7009,
1928,
16306,
199,
25058,
395,
675,
2018,
1159,
283,
13814,
7,
859,
12,
503,
1852,
2195,
5705,
601,
1842,
1470,
14,
199,
199,
2765,
1021,
21592,
687,
445,
426,
1841,
72,
14,
4231,
370,
1852,
652,
18025,
315,
445,
426,
1841,
72,
1159,
199,
4780,
13,
13136,
1402,
14,
257,
421,
199,
3396,
13,
1451,
199,
5695,
1280,
199,
5949,
26,
603,
7455,
4236,
82,
665,
26789,
32,
706,
79,
14,
26051,
14,
846,
30,
199,
3761,
26,
961,
2032,
365,
14286,
367,
625,
14136,
4084,
1334,
314,
268,
2895,
402,
314,
10697,
4190,
14,
221,
1666,
314,
5113,
570,
14,
199,
3353,
26,
2672,
12714,
26,
413,
14,
22,
2672,
199,
3162,
6148,
26,
12521,
15,
709,
15,
1644,
199,
6090,
27095,
6148,
26,
2672,
2506,
26,
8315,
15,
614,
15,
1398,
12497,
26,
1643,
26,
1427,
2672,
199,
624,
221,
199,
363,
2502,
363,
275,
298,
45,
7455,
4236,
82,
665,
26789,
32,
706,
79,
14,
26051,
14,
846,
4335,
199,
363,
5792,
363,
275,
7880,
12714,
26,
413,
14,
22,
2672,
22774,
845,
6809,
18,
61,
199,
199,
646,
747,
199,
504,
445,
426,
1841,
72,
14,
4231,
492,
5458,
199,
199,
533,
18657,
649,
3051,
8,
4231,
304,
272,
408,
10385,
2997,
315,
28716,
10554,
14,
10817,
6184,
1021,
626,
21592,
642,
20048,
1471,
2597,
8287,
445,
426,
1841,
72,
14,
1505,
86,
2723,
14,
272,
408,
1362,
339,
347,
16004,
9883,
8,
277,
304,
267,
408,
18669,
314,
28716,
2323,
340,
642,
365,
282,
28716,
2884,
14,
13596,
11028,
26,
221,
2672,
13814,
9883,
3,
2482,
300,
80,
1779,
11041,
1275,
13814,
9883,
8481,
342,
340,
1265,
2934,
370,
17551,
314,
2323,
14,
267,
408,
267,
340,
291,
14,
374,
35,
6153,
837,
288,
372,
291,
14,
13814,
9883,
8481,
342,
16478,
347,
16004,
9883,
8481,
8,
277,
304,
267,
408,
11954,
340,
1265,
2934,
370,
17551,
314,
28716,
2323,
14,
267,
408,
267,
372,
298,
2714,
13,
466,
26,
1318,
15,
1360,
60,
78,
60,
78,
2,
2378,
347,
365,
35,
6153,
8,
277,
304,
267,
408,
1831,
642,
282,
28716,
2884,
31,
267,
408,
267,
2589,
275,
283,
6780,
63,
9977,
7,
315,
747,
14,
2314,
4960,
336,
75,
275,
291,
423,
4576,
15808,
40,
363,
374,
3717,
1146,
2175,
21666,
267,
372,
2589,
436,
440,
336,
75,
421,
1362,
199,
3,
6695,
26,
20105,
29,
20,
20849,
29,
20,
26414,
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
] | [
2672,
1304,
26,
18657,
649,
3051,
14,
647,
12,
86,
413,
14,
22,
8315,
15,
614,
15,
1398,
12497,
26,
1643,
26,
1427,
307,
1214,
374,
63,
6558,
617,
7910,
2672,
199,
624,
33,
5516,
402,
445,
426,
1841,
72,
14,
4231,
367,
675,
315,
28716,
10554,
14,
199,
199,
7692,
315,
282,
1978,
26,
272,
327,
11036,
445,
426,
1841,
72,
14,
11654,
14,
4064,
649,
3051,
272,
327,
24900,
22722,
272,
2672,
13814,
9883,
3,
2482,
300,
80,
199,
199,
7692,
315,
282,
1978,
29927,
282,
2018,
1021,
26,
199,
17,
14,
710,
1978,
272,
327,
11036,
4932,
4718,
2543,
272,
327,
24900,
22722,
272,
2672,
13814,
9883,
3,
2482,
300,
80,
199,
199,
18,
14,
710,
2018,
1021,
272,
687,
445,
426,
1841,
72,
14,
11654,
492,
18657,
649,
3051,
272,
1021,
4932,
4718,
2543,
8,
4064,
649,
3051,
304,
267,
347,
16004,
9883,
8481,
8,
277,
304,
288,
372,
298,
2714,
13,
804,
26,
1318,
15,
1360,
27,
5960,
29,
7697,
73,
24,
13,
82,
60,
78,
60,
78,
2,
199,
199,
1378,
1586,
9576,
15,
4030,
2860,
12,
675,
314,
1275,
2520,
3205,
1083,
3247,
315,
199,
20335,
1841,
72,
14,
7535,
14,
5926,
3205,
4256,
334,
4561,
315,
1006,
7009,
1928,
16306,
199,
25058,
395,
675,
2018,
1159,
283,
13814,
7,
859,
12,
503,
1852,
2195,
5705,
601,
1842,
1470,
14,
199,
199,
2765,
1021,
21592,
687,
445,
426,
1841,
72,
14,
4231,
370,
1852,
652,
18025,
315,
445,
426,
1841,
72,
1159,
199,
4780,
13,
13136,
1402,
14,
257,
421,
199,
3396,
13,
1451,
199,
5695,
1280,
199,
5949,
26,
603,
7455,
4236,
82,
665,
26789,
32,
706,
79,
14,
26051,
14,
846,
30,
199,
3761,
26,
961,
2032,
365,
14286,
367,
625,
14136,
4084,
1334,
314,
268,
2895,
402,
314,
10697,
4190,
14,
221,
1666,
314,
5113,
570,
14,
199,
3353,
26,
2672,
12714,
26,
413,
14,
22,
2672,
199,
3162,
6148,
26,
12521,
15,
709,
15,
1644,
199,
6090,
27095,
6148,
26,
2672,
2506,
26,
8315,
15,
614,
15,
1398,
12497,
26,
1643,
26,
1427,
2672,
199,
624,
221,
199,
363,
2502,
363,
275,
298,
45,
7455,
4236,
82,
665,
26789,
32,
706,
79,
14,
26051,
14,
846,
4335,
199,
363,
5792,
363,
275,
7880,
12714,
26,
413,
14,
22,
2672,
22774,
845,
6809,
18,
61,
199,
199,
646,
747,
199,
504,
445,
426,
1841,
72,
14,
4231,
492,
5458,
199,
199,
533,
18657,
649,
3051,
8,
4231,
304,
272,
408,
10385,
2997,
315,
28716,
10554,
14,
10817,
6184,
1021,
626,
21592,
642,
20048,
1471,
2597,
8287,
445,
426,
1841,
72,
14,
1505,
86,
2723,
14,
272,
408,
1362,
339,
347,
16004,
9883,
8,
277,
304,
267,
408,
18669,
314,
28716,
2323,
340,
642,
365,
282,
28716,
2884,
14,
13596,
11028,
26,
221,
2672,
13814,
9883,
3,
2482,
300,
80,
1779,
11041,
1275,
13814,
9883,
8481,
342,
340,
1265,
2934,
370,
17551,
314,
2323,
14,
267,
408,
267,
340,
291,
14,
374,
35,
6153,
837,
288,
372,
291,
14,
13814,
9883,
8481,
342,
16478,
347,
16004,
9883,
8481,
8,
277,
304,
267,
408,
11954,
340,
1265,
2934,
370,
17551,
314,
28716,
2323,
14,
267,
408,
267,
372,
298,
2714,
13,
466,
26,
1318,
15,
1360,
60,
78,
60,
78,
2,
2378,
347,
365,
35,
6153,
8,
277,
304,
267,
408,
1831,
642,
282,
28716,
2884,
31,
267,
408,
267,
2589,
275,
283,
6780,
63,
9977,
7,
315,
747,
14,
2314,
4960,
336,
75,
275,
291,
423,
4576,
15808,
40,
363,
374,
3717,
1146,
2175,
21666,
267,
372,
2589,
436,
440,
336,
75,
421,
1362,
199,
3,
6695,
26,
20105,
29,
20,
20849,
29,
20,
26414,
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,
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,
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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
] |
TraurigeNarr/ThirdParties | assimp-3.2/test/regression/gen_db.py | 16 | 8088 | #!/usr/bin/env python3
# -*- Coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# Open Asset Import Library (ASSIMP)
# ---------------------------------------------------------------------------
#
# Copyright (c) 2006-2010, ASSIMP Development Team
#
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# * Neither the name of the ASSIMP team, nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior
# written permission of the ASSIMP Development Team.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ---------------------------------------------------------------------------
"""
Generate the regression database db.zip from the files in the <root>/test/models
directory. Older databases are overwritten with no prompt but can be restored
using Git as needed.
Use --help for usage.
On Windows, use ``py run.py <arguments>`` to make sure command line parameters
are forwarded to the script.
"""
import sys
import os
import subprocess
import zipfile
import settings
import utils
usage = """gen_db [assimp_binary] [-i=...] [-e=...] [-p] [-n]
The assimp_cmd (or assimp) binary to use is specified by the first
command line argument and defaults to ``assimp``.
To build, set ``ASSIMP_BUILD_ASSIMP_TOOLS=ON`` in CMake. If generating
configs for an IDE, make sure to build the assimp_cmd project.
-i,--include: List of file extensions to update dumps for. If omitted,
all file extensions are updated except those in `exclude`.
Example: -ixyz,abc
-i.xyz,.abc
--include=xyz,abc
-e,--exclude: Merged with settings.exclude_extensions to produce a
list of all file extensions to ignore. If dumps exist,
they are not altered. If not, theu are not created.
-p,--preview: Preview list of file extensions touched by the update.
Dont' change anything.
-n,--nozip: Don't pack to ZIP archive. Keep all dumps in individual files.
"""
# -------------------------------------------------------------------------------
def process_dir(d, outfile, file_filter):
""" Generate small dump records for all files in 'd' """
print("Processing directory " + d)
num = 0
for f in os.listdir(d):
fullp = os.path.join(d, f)
if os.path.isdir(fullp) and not f == ".svn":
num += process_dir(fullp, outfile, file_filter)
continue
if file_filter(f):
for pp in settings.pp_configs_to_test:
num += 1
print("DUMP " + fullp + "\n post-processing: " + pp)
outf = os.path.join(os.getcwd(), settings.database_name,
utils.hashing(fullp, pp))
cmd = [ assimp_bin_path, "dump", fullp, outf, "-b", "-s", "-l" ] + pp.split()
outfile.write("assimp dump "+"-"*80+"\n")
outfile.flush()
if subprocess.call(cmd, stdout=outfile, stderr=outfile, shell=False):
print("Failure processing " + fullp)
# spit out an empty file to indicate that this failure is expected
with open(outf,'wb') as f:
pass
return num
# -------------------------------------------------------------------------------
def make_zip():
"""Zip the contents of ./<settings.database_name>
to <settings.database_name>.zip using DEFLATE
compression to minimize the file size. """
num = 0
zipout = zipfile.ZipFile(settings.database_name + ".zip", "w", zipfile.ZIP_DEFLATED)
for f in os.listdir(settings.database_name):
p = os.path.join(settings.database_name, f)
zipout.write(p, f)
if settings.remove_old:
os.remove(p)
num += 1
if settings.remove_old:
os.rmdir(settings.database_name)
bad = zipout.testzip()
assert bad is None
print("="*60)
print("Database contains {0} entries".format(num))
# -------------------------------------------------------------------------------
def extract_zip():
"""Unzip <settings.database_name>.zip to
./<settings.database_name>"""
try:
zipout = zipfile.ZipFile(settings.database_name + ".zip", "r", 0)
zipout.extractall(path=settings.database_name)
except (RuntimeError,IOError) as r:
print(r)
print("failed to extract previous ZIP contents. "\
"DB is generated from scratch.")
# -------------------------------------------------------------------------------
def gen_db(ext_list,outfile):
"""Generate the crash dump database in
./<settings.database_name>"""
try:
os.mkdir(settings.database_name)
except OSError:
pass
num = 0
for tp in settings.model_directories:
num += process_dir(tp, outfile,
lambda x: os.path.splitext(x)[1].lower() in ext_list and not x in settings.files_to_ignore)
print("="*60)
print("Updated {0} entries".format(num))
# -------------------------------------------------------------------------------
if __name__ == "__main__":
def clean(f):
f = f.strip("* \'")
return "."+f if f[:1] != '.' else f
if len(sys.argv) <= 1 or sys.argv[1] == "--help" or sys.argv[1] == "-h":
print(usage)
sys.exit(0)
assimp_bin_path = sys.argv[1]
ext_list, preview, nozip = None, False, False
for m in sys.argv[2:]:
if m[:10]=="--exclude=":
settings.exclude_extensions += map(clean, m[10:].split(","))
elif m[:2]=="-e":
settings.exclude_extensions += map(clean, m[2:].split(","))
elif m[:10]=="--include=":
ext_list = m[10:].split(",")
elif m[:2]=="-i":
ext_list = m[2:].split(",")
elif m=="-p" or m == "--preview":
preview = True
elif m=="-n" or m == "--nozip":
nozip = True
else:
print("Unrecognized parameter: " + m)
sys.exit(-1)
outfile = open(os.path.join("..", "results", "gen_regression_db_output.txt"), "w")
if ext_list is None:
(ext_list, err) = subprocess.Popen([assimp_bin_path, "listext"],
stdout=subprocess.PIPE).communicate()
ext_list = str(ext_list.strip()).lower().split(";")
# todo: Fix for multi dot extensions like .skeleton.xml
ext_list = list(filter(lambda f: not f in settings.exclude_extensions,
map(clean, ext_list)))
print('File extensions processed: ' + ', '.join(ext_list))
if preview:
sys.exit(1)
extract_zip()
gen_db(ext_list,outfile)
make_zip()
print("="*60)
input("Press any key to continue")
sys.exit(0)
# vim: ai ts=4 sts=4 et sw=4
| gpl-2.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
19,
199,
3,
1882,
28312,
26,
9094,
13,
24,
1882,
199,
199,
3,
5620,
13715,
199,
3,
3232,
25670,
3161,
11243,
334,
3755,
8947,
9,
199,
3,
5620,
13715,
199,
3,
199,
3,
1898,
334,
67,
9,
8315,
13,
6542,
12,
17567,
8947,
15290,
11682,
199,
3,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
402,
642,
2032,
315,
1350,
436,
3366,
4513,
12,
221,
199,
3,
543,
503,
1928,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
221,
199,
3,
3704,
787,
7647,
26,
199,
3,
221,
199,
3,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
199,
3,
257,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
199,
3,
257,
2569,
6450,
14,
199,
3,
221,
199,
3,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
257,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
199,
3,
257,
2569,
6450,
315,
314,
3794,
436,
15,
269,
1163,
199,
3,
257,
8418,
2741,
543,
314,
4084,
14,
199,
3,
221,
199,
3,
627,
11443,
314,
536,
402,
314,
17567,
8947,
8099,
12,
6590,
314,
1561,
402,
2399,
199,
3,
257,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
199,
3,
257,
7131,
687,
642,
2032,
1928,
2488,
6791,
199,
3,
257,
5313,
4983,
402,
314,
17567,
8947,
15290,
11682,
14,
199,
3,
221,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
221,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
221,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
221,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
221,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
221,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
221,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
221,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
5620,
13715,
199,
199,
624,
199,
6864,
314,
10864,
3050,
1592,
14,
3065,
687,
314,
1584,
315,
314,
665,
1231,
12202,
396,
15,
992,
199,
3619,
14,
593,
76,
424,
16219,
787,
20200,
543,
949,
8457,
1325,
883,
506,
14429,
199,
4941,
12579,
465,
4346,
14,
199,
199,
6119,
1553,
3437,
367,
4503,
14,
199,
199,
3314,
5417,
12,
675,
1124,
647,
1255,
14,
647,
665,
4958,
28210,
370,
1852,
3238,
1414,
1004,
2633,
199,
1530,
24172,
370,
314,
2884,
14,
199,
624,
199,
199,
646,
984,
199,
646,
747,
199,
646,
3873,
199,
646,
10392,
199,
199,
646,
2202,
199,
646,
3778,
199,
199,
3807,
275,
408,
2268,
63,
697,
359,
2608,
311,
63,
3008,
61,
5243,
73,
29,
18737,
5243,
69,
29,
18737,
5243,
80,
61,
5243,
78,
61,
199,
199,
1918,
465,
11184,
63,
1760,
334,
269,
465,
11184,
9,
3366,
370,
675,
365,
2013,
701,
314,
1642,
199,
1531,
1004,
1423,
436,
4243,
370,
1124,
2608,
311,
4345,
199,
199,
1378,
1900,
12,
663,
1124,
3755,
8947,
63,
8248,
63,
3755,
8947,
63,
20261,
29,
615,
1040,
315,
21355,
14,
982,
12999,
199,
7532,
367,
376,
473,
1093,
12,
1852,
3238,
370,
1900,
314,
465,
11184,
63,
1760,
2199,
14,
199,
199,
13,
73,
28925,
2613,
26,
3820,
402,
570,
5478,
370,
1678,
16864,
367,
14,
982,
11684,
12,
268,
1006,
570,
5478,
787,
4588,
871,
5204,
315,
658,
5473,
2313,
268,
5679,
26,
446,
1148,
19873,
12,
3175,
2116,
446,
73,
14,
8568,
18485,
3175,
2116,
1553,
2613,
29,
8568,
12,
3175,
199,
199,
13,
69,
28925,
5473,
26,
18880,
3046,
543,
2202,
14,
5473,
63,
5359,
370,
7389,
282,
268,
769,
402,
1006,
570,
5478,
370,
3686,
14,
982,
16864,
2187,
12,
268,
2985,
787,
440,
29815,
14,
982,
440,
12,
314,
85,
787,
440,
2737,
14,
199,
199,
13,
80,
28925,
7780,
26,
5543,
1345,
769,
402,
570,
5478,
370,
22821,
701,
314,
1678,
14,
268,
577,
1888,
7,
1570,
7003,
14,
199,
199,
13,
78,
28925,
889,
3065,
26,
7529,
1133,
1706,
370,
18402,
6359,
14,
14797,
1006,
16864,
315,
8212,
1584,
14,
199,
624,
199,
199,
3,
5620,
18964,
199,
318,
2112,
63,
694,
8,
68,
12,
4386,
12,
570,
63,
1541,
304,
272,
408,
7958,
7425,
5461,
5767,
367,
1006,
1584,
315,
283,
68,
7,
408,
272,
870,
480,
9589,
2082,
298,
435,
366,
9,
339,
1967,
275,
378,
272,
367,
289,
315,
747,
14,
7374,
8,
68,
304,
267,
2615,
80,
275,
747,
14,
515,
14,
904,
8,
68,
12,
289,
9,
267,
340,
747,
14,
515,
14,
6027,
8,
2861,
80,
9,
436,
440,
289,
508,
3680,
6836,
582,
288,
1967,
847,
2112,
63,
694,
8,
2861,
80,
12,
4386,
12,
570,
63,
1541,
9,
288,
1980,
398,
340,
570,
63,
1541,
8,
70,
304,
288,
367,
11618,
315,
2202,
14,
802,
63,
7532,
63,
475,
63,
396,
26,
355,
1967,
847,
413,
355,
870,
480,
26406,
298,
435,
2615,
80,
435,
1867,
78,
2963,
13,
6338,
26,
298,
435,
11618,
9,
355,
27552,
275,
747,
14,
515,
14,
904,
8,
736,
14,
9458,
1062,
2202,
14,
4659,
63,
354,
12,
490,
3778,
14,
2227,
316,
8,
2861,
80,
12,
11618,
430,
2234,
2088,
275,
359,
465,
11184,
63,
1393,
63,
515,
12,
298,
2724,
401,
2615,
80,
12,
27552,
12,
3905,
66,
401,
3905,
83,
401,
3905,
76,
2,
1622,
435,
11618,
14,
1294,
342,
355,
4386,
14,
952,
480,
2608,
311,
5461,
298,
14255,
31761,
1257,
25789,
78,
531,
355,
4386,
14,
4939,
342,
355,
340,
3873,
14,
1250,
8,
1760,
12,
3839,
29,
4984,
12,
4635,
29,
4984,
12,
5218,
29,
797,
304,
490,
870,
480,
6782,
6661,
298,
435,
2615,
80,
9
] | [
2647,
15,
1393,
15,
1813,
2366,
19,
199,
3,
1882,
28312,
26,
9094,
13,
24,
1882,
199,
199,
3,
5620,
13715,
199,
3,
3232,
25670,
3161,
11243,
334,
3755,
8947,
9,
199,
3,
5620,
13715,
199,
3,
199,
3,
1898,
334,
67,
9,
8315,
13,
6542,
12,
17567,
8947,
15290,
11682,
199,
3,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
402,
642,
2032,
315,
1350,
436,
3366,
4513,
12,
221,
199,
3,
543,
503,
1928,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
221,
199,
3,
3704,
787,
7647,
26,
199,
3,
221,
199,
3,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
199,
3,
257,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
199,
3,
257,
2569,
6450,
14,
199,
3,
221,
199,
3,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
257,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
199,
3,
257,
2569,
6450,
315,
314,
3794,
436,
15,
269,
1163,
199,
3,
257,
8418,
2741,
543,
314,
4084,
14,
199,
3,
221,
199,
3,
627,
11443,
314,
536,
402,
314,
17567,
8947,
8099,
12,
6590,
314,
1561,
402,
2399,
199,
3,
257,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
199,
3,
257,
7131,
687,
642,
2032,
1928,
2488,
6791,
199,
3,
257,
5313,
4983,
402,
314,
17567,
8947,
15290,
11682,
14,
199,
3,
221,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
221,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
221,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
221,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
221,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
221,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
221,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
221,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
5620,
13715,
199,
199,
624,
199,
6864,
314,
10864,
3050,
1592,
14,
3065,
687,
314,
1584,
315,
314,
665,
1231,
12202,
396,
15,
992,
199,
3619,
14,
593,
76,
424,
16219,
787,
20200,
543,
949,
8457,
1325,
883,
506,
14429,
199,
4941,
12579,
465,
4346,
14,
199,
199,
6119,
1553,
3437,
367,
4503,
14,
199,
199,
3314,
5417,
12,
675,
1124,
647,
1255,
14,
647,
665,
4958,
28210,
370,
1852,
3238,
1414,
1004,
2633,
199,
1530,
24172,
370,
314,
2884,
14,
199,
624,
199,
199,
646,
984,
199,
646,
747,
199,
646,
3873,
199,
646,
10392,
199,
199,
646,
2202,
199,
646,
3778,
199,
199,
3807,
275,
408,
2268,
63,
697,
359,
2608,
311,
63,
3008,
61,
5243,
73,
29,
18737,
5243,
69,
29,
18737,
5243,
80,
61,
5243,
78,
61,
199,
199,
1918,
465,
11184,
63,
1760,
334,
269,
465,
11184,
9,
3366,
370,
675,
365,
2013,
701,
314,
1642,
199,
1531,
1004,
1423,
436,
4243,
370,
1124,
2608,
311,
4345,
199,
199,
1378,
1900,
12,
663,
1124,
3755,
8947,
63,
8248,
63,
3755,
8947,
63,
20261,
29,
615,
1040,
315,
21355,
14,
982,
12999,
199,
7532,
367,
376,
473,
1093,
12,
1852,
3238,
370,
1900,
314,
465,
11184,
63,
1760,
2199,
14,
199,
199,
13,
73,
28925,
2613,
26,
3820,
402,
570,
5478,
370,
1678,
16864,
367,
14,
982,
11684,
12,
268,
1006,
570,
5478,
787,
4588,
871,
5204,
315,
658,
5473,
2313,
268,
5679,
26,
446,
1148,
19873,
12,
3175,
2116,
446,
73,
14,
8568,
18485,
3175,
2116,
1553,
2613,
29,
8568,
12,
3175,
199,
199,
13,
69,
28925,
5473,
26,
18880,
3046,
543,
2202,
14,
5473,
63,
5359,
370,
7389,
282,
268,
769,
402,
1006,
570,
5478,
370,
3686,
14,
982,
16864,
2187,
12,
268,
2985,
787,
440,
29815,
14,
982,
440,
12,
314,
85,
787,
440,
2737,
14,
199,
199,
13,
80,
28925,
7780,
26,
5543,
1345,
769,
402,
570,
5478,
370,
22821,
701,
314,
1678,
14,
268,
577,
1888,
7,
1570,
7003,
14,
199,
199,
13,
78,
28925,
889,
3065,
26,
7529,
1133,
1706,
370,
18402,
6359,
14,
14797,
1006,
16864,
315,
8212,
1584,
14,
199,
624,
199,
199,
3,
5620,
18964,
199,
318,
2112,
63,
694,
8,
68,
12,
4386,
12,
570,
63,
1541,
304,
272,
408,
7958,
7425,
5461,
5767,
367,
1006,
1584,
315,
283,
68,
7,
408,
272,
870,
480,
9589,
2082,
298,
435,
366,
9,
339,
1967,
275,
378,
272,
367,
289,
315,
747,
14,
7374,
8,
68,
304,
267,
2615,
80,
275,
747,
14,
515,
14,
904,
8,
68,
12,
289,
9,
267,
340,
747,
14,
515,
14,
6027,
8,
2861,
80,
9,
436,
440,
289,
508,
3680,
6836,
582,
288,
1967,
847,
2112,
63,
694,
8,
2861,
80,
12,
4386,
12,
570,
63,
1541,
9,
288,
1980,
398,
340,
570,
63,
1541,
8,
70,
304,
288,
367,
11618,
315,
2202,
14,
802,
63,
7532,
63,
475,
63,
396,
26,
355,
1967,
847,
413,
355,
870,
480,
26406,
298,
435,
2615,
80,
435,
1867,
78,
2963,
13,
6338,
26,
298,
435,
11618,
9,
355,
27552,
275,
747,
14,
515,
14,
904,
8,
736,
14,
9458,
1062,
2202,
14,
4659,
63,
354,
12,
490,
3778,
14,
2227,
316,
8,
2861,
80,
12,
11618,
430,
2234,
2088,
275,
359,
465,
11184,
63,
1393,
63,
515,
12,
298,
2724,
401,
2615,
80,
12,
27552,
12,
3905,
66,
401,
3905,
83,
401,
3905,
76,
2,
1622,
435,
11618,
14,
1294,
342,
355,
4386,
14,
952,
480,
2608,
311,
5461,
298,
14255,
31761,
1257,
25789,
78,
531,
355,
4386,
14,
4939,
342,
355,
340,
3873,
14,
1250,
8,
1760,
12,
3839,
29,
4984,
12,
4635,
29,
4984,
12,
5218,
29,
797,
304,
490,
870,
480,
6782,
6661,
298,
435,
2615,
80,
9,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
varunarya10/oslo.serialization | oslo_serialization/jsonutils.py | 1 | 8936 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# 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.
'''
JSON related utilities.
This module provides a few things:
#. A handy function for getting an object down to something that can be
JSON serialized. See :func:`.to_primitive`.
#. Wrappers around :func:`.loads` and :func:`.dumps`. The :func:`.dumps`
wrapper will automatically use :func:`.to_primitive` for you if needed.
#. This sets up ``anyjson`` to use the :func:`.loads` and :func:`.dumps`
wrappers if ``anyjson`` is available.
'''
import codecs
import datetime
import functools
import inspect
import itertools
import sys
import uuid
is_simplejson = False
if sys.version_info < (2, 7):
# On Python <= 2.6, json module is not C boosted, so try to use
# simplejson module if available
try:
import simplejson as json
# NOTE(mriedem): Make sure we have a new enough version of simplejson
# to support the namedobject_as_tuple argument. This can be removed
# in the Kilo release when python 2.6 support is dropped.
if 'namedtuple_as_object' in inspect.getargspec(json.dumps).args:
is_simplejson = True
else:
import json
except ImportError:
import json
else:
import json
from oslo_utils import encodeutils
from oslo_utils import importutils
from oslo_utils import timeutils
import six
import six.moves.xmlrpc_client as xmlrpclib
netaddr = importutils.try_import("netaddr")
_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
inspect.isfunction, inspect.isgeneratorfunction,
inspect.isgenerator, inspect.istraceback, inspect.isframe,
inspect.iscode, inspect.isbuiltin, inspect.isroutine,
inspect.isabstract]
_simple_types = (six.string_types + six.integer_types
+ (type(None), bool, float))
def to_primitive(value, convert_instances=False, convert_datetime=True,
level=0, max_depth=3):
"""Convert a complex object into primitives.
Handy for JSON serialization. We can optionally handle instances,
but since this is a recursive function, we could have cyclical
data structures.
To handle cyclical data structures we could track the actual objects
visited in a set, but not all objects are hashable. Instead we just
track the depth of the object inspections and don't go too deep.
Therefore, ``convert_instances=True`` is lossy ... be aware.
"""
# handle obvious types first - order of basic types determined by running
# full tests on nova project, resulting in the following counts:
# 572754 <type 'NoneType'>
# 460353 <type 'int'>
# 379632 <type 'unicode'>
# 274610 <type 'str'>
# 199918 <type 'dict'>
# 114200 <type 'datetime.datetime'>
# 51817 <type 'bool'>
# 26164 <type 'list'>
# 6491 <type 'float'>
# 283 <type 'tuple'>
# 19 <type 'long'>
if isinstance(value, _simple_types):
return value
if isinstance(value, datetime.datetime):
if convert_datetime:
return timeutils.strtime(value)
else:
return value
if isinstance(value, uuid.UUID):
return six.text_type(value)
# value of itertools.count doesn't get caught by nasty_type_tests
# and results in infinite loop when list(value) is called.
if type(value) == itertools.count:
return six.text_type(value)
# FIXME(vish): Workaround for LP bug 852095. Without this workaround,
# tests that raise an exception in a mocked method that
# has a @wrap_exception with a notifier will fail. If
# we up the dependency to 0.5.4 (when it is released) we
# can remove this workaround.
if getattr(value, '__module__', None) == 'mox':
return 'mock'
if level > max_depth:
return '?'
# The try block may not be necessary after the class check above,
# but just in case ...
try:
recursive = functools.partial(to_primitive,
convert_instances=convert_instances,
convert_datetime=convert_datetime,
level=level,
max_depth=max_depth)
if isinstance(value, dict):
return dict((k, recursive(v)) for k, v in six.iteritems(value))
# It's not clear why xmlrpclib created their own DateTime type, but
# for our purposes, make it a datetime type which is explicitly
# handled
if isinstance(value, xmlrpclib.DateTime):
value = datetime.datetime(*tuple(value.timetuple())[:6])
if convert_datetime and isinstance(value, datetime.datetime):
return timeutils.strtime(value)
elif hasattr(value, 'iteritems'):
return recursive(dict(value.iteritems()), level=level + 1)
elif hasattr(value, '__iter__'):
return list(map(recursive, value))
elif convert_instances and hasattr(value, '__dict__'):
# Likely an instance of something. Watch for cycles.
# Ignore class member vars.
return recursive(value.__dict__, level=level + 1)
elif netaddr and isinstance(value, netaddr.IPAddress):
return six.text_type(value)
elif any(test(value) for test in _nasty_type_tests):
return six.text_type(value)
return value
except TypeError:
# Class objects are tricky since they may define something like
# __iter__ defined but it isn't callable as list().
return six.text_type(value)
JSONEncoder = json.JSONEncoder
JSONDecoder = json.JSONDecoder
def dumps(obj, default=to_primitive, **kwargs):
"""Serialize ``obj`` to a JSON formatted ``str``.
:param obj: object to be serialized
:param default: function that returns a serializable version of an object
:param kwargs: extra named parameters, please see documentation \
of `json.dumps <https://docs.python.org/2/library/json.html#basic-usage>`_
:returns: json formatted string
"""
if is_simplejson:
kwargs['namedtuple_as_object'] = False
return json.dumps(obj, default=default, **kwargs)
def dump(obj, fp, *args, **kwargs):
"""Serialize ``obj`` as a JSON formatted stream to ``fp``
:param obj: object to be serialized
:param fp: a ``.write()``-supporting file-like object
:param default: function that returns a serializable version of an object
:param args: extra arguments, please see documentation \
of `json.dump <https://docs.python.org/2/library/json.html#basic-usage>`_
:param kwargs: extra named parameters, please see documentation \
of `json.dump <https://docs.python.org/2/library/json.html#basic-usage>`_
"""
default = kwargs.get('default', to_primitive)
if is_simplejson:
kwargs['namedtuple_as_object'] = False
return json.dump(obj, fp, default=default, *args, **kwargs)
def loads(s, encoding='utf-8', **kwargs):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
:param s: string to deserialize
:param encoding: encoding used to interpret the string
:param kwargs: extra named parameters, please see documentation \
of `json.loads <https://docs.python.org/2/library/json.html#basic-usage>`_
:returns: python object
"""
return json.loads(encodeutils.safe_decode(s, encoding), **kwargs)
def load(fp, encoding='utf-8', **kwargs):
"""Deserialize ``fp`` to a Python object.
:param fp: a ``.read()`` -supporting file-like object
:param encoding: encoding used to interpret the string
:param kwargs: extra named parameters, please see documentation \
of `json.loads <https://docs.python.org/2/library/json.html#basic-usage>`_
:returns: python object
"""
return json.load(codecs.getreader(encoding)(fp), **kwargs)
try:
import anyjson
except ImportError:
pass
else:
anyjson._modules.append((__name__, 'dumps', TypeError,
'loads', ValueError, 'load'))
anyjson.force_implementation(__name__)
| apache-2.0 | [
3,
1898,
7129,
1910,
5703,
24230,
598,
27639,
465,
11159,
701,
314,
199,
3,
30660,
402,
314,
20548,
437,
281,
265,
3844,
7769,
436,
19326,
9516,
4633,
14,
199,
3,
1898,
7760,
13870,
262,
29359,
502,
12377,
1700,
65,
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,
2344,
199,
6243,
4048,
15841,
14,
199,
199,
2765,
859,
6571,
282,
9284,
7645,
26,
199,
199,
31827,
437,
4926,
89,
805,
367,
10232,
376,
909,
3224,
370,
6020,
626,
883,
506,
2043,
4840,
6380,
14,
221,
1666,
520,
1532,
5026,
475,
63,
16161,
2313,
199,
31827,
21947,
83,
6818,
520,
1532,
5026,
3640,
64,
436,
520,
1532,
5026,
4180,
2313,
710,
520,
1532,
5026,
4180,
64,
2043,
4975,
911,
5847,
675,
520,
1532,
5026,
475,
63,
16161,
64,
367,
1265,
340,
4346,
14,
199,
31827,
961,
5951,
1536,
1124,
1629,
1001,
1040,
370,
675,
314,
520,
1532,
5026,
3640,
64,
436,
520,
1532,
5026,
4180,
64,
2043,
17995,
340,
1124,
1629,
1001,
1040,
365,
2808,
14,
199,
2344,
421,
199,
646,
6010,
199,
646,
2197,
199,
646,
9143,
199,
646,
6485,
199,
646,
7975,
199,
646,
984,
199,
646,
5377,
199,
199,
374,
63,
4129,
1001,
275,
756,
199,
692,
984,
14,
1023,
63,
815,
665,
334,
18,
12,
1520,
304,
272,
327,
4068,
2018,
2695,
499,
14,
22,
12,
2022,
859,
365,
440,
445,
1234,
17849,
12,
880,
862,
370,
675,
272,
327,
13804,
859,
340,
2808,
272,
862,
26,
267,
492,
13804,
465,
2022,
267,
327,
6944,
8,
77,
11317,
23522,
304,
4155,
3238,
781,
1172,
282,
892,
8321,
1015,
402,
13804,
267,
327,
370,
2291,
314,
4310,
785,
63,
305,
63,
2960,
1423,
14,
961,
883,
506,
4829,
267,
327,
315,
314,
1804,
11737,
4683,
1380,
2366,
499,
14,
22,
2291,
365,
17481,
14,
267,
340,
283,
18921,
63,
305,
63,
785,
7,
315,
6485,
14,
29836,
8,
1001,
14,
4180,
680,
589,
26,
288,
365,
63,
4129,
1001,
275,
715,
267,
587,
26,
288,
492,
2022,
272,
871,
3545,
26,
267,
492,
2022,
199,
2836,
26,
272,
492,
2022,
199,
199,
504,
11258,
63,
1208,
492,
3752,
1208,
199,
504,
11258,
63,
1208,
492,
492,
1208,
199,
504,
11258,
63,
1208,
492,
23011,
199,
646,
3816,
199,
646,
3816,
14,
4912,
14,
17596,
63,
1258,
465,
19122,
199,
199,
846,
2697,
275,
492,
1208,
14,
893,
63,
646,
480,
846,
2697,
531,
199,
199,
63,
78,
27352,
63,
466,
63,
2219,
275,
359,
10955,
14,
374,
578,
12,
6485,
14,
28450,
12,
6485,
14,
374,
765,
12,
2151,
6485,
14,
374,
1593,
12,
6485,
14,
374,
4679,
1593,
12,
2151,
6485,
14,
374,
4679,
12,
6485,
14,
631,
5986,
894,
12,
6485,
14,
374,
1943,
12,
2151,
6485,
14,
374,
600,
12,
6485,
14,
374,
5351,
12,
6485,
14,
374,
17765,
12,
2151,
6485,
14,
374,
6198,
61,
199,
199,
63,
4129,
63,
1313,
275,
334,
4174,
14,
875,
63,
1313,
435,
3816,
14,
4115,
63,
1313,
326,
435,
334,
466,
8,
403,
395,
2155,
12,
2069,
430,
421,
199,
318,
370,
63,
16161,
8,
585,
12,
3957,
63,
5990,
29,
797,
12,
3957,
63,
2083,
29,
549,
12,
326,
2166,
29,
16,
12,
1390,
63,
4631,
29,
19,
304,
272,
408,
7306,
282,
6114,
909,
1901,
1979,
22337,
14,
339,
18405,
89,
367,
4840,
16953,
14,
2136,
883,
14190,
2429,
4454,
12,
272,
1325,
3967,
642,
365,
282,
9133,
805,
12,
781,
4293,
1172,
32637,
279,
272,
666,
13955,
14,
339,
4005,
2429,
32637,
279,
666,
13955,
781,
4293,
4426,
314,
3503,
2251,
272,
15867,
315,
282,
663,
12,
1325,
440,
1006,
2251,
787,
21197,
14,
15345,
781,
2951,
272,
4426,
314,
5818,
402,
314,
909,
5261,
321,
2452,
436,
2793,
1133,
2621,
4634,
13217,
14,
339,
21039,
12,
1124,
3916,
63,
5990,
29,
549,
1040,
365,
5621,
89,
2263,
506,
20381,
14,
272,
408,
272,
327,
2429,
25259,
2943,
1642,
446,
1865,
402,
5678,
2943,
12037,
701,
3879,
272,
327,
2615,
2295,
641,
5913,
2199,
12,
9183,
315,
314,
2569,
8242,
26,
272,
327,
12699,
1465,
1477,
665,
466,
283,
26855,
8423,
272,
327,
841,
2259,
15355,
665,
466,
283,
442,
8423,
272,
327,
650,
21655,
708,
665,
466,
283,
2975,
8423,
272,
327,
499,
17718,
709,
665,
466,
283,
495,
8423,
272,
327,
21300,
1085,
665,
466,
283,
807,
8423,
272,
327,
23510,
1840,
665,
466,
283,
2083,
14,
2083,
8423,
272,
327,
221,
959,
1085,
1196,
665,
466,
283,
2245,
8423,
272,
327,
221,
499,
2976,
772,
665,
466,
283,
513,
8423,
272,
327,
257,
5049,
3328,
665,
466,
283,
1609,
8423,
272,
327,
259,
499,
2658,
665,
466,
283,
2960,
8423,
272,
327,
258,
5851,
665,
466,
283,
2809,
8423,
272,
340,
1228,
8,
585,
12,
485,
4129,
63,
1313,
304,
267,
372,
574,
339,
340,
1228,
8,
585,
12,
2197,
14,
2083,
304,
267,
340,
3957,
63,
2083,
26,
288,
372,
23011,
14,
495,
521,
8,
585,
9,
267,
587,
26,
288,
372,
574,
339,
340,
1228,
8,
585,
12,
5377,
14,
8757,
304,
267,
372,
3816,
14,
505,
63,
466,
8,
585,
9,
339,
327,
574,
402,
7975,
14,
835,
3181,
1133,
664,
15604,
701,
302,
27352,
63,
466,
63,
2219,
272,
327,
436,
2058,
315,
15258,
4438,
1380,
769,
8,
585,
9,
365,
2797,
14,
272,
340,
730,
8,
585,
9,
508,
7975,
14,
835
] | [
1898,
7129,
1910,
5703,
24230,
598,
27639,
465,
11159,
701,
314,
199,
3,
30660,
402,
314,
20548,
437,
281,
265,
3844,
7769,
436,
19326,
9516,
4633,
14,
199,
3,
1898,
7760,
13870,
262,
29359,
502,
12377,
1700,
65,
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,
2344,
199,
6243,
4048,
15841,
14,
199,
199,
2765,
859,
6571,
282,
9284,
7645,
26,
199,
199,
31827,
437,
4926,
89,
805,
367,
10232,
376,
909,
3224,
370,
6020,
626,
883,
506,
2043,
4840,
6380,
14,
221,
1666,
520,
1532,
5026,
475,
63,
16161,
2313,
199,
31827,
21947,
83,
6818,
520,
1532,
5026,
3640,
64,
436,
520,
1532,
5026,
4180,
2313,
710,
520,
1532,
5026,
4180,
64,
2043,
4975,
911,
5847,
675,
520,
1532,
5026,
475,
63,
16161,
64,
367,
1265,
340,
4346,
14,
199,
31827,
961,
5951,
1536,
1124,
1629,
1001,
1040,
370,
675,
314,
520,
1532,
5026,
3640,
64,
436,
520,
1532,
5026,
4180,
64,
2043,
17995,
340,
1124,
1629,
1001,
1040,
365,
2808,
14,
199,
2344,
421,
199,
646,
6010,
199,
646,
2197,
199,
646,
9143,
199,
646,
6485,
199,
646,
7975,
199,
646,
984,
199,
646,
5377,
199,
199,
374,
63,
4129,
1001,
275,
756,
199,
692,
984,
14,
1023,
63,
815,
665,
334,
18,
12,
1520,
304,
272,
327,
4068,
2018,
2695,
499,
14,
22,
12,
2022,
859,
365,
440,
445,
1234,
17849,
12,
880,
862,
370,
675,
272,
327,
13804,
859,
340,
2808,
272,
862,
26,
267,
492,
13804,
465,
2022,
267,
327,
6944,
8,
77,
11317,
23522,
304,
4155,
3238,
781,
1172,
282,
892,
8321,
1015,
402,
13804,
267,
327,
370,
2291,
314,
4310,
785,
63,
305,
63,
2960,
1423,
14,
961,
883,
506,
4829,
267,
327,
315,
314,
1804,
11737,
4683,
1380,
2366,
499,
14,
22,
2291,
365,
17481,
14,
267,
340,
283,
18921,
63,
305,
63,
785,
7,
315,
6485,
14,
29836,
8,
1001,
14,
4180,
680,
589,
26,
288,
365,
63,
4129,
1001,
275,
715,
267,
587,
26,
288,
492,
2022,
272,
871,
3545,
26,
267,
492,
2022,
199,
2836,
26,
272,
492,
2022,
199,
199,
504,
11258,
63,
1208,
492,
3752,
1208,
199,
504,
11258,
63,
1208,
492,
492,
1208,
199,
504,
11258,
63,
1208,
492,
23011,
199,
646,
3816,
199,
646,
3816,
14,
4912,
14,
17596,
63,
1258,
465,
19122,
199,
199,
846,
2697,
275,
492,
1208,
14,
893,
63,
646,
480,
846,
2697,
531,
199,
199,
63,
78,
27352,
63,
466,
63,
2219,
275,
359,
10955,
14,
374,
578,
12,
6485,
14,
28450,
12,
6485,
14,
374,
765,
12,
2151,
6485,
14,
374,
1593,
12,
6485,
14,
374,
4679,
1593,
12,
2151,
6485,
14,
374,
4679,
12,
6485,
14,
631,
5986,
894,
12,
6485,
14,
374,
1943,
12,
2151,
6485,
14,
374,
600,
12,
6485,
14,
374,
5351,
12,
6485,
14,
374,
17765,
12,
2151,
6485,
14,
374,
6198,
61,
199,
199,
63,
4129,
63,
1313,
275,
334,
4174,
14,
875,
63,
1313,
435,
3816,
14,
4115,
63,
1313,
326,
435,
334,
466,
8,
403,
395,
2155,
12,
2069,
430,
421,
199,
318,
370,
63,
16161,
8,
585,
12,
3957,
63,
5990,
29,
797,
12,
3957,
63,
2083,
29,
549,
12,
326,
2166,
29,
16,
12,
1390,
63,
4631,
29,
19,
304,
272,
408,
7306,
282,
6114,
909,
1901,
1979,
22337,
14,
339,
18405,
89,
367,
4840,
16953,
14,
2136,
883,
14190,
2429,
4454,
12,
272,
1325,
3967,
642,
365,
282,
9133,
805,
12,
781,
4293,
1172,
32637,
279,
272,
666,
13955,
14,
339,
4005,
2429,
32637,
279,
666,
13955,
781,
4293,
4426,
314,
3503,
2251,
272,
15867,
315,
282,
663,
12,
1325,
440,
1006,
2251,
787,
21197,
14,
15345,
781,
2951,
272,
4426,
314,
5818,
402,
314,
909,
5261,
321,
2452,
436,
2793,
1133,
2621,
4634,
13217,
14,
339,
21039,
12,
1124,
3916,
63,
5990,
29,
549,
1040,
365,
5621,
89,
2263,
506,
20381,
14,
272,
408,
272,
327,
2429,
25259,
2943,
1642,
446,
1865,
402,
5678,
2943,
12037,
701,
3879,
272,
327,
2615,
2295,
641,
5913,
2199,
12,
9183,
315,
314,
2569,
8242,
26,
272,
327,
12699,
1465,
1477,
665,
466,
283,
26855,
8423,
272,
327,
841,
2259,
15355,
665,
466,
283,
442,
8423,
272,
327,
650,
21655,
708,
665,
466,
283,
2975,
8423,
272,
327,
499,
17718,
709,
665,
466,
283,
495,
8423,
272,
327,
21300,
1085,
665,
466,
283,
807,
8423,
272,
327,
23510,
1840,
665,
466,
283,
2083,
14,
2083,
8423,
272,
327,
221,
959,
1085,
1196,
665,
466,
283,
2245,
8423,
272,
327,
221,
499,
2976,
772,
665,
466,
283,
513,
8423,
272,
327,
257,
5049,
3328,
665,
466,
283,
1609,
8423,
272,
327,
259,
499,
2658,
665,
466,
283,
2960,
8423,
272,
327,
258,
5851,
665,
466,
283,
2809,
8423,
272,
340,
1228,
8,
585,
12,
485,
4129,
63,
1313,
304,
267,
372,
574,
339,
340,
1228,
8,
585,
12,
2197,
14,
2083,
304,
267,
340,
3957,
63,
2083,
26,
288,
372,
23011,
14,
495,
521,
8,
585,
9,
267,
587,
26,
288,
372,
574,
339,
340,
1228,
8,
585,
12,
5377,
14,
8757,
304,
267,
372,
3816,
14,
505,
63,
466,
8,
585,
9,
339,
327,
574,
402,
7975,
14,
835,
3181,
1133,
664,
15604,
701,
302,
27352,
63,
466,
63,
2219,
272,
327,
436,
2058,
315,
15258,
4438,
1380,
769,
8,
585,
9,
365,
2797,
14,
272,
340,
730,
8,
585,
9,
508,
7975,
14,
835,
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,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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
] |
aavanian/bokeh | bokeh/sampledata/tests/test_world_cities.py | 2 | 1963 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External imports
import pandas as pd
# Bokeh imports
from bokeh.util.testing import verify_all
# Module under test
#import bokeh.sampledata.world_cities as bsw
#-----------------------------------------------------------------------------
# Setup
#-----------------------------------------------------------------------------
ALL = (
'data',
)
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
Test___all__ = pytest.mark.sampledata(verify_all("bokeh.sampledata.world_cities", ALL))
@pytest.mark.sampledata
def test_data():
import bokeh.sampledata.world_cities as bsw
assert isinstance(bsw.data, pd.DataFrame)
# don't check detail for external data
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
| bsd-3-clause | [
18045,
199,
3,
1898,
334,
67,
9,
6029,
446,
9708,
12,
1626,
16928,
983,
12,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
199,
3,
510,
583,
16179,
701,
314,
5088,
16610,
15290,
11682,
14,
199,
3,
199,
3,
710,
2615,
4190,
365,
315,
314,
570,
5113,
14,
2424,
12,
1854,
543,
642,
2032,
14,
199,
18045,
199,
199,
18045,
199,
3,
5088,
27025,
199,
18045,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
12,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
646,
4613,
8700,
4613,
199,
199,
18045,
199,
3,
24339,
199,
18045,
199,
199,
3,
9739,
3555,
8925,
199,
199,
3,
18802,
8925,
199,
646,
10634,
465,
6454,
199,
199,
3,
5088,
16610,
8925,
199,
504,
25214,
14,
1974,
14,
4776,
492,
4911,
63,
452,
199,
199,
3,
5673,
1334,
511,
199,
3,
646,
25214,
14,
3271,
576,
14,
7617,
63,
18207,
465,
330,
3519,
199,
199,
18045,
199,
3,
12439,
199,
18045,
199,
199,
1761,
275,
334,
272,
283,
576,
297,
199,
9,
199,
199,
18045,
199,
3,
1696,
3261,
199,
18045,
199,
199,
774,
8989,
452,
363,
275,
4613,
14,
1657,
14,
3271,
576,
8,
4712,
63,
452,
480,
656,
16610,
14,
3271,
576,
14,
7617,
63,
18207,
401,
11727,
430,
199,
199,
32,
4462,
14,
1657,
14,
3271,
576,
199,
318,
511,
63,
576,
837,
272,
492,
25214,
14,
3271,
576,
14,
7617,
63,
18207,
465,
330,
3519,
272,
702,
1228,
8,
1533,
87,
14,
576,
12,
6454,
14,
9205,
9,
339,
327,
2793,
1133,
1104,
10093,
367,
5957,
666,
199,
199,
18045,
199,
3,
29314,
3261,
199,
18045,
199,
199,
18045,
199,
3,
18551,
3261,
199,
18045,
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
] | [
199,
3,
1898,
334,
67,
9,
6029,
446,
9708,
12,
1626,
16928,
983,
12,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
199,
3,
510,
583,
16179,
701,
314,
5088,
16610,
15290,
11682,
14,
199,
3,
199,
3,
710,
2615,
4190,
365,
315,
314,
570,
5113,
14,
2424,
12,
1854,
543,
642,
2032,
14,
199,
18045,
199,
199,
18045,
199,
3,
5088,
27025,
199,
18045,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
12,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
646,
4613,
8700,
4613,
199,
199,
18045,
199,
3,
24339,
199,
18045,
199,
199,
3,
9739,
3555,
8925,
199,
199,
3,
18802,
8925,
199,
646,
10634,
465,
6454,
199,
199,
3,
5088,
16610,
8925,
199,
504,
25214,
14,
1974,
14,
4776,
492,
4911,
63,
452,
199,
199,
3,
5673,
1334,
511,
199,
3,
646,
25214,
14,
3271,
576,
14,
7617,
63,
18207,
465,
330,
3519,
199,
199,
18045,
199,
3,
12439,
199,
18045,
199,
199,
1761,
275,
334,
272,
283,
576,
297,
199,
9,
199,
199,
18045,
199,
3,
1696,
3261,
199,
18045,
199,
199,
774,
8989,
452,
363,
275,
4613,
14,
1657,
14,
3271,
576,
8,
4712,
63,
452,
480,
656,
16610,
14,
3271,
576,
14,
7617,
63,
18207,
401,
11727,
430,
199,
199,
32,
4462,
14,
1657,
14,
3271,
576,
199,
318,
511,
63,
576,
837,
272,
492,
25214,
14,
3271,
576,
14,
7617,
63,
18207,
465,
330,
3519,
272,
702,
1228,
8,
1533,
87,
14,
576,
12,
6454,
14,
9205,
9,
339,
327,
2793,
1133,
1104,
10093,
367,
5957,
666,
199,
199,
18045,
199,
3,
29314,
3261,
199,
18045,
199,
199,
18045,
199,
3,
18551,
3261,
199,
18045,
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,
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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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
strk/QGIS | tests/src/python/test_processing_alg_decorator.py | 23 | 5963 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for the @alg processing algorithm.
.. 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.
"""
__author__ = 'Nathan Woodrow'
__date__ = '10.12.2018'
__copyright__ = 'Copyright 2018, The QGIS Project'
import sys
import os
import qgis # NOQA
from qgis.testing import unittest, start_app
from qgis.processing import alg
from qgis.core import QgsSettings
from qgis.PyQt.QtCore import QCoreApplication
start_app()
ARGNAME = "TEST_ALG{0}"
HELPSTRING = "TEST_HELP STRING{0}"
def define_new_no_inputs(newid=1):
@alg(name="noinputs", label=alg.tr("Test func"), group="unittest",
group_label=alg.tr("Test label"))
@alg.output(type=str, name="DISTANCE_OUT", label="Distance out")
def testalg(instance, parameters, context, feedback, inputs):
"""
Test doc string text
"""
def define_new_no_outputs_but_sink_instead(newid=1):
@alg(name=ARGNAME.format(newid), label=alg.tr("Test func"), group="unittest",
group_label=alg.tr("Test label"))
@alg.help(HELPSTRING.format(newid))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.DISTANCE, name="DISTANCE", label="Distance", default=30)
@alg.input(type=alg.SINK, name="SINK", label="Output layer")
def testalg(instance, parameters, context, feedback, inputs):
"""
Given a distance will split a line layer into segments of the distance
"""
def define_new_doc_string(newid=1):
@alg(name=ARGNAME.format(newid), label=alg.tr("Test func"), group="unittest",
group_label=alg.tr("Test label"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.output(type=str, name="DISTANCE_OUT", label="Distance out")
def testalg(instance, parameters, context, feedback, inputs):
"""
Test doc string text
"""
def define_new(newid=1):
@alg(name=ARGNAME.format(newid), label=alg.tr("Test func"), group="unittest",
group_label=alg.tr("Test label"))
@alg.help(HELPSTRING.format(newid))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.DISTANCE, name="DISTANCE", label="Distance", default=30)
@alg.input(type=alg.SINK, name="SINK", label="Output layer")
@alg.output(type=str, name="DISTANCE_OUT", label="Distance out")
def testalg(instance, parameters, context, feedback, inputs):
"""
Given a distance will split a line layer into segments of the distance
"""
def cleanup():
alg.instances.clear()
class AlgNoInputs(unittest.TestCase):
def setUp(self):
cleanup()
def test_can_have_no_inputs(self):
define_new_no_inputs()
class AlgNoOutputsButSinkInstead(unittest.TestCase):
def setUp(self):
cleanup()
def test_can_have_no_outputs_if_there_is_destination(self):
define_new_no_outputs_but_sink_instead()
class AlgInstanceTests(unittest.TestCase):
"""
Tests to check the createInstance method will work as expected.
"""
def setUp(self):
cleanup()
define_new()
self.current = alg.instances.pop().createInstance()
def test_correct_number_of_inputs_and_outputs(self):
self.assertEqual(3, len(self.current.inputs))
self.assertEqual(1, len(self.current.outputs))
def test_correct_number_of_inputs_and_outputs_after_init(self):
self.current.initAlgorithm()
defs = self.current.parameterDefinitions()
self.assertEqual(3, len(defs))
inputs = [
("INPUT", "Input layer"),
("DISTANCE", "Distance"),
("SINK", "Output layer"),
]
for count, data in enumerate(inputs):
parmdef = defs[count]
self.assertEqual(data[0], parmdef.name())
self.assertEqual(data[1], parmdef.description())
def test_func_is_set(self):
self.assertIsNotNone(self.current._func)
def test_has_help_from_help_decorator(self):
self.assertEqual(HELPSTRING.format(1), self.current.shortHelpString())
def test_name_and_label(self):
self.assertEqual(ARGNAME.format(1), self.current.name())
self.assertEqual("Test func", self.current.displayName())
def test_group(self):
self.assertEqual("Test label", self.current.group())
self.assertEqual("unittest", self.current.groupId())
class AlgHelpTests(unittest.TestCase):
def test_has_help_from_help_decorator(self):
cleanup()
define_new()
current = alg.instances.pop()
self.assertEqual(HELPSTRING.format(1), current.shortHelpString())
def test_has_help_from_docstring(self):
define_new_doc_string()
current = alg.instances.pop()
self.assertEqual("Test doc string text", current.shortHelpString())
class TestAlg(unittest.TestCase):
def setUp(self):
cleanup()
define_new()
def test_correct_number_of_inputs_and_outputs(self):
current = alg.instances.pop()
self.assertEqual(3, len(current.inputs))
self.assertEqual(1, len(current.outputs))
self.assertTrue(current.has_inputs)
self.assertTrue(current.has_outputs)
def test_correct_number_defined_in_stack_before_and_after(self):
self.assertEqual(1, len(alg.instances))
alg.instances.pop()
self.assertEqual(0, len(alg.instances))
def test_current_has_correct_name(self):
alg.instances.pop()
for i in range(3):
define_new(i)
self.assertEqual(3, len(alg.instances))
for i in range(3, 1):
current = alg.instances.pop()
self.assertEqual(ARGNAME.format(i), current.name())
if __name__ == "__main__":
unittest.main()
| gpl-2.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
31329,
12008,
2295,
367,
314,
768,
6731,
6661,
5563,
14,
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,
363,
2502,
363,
275,
283,
46,
1619,
290,
644,
23521,
1143,
7,
199,
363,
602,
363,
275,
283,
709,
14,
713,
14,
12682,
7,
199,
363,
7307,
363,
275,
283,
7384,
14894,
12,
710,
27024,
7290,
7,
199,
199,
646,
984,
199,
646,
747,
199,
646,
15640,
221,
327,
20432,
199,
199,
504,
15640,
14,
4776,
492,
2882,
12,
1343,
63,
571,
199,
504,
15640,
14,
6338,
492,
15760,
199,
504,
15640,
14,
1018,
492,
4888,
5268,
199,
504,
15640,
14,
24107,
14,
10901,
492,
1413,
29263,
199,
199,
928,
63,
571,
342,
199,
199,
11611,
2339,
275,
298,
2864,
63,
26613,
91,
16,
7063,
199,
17930,
5353,
275,
298,
2864,
63,
17930,
18661,
91,
16,
7063,
421,
199,
318,
5627,
63,
1222,
63,
889,
63,
3711,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
628,
889,
3711,
401,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
1379,
1382,
1059,
1318,
267,
408,
421,
199,
318,
5627,
63,
1222,
63,
889,
63,
4467,
63,
7911,
63,
11279,
63,
23145,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
3437,
8,
17930,
5353,
14,
908,
8,
1222,
344,
430,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
22375,
12,
536,
628,
22375,
401,
1768,
628,
10076,
401,
849,
29,
1216,
9,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
51,
12394,
12,
536,
628,
51,
12394,
401,
1768,
628,
2959,
4045,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
9138,
282,
6033,
911,
3715,
282,
1004,
4045,
1901,
11998,
402,
314,
6033,
267,
408,
421,
199,
318,
5627,
63,
1222,
63,
1301,
63,
875,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
1379,
1382,
1059,
1318,
267,
408,
421,
199,
318,
5627,
63,
1222,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
3437,
8,
17930,
5353,
14,
908,
8,
1222,
344,
430,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
22375,
12,
536,
628,
22375,
401,
1768,
628,
10076,
401,
849,
29,
1216,
9,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
51,
12394,
12,
536,
628,
51,
12394,
401,
1768,
628,
2959,
4045,
531,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
9138,
282,
6033,
911,
3715,
282,
1004,
4045,
1901,
11998,
402,
314,
6033,
267,
408,
421,
199,
318,
9058,
837,
272,
15760,
14,
5990,
14,
3584,
342,
421,
199,
533,
4580,
71,
1944,
15124,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
339,
347,
511,
63,
2425,
63,
7804,
63,
889,
63,
3711,
8,
277,
304,
267,
5627,
63,
1222,
63,
889,
63,
3711,
342,
421,
199,
533,
4580,
71,
1944,
18669,
28543,
17111,
13962,
13558,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
339,
347,
511,
63,
2425,
63,
7804,
63,
889,
63,
4467,
63,
692,
63,
16990,
63,
374,
63,
6881,
8,
277,
304,
267,
5627,
63,
1222,
63,
889,
63,
4467,
63,
7911,
63,
11279,
63,
23145,
342,
421,
199,
533,
4580,
71,
3244,
2925,
8,
2796,
14,
1746,
304,
272,
408,
272,
6496,
370,
1104,
314,
1218,
3244,
1083,
911,
1736,
465,
1420,
14,
272,
408,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
267,
5627,
63,
1222,
342,
267,
291,
14,
1818,
275,
15760,
14,
5990,
14,
1935,
1252,
981,
3244,
342,
339,
347,
511,
63,
4525,
63,
1955,
63,
1618,
63,
3711,
63,
460,
63,
4467,
8,
277,
304,
267,
291,
14,
629,
8,
19,
12,
822,
8,
277,
14,
1818,
14,
3711,
430,
267,
291,
14,
629,
8,
17,
12,
822,
8,
277,
14,
1818,
14,
4467,
430,
339,
347,
511,
63,
4525,
63,
1955,
63,
1618,
63,
3711,
63,
460,
63,
4467,
63,
4399,
63,
826,
8,
277,
304,
267,
291,
14
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
31329,
12008,
2295,
367,
314,
768,
6731,
6661,
5563,
14,
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,
363,
2502,
363,
275,
283,
46,
1619,
290,
644,
23521,
1143,
7,
199,
363,
602,
363,
275,
283,
709,
14,
713,
14,
12682,
7,
199,
363,
7307,
363,
275,
283,
7384,
14894,
12,
710,
27024,
7290,
7,
199,
199,
646,
984,
199,
646,
747,
199,
646,
15640,
221,
327,
20432,
199,
199,
504,
15640,
14,
4776,
492,
2882,
12,
1343,
63,
571,
199,
504,
15640,
14,
6338,
492,
15760,
199,
504,
15640,
14,
1018,
492,
4888,
5268,
199,
504,
15640,
14,
24107,
14,
10901,
492,
1413,
29263,
199,
199,
928,
63,
571,
342,
199,
199,
11611,
2339,
275,
298,
2864,
63,
26613,
91,
16,
7063,
199,
17930,
5353,
275,
298,
2864,
63,
17930,
18661,
91,
16,
7063,
421,
199,
318,
5627,
63,
1222,
63,
889,
63,
3711,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
628,
889,
3711,
401,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
1379,
1382,
1059,
1318,
267,
408,
421,
199,
318,
5627,
63,
1222,
63,
889,
63,
4467,
63,
7911,
63,
11279,
63,
23145,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
3437,
8,
17930,
5353,
14,
908,
8,
1222,
344,
430,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
22375,
12,
536,
628,
22375,
401,
1768,
628,
10076,
401,
849,
29,
1216,
9,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
51,
12394,
12,
536,
628,
51,
12394,
401,
1768,
628,
2959,
4045,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
9138,
282,
6033,
911,
3715,
282,
1004,
4045,
1901,
11998,
402,
314,
6033,
267,
408,
421,
199,
318,
5627,
63,
1222,
63,
1301,
63,
875,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
1379,
1382,
1059,
1318,
267,
408,
421,
199,
318,
5627,
63,
1222,
8,
1222,
344,
29,
17,
304,
272,
768,
6731,
8,
354,
29,
11611,
2339,
14,
908,
8,
1222,
344,
395,
1768,
29,
6731,
14,
454,
480,
774,
2562,
1288,
1572,
628,
2796,
401,
268,
1572,
63,
1302,
29,
6731,
14,
454,
480,
774,
1768,
2237,
272,
768,
6731,
14,
3437,
8,
17930,
5353,
14,
908,
8,
1222,
344,
430,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
10187,
12,
536,
628,
7321,
401,
1768,
628,
3205,
4045,
531,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
22375,
12,
536,
628,
22375,
401,
1768,
628,
10076,
401,
849,
29,
1216,
9,
272,
768,
6731,
14,
1210,
8,
466,
29,
6731,
14,
51,
12394,
12,
536,
628,
51,
12394,
401,
1768,
628,
2959,
4045,
531,
272,
768,
6731,
14,
1199,
8,
466,
29,
495,
12,
536,
628,
22375,
63,
1877,
401,
1768,
628,
10076,
734,
531,
272,
347,
511,
6731,
8,
842,
12,
2633,
12,
1067,
12,
17145,
12,
4153,
304,
267,
408,
267,
9138,
282,
6033,
911,
3715,
282,
1004,
4045,
1901,
11998,
402,
314,
6033,
267,
408,
421,
199,
318,
9058,
837,
272,
15760,
14,
5990,
14,
3584,
342,
421,
199,
533,
4580,
71,
1944,
15124,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
339,
347,
511,
63,
2425,
63,
7804,
63,
889,
63,
3711,
8,
277,
304,
267,
5627,
63,
1222,
63,
889,
63,
3711,
342,
421,
199,
533,
4580,
71,
1944,
18669,
28543,
17111,
13962,
13558,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
339,
347,
511,
63,
2425,
63,
7804,
63,
889,
63,
4467,
63,
692,
63,
16990,
63,
374,
63,
6881,
8,
277,
304,
267,
5627,
63,
1222,
63,
889,
63,
4467,
63,
7911,
63,
11279,
63,
23145,
342,
421,
199,
533,
4580,
71,
3244,
2925,
8,
2796,
14,
1746,
304,
272,
408,
272,
6496,
370,
1104,
314,
1218,
3244,
1083,
911,
1736,
465,
1420,
14,
272,
408,
339,
347,
3613,
8,
277,
304,
267,
9058,
342,
267,
5627,
63,
1222,
342,
267,
291,
14,
1818,
275,
15760,
14,
5990,
14,
1935,
1252,
981,
3244,
342,
339,
347,
511,
63,
4525,
63,
1955,
63,
1618,
63,
3711,
63,
460,
63,
4467,
8,
277,
304,
267,
291,
14,
629,
8,
19,
12,
822,
8,
277,
14,
1818,
14,
3711,
430,
267,
291,
14,
629,
8,
17,
12,
822,
8,
277,
14,
1818,
14,
4467,
430,
339,
347,
511,
63,
4525,
63,
1955,
63,
1618,
63,
3711,
63,
460,
63,
4467,
63,
4399,
63,
826,
8,
277,
304,
267,
291,
14,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
LockScreen/Backend | venv/lib/python2.7/site-packages/boxsdk/object/item.py | 6 | 9391 | # coding: utf-8
from __future__ import unicode_literals
import json
from .base_object import BaseObject
from boxsdk.config import API
from boxsdk.exception import BoxAPIException
class Item(BaseObject):
"""Box API endpoint for interacting with files and folders."""
def _get_accelerator_upload_url(self, file_id=None):
"""
Make an API call to get the Accelerator upload url for either upload a new file or updating an existing file.
:param file_id:
Box id of the file to be uploaded. Not required for new file uploads.
:type file_id:
`unicode` or None
:return:
The Accelerator upload url or None if cannot get the Accelerator upload url.
:rtype:
`unicode` or None
"""
endpoint = '{0}/content'.format(file_id) if file_id else 'content'
url = '{0}/files/{1}'.format(API.BASE_API_URL, endpoint)
try:
response_json = self._session.options(
url=url,
expect_json_response=True,
).json()
return response_json.get('upload_url', None)
except BoxAPIException:
return None
def _preflight_check(self, size, name=None, file_id=None, parent_id=None):
"""
Make an API call to check if certain file can be uploaded to Box or not.
(https://developers.box.com/docs/#files-preflight-check)
:param size:
The size of the file to be uploaded in bytes. Specify 0 for unknown file sizes.
:type size:
`int`
:param name:
The name of the file to be uploaded. This is optional if `file_id` is specified,
but required for new file uploads.
:type name:
`unicode`
:param file_id:
Box id of the file to be uploaded. Not required for new file uploads.
:type file_id:
`unicode`
:param parent_id:
The ID of the parent folder. Required only for new file uploads.
:type parent_id:
`unicode`
:raises:
:class:`BoxAPIException` when preflight check fails.
"""
endpoint = '{0}/content'.format(file_id) if file_id else 'content'
url = '{0}/files/{1}'.format(API.BASE_API_URL, endpoint)
data = {'size': size}
if name:
data['name'] = name
if parent_id:
data['parent'] = {'id': parent_id}
self._session.options(
url=url,
expect_json_response=False,
data=json.dumps(data),
)
def update_info(self, data, etag=None):
"""Baseclass override.
:param etag:
If specified, instruct the Box API to perform the update only if
the current version's etag matches.
:type etag:
`unicode` or None
:return:
The updated object.
Return a new object of the same type, without modifying the original object passed as self.
Construct the new object with all the default attributes that are returned from the endpoint.
:rtype:
:class:`BaseObject`
"""
# pylint:disable=arguments-differ
headers = {'If-Match': etag} if etag is not None else None
return super(Item, self).update_info(data, headers=headers)
def rename(self, name):
"""
Rename the item to a new name.
:param name:
The new name, you want the item to be renamed to.
:type name:
`unicode`
"""
data = {
'name': name,
}
return self.update_info(data)
def get(self, fields=None, etag=None):
"""Base class override.
:param etag:
If specified, instruct the Box API to get the info only if the current version's etag doesn't match.
:type etag:
`unicode` or None
:returns:
Information about the file or folder.
:rtype:
`dict`
:raises: :class:`BoxAPIException` if the specified etag matches the latest version of the item.
"""
# pylint:disable=arguments-differ
headers = {'If-None-Match': etag} if etag is not None else None
return super(Item, self).get(fields=fields, headers=headers)
def copy(self, parent_folder):
"""Copy the item to the given folder.
:param parent_folder:
The folder to which the item should be copied.
:type parent_folder:
:class:`Folder`
"""
url = self.get_url('copy')
data = {
'parent': {'id': parent_folder.object_id}
}
box_response = self._session.post(url, data=json.dumps(data))
response = box_response.json()
return self.__class__(
session=self._session,
object_id=response['id'],
response_object=response,
)
def move(self, parent_folder):
"""
Move the item to the given folder.
:param parent_folder:
The parent `Folder` object, where the item will be moved to.
:type parent_folder:
`Folder`
"""
data = {
'parent': {'id': parent_folder.object_id}
}
return self.update_info(data)
def get_shared_link(self, access=None, etag=None, unshared_at=None, allow_download=None, allow_preview=None, password=None):
"""Get a shared link for the item with the given access permissions.
:param access:
Determines who can access the shared link. May be open, company, or collaborators. If no access is
specified, the default access will be used.
:type access:
`unicode` or None
:param etag:
If specified, instruct the Box API to create the link only if the current version's etag matches.
:type etag:
`unicode` or None
:param unshared_at:
The date on which this link should be disabled. May only be set if the current user is not a free user
and has permission to set expiration dates.
:type unshared_at:
:class:`datetime.date` or None
:param allow_download:
Whether or not the item being shared can be downloaded when accessed via the shared link.
If this parameter is None, the default setting will be used.
:type allow_download:
`bool` or None
:param allow_preview:
Whether or not the item being shared can be previewed when accessed via the shared link.
If this parameter is None, the default setting will be used.
:type allow_preview:
`bool` or None
:param password:
The password required to view this link. If no password is specified then no password will be set.
Please notice that this is a premium feature, which might not be available to your app.
:type password:
`unicode` or None
:returns:
The URL of the shared link.
:rtype:
`unicode`
:raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
"""
data = {
'shared_link': {} if not access else {
'access': access
}
}
if unshared_at is not None:
data['shared_link']['unshared_at'] = unshared_at.isoformat()
if allow_download is not None or allow_preview is not None:
data['shared_link']['permissions'] = permissions = {}
if allow_download is not None:
permissions['can_download'] = allow_download
if allow_preview is not None:
permissions['can_preview'] = allow_preview
if password is not None:
data['shared_link']['password'] = password
item = self.update_info(data, etag=etag)
return item.shared_link['url']
def remove_shared_link(self, etag=None):
"""Delete the shared link for the item.
:param etag:
If specified, instruct the Box API to delete the link only if the current version's etag matches.
:type etag:
`unicode` or None
:returns:
Whether or not the update was successful.
:rtype:
`bool`
:raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
"""
data = {'shared_link': None}
item = self.update_info(data, etag=etag)
return item.shared_link is None
def delete(self, params=None, etag=None):
"""Delete the item.
:param params:
Additional parameters to send with the request.
:type params:
`dict`
:param etag:
If specified, instruct the Box API to delete the item only if the current version's etag matches.
:type etag:
`unicode` or None
:returns:
Whether or not the delete was successful.
:rtype:
`bool`
:raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
"""
headers = {'If-Match': etag} if etag is not None else None
return super(Item, self).delete(params, headers)
| mit | [
3,
2803,
26,
2774,
13,
24,
199,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2022,
199,
199,
504,
1275,
1095,
63,
785,
492,
3523,
1692,
199,
504,
5689,
9277,
14,
888,
492,
3261,
199,
504,
5689,
9277,
14,
1971,
492,
20783,
29388,
421,
199,
533,
7020,
8,
1563,
1692,
304,
272,
408,
3532,
3261,
6037,
367,
17232,
316,
543,
1584,
436,
16533,
1041,
339,
347,
485,
362,
63,
645,
27139,
63,
5064,
63,
633,
8,
277,
12,
570,
63,
344,
29,
403,
304,
267,
408,
267,
4155,
376,
3261,
1240,
370,
664,
314,
4473,
27139,
5802,
1166,
367,
1902,
5802,
282,
892,
570,
503,
12928,
376,
3411,
570,
14,
398,
520,
635,
570,
63,
344,
26,
288,
20783,
1305,
402,
314,
570,
370,
506,
14238,
14,
2832,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
570,
63,
344,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
1107,
26,
288,
710,
4473,
27139,
5802,
1166,
503,
488,
340,
3913,
664,
314,
4473,
27139,
5802,
1166,
14,
267,
520,
4500,
26,
288,
658,
2975,
64,
503,
488,
267,
408,
267,
6037,
275,
5041,
16,
5995,
1317,
1370,
908,
8,
493,
63,
344,
9,
340,
570,
63,
344,
587,
283,
1317,
7,
267,
1166,
275,
5041,
16,
5995,
1725,
5321,
17,
5285,
908,
8,
3735,
14,
5825,
63,
3735,
63,
2632,
12,
6037,
9,
267,
862,
26,
288,
1177,
63,
1001,
275,
291,
423,
1730,
14,
1419,
8,
355,
1166,
29,
633,
12,
355,
4282,
63,
1001,
63,
1310,
29,
549,
12,
288,
7092,
1001,
342,
288,
372,
1177,
63,
1001,
14,
362,
360,
5064,
63,
633,
297,
488,
9,
267,
871,
20783,
29388,
26,
288,
372,
488,
339,
347,
485,
13829,
4040,
63,
1074,
8,
277,
12,
1568,
12,
536,
29,
403,
12,
570,
63,
344,
29,
403,
12,
1676,
63,
344,
29,
403,
304,
267,
408,
267,
4155,
376,
3261,
1240,
370,
1104,
340,
9842,
570,
883,
506,
14238,
370,
20783,
503,
440,
14,
267,
334,
2859,
921,
23826,
14,
1977,
14,
957,
15,
4757,
12645,
1725,
13,
13829,
4040,
13,
1074,
9,
398,
520,
635,
1568,
26,
288,
710,
1568,
402,
314,
570,
370,
506,
14238,
315,
2783,
14,
13327,
378,
367,
5809,
570,
10627,
14,
267,
520,
466,
1568,
26,
288,
658,
442,
64,
267,
520,
635,
536,
26,
288,
710,
536,
402,
314,
570,
370,
506,
14238,
14,
961,
365,
2716,
340,
658,
493,
63,
344,
64,
365,
2013,
12,
288,
1325,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
536,
26,
288,
658,
2975,
64,
267,
520,
635,
570,
63,
344,
26,
288,
20783,
1305,
402,
314,
570,
370,
506,
14238,
14,
2832,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
570,
63,
344,
26,
288,
658,
2975,
64,
267,
520,
635,
1676,
63,
344,
26,
288,
710,
2870,
402,
314,
1676,
4922,
14,
11105,
1454,
367,
892,
570,
26598,
14,
267,
520,
466,
1676,
63,
344,
26,
288,
658,
2975,
64,
267,
520,
3536,
26,
288,
520,
533,
1705,
3532,
29388,
64,
1380,
20491,
4040,
1104,
6918,
14,
267,
408,
267,
6037,
275,
5041,
16,
5995,
1317,
1370,
908,
8,
493,
63,
344,
9,
340,
570,
63,
344,
587,
283,
1317,
7,
267,
1166,
275,
5041,
16,
5995,
1725,
5321,
17,
5285,
908,
8,
3735,
14,
5825,
63,
3735,
63,
2632,
12,
6037,
9,
267,
666,
275,
791,
890,
356,
1568,
93,
267,
340,
536,
26,
288,
666,
459,
354,
418,
275,
536,
267,
340,
1676,
63,
344,
26,
288,
666,
459,
1708,
418,
275,
791,
344,
356,
1676,
63,
344,
93,
398,
291,
423,
1730,
14,
1419,
8,
288,
1166,
29,
633,
12,
288,
4282,
63,
1001,
63,
1310,
29,
797,
12,
288,
666,
29,
1001,
14,
4180,
8,
576,
395,
267,
776,
339,
347,
1678,
63,
815,
8,
277,
12,
666,
12,
13677,
29,
403,
304,
267,
408,
1563,
533,
4278,
14,
398,
520,
635,
13677,
26,
288,
982,
2013,
12,
315,
1820,
314,
20783,
3261,
370,
5147,
314,
1678,
1454,
340,
288,
314,
1453,
1015,
1159,
13677,
4450,
14,
267,
520,
466,
13677,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
1107,
26,
288,
710,
4588,
909,
14,
288,
1432,
282,
892,
909,
402,
314,
2011,
730,
12,
1928,
24662,
314,
3379,
909,
3032,
465,
291,
14,
288,
9215,
314,
892,
909,
543,
1006,
314,
849,
3004,
626,
787,
2138,
687,
314,
6037,
14,
267,
520,
4500,
26,
288,
520,
533,
1705,
1563,
1692,
64,
267,
408,
267,
327,
4287,
26,
5993,
29,
4958,
13,
328,
1260,
267,
2323,
275,
791,
3917,
13,
4486,
356,
13677,
93,
340,
13677,
365,
440,
488,
587,
488,
267,
372,
1613,
8,
2081,
12,
291,
680,
873,
63,
815,
8,
576,
12,
2323,
29,
2139,
9,
339,
347,
11441,
8,
277,
12,
536,
304,
267,
408,
267,
22756,
314,
1242,
370,
282,
892,
536,
14,
398,
520,
635,
536,
26,
288,
710,
892,
536,
12,
1265,
2934,
314,
1242,
370,
506,
17864,
370,
14,
267,
520,
466,
536,
26,
288,
658,
2975,
64,
267,
408,
267,
666,
275,
469,
288,
283,
354,
356,
536,
12,
267,
789,
267,
372,
291,
14,
873,
63,
815,
8,
576,
9,
339,
347,
664,
8,
277,
12,
1504,
29,
403,
12,
13677,
29,
403,
304,
267,
408,
1563,
1021,
4278,
14,
398,
520,
635,
13677,
26,
288,
982,
2013,
12,
315,
1820,
314,
20783,
3261,
370,
664,
314,
2256,
1454,
340,
314,
1453,
1015,
1159,
13677,
3181,
1133,
1336,
14,
267,
520,
466,
13677,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
5808,
26,
288,
17064,
3595,
314,
570,
503,
4922,
14,
267,
520,
4500,
26,
288,
658,
807,
64,
267,
520,
3536,
26,
520,
533,
1705,
3532,
29388,
64,
340,
314,
2013,
13677,
4450,
314,
8839,
1015,
402,
314,
1242,
14,
267,
408,
267,
327,
4287,
26,
5993,
29,
4958,
13,
328,
1260,
267,
2323,
275,
791,
3917,
13,
403,
13,
4486,
356,
13677,
93,
340,
13677,
365,
440,
488,
587,
488,
267,
372,
1613,
8,
2081,
12,
291,
680,
362,
8,
955,
29,
955,
12,
2323,
29,
2139,
9,
339,
347,
1331,
8,
277,
12,
1676,
63,
3741,
304,
267,
408,
5116
] | [
2803,
26,
2774,
13,
24,
199,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2022,
199,
199,
504,
1275,
1095,
63,
785,
492,
3523,
1692,
199,
504,
5689,
9277,
14,
888,
492,
3261,
199,
504,
5689,
9277,
14,
1971,
492,
20783,
29388,
421,
199,
533,
7020,
8,
1563,
1692,
304,
272,
408,
3532,
3261,
6037,
367,
17232,
316,
543,
1584,
436,
16533,
1041,
339,
347,
485,
362,
63,
645,
27139,
63,
5064,
63,
633,
8,
277,
12,
570,
63,
344,
29,
403,
304,
267,
408,
267,
4155,
376,
3261,
1240,
370,
664,
314,
4473,
27139,
5802,
1166,
367,
1902,
5802,
282,
892,
570,
503,
12928,
376,
3411,
570,
14,
398,
520,
635,
570,
63,
344,
26,
288,
20783,
1305,
402,
314,
570,
370,
506,
14238,
14,
2832,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
570,
63,
344,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
1107,
26,
288,
710,
4473,
27139,
5802,
1166,
503,
488,
340,
3913,
664,
314,
4473,
27139,
5802,
1166,
14,
267,
520,
4500,
26,
288,
658,
2975,
64,
503,
488,
267,
408,
267,
6037,
275,
5041,
16,
5995,
1317,
1370,
908,
8,
493,
63,
344,
9,
340,
570,
63,
344,
587,
283,
1317,
7,
267,
1166,
275,
5041,
16,
5995,
1725,
5321,
17,
5285,
908,
8,
3735,
14,
5825,
63,
3735,
63,
2632,
12,
6037,
9,
267,
862,
26,
288,
1177,
63,
1001,
275,
291,
423,
1730,
14,
1419,
8,
355,
1166,
29,
633,
12,
355,
4282,
63,
1001,
63,
1310,
29,
549,
12,
288,
7092,
1001,
342,
288,
372,
1177,
63,
1001,
14,
362,
360,
5064,
63,
633,
297,
488,
9,
267,
871,
20783,
29388,
26,
288,
372,
488,
339,
347,
485,
13829,
4040,
63,
1074,
8,
277,
12,
1568,
12,
536,
29,
403,
12,
570,
63,
344,
29,
403,
12,
1676,
63,
344,
29,
403,
304,
267,
408,
267,
4155,
376,
3261,
1240,
370,
1104,
340,
9842,
570,
883,
506,
14238,
370,
20783,
503,
440,
14,
267,
334,
2859,
921,
23826,
14,
1977,
14,
957,
15,
4757,
12645,
1725,
13,
13829,
4040,
13,
1074,
9,
398,
520,
635,
1568,
26,
288,
710,
1568,
402,
314,
570,
370,
506,
14238,
315,
2783,
14,
13327,
378,
367,
5809,
570,
10627,
14,
267,
520,
466,
1568,
26,
288,
658,
442,
64,
267,
520,
635,
536,
26,
288,
710,
536,
402,
314,
570,
370,
506,
14238,
14,
961,
365,
2716,
340,
658,
493,
63,
344,
64,
365,
2013,
12,
288,
1325,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
536,
26,
288,
658,
2975,
64,
267,
520,
635,
570,
63,
344,
26,
288,
20783,
1305,
402,
314,
570,
370,
506,
14238,
14,
2832,
1415,
367,
892,
570,
26598,
14,
267,
520,
466,
570,
63,
344,
26,
288,
658,
2975,
64,
267,
520,
635,
1676,
63,
344,
26,
288,
710,
2870,
402,
314,
1676,
4922,
14,
11105,
1454,
367,
892,
570,
26598,
14,
267,
520,
466,
1676,
63,
344,
26,
288,
658,
2975,
64,
267,
520,
3536,
26,
288,
520,
533,
1705,
3532,
29388,
64,
1380,
20491,
4040,
1104,
6918,
14,
267,
408,
267,
6037,
275,
5041,
16,
5995,
1317,
1370,
908,
8,
493,
63,
344,
9,
340,
570,
63,
344,
587,
283,
1317,
7,
267,
1166,
275,
5041,
16,
5995,
1725,
5321,
17,
5285,
908,
8,
3735,
14,
5825,
63,
3735,
63,
2632,
12,
6037,
9,
267,
666,
275,
791,
890,
356,
1568,
93,
267,
340,
536,
26,
288,
666,
459,
354,
418,
275,
536,
267,
340,
1676,
63,
344,
26,
288,
666,
459,
1708,
418,
275,
791,
344,
356,
1676,
63,
344,
93,
398,
291,
423,
1730,
14,
1419,
8,
288,
1166,
29,
633,
12,
288,
4282,
63,
1001,
63,
1310,
29,
797,
12,
288,
666,
29,
1001,
14,
4180,
8,
576,
395,
267,
776,
339,
347,
1678,
63,
815,
8,
277,
12,
666,
12,
13677,
29,
403,
304,
267,
408,
1563,
533,
4278,
14,
398,
520,
635,
13677,
26,
288,
982,
2013,
12,
315,
1820,
314,
20783,
3261,
370,
5147,
314,
1678,
1454,
340,
288,
314,
1453,
1015,
1159,
13677,
4450,
14,
267,
520,
466,
13677,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
1107,
26,
288,
710,
4588,
909,
14,
288,
1432,
282,
892,
909,
402,
314,
2011,
730,
12,
1928,
24662,
314,
3379,
909,
3032,
465,
291,
14,
288,
9215,
314,
892,
909,
543,
1006,
314,
849,
3004,
626,
787,
2138,
687,
314,
6037,
14,
267,
520,
4500,
26,
288,
520,
533,
1705,
1563,
1692,
64,
267,
408,
267,
327,
4287,
26,
5993,
29,
4958,
13,
328,
1260,
267,
2323,
275,
791,
3917,
13,
4486,
356,
13677,
93,
340,
13677,
365,
440,
488,
587,
488,
267,
372,
1613,
8,
2081,
12,
291,
680,
873,
63,
815,
8,
576,
12,
2323,
29,
2139,
9,
339,
347,
11441,
8,
277,
12,
536,
304,
267,
408,
267,
22756,
314,
1242,
370,
282,
892,
536,
14,
398,
520,
635,
536,
26,
288,
710,
892,
536,
12,
1265,
2934,
314,
1242,
370,
506,
17864,
370,
14,
267,
520,
466,
536,
26,
288,
658,
2975,
64,
267,
408,
267,
666,
275,
469,
288,
283,
354,
356,
536,
12,
267,
789,
267,
372,
291,
14,
873,
63,
815,
8,
576,
9,
339,
347,
664,
8,
277,
12,
1504,
29,
403,
12,
13677,
29,
403,
304,
267,
408,
1563,
1021,
4278,
14,
398,
520,
635,
13677,
26,
288,
982,
2013,
12,
315,
1820,
314,
20783,
3261,
370,
664,
314,
2256,
1454,
340,
314,
1453,
1015,
1159,
13677,
3181,
1133,
1336,
14,
267,
520,
466,
13677,
26,
288,
658,
2975,
64,
503,
488,
267,
520,
5808,
26,
288,
17064,
3595,
314,
570,
503,
4922,
14,
267,
520,
4500,
26,
288,
658,
807,
64,
267,
520,
3536,
26,
520,
533,
1705,
3532,
29388,
64,
340,
314,
2013,
13677,
4450,
314,
8839,
1015,
402,
314,
1242,
14,
267,
408,
267,
327,
4287,
26,
5993,
29,
4958,
13,
328,
1260,
267,
2323,
275,
791,
3917,
13,
403,
13,
4486,
356,
13677,
93,
340,
13677,
365,
440,
488,
587,
488,
267,
372,
1613,
8,
2081,
12,
291,
680,
362,
8,
955,
29,
955,
12,
2323,
29,
2139,
9,
339,
347,
1331,
8,
277,
12,
1676,
63,
3741,
304,
267,
408,
5116,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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(c) 2013, Paul Durivage <paul.durivage@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/>.
#
#
# Author: Paul Durivage <paul.durivage@gmail.com>
#
# Description:
# This module queries local or remote Docker daemons and generates
# inventory information.
#
# This plugin does not support targeting of specific hosts using the --host
# flag. Instead, it queries the Docker API for each container, running
# or not, and returns this data all once.
#
# The plugin returns the following custom attributes on Docker containers:
# docker_args
# docker_config
# docker_created
# docker_driver
# docker_exec_driver
# docker_host_config
# docker_hostname_path
# docker_hosts_path
# docker_id
# docker_image
# docker_name
# docker_network_settings
# docker_path
# docker_resolv_conf_path
# docker_state
# docker_volumes
# docker_volumes_rw
#
# Requirements:
# The docker-py module: https://github.com/dotcloud/docker-py
#
# Notes:
# A config file can be used to configure this inventory module, and there
# are several environment variables that can be set to modify the behavior
# of the plugin at runtime:
# DOCKER_CONFIG_FILE
# DOCKER_HOST
# DOCKER_VERSION
# DOCKER_TIMEOUT
# DOCKER_PRIVATE_SSH_PORT
# DOCKER_DEFAULT_IP
#
# Environment Variables:
# environment variable: DOCKER_CONFIG_FILE
# description:
# - A path to a Docker inventory hosts/defaults file in YAML format
# - A sample file has been provided, colocated with the inventory
# file called 'docker.yml'
# required: false
# default: Uses docker.docker.Client constructor defaults
# environment variable: DOCKER_HOST
# description:
# - The socket on which to connect to a Docker daemon API
# required: false
# default: Uses docker.docker.Client constructor defaults
# environment variable: DOCKER_VERSION
# description:
# - Version of the Docker API to use
# default: Uses docker.docker.Client constructor defaults
# required: false
# environment variable: DOCKER_TIMEOUT
# description:
# - Timeout in seconds for connections to Docker daemon API
# default: Uses docker.docker.Client constructor defaults
# required: false
# environment variable: DOCKER_PRIVATE_SSH_PORT
# description:
# - The private port (container port) on which SSH is listening
# for connections
# default: 22
# required: false
# environment variable: DOCKER_DEFAULT_IP
# description:
# - This environment variable overrides the container SSH connection
# IP address (aka, 'ansible_ssh_host')
#
# This option allows one to override the ansible_ssh_host whenever
# Docker has exercised its default behavior of binding private ports
# to all interfaces of the Docker host. This behavior, when dealing
# with remote Docker hosts, does not allow Ansible to determine
# a proper host IP address on which to connect via SSH to containers.
# By default, this inventory module assumes all 0.0.0.0-exposed
# ports to be bound to localhost:<port>. To override this
# behavior, for example, to bind a container's SSH port to the public
# interface of its host, one must manually set this IP.
#
# It is preferable to begin to launch Docker containers with
# ports exposed on publicly accessible IP addresses, particularly
# if the containers are to be targeted by Ansible for remote
# configuration, not accessible via localhost SSH connections.
#
# Docker containers can be explicitly exposed on IP addresses by
# a) starting the daemon with the --ip argument
# b) running containers with the -P/--publish ip::containerPort
# argument
# default: 127.0.0.1 if port exposed on 0.0.0.0 by Docker
# required: false
#
# Examples:
# Use the config file:
# DOCKER_CONFIG_FILE=./docker.yml docker.py --list
#
# Connect to docker instance on localhost port 4243
# DOCKER_HOST=tcp://localhost:4243 docker.py --list
#
# Any container's ssh port exposed on 0.0.0.0 will mapped to
# another IP address (where Ansible will attempt to connect via SSH)
# DOCKER_DEFAULT_IP=1.2.3.4 docker.py --list
import os
import sys
import json
import argparse
from UserDict import UserDict
from collections import defaultdict
import yaml
from requests import HTTPError, ConnectionError
# Manipulation of the path is needed because the docker-py
# module is imported by the name docker, and because this file
# is also named docker
for path in [os.getcwd(), '', os.path.dirname(os.path.abspath(__file__))]:
try:
del sys.path[sys.path.index(path)]
except:
pass
try:
import docker
except ImportError:
print('docker-py is required for this module')
sys.exit(1)
class HostDict(UserDict):
def __setitem__(self, key, value):
if value is not None:
self.data[key] = value
def update(self, dict=None, **kwargs):
if dict is None:
pass
elif isinstance(dict, UserDict):
for k, v in dict.data.items():
self[k] = v
else:
for k, v in dict.items():
self[k] = v
if len(kwargs):
for k, v in kwargs.items():
self[k] = v
def write_stderr(string):
sys.stderr.write('%s\n' % string)
def setup():
config = dict()
config_file = os.environ.get('DOCKER_CONFIG_FILE')
if config_file:
try:
config_file = os.path.abspath(config_file)
except Exception as e:
write_stderr(e)
sys.exit(1)
with open(config_file) as f:
try:
config = yaml.safe_load(f.read())
except Exception as e:
write_stderr(e)
sys.exit(1)
# Environment Variables
env_base_url = os.environ.get('DOCKER_HOST')
env_version = os.environ.get('DOCKER_VERSION')
env_timeout = os.environ.get('DOCKER_TIMEOUT')
env_ssh_port = os.environ.get('DOCKER_PRIVATE_SSH_PORT', '22')
env_default_ip = os.environ.get('DOCKER_DEFAULT_IP', '127.0.0.1')
# Config file defaults
defaults = config.get('defaults', dict())
def_host = defaults.get('host')
def_version = defaults.get('version')
def_timeout = defaults.get('timeout')
def_default_ip = defaults.get('default_ip')
def_ssh_port = defaults.get('private_ssh_port')
hosts = list()
if config:
hosts_list = config.get('hosts', list())
# Look to the config file's defined hosts
if hosts_list:
for host in hosts_list:
baseurl = host.get('host') or def_host or env_base_url
version = host.get('version') or def_version or env_version
timeout = host.get('timeout') or def_timeout or env_timeout
default_ip = host.get('default_ip') or def_default_ip or env_default_ip
ssh_port = host.get('private_ssh_port') or def_ssh_port or env_ssh_port
hostdict = HostDict(
base_url=baseurl,
version=version,
timeout=timeout,
default_ip=default_ip,
private_ssh_port=ssh_port,
)
hosts.append(hostdict)
# Look to the defaults
else:
hostdict = HostDict(
base_url=def_host,
version=def_version,
timeout=def_timeout,
default_ip=def_default_ip,
private_ssh_port=def_ssh_port,
)
hosts.append(hostdict)
# Look to the environment
else:
hostdict = HostDict(
base_url=env_base_url,
version=env_version,
timeout=env_timeout,
default_ip=env_default_ip,
private_ssh_port=env_ssh_port,
)
hosts.append(hostdict)
return hosts
def list_groups():
hosts = setup()
groups = defaultdict(list)
hostvars = defaultdict(dict)
for host in hosts:
ssh_port = host.pop('private_ssh_port', None)
default_ip = host.pop('default_ip', None)
hostname = host.get('base_url')
try:
client = docker.Client(**host)
containers = client.containers(all=True)
except (HTTPError, ConnectionError) as e:
write_stderr(e)
sys.exit(1)
for container in containers:
id = container.get('Id')
short_id = id[:13]
try:
name = container.get('Names', list()).pop(0).lstrip('/')
except IndexError:
name = short_id
if not id:
continue
inspect = client.inspect_container(id)
running = inspect.get('State', dict()).get('Running')
groups[id].append(name)
groups[name].append(name)
if not short_id in groups.keys():
groups[short_id].append(name)
groups[hostname].append(name)
if running is True:
groups['running'].append(name)
else:
groups['stopped'].append(name)
try:
port = client.port(container, ssh_port)[0]
except (IndexError, AttributeError, TypeError):
port = dict()
try:
ip = default_ip if port['HostIp'] == '0.0.0.0' else port['HostIp']
except KeyError:
ip = ''
container_info = dict(
ansible_ssh_host=ip,
ansible_ssh_port=port.get('HostPort', int()),
docker_args=inspect.get('Args'),
docker_config=inspect.get('Config'),
docker_created=inspect.get('Created'),
docker_driver=inspect.get('Driver'),
docker_exec_driver=inspect.get('ExecDriver'),
docker_host_config=inspect.get('HostConfig'),
docker_hostname_path=inspect.get('HostnamePath'),
docker_hosts_path=inspect.get('HostsPath'),
docker_id=inspect.get('ID'),
docker_image=inspect.get('Image'),
docker_name=name,
docker_network_settings=inspect.get('NetworkSettings'),
docker_path=inspect.get('Path'),
docker_resolv_conf_path=inspect.get('ResolvConfPath'),
docker_state=inspect.get('State'),
docker_volumes=inspect.get('Volumes'),
docker_volumes_rw=inspect.get('VolumesRW'),
)
hostvars[name].update(container_info)
groups['docker_hosts'] = [host.get('base_url') for host in hosts]
groups['_meta'] = dict()
groups['_meta']['hostvars'] = hostvars
print json.dumps(groups, sort_keys=True, indent=4)
sys.exit(0)
def parse_args():
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--list', action='store_true')
group.add_argument('--host', action='store_true')
return parser.parse_args()
def main():
args = parse_args()
if args.list:
list_groups()
elif args.host:
write_stderr('This option is not supported.')
sys.exit(1)
sys.exit(0)
main()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
334,
67,
9,
6171,
12,
28574,
577,
300,
1003,
474,
665,
387,
348,
14,
30695,
1003,
474,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
2622,
14,
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,
3,
199,
3,
199,
3,
6529,
26,
28574,
577,
300,
1003,
474,
665,
387,
348,
14,
30695,
1003,
474,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
11994,
26,
199,
3,
961,
859,
9212,
2257,
503,
3982,
22067,
11128,
83,
436,
12821,
199,
3,
8200,
2556,
14,
199,
3,
199,
3,
961,
3589,
1630,
440,
2291,
1347,
316,
402,
2488,
7057,
1808,
314,
1553,
1102,
199,
3,
3305,
14,
15345,
12,
652,
9212,
314,
22067,
3261,
367,
1924,
3970,
12,
3879,
199,
3,
503,
440,
12,
436,
2529,
642,
666,
1006,
5403,
14,
199,
3,
199,
3,
710,
3589,
2529,
314,
2569,
3537,
3004,
641,
22067,
15333,
26,
199,
3,
259,
12424,
63,
589,
199,
3,
259,
12424,
63,
888,
199,
3,
259,
12424,
63,
3966,
199,
3,
259,
12424,
63,
3090,
199,
3,
259,
12424,
63,
1628,
63,
3090,
199,
3,
259,
12424,
63,
1102,
63,
888,
199,
3,
259,
12424,
63,
4269,
63,
515,
199,
3,
259,
12424,
63,
5146,
63,
515,
199,
3,
259,
12424,
63,
344,
199,
3,
259,
12424,
63,
1569,
199,
3,
259,
12424,
63,
354,
199,
3,
259,
12424,
63,
1200,
63,
1751,
199,
3,
259,
12424,
63,
515,
199,
3,
259,
12424,
63,
26702,
86,
63,
2190,
63,
515,
199,
3,
259,
12424,
63,
929,
199,
3,
259,
12424,
63,
8838,
199,
3,
259,
12424,
63,
8838,
63,
13057,
199,
3,
199,
3,
18513,
1470,
26,
199,
3,
710,
12424,
13,
647,
859,
26,
4178,
921,
5031,
14,
957,
15,
3287,
4091,
15,
9991,
13,
647,
199,
3,
199,
3,
8144,
26,
199,
3,
437,
1101,
570,
883,
506,
1202,
370,
7908,
642,
8200,
859,
12,
436,
2337,
199,
3,
787,
9978,
3734,
2860,
626,
883,
506,
663,
370,
2811,
314,
5953,
199,
3,
402,
314,
3589,
737,
8836,
26,
199,
3,
259,
3506,
2504,
540,
63,
5569,
63,
3817,
199,
3,
259,
3506,
2504,
540,
63,
5449,
199,
3,
259,
3506,
2504,
540,
63,
4612,
199,
3,
259,
3506,
2504,
540,
63,
8899,
199,
3,
259,
3506,
2504,
540,
63,
18748,
63,
13716,
63,
3657,
199,
3,
259,
3506,
2504,
540,
63,
3472,
63,
1772,
199,
3,
199,
3,
9711,
17198,
26,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
5569,
63,
3817,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
437,
931,
370,
282,
22067,
8200,
7057,
15,
4322,
570,
315,
18916,
1475,
199,
3,
260,
446,
437,
2690,
570,
965,
2757,
2741,
12,
512,
13340,
543,
314,
8200,
199,
3,
3698,
570,
2797,
283,
9991,
14,
11714,
7,
199,
3,
258,
1415,
26,
3055,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
5449,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
710,
2838,
641,
1314,
370,
4907,
370,
282,
22067,
11128,
3261,
199,
3,
258,
1415,
26,
3055,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
4612,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
3394,
402,
314,
22067,
3261,
370,
675,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
8899,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
12878,
315,
4696,
367,
6947,
370,
22067,
11128,
3261,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
18748,
63,
13716,
63,
3657,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
710,
5726,
1844,
334,
3600,
1844,
9,
641,
1314,
12027,
365,
22721,
199,
3,
3698,
367,
6947,
199,
3,
258,
849,
26,
6928,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
3472,
63,
1772,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
961,
3734,
1750,
10580,
314,
3970,
12027,
1950,
199,
3,
3698,
3531,
2287,
334,
24685,
12,
283,
4853,
63,
5510,
63,
1102,
358,
199,
3,
199,
3,
3698,
961,
945,
6127,
1373,
370,
4278,
314,
3242,
63,
5510,
63,
1102,
18119,
199,
3,
3698,
22067,
965,
444,
281,
559,
939,
2399,
849,
5953,
402,
11696,
5726,
8873,
199,
3,
3698,
370,
1006,
8386,
402,
314,
22067,
1591,
14,
221,
961,
5953,
12,
1380,
23654,
199,
3,
3698,
543,
3982,
22067,
7057,
12,
1630,
440,
2040,
2622,
370,
6705,
199,
3,
3698,
282,
5576,
1591,
3531,
2287,
641,
1314,
370,
4907,
4799,
12027,
370,
15333,
14,
199,
3,
3698,
4885,
849,
12,
642,
8200,
859,
15194,
1006,
378,
14,
16,
14,
16,
14,
16,
13,
26717,
199,
3,
3698,
8873,
370,
506,
3914,
370,
11667,
16875,
719,
10827,
221,
4005,
4278,
642,
199,
3,
3698,
5953,
12,
367,
2893,
12,
370,
5398,
282,
3970,
1159,
12027,
1844,
370,
314,
4575,
199,
3,
3698,
3217,
402,
2399,
1591,
12,
1373,
1471,
10250,
663,
642,
3531,
14,
199,
3,
199
] | [
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
334,
67,
9,
6171,
12,
28574,
577,
300,
1003,
474,
665,
387,
348,
14,
30695,
1003,
474,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
2622,
14,
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,
3,
199,
3,
199,
3,
6529,
26,
28574,
577,
300,
1003,
474,
665,
387,
348,
14,
30695,
1003,
474,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
11994,
26,
199,
3,
961,
859,
9212,
2257,
503,
3982,
22067,
11128,
83,
436,
12821,
199,
3,
8200,
2556,
14,
199,
3,
199,
3,
961,
3589,
1630,
440,
2291,
1347,
316,
402,
2488,
7057,
1808,
314,
1553,
1102,
199,
3,
3305,
14,
15345,
12,
652,
9212,
314,
22067,
3261,
367,
1924,
3970,
12,
3879,
199,
3,
503,
440,
12,
436,
2529,
642,
666,
1006,
5403,
14,
199,
3,
199,
3,
710,
3589,
2529,
314,
2569,
3537,
3004,
641,
22067,
15333,
26,
199,
3,
259,
12424,
63,
589,
199,
3,
259,
12424,
63,
888,
199,
3,
259,
12424,
63,
3966,
199,
3,
259,
12424,
63,
3090,
199,
3,
259,
12424,
63,
1628,
63,
3090,
199,
3,
259,
12424,
63,
1102,
63,
888,
199,
3,
259,
12424,
63,
4269,
63,
515,
199,
3,
259,
12424,
63,
5146,
63,
515,
199,
3,
259,
12424,
63,
344,
199,
3,
259,
12424,
63,
1569,
199,
3,
259,
12424,
63,
354,
199,
3,
259,
12424,
63,
1200,
63,
1751,
199,
3,
259,
12424,
63,
515,
199,
3,
259,
12424,
63,
26702,
86,
63,
2190,
63,
515,
199,
3,
259,
12424,
63,
929,
199,
3,
259,
12424,
63,
8838,
199,
3,
259,
12424,
63,
8838,
63,
13057,
199,
3,
199,
3,
18513,
1470,
26,
199,
3,
710,
12424,
13,
647,
859,
26,
4178,
921,
5031,
14,
957,
15,
3287,
4091,
15,
9991,
13,
647,
199,
3,
199,
3,
8144,
26,
199,
3,
437,
1101,
570,
883,
506,
1202,
370,
7908,
642,
8200,
859,
12,
436,
2337,
199,
3,
787,
9978,
3734,
2860,
626,
883,
506,
663,
370,
2811,
314,
5953,
199,
3,
402,
314,
3589,
737,
8836,
26,
199,
3,
259,
3506,
2504,
540,
63,
5569,
63,
3817,
199,
3,
259,
3506,
2504,
540,
63,
5449,
199,
3,
259,
3506,
2504,
540,
63,
4612,
199,
3,
259,
3506,
2504,
540,
63,
8899,
199,
3,
259,
3506,
2504,
540,
63,
18748,
63,
13716,
63,
3657,
199,
3,
259,
3506,
2504,
540,
63,
3472,
63,
1772,
199,
3,
199,
3,
9711,
17198,
26,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
5569,
63,
3817,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
437,
931,
370,
282,
22067,
8200,
7057,
15,
4322,
570,
315,
18916,
1475,
199,
3,
260,
446,
437,
2690,
570,
965,
2757,
2741,
12,
512,
13340,
543,
314,
8200,
199,
3,
3698,
570,
2797,
283,
9991,
14,
11714,
7,
199,
3,
258,
1415,
26,
3055,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
5449,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
710,
2838,
641,
1314,
370,
4907,
370,
282,
22067,
11128,
3261,
199,
3,
258,
1415,
26,
3055,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
4612,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
3394,
402,
314,
22067,
3261,
370,
675,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
8899,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
12878,
315,
4696,
367,
6947,
370,
22067,
11128,
3261,
199,
3,
258,
849,
26,
14911,
12424,
14,
9991,
14,
3041,
3787,
4243,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
18748,
63,
13716,
63,
3657,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
710,
5726,
1844,
334,
3600,
1844,
9,
641,
1314,
12027,
365,
22721,
199,
3,
3698,
367,
6947,
199,
3,
258,
849,
26,
6928,
199,
3,
258,
1415,
26,
3055,
199,
3,
3734,
1750,
26,
3506,
2504,
540,
63,
3472,
63,
1772,
199,
3,
258,
1369,
26,
199,
3,
260,
446,
961,
3734,
1750,
10580,
314,
3970,
12027,
1950,
199,
3,
3698,
3531,
2287,
334,
24685,
12,
283,
4853,
63,
5510,
63,
1102,
358,
199,
3,
199,
3,
3698,
961,
945,
6127,
1373,
370,
4278,
314,
3242,
63,
5510,
63,
1102,
18119,
199,
3,
3698,
22067,
965,
444,
281,
559,
939,
2399,
849,
5953,
402,
11696,
5726,
8873,
199,
3,
3698,
370,
1006,
8386,
402,
314,
22067,
1591,
14,
221,
961,
5953,
12,
1380,
23654,
199,
3,
3698,
543,
3982,
22067,
7057,
12,
1630,
440,
2040,
2622,
370,
6705,
199,
3,
3698,
282,
5576,
1591,
3531,
2287,
641,
1314,
370,
4907,
4799,
12027,
370,
15333,
14,
199,
3,
3698,
4885,
849,
12,
642,
8200,
859,
15194,
1006,
378,
14,
16,
14,
16,
14,
16,
13,
26717,
199,
3,
3698,
8873,
370,
506,
3914,
370,
11667,
16875,
719,
10827,
221,
4005,
4278,
642,
199,
3,
3698,
5953,
12,
367,
2893,
12,
370,
5398,
282,
3970,
1159,
12027,
1844,
370,
314,
4575,
199,
3,
3698,
3217,
402,
2399,
1591,
12,
1373,
1471,
10250,
663,
642,
3531,
14,
199,
3,
199,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
schrd/django-crispy-forms | crispy_forms/helper.py | 14 | 14012 | # -*- coding: utf-8 -*-
import re
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from crispy_forms.compatibility import string_types
from crispy_forms.layout import Layout
from crispy_forms.layout_slice import LayoutSlice
from crispy_forms.utils import render_field, flatatt, TEMPLATE_PACK
from crispy_forms.exceptions import FormHelpersException
class DynamicLayoutHandler(object):
def _check_layout(self):
if self.layout is None:
raise FormHelpersException("You need to set a layout in your FormHelper")
def _check_layout_and_form(self):
self._check_layout()
if self.form is None:
raise FormHelpersException("You need to pass a form instance to your FormHelper")
def all(self):
"""
Returns all layout objects of first level of depth
"""
self._check_layout()
return LayoutSlice(self.layout, slice(0, len(self.layout.fields), 1))
def filter(self, *LayoutClasses, **kwargs):
"""
Returns a LayoutSlice pointing to layout objects of type `LayoutClass`
"""
self._check_layout()
max_level = kwargs.pop('max_level', 0)
greedy = kwargs.pop('greedy', False)
filtered_layout_objects = self.layout.get_layout_objects(LayoutClasses, max_level=max_level, greedy=greedy)
return LayoutSlice(self.layout, filtered_layout_objects)
def filter_by_widget(self, widget_type):
"""
Returns a LayoutSlice pointing to fields with widgets of `widget_type`
"""
self._check_layout_and_form()
layout_field_names = self.layout.get_field_names()
# Let's filter all fields with widgets like widget_type
filtered_fields = []
for pointer in layout_field_names:
if isinstance(self.form.fields[pointer[1]].widget, widget_type):
filtered_fields.append(pointer)
return LayoutSlice(self.layout, filtered_fields)
def exclude_by_widget(self, widget_type):
"""
Returns a LayoutSlice pointing to fields with widgets NOT matching `widget_type`
"""
self._check_layout_and_form()
layout_field_names = self.layout.get_field_names()
# Let's exclude all fields with widgets like widget_type
filtered_fields = []
for pointer in layout_field_names:
if not isinstance(self.form.fields[pointer[1]].widget, widget_type):
filtered_fields.append(pointer)
return LayoutSlice(self.layout, filtered_fields)
def __getitem__(self, key):
"""
Return a LayoutSlice that makes changes affect the current instance of the layout
and not a copy.
"""
# when key is a string containing the field name
if isinstance(key, string_types):
# Django templates access FormHelper attributes using dictionary [] operator
# This could be a helper['form_id'] access, not looking for a field
if hasattr(self, key):
return getattr(self, key)
self._check_layout()
layout_field_names = self.layout.get_field_names()
filtered_field = []
for pointer in layout_field_names:
# There can be an empty pointer
if len(pointer) == 2 and pointer[1] == key:
filtered_field.append(pointer)
return LayoutSlice(self.layout, filtered_field)
return LayoutSlice(self.layout, key)
def __setitem__(self, key, value):
self.layout[key] = value
def __delitem__(self, key):
del self.layout.fields[key]
def __len__(self):
if self.layout is not None:
return len(self.layout.fields)
else:
return 0
class FormHelper(DynamicLayoutHandler):
"""
This class controls the form rendering behavior of the form passed to
the `{% crispy %}` tag. For doing so you will need to set its attributes
and pass the corresponding helper object to the tag::
{% crispy form form.helper %}
Let's see what attributes you can set and what form behaviors they apply to:
**form_method**: Specifies form method attribute.
You can see it to 'POST' or 'GET'. Defaults to 'POST'
**form_action**: Applied to the form action attribute:
- Can be a named url in your URLconf that can be executed via the `{% url %}` template tag. \
Example: 'show_my_profile'. In your URLconf you could have something like::
url(r'^show/profile/$', 'show_my_profile_view', name = 'show_my_profile')
- It can simply point to a URL '/whatever/blabla/'.
**form_id**: Generates a form id for dom identification.
If no id provided then no id attribute is created on the form.
**form_class**: String containing separated CSS clases to be applied
to form class attribute. The form will always have by default
'uniForm' class.
**form_tag**: It specifies if <form></form> tags should be rendered when using a Layout.
If set to False it renders the form without the <form></form> tags. Defaults to True.
**form_error_title**: If a form has `non_field_errors` to display, they
are rendered in a div. You can set title's div with this attribute.
Example: "Oooops!" or "Form Errors"
**formset_error_title**: If a formset has `non_form_errors` to display, they
are rendered in a div. You can set title's div with this attribute.
**form_style**: Uni-form has two built in different form styles. You can choose
your favorite. This can be set to "default" or "inline". Defaults to "default".
Public Methods:
**add_input(input)**: You can add input buttons using this method. Inputs
added using this method will be rendered at the end of the form/formset.
**add_layout(layout)**: You can add a `Layout` object to `FormHelper`. The Layout
specifies in a simple, clean and DRY way how the form fields should be rendered.
You can wrap fields, order them, customize pretty much anything in the form.
Best way to add a helper to a form is adding a property named helper to the form
that returns customized `FormHelper` object::
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
class MyForm(forms.Form):
title = forms.CharField(_("Title"))
@property
def helper(self):
helper = FormHelper()
helper.form_id = 'this-form-rocks'
helper.form_class = 'search'
helper.add_input(Submit('save', 'save'))
[...]
return helper
You can use it in a template doing::
{% load crispy_forms_tags %}
{% crispy form %}
"""
_form_method = 'post'
_form_action = ''
_form_style = 'default'
form = None
form_id = ''
form_class = ''
layout = None
form_tag = True
form_error_title = None
formset_error_title = None
form_show_errors = True
render_unmentioned_fields = False
render_hidden_fields = False
render_required_fields = False
_help_text_inline = False
_error_text_inline = True
html5_required = False
form_show_labels = True
template = None
field_template = None
disable_csrf = False
label_class = ''
field_class = ''
def __init__(self, form=None):
self.attrs = {}
self.inputs = []
if form is not None:
self.form = form
self.layout = self.build_default_layout(form)
def build_default_layout(self, form):
return Layout(*form.fields.keys())
@property
def form_method(self):
return self._form_method
@form_method.setter
def form_method(self, method):
if method.lower() not in ('get', 'post'):
raise FormHelpersException('Only GET and POST are valid in the \
form_method helper attribute')
self._form_method = method.lower()
@property
def form_action(self):
try:
return reverse(self._form_action)
except NoReverseMatch:
return self._form_action
@form_action.setter
def form_action(self, action):
self._form_action = action
@property
def form_style(self):
if self._form_style == "default":
return ''
if self._form_style == "inline":
return 'inlineLabels'
@form_style.setter
def form_style(self, style):
if style.lower() not in ('default', 'inline'):
raise FormHelpersException('Only default and inline are valid in the \
form_style helper attribute')
self._form_style = style.lower()
@property
def help_text_inline(self):
return self._help_text_inline
@help_text_inline.setter
def help_text_inline(self, flag):
self._help_text_inline = flag
self._error_text_inline = not flag
@property
def error_text_inline(self):
return self._error_text_inline
@error_text_inline.setter
def error_text_inline(self, flag):
self._error_text_inline = flag
self._help_text_inline = not flag
def add_input(self, input_object):
self.inputs.append(input_object)
def add_layout(self, layout):
self.layout = layout
def render_layout(self, form, context, template_pack=TEMPLATE_PACK):
"""
Returns safe html of the rendering of the layout
"""
form.rendered_fields = set()
form.crispy_field_template = self.field_template
# This renders the specified Layout strictly
html = self.layout.render(
form,
self.form_style,
context,
template_pack=template_pack
)
# Rendering some extra fields if specified
if self.render_unmentioned_fields or self.render_hidden_fields or self.render_required_fields:
fields = set(form.fields.keys())
left_fields_to_render = fields - form.rendered_fields
for field in left_fields_to_render:
if (
self.render_unmentioned_fields or
self.render_hidden_fields and form.fields[field].widget.is_hidden or
self.render_required_fields and form.fields[field].widget.is_required
):
html += render_field(
field,
form,
self.form_style,
context,
template_pack=template_pack
)
# If the user has Meta.fields defined, not included in the layout,
# we suppose they need to be rendered
if hasattr(form, 'Meta'):
if hasattr(form.Meta, 'fields'):
current_fields = set(getattr(form, 'fields', []))
meta_fields = set(getattr(form.Meta, 'fields'))
fields_to_render = current_fields & meta_fields
left_fields_to_render = fields_to_render - form.rendered_fields
for field in left_fields_to_render:
html += render_field(field, form, self.form_style, context)
return mark_safe(html)
def get_attributes(self, template_pack=TEMPLATE_PACK):
"""
Used by crispy_forms_tags to get helper attributes
"""
items = {
'form_method': self.form_method.strip(),
'form_tag': self.form_tag,
'form_style': self.form_style.strip(),
'form_show_errors': self.form_show_errors,
'help_text_inline': self.help_text_inline,
'error_text_inline': self.error_text_inline,
'html5_required': self.html5_required,
'form_show_labels': self.form_show_labels,
'disable_csrf': self.disable_csrf,
'label_class': self.label_class,
'field_class': self.field_class
}
# col-[lg|md|sm|xs]-<number>
label_size_match = re.search('(\d+)', self.label_class)
device_type_match = re.search('(lg|md|sm|xs)', self.label_class)
if label_size_match and device_type_match:
try:
items['label_size'] = int(label_size_match.groups()[0])
items['bootstrap_device_type'] = device_type_match.groups()[0]
except:
pass
items['attrs'] = {}
if self.attrs:
items['attrs'] = self.attrs.copy()
if self.form_action:
items['attrs']['action'] = self.form_action.strip()
if self.form_id:
items['attrs']['id'] = self.form_id.strip()
if self.form_class:
# uni_form TEMPLATE PACK has a uniForm class by default
if template_pack == 'uni_form':
items['attrs']['class'] = "uniForm %s" % self.form_class.strip()
else:
items['attrs']['class'] = self.form_class.strip()
else:
if template_pack == 'uni_form':
items['attrs']['class'] = self.attrs.get('class', '') + " uniForm"
items['flat_attrs'] = flatatt(items['attrs'])
if self.inputs:
items['inputs'] = self.inputs
if self.form_error_title:
items['form_error_title'] = self.form_error_title.strip()
if self.formset_error_title:
items['formset_error_title'] = self.formset_error_title.strip()
for attribute_name, value in self.__dict__.items():
if attribute_name not in items and attribute_name not in ['layout', 'inputs'] and not attribute_name.startswith('_'):
items[attribute_name] = value
return items
| mit | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
295,
199,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
12,
32036,
199,
504,
1639,
14,
1208,
14,
28389,
492,
2216,
63,
3489,
199,
199,
504,
286,
5719,
647,
63,
3351,
14,
15390,
492,
1059,
63,
1313,
199,
504,
286,
5719,
647,
63,
3351,
14,
4209,
492,
25604,
199,
504,
286,
5719,
647,
63,
3351,
14,
4209,
63,
5224,
492,
25604,
14034,
199,
504,
286,
5719,
647,
63,
3351,
14,
1208,
492,
3795,
63,
698,
12,
6829,
6796,
12,
24877,
63,
6961,
199,
504,
286,
5719,
647,
63,
3351,
14,
3924,
492,
8204,
4433,
83,
1726,
421,
199,
533,
21907,
4798,
2461,
8,
785,
304,
272,
347,
485,
1074,
63,
4209,
8,
277,
304,
267,
340,
291,
14,
4209,
365,
488,
26,
288,
746,
8204,
4433,
83,
1726,
480,
5556,
1929,
370,
663,
282,
7054,
315,
2195,
8204,
4433,
531,
339,
347,
485,
1074,
63,
4209,
63,
460,
63,
964,
8,
277,
304,
267,
291,
423,
1074,
63,
4209,
342,
267,
340,
291,
14,
964,
365,
488,
26,
288,
746,
8204,
4433,
83,
1726,
480,
5556,
1929,
370,
986,
282,
1824,
1256,
370,
2195,
8204,
4433,
531,
339,
347,
1006,
8,
277,
304,
267,
408,
267,
1803,
1006,
7054,
2251,
402,
1642,
2166,
402,
5818,
267,
408,
267,
291,
423,
1074,
63,
4209,
342,
267,
372,
25604,
14034,
8,
277,
14,
4209,
12,
6014,
8,
16,
12,
822,
8,
277,
14,
4209,
14,
955,
395,
413,
430,
339,
347,
2457,
8,
277,
12,
627,
4798,
15711,
12,
1011,
958,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
7054,
2251,
402,
730,
658,
4798,
2543,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
342,
267,
1390,
63,
1896,
275,
2074,
14,
1935,
360,
988,
63,
1896,
297,
378,
9,
267,
486,
24737,
275,
2074,
14,
1935,
360,
71,
24737,
297,
756,
9,
267,
9806,
63,
4209,
63,
1462,
275,
291,
14,
4209,
14,
362,
63,
4209,
63,
1462,
8,
4798,
15711,
12,
1390,
63,
1896,
29,
988,
63,
1896,
12,
486,
24737,
29,
71,
24737,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
4209,
63,
1462,
9,
339,
347,
2457,
63,
991,
63,
3440,
8,
277,
12,
3938,
63,
466,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
1504,
543,
11114,
402,
658,
3440,
63,
466,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
63,
460,
63,
964,
342,
267,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
398,
327,
12230,
1159,
2457,
1006,
1504,
543,
11114,
2839,
3938,
63,
466,
267,
9806,
63,
955,
275,
942,
267,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
288,
340,
1228,
8,
277,
14,
964,
14,
955,
59,
3929,
59,
17,
20230,
3440,
12,
3938,
63,
466,
304,
355,
9806,
63,
955,
14,
740,
8,
3929,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
955,
9,
339,
347,
5760,
63,
991,
63,
3440,
8,
277,
12,
3938,
63,
466,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
1504,
543,
11114,
2845,
4877,
658,
3440,
63,
466,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
63,
460,
63,
964,
342,
267,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
398,
327,
12230,
1159,
5760,
1006,
1504,
543,
11114,
2839,
3938,
63,
466,
267,
9806,
63,
955,
275,
942,
267,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
288,
340,
440,
1228,
8,
277,
14,
964,
14,
955,
59,
3929,
59,
17,
20230,
3440,
12,
3938,
63,
466,
304,
355,
9806,
63,
955,
14,
740,
8,
3929,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
955,
9,
339,
347,
636,
6095,
721,
277,
12,
790,
304,
267,
408,
267,
1432,
282,
25604,
14034,
626,
7704,
4493,
12787,
314,
1453,
1256,
402,
314,
7054,
267,
436,
440,
282,
1331,
14,
267,
408,
267,
327,
1380,
790,
365,
282,
1059,
3035,
314,
901,
536,
267,
340,
1228,
8,
498,
12,
1059,
63,
1313,
304,
288,
327,
5634,
7009,
2879,
8204,
4433,
3004,
1808,
2600,
942,
4182,
288,
327,
961,
4293,
506,
282,
5922,
459,
964,
63,
344,
418,
2879,
12,
440,
10023,
367,
282,
901,
288,
340,
2688,
8,
277,
12,
790,
304,
355,
372,
2519,
8,
277,
12,
790,
9,
953,
291,
423,
1074,
63,
4209,
342,
288,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
953,
9806,
63,
698,
275,
942,
288,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
355,
327,
6006,
883,
506,
376,
2701,
7849,
355,
340,
822,
8,
3929,
9,
508,
499,
436,
7849,
59,
17,
61,
508,
790,
26,
490,
9806,
63,
698,
14,
740,
8,
3929,
9,
953,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
698,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
790,
9,
339,
347,
636,
8617,
721,
277,
12,
790,
12,
574,
304,
267,
291,
14,
4209,
59,
498,
61,
275,
574,
339,
347,
636,
13228,
721,
277,
12,
790,
304,
267,
2150,
291,
14,
4209,
14,
955,
59,
498,
61,
339,
347,
636,
552,
721,
277,
304,
267,
340,
291,
14,
4209,
365,
440,
488,
26,
288,
372,
822,
8,
277,
14,
4209,
14,
955,
9,
267,
587,
26,
288,
372,
378,
421,
199,
533,
8204,
4433,
8,
14451,
4798,
2461,
304,
272,
408,
272,
961,
1021,
13467,
314,
1824,
14066,
5953,
402,
314,
1824,
3032,
370,
272,
314,
658,
3996,
286,
5719,
647,
3674,
64,
1947,
14,
2104,
9689,
880,
1265,
911,
1929,
370,
663,
2399,
3004,
272,
436,
986,
314,
5226,
5922,
909,
370,
314,
1947,
447,
398,
7749,
286,
5719,
647,
1824,
1824,
14,
3676,
3674,
339,
12230,
1159,
1937,
4052,
3004,
1265,
883,
663,
436,
4052,
1824,
5112,
1384,
2985,
4838,
370,
26,
398,
1011,
964,
63,
765,
26742,
11015,
1824,
1083,
2225,
14,
288,
2047,
883,
1937,
652,
370,
283,
4030,
7,
503,
283,
2970,
1370,
7827,
370,
283,
4030,
7,
398,
1011,
964,
63,
1287,
26742,
4693,
1857
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
295,
199,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
12,
32036,
199,
504,
1639,
14,
1208,
14,
28389,
492,
2216,
63,
3489,
199,
199,
504,
286,
5719,
647,
63,
3351,
14,
15390,
492,
1059,
63,
1313,
199,
504,
286,
5719,
647,
63,
3351,
14,
4209,
492,
25604,
199,
504,
286,
5719,
647,
63,
3351,
14,
4209,
63,
5224,
492,
25604,
14034,
199,
504,
286,
5719,
647,
63,
3351,
14,
1208,
492,
3795,
63,
698,
12,
6829,
6796,
12,
24877,
63,
6961,
199,
504,
286,
5719,
647,
63,
3351,
14,
3924,
492,
8204,
4433,
83,
1726,
421,
199,
533,
21907,
4798,
2461,
8,
785,
304,
272,
347,
485,
1074,
63,
4209,
8,
277,
304,
267,
340,
291,
14,
4209,
365,
488,
26,
288,
746,
8204,
4433,
83,
1726,
480,
5556,
1929,
370,
663,
282,
7054,
315,
2195,
8204,
4433,
531,
339,
347,
485,
1074,
63,
4209,
63,
460,
63,
964,
8,
277,
304,
267,
291,
423,
1074,
63,
4209,
342,
267,
340,
291,
14,
964,
365,
488,
26,
288,
746,
8204,
4433,
83,
1726,
480,
5556,
1929,
370,
986,
282,
1824,
1256,
370,
2195,
8204,
4433,
531,
339,
347,
1006,
8,
277,
304,
267,
408,
267,
1803,
1006,
7054,
2251,
402,
1642,
2166,
402,
5818,
267,
408,
267,
291,
423,
1074,
63,
4209,
342,
267,
372,
25604,
14034,
8,
277,
14,
4209,
12,
6014,
8,
16,
12,
822,
8,
277,
14,
4209,
14,
955,
395,
413,
430,
339,
347,
2457,
8,
277,
12,
627,
4798,
15711,
12,
1011,
958,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
7054,
2251,
402,
730,
658,
4798,
2543,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
342,
267,
1390,
63,
1896,
275,
2074,
14,
1935,
360,
988,
63,
1896,
297,
378,
9,
267,
486,
24737,
275,
2074,
14,
1935,
360,
71,
24737,
297,
756,
9,
267,
9806,
63,
4209,
63,
1462,
275,
291,
14,
4209,
14,
362,
63,
4209,
63,
1462,
8,
4798,
15711,
12,
1390,
63,
1896,
29,
988,
63,
1896,
12,
486,
24737,
29,
71,
24737,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
4209,
63,
1462,
9,
339,
347,
2457,
63,
991,
63,
3440,
8,
277,
12,
3938,
63,
466,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
1504,
543,
11114,
402,
658,
3440,
63,
466,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
63,
460,
63,
964,
342,
267,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
398,
327,
12230,
1159,
2457,
1006,
1504,
543,
11114,
2839,
3938,
63,
466,
267,
9806,
63,
955,
275,
942,
267,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
288,
340,
1228,
8,
277,
14,
964,
14,
955,
59,
3929,
59,
17,
20230,
3440,
12,
3938,
63,
466,
304,
355,
9806,
63,
955,
14,
740,
8,
3929,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
955,
9,
339,
347,
5760,
63,
991,
63,
3440,
8,
277,
12,
3938,
63,
466,
304,
267,
408,
267,
1803,
282,
25604,
14034,
20686,
370,
1504,
543,
11114,
2845,
4877,
658,
3440,
63,
466,
64,
267,
408,
267,
291,
423,
1074,
63,
4209,
63,
460,
63,
964,
342,
267,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
398,
327,
12230,
1159,
5760,
1006,
1504,
543,
11114,
2839,
3938,
63,
466,
267,
9806,
63,
955,
275,
942,
267,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
288,
340,
440,
1228,
8,
277,
14,
964,
14,
955,
59,
3929,
59,
17,
20230,
3440,
12,
3938,
63,
466,
304,
355,
9806,
63,
955,
14,
740,
8,
3929,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
955,
9,
339,
347,
636,
6095,
721,
277,
12,
790,
304,
267,
408,
267,
1432,
282,
25604,
14034,
626,
7704,
4493,
12787,
314,
1453,
1256,
402,
314,
7054,
267,
436,
440,
282,
1331,
14,
267,
408,
267,
327,
1380,
790,
365,
282,
1059,
3035,
314,
901,
536,
267,
340,
1228,
8,
498,
12,
1059,
63,
1313,
304,
288,
327,
5634,
7009,
2879,
8204,
4433,
3004,
1808,
2600,
942,
4182,
288,
327,
961,
4293,
506,
282,
5922,
459,
964,
63,
344,
418,
2879,
12,
440,
10023,
367,
282,
901,
288,
340,
2688,
8,
277,
12,
790,
304,
355,
372,
2519,
8,
277,
12,
790,
9,
953,
291,
423,
1074,
63,
4209,
342,
288,
7054,
63,
698,
63,
1247,
275,
291,
14,
4209,
14,
362,
63,
698,
63,
1247,
342,
953,
9806,
63,
698,
275,
942,
288,
367,
7849,
315,
7054,
63,
698,
63,
1247,
26,
355,
327,
6006,
883,
506,
376,
2701,
7849,
355,
340,
822,
8,
3929,
9,
508,
499,
436,
7849,
59,
17,
61,
508,
790,
26,
490,
9806,
63,
698,
14,
740,
8,
3929,
9,
953,
372,
25604,
14034,
8,
277,
14,
4209,
12,
9806,
63,
698,
9,
398,
372,
25604,
14034,
8,
277,
14,
4209,
12,
790,
9,
339,
347,
636,
8617,
721,
277,
12,
790,
12,
574,
304,
267,
291,
14,
4209,
59,
498,
61,
275,
574,
339,
347,
636,
13228,
721,
277,
12,
790,
304,
267,
2150,
291,
14,
4209,
14,
955,
59,
498,
61,
339,
347,
636,
552,
721,
277,
304,
267,
340,
291,
14,
4209,
365,
440,
488,
26,
288,
372,
822,
8,
277,
14,
4209,
14,
955,
9,
267,
587,
26,
288,
372,
378,
421,
199,
533,
8204,
4433,
8,
14451,
4798,
2461,
304,
272,
408,
272,
961,
1021,
13467,
314,
1824,
14066,
5953,
402,
314,
1824,
3032,
370,
272,
314,
658,
3996,
286,
5719,
647,
3674,
64,
1947,
14,
2104,
9689,
880,
1265,
911,
1929,
370,
663,
2399,
3004,
272,
436,
986,
314,
5226,
5922,
909,
370,
314,
1947,
447,
398,
7749,
286,
5719,
647,
1824,
1824,
14,
3676,
3674,
339,
12230,
1159,
1937,
4052,
3004,
1265,
883,
663,
436,
4052,
1824,
5112,
1384,
2985,
4838,
370,
26,
398,
1011,
964,
63,
765,
26742,
11015,
1824,
1083,
2225,
14,
288,
2047,
883,
1937,
652,
370,
283,
4030,
7,
503,
283,
2970,
1370,
7827,
370,
283,
4030,
7,
398,
1011,
964,
63,
1287,
26742,
4693,
1857,
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,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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
] |
OWASP/django-DefectDojo | dojo/tools/appspider/parser.py | 2 | 3838 |
from datetime import datetime
from xml.dom import NamespaceErr
from defusedxml import ElementTree
from dojo.models import Endpoint, Finding
import html2text
import urllib.parse
__author__ = "Jay Paz"
class AppSpiderXMLParser(object):
def __init__(self, filename, test):
if "VulnerabilitiesSummary.xml" not in str(filename):
raise NamespaceErr('Please ensure that you are uploading AppSpider\'s VulnerabilitiesSummary.xml file.'
'At this time it is the only file that is consumable by DefectDojo.')
vscan = ElementTree.parse(filename)
root = vscan.getroot()
if "VulnSummary" not in str(root.tag):
raise NamespaceErr('Please ensure that you are uploading AppSpider\'s VulnerabilitiesSummary.xml file.'
'At this time it is the only file that is consumable by DefectDojo.')
dupes = dict()
for finding in root.iter('Vuln'):
severity = finding.find("AttackScore").text
if severity == "0-Safe":
severity = "Info"
elif severity == "1-Informational":
severity = "Low"
elif severity == "2-Low":
severity = "Medium"
elif severity == "3-Medium":
severity = "High"
elif severity == "4-High":
severity = "Critical"
else:
severity = "Info"
title = finding.find("VulnType").text
description = finding.find("Description").text
mitigation = finding.find("Recommendation").text
vuln_url = finding.find("VulnUrl").text
parts = urllib.parse.urlparse(vuln_url)
cwe = int(finding.find("CweId").text)
dupe_key = severity + title
unsaved_endpoints = list()
unsaved_req_resp = list()
if title is None:
title = ''
if description is None:
description = ''
if mitigation is None:
mitigation = ''
if dupe_key in dupes:
find = dupes[dupe_key]
unsaved_endpoints.append(find.unsaved_endpoints)
unsaved_req_resp.append(find.unsaved_req_resp)
else:
find = Finding(title=title,
test=test,
active=False,
verified=False,
description=html2text.html2text(description),
severity=severity,
numerical_severity=Finding.get_numerical_severity(severity),
mitigation=html2text.html2text(mitigation),
impact="N/A",
references=None,
cwe=cwe)
find.unsaved_endpoints = unsaved_endpoints
find.unsaved_req_resp = unsaved_req_resp
dupes[dupe_key] = find
for attack in finding.iter("AttackRequest"):
req = attack.find("Request").text
resp = attack.find("Response").text
find.unsaved_req_resp.append({"req": req, "resp": resp})
find.unsaved_endpoints.append(Endpoint(protocol=parts.scheme,
host=parts.netloc,
path=parts.path,
query=parts.query,
fragment=parts.fragment,
product=test.engagement.product))
self.items = list(dupes.values())
| bsd-3-clause | [
199,
199,
504,
2197,
492,
2197,
199,
504,
2748,
14,
4556,
492,
19317,
5432,
199,
199,
504,
347,
2972,
1652,
492,
13139,
199,
199,
504,
886,
743,
14,
992,
492,
9599,
1403,
12,
6668,
316,
199,
646,
3517,
18,
505,
199,
646,
4011,
14,
1122,
199,
199,
363,
2502,
363,
275,
298,
42,
1187,
510,
4651,
2,
421,
199,
533,
4693,
25157,
4317,
2842,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1788,
12,
511,
304,
398,
340,
298,
54,
21406,
5807,
10407,
14,
1652,
2,
440,
315,
620,
8,
1501,
304,
288,
746,
19317,
5432,
360,
8254,
4868,
626,
1265,
787,
24349,
4693,
25157,
3985,
83,
812,
21406,
5807,
10407,
14,
1652,
570,
3530,
3044,
283,
1271,
642,
900,
652,
365,
314,
1454,
570,
626,
365,
406,
1838,
461,
701,
11391,
449,
2585,
743,
2659,
398,
373,
6282,
275,
13139,
14,
1122,
8,
1501,
9,
267,
1738,
275,
373,
6282,
14,
24544,
342,
398,
340,
298,
54,
348,
78,
10407,
2,
440,
315,
620,
8,
1231,
14,
1450,
304,
288,
746,
19317,
5432,
360,
8254,
4868,
626,
1265,
787,
24349,
4693,
25157,
3985,
83,
812,
21406,
5807,
10407,
14,
1652,
570,
3530,
3044,
283,
1271,
642,
900,
652,
365,
314,
1454,
570,
626,
365,
406,
1838,
461,
701,
11391,
449,
2585,
743,
2659,
398,
15776,
22020,
275,
1211,
342,
398,
367,
17196,
315,
1738,
14,
1661,
360,
54,
348,
78,
735,
953,
25574,
275,
17196,
14,
1623,
480,
1271,
13058,
12642,
3471,
505,
288,
340,
25574,
508,
298,
16,
13,
11090,
582,
355,
25574,
275,
298,
2354,
2,
288,
916,
25574,
508,
298,
17,
13,
4935,
279,
582,
355,
25574,
275,
298,
10281,
2,
288,
916,
25574,
508,
298,
18,
13,
10281,
582,
355,
25574,
275,
298,
26139,
2,
288,
916,
25574,
508,
298,
19,
13,
26139,
582,
355,
25574,
275,
298,
11688,
2,
288,
916,
25574,
508,
298,
20,
13,
11688,
582,
355,
25574,
275,
298,
27677,
2,
288,
587,
26,
355,
25574,
275,
298,
2354,
2,
953,
2538,
275,
17196,
14,
1623,
480,
54,
348,
78,
804,
3471,
505,
288,
1369,
275,
17196,
14,
1623,
480,
5831,
3471,
505,
288,
333,
5277,
5360,
275,
17196,
14,
1623,
480,
497,
22105,
3471,
505,
288,
373,
348,
78,
63,
633,
275,
17196,
14,
1623,
480,
54,
348,
78,
6417,
3471,
505,
953,
4184,
275,
4011,
14,
1122,
14,
10290,
8,
86,
348,
78,
63,
633,
9,
953,
286,
1129,
275,
1109,
8,
1623,
316,
14,
1623,
480,
35,
1129,
1304,
3471,
505,
9,
953,
15776,
321,
63,
498,
275,
25574,
435,
2538,
288,
625,
8420,
63,
14461,
275,
769,
342,
288,
625,
8420,
63,
2103,
63,
4518,
275,
769,
342,
953,
340,
2538,
365,
488,
26,
355,
2538,
275,
2125,
288,
340,
1369,
365,
488,
26,
355,
1369,
275,
2125,
288,
340,
333,
5277,
5360,
365,
488,
26,
355,
333,
5277,
5360,
275,
2125,
953,
340,
15776,
321,
63,
498,
315,
15776,
22020,
26,
355,
2342,
275,
15776,
22020,
59,
30706,
63,
498,
61,
2234,
625,
8420,
63,
14461,
14,
740,
8,
1623,
14,
324,
8420,
63,
14461,
9,
355,
625,
8420,
63,
2103,
63,
4518,
14,
740,
8,
1623,
14,
324,
8420,
63,
2103,
63,
4518,
9,
953,
587,
26,
355,
2342,
275,
6668,
316,
8,
1213,
29,
1213,
12,
3044,
511,
29,
396,
12,
3044,
4702,
29,
797,
12,
3044,
16317,
29,
797,
12,
3044,
1369,
29,
1360,
18,
505,
14,
1360,
18,
505,
8,
1802,
395,
3044,
25574,
29,
20394,
12,
3044,
15470,
63,
20394,
29,
6591,
316,
14,
362,
63,
10563,
8825,
63,
20394,
8,
20394,
395,
3044,
333,
5277,
5360,
29,
1360,
18,
505,
14,
1360,
18,
505,
8,
2664,
280,
5360,
395,
3044,
25568,
628,
46,
15,
33,
401,
3044,
6941,
29,
403,
12,
3044,
286,
1129,
29,
67,
1129,
9,
355,
2342,
14,
324,
8420,
63,
14461,
275,
625,
8420,
63,
14461,
355,
2342,
14,
324,
8420,
63,
2103,
63,
4518,
275,
625,
8420,
63,
2103,
63,
4518,
355,
15776,
22020,
59,
30706,
63,
498,
61,
275,
2342,
2234,
367,
23326,
315,
17196,
14,
1661,
480,
1271,
13058,
2017,
2349,
490,
2648,
275,
23326,
14,
1623,
480,
2017,
3471,
505,
490,
3085,
275,
23326,
14,
1623,
480,
2364,
3471,
505,
4951,
2342,
14,
324,
8420,
63,
2103,
63,
4518,
14,
740,
6333,
2103,
582,
2648,
12,
298,
4518,
582,
3085,
1552,
2234,
2342,
14,
324,
8420,
63,
14461,
14,
740,
8,
11442,
8,
3922,
29,
4181,
14,
5512,
12,
10940,
1591,
29,
4181,
14,
12652,
12,
10940,
931,
29,
4181,
14,
515,
12,
10940,
1827,
29,
4181,
14,
1131,
12,
10940,
7956,
29,
4181,
14,
7677,
12,
10940,
3336,
29,
396,
14,
7420,
4103,
14,
2558,
430,
398,
291,
14,
1744,
275,
769,
8,
2033,
22020,
14,
1459,
1012,
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
] | [
199,
504,
2197,
492,
2197,
199,
504,
2748,
14,
4556,
492,
19317,
5432,
199,
199,
504,
347,
2972,
1652,
492,
13139,
199,
199,
504,
886,
743,
14,
992,
492,
9599,
1403,
12,
6668,
316,
199,
646,
3517,
18,
505,
199,
646,
4011,
14,
1122,
199,
199,
363,
2502,
363,
275,
298,
42,
1187,
510,
4651,
2,
421,
199,
533,
4693,
25157,
4317,
2842,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1788,
12,
511,
304,
398,
340,
298,
54,
21406,
5807,
10407,
14,
1652,
2,
440,
315,
620,
8,
1501,
304,
288,
746,
19317,
5432,
360,
8254,
4868,
626,
1265,
787,
24349,
4693,
25157,
3985,
83,
812,
21406,
5807,
10407,
14,
1652,
570,
3530,
3044,
283,
1271,
642,
900,
652,
365,
314,
1454,
570,
626,
365,
406,
1838,
461,
701,
11391,
449,
2585,
743,
2659,
398,
373,
6282,
275,
13139,
14,
1122,
8,
1501,
9,
267,
1738,
275,
373,
6282,
14,
24544,
342,
398,
340,
298,
54,
348,
78,
10407,
2,
440,
315,
620,
8,
1231,
14,
1450,
304,
288,
746,
19317,
5432,
360,
8254,
4868,
626,
1265,
787,
24349,
4693,
25157,
3985,
83,
812,
21406,
5807,
10407,
14,
1652,
570,
3530,
3044,
283,
1271,
642,
900,
652,
365,
314,
1454,
570,
626,
365,
406,
1838,
461,
701,
11391,
449,
2585,
743,
2659,
398,
15776,
22020,
275,
1211,
342,
398,
367,
17196,
315,
1738,
14,
1661,
360,
54,
348,
78,
735,
953,
25574,
275,
17196,
14,
1623,
480,
1271,
13058,
12642,
3471,
505,
288,
340,
25574,
508,
298,
16,
13,
11090,
582,
355,
25574,
275,
298,
2354,
2,
288,
916,
25574,
508,
298,
17,
13,
4935,
279,
582,
355,
25574,
275,
298,
10281,
2,
288,
916,
25574,
508,
298,
18,
13,
10281,
582,
355,
25574,
275,
298,
26139,
2,
288,
916,
25574,
508,
298,
19,
13,
26139,
582,
355,
25574,
275,
298,
11688,
2,
288,
916,
25574,
508,
298,
20,
13,
11688,
582,
355,
25574,
275,
298,
27677,
2,
288,
587,
26,
355,
25574,
275,
298,
2354,
2,
953,
2538,
275,
17196,
14,
1623,
480,
54,
348,
78,
804,
3471,
505,
288,
1369,
275,
17196,
14,
1623,
480,
5831,
3471,
505,
288,
333,
5277,
5360,
275,
17196,
14,
1623,
480,
497,
22105,
3471,
505,
288,
373,
348,
78,
63,
633,
275,
17196,
14,
1623,
480,
54,
348,
78,
6417,
3471,
505,
953,
4184,
275,
4011,
14,
1122,
14,
10290,
8,
86,
348,
78,
63,
633,
9,
953,
286,
1129,
275,
1109,
8,
1623,
316,
14,
1623,
480,
35,
1129,
1304,
3471,
505,
9,
953,
15776,
321,
63,
498,
275,
25574,
435,
2538,
288,
625,
8420,
63,
14461,
275,
769,
342,
288,
625,
8420,
63,
2103,
63,
4518,
275,
769,
342,
953,
340,
2538,
365,
488,
26,
355,
2538,
275,
2125,
288,
340,
1369,
365,
488,
26,
355,
1369,
275,
2125,
288,
340,
333,
5277,
5360,
365,
488,
26,
355,
333,
5277,
5360,
275,
2125,
953,
340,
15776,
321,
63,
498,
315,
15776,
22020,
26,
355,
2342,
275,
15776,
22020,
59,
30706,
63,
498,
61,
2234,
625,
8420,
63,
14461,
14,
740,
8,
1623,
14,
324,
8420,
63,
14461,
9,
355,
625,
8420,
63,
2103,
63,
4518,
14,
740,
8,
1623,
14,
324,
8420,
63,
2103,
63,
4518,
9,
953,
587,
26,
355,
2342,
275,
6668,
316,
8,
1213,
29,
1213,
12,
3044,
511,
29,
396,
12,
3044,
4702,
29,
797,
12,
3044,
16317,
29,
797,
12,
3044,
1369,
29,
1360,
18,
505,
14,
1360,
18,
505,
8,
1802,
395,
3044,
25574,
29,
20394,
12,
3044,
15470,
63,
20394,
29,
6591,
316,
14,
362,
63,
10563,
8825,
63,
20394,
8,
20394,
395,
3044,
333,
5277,
5360,
29,
1360,
18,
505,
14,
1360,
18,
505,
8,
2664,
280,
5360,
395,
3044,
25568,
628,
46,
15,
33,
401,
3044,
6941,
29,
403,
12,
3044,
286,
1129,
29,
67,
1129,
9,
355,
2342,
14,
324,
8420,
63,
14461,
275,
625,
8420,
63,
14461,
355,
2342,
14,
324,
8420,
63,
2103,
63,
4518,
275,
625,
8420,
63,
2103,
63,
4518,
355,
15776,
22020,
59,
30706,
63,
498,
61,
275,
2342,
2234,
367,
23326,
315,
17196,
14,
1661,
480,
1271,
13058,
2017,
2349,
490,
2648,
275,
23326,
14,
1623,
480,
2017,
3471,
505,
490,
3085,
275,
23326,
14,
1623,
480,
2364,
3471,
505,
4951,
2342,
14,
324,
8420,
63,
2103,
63,
4518,
14,
740,
6333,
2103,
582,
2648,
12,
298,
4518,
582,
3085,
1552,
2234,
2342,
14,
324,
8420,
63,
14461,
14,
740,
8,
11442,
8,
3922,
29,
4181,
14,
5512,
12,
10940,
1591,
29,
4181,
14,
12652,
12,
10940,
931,
29,
4181,
14,
515,
12,
10940,
1827,
29,
4181,
14,
1131,
12,
10940,
7956,
29,
4181,
14,
7677,
12,
10940,
3336,
29,
396,
14,
7420,
4103,
14,
2558,
430,
398,
291,
14,
1744,
275,
769,
8,
2033,
22020,
14,
1459,
1012,
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,
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,
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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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
wteiken/letsencrypt | certbot/tests/account_test.py | 4 | 6573 | """Tests for certbot.account."""
import datetime
import os
import shutil
import stat
import tempfile
import unittest
import mock
import pytz
from acme import jose
from acme import messages
from certbot import errors
from certbot.tests import test_util
KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key_2.pem"))
class AccountTest(unittest.TestCase):
"""Tests for certbot.account.Account."""
def setUp(self):
from certbot.account import Account
self.regr = mock.MagicMock()
self.meta = Account.Meta(
creation_host="test.certbot.org",
creation_dt=datetime.datetime(
2015, 7, 4, 14, 4, 10, tzinfo=pytz.UTC))
self.acc = Account(self.regr, KEY, self.meta)
with mock.patch("certbot.account.socket") as mock_socket:
mock_socket.getfqdn.return_value = "test.certbot.org"
with mock.patch("certbot.account.datetime") as mock_dt:
mock_dt.datetime.now.return_value = self.meta.creation_dt
self.acc_no_meta = Account(self.regr, KEY)
def test_init(self):
self.assertEqual(self.regr, self.acc.regr)
self.assertEqual(KEY, self.acc.key)
self.assertEqual(self.meta, self.acc_no_meta.meta)
def test_id(self):
self.assertEqual(
self.acc.id, "bca5889f66457d5b62fbba7b25f9ab6f")
def test_slug(self):
self.assertEqual(
self.acc.slug, "test.certbot.org@2015-07-04T14:04:10Z (bca5)")
def test_repr(self):
self.assertEqual(
repr(self.acc),
"<Account(bca5889f66457d5b62fbba7b25f9ab6f)>")
class ReportNewAccountTest(unittest.TestCase):
"""Tests for certbot.account.report_new_account."""
def setUp(self):
self.config = mock.MagicMock(config_dir="/etc/letsencrypt")
reg = messages.Registration.from_data(email="rhino@jungle.io")
self.acc = mock.MagicMock(regr=messages.RegistrationResource(
uri=None, new_authzr_uri=None, body=reg))
def _call(self):
from certbot.account import report_new_account
report_new_account(self.acc, self.config)
@mock.patch("certbot.account.zope.component.queryUtility")
def test_no_reporter(self, mock_zope):
mock_zope.return_value = None
self._call()
@mock.patch("certbot.account.zope.component.queryUtility")
def test_it(self, mock_zope):
self._call()
call_list = mock_zope().add_message.call_args_list
self.assertTrue(self.config.config_dir in call_list[0][0][0])
self.assertTrue(
", ".join(self.acc.regr.body.emails) in call_list[1][0][0])
class AccountMemoryStorageTest(unittest.TestCase):
"""Tests for certbot.account.AccountMemoryStorage."""
def setUp(self):
from certbot.account import AccountMemoryStorage
self.storage = AccountMemoryStorage()
def test_it(self):
account = mock.Mock(id="x")
self.assertEqual([], self.storage.find_all())
self.assertRaises(errors.AccountNotFound, self.storage.load, "x")
self.storage.save(account)
self.assertEqual([account], self.storage.find_all())
self.assertEqual(account, self.storage.load("x"))
self.storage.save(account)
self.assertEqual([account], self.storage.find_all())
class AccountFileStorageTest(unittest.TestCase):
"""Tests for certbot.account.AccountFileStorage."""
def setUp(self):
self.tmp = tempfile.mkdtemp()
self.config = mock.MagicMock(
accounts_dir=os.path.join(self.tmp, "accounts"))
from certbot.account import AccountFileStorage
self.storage = AccountFileStorage(self.config)
from certbot.account import Account
self.acc = Account(
regr=messages.RegistrationResource(
uri=None, new_authzr_uri=None, body=messages.Registration()),
key=KEY)
def tearDown(self):
shutil.rmtree(self.tmp)
def test_init_creates_dir(self):
self.assertTrue(os.path.isdir(self.config.accounts_dir))
def test_save_and_restore(self):
self.storage.save(self.acc)
account_path = os.path.join(self.config.accounts_dir, self.acc.id)
self.assertTrue(os.path.exists(account_path))
for file_name in "regr.json", "meta.json", "private_key.json":
self.assertTrue(os.path.exists(
os.path.join(account_path, file_name)))
self.assertEqual("0400", oct(os.stat(os.path.join(
account_path, "private_key.json"))[stat.ST_MODE] & 0o777))
# restore
self.assertEqual(self.acc, self.storage.load(self.acc.id))
def test_find_all(self):
self.storage.save(self.acc)
self.assertEqual([self.acc], self.storage.find_all())
def test_find_all_none_empty_list(self):
self.assertEqual([], self.storage.find_all())
def test_find_all_accounts_dir_absent(self):
os.rmdir(self.config.accounts_dir)
self.assertEqual([], self.storage.find_all())
def test_find_all_load_skips(self):
self.storage.load = mock.MagicMock(
side_effect=["x", errors.AccountStorageError, "z"])
with mock.patch("certbot.account.os.listdir") as mock_listdir:
mock_listdir.return_value = ["x", "y", "z"]
self.assertEqual(["x", "z"], self.storage.find_all())
def test_load_non_existent_raises_error(self):
self.assertRaises(errors.AccountNotFound, self.storage.load, "missing")
def test_load_id_mismatch_raises_error(self):
self.storage.save(self.acc)
shutil.move(os.path.join(self.config.accounts_dir, self.acc.id),
os.path.join(self.config.accounts_dir, "x" + self.acc.id))
self.assertRaises(errors.AccountStorageError, self.storage.load,
"x" + self.acc.id)
def test_load_ioerror(self):
self.storage.save(self.acc)
mock_open = mock.mock_open()
mock_open.side_effect = IOError
with mock.patch("__builtin__.open", mock_open):
self.assertRaises(
errors.AccountStorageError, self.storage.load, self.acc.id)
def test_save_ioerrors(self):
mock_open = mock.mock_open()
mock_open.side_effect = IOError # TODO: [None, None, IOError]
with mock.patch("__builtin__.open", mock_open):
self.assertRaises(
errors.AccountStorageError, self.storage.save, self.acc)
if __name__ == "__main__":
unittest.main() # pragma: no cover
| apache-2.0 | [
624,
2925,
367,
6250,
3018,
14,
2048,
1041,
199,
646,
2197,
199,
646,
747,
199,
646,
5145,
199,
646,
5672,
199,
646,
5549,
199,
646,
2882,
199,
199,
646,
1683,
199,
646,
15444,
199,
199,
504,
32433,
492,
5225,
261,
199,
504,
32433,
492,
3788,
199,
199,
504,
6250,
3018,
492,
2552,
199,
199,
504,
6250,
3018,
14,
2219,
492,
511,
63,
1974,
421,
199,
3078,
275,
5225,
261,
14,
42,
31005,
12115,
14,
912,
8,
396,
63,
1974,
14,
912,
63,
4106,
480,
13487,
7736,
63,
498,
63,
18,
14,
13102,
2237,
421,
199,
533,
9973,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
1041,
339,
347,
3613,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
9973,
267,
291,
14,
1135,
82,
275,
1683,
14,
11988,
342,
267,
291,
14,
2024,
275,
9973,
14,
3396,
8,
288,
7143,
63,
1102,
628,
396,
14,
4736,
3018,
14,
1308,
401,
288,
7143,
63,
3583,
29,
2083,
14,
2083,
8,
355,
6900,
12,
1520,
12,
841,
12,
4329,
12,
841,
12,
1616,
12,
10313,
29,
21948,
14,
11288,
430,
267,
291,
14,
5470,
275,
9973,
8,
277,
14,
1135,
82,
12,
9301,
12,
291,
14,
2024,
9,
398,
543,
1683,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
3450,
531,
465,
1683,
63,
3450,
26,
288,
1683,
63,
3450,
14,
362,
18364,
14,
1107,
63,
585,
275,
298,
396,
14,
4736,
3018,
14,
1308,
2,
288,
543,
1683,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
2083,
531,
465,
1683,
63,
3583,
26,
355,
1683,
63,
3583,
14,
2083,
14,
2131,
14,
1107,
63,
585,
275,
291,
14,
2024,
14,
8782,
63,
3583,
355,
291,
14,
5470,
63,
889,
63,
2024,
275,
9973,
8,
277,
14,
1135,
82,
12,
9301,
9,
339,
347,
511,
63,
826,
8,
277,
304,
267,
291,
14,
629,
8,
277,
14,
1135,
82,
12,
291,
14,
5470,
14,
1135,
82,
9,
267,
291,
14,
629,
8,
3078,
12,
291,
14,
5470,
14,
498,
9,
267,
291,
14,
629,
8,
277,
14,
2024,
12,
291,
14,
5470,
63,
889,
63,
2024,
14,
2024,
9,
339,
347,
511,
63,
344,
8,
277,
304,
267,
291,
14,
629,
8,
288,
291,
14,
5470,
14,
344,
12,
298,
66,
696,
21,
13976,
70,
28169,
1641,
68,
21,
66,
2789,
4675,
2470,
23,
66,
821,
70,
25,
371,
22,
70,
531,
339,
347,
511,
63,
5464,
8,
277,
304,
267,
291,
14,
629,
8,
288,
291,
14,
5470,
14,
5464,
12,
298,
396,
14,
4736,
3018,
14,
1308,
32,
7806,
13,
1780,
13,
966,
52,
1079,
26,
966,
26,
709,
58,
334,
66,
696,
21,
6320,
339,
347,
511,
63,
2722,
8,
277,
304,
267,
291,
14,
629,
8,
288,
4700,
8,
277,
14,
5470,
395,
288,
3886,
6009,
8,
66,
696,
21,
13976,
70,
28169,
1641,
68,
21,
66,
2789,
4675,
2470,
23,
66,
821,
70,
25,
371,
22,
70,
9,
9579,
421,
199,
533,
11774,
4665,
6009,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
3070,
63,
1222,
63,
2048,
1041,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
888,
275,
1683,
14,
11988,
8,
888,
63,
694,
9555,
6839,
15,
2723,
31561,
531,
267,
1295,
275,
3788,
14,
11757,
14,
504,
63,
576,
8,
2123,
628,
17157,
10175,
32,
74,
324,
3845,
14,
2308,
531,
267,
291,
14,
5470,
275,
1683,
14,
11988,
8,
1135,
82,
29,
3431,
14,
11757,
4031,
8,
288,
5108,
29,
403,
12,
892,
63,
1178,
32605,
63,
2302,
29,
403,
12,
2396,
29,
1135,
430,
339,
347,
485,
1250,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
3622,
63,
1222,
63,
2048,
267,
3622,
63,
1222,
63,
2048,
8,
277,
14,
5470,
12,
291,
14,
888,
9,
339,
768,
1805,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
90,
13458,
14,
3173,
14,
1131,
17505,
531,
272,
347,
511,
63,
889,
63,
12222,
8,
277,
12,
1683,
63,
90,
13458,
304,
267,
1683,
63,
90,
13458,
14,
1107,
63,
585,
275,
488,
267,
291,
423,
1250,
342,
339,
768,
1805,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
90,
13458,
14,
3173,
14,
1131,
17505,
531,
272,
347,
511,
63,
390,
8,
277,
12,
1683,
63,
90,
13458,
304,
267,
291,
423,
1250,
342,
267,
1240,
63,
513,
275,
1683,
63,
90,
13458,
1252,
525,
63,
1188,
14,
1250,
63,
589,
63,
513,
267,
291,
14,
1815,
8,
277,
14,
888,
14,
888,
63,
694,
315,
1240,
63,
513,
59,
16,
1527,
16,
1527,
16,
566,
267,
291,
14,
1815,
8,
288,
3872,
3680,
904,
8,
277,
14,
5470,
14,
1135,
82,
14,
2030,
14,
14170,
9,
315,
1240,
63,
513,
59,
17,
1527,
16,
1527,
16,
566,
421,
199,
533,
9973,
8628,
6408,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
8628,
6408,
1041,
339,
347,
3613,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
9973,
8628,
6408,
267,
291,
14,
3494,
275,
9973,
8628,
6408,
342,
339,
347,
511,
63,
390,
8,
277,
304,
267,
2933,
275,
1683,
14,
3346,
8,
344,
628,
88,
531,
267,
291,
14,
629,
8798,
291,
14,
3494,
14,
1623,
63,
452,
1012,
267,
291,
14,
1855,
8,
2550,
14,
6009,
4667,
12,
291,
14,
3494,
14,
912,
12,
298,
88,
531,
267,
291,
14,
3494,
14,
2117,
8,
2048,
9,
267,
291,
14,
629,
779,
2048,
467,
291,
14,
3494,
14,
1623,
63,
452,
1012,
267,
291,
14,
629,
8,
2048,
12,
291,
14,
3494,
14,
912,
480,
88,
2237,
267,
291,
14,
3494,
14,
2117,
8,
2048,
9,
267,
291,
14,
629,
779,
2048,
467,
291,
14,
3494,
14,
1623,
63,
452,
1012,
421,
199,
533,
9973,
1173,
6408,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
1173,
6408,
1041,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
2791,
275,
5549,
14,
11983,
342,
267,
291,
14,
888,
275,
1683,
14,
11988,
8,
288,
12639,
63,
694,
29,
736,
14,
515,
14,
904,
8,
277,
14,
2791,
12,
298,
8370
] | [
2925,
367,
6250,
3018,
14,
2048,
1041,
199,
646,
2197,
199,
646,
747,
199,
646,
5145,
199,
646,
5672,
199,
646,
5549,
199,
646,
2882,
199,
199,
646,
1683,
199,
646,
15444,
199,
199,
504,
32433,
492,
5225,
261,
199,
504,
32433,
492,
3788,
199,
199,
504,
6250,
3018,
492,
2552,
199,
199,
504,
6250,
3018,
14,
2219,
492,
511,
63,
1974,
421,
199,
3078,
275,
5225,
261,
14,
42,
31005,
12115,
14,
912,
8,
396,
63,
1974,
14,
912,
63,
4106,
480,
13487,
7736,
63,
498,
63,
18,
14,
13102,
2237,
421,
199,
533,
9973,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
1041,
339,
347,
3613,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
9973,
267,
291,
14,
1135,
82,
275,
1683,
14,
11988,
342,
267,
291,
14,
2024,
275,
9973,
14,
3396,
8,
288,
7143,
63,
1102,
628,
396,
14,
4736,
3018,
14,
1308,
401,
288,
7143,
63,
3583,
29,
2083,
14,
2083,
8,
355,
6900,
12,
1520,
12,
841,
12,
4329,
12,
841,
12,
1616,
12,
10313,
29,
21948,
14,
11288,
430,
267,
291,
14,
5470,
275,
9973,
8,
277,
14,
1135,
82,
12,
9301,
12,
291,
14,
2024,
9,
398,
543,
1683,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
3450,
531,
465,
1683,
63,
3450,
26,
288,
1683,
63,
3450,
14,
362,
18364,
14,
1107,
63,
585,
275,
298,
396,
14,
4736,
3018,
14,
1308,
2,
288,
543,
1683,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
2083,
531,
465,
1683,
63,
3583,
26,
355,
1683,
63,
3583,
14,
2083,
14,
2131,
14,
1107,
63,
585,
275,
291,
14,
2024,
14,
8782,
63,
3583,
355,
291,
14,
5470,
63,
889,
63,
2024,
275,
9973,
8,
277,
14,
1135,
82,
12,
9301,
9,
339,
347,
511,
63,
826,
8,
277,
304,
267,
291,
14,
629,
8,
277,
14,
1135,
82,
12,
291,
14,
5470,
14,
1135,
82,
9,
267,
291,
14,
629,
8,
3078,
12,
291,
14,
5470,
14,
498,
9,
267,
291,
14,
629,
8,
277,
14,
2024,
12,
291,
14,
5470,
63,
889,
63,
2024,
14,
2024,
9,
339,
347,
511,
63,
344,
8,
277,
304,
267,
291,
14,
629,
8,
288,
291,
14,
5470,
14,
344,
12,
298,
66,
696,
21,
13976,
70,
28169,
1641,
68,
21,
66,
2789,
4675,
2470,
23,
66,
821,
70,
25,
371,
22,
70,
531,
339,
347,
511,
63,
5464,
8,
277,
304,
267,
291,
14,
629,
8,
288,
291,
14,
5470,
14,
5464,
12,
298,
396,
14,
4736,
3018,
14,
1308,
32,
7806,
13,
1780,
13,
966,
52,
1079,
26,
966,
26,
709,
58,
334,
66,
696,
21,
6320,
339,
347,
511,
63,
2722,
8,
277,
304,
267,
291,
14,
629,
8,
288,
4700,
8,
277,
14,
5470,
395,
288,
3886,
6009,
8,
66,
696,
21,
13976,
70,
28169,
1641,
68,
21,
66,
2789,
4675,
2470,
23,
66,
821,
70,
25,
371,
22,
70,
9,
9579,
421,
199,
533,
11774,
4665,
6009,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
3070,
63,
1222,
63,
2048,
1041,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
888,
275,
1683,
14,
11988,
8,
888,
63,
694,
9555,
6839,
15,
2723,
31561,
531,
267,
1295,
275,
3788,
14,
11757,
14,
504,
63,
576,
8,
2123,
628,
17157,
10175,
32,
74,
324,
3845,
14,
2308,
531,
267,
291,
14,
5470,
275,
1683,
14,
11988,
8,
1135,
82,
29,
3431,
14,
11757,
4031,
8,
288,
5108,
29,
403,
12,
892,
63,
1178,
32605,
63,
2302,
29,
403,
12,
2396,
29,
1135,
430,
339,
347,
485,
1250,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
3622,
63,
1222,
63,
2048,
267,
3622,
63,
1222,
63,
2048,
8,
277,
14,
5470,
12,
291,
14,
888,
9,
339,
768,
1805,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
90,
13458,
14,
3173,
14,
1131,
17505,
531,
272,
347,
511,
63,
889,
63,
12222,
8,
277,
12,
1683,
63,
90,
13458,
304,
267,
1683,
63,
90,
13458,
14,
1107,
63,
585,
275,
488,
267,
291,
423,
1250,
342,
339,
768,
1805,
14,
2068,
480,
4736,
3018,
14,
2048,
14,
90,
13458,
14,
3173,
14,
1131,
17505,
531,
272,
347,
511,
63,
390,
8,
277,
12,
1683,
63,
90,
13458,
304,
267,
291,
423,
1250,
342,
267,
1240,
63,
513,
275,
1683,
63,
90,
13458,
1252,
525,
63,
1188,
14,
1250,
63,
589,
63,
513,
267,
291,
14,
1815,
8,
277,
14,
888,
14,
888,
63,
694,
315,
1240,
63,
513,
59,
16,
1527,
16,
1527,
16,
566,
267,
291,
14,
1815,
8,
288,
3872,
3680,
904,
8,
277,
14,
5470,
14,
1135,
82,
14,
2030,
14,
14170,
9,
315,
1240,
63,
513,
59,
17,
1527,
16,
1527,
16,
566,
421,
199,
533,
9973,
8628,
6408,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
8628,
6408,
1041,
339,
347,
3613,
8,
277,
304,
267,
687,
6250,
3018,
14,
2048,
492,
9973,
8628,
6408,
267,
291,
14,
3494,
275,
9973,
8628,
6408,
342,
339,
347,
511,
63,
390,
8,
277,
304,
267,
2933,
275,
1683,
14,
3346,
8,
344,
628,
88,
531,
267,
291,
14,
629,
8798,
291,
14,
3494,
14,
1623,
63,
452,
1012,
267,
291,
14,
1855,
8,
2550,
14,
6009,
4667,
12,
291,
14,
3494,
14,
912,
12,
298,
88,
531,
267,
291,
14,
3494,
14,
2117,
8,
2048,
9,
267,
291,
14,
629,
779,
2048,
467,
291,
14,
3494,
14,
1623,
63,
452,
1012,
267,
291,
14,
629,
8,
2048,
12,
291,
14,
3494,
14,
912,
480,
88,
2237,
267,
291,
14,
3494,
14,
2117,
8,
2048,
9,
267,
291,
14,
629,
779,
2048,
467,
291,
14,
3494,
14,
1623,
63,
452,
1012,
421,
199,
533,
9973,
1173,
6408,
774,
8,
2796,
14,
1746,
304,
272,
408,
2925,
367,
6250,
3018,
14,
2048,
14,
6009,
1173,
6408,
1041,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
2791,
275,
5549,
14,
11983,
342,
267,
291,
14,
888,
275,
1683,
14,
11988,
8,
288,
12639,
63,
694,
29,
736,
14,
515,
14,
904,
8,
277,
14,
2791,
12,
298,
8370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,
1,
1
] |
ryanjoneil/docker-image-construction | ipynb/examples/example1.py | 1 | 3732 | from mosek.fusion import Model, Domain, Expr, ObjectiveSense
import sys
# Example 1. Full representation of 3-image problem with all maximal cliques.
# DICP instance:
#
# Resource consumption by command:
#
# C = {A, B, C, D}
#
# | x = A: 5 |
# r(c) = | x = B: 10 |
# | x = C: 7 |
# | x = D: 12 |
#
# Images to create:
#
# I = {1, 2, 3}
#
# | i = 1: {A, B} |
# C(i) = | i = 2: {A, B, C, D} |
# | i = 3: {B, C, D} |
r = {'A': 5.0, 'B': 10.0, 'C': 7.0, 'D': 12.0}
m = Model()
binary = (Domain.inRange(0.0, 1.0), Domain.isInteger())
# Provide a variable for each image and command. This is 1 if the command
# is not run as part of a clique for the image.
x_1_a = m.variable('x_1_a', *binary)
x_1_b = m.variable('x_1_b', *binary)
x_2_a = m.variable('x_2_a', *binary)
x_2_b = m.variable('x_2_b', *binary)
x_2_c = m.variable('x_2_c', *binary)
x_2_d = m.variable('x_2_d', *binary)
x_3_b = m.variable('x_3_b', *binary)
x_3_c = m.variable('x_3_c', *binary)
x_3_d = m.variable('x_3_d', *binary)
# Provide a variable for each maximal clique and maximal sub-clique.
x_12_ab = m.variable('x_12_ab', *binary)
x_123_b = m.variable('x_123_b', *binary)
x_123_b_12_a = m.variable('x_123_b_12_a', *binary)
x_123_b_23_cd = m.variable('x_123_b_23_cd', *binary)
# Each command must be run once for each image.
m.constraint('c_1_a', Expr.add([x_1_a, x_12_ab, x_123_b_12_a]), Domain.equalsTo(1.0))
m.constraint('c_1_b', Expr.add([x_1_b, x_12_ab, x_123_b]), Domain.equalsTo(1.0))
m.constraint('c_2_a', Expr.add([x_2_a, x_12_ab, x_123_b_12_a]), Domain.equalsTo(1.0))
m.constraint('c_2_b', Expr.add([x_2_b, x_12_ab, x_123_b]), Domain.equalsTo(1.0))
m.constraint('c_2_c', Expr.add([x_2_c, x_123_b_23_cd]), Domain.equalsTo(1.0))
m.constraint('c_2_d', Expr.add([x_2_d, x_123_b_23_cd]), Domain.equalsTo(1.0))
m.constraint('c_3_b', Expr.add([x_3_b, x_123_b]), Domain.equalsTo(1.0))
m.constraint('c_3_c', Expr.add([x_3_c, x_123_b_23_cd]), Domain.equalsTo(1.0))
m.constraint('c_3_d', Expr.add([x_3_d, x_123_b_23_cd]), Domain.equalsTo(1.0))
# Add dependency constraints for sub-cliques.
m.constraint('d_123_b_12_a', Expr.sub(x_123_b, x_123_b_12_a), Domain.greaterThan(0.0))
m.constraint('d_123_b_23_cd', Expr.sub(x_123_b, x_123_b_23_cd), Domain.greaterThan(0.0))
# Eliminated intersections between cliques.
m.constraint('e1', Expr.add([x_12_ab, x_123_b]), Domain.lessThan(1.0))
m.constraint('e2', Expr.add([x_123_b_12_a, x_123_b_23_cd]), Domain.lessThan(1.0))
# Minimize resources required to construct all images.
obj = [Expr.mul(c, x) for c, x in [
# Individual image/command pairs
(r['A'], x_1_a), (r['B'], x_1_b),
(r['A'], x_2_a), (r['B'], x_2_b), (r['C'], x_2_c), (r['D'], x_2_d),
(r['B'], x_3_b), (r['C'], x_3_c), (r['D'], x_3_d),
# Cliques
(r['A'] + r['B'], x_12_ab),
(r['B'], x_123_b),
(r['A'], x_123_b_12_a),
(r['C'] + r['D'], x_123_b_23_cd),
]]
m.objective('w', ObjectiveSense.Minimize, Expr.add(obj))
m.setLogHandler(sys.stdout)
m.solve()
print
print 'Image 1:'
print '\tx_1_a = %.0f' % x_1_a.level()[0]
print '\tx_1_b = %.0f' % x_1_b.level()[0]
print
print 'Image 2:'
print '\tx_2_a = %.0f' % x_2_a.level()[0]
print '\tx_2_b = %.0f' % x_2_b.level()[0]
print '\tx_2_c = %.0f' % x_2_c.level()[0]
print '\tx_2_d = %.0f' % x_2_d.level()[0]
print
print 'Image 3:'
print '\tx_3_b = %.0f' % x_3_b.level()[0]
print '\tx_3_c = %.0f' % x_3_c.level()[0]
print '\tx_3_d = %.0f' % x_3_d.level()[0]
print
print 'Cliques:'
print '\tx_12_ab = %.0f' % x_12_ab.level()[0]
print '\tx_123_b = %.0f' % x_123_b.level()[0]
print '\tx_123_b_12_a = %.0f' % x_123_b_12_a.level()[0]
print '\tx_123_b_23_cd = %.0f' % x_123_b_23_cd.level()[0]
print
| mit | [
504,
1303,
261,
75,
14,
70,
12444,
492,
5822,
12,
14061,
12,
14754,
12,
24921,
6850,
51,
677,
199,
646,
984,
199,
199,
3,
5679,
413,
14,
16579,
6025,
402,
650,
13,
1569,
5160,
543,
1006,
1390,
7265,
5053,
19658,
14,
199,
3,
577,
948,
48,
1256,
26,
199,
3,
199,
3,
7337,
13447,
15052,
701,
1414,
26,
199,
3,
199,
3,
258,
445,
275,
469,
33,
12,
699,
12,
445,
12,
577,
93,
199,
3,
199,
3,
3322,
1204,
671,
275,
437,
26,
221,
959,
1204,
199,
3,
258,
519,
8,
67,
9,
275,
1204,
671,
275,
699,
26,
1616,
1204,
199,
3,
3322,
1204,
671,
275,
445,
26,
221,
1520,
1204,
199,
3,
3322,
1204,
671,
275,
577,
26,
3144,
1204,
199,
3,
199,
3,
32658,
370,
1218,
26,
199,
3,
199,
3,
258,
473,
275,
469,
17,
12,
499,
12,
650,
93,
199,
3,
199,
3,
3322,
1204,
284,
275,
413,
26,
469,
33,
12,
699,
93,
755,
1204,
199,
3,
258,
445,
8,
73,
9,
275,
1204,
284,
275,
499,
26,
469,
33,
12,
699,
12,
445,
12,
577,
93,
1204,
199,
3,
3322,
1204,
284,
275,
650,
26,
469,
34,
12,
445,
12,
577,
93,
259,
1204,
199,
199,
82,
275,
791,
33,
356,
959,
14,
16,
12,
283,
34,
356,
1616,
14,
16,
12,
283,
35,
356,
1520,
14,
16,
12,
283,
36,
356,
3144,
14,
16,
93,
199,
199,
77,
275,
5822,
342,
199,
3008,
275,
334,
7705,
14,
262,
4709,
8,
16,
14,
16,
12,
413,
14,
16,
395,
14061,
14,
374,
2674,
1012,
199,
199,
3,
22896,
282,
1750,
367,
1924,
1834,
436,
1414,
14,
961,
365,
413,
340,
314,
1414,
199,
3,
365,
440,
1255,
465,
1777,
402,
282,
5053,
544,
367,
314,
1834,
14,
199,
88,
63,
17,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
17,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
17,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
17,
63,
66,
297,
627,
3008,
9,
199,
199,
88,
63,
18,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
67,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
67,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
68,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
68,
297,
627,
3008,
9,
199,
199,
88,
63,
19,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
19,
63,
67,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
67,
297,
627,
3008,
9,
199,
88,
63,
19,
63,
68,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
68,
297,
627,
3008,
9,
199,
199,
3,
22896,
282,
1750,
367,
1924,
1390,
7265,
5053,
544,
436,
1390,
7265,
1007,
13,
2764,
544,
14,
199,
88,
63,
713,
63,
371,
275,
333,
14,
1975,
360,
88,
63,
713,
63,
371,
297,
627,
3008,
9,
199,
199,
88,
63,
4288,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
4288,
63,
66,
63,
713,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
63,
713,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
4288,
63,
66,
63,
1789,
63,
2866,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
63,
1789,
63,
2866,
297,
627,
3008,
9,
199,
199,
3,
7048,
1414,
1471,
506,
1255,
5403,
367,
1924,
1834,
14,
199,
77,
14,
5631,
360,
67,
63,
17,
63,
65,
297,
14754,
14,
525,
779,
88,
63,
17,
63,
65,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
63,
713,
63,
65,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
17,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
17,
63,
66,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
65,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
65,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
63,
713,
63,
65,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
66,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
67,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
67,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
68,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
68,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
66,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
67,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
67,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
68,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
68,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
199,
3,
2654,
5936,
9565,
367,
1007,
13,
2764,
19658,
14,
199,
77,
14,
5631,
360,
68,
63,
4288,
63,
66,
63,
713,
63,
65,
297,
14754,
14,
954,
8,
88,
63,
4288,
63,
66,
12,
671,
63,
4288,
63,
66,
63,
713,
63
] | [
1303,
261,
75,
14,
70,
12444,
492,
5822,
12,
14061,
12,
14754,
12,
24921,
6850,
51,
677,
199,
646,
984,
199,
199,
3,
5679,
413,
14,
16579,
6025,
402,
650,
13,
1569,
5160,
543,
1006,
1390,
7265,
5053,
19658,
14,
199,
3,
577,
948,
48,
1256,
26,
199,
3,
199,
3,
7337,
13447,
15052,
701,
1414,
26,
199,
3,
199,
3,
258,
445,
275,
469,
33,
12,
699,
12,
445,
12,
577,
93,
199,
3,
199,
3,
3322,
1204,
671,
275,
437,
26,
221,
959,
1204,
199,
3,
258,
519,
8,
67,
9,
275,
1204,
671,
275,
699,
26,
1616,
1204,
199,
3,
3322,
1204,
671,
275,
445,
26,
221,
1520,
1204,
199,
3,
3322,
1204,
671,
275,
577,
26,
3144,
1204,
199,
3,
199,
3,
32658,
370,
1218,
26,
199,
3,
199,
3,
258,
473,
275,
469,
17,
12,
499,
12,
650,
93,
199,
3,
199,
3,
3322,
1204,
284,
275,
413,
26,
469,
33,
12,
699,
93,
755,
1204,
199,
3,
258,
445,
8,
73,
9,
275,
1204,
284,
275,
499,
26,
469,
33,
12,
699,
12,
445,
12,
577,
93,
1204,
199,
3,
3322,
1204,
284,
275,
650,
26,
469,
34,
12,
445,
12,
577,
93,
259,
1204,
199,
199,
82,
275,
791,
33,
356,
959,
14,
16,
12,
283,
34,
356,
1616,
14,
16,
12,
283,
35,
356,
1520,
14,
16,
12,
283,
36,
356,
3144,
14,
16,
93,
199,
199,
77,
275,
5822,
342,
199,
3008,
275,
334,
7705,
14,
262,
4709,
8,
16,
14,
16,
12,
413,
14,
16,
395,
14061,
14,
374,
2674,
1012,
199,
199,
3,
22896,
282,
1750,
367,
1924,
1834,
436,
1414,
14,
961,
365,
413,
340,
314,
1414,
199,
3,
365,
440,
1255,
465,
1777,
402,
282,
5053,
544,
367,
314,
1834,
14,
199,
88,
63,
17,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
17,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
17,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
17,
63,
66,
297,
627,
3008,
9,
199,
199,
88,
63,
18,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
67,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
67,
297,
627,
3008,
9,
199,
88,
63,
18,
63,
68,
275,
333,
14,
1975,
360,
88,
63,
18,
63,
68,
297,
627,
3008,
9,
199,
199,
88,
63,
19,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
19,
63,
67,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
67,
297,
627,
3008,
9,
199,
88,
63,
19,
63,
68,
275,
333,
14,
1975,
360,
88,
63,
19,
63,
68,
297,
627,
3008,
9,
199,
199,
3,
22896,
282,
1750,
367,
1924,
1390,
7265,
5053,
544,
436,
1390,
7265,
1007,
13,
2764,
544,
14,
199,
88,
63,
713,
63,
371,
275,
333,
14,
1975,
360,
88,
63,
713,
63,
371,
297,
627,
3008,
9,
199,
199,
88,
63,
4288,
63,
66,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
297,
627,
3008,
9,
199,
88,
63,
4288,
63,
66,
63,
713,
63,
65,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
63,
713,
63,
65,
297,
627,
3008,
9,
199,
88,
63,
4288,
63,
66,
63,
1789,
63,
2866,
275,
333,
14,
1975,
360,
88,
63,
4288,
63,
66,
63,
1789,
63,
2866,
297,
627,
3008,
9,
199,
199,
3,
7048,
1414,
1471,
506,
1255,
5403,
367,
1924,
1834,
14,
199,
77,
14,
5631,
360,
67,
63,
17,
63,
65,
297,
14754,
14,
525,
779,
88,
63,
17,
63,
65,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
63,
713,
63,
65,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
17,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
17,
63,
66,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
65,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
65,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
63,
713,
63,
65,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
66,
12,
671,
63,
713,
63,
371,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
67,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
67,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
18,
63,
68,
297,
14754,
14,
525,
779,
88,
63,
18,
63,
68,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
66,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
66,
12,
671,
63,
4288,
63,
66,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
67,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
67,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
77,
14,
5631,
360,
67,
63,
19,
63,
68,
297,
14754,
14,
525,
779,
88,
63,
19,
63,
68,
12,
671,
63,
4288,
63,
66,
63,
1789,
63,
2866,
2522,
14061,
14,
11332,
1378,
8,
17,
14,
16,
430,
199,
199,
3,
2654,
5936,
9565,
367,
1007,
13,
2764,
19658,
14,
199,
77,
14,
5631,
360,
68,
63,
4288,
63,
66,
63,
713,
63,
65,
297,
14754,
14,
954,
8,
88,
63,
4288,
63,
66,
12,
671,
63,
4288,
63,
66,
63,
713,
63,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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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
] |
dreamer7/ZOPO-TSN | tools/perf/scripts/python/net_dropmonitor.py | 4235 | 1554 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
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 *
drop_log = {}
kallsyms = []
def get_kallsyms_table():
global kallsyms
try:
f = open("/proc/kallsyms", "r")
linecount = 0
for line in f:
linecount = linecount+1
f.seek(0)
except:
return
j = 0
for line in f:
loc = int(line.split()[0], 16)
name = line.split()[2]
j = j +1
if ((j % 100) == 0):
print "\r" + str(j) + "/" + str(linecount),
kallsyms.append({ 'loc': loc, 'name' : name})
print "\r" + str(j) + "/" + str(linecount)
kallsyms.sort()
return
def get_sym(sloc):
loc = int(sloc)
for i in kallsyms:
if (i['loc'] >= loc):
return (i['name'], i['loc']-loc)
return (None, 0)
def print_drop_table():
print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")
for i in drop_log.keys():
(sym, off) = get_sym(i)
if sym == None:
sym = i
print "%25s %25s %25s" % (sym, off, drop_log[i])
def trace_begin():
print "Starting trace (Ctrl-C to dump results)"
def trace_end():
print "Gathering kallsyms data"
get_kallsyms_table()
print_drop_table()
# called from perf, when it finds a correspoinding event
def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm,
skbaddr, protocol, location):
slocation = str(location)
try:
drop_log[slocation] = drop_log[slocation] + 1
except:
drop_log[slocation] = 1
| gpl-2.0 | [
3,
26504,
314,
2656,
367,
17481,
14593,
436,
557,
1181,
301,
282,
3622,
402,
5978,
9918,
436,
8242,
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,
507,
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,
4824,
63,
793,
275,
1052,
199,
32483,
275,
942,
199,
199,
318,
664,
63,
32483,
63,
1224,
837,
199,
198,
2966,
1022,
452,
13807,
199,
198,
893,
26,
507,
198,
70,
275,
1551,
4769,
4687,
15,
32483,
401,
298,
82,
531,
507,
198,
604,
835,
275,
378,
507,
198,
509,
1004,
315,
289,
26,
686,
198,
604,
835,
275,
1004,
835,
11,
17,
507,
198,
70,
14,
5507,
8,
16,
9,
199,
198,
2590,
26,
507,
198,
1107,
4388,
198,
74,
275,
378,
199,
198,
509,
1004,
315,
289,
26,
507,
198,
2102,
275,
1109,
8,
604,
14,
1294,
3430,
16,
467,
3193,
9,
507,
198,
354,
275,
1004,
14,
1294,
3430,
18,
61,
507,
198,
74,
275,
1335,
435,
17,
507,
198,
692,
3666,
74,
450,
2948,
9,
508,
378,
304,
686,
198,
1361,
1867,
82,
2,
435,
620,
8,
74,
9,
435,
10609,
435,
620,
8,
604,
835,
395,
507,
198,
32483,
14,
740,
2561,
283,
2102,
356,
4355,
12,
283,
354,
7,
520,
536,
1552,
421,
198,
1361,
1867,
82,
2,
435,
620,
8,
74,
9,
435,
10609,
435,
620,
8,
604,
835,
9,
199,
198,
32483,
14,
3191,
342,
199,
198,
1107,
199,
199,
318,
664,
63,
3840,
8,
83,
2102,
304,
199,
198,
2102,
275,
1109,
8,
83,
2102,
9,
199,
198,
509,
284,
315,
1022,
452,
13807,
26,
507,
198,
692,
334,
73,
459,
2102,
418,
2356,
4355,
304,
686,
198,
1107,
334,
73,
459,
354,
995,
284,
459,
2102,
418,
13,
2102,
9,
199,
198,
1107,
334,
403,
12,
378,
9,
199,
199,
318,
870,
63,
4824,
63,
1224,
837,
199,
198,
1361,
2071,
821,
83,
450,
821,
83,
450,
821,
83,
2,
450,
1689,
16575,
401,
298,
14839,
401,
298,
8760,
531,
199,
198,
509,
284,
315,
5978,
63,
793,
14,
1612,
837,
507,
198,
8,
3840,
12,
2331,
9,
275,
664,
63,
3840,
8,
73,
9,
507,
198,
692,
4678,
508,
488,
26,
686,
198,
3840,
275,
284,
507,
198,
1361,
2071,
821,
83,
450,
821,
83,
450,
821,
83,
2,
450,
334,
3840,
12,
2331,
12,
5978,
63,
793,
59,
73,
566,
421,
199,
318,
3307,
63,
5037,
837,
199,
198,
1361,
298,
14139,
3307,
334,
9778,
13,
35,
370,
5461,
2058,
2924,
199,
199,
318,
3307,
63,
500,
837,
199,
198,
1361,
298,
39,
7404,
316,
1022,
452,
13807,
666,
2,
199,
198,
362,
63,
32483,
63,
1224,
342,
199,
198,
1361,
63,
4824,
63,
1224,
342,
199,
199,
3,
2797,
687,
8582,
12,
1380,
652,
17651,
282,
1970,
470,
555,
688,
316,
1566,
199,
318,
11448,
363,
22197,
63,
6852,
8,
354,
12,
1067,
12,
5033,
12,
6513,
12,
14256,
12,
4422,
12,
1923,
12,
686,
198,
13664,
12,
4113,
12,
2909,
304,
199,
198,
83,
1985,
275,
620,
8,
1985,
9,
199,
198,
893,
26,
507,
198,
4824,
63,
793,
59,
83,
1985,
61,
275,
5978,
63,
793,
59,
83,
1985,
61,
435,
413,
199,
198,
2590,
26,
507,
198,
4824,
63,
793,
59,
83,
1985,
61,
275,
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
] | [
26504,
314,
2656,
367,
17481,
14593,
436,
557,
1181,
301,
282,
3622,
402,
5978,
9918,
436,
8242,
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,
507,
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,
4824,
63,
793,
275,
1052,
199,
32483,
275,
942,
199,
199,
318,
664,
63,
32483,
63,
1224,
837,
199,
198,
2966,
1022,
452,
13807,
199,
198,
893,
26,
507,
198,
70,
275,
1551,
4769,
4687,
15,
32483,
401,
298,
82,
531,
507,
198,
604,
835,
275,
378,
507,
198,
509,
1004,
315,
289,
26,
686,
198,
604,
835,
275,
1004,
835,
11,
17,
507,
198,
70,
14,
5507,
8,
16,
9,
199,
198,
2590,
26,
507,
198,
1107,
4388,
198,
74,
275,
378,
199,
198,
509,
1004,
315,
289,
26,
507,
198,
2102,
275,
1109,
8,
604,
14,
1294,
3430,
16,
467,
3193,
9,
507,
198,
354,
275,
1004,
14,
1294,
3430,
18,
61,
507,
198,
74,
275,
1335,
435,
17,
507,
198,
692,
3666,
74,
450,
2948,
9,
508,
378,
304,
686,
198,
1361,
1867,
82,
2,
435,
620,
8,
74,
9,
435,
10609,
435,
620,
8,
604,
835,
395,
507,
198,
32483,
14,
740,
2561,
283,
2102,
356,
4355,
12,
283,
354,
7,
520,
536,
1552,
421,
198,
1361,
1867,
82,
2,
435,
620,
8,
74,
9,
435,
10609,
435,
620,
8,
604,
835,
9,
199,
198,
32483,
14,
3191,
342,
199,
198,
1107,
199,
199,
318,
664,
63,
3840,
8,
83,
2102,
304,
199,
198,
2102,
275,
1109,
8,
83,
2102,
9,
199,
198,
509,
284,
315,
1022,
452,
13807,
26,
507,
198,
692,
334,
73,
459,
2102,
418,
2356,
4355,
304,
686,
198,
1107,
334,
73,
459,
354,
995,
284,
459,
2102,
418,
13,
2102,
9,
199,
198,
1107,
334,
403,
12,
378,
9,
199,
199,
318,
870,
63,
4824,
63,
1224,
837,
199,
198,
1361,
2071,
821,
83,
450,
821,
83,
450,
821,
83,
2,
450,
1689,
16575,
401,
298,
14839,
401,
298,
8760,
531,
199,
198,
509,
284,
315,
5978,
63,
793,
14,
1612,
837,
507,
198,
8,
3840,
12,
2331,
9,
275,
664,
63,
3840,
8,
73,
9,
507,
198,
692,
4678,
508,
488,
26,
686,
198,
3840,
275,
284,
507,
198,
1361,
2071,
821,
83,
450,
821,
83,
450,
821,
83,
2,
450,
334,
3840,
12,
2331,
12,
5978,
63,
793,
59,
73,
566,
421,
199,
318,
3307,
63,
5037,
837,
199,
198,
1361,
298,
14139,
3307,
334,
9778,
13,
35,
370,
5461,
2058,
2924,
199,
199,
318,
3307,
63,
500,
837,
199,
198,
1361,
298,
39,
7404,
316,
1022,
452,
13807,
666,
2,
199,
198,
362,
63,
32483,
63,
1224,
342,
199,
198,
1361,
63,
4824,
63,
1224,
342,
199,
199,
3,
2797,
687,
8582,
12,
1380,
652,
17651,
282,
1970,
470,
555,
688,
316,
1566,
199,
318,
11448,
363,
22197,
63,
6852,
8,
354,
12,
1067,
12,
5033,
12,
6513,
12,
14256,
12,
4422,
12,
1923,
12,
686,
198,
13664,
12,
4113,
12,
2909,
304,
199,
198,
83,
1985,
275,
620,
8,
1985,
9,
199,
198,
893,
26,
507,
198,
4824,
63,
793,
59,
83,
1985,
61,
275,
5978,
63,
793,
59,
83,
1985,
61,
435,
413,
199,
198,
2590,
26,
507,
198,
4824,
63,
793,
59,
83,
1985,
61,
275,
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,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
apocalypsebg/odoo | addons/hr/__init__.py | 382 | 1092 | # -*- 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 hr
import res_config
import res_users
# 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,
16140,
199,
199,
646,
522,
63,
888,
199,
646,
522,
63,
3707,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,
16140,
199,
199,
646,
522,
63,
888,
199,
646,
522,
63,
3707,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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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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
] |
clld/tsammalex | tsammalex/util.py | 1 | 4317 | from collections import OrderedDict
from purl import URL
from sqlalchemy.orm import joinedload, contains_eager
from clld.web.util.multiselect import MultiSelect
from clld.db.meta import DBSession
from clld.db.models.common import Language, Unit, Value, ValueSet
from clld.web.util.htmllib import HTML
from clld.web.util.helpers import maybe_external_link, collapsed
from tsammalex.models import split_ids
assert split_ids
def license_name(license_url):
if license_url == "http://commons.wikimedia.org/wiki/GNU_Free_Documentation_License":
return 'GNU Free Documentation License'
if license_url == 'http://en.wikipedia.org/wiki/Public_domain':
license_url = 'http://creativecommons.org/publicdomain/zero/1.0/'
license_url_ = URL(license_url)
if license_url_.host() != 'creativecommons.org':
return license_url
comps = license_url_.path().split('/')
if len(comps) < 3:
return license_url
return {
'zero': 'Public Domain',
}.get(comps[2], '(CC) %s' % comps[2].upper())
def names_in_2nd_languages(vs):
def format_name(n):
res = [HTML.i(n.name)]
if n.ipa:
res.append(' [%s]' % n.ipa)
return HTML.span(*res)
def format_language(vs):
return ' '.join([vs.language.name, ', '.join(format_name(n) for n in vs.values)])
query = DBSession.query(ValueSet).join(ValueSet.language)\
.order_by(Language.name)\
.filter(Language.pk.in_([l.pk for l in vs.language.second_languages]))\
.filter(ValueSet.parameter_pk == vs.parameter_pk)\
.options(contains_eager(ValueSet.language), joinedload(ValueSet.values))
res = '; '.join(format_language(vs) for vs in query)
if res:
res = '(%s)' % res
return res
def source_link(source):
label = source
host = URL(source).host()
if host == 'commons.wikimedia.org':
label = 'wikimedia'
elif host == 'en.wikipedia.org':
label = 'wikipedia'
return maybe_external_link(source, label=label)
def with_attr(f):
def wrapper(ctx, name, *args, **kw):
kw['attr'] = getattr(ctx, name)
if not kw['attr']:
return '' # pragma: no cover
return f(ctx, name, *args, **kw)
return wrapper
@with_attr
def tr_rel(ctx, name, label=None, dt='name', dd='description', attr=None):
content = []
for item in attr:
content.extend([HTML.dt(getattr(item, dt)), HTML.dd(getattr(item, dd))])
content = HTML.dl(*content, class_='dl-horizontal')
if len(attr) > 3:
content = collapsed('collapsed-' + name, content)
return HTML.tr(HTML.td((label or name.capitalize()) + ':'), HTML.td(content))
@with_attr
def tr_attr(ctx, name, label=None, content=None, attr=None):
return HTML.tr(
HTML.td((label or name.capitalize()) + ':'),
HTML.td(content or maybe_external_link(attr)))
def format_classification(taxon, with_species=False, with_rank=False):
names = OrderedDict()
for r in 'kingdom phylum class_ order family'.split():
names[r.replace('_', '')] = getattr(taxon, r)
if with_species:
names[taxon.rank] = taxon.name
return HTML.ul(
*[HTML.li(('{0} {1}: {2}' if with_rank else '{0}{2}').format('-' * i, *n))
for i, n in enumerate(n for n in names.items() if n[1])],
class_="unstyled")
class LanguageMultiSelect(MultiSelect):
def __init__(self, ctx, req, name='languages', eid='ms-languages', **kw):
kw['selected'] = ctx.languages
MultiSelect.__init__(self, req, name, eid, **kw)
@classmethod
def query(cls):
return DBSession.query(Language).order_by(Language.name)
def get_options(self):
return {
'data': [self.format_result(p) for p in self.query()],
'multiple': True,
'maximumSelectionSize': 2}
def parameter_index_html(context=None, request=None, **kw):
return dict(select=LanguageMultiSelect(context, request))
def language_detail_html(context=None, request=None, **kw):
return dict(categories=list(DBSession.query(Unit)
.filter(Unit.language == context).order_by(Unit.name)))
def language_index_html(context=None, request=None, **kw):
return dict(map_=request.get_map('languages', col='lineage', dt=context))
| apache-2.0 | [
504,
5055,
492,
8773,
199,
199,
504,
299,
633,
492,
2851,
199,
504,
8335,
14,
1025,
492,
16538,
912,
12,
3509,
63,
10283,
199,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
3029,
2416,
492,
6879,
5446,
199,
504,
824,
1447,
14,
697,
14,
2024,
492,
6249,
4434,
199,
504,
824,
1447,
14,
697,
14,
992,
14,
2330,
492,
8466,
12,
12008,
12,
1594,
12,
1594,
1084,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
1360,
773,
492,
4163,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
7546,
492,
11703,
63,
5159,
63,
1073,
12,
31219,
199,
199,
504,
6714,
4746,
3113,
14,
992,
492,
3715,
63,
1580,
199,
479,
3715,
63,
1580,
421,
199,
318,
4190,
63,
354,
8,
1682,
63,
633,
304,
272,
340,
4190,
63,
633,
508,
298,
1014,
921,
2330,
83,
14,
5319,
1036,
2391,
14,
1308,
15,
6797,
15,
17732,
63,
10146,
63,
17763,
63,
3761,
582,
267,
372,
283,
17732,
2868,
15249,
844,
7,
272,
340,
4190,
63,
633,
508,
283,
1014,
921,
287,
14,
13961,
14,
1308,
15,
6797,
15,
9885,
63,
2261,
356,
267,
4190,
63,
633,
275,
283,
1014,
921,
1353,
1905,
2330,
83,
14,
1308,
15,
3455,
2261,
15,
4262,
15,
17,
14,
16,
4805,
272,
4190,
63,
633,
63,
275,
2851,
8,
1682,
63,
633,
9,
272,
340,
4190,
63,
633,
3754,
1102,
342,
1137,
283,
1353,
1905,
2330,
83,
14,
1308,
356,
267,
372,
4190,
63,
633,
339,
30594,
275,
4190,
63,
633,
3754,
515,
1252,
1294,
7825,
272,
340,
822,
8,
24344,
9,
665,
650,
26,
267,
372,
4190,
63,
633,
339,
372,
469,
267,
283,
4262,
356,
283,
9885,
14061,
297,
272,
789,
14,
362,
8,
24344,
59,
18,
467,
8189,
2571,
9,
450,
83,
7,
450,
30594,
59,
18,
1055,
4142,
1012,
421,
199,
318,
1561,
63,
262,
63,
18,
977,
63,
13209,
8,
3122,
304,
272,
347,
1475,
63,
354,
8,
78,
304,
267,
522,
275,
359,
4943,
14,
73,
8,
78,
14,
354,
1874,
267,
340,
302,
14,
20014,
26,
288,
522,
14,
740,
20040,
10758,
27,
9722,
83,
6616,
450,
302,
14,
20014,
9,
267,
372,
4163,
14,
3751,
2031,
470,
9,
339,
347,
1475,
63,
3671,
8,
3122,
304,
267,
372,
283,
1987,
904,
779,
3122,
14,
3671,
14,
354,
12,
1656,
1987,
904,
8,
908,
63,
354,
8,
78,
9,
367,
302,
315,
8118,
14,
1459,
3948,
339,
1827,
275,
6249,
4434,
14,
1131,
8,
1110,
1084,
680,
904,
8,
1110,
1084,
14,
3671,
2862,
267,
1275,
1648,
63,
991,
8,
8493,
14,
354,
2862,
267,
1275,
1541,
8,
8493,
14,
2051,
14,
262,
63,
779,
76,
14,
2051,
367,
634,
315,
8118,
14,
3671,
14,
4375,
63,
13209,
2459,
60,
267,
1275,
1541,
8,
1110,
1084,
14,
5329,
63,
2051,
508,
8118,
14,
5329,
63,
2051,
2862,
267,
1275,
1419,
8,
6134,
63,
10283,
8,
1110,
1084,
14,
3671,
395,
16538,
912,
8,
1110,
1084,
14,
1459,
430,
272,
522,
275,
14289,
1987,
904,
8,
908,
63,
3671,
8,
3122,
9,
367,
8118,
315,
1827,
9,
272,
340,
522,
26,
267,
522,
275,
25676,
83,
3171,
450,
522,
272,
372,
522,
421,
199,
318,
1350,
63,
1073,
8,
1365,
304,
272,
1768,
275,
1350,
272,
1591,
275,
2851,
8,
1365,
680,
1102,
342,
272,
340,
1591,
508,
283,
2330,
83,
14,
5319,
1036,
2391,
14,
1308,
356,
267,
1768,
275,
283,
5319,
1036,
2391,
7,
272,
916,
1591,
508,
283,
287,
14,
13961,
14,
1308,
356,
267,
1768,
275,
283,
13961,
7,
272,
372,
11703,
63,
5159,
63,
1073,
8,
1365,
12,
1768,
29,
1302,
9,
421,
199,
318,
543,
63,
962,
8,
70,
304,
272,
347,
4975,
8,
3799,
12,
536,
12,
627,
589,
12,
1011,
829,
304,
267,
4775,
459,
962,
418,
275,
2519,
8,
3799,
12,
536,
9,
267,
340,
440,
4775,
459,
962,
2565,
288,
372,
2125,
221,
327,
11942,
26,
949,
8486,
267,
372,
289,
8,
3799,
12,
536,
12,
627,
589,
12,
1011,
829,
9,
272,
372,
4975,
421,
199,
32,
1045,
63,
962,
199,
318,
5651,
63,
3369,
8,
3799,
12,
536,
12,
1768,
29,
403,
12,
4487,
534,
354,
297,
13972,
534,
1802,
297,
1921,
29,
403,
304,
272,
1564,
275,
942,
272,
367,
1242,
315,
1921,
26,
267,
1564,
14,
2880,
779,
4943,
14,
3583,
8,
5675,
8,
1053,
12,
4487,
1826,
4163,
14,
617,
8,
5675,
8,
1053,
12,
13972,
18229,
272,
1564,
275,
4163,
14,
5030,
2031,
1317,
12,
1021,
7993,
5030,
13,
11392,
358,
272,
340,
822,
8,
962,
9,
690,
650,
26,
267,
1564,
275,
31219,
360,
761,
9982,
15668,
435,
536,
12,
1564,
9,
272,
372,
4163,
14,
454,
8,
4943,
14,
2076,
1332,
1302,
503,
536,
14,
18351,
1012,
435,
7596,
659,
4163,
14,
2076,
8,
1317,
430,
421,
199,
32,
1045,
63,
962,
199,
318,
5651,
63,
962,
8,
3799,
12,
536,
12,
1768,
29,
403,
12,
1564,
29,
403,
12,
1921,
29,
403,
304,
272,
372,
4163,
14,
454,
8,
267,
4163,
14,
2076,
1332,
1302,
503,
536,
14,
18351,
1012,
435,
7596,
659,
267,
4163,
14,
2076,
8,
1317,
503,
11703,
63,
5159,
63,
1073,
8,
962,
1724,
421,
199,
318,
1475,
63,
14368,
8,
5530,
265,
12,
543,
63,
17168,
29,
797,
12,
543,
63,
4648,
29,
797,
304,
272,
1561,
275,
8773,
342,
272,
367,
519,
315,
283,
17443,
4556,
11831,
25065,
1021,
63,
1865,
9614,
1370,
1294,
837,
267,
1561,
59,
82,
14,
1814,
20928,
4074,
61,
275,
2519,
8,
5530,
265,
12,
519,
9,
272,
340,
543,
63,
17168,
26,
267,
1561,
59,
5530,
265,
14,
4648,
61,
275,
9067,
265,
14,
354,
272,
372,
4163,
14,
348,
8,
267,
627,
59,
4943,
14,
317,
4725,
91,
16,
93,
469,
17,
9160,
469,
18,
6834,
340,
543,
63,
4648,
587,
5041,
16,
8847,
18,
93,
1959,
908,
3654,
7,
627,
284,
12,
627,
78,
430,
881,
367,
284,
12,
302,
315,
3874,
8,
78,
367,
302,
315,
1561,
14,
1744,
342,
340,
302,
59,
17,
27520,
267,
1021,
63,
628,
324,
28352,
1146,
531,
421,
199,
533,
8466,
3947,
5446,
8,
3947,
5446,
304,
272,
347,
636,
826
] | [
5055,
492,
8773,
199,
199,
504,
299,
633,
492,
2851,
199,
504,
8335,
14,
1025,
492,
16538,
912,
12,
3509,
63,
10283,
199,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
3029,
2416,
492,
6879,
5446,
199,
504,
824,
1447,
14,
697,
14,
2024,
492,
6249,
4434,
199,
504,
824,
1447,
14,
697,
14,
992,
14,
2330,
492,
8466,
12,
12008,
12,
1594,
12,
1594,
1084,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
1360,
773,
492,
4163,
199,
504,
824,
1447,
14,
2520,
14,
1974,
14,
7546,
492,
11703,
63,
5159,
63,
1073,
12,
31219,
199,
199,
504,
6714,
4746,
3113,
14,
992,
492,
3715,
63,
1580,
199,
479,
3715,
63,
1580,
421,
199,
318,
4190,
63,
354,
8,
1682,
63,
633,
304,
272,
340,
4190,
63,
633,
508,
298,
1014,
921,
2330,
83,
14,
5319,
1036,
2391,
14,
1308,
15,
6797,
15,
17732,
63,
10146,
63,
17763,
63,
3761,
582,
267,
372,
283,
17732,
2868,
15249,
844,
7,
272,
340,
4190,
63,
633,
508,
283,
1014,
921,
287,
14,
13961,
14,
1308,
15,
6797,
15,
9885,
63,
2261,
356,
267,
4190,
63,
633,
275,
283,
1014,
921,
1353,
1905,
2330,
83,
14,
1308,
15,
3455,
2261,
15,
4262,
15,
17,
14,
16,
4805,
272,
4190,
63,
633,
63,
275,
2851,
8,
1682,
63,
633,
9,
272,
340,
4190,
63,
633,
3754,
1102,
342,
1137,
283,
1353,
1905,
2330,
83,
14,
1308,
356,
267,
372,
4190,
63,
633,
339,
30594,
275,
4190,
63,
633,
3754,
515,
1252,
1294,
7825,
272,
340,
822,
8,
24344,
9,
665,
650,
26,
267,
372,
4190,
63,
633,
339,
372,
469,
267,
283,
4262,
356,
283,
9885,
14061,
297,
272,
789,
14,
362,
8,
24344,
59,
18,
467,
8189,
2571,
9,
450,
83,
7,
450,
30594,
59,
18,
1055,
4142,
1012,
421,
199,
318,
1561,
63,
262,
63,
18,
977,
63,
13209,
8,
3122,
304,
272,
347,
1475,
63,
354,
8,
78,
304,
267,
522,
275,
359,
4943,
14,
73,
8,
78,
14,
354,
1874,
267,
340,
302,
14,
20014,
26,
288,
522,
14,
740,
20040,
10758,
27,
9722,
83,
6616,
450,
302,
14,
20014,
9,
267,
372,
4163,
14,
3751,
2031,
470,
9,
339,
347,
1475,
63,
3671,
8,
3122,
304,
267,
372,
283,
1987,
904,
779,
3122,
14,
3671,
14,
354,
12,
1656,
1987,
904,
8,
908,
63,
354,
8,
78,
9,
367,
302,
315,
8118,
14,
1459,
3948,
339,
1827,
275,
6249,
4434,
14,
1131,
8,
1110,
1084,
680,
904,
8,
1110,
1084,
14,
3671,
2862,
267,
1275,
1648,
63,
991,
8,
8493,
14,
354,
2862,
267,
1275,
1541,
8,
8493,
14,
2051,
14,
262,
63,
779,
76,
14,
2051,
367,
634,
315,
8118,
14,
3671,
14,
4375,
63,
13209,
2459,
60,
267,
1275,
1541,
8,
1110,
1084,
14,
5329,
63,
2051,
508,
8118,
14,
5329,
63,
2051,
2862,
267,
1275,
1419,
8,
6134,
63,
10283,
8,
1110,
1084,
14,
3671,
395,
16538,
912,
8,
1110,
1084,
14,
1459,
430,
272,
522,
275,
14289,
1987,
904,
8,
908,
63,
3671,
8,
3122,
9,
367,
8118,
315,
1827,
9,
272,
340,
522,
26,
267,
522,
275,
25676,
83,
3171,
450,
522,
272,
372,
522,
421,
199,
318,
1350,
63,
1073,
8,
1365,
304,
272,
1768,
275,
1350,
272,
1591,
275,
2851,
8,
1365,
680,
1102,
342,
272,
340,
1591,
508,
283,
2330,
83,
14,
5319,
1036,
2391,
14,
1308,
356,
267,
1768,
275,
283,
5319,
1036,
2391,
7,
272,
916,
1591,
508,
283,
287,
14,
13961,
14,
1308,
356,
267,
1768,
275,
283,
13961,
7,
272,
372,
11703,
63,
5159,
63,
1073,
8,
1365,
12,
1768,
29,
1302,
9,
421,
199,
318,
543,
63,
962,
8,
70,
304,
272,
347,
4975,
8,
3799,
12,
536,
12,
627,
589,
12,
1011,
829,
304,
267,
4775,
459,
962,
418,
275,
2519,
8,
3799,
12,
536,
9,
267,
340,
440,
4775,
459,
962,
2565,
288,
372,
2125,
221,
327,
11942,
26,
949,
8486,
267,
372,
289,
8,
3799,
12,
536,
12,
627,
589,
12,
1011,
829,
9,
272,
372,
4975,
421,
199,
32,
1045,
63,
962,
199,
318,
5651,
63,
3369,
8,
3799,
12,
536,
12,
1768,
29,
403,
12,
4487,
534,
354,
297,
13972,
534,
1802,
297,
1921,
29,
403,
304,
272,
1564,
275,
942,
272,
367,
1242,
315,
1921,
26,
267,
1564,
14,
2880,
779,
4943,
14,
3583,
8,
5675,
8,
1053,
12,
4487,
1826,
4163,
14,
617,
8,
5675,
8,
1053,
12,
13972,
18229,
272,
1564,
275,
4163,
14,
5030,
2031,
1317,
12,
1021,
7993,
5030,
13,
11392,
358,
272,
340,
822,
8,
962,
9,
690,
650,
26,
267,
1564,
275,
31219,
360,
761,
9982,
15668,
435,
536,
12,
1564,
9,
272,
372,
4163,
14,
454,
8,
4943,
14,
2076,
1332,
1302,
503,
536,
14,
18351,
1012,
435,
7596,
659,
4163,
14,
2076,
8,
1317,
430,
421,
199,
32,
1045,
63,
962,
199,
318,
5651,
63,
962,
8,
3799,
12,
536,
12,
1768,
29,
403,
12,
1564,
29,
403,
12,
1921,
29,
403,
304,
272,
372,
4163,
14,
454,
8,
267,
4163,
14,
2076,
1332,
1302,
503,
536,
14,
18351,
1012,
435,
7596,
659,
267,
4163,
14,
2076,
8,
1317,
503,
11703,
63,
5159,
63,
1073,
8,
962,
1724,
421,
199,
318,
1475,
63,
14368,
8,
5530,
265,
12,
543,
63,
17168,
29,
797,
12,
543,
63,
4648,
29,
797,
304,
272,
1561,
275,
8773,
342,
272,
367,
519,
315,
283,
17443,
4556,
11831,
25065,
1021,
63,
1865,
9614,
1370,
1294,
837,
267,
1561,
59,
82,
14,
1814,
20928,
4074,
61,
275,
2519,
8,
5530,
265,
12,
519,
9,
272,
340,
543,
63,
17168,
26,
267,
1561,
59,
5530,
265,
14,
4648,
61,
275,
9067,
265,
14,
354,
272,
372,
4163,
14,
348,
8,
267,
627,
59,
4943,
14,
317,
4725,
91,
16,
93,
469,
17,
9160,
469,
18,
6834,
340,
543,
63,
4648,
587,
5041,
16,
8847,
18,
93,
1959,
908,
3654,
7,
627,
284,
12,
627,
78,
430,
881,
367,
284,
12,
302,
315,
3874,
8,
78,
367,
302,
315,
1561,
14,
1744,
342,
340,
302,
59,
17,
27520,
267,
1021,
63,
628,
324,
28352,
1146,
531,
421,
199,
533,
8466,
3947,
5446,
8,
3947,
5446,
304,
272,
347,
636,
826,
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,
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ible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.parsing.yaml.strings import *
class AnsibleError(Exception):
'''
This is the base class for all errors raised from Ansible code,
and can be instantiated with two optional parameters beyond the
error message to control whether detailed information is displayed
when the error occurred while parsing a data file of some kind.
Usage:
raise AnsibleError('some message here', obj=obj, show_content=True)
Where "obj" is some subclass of ansible.parsing.yaml.objects.AnsibleBaseYAMLObject,
which should be returned by the DataLoader() class.
'''
def __init__(self, message, obj=None, show_content=True):
# we import this here to prevent an import loop problem,
# since the objects code also imports ansible.errors
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject
self._obj = obj
self._show_content = show_content
if isinstance(self._obj, AnsibleBaseYAMLObject):
extended_error = self._get_extended_error()
if extended_error:
self.message = '%s\n\n%s' % (message, extended_error)
else:
self.message = message
def __str__(self):
return self.message
def __repr__(self):
return self.message
def _get_error_lines_from_file(self, file_name, line_number):
'''
Returns the line in the file which coresponds to the reported error
location, as well as the line preceding it (if the error did not
occur on the first line), to provide context to the error.
'''
target_line = ''
prev_line = ''
with open(file_name, 'r') as f:
lines = f.readlines()
target_line = lines[line_number]
if line_number > 0:
prev_line = lines[line_number - 1]
return (target_line, prev_line)
def _get_extended_error(self):
'''
Given an object reporting the location of the exception in a file, return
detailed information regarding it including:
* the line which caused the error as well as the one preceding it
* causes and suggested remedies for common syntax errors
If this error was created with show_content=False, the reporting of content
is suppressed, as the file contents may be sensitive (ie. vault data).
'''
error_message = ''
try:
(src_file, line_number, col_number) = self._obj.get_position_info()
error_message += YAML_POSITION_DETAILS % (src_file, line_number, col_number)
if src_file not in ('<string>', '<unicode>') and self._show_content:
(target_line, prev_line) = self._get_error_lines_from_file(src_file, line_number - 1)
if target_line:
stripped_line = target_line.replace(" ","")
arrow_line = (" " * (col_number-1)) + "^"
error_message += "%s\n%s\n%s\n" % (prev_line.rstrip(), target_line.rstrip(), arrow_line)
# common error/remediation checking here:
# check for unquoted vars starting lines
if ('{{' in target_line and '}}' in target_line) and ('"{{' not in target_line or "'{{" not in target_line):
error_message += YAML_COMMON_UNQUOTED_VARIABLE_ERROR
# check for common dictionary mistakes
elif ":{{" in stripped_line and "}}" in stripped_line:
error_message += YAML_COMMON_DICT_ERROR
# check for common unquoted colon mistakes
elif len(target_line) and len(target_line) > 1 and len(target_line) > col_number and target_line[col_number] == ":" and target_line.count(':') > 1:
error_message += YAML_COMMON_UNQUOTED_COLON_ERROR
# otherwise, check for some common quoting mistakes
else:
parts = target_line.split(":")
if len(parts) > 1:
middle = parts[1].strip()
match = False
unbalanced = False
if middle.startswith("'") and not middle.endswith("'"):
match = True
elif middle.startswith('"') and not middle.endswith('"'):
match = True
if len(middle) > 0 and middle[0] in [ '"', "'" ] and middle[-1] in [ '"', "'" ] and target_line.count("'") > 2 or target_line.count('"') > 2:
unbalanced = True
if match:
error_message += YAML_COMMON_PARTIALLY_QUOTED_LINE_ERROR
if unbalanced:
error_message += YAML_COMMON_UNBALANCED_QUOTES_ERROR
except (IOError, TypeError):
error_message += '\n(could not open file to display line)'
except IndexError:
error_message += '\n(specified line no longer in file, maybe it changed?)'
return error_message
class AnsibleParserError(AnsibleError):
''' something was detected early that is wrong about a playbook or data file '''
pass
class AnsibleInternalError(AnsibleError):
''' internal safeguards tripped, something happened in the code that should never happen '''
pass
class AnsibleRuntimeError(AnsibleError):
''' ansible had a problem while running a playbook '''
pass
class AnsibleModuleError(AnsibleRuntimeError):
''' a module failed somehow '''
pass
class AnsibleConnectionFailure(AnsibleRuntimeError):
''' the transport / connection_plugin had a fatal error '''
pass
| gpl-3.0 | [
3,
334,
67,
9,
6029,
13,
7280,
12,
16922,
22453,
665,
22333,
14,
24247,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
2622,
199,
3,
199,
3,
2622,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
2622,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
2622,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
199,
3,
4155,
2803,
1655,
2366,
19,
13,
2453,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
870,
63,
1593,
9,
199,
363,
6577,
363,
275,
730,
199,
199,
646,
747,
199,
199,
504,
3242,
14,
11059,
14,
5963,
14,
5465,
492,
627,
199,
199,
533,
13358,
8,
1726,
304,
272,
1449,
272,
961,
365,
314,
1300,
1021,
367,
1006,
2552,
4915,
687,
2622,
1233,
12,
272,
436,
883,
506,
17544,
543,
2877,
2716,
2633,
20561,
314,
272,
1125,
1245,
370,
3304,
3775,
16212,
2556,
365,
9080,
272,
1380,
314,
1125,
8920,
1830,
6057,
282,
666,
570,
402,
2005,
4928,
14,
339,
11028,
26,
398,
746,
13358,
360,
3972,
1245,
2348,
297,
1559,
29,
1113,
12,
2498,
63,
1317,
29,
549,
9,
339,
17685,
298,
1113,
2,
365,
2005,
5516,
402,
3242,
14,
11059,
14,
5963,
14,
1462,
14,
10047,
1563,
57,
1156,
30113,
12,
272,
1314,
1077,
506,
2138,
701,
314,
3918,
5455,
342,
1021,
14,
272,
1449,
339,
347,
636,
826,
721,
277,
12,
1245,
12,
1559,
29,
403,
12,
2498,
63,
1317,
29,
549,
304,
267,
327,
781,
492,
642,
2348,
370,
7981,
376,
492,
4438,
5160,
12,
267,
327,
3967,
314,
2251,
1233,
2597,
8925,
3242,
14,
2550,
267,
687,
3242,
14,
11059,
14,
5963,
14,
1462,
492,
2622,
1563,
57,
1156,
30113,
398,
291,
423,
1113,
275,
1559,
267,
291,
423,
2384,
63,
1317,
275,
2498,
63,
1317,
267,
340,
1228,
8,
277,
423,
1113,
12,
2622,
1563,
57,
1156,
30113,
304,
288,
9243,
63,
705,
275,
291,
423,
362,
63,
10525,
63,
705,
342,
288,
340,
9243,
63,
705,
26,
355,
291,
14,
1188,
275,
1543,
83,
60,
78,
60,
78,
5,
83,
7,
450,
334,
1188,
12,
9243,
63,
705,
9,
267,
587,
26,
288,
291,
14,
1188,
275,
1245,
339,
347,
636,
495,
721,
277,
304,
267,
372,
291,
14,
1188,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
291,
14,
1188,
339,
347,
485,
362,
63,
705,
63,
1278,
63,
504,
63,
493,
8,
277,
12,
570,
63,
354,
12,
1004,
63,
1955,
304,
267,
1449,
267,
1803,
314,
1004,
315,
314,
570,
1314,
512,
3853,
795,
370,
314,
14581,
1125,
267,
2909,
12,
465,
5521,
465,
314,
1004,
22627,
652,
334,
692,
314,
1125,
8103,
440,
267,
4781,
641,
314,
1642,
1004,
395,
370,
5647,
1067,
370,
314,
1125,
14,
267,
1449,
398,
1347,
63,
604,
275,
2125,
267,
5071,
63,
604,
275,
2125,
398,
543,
1551,
8,
493,
63,
354,
12,
283,
82,
358,
465,
289,
26,
288,
2385,
275,
289,
14,
9684,
342,
953,
1347,
63,
604,
275,
2385,
59,
604,
63,
1955,
61,
288,
340,
1004,
63,
1955,
690,
378,
26,
355,
5071,
63,
604,
275,
2385,
59,
604,
63,
1955,
446,
413,
61,
398,
372,
334,
1375,
63,
604,
12,
5071,
63,
604,
9,
339,
347,
485,
362,
63,
10525,
63,
705,
8,
277,
304,
267,
1449,
267,
9138,
376,
909,
17290,
314,
2909,
402,
314,
1919,
315,
282,
570,
12,
372,
267,
16212,
2556,
12602,
652,
5893,
26,
8592,
627,
314,
1004,
1314,
18104,
314,
1125,
465,
5521,
465,
314,
1373,
22627,
652,
881,
627,
14486,
436,
25697,
295,
3700,
397,
367,
2863,
6302,
2552,
398,
982,
642,
1125,
1990,
2737,
543,
2498,
63,
1317,
29,
797,
12,
314,
17290,
402,
1564,
267,
365,
30581,
12,
465,
314,
570,
4072,
1443,
506,
18423,
334,
1873,
14,
12738,
666,
680,
267,
1449,
398,
1125,
63,
1188,
275,
2125,
398,
862,
26,
288,
334,
2164,
63,
493,
12,
1004,
63,
1955,
12,
1048,
63,
1955,
9,
275,
291,
423,
1113,
14,
362,
63,
3124,
63,
815,
342,
288,
1125,
63,
1188,
847,
18916,
63,
15717,
63,
25081,
51,
450,
334,
2164,
63,
493,
12,
1004,
63,
1955,
12,
1048,
63,
1955,
9,
288,
340,
2928,
63,
493,
440,
315,
19990,
875,
4206,
2650,
2975,
5971,
436,
291,
423,
2384,
63,
1317,
26,
355,
334,
1375,
63,
604,
12,
5071,
63,
604,
9,
275,
291,
423,
362,
63,
705,
63,
1278,
63,
504,
63,
493,
8,
2164,
63,
493,
12,
1004,
63,
1955,
446,
413,
9,
355,
340,
1347,
63,
604,
26,
490,
14489,
63,
604,
275,
1347,
63,
604,
14,
1814,
480,
3872,
7230,
490,
18800,
63,
604,
259,
275,
1689,
298,
627,
334,
761,
63,
1955,
13,
17,
430,
435,
18129,
2,
490,
1125,
63,
1188,
847,
2071,
83,
60,
78,
5,
83,
60,
78,
5,
83,
60,
78,
2,
450,
334,
5701,
63,
604,
14,
6735,
1062,
1347,
63,
604,
14,
6735,
1062,
18800,
63,
604,
9,
4951,
327,
2863,
1125,
15,
264,
3700,
425,
7907,
2348,
26,
490,
327,
1104,
367,
31791,
6802,
6617,
2385,
490,
340,
661,
91,
1445,
315,
1347,
63,
604,
436,
283,
4863,
7,
315,
1347,
63,
604,
9,
436,
661,
14381,
1445,
440,
315,
1347,
63,
604,
503,
3546,
3638,
2,
440,
315,
1347,
63,
604,
304,
717,
1125,
63,
1188,
847,
18916,
63,
21637,
63,
1734,
18654,
1149,
63,
23129,
63,
3170,
490,
327,
1104,
367,
2863,
2600,
27572,
4364,
490,
916,
7244,
3638,
2,
315,
14489,
63
] | [
334,
67,
9,
6029,
13,
7280,
12,
16922,
22453,
665,
22333,
14,
24247,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
2622,
199,
3,
199,
3,
2622,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
2622,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
2622,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
199,
3,
4155,
2803,
1655,
2366,
19,
13,
2453,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
870,
63,
1593,
9,
199,
363,
6577,
363,
275,
730,
199,
199,
646,
747,
199,
199,
504,
3242,
14,
11059,
14,
5963,
14,
5465,
492,
627,
199,
199,
533,
13358,
8,
1726,
304,
272,
1449,
272,
961,
365,
314,
1300,
1021,
367,
1006,
2552,
4915,
687,
2622,
1233,
12,
272,
436,
883,
506,
17544,
543,
2877,
2716,
2633,
20561,
314,
272,
1125,
1245,
370,
3304,
3775,
16212,
2556,
365,
9080,
272,
1380,
314,
1125,
8920,
1830,
6057,
282,
666,
570,
402,
2005,
4928,
14,
339,
11028,
26,
398,
746,
13358,
360,
3972,
1245,
2348,
297,
1559,
29,
1113,
12,
2498,
63,
1317,
29,
549,
9,
339,
17685,
298,
1113,
2,
365,
2005,
5516,
402,
3242,
14,
11059,
14,
5963,
14,
1462,
14,
10047,
1563,
57,
1156,
30113,
12,
272,
1314,
1077,
506,
2138,
701,
314,
3918,
5455,
342,
1021,
14,
272,
1449,
339,
347,
636,
826,
721,
277,
12,
1245,
12,
1559,
29,
403,
12,
2498,
63,
1317,
29,
549,
304,
267,
327,
781,
492,
642,
2348,
370,
7981,
376,
492,
4438,
5160,
12,
267,
327,
3967,
314,
2251,
1233,
2597,
8925,
3242,
14,
2550,
267,
687,
3242,
14,
11059,
14,
5963,
14,
1462,
492,
2622,
1563,
57,
1156,
30113,
398,
291,
423,
1113,
275,
1559,
267,
291,
423,
2384,
63,
1317,
275,
2498,
63,
1317,
267,
340,
1228,
8,
277,
423,
1113,
12,
2622,
1563,
57,
1156,
30113,
304,
288,
9243,
63,
705,
275,
291,
423,
362,
63,
10525,
63,
705,
342,
288,
340,
9243,
63,
705,
26,
355,
291,
14,
1188,
275,
1543,
83,
60,
78,
60,
78,
5,
83,
7,
450,
334,
1188,
12,
9243,
63,
705,
9,
267,
587,
26,
288,
291,
14,
1188,
275,
1245,
339,
347,
636,
495,
721,
277,
304,
267,
372,
291,
14,
1188,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
291,
14,
1188,
339,
347,
485,
362,
63,
705,
63,
1278,
63,
504,
63,
493,
8,
277,
12,
570,
63,
354,
12,
1004,
63,
1955,
304,
267,
1449,
267,
1803,
314,
1004,
315,
314,
570,
1314,
512,
3853,
795,
370,
314,
14581,
1125,
267,
2909,
12,
465,
5521,
465,
314,
1004,
22627,
652,
334,
692,
314,
1125,
8103,
440,
267,
4781,
641,
314,
1642,
1004,
395,
370,
5647,
1067,
370,
314,
1125,
14,
267,
1449,
398,
1347,
63,
604,
275,
2125,
267,
5071,
63,
604,
275,
2125,
398,
543,
1551,
8,
493,
63,
354,
12,
283,
82,
358,
465,
289,
26,
288,
2385,
275,
289,
14,
9684,
342,
953,
1347,
63,
604,
275,
2385,
59,
604,
63,
1955,
61,
288,
340,
1004,
63,
1955,
690,
378,
26,
355,
5071,
63,
604,
275,
2385,
59,
604,
63,
1955,
446,
413,
61,
398,
372,
334,
1375,
63,
604,
12,
5071,
63,
604,
9,
339,
347,
485,
362,
63,
10525,
63,
705,
8,
277,
304,
267,
1449,
267,
9138,
376,
909,
17290,
314,
2909,
402,
314,
1919,
315,
282,
570,
12,
372,
267,
16212,
2556,
12602,
652,
5893,
26,
8592,
627,
314,
1004,
1314,
18104,
314,
1125,
465,
5521,
465,
314,
1373,
22627,
652,
881,
627,
14486,
436,
25697,
295,
3700,
397,
367,
2863,
6302,
2552,
398,
982,
642,
1125,
1990,
2737,
543,
2498,
63,
1317,
29,
797,
12,
314,
17290,
402,
1564,
267,
365,
30581,
12,
465,
314,
570,
4072,
1443,
506,
18423,
334,
1873,
14,
12738,
666,
680,
267,
1449,
398,
1125,
63,
1188,
275,
2125,
398,
862,
26,
288,
334,
2164,
63,
493,
12,
1004,
63,
1955,
12,
1048,
63,
1955,
9,
275,
291,
423,
1113,
14,
362,
63,
3124,
63,
815,
342,
288,
1125,
63,
1188,
847,
18916,
63,
15717,
63,
25081,
51,
450,
334,
2164,
63,
493,
12,
1004,
63,
1955,
12,
1048,
63,
1955,
9,
288,
340,
2928,
63,
493,
440,
315,
19990,
875,
4206,
2650,
2975,
5971,
436,
291,
423,
2384,
63,
1317,
26,
355,
334,
1375,
63,
604,
12,
5071,
63,
604,
9,
275,
291,
423,
362,
63,
705,
63,
1278,
63,
504,
63,
493,
8,
2164,
63,
493,
12,
1004,
63,
1955,
446,
413,
9,
355,
340,
1347,
63,
604,
26,
490,
14489,
63,
604,
275,
1347,
63,
604,
14,
1814,
480,
3872,
7230,
490,
18800,
63,
604,
259,
275,
1689,
298,
627,
334,
761,
63,
1955,
13,
17,
430,
435,
18129,
2,
490,
1125,
63,
1188,
847,
2071,
83,
60,
78,
5,
83,
60,
78,
5,
83,
60,
78,
2,
450,
334,
5701,
63,
604,
14,
6735,
1062,
1347,
63,
604,
14,
6735,
1062,
18800,
63,
604,
9,
4951,
327,
2863,
1125,
15,
264,
3700,
425,
7907,
2348,
26,
490,
327,
1104,
367,
31791,
6802,
6617,
2385,
490,
340,
661,
91,
1445,
315,
1347,
63,
604,
436,
283,
4863,
7,
315,
1347,
63,
604,
9,
436,
661,
14381,
1445,
440,
315,
1347,
63,
604,
503,
3546,
3638,
2,
440,
315,
1347,
63,
604,
304,
717,
1125,
63,
1188,
847,
18916,
63,
21637,
63,
1734,
18654,
1149,
63,
23129,
63,
3170,
490,
327,
1104,
367,
2863,
2600,
27572,
4364,
490,
916,
7244,
3638,
2,
315,
14489,
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,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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
] |
royveshovda/pifog | source/piclient/sensorpi/sensor_runner.py | 2 | 4086 | import json
import time
import settings
from shared import common
from datetime import datetime
from uptime import boottime
handler = None
loudness_sensor_pin = 2
dht_sensor_pin = 4
def init():
global handler
if settings.is_fake():
from sensorpi import read_faker
handler = read_faker
else:
from sensorpi import read
handler = read
return
def customShadowCallback_Update(payload, responseStatus, token):
if responseStatus == "timeout":
print("Update request " + token + " time out!")
if responseStatus == "accepted":
payloadDict = json.loads(payload)
print("~~~~~~~~~~~~~~~~~~~~~~~")
print("Update request with token: " + token + " accepted!")
reported = payloadDict["state"]["reported"]
if "temperature" in reported:
print("temperature: " + str(payloadDict["state"]["reported"]["temperature"]))
if "humidity" in reported:
print("humidity: " + str(payloadDict["state"]["reported"]["humidity"]))
if "co2" in reported:
print("co2: " + str(payloadDict["state"]["reported"]["co2"]))
if "connected" in reported:
print("connected: " + str(payloadDict["state"]["reported"]["connected"]))
print("~~~~~~~~~~~~~~~~~~~~~~~\n\n")
if responseStatus == "rejected":
print("Update request " + token + " rejected!")
def should_read_co2(boot_time):
d2 = datetime.now()
d = d2 - boot_time
if d.total_seconds() > 200.0:
return True
else:
return False
def handle_command(client, message):
payload = message.payload.decode('utf-8')
print("Command received:")
print(payload)
#cmd = json.loads(payload)
#command = cmd["command"]
#cmd_id = cmd["id"]
#if command == "ping":
# common.send_pong(client, cmd_id, settings.topic_sensorpi_event)
def handle_notification(message):
print("Notification received: " + str(message.payload))
def on_message(client, userdata, msg):
if msg.topic == settings.topic_sensorpi_command:
handle_command(client, msg)
return
if msg.topic == settings.topic_sensorpi_notify:
handle_notification(msg)
return
print("Spam received: " + str(msg.payload))
def send_data(client, co2, temperature, humidity, loudness):
# Prepare our sensor data in JSON format.
payload = json.dumps({
"state": {
"reported": {
"co2": co2,
"temperature": temperature,
"humidity": humidity
}
}
})
client.shadowUpdate(payload, customShadowCallback_Update, 5)
def start():
time.sleep(20)
shadow, client = common.setup_aws_shadow_client(settings.aws_endpoint,
settings.aws_root_certificate,
settings.aws_private_key,
settings.aws_certificate,
settings.device_name)
JSONPayload = '{"state":{"reported":{"connected":"true"}}}'
client.shadowUpdate(JSONPayload, customShadowCallback_Update, 5)
handler.setup(dht_sensor_pin, loudness_sensor_pin)
d1 = datetime.min
boot_time = boottime()
should_read = False
try:
while True:
d2 = datetime.now()
d = d2 - d1
if d.total_seconds() > 10.0:
if (should_read == False):
should_read = should_read_co2(boot_time)
[co2, temperature, humidity, loudness] = handler.read_data(should_read)
send_data(client, co2, temperature, humidity, loudness)
d1 = d2
else:
time.sleep(1)
except KeyboardInterrupt:
JSONPayload = '{"state":{"reported":{"connected":"false"}}}'
client.shadowUpdate(JSONPayload, customShadowCallback_Update, 5)
shadow.disconnect()
handler.cleanup()
print('stopped')
def stop():
return
| apache-2.0 | [
646,
2022,
199,
646,
900,
199,
646,
2202,
199,
504,
5709,
492,
2863,
199,
504,
2197,
492,
2197,
199,
504,
1536,
521,
492,
8498,
521,
199,
199,
2232,
275,
488,
199,
320,
1181,
4171,
63,
8956,
63,
7751,
275,
499,
199,
68,
517,
63,
8956,
63,
7751,
275,
841,
199,
199,
318,
4205,
837,
272,
2288,
3016,
272,
340,
2202,
14,
374,
63,
3183,
837,
267,
687,
8778,
1038,
492,
1586,
63,
667,
2570,
267,
3016,
275,
1586,
63,
667,
2570,
272,
587,
26,
267,
687,
8778,
1038,
492,
1586,
267,
3016,
275,
1586,
272,
372,
421,
199,
318,
3537,
23574,
2806,
63,
4152,
8,
4749,
12,
1177,
3694,
12,
1526,
304,
272,
340,
1177,
3694,
508,
298,
2593,
582,
267,
870,
480,
4152,
1056,
298,
435,
1526,
435,
298,
900,
734,
9124,
272,
340,
1177,
3694,
508,
298,
16121,
582,
267,
4886,
2141,
275,
2022,
14,
3640,
8,
4749,
9,
267,
870,
480,
9753,
2878,
23597,
531,
267,
870,
480,
4152,
1056,
543,
1526,
26,
298,
435,
1526,
435,
298,
10226,
9124,
267,
14581,
275,
4886,
2141,
905,
929,
6611,
1155,
1376,
937,
267,
340,
298,
12954,
2,
315,
14581,
26,
288,
870,
480,
12954,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
12954,
13045,
267,
340,
298,
31812,
2,
315,
14581,
26,
288,
870,
480,
31812,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
31812,
13045,
267,
340,
298,
331,
18,
2,
315,
14581,
26,
288,
870,
480,
331,
18,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
331,
18,
13045,
267,
340,
298,
7113,
2,
315,
14581,
26,
288,
870,
480,
7113,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
7113,
13045,
398,
870,
480,
9753,
2878,
23597,
60,
78,
60,
78,
531,
272,
340,
1177,
3694,
508,
298,
24054,
582,
267,
870,
480,
4152,
1056,
298,
435,
1526,
435,
298,
18935,
9124,
421,
199,
318,
1077,
63,
739,
63,
331,
18,
8,
4930,
63,
521,
304,
272,
366,
18,
275,
2197,
14,
2131,
342,
272,
366,
275,
366,
18,
446,
8498,
63,
521,
272,
340,
366,
14,
2923,
63,
4515,
342,
690,
1926,
14,
16,
26,
267,
372,
715,
272,
587,
26,
267,
372,
756,
421,
199,
318,
2429,
63,
1531,
8,
1258,
12,
1245,
304,
272,
4886,
275,
1245,
14,
4749,
14,
2708,
360,
1624,
13,
24,
358,
272,
870,
480,
3110,
3086,
9107,
272,
870,
8,
4749,
9,
339,
327,
1760,
275,
2022,
14,
3640,
8,
4749,
9,
272,
327,
1531,
275,
2088,
905,
1531,
937,
272,
327,
1760,
63,
344,
275,
2088,
905,
344,
937,
272,
327,
692,
1414,
508,
298,
4073,
582,
272,
327,
259,
2863,
14,
2254,
63,
26992,
8,
1258,
12,
2088,
63,
344,
12,
2202,
14,
5746,
63,
8956,
1038,
63,
1430,
9,
421,
199,
318,
2429,
63,
6761,
8,
1188,
304,
272,
870,
480,
11598,
3086,
26,
298,
435,
620,
8,
1188,
14,
4749,
430,
421,
199,
318,
641,
63,
1188,
8,
1258,
12,
922,
576,
12,
1499,
304,
272,
340,
1499,
14,
5746,
508,
2202,
14,
5746,
63,
8956,
1038,
63,
1531,
26,
267,
2429,
63,
1531,
8,
1258,
12,
1499,
9,
267,
372,
272,
340,
1499,
14,
5746,
508,
2202,
14,
5746,
63,
8956,
1038,
63,
6814,
26,
267,
2429,
63,
6761,
8,
1328,
9,
267,
372,
272,
870,
480,
12739,
77,
3086,
26,
298,
435,
620,
8,
1328,
14,
4749,
430,
421,
199,
318,
3222,
63,
576,
8,
1258,
12,
512,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
304,
272,
327,
17008,
4154,
8778,
666,
315,
4840,
1475,
14,
272,
4886,
275,
2022,
14,
4180,
2561,
267,
298,
929,
582,
469,
288,
298,
1155,
1376,
582,
469,
355,
298,
331,
18,
582,
512,
18,
12,
355,
298,
12954,
582,
14843,
12,
355,
298,
31812,
582,
394,
21704,
288,
789,
267,
789,
272,
3828,
272,
1890,
14,
14714,
4152,
8,
4749,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
421,
199,
318,
1343,
837,
272,
900,
14,
4532,
8,
1165,
9,
339,
15084,
12,
1890,
275,
2863,
14,
2758,
63,
7231,
63,
14714,
63,
1258,
8,
1751,
14,
7231,
63,
6520,
12,
8105,
2202,
14,
7231,
63,
1231,
63,
6999,
12,
8105,
2202,
14,
7231,
63,
4239,
63,
498,
12,
8105,
2202,
14,
7231,
63,
6999,
12,
8105,
2202,
14,
1782,
63,
354,
9,
339,
4840,
17215,
275,
17137,
929,
18517,
1155,
1376,
18517,
7113,
5122,
2052,
3570,
4863,
7,
272,
1890,
14,
14714,
4152,
8,
6243,
17215,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
339,
3016,
14,
2758,
8,
68,
517,
63,
8956,
63,
7751,
12,
560,
1181,
4171,
63,
8956,
63,
7751,
9,
272,
366,
17,
275,
2197,
14,
827,
272,
8498,
63,
521,
275,
8498,
521,
342,
272,
1077,
63,
739,
275,
756,
272,
862,
26,
267,
1830,
715,
26,
288,
366,
18,
275,
2197,
14,
2131,
342,
288,
366,
275,
366,
18,
446,
366,
17,
288,
340,
366,
14,
2923,
63,
4515,
342,
690,
1616,
14,
16,
26,
355,
340,
334,
5626,
63,
739,
508,
756,
304,
490,
1077,
63,
739,
275,
1077,
63,
739,
63,
331,
18,
8,
4930,
63,
521,
9,
355,
359,
331,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
61,
275,
3016,
14,
739,
63,
576,
8,
5626,
63,
739,
9,
355,
3222,
63,
576,
8,
1258,
12,
512,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
9,
355,
366,
17,
275,
366,
18,
288,
587,
26,
355,
900,
14,
4532,
8,
17,
9,
272,
871,
13483,
26,
267,
4840,
17215,
275,
17137,
929,
18517,
1155,
1376,
18517,
7113,
5122,
3910,
3570,
4863,
7,
267,
1890,
14,
14714,
4152,
8,
6243,
17215,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
267,
15084,
14,
10673,
342,
267,
3016,
14,
7661,
342,
267,
870,
360,
14661,
358,
421,
199,
318,
3631,
837,
272,
372,
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
] | [
2022,
199,
646,
900,
199,
646,
2202,
199,
504,
5709,
492,
2863,
199,
504,
2197,
492,
2197,
199,
504,
1536,
521,
492,
8498,
521,
199,
199,
2232,
275,
488,
199,
320,
1181,
4171,
63,
8956,
63,
7751,
275,
499,
199,
68,
517,
63,
8956,
63,
7751,
275,
841,
199,
199,
318,
4205,
837,
272,
2288,
3016,
272,
340,
2202,
14,
374,
63,
3183,
837,
267,
687,
8778,
1038,
492,
1586,
63,
667,
2570,
267,
3016,
275,
1586,
63,
667,
2570,
272,
587,
26,
267,
687,
8778,
1038,
492,
1586,
267,
3016,
275,
1586,
272,
372,
421,
199,
318,
3537,
23574,
2806,
63,
4152,
8,
4749,
12,
1177,
3694,
12,
1526,
304,
272,
340,
1177,
3694,
508,
298,
2593,
582,
267,
870,
480,
4152,
1056,
298,
435,
1526,
435,
298,
900,
734,
9124,
272,
340,
1177,
3694,
508,
298,
16121,
582,
267,
4886,
2141,
275,
2022,
14,
3640,
8,
4749,
9,
267,
870,
480,
9753,
2878,
23597,
531,
267,
870,
480,
4152,
1056,
543,
1526,
26,
298,
435,
1526,
435,
298,
10226,
9124,
267,
14581,
275,
4886,
2141,
905,
929,
6611,
1155,
1376,
937,
267,
340,
298,
12954,
2,
315,
14581,
26,
288,
870,
480,
12954,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
12954,
13045,
267,
340,
298,
31812,
2,
315,
14581,
26,
288,
870,
480,
31812,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
31812,
13045,
267,
340,
298,
331,
18,
2,
315,
14581,
26,
288,
870,
480,
331,
18,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
331,
18,
13045,
267,
340,
298,
7113,
2,
315,
14581,
26,
288,
870,
480,
7113,
26,
298,
435,
620,
8,
4749,
2141,
905,
929,
6611,
1155,
1376,
6611,
7113,
13045,
398,
870,
480,
9753,
2878,
23597,
60,
78,
60,
78,
531,
272,
340,
1177,
3694,
508,
298,
24054,
582,
267,
870,
480,
4152,
1056,
298,
435,
1526,
435,
298,
18935,
9124,
421,
199,
318,
1077,
63,
739,
63,
331,
18,
8,
4930,
63,
521,
304,
272,
366,
18,
275,
2197,
14,
2131,
342,
272,
366,
275,
366,
18,
446,
8498,
63,
521,
272,
340,
366,
14,
2923,
63,
4515,
342,
690,
1926,
14,
16,
26,
267,
372,
715,
272,
587,
26,
267,
372,
756,
421,
199,
318,
2429,
63,
1531,
8,
1258,
12,
1245,
304,
272,
4886,
275,
1245,
14,
4749,
14,
2708,
360,
1624,
13,
24,
358,
272,
870,
480,
3110,
3086,
9107,
272,
870,
8,
4749,
9,
339,
327,
1760,
275,
2022,
14,
3640,
8,
4749,
9,
272,
327,
1531,
275,
2088,
905,
1531,
937,
272,
327,
1760,
63,
344,
275,
2088,
905,
344,
937,
272,
327,
692,
1414,
508,
298,
4073,
582,
272,
327,
259,
2863,
14,
2254,
63,
26992,
8,
1258,
12,
2088,
63,
344,
12,
2202,
14,
5746,
63,
8956,
1038,
63,
1430,
9,
421,
199,
318,
2429,
63,
6761,
8,
1188,
304,
272,
870,
480,
11598,
3086,
26,
298,
435,
620,
8,
1188,
14,
4749,
430,
421,
199,
318,
641,
63,
1188,
8,
1258,
12,
922,
576,
12,
1499,
304,
272,
340,
1499,
14,
5746,
508,
2202,
14,
5746,
63,
8956,
1038,
63,
1531,
26,
267,
2429,
63,
1531,
8,
1258,
12,
1499,
9,
267,
372,
272,
340,
1499,
14,
5746,
508,
2202,
14,
5746,
63,
8956,
1038,
63,
6814,
26,
267,
2429,
63,
6761,
8,
1328,
9,
267,
372,
272,
870,
480,
12739,
77,
3086,
26,
298,
435,
620,
8,
1328,
14,
4749,
430,
421,
199,
318,
3222,
63,
576,
8,
1258,
12,
512,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
304,
272,
327,
17008,
4154,
8778,
666,
315,
4840,
1475,
14,
272,
4886,
275,
2022,
14,
4180,
2561,
267,
298,
929,
582,
469,
288,
298,
1155,
1376,
582,
469,
355,
298,
331,
18,
582,
512,
18,
12,
355,
298,
12954,
582,
14843,
12,
355,
298,
31812,
582,
394,
21704,
288,
789,
267,
789,
272,
3828,
272,
1890,
14,
14714,
4152,
8,
4749,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
421,
199,
318,
1343,
837,
272,
900,
14,
4532,
8,
1165,
9,
339,
15084,
12,
1890,
275,
2863,
14,
2758,
63,
7231,
63,
14714,
63,
1258,
8,
1751,
14,
7231,
63,
6520,
12,
8105,
2202,
14,
7231,
63,
1231,
63,
6999,
12,
8105,
2202,
14,
7231,
63,
4239,
63,
498,
12,
8105,
2202,
14,
7231,
63,
6999,
12,
8105,
2202,
14,
1782,
63,
354,
9,
339,
4840,
17215,
275,
17137,
929,
18517,
1155,
1376,
18517,
7113,
5122,
2052,
3570,
4863,
7,
272,
1890,
14,
14714,
4152,
8,
6243,
17215,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
339,
3016,
14,
2758,
8,
68,
517,
63,
8956,
63,
7751,
12,
560,
1181,
4171,
63,
8956,
63,
7751,
9,
272,
366,
17,
275,
2197,
14,
827,
272,
8498,
63,
521,
275,
8498,
521,
342,
272,
1077,
63,
739,
275,
756,
272,
862,
26,
267,
1830,
715,
26,
288,
366,
18,
275,
2197,
14,
2131,
342,
288,
366,
275,
366,
18,
446,
366,
17,
288,
340,
366,
14,
2923,
63,
4515,
342,
690,
1616,
14,
16,
26,
355,
340,
334,
5626,
63,
739,
508,
756,
304,
490,
1077,
63,
739,
275,
1077,
63,
739,
63,
331,
18,
8,
4930,
63,
521,
9,
355,
359,
331,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
61,
275,
3016,
14,
739,
63,
576,
8,
5626,
63,
739,
9,
355,
3222,
63,
576,
8,
1258,
12,
512,
18,
12,
14843,
12,
394,
21704,
12,
560,
1181,
4171,
9,
355,
366,
17,
275,
366,
18,
288,
587,
26,
355,
900,
14,
4532,
8,
17,
9,
272,
871,
13483,
26,
267,
4840,
17215,
275,
17137,
929,
18517,
1155,
1376,
18517,
7113,
5122,
3910,
3570,
4863,
7,
267,
1890,
14,
14714,
4152,
8,
6243,
17215,
12,
3537,
23574,
2806,
63,
4152,
12,
959,
9,
267,
15084,
14,
10673,
342,
267,
3016,
14,
7661,
342,
267,
870,
360,
14661,
358,
421,
199,
318,
3631,
837,
272,
372,
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,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
] |
Kelfast/mamba-framework | mamba/test/test_unittest.py | 3 | 4197 |
# Copyright (c) 2012 ~ 2014 - Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""Unit tests for unittesting module helper
"""
import os
from storm.store import Store
from twisted.trial import unittest
from twisted.python.threadpool import ThreadPool
from mamba.utils import config
from mamba.application.model import Model
from mamba.unittest import database_helpers
from mamba.test.test_model import DummyModel
class DatabaseHelpersTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
Model.database = database_helpers.Database()
def test_testable_database_engine_native(self):
db = database_helpers.TestableDatabase()
self.assertEqual(db.engine, database_helpers.ENGINE.NATIVE)
def test_initialize_engine_native(self):
config.Database('../mamba/test/dummy_app/config/database.json')
current_dir = os.getcwd()
os.chdir('../mamba/test/dummy_app')
db = database_helpers.TestableDatabase()
store = db.store()
self.assertEqual(store.get_database()._filename, 'db/dummy.db')
os.chdir(current_dir)
def test_testable_database_engine_inmemory(self):
engine = database_helpers.ENGINE.INMEMORY
db = database_helpers.TestableDatabase(engine)
self.assertEqual(db.engine, database_helpers.ENGINE.INMEMORY)
def test_initialize_engine_memory(self):
engine = database_helpers.ENGINE.INMEMORY
db = database_helpers.TestableDatabase(engine)
store = db.store()
self.assertEqual(store.get_database()._filename, ':memory:')
store.close()
def test_testable_database_engine_persistent(self):
engine = database_helpers.ENGINE.PERSISTENT
db = database_helpers.TestableDatabase(engine)
self.assertEqual(db.engine, database_helpers.ENGINE.PERSISTENT)
def test_initialize_engine_persistent(self):
engine = database_helpers.ENGINE.PERSISTENT
db = database_helpers.TestableDatabase(engine)
uri = database_helpers.global_zstorm.get_default_uris()['mamba'].split(
'?foreign_keys=1'
)[0].split('sqlite:')[1]
store = db.store()
self.assertEqual(store.get_database()._filename, uri)
def test_prepare_model_for_test(self):
model = Model()
self.assertEqual(model.database.__class__, database_helpers.Database)
database_helpers.prepare_model_for_test(model)
self.assertEqual(
model.database.__class__, database_helpers.TestableDatabase)
def test_prepate_model_for_test_using_class(self):
self.assertEqual(Model.database.__class__, database_helpers.Database)
database_helpers.prepare_model_for_test(Model)
self.assertEqual(
Model.database.__class__, database_helpers.TestableDatabase)
def test_prepare_model_for_test_using_real_model(self):
self.assertEqual(
DummyModel.database.__class__, database_helpers.Database)
database_helpers.prepare_model_for_test(DummyModel)
self.assertEqual(
DummyModel.database.__class__, database_helpers.TestableDatabase)
def test_database_is_started_defacto(self):
config.Database('../mamba/test/dummy_app/config/database.json')
model = Model()
database_helpers.prepare_model_for_test(model)
self.assertTrue(model.database.started)
def test_database_stop(self):
model = Model()
database_helpers.prepare_model_for_test(model)
self.assertTrue(model.database.started)
model.database.stop()
self.assertFalse(model.database.started)
def test_store_return_valid_store(self):
model = Model()
database_helpers.prepare_model_for_test(model)
store = model.database.store()
self.assertIsInstance(store, Store)
def test_model_transactor_uses_dummy_thread_pool(self):
model = Model()
self.assertIsInstance(model.transactor._threadpool, ThreadPool)
database_helpers.prepare_model_for_test(model)
self.assertIsInstance(
model.transactor._threadpool, database_helpers.DummyThreadPool)
| gpl-3.0 | [
199,
3,
1898,
334,
67,
9,
6029,
6146,
6927,
446,
593,
22707,
24569,
736,
665,
79,
22707,
14,
20290,
736,
32,
1114,
14,
2319,
70,
14,
1308,
30,
199,
3,
1666,
5113,
367,
1655,
2436,
199,
199,
624,
5072,
2295,
367,
2882,
316,
859,
5922,
199,
624,
199,
199,
646,
747,
199,
199,
504,
410,
1025,
14,
1617,
492,
13874,
199,
504,
7390,
14,
14443,
492,
2882,
199,
504,
7390,
14,
1548,
14,
2671,
2293,
492,
11086,
5453,
199,
199,
504,
333,
14310,
14,
1208,
492,
1101,
199,
504,
333,
14310,
14,
3578,
14,
1238,
492,
5822,
199,
504,
333,
14310,
14,
2796,
492,
3050,
63,
7546,
199,
504,
333,
14310,
14,
396,
14,
396,
63,
1238,
492,
9762,
1685,
421,
199,
533,
8692,
4433,
26935,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
986,
339,
347,
6766,
8,
277,
304,
267,
5822,
14,
4659,
275,
3050,
63,
7546,
14,
7243,
342,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
6106,
8,
277,
304,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
342,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
46,
14277,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
6106,
8,
277,
304,
267,
1101,
14,
7243,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
15,
888,
15,
4659,
14,
1001,
358,
267,
1453,
63,
694,
275,
747,
14,
9458,
342,
267,
747,
14,
8563,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
358,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
342,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
283,
697,
15,
5869,
14,
697,
358,
267,
747,
14,
8563,
8,
1818,
63,
694,
9,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
262,
4844,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
4844,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
7596,
4844,
10993,
267,
3877,
14,
1600,
342,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
18539,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
18539,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
5108,
275,
3050,
63,
7546,
14,
2966,
63,
90,
26949,
14,
362,
63,
885,
63,
17656,
12047,
391,
887,
65,
2278,
1294,
8,
288,
8720,
6846,
63,
1612,
29,
17,
7,
267,
29688,
16,
1055,
1294,
360,
10659,
26,
5832,
17,
61,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
5108,
9,
339,
347,
511,
63,
6726,
63,
1238,
63,
509,
63,
396,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
291,
14,
629,
8,
1238,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
629,
8,
288,
1402,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
10837,
323,
63,
1238,
63,
509,
63,
396,
63,
4941,
63,
533,
8,
277,
304,
267,
291,
14,
629,
8,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1685,
9,
267,
291,
14,
629,
8,
288,
5822,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
6726,
63,
1238,
63,
509,
63,
396,
63,
4941,
63,
3093,
63,
1238,
8,
277,
304,
267,
291,
14,
629,
8,
288,
9762,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
11324,
1685,
9,
267,
291,
14,
629,
8,
288,
9762,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
4659,
63,
374,
63,
8924,
63,
318,
2442,
79,
8,
277,
304,
267,
1101,
14,
7243,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
15,
888,
15,
4659,
14,
1001,
358,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
1815,
8,
1238,
14,
4659,
14,
8924,
9,
339,
347,
511,
63,
4659,
63,
2379,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
1815,
8,
1238,
14,
4659,
14,
8924,
9,
267,
1402,
14,
4659,
14,
2379,
342,
267,
291,
14,
3334,
8,
1238,
14,
4659,
14,
8924,
9,
339,
347,
511,
63,
1617,
63,
1107,
63,
1078,
63,
1617,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
3877,
275,
1402,
14,
4659,
14,
1617,
342,
267,
291,
14,
6926,
8,
1617,
12,
13874,
9,
339,
347,
511,
63,
1238,
63,
1515,
5021,
63,
5589,
63,
5869,
63,
2671,
63,
2293,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
291,
14,
6926,
8,
1238,
14,
1515,
5021,
423,
2671,
2293,
12,
11086,
5453,
9
] | [
3,
1898,
334,
67,
9,
6029,
6146,
6927,
446,
593,
22707,
24569,
736,
665,
79,
22707,
14,
20290,
736,
32,
1114,
14,
2319,
70,
14,
1308,
30,
199,
3,
1666,
5113,
367,
1655,
2436,
199,
199,
624,
5072,
2295,
367,
2882,
316,
859,
5922,
199,
624,
199,
199,
646,
747,
199,
199,
504,
410,
1025,
14,
1617,
492,
13874,
199,
504,
7390,
14,
14443,
492,
2882,
199,
504,
7390,
14,
1548,
14,
2671,
2293,
492,
11086,
5453,
199,
199,
504,
333,
14310,
14,
1208,
492,
1101,
199,
504,
333,
14310,
14,
3578,
14,
1238,
492,
5822,
199,
504,
333,
14310,
14,
2796,
492,
3050,
63,
7546,
199,
504,
333,
14310,
14,
396,
14,
396,
63,
1238,
492,
9762,
1685,
421,
199,
533,
8692,
4433,
26935,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
986,
339,
347,
6766,
8,
277,
304,
267,
5822,
14,
4659,
275,
3050,
63,
7546,
14,
7243,
342,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
6106,
8,
277,
304,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
342,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
46,
14277,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
6106,
8,
277,
304,
267,
1101,
14,
7243,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
15,
888,
15,
4659,
14,
1001,
358,
267,
1453,
63,
694,
275,
747,
14,
9458,
342,
267,
747,
14,
8563,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
358,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
342,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
283,
697,
15,
5869,
14,
697,
358,
267,
747,
14,
8563,
8,
1818,
63,
694,
9,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
262,
4844,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
4844,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
568,
19495,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
7596,
4844,
10993,
267,
3877,
14,
1600,
342,
339,
347,
511,
63,
396,
461,
63,
4659,
63,
3908,
63,
18539,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
291,
14,
629,
8,
697,
14,
3908,
12,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
9,
339,
347,
511,
63,
8489,
63,
3908,
63,
18539,
8,
277,
304,
267,
6869,
275,
3050,
63,
7546,
14,
15956,
14,
4227,
29367,
1309,
267,
1592,
275,
3050,
63,
7546,
14,
774,
461,
7243,
8,
3908,
9,
267,
5108,
275,
3050,
63,
7546,
14,
2966,
63,
90,
26949,
14,
362,
63,
885,
63,
17656,
12047,
391,
887,
65,
2278,
1294,
8,
288,
8720,
6846,
63,
1612,
29,
17,
7,
267,
29688,
16,
1055,
1294,
360,
10659,
26,
5832,
17,
61,
267,
3877,
275,
1592,
14,
1617,
342,
267,
291,
14,
629,
8,
1617,
14,
362,
63,
4659,
19050,
1501,
12,
5108,
9,
339,
347,
511,
63,
6726,
63,
1238,
63,
509,
63,
396,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
291,
14,
629,
8,
1238,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
629,
8,
288,
1402,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
10837,
323,
63,
1238,
63,
509,
63,
396,
63,
4941,
63,
533,
8,
277,
304,
267,
291,
14,
629,
8,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1685,
9,
267,
291,
14,
629,
8,
288,
5822,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
6726,
63,
1238,
63,
509,
63,
396,
63,
4941,
63,
3093,
63,
1238,
8,
277,
304,
267,
291,
14,
629,
8,
288,
9762,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
7243,
9,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
11324,
1685,
9,
267,
291,
14,
629,
8,
288,
9762,
1685,
14,
4659,
855,
533,
3108,
3050,
63,
7546,
14,
774,
461,
7243,
9,
339,
347,
511,
63,
4659,
63,
374,
63,
8924,
63,
318,
2442,
79,
8,
277,
304,
267,
1101,
14,
7243,
24592,
391,
887,
65,
15,
396,
15,
5869,
63,
571,
15,
888,
15,
4659,
14,
1001,
358,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
1815,
8,
1238,
14,
4659,
14,
8924,
9,
339,
347,
511,
63,
4659,
63,
2379,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
291,
14,
1815,
8,
1238,
14,
4659,
14,
8924,
9,
267,
1402,
14,
4659,
14,
2379,
342,
267,
291,
14,
3334,
8,
1238,
14,
4659,
14,
8924,
9,
339,
347,
511,
63,
1617,
63,
1107,
63,
1078,
63,
1617,
8,
277,
304,
267,
1402,
275,
5822,
342,
267,
3050,
63,
7546,
14,
6726,
63,
1238,
63,
509,
63,
396,
8,
1238,
9,
267,
3877,
275,
1402,
14,
4659,
14,
1617,
342,
267,
291,
14,
6926,
8,
1617,
12,
13874,
9,
339,
347,
511,
63,
1238,
63,
1515,
5021,
63,
5589,
63,
5869,
63,
2671,
63,
2293,
8,
277,
304,
267,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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
] |
fidomason/kbengine | kbe/res/scripts/common/Lib/distutils/dir_util.py | 59 | 7780 | """distutils.dir_util
Utility functions for manipulating directories and directory trees."""
import os
import errno
from distutils.errors import DistutilsFileError, DistutilsInternalError
from distutils import log
# cache for by mkpath() -- in addition to cheapening redundant calls,
# eliminates redundant "creating /foo/bar/baz" messages in dry-run mode
_path_created = {}
# I don't use os.makedirs because a) it's new to Python 1.5.2, and
# b) it blows up if the directory already exists (I want to silently
# succeed in that case).
def mkpath(name, mode=0o777, verbose=1, dry_run=0):
"""Create a directory and any missing ancestor directories.
If the directory already exists (or if 'name' is the empty string, which
means the current directory, which of course exists), then do nothing.
Raise DistutilsFileError if unable to create some directory along the way
(eg. some sub-path exists, but is a file rather than a directory).
If 'verbose' is true, print a one-line summary of each mkdir to stdout.
Return the list of directories actually created.
"""
global _path_created
# Detect a common bug -- name is None
if not isinstance(name, str):
raise DistutilsInternalError(
"mkpath: 'name' must be a string (got %r)" % (name,))
# XXX what's the better way to handle verbosity? print as we create
# each directory in the path (the current behaviour), or only announce
# the creation of the whole path? (quite easy to do the latter since
# we're not using a recursive algorithm)
name = os.path.normpath(name)
created_dirs = []
if os.path.isdir(name) or name == '':
return created_dirs
if _path_created.get(os.path.abspath(name)):
return created_dirs
(head, tail) = os.path.split(name)
tails = [tail] # stack of lone dirs to create
while head and tail and not os.path.isdir(head):
(head, tail) = os.path.split(head)
tails.insert(0, tail) # push next higher dir onto stack
# now 'head' contains the deepest directory that already exists
# (that is, the child of 'head' in 'name' is the highest directory
# that does *not* exist)
for d in tails:
#print "head = %s, d = %s: " % (head, d),
head = os.path.join(head, d)
abs_head = os.path.abspath(head)
if _path_created.get(abs_head):
continue
if verbose >= 1:
log.info("creating %s", head)
if not dry_run:
try:
os.mkdir(head, mode)
except OSError as exc:
if not (exc.errno == errno.EEXIST and os.path.isdir(head)):
raise DistutilsFileError(
"could not create '%s': %s" % (head, exc.args[-1]))
created_dirs.append(head)
_path_created[abs_head] = 1
return created_dirs
def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
"""Create all the empty directories under 'base_dir' needed to put 'files'
there.
'base_dir' is just the a name of a directory which doesn't necessarily
exist yet; 'files' is a list of filenames to be interpreted relative to
'base_dir'. 'base_dir' + the directory portion of every file in 'files'
will be created if it doesn't already exist. 'mode', 'verbose' and
'dry_run' flags are as for 'mkpath()'.
"""
# First get the list of directories to create
need_dir = set()
for file in files:
need_dir.add(os.path.join(base_dir, os.path.dirname(file)))
# Now create them
for dir in sorted(need_dir):
mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, update=0, verbose=1, dry_run=0):
"""Copy an entire directory tree 'src' to a new location 'dst'.
Both 'src' and 'dst' must be directory names. If 'src' is not a
directory, raise DistutilsFileError. If 'dst' does not exist, it is
created with 'mkpath()'. The end result of the copy is that every
file in 'src' is copied to 'dst', and directories under 'src' are
recursively copied to 'dst'. Return the list of files that were
copied or might have been copied, using their output name. The
return value is unaffected by 'update' or 'dry_run': it is simply
the list of all files under 'src', with the names changed to be
under 'dst'.
'preserve_mode' and 'preserve_times' are the same as for
'copy_file'; note that they only apply to regular files, not to
directories. If 'preserve_symlinks' is true, symlinks will be
copied as symlinks (on platforms that support them!); otherwise
(the default), the destination of the symlink will be copied.
'update' and 'verbose' are the same as for 'copy_file'.
"""
from distutils.file_util import copy_file
if not dry_run and not os.path.isdir(src):
raise DistutilsFileError(
"cannot copy tree '%s': not a directory" % src)
try:
names = os.listdir(src)
except OSError as e:
if dry_run:
names = []
else:
raise DistutilsFileError(
"error listing files in '%s': %s" % (src, e.strerror))
if not dry_run:
mkpath(dst, verbose=verbose)
outputs = []
for n in names:
src_name = os.path.join(src, n)
dst_name = os.path.join(dst, n)
if n.startswith('.nfs'):
# skip NFS rename files
continue
if preserve_symlinks and os.path.islink(src_name):
link_dest = os.readlink(src_name)
if verbose >= 1:
log.info("linking %s -> %s", dst_name, link_dest)
if not dry_run:
os.symlink(link_dest, dst_name)
outputs.append(dst_name)
elif os.path.isdir(src_name):
outputs.extend(
copy_tree(src_name, dst_name, preserve_mode,
preserve_times, preserve_symlinks, update,
verbose=verbose, dry_run=dry_run))
else:
copy_file(src_name, dst_name, preserve_mode,
preserve_times, update, verbose=verbose,
dry_run=dry_run)
outputs.append(dst_name)
return outputs
def _build_cmdtuple(path, cmdtuples):
"""Helper for remove_tree()."""
for f in os.listdir(path):
real_f = os.path.join(path,f)
if os.path.isdir(real_f) and not os.path.islink(real_f):
_build_cmdtuple(real_f, cmdtuples)
else:
cmdtuples.append((os.remove, real_f))
cmdtuples.append((os.rmdir, path))
def remove_tree(directory, verbose=1, dry_run=0):
"""Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
"""
global _path_created
if verbose >= 1:
log.info("removing '%s' (and everything under it)", directory)
if dry_run:
return
cmdtuples = []
_build_cmdtuple(directory, cmdtuples)
for cmd in cmdtuples:
try:
cmd[0](cmd[1])
# remove dir from cache if it's already there
abspath = os.path.abspath(cmd[1])
if abspath in _path_created:
del _path_created[abspath]
except OSError as exc:
log.warn("error removing %s: %s", directory, exc)
def ensure_relative(path):
"""Take the full path 'path', and make it a relative path.
This is useful to make 'path' the second argument to os.path.join().
"""
drive, path = os.path.splitdrive(path)
if path[0:1] == os.sep:
path = drive + path[1:]
return path
| lgpl-3.0 | [
624,
13350,
14,
694,
63,
1974,
199,
199,
17505,
3423,
367,
13335,
20529,
6602,
436,
2082,
14416,
1041,
199,
199,
646,
747,
199,
646,
7554,
199,
504,
7065,
14,
2550,
492,
12577,
25212,
12,
12577,
8405,
547,
199,
504,
7065,
492,
943,
199,
199,
3,
2581,
367,
701,
9199,
515,
342,
1553,
315,
10234,
370,
286,
12492,
287,
316,
22649,
4882,
12,
199,
3,
20714,
2335,
22649,
298,
20358,
1182,
1421,
15,
1700,
15,
6185,
2,
3788,
315,
9951,
13,
1065,
818,
199,
63,
515,
63,
3966,
275,
1052,
199,
199,
3,
473,
2793,
1133,
675,
747,
14,
8347,
2952,
282,
9,
652,
1159,
892,
370,
2018,
413,
14,
21,
14,
18,
12,
436,
199,
3,
330,
9,
652,
28511,
83,
1536,
340,
314,
2082,
2575,
3495,
334,
41,
2934,
370,
18030,
199,
3,
17961,
315,
626,
1930,
680,
199,
318,
9199,
515,
8,
354,
12,
818,
29,
16,
79,
11956,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
2499,
282,
2082,
436,
1263,
4124,
18432,
6602,
14,
339,
982,
314,
2082,
2575,
3495,
334,
269,
340,
283,
354,
7,
365,
314,
2701,
1059,
12,
1314,
272,
4910,
314,
1453,
2082,
12,
1314,
402,
2518,
3495,
395,
2066,
886,
6548,
14,
272,
14771,
12577,
25212,
340,
17329,
370,
1218,
2005,
2082,
3180,
314,
4340,
272,
334,
5902,
14,
2005,
1007,
13,
515,
3495,
12,
1325,
365,
282,
570,
7830,
2419,
282,
2082,
680,
272,
982,
283,
3832,
7,
365,
2549,
12,
870,
282,
1373,
13,
604,
6212,
402,
1924,
20366,
370,
3839,
14,
272,
1432,
314,
769,
402,
6602,
5965,
2737,
14,
272,
408,
339,
2288,
485,
515,
63,
3966,
339,
327,
30577,
282,
2863,
6519,
1553,
536,
365,
488,
272,
340,
440,
1228,
8,
354,
12,
620,
304,
267,
746,
12577,
8405,
547,
8,
1598,
298,
3880,
515,
26,
283,
354,
7,
1471,
506,
282,
1059,
334,
7808,
450,
82,
2924,
450,
334,
354,
4641,
339,
327,
5787,
4052,
1159,
314,
8034,
4340,
370,
2429,
8661,
31,
870,
465,
781,
1218,
272,
327,
1924,
2082,
315,
314,
931,
334,
1589,
1453,
13942,
395,
503,
1454,
28136,
272,
327,
314,
7143,
402,
314,
8852,
931,
31,
334,
783,
266,
8837,
370,
886,
314,
19045,
3967,
272,
327,
781,
3984,
440,
1808,
282,
9133,
5563,
9,
339,
536,
275,
747,
14,
515,
14,
9267,
8,
354,
9,
272,
2737,
63,
3220,
275,
942,
272,
340,
747,
14,
515,
14,
6027,
8,
354,
9,
503,
536,
508,
8061,
267,
372,
2737,
63,
3220,
272,
340,
485,
515,
63,
3966,
14,
362,
8,
736,
14,
515,
14,
4832,
8,
354,
2298,
267,
372,
2737,
63,
3220,
339,
334,
2993,
12,
9483,
9,
275,
747,
14,
515,
14,
1294,
8,
354,
9,
272,
9483,
83,
275,
359,
1521,
61,
10473,
327,
3464,
402,
634,
368,
7606,
370,
1218,
339,
1830,
4854,
436,
9483,
436,
440,
747,
14,
515,
14,
6027,
8,
2993,
304,
267,
334,
2993,
12,
9483,
9,
275,
747,
14,
515,
14,
1294,
8,
2993,
9,
267,
9483,
83,
14,
3176,
8,
16,
12,
9483,
9,
3515,
327,
6675,
2163,
10948,
2935,
14602,
3464,
339,
327,
3063,
283,
2993,
7,
3509,
314,
27646,
321,
270,
2082,
626,
2575,
3495,
272,
327,
334,
9099,
365,
12,
314,
1982,
402,
283,
2993,
7,
315,
283,
354,
7,
365,
314,
15356,
2082,
272,
327,
626,
1630,
627,
1397,
10,
2187,
9,
272,
367,
366,
315,
9483,
83,
26,
267,
327,
1361,
298,
2993,
275,
450,
83,
12,
366,
275,
450,
83,
26,
298,
450,
334,
2993,
12,
366,
395,
267,
4854,
275,
747,
14,
515,
14,
904,
8,
2993,
12,
366,
9,
267,
2853,
63,
2993,
275,
747,
14,
515,
14,
4832,
8,
2993,
9,
398,
340,
485,
515,
63,
3966,
14,
362,
8,
2101,
63,
2993,
304,
288,
1980,
398,
340,
3376,
2356,
413,
26,
288,
943,
14,
815,
480,
20358,
450,
83,
401,
4854,
9,
398,
340,
440,
9951,
63,
1065,
26,
288,
862,
26,
355,
747,
14,
8215,
8,
2993,
12,
818,
9,
288,
871,
6440,
465,
3178,
26,
355,
340,
440,
334,
2804,
14,
7931,
508,
7554,
14,
28596,
436,
747,
14,
515,
14,
6027,
8,
2993,
2298,
490,
746,
12577,
25212,
8,
2079,
298,
15153,
440,
1218,
1543,
83,
356,
450,
83,
2,
450,
334,
2993,
12,
3178,
14,
589,
1988,
17,
2459,
288,
2737,
63,
3220,
14,
740,
8,
2993,
9,
398,
485,
515,
63,
3966,
59,
2101,
63,
2993,
61,
275,
413,
272,
372,
2737,
63,
3220,
199,
199,
318,
1218,
63,
2350,
8,
1095,
63,
694,
12,
1584,
12,
818,
29,
16,
79,
11956,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
2499,
1006,
314,
2701,
6602,
1334,
283,
1095,
63,
694,
7,
4346,
370,
5324,
283,
1725,
7,
272,
2337,
14,
339,
283,
1095,
63,
694,
7,
365,
2951,
314,
282,
536,
402,
282,
2082,
1314,
3181,
1133,
20513,
272,
2187,
5966,
27,
283,
1725,
7,
365,
282,
769,
402,
6203,
370,
506,
11922,
3847,
370,
272,
283,
1095,
63,
694,
1370,
221,
283,
1095,
63,
694,
7,
435,
314,
2082,
18046,
402,
4036,
570,
315,
283,
1725,
7,
272,
911,
506,
2737,
340,
652,
3181,
1133,
2575,
2187,
14,
221,
283,
632,
297,
283,
3832,
7,
436,
272,
283,
10481,
63,
1065,
7,
3285,
787,
465,
367,
283,
3880,
515,
342,
1370,
272,
408,
272,
327,
7758,
664,
314,
769,
402,
6602,
370,
1218,
272,
1929,
63,
694,
275,
663,
342,
272,
367,
570,
315,
1584,
26,
267,
1929,
63,
694,
14,
525,
8,
736,
14,
515,
14,
904,
8,
1095,
63,
694,
12,
747,
14,
515,
14,
3475,
8,
493,
1724,
339,
327,
7356,
1218,
3062,
272,
367,
2935,
315,
3355,
8,
9321,
63,
694,
304,
267,
9199,
515,
8,
694,
12,
818,
12,
3376,
29,
3832,
12,
9951,
63,
1065,
29,
10481,
63,
1065,
9,
199,
199,
318,
1331,
63,
2350,
8,
2164,
12,
5042,
12,
11211,
63,
632,
29,
17,
12,
11211,
63,
4508,
29,
17,
12,
1598,
11211,
63,
19522,
29,
16,
12,
1678,
29,
16,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
5116,
376,
8039,
2082,
3123,
283
] | [
13350,
14,
694,
63,
1974,
199,
199,
17505,
3423,
367,
13335,
20529,
6602,
436,
2082,
14416,
1041,
199,
199,
646,
747,
199,
646,
7554,
199,
504,
7065,
14,
2550,
492,
12577,
25212,
12,
12577,
8405,
547,
199,
504,
7065,
492,
943,
199,
199,
3,
2581,
367,
701,
9199,
515,
342,
1553,
315,
10234,
370,
286,
12492,
287,
316,
22649,
4882,
12,
199,
3,
20714,
2335,
22649,
298,
20358,
1182,
1421,
15,
1700,
15,
6185,
2,
3788,
315,
9951,
13,
1065,
818,
199,
63,
515,
63,
3966,
275,
1052,
199,
199,
3,
473,
2793,
1133,
675,
747,
14,
8347,
2952,
282,
9,
652,
1159,
892,
370,
2018,
413,
14,
21,
14,
18,
12,
436,
199,
3,
330,
9,
652,
28511,
83,
1536,
340,
314,
2082,
2575,
3495,
334,
41,
2934,
370,
18030,
199,
3,
17961,
315,
626,
1930,
680,
199,
318,
9199,
515,
8,
354,
12,
818,
29,
16,
79,
11956,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
2499,
282,
2082,
436,
1263,
4124,
18432,
6602,
14,
339,
982,
314,
2082,
2575,
3495,
334,
269,
340,
283,
354,
7,
365,
314,
2701,
1059,
12,
1314,
272,
4910,
314,
1453,
2082,
12,
1314,
402,
2518,
3495,
395,
2066,
886,
6548,
14,
272,
14771,
12577,
25212,
340,
17329,
370,
1218,
2005,
2082,
3180,
314,
4340,
272,
334,
5902,
14,
2005,
1007,
13,
515,
3495,
12,
1325,
365,
282,
570,
7830,
2419,
282,
2082,
680,
272,
982,
283,
3832,
7,
365,
2549,
12,
870,
282,
1373,
13,
604,
6212,
402,
1924,
20366,
370,
3839,
14,
272,
1432,
314,
769,
402,
6602,
5965,
2737,
14,
272,
408,
339,
2288,
485,
515,
63,
3966,
339,
327,
30577,
282,
2863,
6519,
1553,
536,
365,
488,
272,
340,
440,
1228,
8,
354,
12,
620,
304,
267,
746,
12577,
8405,
547,
8,
1598,
298,
3880,
515,
26,
283,
354,
7,
1471,
506,
282,
1059,
334,
7808,
450,
82,
2924,
450,
334,
354,
4641,
339,
327,
5787,
4052,
1159,
314,
8034,
4340,
370,
2429,
8661,
31,
870,
465,
781,
1218,
272,
327,
1924,
2082,
315,
314,
931,
334,
1589,
1453,
13942,
395,
503,
1454,
28136,
272,
327,
314,
7143,
402,
314,
8852,
931,
31,
334,
783,
266,
8837,
370,
886,
314,
19045,
3967,
272,
327,
781,
3984,
440,
1808,
282,
9133,
5563,
9,
339,
536,
275,
747,
14,
515,
14,
9267,
8,
354,
9,
272,
2737,
63,
3220,
275,
942,
272,
340,
747,
14,
515,
14,
6027,
8,
354,
9,
503,
536,
508,
8061,
267,
372,
2737,
63,
3220,
272,
340,
485,
515,
63,
3966,
14,
362,
8,
736,
14,
515,
14,
4832,
8,
354,
2298,
267,
372,
2737,
63,
3220,
339,
334,
2993,
12,
9483,
9,
275,
747,
14,
515,
14,
1294,
8,
354,
9,
272,
9483,
83,
275,
359,
1521,
61,
10473,
327,
3464,
402,
634,
368,
7606,
370,
1218,
339,
1830,
4854,
436,
9483,
436,
440,
747,
14,
515,
14,
6027,
8,
2993,
304,
267,
334,
2993,
12,
9483,
9,
275,
747,
14,
515,
14,
1294,
8,
2993,
9,
267,
9483,
83,
14,
3176,
8,
16,
12,
9483,
9,
3515,
327,
6675,
2163,
10948,
2935,
14602,
3464,
339,
327,
3063,
283,
2993,
7,
3509,
314,
27646,
321,
270,
2082,
626,
2575,
3495,
272,
327,
334,
9099,
365,
12,
314,
1982,
402,
283,
2993,
7,
315,
283,
354,
7,
365,
314,
15356,
2082,
272,
327,
626,
1630,
627,
1397,
10,
2187,
9,
272,
367,
366,
315,
9483,
83,
26,
267,
327,
1361,
298,
2993,
275,
450,
83,
12,
366,
275,
450,
83,
26,
298,
450,
334,
2993,
12,
366,
395,
267,
4854,
275,
747,
14,
515,
14,
904,
8,
2993,
12,
366,
9,
267,
2853,
63,
2993,
275,
747,
14,
515,
14,
4832,
8,
2993,
9,
398,
340,
485,
515,
63,
3966,
14,
362,
8,
2101,
63,
2993,
304,
288,
1980,
398,
340,
3376,
2356,
413,
26,
288,
943,
14,
815,
480,
20358,
450,
83,
401,
4854,
9,
398,
340,
440,
9951,
63,
1065,
26,
288,
862,
26,
355,
747,
14,
8215,
8,
2993,
12,
818,
9,
288,
871,
6440,
465,
3178,
26,
355,
340,
440,
334,
2804,
14,
7931,
508,
7554,
14,
28596,
436,
747,
14,
515,
14,
6027,
8,
2993,
2298,
490,
746,
12577,
25212,
8,
2079,
298,
15153,
440,
1218,
1543,
83,
356,
450,
83,
2,
450,
334,
2993,
12,
3178,
14,
589,
1988,
17,
2459,
288,
2737,
63,
3220,
14,
740,
8,
2993,
9,
398,
485,
515,
63,
3966,
59,
2101,
63,
2993,
61,
275,
413,
272,
372,
2737,
63,
3220,
199,
199,
318,
1218,
63,
2350,
8,
1095,
63,
694,
12,
1584,
12,
818,
29,
16,
79,
11956,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
2499,
1006,
314,
2701,
6602,
1334,
283,
1095,
63,
694,
7,
4346,
370,
5324,
283,
1725,
7,
272,
2337,
14,
339,
283,
1095,
63,
694,
7,
365,
2951,
314,
282,
536,
402,
282,
2082,
1314,
3181,
1133,
20513,
272,
2187,
5966,
27,
283,
1725,
7,
365,
282,
769,
402,
6203,
370,
506,
11922,
3847,
370,
272,
283,
1095,
63,
694,
1370,
221,
283,
1095,
63,
694,
7,
435,
314,
2082,
18046,
402,
4036,
570,
315,
283,
1725,
7,
272,
911,
506,
2737,
340,
652,
3181,
1133,
2575,
2187,
14,
221,
283,
632,
297,
283,
3832,
7,
436,
272,
283,
10481,
63,
1065,
7,
3285,
787,
465,
367,
283,
3880,
515,
342,
1370,
272,
408,
272,
327,
7758,
664,
314,
769,
402,
6602,
370,
1218,
272,
1929,
63,
694,
275,
663,
342,
272,
367,
570,
315,
1584,
26,
267,
1929,
63,
694,
14,
525,
8,
736,
14,
515,
14,
904,
8,
1095,
63,
694,
12,
747,
14,
515,
14,
3475,
8,
493,
1724,
339,
327,
7356,
1218,
3062,
272,
367,
2935,
315,
3355,
8,
9321,
63,
694,
304,
267,
9199,
515,
8,
694,
12,
818,
12,
3376,
29,
3832,
12,
9951,
63,
1065,
29,
10481,
63,
1065,
9,
199,
199,
318,
1331,
63,
2350,
8,
2164,
12,
5042,
12,
11211,
63,
632,
29,
17,
12,
11211,
63,
4508,
29,
17,
12,
1598,
11211,
63,
19522,
29,
16,
12,
1678,
29,
16,
12,
3376,
29,
17,
12,
9951,
63,
1065,
29,
16,
304,
272,
408,
5116,
376,
8039,
2082,
3123,
283,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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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
] |
mcanthony/cython | tests/run/generators_py.py | 20 | 7054 | # mode: run
# tag: generators
import cython
def very_simple():
"""
>>> x = very_simple()
>>> next(x)
1
>>> next(x)
Traceback (most recent call last):
StopIteration
>>> next(x)
Traceback (most recent call last):
StopIteration
>>> x = very_simple()
>>> x.send(1)
Traceback (most recent call last):
TypeError: can't send non-None value to a just-started generator
"""
yield 1
def simple():
"""
>>> x = simple()
>>> list(x)
[1, 2, 3]
"""
yield 1
yield 2
yield 3
def simple_seq(seq):
"""
>>> x = simple_seq("abc")
>>> list(x)
['a', 'b', 'c']
"""
for i in seq:
yield i
def simple_send():
"""
>>> x = simple_send()
>>> next(x)
>>> x.send(1)
1
>>> x.send(2)
2
>>> x.send(3)
3
"""
i = None
while True:
i = yield i
def raising():
"""
>>> x = raising()
>>> next(x)
Traceback (most recent call last):
KeyError: 'foo'
>>> next(x)
Traceback (most recent call last):
StopIteration
"""
yield {}['foo']
def with_outer(*args):
"""
>>> x = with_outer(1, 2, 3)
>>> list(x())
[1, 2, 3]
"""
def generator():
for i in args:
yield i
return generator
def with_outer_raising(*args):
"""
>>> x = with_outer_raising(1, 2, 3)
>>> list(x())
[1, 2, 3]
"""
def generator():
for i in args:
yield i
raise StopIteration
return generator
def test_close():
"""
>>> x = test_close()
>>> x.close()
>>> x = test_close()
>>> next(x)
>>> x.close()
>>> next(x)
Traceback (most recent call last):
StopIteration
"""
while True:
yield
def test_ignore_close():
"""
>>> x = test_ignore_close()
>>> x.close()
>>> x = test_ignore_close()
>>> next(x)
>>> x.close()
Traceback (most recent call last):
RuntimeError: generator ignored GeneratorExit
"""
try:
yield
except GeneratorExit:
yield
def check_throw():
"""
>>> x = check_throw()
>>> x.throw(ValueError)
Traceback (most recent call last):
ValueError
>>> next(x)
Traceback (most recent call last):
StopIteration
>>> x = check_throw()
>>> next(x)
>>> x.throw(ValueError)
>>> next(x)
>>> x.throw(IndexError, "oops")
Traceback (most recent call last):
IndexError: oops
>>> next(x)
Traceback (most recent call last):
StopIteration
"""
while True:
try:
yield
except ValueError:
pass
def check_yield_in_except():
"""
>>> import sys
>>> orig_exc = sys.exc_info()[0]
>>> g = check_yield_in_except()
>>> next(g)
>>> next(g)
>>> orig_exc is sys.exc_info()[0] or sys.exc_info()[0]
True
"""
try:
yield
raise ValueError
except ValueError:
yield
def yield_in_except_throw_exc_type():
"""
>>> import sys
>>> g = yield_in_except_throw_exc_type()
>>> next(g)
>>> g.throw(TypeError)
Traceback (most recent call last):
TypeError
>>> next(g)
Traceback (most recent call last):
StopIteration
"""
try:
raise ValueError
except ValueError:
yield
def yield_in_except_throw_instance():
"""
>>> import sys
>>> g = yield_in_except_throw_instance()
>>> next(g)
>>> g.throw(TypeError())
Traceback (most recent call last):
TypeError
>>> next(g)
Traceback (most recent call last):
StopIteration
"""
try:
raise ValueError
except ValueError:
yield
def test_swap_assignment():
"""
>>> gen = test_swap_assignment()
>>> next(gen)
(5, 10)
>>> next(gen)
(10, 5)
"""
x,y = 5,10
yield (x,y)
x,y = y,x # no ref-counting here
yield (x,y)
class Foo(object):
"""
>>> obj = Foo()
>>> list(obj.simple(1, 2, 3))
[1, 2, 3]
"""
def simple(self, *args):
for i in args:
yield i
def test_nested(a, b, c):
"""
>>> obj = test_nested(1, 2, 3)
>>> [i() for i in obj]
[1, 2, 3, 4]
"""
def one():
return a
def two():
return b
def three():
return c
def new_closure(a, b):
def sum():
return a + b
return sum
yield one
yield two
yield three
yield new_closure(a, c)
def tolist(func):
def wrapper(*args, **kwargs):
return list(func(*args, **kwargs))
return wrapper
@tolist
def test_decorated(*args):
"""
>>> test_decorated(1, 2, 3)
[1, 2, 3]
"""
for i in args:
yield i
def test_return(a):
"""
>>> d = dict()
>>> obj = test_return(d)
>>> next(obj)
1
>>> next(obj)
Traceback (most recent call last):
StopIteration
>>> d['i_was_here']
True
"""
yield 1
a['i_was_here'] = True
return
def test_copied_yield(foo):
"""
>>> class Manager(object):
... def __enter__(self):
... return self
... def __exit__(self, type, value, tb):
... pass
>>> list(test_copied_yield(Manager()))
[1]
"""
with foo:
yield 1
def test_nested_yield():
"""
>>> obj = test_nested_yield()
>>> next(obj)
1
>>> obj.send(2)
2
>>> obj.send(3)
3
>>> obj.send(4)
Traceback (most recent call last):
StopIteration
"""
yield (yield (yield 1))
def test_sum_of_yields(n):
"""
>>> g = test_sum_of_yields(3)
>>> next(g)
(0, 0)
>>> g.send(1)
(0, 1)
>>> g.send(1)
(1, 2)
"""
x = 0
x += yield (0, x)
x += yield (0, x)
yield (1, x)
def test_nested_gen(n):
"""
>>> [list(a) for a in test_nested_gen(5)]
[[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3]]
"""
for a in range(n):
yield (b for b in range(a))
def test_lambda(n):
"""
>>> [i() for i in test_lambda(3)]
[0, 1, 2]
"""
for i in range(n):
yield lambda : i
def test_generator_cleanup():
"""
>>> g = test_generator_cleanup()
>>> del g
>>> g = test_generator_cleanup()
>>> next(g)
1
>>> del g
cleanup
"""
try:
yield 1
finally:
print('cleanup')
def test_del_in_generator():
"""
>>> [ s for s in test_del_in_generator() ]
['abcabcabc', 'abcabcabc']
"""
x = len('abc') * 'abc'
a = x
yield x
del x
yield a
del a
@cython.test_fail_if_path_exists("//IfStatNode", "//PrintStatNode")
def test_yield_in_const_conditional_false():
"""
>>> list(test_yield_in_const_conditional_false())
[]
"""
if False:
print((yield 1))
@cython.test_fail_if_path_exists("//IfStatNode")
@cython.test_assert_path_exists("//PrintStatNode")
def test_yield_in_const_conditional_true():
"""
>>> list(test_yield_in_const_conditional_true())
None
[1]
"""
if True:
print((yield 1))
| apache-2.0 | [
3,
818,
26,
1255,
199,
3,
1947,
26,
16952,
199,
199,
646,
29348,
421,
199,
318,
7437,
63,
4129,
837,
272,
408,
272,
1306,
671,
275,
7437,
63,
4129,
342,
272,
1306,
2163,
8,
88,
9,
272,
413,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
671,
275,
7437,
63,
4129,
342,
272,
1306,
671,
14,
2254,
8,
17,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
26,
883,
1133,
3222,
2222,
13,
403,
574,
370,
282,
2951,
13,
8924,
4306,
272,
408,
272,
1995,
413,
421,
199,
318,
3486,
837,
272,
408,
272,
1306,
671,
275,
3486,
342,
272,
1306,
769,
8,
88,
9,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
1995,
413,
272,
1995,
499,
272,
1995,
650,
199,
199,
318,
3486,
63,
3610,
8,
3610,
304,
272,
408,
272,
1306,
671,
275,
3486,
63,
3610,
480,
3175,
531,
272,
1306,
769,
8,
88,
9,
272,
788,
65,
297,
283,
66,
297,
283,
67,
418,
272,
408,
272,
367,
284,
315,
5412,
26,
267,
1995,
284,
199,
199,
318,
3486,
63,
2254,
837,
272,
408,
272,
1306,
671,
275,
3486,
63,
2254,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
2254,
8,
17,
9,
272,
413,
272,
1306,
671,
14,
2254,
8,
18,
9,
272,
499,
272,
1306,
671,
14,
2254,
8,
19,
9,
272,
650,
272,
408,
272,
284,
275,
488,
272,
1830,
715,
26,
267,
284,
275,
1995,
284,
199,
199,
318,
17026,
837,
272,
408,
272,
1306,
671,
275,
17026,
342,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
4067,
26,
283,
1421,
7,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1995,
1052,
459,
1421,
418,
199,
199,
318,
543,
63,
7837,
2031,
589,
304,
272,
408,
272,
1306,
671,
275,
543,
63,
7837,
8,
17,
12,
499,
12,
650,
9,
272,
1306,
769,
8,
88,
1012,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
347,
4306,
837,
267,
367,
284,
315,
1249,
26,
288,
1995,
284,
272,
372,
4306,
199,
199,
318,
543,
63,
7837,
63,
345,
11136,
2031,
589,
304,
272,
408,
272,
1306,
671,
275,
543,
63,
7837,
63,
345,
11136,
8,
17,
12,
499,
12,
650,
9,
272,
1306,
769,
8,
88,
1012,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
347,
4306,
837,
267,
367,
284,
315,
1249,
26,
288,
1995,
284,
267,
746,
10852,
272,
372,
4306,
199,
199,
318,
511,
63,
1600,
837,
272,
408,
272,
1306,
671,
275,
511,
63,
1600,
342,
272,
1306,
671,
14,
1600,
342,
272,
1306,
671,
275,
511,
63,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1830,
715,
26,
267,
1995,
199,
199,
318,
511,
63,
4247,
63,
1600,
837,
272,
408,
272,
1306,
671,
275,
511,
63,
4247,
63,
1600,
342,
272,
1306,
671,
14,
1600,
342,
272,
1306,
671,
275,
511,
63,
4247,
63,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
1600,
342,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
6064,
26,
4306,
5525,
15042,
6699,
272,
408,
272,
862,
26,
267,
1995,
272,
871,
15042,
6699,
26,
267,
1995,
199,
199,
318,
1104,
63,
11964,
837,
272,
408,
272,
1306,
671,
275,
1104,
63,
11964,
342,
272,
1306,
671,
14,
11964,
8,
3393,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
1722,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
671,
275,
1104,
63,
11964,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
11964,
8,
3393,
9,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
11964,
8,
12129,
12,
298,
79,
1483,
531,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
7888,
26,
312,
1483,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1830,
715,
26,
267,
862,
26,
288,
1995,
267,
871,
1722,
26,
288,
986,
199,
199,
318,
1104,
63,
11481,
63,
262,
63,
2590,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
2306,
63,
2804,
275,
984,
14,
2804,
63,
815,
3430,
16,
61,
272,
1306,
486,
275,
1104,
63,
11481,
63,
262,
63,
2590,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
2163,
8,
71,
9,
272,
1306,
2306,
63,
2804,
365,
984,
14,
2804,
63,
815,
3430,
16,
61,
503,
984,
14,
2804,
63,
815,
3430,
16,
61,
272,
715,
272,
408,
272,
862,
26,
267,
1995,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
1995,
63,
262,
63,
2590,
63,
11964,
63,
2804,
63,
466,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
486,
275,
1995,
63,
262,
63,
2590,
63,
11964,
63,
2804,
63,
466,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
486,
14,
11964,
8,
4333,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
272,
1306,
2163,
8,
71,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
862,
26,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
1995,
63,
262,
63,
2590,
63,
11964,
63,
842,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
486,
275,
1995,
63,
262,
63,
2590,
63,
11964,
63,
842,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
486,
14,
11964,
8,
4333,
1012,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
272,
1306,
2163,
8,
71,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
862,
26,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
511,
63,
9286,
63,
10861,
837,
272,
408,
272,
1306,
3805,
275,
511,
63,
9286,
63
] | [
818,
26,
1255,
199,
3,
1947,
26,
16952,
199,
199,
646,
29348,
421,
199,
318,
7437,
63,
4129,
837,
272,
408,
272,
1306,
671,
275,
7437,
63,
4129,
342,
272,
1306,
2163,
8,
88,
9,
272,
413,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
671,
275,
7437,
63,
4129,
342,
272,
1306,
671,
14,
2254,
8,
17,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
26,
883,
1133,
3222,
2222,
13,
403,
574,
370,
282,
2951,
13,
8924,
4306,
272,
408,
272,
1995,
413,
421,
199,
318,
3486,
837,
272,
408,
272,
1306,
671,
275,
3486,
342,
272,
1306,
769,
8,
88,
9,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
1995,
413,
272,
1995,
499,
272,
1995,
650,
199,
199,
318,
3486,
63,
3610,
8,
3610,
304,
272,
408,
272,
1306,
671,
275,
3486,
63,
3610,
480,
3175,
531,
272,
1306,
769,
8,
88,
9,
272,
788,
65,
297,
283,
66,
297,
283,
67,
418,
272,
408,
272,
367,
284,
315,
5412,
26,
267,
1995,
284,
199,
199,
318,
3486,
63,
2254,
837,
272,
408,
272,
1306,
671,
275,
3486,
63,
2254,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
2254,
8,
17,
9,
272,
413,
272,
1306,
671,
14,
2254,
8,
18,
9,
272,
499,
272,
1306,
671,
14,
2254,
8,
19,
9,
272,
650,
272,
408,
272,
284,
275,
488,
272,
1830,
715,
26,
267,
284,
275,
1995,
284,
199,
199,
318,
17026,
837,
272,
408,
272,
1306,
671,
275,
17026,
342,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
4067,
26,
283,
1421,
7,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1995,
1052,
459,
1421,
418,
199,
199,
318,
543,
63,
7837,
2031,
589,
304,
272,
408,
272,
1306,
671,
275,
543,
63,
7837,
8,
17,
12,
499,
12,
650,
9,
272,
1306,
769,
8,
88,
1012,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
347,
4306,
837,
267,
367,
284,
315,
1249,
26,
288,
1995,
284,
272,
372,
4306,
199,
199,
318,
543,
63,
7837,
63,
345,
11136,
2031,
589,
304,
272,
408,
272,
1306,
671,
275,
543,
63,
7837,
63,
345,
11136,
8,
17,
12,
499,
12,
650,
9,
272,
1306,
769,
8,
88,
1012,
272,
359,
17,
12,
499,
12,
650,
61,
272,
408,
272,
347,
4306,
837,
267,
367,
284,
315,
1249,
26,
288,
1995,
284,
267,
746,
10852,
272,
372,
4306,
199,
199,
318,
511,
63,
1600,
837,
272,
408,
272,
1306,
671,
275,
511,
63,
1600,
342,
272,
1306,
671,
14,
1600,
342,
272,
1306,
671,
275,
511,
63,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1830,
715,
26,
267,
1995,
199,
199,
318,
511,
63,
4247,
63,
1600,
837,
272,
408,
272,
1306,
671,
275,
511,
63,
4247,
63,
1600,
342,
272,
1306,
671,
14,
1600,
342,
272,
1306,
671,
275,
511,
63,
4247,
63,
1600,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
1600,
342,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
6064,
26,
4306,
5525,
15042,
6699,
272,
408,
272,
862,
26,
267,
1995,
272,
871,
15042,
6699,
26,
267,
1995,
199,
199,
318,
1104,
63,
11964,
837,
272,
408,
272,
1306,
671,
275,
1104,
63,
11964,
342,
272,
1306,
671,
14,
11964,
8,
3393,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
1722,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
1306,
671,
275,
1104,
63,
11964,
342,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
11964,
8,
3393,
9,
272,
1306,
2163,
8,
88,
9,
272,
1306,
671,
14,
11964,
8,
12129,
12,
298,
79,
1483,
531,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
7888,
26,
312,
1483,
272,
1306,
2163,
8,
88,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
1830,
715,
26,
267,
862,
26,
288,
1995,
267,
871,
1722,
26,
288,
986,
199,
199,
318,
1104,
63,
11481,
63,
262,
63,
2590,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
2306,
63,
2804,
275,
984,
14,
2804,
63,
815,
3430,
16,
61,
272,
1306,
486,
275,
1104,
63,
11481,
63,
262,
63,
2590,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
2163,
8,
71,
9,
272,
1306,
2306,
63,
2804,
365,
984,
14,
2804,
63,
815,
3430,
16,
61,
503,
984,
14,
2804,
63,
815,
3430,
16,
61,
272,
715,
272,
408,
272,
862,
26,
267,
1995,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
1995,
63,
262,
63,
2590,
63,
11964,
63,
2804,
63,
466,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
486,
275,
1995,
63,
262,
63,
2590,
63,
11964,
63,
2804,
63,
466,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
486,
14,
11964,
8,
4333,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
272,
1306,
2163,
8,
71,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
862,
26,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
1995,
63,
262,
63,
2590,
63,
11964,
63,
842,
837,
272,
408,
272,
1306,
492,
984,
272,
1306,
486,
275,
1995,
63,
262,
63,
2590,
63,
11964,
63,
842,
342,
272,
1306,
2163,
8,
71,
9,
272,
1306,
486,
14,
11964,
8,
4333,
1012,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
3146,
272,
1306,
2163,
8,
71,
9,
272,
15273,
334,
2786,
8058,
1240,
2061,
304,
272,
10852,
272,
408,
272,
862,
26,
267,
746,
1722,
272,
871,
1722,
26,
267,
1995,
199,
199,
318,
511,
63,
9286,
63,
10861,
837,
272,
408,
272,
1306,
3805,
275,
511,
63,
9286,
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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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
michaelld/gnuradio | grc/converter/flow_graph.py | 5 | 3929 | # Copyright 2017,2018 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion 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.
#
# GNU Radio Companion 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
from __future__ import absolute_import, division
import ast
from collections import OrderedDict
from ..core.io import yaml
from . import xml
def from_xml(filename):
"""Load flow graph from xml file"""
element, version_info = xml.load(filename, 'flow_graph.dtd')
data = convert_flow_graph_xml(element)
try:
file_format = int(version_info['format'])
except KeyError:
file_format = _guess_file_format_1(data)
data['metadata'] = {'file_format': file_format}
return data
def dump(data, stream):
out = yaml.dump(data, indent=2)
replace = [
('blocks:', '\nblocks:'),
('connections:', '\nconnections:'),
('metadata:', '\nmetadata:'),
]
for r in replace:
out = out.replace(*r)
prefix = '# auto-generated by grc.converter\n\n'
stream.write(prefix + out)
def convert_flow_graph_xml(node):
blocks = [
convert_block(block_data)
for block_data in node.findall('block')
]
options = next(b for b in blocks if b['id'] == 'options')
blocks.remove(options)
options.pop('id')
connections = [
convert_connection(connection)
for connection in node.findall('connection')
]
flow_graph = OrderedDict()
flow_graph['options'] = options
flow_graph['blocks'] = blocks
flow_graph['connections'] = connections
return flow_graph
def convert_block(data):
block_id = data.findtext('key')
params = OrderedDict(sorted(
(param.findtext('key'), param.findtext('value'))
for param in data.findall('param')
))
if block_id == "import":
params["imports"] = params.pop("import")
states = OrderedDict()
x, y = ast.literal_eval(params.pop('_coordinate', '(10, 10)'))
states['coordinate'] = yaml.ListFlowing([x, y])
states['rotation'] = int(params.pop('_rotation', '0'))
enabled = params.pop('_enabled', 'True')
states['state'] = (
'enabled' if enabled in ('1', 'True') else
'bypassed' if enabled == '2' else
'disabled'
)
block = OrderedDict()
if block_id != 'options':
block['name'] = params.pop('id')
block['id'] = block_id
block['parameters'] = params
block['states'] = states
return block
def convert_connection(data):
src_blk_id = data.findtext('source_block_id')
src_port_id = data.findtext('source_key')
snk_blk_id = data.findtext('sink_block_id')
snk_port_id = data.findtext('sink_key')
if src_port_id.isdigit():
src_port_id = src_port_id
if snk_port_id.isdigit():
snk_port_id = snk_port_id
return yaml.ListFlowing([src_blk_id, src_port_id, snk_blk_id, snk_port_id])
def _guess_file_format_1(data):
"""Try to guess the file format for flow-graph files without version tag"""
def has_numeric_port_ids(src_id, src_port_id, snk_id, snk_port_id):
return src_port_id.isdigit() and snk_port_id.isdigit()
try:
if any(not has_numeric_port_ids(*con) for con in data['connections']):
return 1
except (TypeError, KeyError):
pass
return 0
| gpl-3.0 | [
3,
1898,
9708,
12,
12682,
2868,
2290,
2752,
12,
3277,
14,
199,
3,
961,
570,
365,
1777,
402,
1664,
13514,
199,
3,
199,
3,
1664,
13514,
3599,
32012,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
199,
3,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
199,
3,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
1664,
13514,
3599,
32012,
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,
221,
11315,
13,
10067,
12,
8217,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
199,
199,
646,
6073,
199,
504,
5055,
492,
8773,
199,
199,
504,
2508,
1018,
14,
2308,
492,
8864,
199,
504,
1275,
492,
2748,
421,
199,
318,
687,
63,
1652,
8,
1501,
304,
272,
408,
6200,
6369,
3343,
687,
2748,
570,
624,
272,
1819,
12,
1015,
63,
815,
275,
2748,
14,
912,
8,
1501,
12,
283,
1659,
63,
2180,
14,
15662,
358,
339,
666,
275,
3957,
63,
1659,
63,
2180,
63,
1652,
8,
2108,
9,
272,
862,
26,
267,
570,
63,
908,
275,
1109,
8,
1023,
63,
815,
459,
908,
1105,
272,
871,
4067,
26,
267,
570,
63,
908,
275,
485,
11636,
63,
493,
63,
908,
63,
17,
8,
576,
9,
339,
666,
459,
2343,
418,
275,
791,
493,
63,
908,
356,
570,
63,
908,
93,
339,
372,
666,
421,
199,
318,
5461,
8,
576,
12,
2547,
304,
272,
734,
275,
8864,
14,
2724,
8,
576,
12,
4363,
29,
18,
9,
339,
3350,
275,
359,
267,
661,
4166,
6536,
1557,
78,
4166,
26,
659,
267,
661,
7995,
6536,
1557,
78,
7995,
26,
659,
267,
661,
2343,
6536,
1557,
78,
2343,
26,
659,
272,
1622,
272,
367,
519,
315,
3350,
26,
267,
734,
275,
734,
14,
1814,
2031,
82,
9,
272,
2403,
275,
3943,
2599,
13,
10176,
701,
486,
1195,
14,
11256,
60,
78,
60,
78,
7,
272,
2547,
14,
952,
8,
1861,
435,
734,
9,
421,
199,
318,
3957,
63,
1659,
63,
2180,
63,
1652,
8,
932,
304,
272,
5664,
275,
359,
267,
3957,
63,
1457,
8,
1457,
63,
576,
9,
267,
367,
1853,
63,
576,
315,
1031,
14,
6452,
360,
1457,
358,
272,
1622,
339,
1511,
275,
2163,
8,
66,
367,
330,
315,
5664,
340,
330,
459,
344,
418,
508,
283,
1419,
358,
272,
5664,
14,
2168,
8,
1419,
9,
272,
1511,
14,
1935,
360,
344,
358,
339,
6947,
275,
359,
267,
3957,
63,
2105,
8,
2105,
9,
267,
367,
1950,
315,
1031,
14,
6452,
360,
2105,
358,
272,
1622,
339,
6369,
63,
2180,
275,
8773,
342,
272,
6369,
63,
2180,
459,
1419,
418,
275,
1511,
272,
6369,
63,
2180,
459,
4166,
418,
275,
5664,
272,
6369,
63,
2180,
459,
7995,
418,
275,
6947,
272,
372,
6369,
63,
2180,
421,
199,
318,
3957,
63,
1457,
8,
576,
304,
272,
1853,
63,
344,
275,
666,
14,
30401,
360,
498,
358,
339,
1862,
275,
8773,
8,
5917,
8,
267,
334,
635,
14,
30401,
360,
498,
659,
1215,
14,
30401,
360,
585,
1333,
267,
367,
1215,
315,
666,
14,
6452,
360,
635,
358,
272,
5082,
272,
340,
1853,
63,
344,
508,
298,
646,
582,
267,
1862,
905,
12775,
937,
275,
1862,
14,
1935,
480,
646,
531,
272,
6363,
275,
8773,
342,
272,
671,
12,
612,
275,
6073,
14,
8939,
63,
2579,
8,
1162,
14,
1935,
6412,
20493,
297,
8189,
709,
12,
1616,
9,
1333,
272,
6363,
459,
20493,
418,
275,
8864,
14,
1296,
5060,
316,
779,
88,
12,
612,
566,
272,
6363,
459,
15362,
418,
275,
1109,
8,
1162,
14,
1935,
6412,
15362,
297,
283,
16,
1333,
272,
5223,
275,
1862,
14,
1935,
6412,
3827,
297,
283,
549,
358,
272,
6363,
459,
929,
418,
275,
334,
267,
283,
3827,
7,
340,
5223,
315,
661,
17,
297,
283,
549,
358,
587,
267,
283,
991,
12070,
7,
340,
5223,
508,
283,
18,
7,
587,
267,
283,
7011,
7,
272,
776,
339,
1853,
275,
8773,
342,
272,
340,
1853,
63,
344,
1137,
283,
1419,
356,
267,
1853,
459,
354,
418,
275,
1862,
14,
1935,
360,
344,
358,
272,
1853,
459,
344,
418,
275,
1853,
63,
344,
272,
1853,
459,
3214,
418,
275,
1862,
272,
1853,
459,
4981,
418,
275,
6363,
339,
372,
1853,
421,
199,
318,
3957,
63,
2105,
8,
576,
304,
272,
2928,
63,
14023,
63,
344,
275,
666,
14,
30401,
360,
1365,
63,
1457,
63,
344,
358,
272,
2928,
63,
719,
63,
344,
275,
666,
14,
30401,
360,
1365,
63,
498,
358,
272,
6895,
75,
63,
14023,
63,
344,
275,
666,
14,
30401,
360,
11279,
63,
1457,
63,
344,
358,
272,
6895,
75,
63,
719,
63,
344,
275,
666,
14,
30401,
360,
11279,
63,
498,
358,
339,
340,
2928,
63,
719,
63,
344,
14,
13896,
837,
267,
2928,
63,
719,
63,
344,
275,
2928,
63,
719,
63,
344,
272,
340,
6895,
75,
63,
719,
63,
344,
14,
13896,
837,
267,
6895,
75,
63,
719,
63,
344,
275,
6895,
75,
63,
719,
63,
344,
339,
372,
8864,
14,
1296,
5060,
316,
779,
2164,
63,
14023,
63,
344,
12,
2928,
63,
719,
63,
344,
12,
6895,
75,
63,
14023,
63,
344,
12,
6895,
75,
63,
719,
63,
344,
566,
421,
199,
318,
485,
11636,
63,
493,
63,
908,
63,
17,
8,
576,
304,
272,
408,
12357,
370,
9519,
314,
570,
1475,
367,
6369,
13,
2180,
1584,
1928,
1015,
1947,
624,
339,
347,
965,
63,
6677,
63,
719,
63,
1580,
8,
2164,
63,
344,
12,
2928,
63,
719,
63,
344,
12,
6895,
75,
63,
344,
12,
6895,
75,
63,
719,
63,
344,
304,
267,
372,
2928,
63,
719,
63,
344
] | [
1898,
9708,
12,
12682,
2868,
2290,
2752,
12,
3277,
14,
199,
3,
961,
570,
365,
1777,
402,
1664,
13514,
199,
3,
199,
3,
1664,
13514,
3599,
32012,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
199,
3,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
199,
3,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
1664,
13514,
3599,
32012,
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,
221,
11315,
13,
10067,
12,
8217,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
199,
199,
646,
6073,
199,
504,
5055,
492,
8773,
199,
199,
504,
2508,
1018,
14,
2308,
492,
8864,
199,
504,
1275,
492,
2748,
421,
199,
318,
687,
63,
1652,
8,
1501,
304,
272,
408,
6200,
6369,
3343,
687,
2748,
570,
624,
272,
1819,
12,
1015,
63,
815,
275,
2748,
14,
912,
8,
1501,
12,
283,
1659,
63,
2180,
14,
15662,
358,
339,
666,
275,
3957,
63,
1659,
63,
2180,
63,
1652,
8,
2108,
9,
272,
862,
26,
267,
570,
63,
908,
275,
1109,
8,
1023,
63,
815,
459,
908,
1105,
272,
871,
4067,
26,
267,
570,
63,
908,
275,
485,
11636,
63,
493,
63,
908,
63,
17,
8,
576,
9,
339,
666,
459,
2343,
418,
275,
791,
493,
63,
908,
356,
570,
63,
908,
93,
339,
372,
666,
421,
199,
318,
5461,
8,
576,
12,
2547,
304,
272,
734,
275,
8864,
14,
2724,
8,
576,
12,
4363,
29,
18,
9,
339,
3350,
275,
359,
267,
661,
4166,
6536,
1557,
78,
4166,
26,
659,
267,
661,
7995,
6536,
1557,
78,
7995,
26,
659,
267,
661,
2343,
6536,
1557,
78,
2343,
26,
659,
272,
1622,
272,
367,
519,
315,
3350,
26,
267,
734,
275,
734,
14,
1814,
2031,
82,
9,
272,
2403,
275,
3943,
2599,
13,
10176,
701,
486,
1195,
14,
11256,
60,
78,
60,
78,
7,
272,
2547,
14,
952,
8,
1861,
435,
734,
9,
421,
199,
318,
3957,
63,
1659,
63,
2180,
63,
1652,
8,
932,
304,
272,
5664,
275,
359,
267,
3957,
63,
1457,
8,
1457,
63,
576,
9,
267,
367,
1853,
63,
576,
315,
1031,
14,
6452,
360,
1457,
358,
272,
1622,
339,
1511,
275,
2163,
8,
66,
367,
330,
315,
5664,
340,
330,
459,
344,
418,
508,
283,
1419,
358,
272,
5664,
14,
2168,
8,
1419,
9,
272,
1511,
14,
1935,
360,
344,
358,
339,
6947,
275,
359,
267,
3957,
63,
2105,
8,
2105,
9,
267,
367,
1950,
315,
1031,
14,
6452,
360,
2105,
358,
272,
1622,
339,
6369,
63,
2180,
275,
8773,
342,
272,
6369,
63,
2180,
459,
1419,
418,
275,
1511,
272,
6369,
63,
2180,
459,
4166,
418,
275,
5664,
272,
6369,
63,
2180,
459,
7995,
418,
275,
6947,
272,
372,
6369,
63,
2180,
421,
199,
318,
3957,
63,
1457,
8,
576,
304,
272,
1853,
63,
344,
275,
666,
14,
30401,
360,
498,
358,
339,
1862,
275,
8773,
8,
5917,
8,
267,
334,
635,
14,
30401,
360,
498,
659,
1215,
14,
30401,
360,
585,
1333,
267,
367,
1215,
315,
666,
14,
6452,
360,
635,
358,
272,
5082,
272,
340,
1853,
63,
344,
508,
298,
646,
582,
267,
1862,
905,
12775,
937,
275,
1862,
14,
1935,
480,
646,
531,
272,
6363,
275,
8773,
342,
272,
671,
12,
612,
275,
6073,
14,
8939,
63,
2579,
8,
1162,
14,
1935,
6412,
20493,
297,
8189,
709,
12,
1616,
9,
1333,
272,
6363,
459,
20493,
418,
275,
8864,
14,
1296,
5060,
316,
779,
88,
12,
612,
566,
272,
6363,
459,
15362,
418,
275,
1109,
8,
1162,
14,
1935,
6412,
15362,
297,
283,
16,
1333,
272,
5223,
275,
1862,
14,
1935,
6412,
3827,
297,
283,
549,
358,
272,
6363,
459,
929,
418,
275,
334,
267,
283,
3827,
7,
340,
5223,
315,
661,
17,
297,
283,
549,
358,
587,
267,
283,
991,
12070,
7,
340,
5223,
508,
283,
18,
7,
587,
267,
283,
7011,
7,
272,
776,
339,
1853,
275,
8773,
342,
272,
340,
1853,
63,
344,
1137,
283,
1419,
356,
267,
1853,
459,
354,
418,
275,
1862,
14,
1935,
360,
344,
358,
272,
1853,
459,
344,
418,
275,
1853,
63,
344,
272,
1853,
459,
3214,
418,
275,
1862,
272,
1853,
459,
4981,
418,
275,
6363,
339,
372,
1853,
421,
199,
318,
3957,
63,
2105,
8,
576,
304,
272,
2928,
63,
14023,
63,
344,
275,
666,
14,
30401,
360,
1365,
63,
1457,
63,
344,
358,
272,
2928,
63,
719,
63,
344,
275,
666,
14,
30401,
360,
1365,
63,
498,
358,
272,
6895,
75,
63,
14023,
63,
344,
275,
666,
14,
30401,
360,
11279,
63,
1457,
63,
344,
358,
272,
6895,
75,
63,
719,
63,
344,
275,
666,
14,
30401,
360,
11279,
63,
498,
358,
339,
340,
2928,
63,
719,
63,
344,
14,
13896,
837,
267,
2928,
63,
719,
63,
344,
275,
2928,
63,
719,
63,
344,
272,
340,
6895,
75,
63,
719,
63,
344,
14,
13896,
837,
267,
6895,
75,
63,
719,
63,
344,
275,
6895,
75,
63,
719,
63,
344,
339,
372,
8864,
14,
1296,
5060,
316,
779,
2164,
63,
14023,
63,
344,
12,
2928,
63,
719,
63,
344,
12,
6895,
75,
63,
14023,
63,
344,
12,
6895,
75,
63,
719,
63,
344,
566,
421,
199,
318,
485,
11636,
63,
493,
63,
908,
63,
17,
8,
576,
304,
272,
408,
12357,
370,
9519,
314,
570,
1475,
367,
6369,
13,
2180,
1584,
1928,
1015,
1947,
624,
339,
347,
965,
63,
6677,
63,
719,
63,
1580,
8,
2164,
63,
344,
12,
2928,
63,
719,
63,
344,
12,
6895,
75,
63,
344,
12,
6895,
75,
63,
719,
63,
344,
304,
267,
372,
2928,
63,
719,
63,
344,
0
] | [
1,
1,
1,
1,
1,
1,
1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ugins/processing/algs/grass7/ext/r_coin.py | 20 | 1212 | # -*- coding: utf-8 -*-
"""
***************************************************************************
r_coin.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""
__author__ = 'Victor Olaya'
__date__ = 'December 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import HtmlReportPostProcessor
def postProcessResults(alg):
HtmlReportPostProcessor.postProcessResults(alg)
| gpl-2.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
624,
199,
17623,
272,
519,
63,
9061,
14,
647,
272,
10652,
9858,
272,
6148,
463,
520,
1487,
26381,
6029,
272,
1898,
3322,
520,
334,
35,
9,
6029,
701,
6561,
630,
593,
817,
65,
272,
11426,
4483,
520,
5236,
1187,
2756,
737,
29712,
6308,
2414,
199,
17623,
199,
10,
17997,
627,
199,
10,
257,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
221,
627,
199,
10,
257,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
221,
627,
199,
10,
257,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
402,
314,
844,
12,
503,
258,
627,
199,
10,
257,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
15530,
627,
199,
10,
17997,
627,
199,
17623,
199,
624,
199,
199,
363,
2502,
363,
275,
283,
2201,
630,
593,
817,
65,
7,
199,
363,
602,
363,
275,
283,
872,
26381,
6029,
7,
199,
363,
7307,
363,
275,
8189,
35,
9,
6029,
12,
6561,
630,
593,
817,
65,
7,
199,
199,
3,
961,
911,
664,
8717,
543,
282,
6135,
12002,
17,
1380,
1265,
886,
282,
6135,
6359,
199,
199,
363,
5792,
363,
275,
4505,
3484,
2689,
40,
12913,
199,
199,
646,
20880,
7457,
6564,
10438,
421,
199,
318,
2963,
3498,
6579,
8,
6731,
304,
272,
20880,
7457,
6564,
10438,
14,
1932,
3498,
6579,
8,
6731,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,
624,
199,
17623,
272,
519,
63,
9061,
14,
647,
272,
10652,
9858,
272,
6148,
463,
520,
1487,
26381,
6029,
272,
1898,
3322,
520,
334,
35,
9,
6029,
701,
6561,
630,
593,
817,
65,
272,
11426,
4483,
520,
5236,
1187,
2756,
737,
29712,
6308,
2414,
199,
17623,
199,
10,
17997,
627,
199,
10,
257,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
221,
627,
199,
10,
257,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
221,
627,
199,
10,
257,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
402,
314,
844,
12,
503,
258,
627,
199,
10,
257,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
15530,
627,
199,
10,
17997,
627,
199,
17623,
199,
624,
199,
199,
363,
2502,
363,
275,
283,
2201,
630,
593,
817,
65,
7,
199,
363,
602,
363,
275,
283,
872,
26381,
6029,
7,
199,
363,
7307,
363,
275,
8189,
35,
9,
6029,
12,
6561,
630,
593,
817,
65,
7,
199,
199,
3,
961,
911,
664,
8717,
543,
282,
6135,
12002,
17,
1380,
1265,
886,
282,
6135,
6359,
199,
199,
363,
5792,
363,
275,
4505,
3484,
2689,
40,
12913,
199,
199,
646,
20880,
7457,
6564,
10438,
421,
199,
318,
2963,
3498,
6579,
8,
6731,
304,
272,
20880,
7457,
6564,
10438,
14,
1932,
3498,
6579,
8,
6731,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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
] |
cchauve/lrcstats | src/preprocessing/multi2singlefasta.py | 2 | 1641 | import sys, getopt
if __name__ == "__main__":
helpMessage = "Process FASTA files such that sequences for each sample are contained in one line."
usageMessage = "Usage: %s [-h help and usage] [-i long reads FASTA inputPath] [-o output path]" % (sys.argv[0])
options = "hi:o:"
try:
opts, args = getopt.getopt(sys.argv[1:], options)
except getopt.GetoptError:
print "Error: unable to read command line arguments."
sys.exit(2)
if (len(sys.argv) == 1):
print usageMessage
sys.exit()
inputPath = None
outputPath = None
for opt, arg in opts:
# Help message
if opt == '-h':
print helpMessage
print usageMessage
sys.exit()
# Get long reads FASTA inputPath
elif opt == '-i':
inputPath = arg
elif opt == '-o':
outputPath = arg
optsIncomplete = False
if inputPath is None or inputPath is '':
print "Please provide the sample long read FASTQ inputPath."
optsIncomplete = True
if outputPath is None or outputPath is '':
print "Please provide an output path."
optsIncomplete = True
if optsIncomplete:
print usageMessage
sys.exit(2)
with open(inputPath, 'r') as inputFile:
with open(outputPath, 'w') as outputFile:
sequence = ''
for line in inputFile:
if line is not '' and line[0] is '>':
if sequence is not '':
outputFile.write(sequence)
outputFile.write('\n')
outputFile.write(line)
sequence = ''
else:
line = line.rstrip('\n')
sequence = sequence + line
outputFile.write(sequence)
| gpl-3.0 | [
646,
984,
12,
12733,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
199,
198,
3437,
2209,
275,
298,
3498,
481,
11307,
33,
1584,
4066,
626,
8013,
367,
1924,
2690,
787,
10470,
315,
1373,
1004,
2122,
199,
198,
3807,
2209,
275,
298,
7692,
26,
450,
83,
5243,
72,
1720,
436,
4503,
61,
5243,
73,
1846,
11597,
481,
11307,
33,
1324,
2042,
61,
5243,
79,
1072,
931,
8480,
450,
334,
1274,
14,
3020,
59,
16,
566,
199,
198,
1419,
275,
298,
5812,
26,
79,
5424,
421,
198,
893,
26,
507,
198,
3291,
12,
1249,
275,
12733,
14,
18907,
8,
1274,
14,
3020,
59,
17,
8429,
1511,
9,
199,
198,
2590,
12733,
14,
1002,
29368,
26,
507,
198,
1361,
298,
547,
26,
17329,
370,
1586,
1414,
1004,
2368,
2122,
507,
198,
1274,
14,
2224,
8,
18,
9,
421,
198,
692,
334,
552,
8,
1274,
14,
3020,
9,
508,
413,
304,
355,
870,
4503,
2209,
355,
984,
14,
2224,
342,
421,
198,
1210,
2042,
275,
488,
199,
198,
1199,
2042,
275,
488,
398,
367,
2450,
12,
1680,
315,
3999,
26,
507,
198,
3,
15456,
1245,
355,
340,
2450,
508,
2475,
72,
356,
686,
198,
1361,
1720,
2209,
717,
870,
4503,
2209,
717,
984,
14,
2224,
342,
507,
198,
3,
2372,
1846,
11597,
481,
11307,
33,
1324,
2042,
355,
916,
2450,
508,
2475,
73,
356,
717,
1324,
2042,
275,
1680,
507,
198,
4164,
2450,
508,
2475,
79,
356,
686,
198,
1199,
2042,
275,
1680,
421,
198,
3291,
31962,
275,
756,
398,
340,
1324,
2042,
365,
488,
503,
1324,
2042,
365,
8061,
355,
870,
298,
8254,
5647,
314,
2690,
1846,
1586,
481,
11307,
49,
1324,
2042,
2122,
507,
198,
3291,
31962,
275,
715,
199,
198,
692,
1072,
2042,
365,
488,
503,
1072,
2042,
365,
8061,
507,
198,
1361,
298,
8254,
5647,
376,
1072,
931,
2122,
507,
198,
3291,
31962,
275,
715,
199,
198,
692,
3999,
31962,
26,
507,
198,
1361,
4503,
2209,
507,
198,
1274,
14,
2224,
8,
18,
9,
421,
198,
1045,
1551,
8,
1210,
2042,
12,
283,
82,
358,
465,
1324,
1173,
26,
507,
198,
1045,
1551,
8,
1199,
2042,
12,
283,
87,
358,
465,
1072,
1173,
26,
686,
198,
4041,
275,
2125,
686,
198,
509,
1004,
315,
1324,
1173,
26,
1585,
198,
692,
1004,
365,
440,
2125,
436,
1004,
59,
16,
61,
365,
12696,
356,
1871,
198,
692,
3414,
365,
440,
8061,
4671,
198,
1199,
1173,
14,
952,
8,
4041,
9,
4671,
198,
1199,
1173,
14,
952,
2258,
78,
358,
1871,
198,
1199,
1173,
14,
952,
8,
604,
9,
1871,
198,
4041,
275,
2125,
1585,
198,
2836,
26,
1871,
198,
604,
275,
1004,
14,
6735,
2258,
78,
358,
1871,
198,
4041,
275,
3414,
435,
1004,
686,
198,
1199,
1173,
14,
952,
8,
4041,
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
] | [
984,
12,
12733,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
199,
198,
3437,
2209,
275,
298,
3498,
481,
11307,
33,
1584,
4066,
626,
8013,
367,
1924,
2690,
787,
10470,
315,
1373,
1004,
2122,
199,
198,
3807,
2209,
275,
298,
7692,
26,
450,
83,
5243,
72,
1720,
436,
4503,
61,
5243,
73,
1846,
11597,
481,
11307,
33,
1324,
2042,
61,
5243,
79,
1072,
931,
8480,
450,
334,
1274,
14,
3020,
59,
16,
566,
199,
198,
1419,
275,
298,
5812,
26,
79,
5424,
421,
198,
893,
26,
507,
198,
3291,
12,
1249,
275,
12733,
14,
18907,
8,
1274,
14,
3020,
59,
17,
8429,
1511,
9,
199,
198,
2590,
12733,
14,
1002,
29368,
26,
507,
198,
1361,
298,
547,
26,
17329,
370,
1586,
1414,
1004,
2368,
2122,
507,
198,
1274,
14,
2224,
8,
18,
9,
421,
198,
692,
334,
552,
8,
1274,
14,
3020,
9,
508,
413,
304,
355,
870,
4503,
2209,
355,
984,
14,
2224,
342,
421,
198,
1210,
2042,
275,
488,
199,
198,
1199,
2042,
275,
488,
398,
367,
2450,
12,
1680,
315,
3999,
26,
507,
198,
3,
15456,
1245,
355,
340,
2450,
508,
2475,
72,
356,
686,
198,
1361,
1720,
2209,
717,
870,
4503,
2209,
717,
984,
14,
2224,
342,
507,
198,
3,
2372,
1846,
11597,
481,
11307,
33,
1324,
2042,
355,
916,
2450,
508,
2475,
73,
356,
717,
1324,
2042,
275,
1680,
507,
198,
4164,
2450,
508,
2475,
79,
356,
686,
198,
1199,
2042,
275,
1680,
421,
198,
3291,
31962,
275,
756,
398,
340,
1324,
2042,
365,
488,
503,
1324,
2042,
365,
8061,
355,
870,
298,
8254,
5647,
314,
2690,
1846,
1586,
481,
11307,
49,
1324,
2042,
2122,
507,
198,
3291,
31962,
275,
715,
199,
198,
692,
1072,
2042,
365,
488,
503,
1072,
2042,
365,
8061,
507,
198,
1361,
298,
8254,
5647,
376,
1072,
931,
2122,
507,
198,
3291,
31962,
275,
715,
199,
198,
692,
3999,
31962,
26,
507,
198,
1361,
4503,
2209,
507,
198,
1274,
14,
2224,
8,
18,
9,
421,
198,
1045,
1551,
8,
1210,
2042,
12,
283,
82,
358,
465,
1324,
1173,
26,
507,
198,
1045,
1551,
8,
1199,
2042,
12,
283,
87,
358,
465,
1072,
1173,
26,
686,
198,
4041,
275,
2125,
686,
198,
509,
1004,
315,
1324,
1173,
26,
1585,
198,
692,
1004,
365,
440,
2125,
436,
1004,
59,
16,
61,
365,
12696,
356,
1871,
198,
692,
3414,
365,
440,
8061,
4671,
198,
1199,
1173,
14,
952,
8,
4041,
9,
4671,
198,
1199,
1173,
14,
952,
2258,
78,
358,
1871,
198,
1199,
1173,
14,
952,
8,
604,
9,
1871,
198,
4041,
275,
2125,
1585,
198,
2836,
26,
1871,
198,
604,
275,
1004,
14,
6735,
2258,
78,
358,
1871,
198,
4041,
275,
3414,
435,
1004,
686,
198,
1199,
1173,
14,
952,
8,
4041,
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,
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
] |
4022321818/40223218w11 | static/Brython3.1.0-20150301-090019/Lib/keyword.py | 761 | 2049 | #! /usr/bin/env python3
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
./python Lib/keyword.py
"""
__all__ = ["iskeyword", "kwlist"]
kwlist = [
#--start keywords--
'False',
'None',
'True',
'and',
'as',
'assert',
'break',
'class',
'continue',
'def',
'del',
'elif',
'else',
'except',
'finally',
'for',
'from',
'global',
'if',
'import',
'in',
'is',
'lambda',
'nonlocal',
'not',
'or',
'pass',
'raise',
'return',
'try',
'while',
'with',
'yield',
#--end keywords--
]
iskeyword = frozenset(kwlist).__contains__
def main():
import sys, re
args = sys.argv[1:]
iptfile = args and args[0] or "Python/graminit.c"
if len(args) > 1: optfile = args[1]
else: optfile = "Lib/keyword.py"
# scan the source file for keywords
with open(iptfile) as fp:
strprog = re.compile('"([^"]+)"')
lines = []
for line in fp:
if '{1, "' in line:
match = strprog.search(line)
if match:
lines.append(" '" + match.group(1) + "',\n")
lines.sort()
# load the output skeleton from the target
with open(optfile) as fp:
format = fp.readlines()
# insert the lines of keywords
try:
start = format.index("#--start keywords--\n") + 1
end = format.index("#--end keywords--\n")
format[start:end] = lines
except ValueError:
sys.stderr.write("target does not contain format markers\n")
sys.exit(1)
# write the output file
fp = open(optfile, 'w')
fp.write(''.join(format))
fp.close()
if __name__ == "__main__":
main()
| gpl-3.0 | [
3168,
1182,
2647,
15,
1393,
15,
1813,
2366,
19,
199,
199,
624,
23611,
334,
504,
298,
1679,
826,
14,
67,
531,
199,
199,
2765,
570,
365,
5847,
4046,
27,
8749,
2793,
1133,
8504,
346,
652,
1536,
1,
199,
199,
1378,
1678,
314,
6698,
315,
642,
570,
12,
283,
2866,
7,
370,
314,
2746,
2082,
402,
199,
1589,
2366,
1350,
3123,
2410,
10015,
314,
12693,
436,
1255,
26,
339,
16605,
1548,
8003,
15,
6691,
14,
647,
199,
624,
199,
199,
363,
452,
363,
275,
2097,
374,
6691,
401,
298,
829,
513,
937,
199,
199,
829,
513,
275,
359,
199,
3,
306,
928,
7681,
306,
267,
283,
797,
297,
267,
283,
403,
297,
267,
283,
549,
297,
267,
283,
460,
297,
267,
283,
305,
297,
267,
283,
479,
297,
267,
283,
4785,
297,
267,
283,
533,
297,
267,
283,
6958,
297,
267,
283,
318,
297,
267,
283,
2264,
297,
267,
283,
4164,
297,
267,
283,
2836,
297,
267,
283,
2590,
297,
267,
283,
15172,
297,
267,
283,
509,
297,
267,
283,
504,
297,
267,
283,
2966,
297,
267,
283,
692,
297,
267,
283,
646,
297,
267,
283,
262,
297,
267,
283,
374,
297,
267,
283,
2734,
297,
267,
283,
2865,
1832,
297,
267,
283,
1397,
297,
267,
283,
269,
297,
267,
283,
1529,
297,
267,
283,
3730,
297,
267,
283,
1107,
297,
267,
283,
893,
297,
267,
283,
6710,
297,
267,
283,
1045,
297,
267,
283,
11481,
297,
199,
3,
306,
500,
7681,
306,
267,
1622,
199,
199,
374,
6691,
275,
9522,
8,
829,
513,
2843,
6134,
363,
199,
199,
318,
2446,
837,
272,
492,
984,
12,
295,
339,
1249,
275,
984,
14,
3020,
59,
17,
2938,
272,
24170,
493,
275,
1249,
436,
1249,
59,
16,
61,
503,
298,
4718,
15,
1679,
826,
14,
67,
2,
272,
340,
822,
8,
589,
9,
690,
413,
26,
2450,
493,
275,
1249,
59,
17,
61,
272,
587,
26,
2450,
493,
275,
298,
4728,
15,
6691,
14,
647,
2,
339,
327,
8000,
314,
1350,
570,
367,
7681,
272,
543,
1551,
8,
10432,
493,
9,
465,
4090,
26,
267,
620,
6595,
275,
295,
14,
2014,
14088,
15710,
20415,
358,
267,
2385,
275,
942,
267,
367,
1004,
315,
4090,
26,
288,
340,
5041,
17,
12,
3546,
315,
1004,
26,
355,
1336,
275,
620,
6595,
14,
1733,
8,
604,
9,
355,
340,
1336,
26,
490,
2385,
14,
740,
480,
263,
5522,
435,
1336,
14,
923,
8,
17,
9,
435,
298,
30989,
78,
531,
272,
2385,
14,
3191,
342,
339,
327,
2248,
314,
1072,
30537,
687,
314,
1347,
272,
543,
1551,
8,
2992,
493,
9,
465,
4090,
26,
267,
1475,
275,
4090,
14,
9684,
342,
339,
327,
5518,
314,
2385,
402,
7681,
272,
862,
26,
267,
1343,
275,
1475,
14,
1080,
10064,
306,
928,
7681,
306,
60,
78,
531,
435,
413,
267,
1284,
275,
1475,
14,
1080,
10064,
306,
500,
7681,
306,
60,
78,
531,
267,
1475,
59,
928,
26,
500,
61,
275,
2385,
272,
871,
1722,
26,
267,
984,
14,
3083,
14,
952,
480,
1375,
1630,
440,
1395,
1475,
14327,
60,
78,
531,
267,
984,
14,
2224,
8,
17,
9,
339,
327,
2218,
314,
1072,
570,
272,
4090,
275,
1551,
8,
2992,
493,
12,
283,
87,
358,
272,
4090,
14,
952,
17840,
904,
8,
908,
430,
272,
4090,
14,
1600,
342,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
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
] | [
1182,
2647,
15,
1393,
15,
1813,
2366,
19,
199,
199,
624,
23611,
334,
504,
298,
1679,
826,
14,
67,
531,
199,
199,
2765,
570,
365,
5847,
4046,
27,
8749,
2793,
1133,
8504,
346,
652,
1536,
1,
199,
199,
1378,
1678,
314,
6698,
315,
642,
570,
12,
283,
2866,
7,
370,
314,
2746,
2082,
402,
199,
1589,
2366,
1350,
3123,
2410,
10015,
314,
12693,
436,
1255,
26,
339,
16605,
1548,
8003,
15,
6691,
14,
647,
199,
624,
199,
199,
363,
452,
363,
275,
2097,
374,
6691,
401,
298,
829,
513,
937,
199,
199,
829,
513,
275,
359,
199,
3,
306,
928,
7681,
306,
267,
283,
797,
297,
267,
283,
403,
297,
267,
283,
549,
297,
267,
283,
460,
297,
267,
283,
305,
297,
267,
283,
479,
297,
267,
283,
4785,
297,
267,
283,
533,
297,
267,
283,
6958,
297,
267,
283,
318,
297,
267,
283,
2264,
297,
267,
283,
4164,
297,
267,
283,
2836,
297,
267,
283,
2590,
297,
267,
283,
15172,
297,
267,
283,
509,
297,
267,
283,
504,
297,
267,
283,
2966,
297,
267,
283,
692,
297,
267,
283,
646,
297,
267,
283,
262,
297,
267,
283,
374,
297,
267,
283,
2734,
297,
267,
283,
2865,
1832,
297,
267,
283,
1397,
297,
267,
283,
269,
297,
267,
283,
1529,
297,
267,
283,
3730,
297,
267,
283,
1107,
297,
267,
283,
893,
297,
267,
283,
6710,
297,
267,
283,
1045,
297,
267,
283,
11481,
297,
199,
3,
306,
500,
7681,
306,
267,
1622,
199,
199,
374,
6691,
275,
9522,
8,
829,
513,
2843,
6134,
363,
199,
199,
318,
2446,
837,
272,
492,
984,
12,
295,
339,
1249,
275,
984,
14,
3020,
59,
17,
2938,
272,
24170,
493,
275,
1249,
436,
1249,
59,
16,
61,
503,
298,
4718,
15,
1679,
826,
14,
67,
2,
272,
340,
822,
8,
589,
9,
690,
413,
26,
2450,
493,
275,
1249,
59,
17,
61,
272,
587,
26,
2450,
493,
275,
298,
4728,
15,
6691,
14,
647,
2,
339,
327,
8000,
314,
1350,
570,
367,
7681,
272,
543,
1551,
8,
10432,
493,
9,
465,
4090,
26,
267,
620,
6595,
275,
295,
14,
2014,
14088,
15710,
20415,
358,
267,
2385,
275,
942,
267,
367,
1004,
315,
4090,
26,
288,
340,
5041,
17,
12,
3546,
315,
1004,
26,
355,
1336,
275,
620,
6595,
14,
1733,
8,
604,
9,
355,
340,
1336,
26,
490,
2385,
14,
740,
480,
263,
5522,
435,
1336,
14,
923,
8,
17,
9,
435,
298,
30989,
78,
531,
272,
2385,
14,
3191,
342,
339,
327,
2248,
314,
1072,
30537,
687,
314,
1347,
272,
543,
1551,
8,
2992,
493,
9,
465,
4090,
26,
267,
1475,
275,
4090,
14,
9684,
342,
339,
327,
5518,
314,
2385,
402,
7681,
272,
862,
26,
267,
1343,
275,
1475,
14,
1080,
10064,
306,
928,
7681,
306,
60,
78,
531,
435,
413,
267,
1284,
275,
1475,
14,
1080,
10064,
306,
500,
7681,
306,
60,
78,
531,
267,
1475,
59,
928,
26,
500,
61,
275,
2385,
272,
871,
1722,
26,
267,
984,
14,
3083,
14,
952,
480,
1375,
1630,
440,
1395,
1475,
14327,
60,
78,
531,
267,
984,
14,
2224,
8,
17,
9,
339,
327,
2218,
314,
1072,
570,
272,
4090,
275,
1551,
8,
2992,
493,
12,
283,
87,
358,
272,
4090,
14,
952,
17840,
904,
8,
908,
430,
272,
4090,
14,
1600,
342,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
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,
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,
0,
0
] |
tsengj10/physics-admit | admissions/management/commands/jelley.py | 1 | 1202 | from django.core.management.base import BaseCommand, CommandError
from admissions.models import *
class Command(BaseCommand):
help = 'Recalculate Jelley scores and ranks'
def add_arguments(self, parser):
parser.add_argument('tag', nargs='?', default='test')
def handle(self, *args, **options):
weights = Weights.objects.last()
all_students = Candidate.objects.all()
for s in all_students:
s.stored_jell_score = s.calc_jell_score(weights)
s.save()
self.stdout.write('Jelley score of {0} is {1}'.format(s.ucas_id, s.stored_jell_score))
ordered = Candidate.objects.order_by('-stored_jell_score').all()
first = True
index = 1
for s in ordered:
if first:
s.stored_rank = index
previous_score = s.stored_jell_score
previous_rank = index
first = False
else:
if s.stored_jell_score == previous_score:
s.stored_rank = previous_rank
else:
s.stored_rank = index
previous_score = s.stored_jell_score
previous_rank = index
s.save()
self.stdout.write('Rank of {0} is {1} ({2})'.format(s.ucas_id, s.stored_rank, index))
index = index + 1
| gpl-2.0 | [
504,
1639,
14,
1018,
14,
8110,
14,
1095,
492,
22239,
12,
14393,
199,
199,
504,
1503,
2554,
14,
992,
492,
627,
199,
199,
533,
5817,
8,
25150,
304,
523,
1720,
275,
283,
497,
12063,
1603,
352,
15515,
9342,
436,
6915,
83,
7,
819,
347,
1050,
63,
4958,
8,
277,
12,
1798,
304,
272,
1798,
14,
525,
63,
2094,
360,
1450,
297,
9237,
31468,
849,
534,
396,
358,
819,
347,
2429,
8,
277,
12,
627,
589,
12,
1011,
1419,
304,
272,
4931,
275,
2136,
2492,
14,
1462,
14,
2019,
342,
272,
1006,
63,
17921,
275,
6855,
5168,
14,
1462,
14,
452,
342,
272,
367,
308,
315,
1006,
63,
17921,
26,
489,
308,
14,
16431,
63,
74,
1697,
63,
3397,
275,
308,
14,
8104,
63,
74,
1697,
63,
3397,
8,
4916,
9,
489,
308,
14,
2117,
342,
489,
291,
14,
2703,
14,
952,
360,
42,
352,
15515,
5396,
402,
469,
16,
93,
365,
469,
17,
5285,
908,
8,
83,
14,
947,
305,
63,
344,
12,
308,
14,
16431,
63,
74,
1697,
63,
3397,
430,
272,
7741,
275,
6855,
5168,
14,
1462,
14,
1648,
63,
991,
3654,
16431,
63,
74,
1697,
63,
3397,
1959,
452,
342,
272,
1642,
275,
715,
272,
1478,
275,
413,
272,
367,
308,
315,
7741,
26,
489,
340,
1642,
26,
267,
308,
14,
16431,
63,
4648,
275,
1478,
267,
4136,
63,
3397,
275,
308,
14,
16431,
63,
74,
1697,
63,
3397,
267,
4136,
63,
4648,
275,
1478,
267,
1642,
275,
756,
489,
587,
26,
267,
340,
308,
14,
16431,
63,
74,
1697,
63,
3397,
508,
4136,
63,
3397,
26,
881,
308,
14,
16431,
63,
4648,
275,
4136,
63,
4648,
267,
587,
26,
881,
308,
14,
16431,
63,
4648,
275,
1478,
881,
4136,
63,
3397,
275,
308,
14,
16431,
63,
74,
1697,
63,
3397,
881,
4136,
63,
4648,
275,
1478,
489,
308,
14,
2117,
342,
489,
291,
14,
2703,
14,
952,
360,
19486,
402,
469,
16,
93,
365,
469,
17,
93,
11459,
18,
25885,
908,
8,
83,
14,
947,
305,
63,
344,
12,
308,
14,
16431,
63,
4648,
12,
1478,
430,
489,
1478,
275,
1478,
435,
413,
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
] | [
1639,
14,
1018,
14,
8110,
14,
1095,
492,
22239,
12,
14393,
199,
199,
504,
1503,
2554,
14,
992,
492,
627,
199,
199,
533,
5817,
8,
25150,
304,
523,
1720,
275,
283,
497,
12063,
1603,
352,
15515,
9342,
436,
6915,
83,
7,
819,
347,
1050,
63,
4958,
8,
277,
12,
1798,
304,
272,
1798,
14,
525,
63,
2094,
360,
1450,
297,
9237,
31468,
849,
534,
396,
358,
819,
347,
2429,
8,
277,
12,
627,
589,
12,
1011,
1419,
304,
272,
4931,
275,
2136,
2492,
14,
1462,
14,
2019,
342,
272,
1006,
63,
17921,
275,
6855,
5168,
14,
1462,
14,
452,
342,
272,
367,
308,
315,
1006,
63,
17921,
26,
489,
308,
14,
16431,
63,
74,
1697,
63,
3397,
275,
308,
14,
8104,
63,
74,
1697,
63,
3397,
8,
4916,
9,
489,
308,
14,
2117,
342,
489,
291,
14,
2703,
14,
952,
360,
42,
352,
15515,
5396,
402,
469,
16,
93,
365,
469,
17,
5285,
908,
8,
83,
14,
947,
305,
63,
344,
12,
308,
14,
16431,
63,
74,
1697,
63,
3397,
430,
272,
7741,
275,
6855,
5168,
14,
1462,
14,
1648,
63,
991,
3654,
16431,
63,
74,
1697,
63,
3397,
1959,
452,
342,
272,
1642,
275,
715,
272,
1478,
275,
413,
272,
367,
308,
315,
7741,
26,
489,
340,
1642,
26,
267,
308,
14,
16431,
63,
4648,
275,
1478,
267,
4136,
63,
3397,
275,
308,
14,
16431,
63,
74,
1697,
63,
3397,
267,
4136,
63,
4648,
275,
1478,
267,
1642,
275,
756,
489,
587,
26,
267,
340,
308,
14,
16431,
63,
74,
1697,
63,
3397,
508,
4136,
63,
3397,
26,
881,
308,
14,
16431,
63,
4648,
275,
4136,
63,
4648,
267,
587,
26,
881,
308,
14,
16431,
63,
4648,
275,
1478,
881,
4136,
63,
3397,
275,
308,
14,
16431,
63,
74,
1697,
63,
3397,
881,
4136,
63,
4648,
275,
1478,
489,
308,
14,
2117,
342,
489,
291,
14,
2703,
14,
952,
360,
19486,
402,
469,
16,
93,
365,
469,
17,
93,
11459,
18,
25885,
908,
8,
83,
14,
947,
305,
63,
344,
12,
308,
14,
16431,
63,
4648,
12,
1478,
430,
489,
1478,
275,
1478,
435,
413,
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,
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,
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
] |
Serag8/Bachelor | google_appengine/lib/distutils/distutils/msvc9compiler.py | 148 | 31018 | """distutils.msvc9compiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.
The module is compatible with VS 2005 and VS 2008. You can find legacy support
for older versions of VS in distutils.msvccompiler.
"""
# Written by Perry Stoll
# hacked by Robin Becker and Thomas Heller to do a better job of
# finding DevStudio (through the registry)
# ported to VS2005 and VS 2008 by Christian Heimes
__revision__ = "$Id$"
import os
import subprocess
import sys
import re
from distutils.errors import (DistutilsExecError, DistutilsPlatformError,
CompileError, LibError, LinkError)
from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform
import _winreg
RegOpenKeyEx = _winreg.OpenKeyEx
RegEnumKey = _winreg.EnumKey
RegEnumValue = _winreg.EnumValue
RegError = _winreg.error
HKEYS = (_winreg.HKEY_USERS,
_winreg.HKEY_CURRENT_USER,
_winreg.HKEY_LOCAL_MACHINE,
_winreg.HKEY_CLASSES_ROOT)
NATIVE_WIN64 = (sys.platform == 'win32' and sys.maxsize > 2**32)
if NATIVE_WIN64:
# Visual C++ is a 32-bit application, so we need to look in
# the corresponding registry branch, if we're running a
# 64-bit Python on Win64
VS_BASE = r"Software\Wow6432Node\Microsoft\VisualStudio\%0.1f"
VSEXPRESS_BASE = r"Software\Wow6432Node\Microsoft\VCExpress\%0.1f"
WINSDK_BASE = r"Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows"
NET_BASE = r"Software\Wow6432Node\Microsoft\.NETFramework"
else:
VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f"
VSEXPRESS_BASE = r"Software\Microsoft\VCExpress\%0.1f"
WINSDK_BASE = r"Software\Microsoft\Microsoft SDKs\Windows"
NET_BASE = r"Software\Microsoft\.NETFramework"
# A map keyed by get_platform() return values to values accepted by
# 'vcvarsall.bat'. Note a cross-compile may combine these (eg, 'x86_amd64' is
# the param to cross-compile on x86 targetting amd64.)
PLAT_TO_VCVARS = {
'win32' : 'x86',
'win-amd64' : 'amd64',
'win-ia64' : 'ia64',
}
class Reg:
"""Helper class to read values from the registry
"""
def get_value(cls, path, key):
for base in HKEYS:
d = cls.read_values(base, path)
if d and key in d:
return d[key]
raise KeyError(key)
get_value = classmethod(get_value)
def read_keys(cls, base, key):
"""Return list of registry keys."""
try:
handle = RegOpenKeyEx(base, key)
except RegError:
return None
L = []
i = 0
while True:
try:
k = RegEnumKey(handle, i)
except RegError:
break
L.append(k)
i += 1
return L
read_keys = classmethod(read_keys)
def read_values(cls, base, key):
"""Return dict of registry keys and values.
All names are converted to lowercase.
"""
try:
handle = RegOpenKeyEx(base, key)
except RegError:
return None
d = {}
i = 0
while True:
try:
name, value, type = RegEnumValue(handle, i)
except RegError:
break
name = name.lower()
d[cls.convert_mbcs(name)] = cls.convert_mbcs(value)
i += 1
return d
read_values = classmethod(read_values)
def convert_mbcs(s):
dec = getattr(s, "decode", None)
if dec is not None:
try:
s = dec("mbcs")
except UnicodeError:
pass
return s
convert_mbcs = staticmethod(convert_mbcs)
class MacroExpander:
def __init__(self, version):
self.macros = {}
self.vsbase = VS_BASE % version
self.load_macros(version)
def set_macro(self, macro, path, key):
self.macros["$(%s)" % macro] = Reg.get_value(path, key)
def load_macros(self, version):
self.set_macro("VCInstallDir", self.vsbase + r"\Setup\VC", "productdir")
self.set_macro("VSInstallDir", self.vsbase + r"\Setup\VS", "productdir")
self.set_macro("FrameworkDir", NET_BASE, "installroot")
try:
if version >= 8.0:
self.set_macro("FrameworkSDKDir", NET_BASE,
"sdkinstallrootv2.0")
else:
raise KeyError("sdkinstallrootv2.0")
except KeyError:
raise DistutilsPlatformError(
"""Python was built with Visual Studio 2008;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2008 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""")
if version >= 9.0:
self.set_macro("FrameworkVersion", self.vsbase, "clr version")
self.set_macro("WindowsSdkDir", WINSDK_BASE, "currentinstallfolder")
else:
p = r"Software\Microsoft\NET Framework Setup\Product"
for base in HKEYS:
try:
h = RegOpenKeyEx(base, p)
except RegError:
continue
key = RegEnumKey(h, 0)
d = Reg.get_value(base, r"%s\%s" % (p, key))
self.macros["$(FrameworkVersion)"] = d["version"]
def sub(self, s):
for k, v in self.macros.items():
s = s.replace(k, v)
return s
def get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
prefix = "MSC v."
i = sys.version.find(prefix)
if i == -1:
return 6
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
minorVersion = 0
if majorVersion >= 6:
return majorVersion + minorVersion
# else we don't know what version of the compiler this is
return None
def normalize_and_reduce_paths(paths):
"""Return a list of normalized paths with duplicates removed.
The current order of paths is maintained.
"""
# Paths are normalized so things like: /a and /a/ aren't both preserved.
reduced_paths = []
for p in paths:
np = os.path.normpath(p)
# XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
if np not in reduced_paths:
reduced_paths.append(np)
return reduced_paths
def removeDuplicates(variable):
"""Remove duplicate values of an environment variable.
"""
oldList = variable.split(os.pathsep)
newList = []
for i in oldList:
if i not in newList:
newList.append(i)
newVariable = os.pathsep.join(newList)
return newVariable
def find_vcvarsall(version):
"""Find the vcvarsall.bat file
At first it tries to find the productdir of VS 2008 in the registry. If
that fails it falls back to the VS90COMNTOOLS env var.
"""
vsbase = VS_BASE % version
try:
productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
"productdir")
except KeyError:
productdir = None
# trying Express edition
if productdir is None:
vsbase = VSEXPRESS_BASE % version
try:
productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
"productdir")
except KeyError:
productdir = None
log.debug("Unable to find productdir in registry")
if not productdir or not os.path.isdir(productdir):
toolskey = "VS%0.f0COMNTOOLS" % version
toolsdir = os.environ.get(toolskey, None)
if toolsdir and os.path.isdir(toolsdir):
productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
productdir = os.path.abspath(productdir)
if not os.path.isdir(productdir):
log.debug("%s is not a valid directory" % productdir)
return None
else:
log.debug("Env var %s is not set or invalid" % toolskey)
if not productdir:
log.debug("No productdir found")
return None
vcvarsall = os.path.join(productdir, "vcvarsall.bat")
if os.path.isfile(vcvarsall):
return vcvarsall
log.debug("Unable to find vcvarsall.bat")
return None
def query_vcvarsall(version, arch="x86"):
"""Launch vcvarsall.bat and read the settings from its environment
"""
vcvarsall = find_vcvarsall(version)
interesting = set(("include", "lib", "libpath", "path"))
result = {}
if vcvarsall is None:
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version)
popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
stdout, stderr = popen.communicate()
if popen.wait() != 0:
raise DistutilsPlatformError(stderr.decode("mbcs"))
stdout = stdout.decode("mbcs")
for line in stdout.split("\n"):
line = Reg.convert_mbcs(line)
if '=' not in line:
continue
line = line.strip()
key, value = line.split('=', 1)
key = key.lower()
if key in interesting:
if value.endswith(os.pathsep):
value = value[:-1]
result[key] = removeDuplicates(value)
finally:
popen.stdout.close()
popen.stderr.close()
if len(result) != len(interesting):
raise ValueError(str(list(result.keys())))
return result
# More globals
VERSION = get_build_version()
if VERSION < 8.0:
raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
# MACROS = MacroExpander(VERSION)
class MSVCCompiler(CCompiler) :
"""Concrete class that implements an interface to Microsoft Visual C++,
as defined by the CCompiler abstract class."""
compiler_type = 'msvc'
# Just set this so CCompiler's constructor doesn't barf. We currently
# don't use the 'set_executables()' bureaucracy provided by CCompiler,
# as it really isn't necessary for this sort of single-compiler class.
# Would be nice to have a consistent interface with UnixCCompiler,
# though, so it's worth thinking about.
executables = {}
# Private class data (need to distinguish C from C++ source for compiler)
_c_extensions = ['.c']
_cpp_extensions = ['.cc', '.cpp', '.cxx']
_rc_extensions = ['.rc']
_mc_extensions = ['.mc']
# Needed for the filename generation methods provided by the
# base class, CCompiler.
src_extensions = (_c_extensions + _cpp_extensions +
_rc_extensions + _mc_extensions)
res_extension = '.res'
obj_extension = '.obj'
static_lib_extension = '.lib'
shared_lib_extension = '.dll'
static_lib_format = shared_lib_format = '%s%s'
exe_extension = '.exe'
def __init__(self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
self.__version = VERSION
self.__root = r"Software\Microsoft\VisualStudio"
# self.__macros = MACROS
self.__paths = []
# target platform (.plat_name is consistent with 'bdist')
self.plat_name = None
self.__arch = None # deprecated name
self.initialized = False
def initialize(self, plat_name=None):
# multi-init means we would need to check platform same each time...
assert not self.initialized, "don't init multiple times"
if plat_name is None:
plat_name = get_platform()
# sanity check for platforms to prevent obscure errors later.
ok_plats = 'win32', 'win-amd64', 'win-ia64'
if plat_name not in ok_plats:
raise DistutilsPlatformError("--plat-name must be one of %s" %
(ok_plats,))
if "DISTUTILS_USE_SDK" in os.environ and "MSSdk" in os.environ and self.find_exe("cl.exe"):
# Assume that the SDK set up everything alright; don't try to be
# smarter
self.cc = "cl.exe"
self.linker = "link.exe"
self.lib = "lib.exe"
self.rc = "rc.exe"
self.mc = "mc.exe"
else:
# On x86, 'vcvars32.bat amd64' creates an env that doesn't work;
# to cross compile, you use 'x86_amd64'.
# On AMD64, 'vcvars32.bat amd64' is a native build env; to cross
# compile use 'x86' (ie, it runs the x86 compiler directly)
# No idea how itanium handles this, if at all.
if plat_name == get_platform() or plat_name == 'win32':
# native build or cross-compile to win32
plat_spec = PLAT_TO_VCVARS[plat_name]
else:
# cross compile from win32 -> some 64bit
plat_spec = PLAT_TO_VCVARS[get_platform()] + '_' + \
PLAT_TO_VCVARS[plat_name]
vc_env = query_vcvarsall(VERSION, plat_spec)
# take care to only use strings in the environment.
self.__paths = vc_env['path'].encode('mbcs').split(os.pathsep)
os.environ['lib'] = vc_env['lib'].encode('mbcs')
os.environ['include'] = vc_env['include'].encode('mbcs')
if len(self.__paths) == 0:
raise DistutilsPlatformError("Python was built with %s, "
"and extensions need to be built with the same "
"version of the compiler, but it isn't installed."
% self.__product)
self.cc = self.find_exe("cl.exe")
self.linker = self.find_exe("link.exe")
self.lib = self.find_exe("lib.exe")
self.rc = self.find_exe("rc.exe") # resource compiler
self.mc = self.find_exe("mc.exe") # message compiler
#self.set_path_env_var('lib')
#self.set_path_env_var('include')
# extend the MSVC path with the current path
try:
for p in os.environ['path'].split(';'):
self.__paths.append(p)
except KeyError:
pass
self.__paths = normalize_and_reduce_paths(self.__paths)
os.environ['path'] = ";".join(self.__paths)
self.preprocess_options = None
if self.__arch == "x86":
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3',
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
'/Z7', '/D_DEBUG']
else:
# Win64
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-',
'/Z7', '/D_DEBUG']
self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO']
if self.__version >= 7:
self.ldflags_shared_debug = [
'/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG', '/pdb:None'
]
self.ldflags_static = [ '/nologo']
self.initialized = True
# -- Worker methods ------------------------------------------------
def object_filenames(self,
source_filenames,
strip_dir=0,
output_dir=''):
# Copied from ccompiler.py, extended to return .res as 'object'-file
# for .rc input file
if output_dir is None: output_dir = ''
obj_names = []
for src_name in source_filenames:
(base, ext) = os.path.splitext (src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if ext not in self.src_extensions:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
# different lengths
raise CompileError ("Don't know how to compile %s" % src_name)
if strip_dir:
base = os.path.basename (base)
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
return obj_names
def compile(self, sources,
output_dir=None, macros=None, include_dirs=None, debug=0,
extra_preargs=None, extra_postargs=None, depends=None):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
compile_opts.append ('/c')
if debug:
compile_opts.extend(self.compile_options_debug)
else:
compile_opts.extend(self.compile_options)
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError, msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError, msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
output_opt = "/Fo" + obj
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError, msg:
raise CompileError(msg)
return objects
def create_static_lib(self,
objects,
output_libname,
output_dir=None,
debug=0,
target_lang=None):
if not self.initialized:
self.initialize()
(objects, output_dir) = self._fix_object_args(objects, output_dir)
output_filename = self.library_filename(output_libname,
output_dir=output_dir)
if self._need_link(objects, output_filename):
lib_args = objects + ['/OUT:' + output_filename]
if debug:
pass # XXX what goes here?
try:
self.spawn([self.lib] + lib_args)
except DistutilsExecError, msg:
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
def link(self,
target_desc,
objects,
output_filename,
output_dir=None,
libraries=None,
library_dirs=None,
runtime_library_dirs=None,
export_symbols=None,
debug=0,
extra_preargs=None,
extra_postargs=None,
build_temp=None,
target_lang=None):
if not self.initialized:
self.initialize()
(objects, output_dir) = self._fix_object_args(objects, output_dir)
fixed_args = self._fix_lib_args(libraries, library_dirs,
runtime_library_dirs)
(libraries, library_dirs, runtime_library_dirs) = fixed_args
if runtime_library_dirs:
self.warn ("I don't know what to do with 'runtime_library_dirs': "
+ str (runtime_library_dirs))
lib_opts = gen_lib_options(self,
library_dirs, runtime_library_dirs,
libraries)
if output_dir is not None:
output_filename = os.path.join(output_dir, output_filename)
if self._need_link(objects, output_filename):
if target_desc == CCompiler.EXECUTABLE:
if debug:
ldflags = self.ldflags_shared_debug[1:]
else:
ldflags = self.ldflags_shared[1:]
else:
if debug:
ldflags = self.ldflags_shared_debug
else:
ldflags = self.ldflags_shared
export_opts = []
for sym in (export_symbols or []):
export_opts.append("/EXPORT:" + sym)
ld_args = (ldflags + lib_opts + export_opts +
objects + ['/OUT:' + output_filename])
# The MSVC linker generates .lib and .exp files, which cannot be
# suppressed by any linker switches. The .lib files may even be
# needed! Make sure they are generated in the temporary build
# directory. Since they have different names for debug and release
# builds, they can go into the same directory.
build_temp = os.path.dirname(objects[0])
if export_symbols is not None:
(dll_name, dll_ext) = os.path.splitext(
os.path.basename(output_filename))
implib_file = os.path.join(
build_temp,
self.library_filename(dll_name))
ld_args.append ('/IMPLIB:' + implib_file)
self.manifest_setup_ldargs(output_filename, build_temp, ld_args)
if extra_preargs:
ld_args[:0] = extra_preargs
if extra_postargs:
ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename))
try:
self.spawn([self.linker] + ld_args)
except DistutilsExecError, msg:
raise LinkError(msg)
# embed the manifest
# XXX - this is somewhat fragile - if mt.exe fails, distutils
# will still consider the DLL up-to-date, but it will not have a
# manifest. Maybe we should link to a temp file? OTOH, that
# implies a build environment error that shouldn't go undetected.
mfinfo = self.manifest_get_embed_info(target_desc, ld_args)
if mfinfo is not None:
mffilename, mfid = mfinfo
out_arg = '-outputresource:%s;%s' % (output_filename, mfid)
try:
self.spawn(['mt.exe', '-nologo', '-manifest',
mffilename, out_arg])
except DistutilsExecError, msg:
raise LinkError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
def manifest_setup_ldargs(self, output_filename, build_temp, ld_args):
# If we need a manifest at all, an embedded manifest is recommended.
# See MSDN article titled
# "How to: Embed a Manifest Inside a C/C++ Application"
# (currently at http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx)
# Ask the linker to generate the manifest in the temp dir, so
# we can check it, and possibly embed it, later.
temp_manifest = os.path.join(
build_temp,
os.path.basename(output_filename) + ".manifest")
ld_args.append('/MANIFESTFILE:' + temp_manifest)
def manifest_get_embed_info(self, target_desc, ld_args):
# If a manifest should be embedded, return a tuple of
# (manifest_filename, resource_id). Returns None if no manifest
# should be embedded. See http://bugs.python.org/issue7833 for why
# we want to avoid any manifest for extension modules if we can)
for arg in ld_args:
if arg.startswith("/MANIFESTFILE:"):
temp_manifest = arg.split(":", 1)[1]
break
else:
# no /MANIFESTFILE so nothing to do.
return None
if target_desc == CCompiler.EXECUTABLE:
# by default, executables always get the manifest with the
# CRT referenced.
mfid = 1
else:
# Extension modules try and avoid any manifest if possible.
mfid = 2
temp_manifest = self._remove_visual_c_ref(temp_manifest)
if temp_manifest is None:
return None
return temp_manifest, mfid
def _remove_visual_c_ref(self, manifest_file):
try:
# Remove references to the Visual C runtime, so they will
# fall through to the Visual C dependency of Python.exe.
# This way, when installed for a restricted user (e.g.
# runtimes are not in WinSxS folder, but in Python's own
# folder), the runtimes do not need to be in every folder
# with .pyd's.
# Returns either the filename of the modified manifest or
# None if no manifest should be embedded.
manifest_f = open(manifest_file)
try:
manifest_buf = manifest_f.read()
finally:
manifest_f.close()
pattern = re.compile(
r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
re.DOTALL)
manifest_buf = re.sub(pattern, "", manifest_buf)
pattern = "<dependentAssembly>\s*</dependentAssembly>"
manifest_buf = re.sub(pattern, "", manifest_buf)
# Now see if any other assemblies are referenced - if not, we
# don't want a manifest embedded.
pattern = re.compile(
r"""<assemblyIdentity.*?name=(?:"|')(.+?)(?:"|')"""
r""".*?(?:/>|</assemblyIdentity>)""", re.DOTALL)
if re.search(pattern, manifest_buf) is None:
return None
manifest_f = open(manifest_file, 'w')
try:
manifest_f.write(manifest_buf)
return manifest_file
finally:
manifest_f.close()
except IOError:
pass
# -- Miscellaneous methods -----------------------------------------
# These are all used by the 'gen_lib_options() function, in
# ccompiler.py.
def library_dir_option(self, dir):
return "/LIBPATH:" + dir
def runtime_library_dir_option(self, dir):
raise DistutilsPlatformError(
"don't know how to set runtime library search path for MSVC++")
def library_option(self, lib):
return self.library_filename(lib)
def find_library_file(self, dirs, lib, debug=0):
# Prefer a debugging library if found (and requested), but deal
# with it if we don't have one.
if debug:
try_names = [lib + "_d", lib]
else:
try_names = [lib]
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
# Helper methods for using the MSVC registry settings
def find_exe(self, exe):
"""Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is known to exist. If none of them work, just
return the original program name, 'exe'.
"""
for p in self.__paths:
fn = os.path.join(os.path.abspath(p), exe)
if os.path.isfile(fn):
return fn
# didn't find it; try existing path
for p in os.environ['Path'].split(';'):
fn = os.path.join(os.path.abspath(p),exe)
if os.path.isfile(fn):
return fn
return exe
| mit | [
624,
13350,
14,
19875,
25,
5772,
199,
199,
6906,
11694,
30926,
12,
376,
4514,
402,
314,
9006,
445,
9131,
1021,
199,
509,
314,
15332,
14702,
13225,
9079,
14,
199,
199,
1918,
859,
365,
9025,
543,
21685,
11811,
436,
21685,
9079,
14,
2047,
883,
2342,
12139,
2291,
199,
509,
12731,
5459,
402,
21685,
315,
7065,
14,
19875,
5772,
14,
199,
624,
199,
199,
3,
27694,
701,
3492,
651,
1933,
14385,
199,
3,
11176,
379,
701,
6848,
1393,
6423,
22043,
436,
27864,
869,
352,
1435,
370,
886,
282,
8034,
3906,
402,
199,
3,
257,
17196,
29314,
21025,
334,
8304,
314,
7086,
9,
199,
3,
299,
1376,
370,
21685,
9397,
436,
21685,
9079,
701,
2799,
18824,
5653,
5311,
29778,
199,
199,
363,
5792,
363,
275,
7880,
1304,
17351,
199,
199,
646,
747,
199,
646,
3873,
199,
646,
984,
199,
646,
295,
199,
199,
504,
7065,
14,
2550,
492,
334,
12012,
1208,
4858,
547,
12,
12577,
10397,
547,
12,
2892,
24562,
547,
12,
8003,
547,
12,
10967,
547,
9,
199,
504,
7065,
14,
67,
5772,
492,
445,
9131,
12,
3805,
63,
773,
63,
1419,
199,
504,
7065,
492,
943,
199,
504,
7065,
14,
1974,
492,
664,
63,
3246,
199,
199,
646,
485,
15658,
199,
199,
2872,
28144,
920,
275,
485,
15658,
14,
28144,
920,
199,
2872,
5081,
1197,
275,
485,
15658,
14,
5081,
1197,
199,
2872,
14432,
275,
485,
15658,
14,
14432,
199,
2872,
547,
275,
485,
15658,
14,
705,
199,
199,
40,
17434,
275,
6110,
15658,
14,
23802,
63,
28164,
12,
268,
485,
15658,
14,
23802,
63,
14211,
63,
3791,
12,
268,
485,
15658,
14,
23802,
63,
7486,
63,
20890,
12,
268,
485,
15658,
14,
23802,
63,
13748,
63,
5441,
9,
199,
199,
46,
14277,
63,
7941,
772,
275,
334,
1274,
14,
3246,
508,
283,
2676,
708,
7,
436,
984,
14,
13634,
690,
499,
538,
708,
9,
199,
692,
653,
14277,
63,
7941,
772,
26,
272,
327,
14702,
445,
4176,
365,
282,
4337,
13,
2075,
4223,
12,
880,
781,
1929,
370,
3648,
315,
272,
327,
314,
5226,
7086,
5246,
12,
340,
781,
3984,
3879,
282,
272,
327,
5049,
13,
2075,
2018,
641,
13036,
772,
272,
21685,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
15039,
21025,
60,
5,
16,
14,
17,
70,
2,
272,
812,
899,
56,
5786,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
9454,
32161,
60,
5,
16,
14,
17,
70,
2,
272,
20896,
14939,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
12940,
15610,
83,
60,
8647,
2,
272,
18340,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
4537,
7278,
16442,
2,
199,
2836,
26,
272,
21685,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
15039,
21025,
60,
5,
16,
14,
17,
70,
2,
272,
812,
899,
56,
5786,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
9454,
32161,
60,
5,
16,
14,
17,
70,
2,
272,
20896,
14939,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
12940,
15610,
83,
60,
8647,
2,
272,
18340,
63,
5825,
275,
519,
2,
10337,
60,
12940,
4537,
7278,
16442,
2,
199,
199,
3,
437,
2341,
19272,
701,
664,
63,
3246,
342,
372,
1338,
370,
1338,
10226,
701,
199,
3,
283,
6737,
2936,
452,
14,
13475,
1370,
221,
3390,
282,
8059,
13,
2014,
1443,
13323,
3520,
334,
5902,
12,
283,
88,
1184,
63,
21778,
772,
7,
365,
199,
3,
314,
1215,
370,
8059,
13,
2014,
641,
671,
1184,
1347,
1337,
282,
1064,
772,
4959,
199,
2749,
619,
63,
2566,
63,
9454,
21367,
275,
469,
272,
283,
2676,
708,
7,
520,
283,
88,
1184,
297,
272,
283,
2676,
13,
21778,
772,
7,
520,
283,
21778,
772,
297,
272,
283,
2676,
13,
4674,
772,
7,
520,
283,
4674,
772,
297,
199,
93,
199,
199,
533,
5044,
26,
272,
408,
4433,
1021,
370,
1586,
1338,
687,
314,
7086,
272,
408,
339,
347,
664,
63,
585,
8,
1886,
12,
931,
12,
790,
304,
267,
367,
1300,
315,
869,
17434,
26,
288,
366,
275,
843,
14,
739,
63,
1459,
8,
1095,
12,
931,
9,
288,
340,
366,
436,
790,
315,
366,
26,
355,
372,
366,
59,
498,
61,
267,
746,
4067,
8,
498,
9,
272,
664,
63,
585,
275,
18990,
8,
362,
63,
585,
9,
339,
347,
1586,
63,
1612,
8,
1886,
12,
1300,
12,
790,
304,
267,
408,
1767,
769,
402,
7086,
2883,
1041,
267,
862,
26,
288,
2429,
275,
5044,
28144,
920,
8,
1095,
12,
790,
9,
267,
871,
5044,
547,
26,
288,
372,
488,
267,
491,
275,
942,
267,
284,
275,
378,
267,
1830,
715,
26,
288,
862,
26,
355,
1022,
275,
5044,
5081,
1197,
8,
2479,
12,
284,
9,
288,
871,
5044,
547,
26,
355,
2059,
288,
491,
14,
740,
8,
75,
9,
288,
284,
847,
413,
267,
372,
491,
272,
1586,
63,
1612,
275,
18990,
8,
739,
63,
1612,
9,
339,
347,
1586,
63,
1459,
8,
1886,
12,
1300,
12,
790,
304,
267,
408,
1767,
1211,
402,
7086,
2883,
436,
1338,
14,
398,
2900,
1561,
787,
6702,
370,
12141,
14,
267,
408,
267,
862,
26,
288,
2429,
275,
5044,
28144,
920,
8,
1095,
12,
790,
9,
267,
871,
5044,
547,
26,
288,
372,
488,
267,
366,
275,
1052,
267,
284,
275,
378,
267,
1830,
715,
26,
288,
862,
26,
355,
536,
12,
574,
12,
730,
275,
5044,
14432,
8,
2479,
12,
284,
9,
288,
871,
5044,
547,
26,
355,
2059,
288,
536,
275,
536,
14,
2325,
342,
288,
366,
59,
1886,
14,
3916,
63,
887,
1259,
8,
354,
1874,
275,
843,
14,
3916,
63,
887,
1259,
8,
585,
9,
288,
284,
847,
413,
267,
372,
366,
272,
1586,
63,
1459,
275,
18990,
8,
739,
63,
1459,
9,
339,
347,
3957,
63,
887,
1259,
8,
83,
304,
267,
9700,
275,
2519,
8,
83,
12,
298,
2708,
401,
488,
9,
267,
340,
9700,
365,
440,
488,
26,
288,
862,
26,
355,
308,
275,
9700,
480,
887,
1259,
531,
288,
871,
20872,
26,
355,
986,
267,
372,
308,
272,
3957,
63,
887,
1259,
275,
12822,
8,
3916,
63,
887,
1259,
9,
199,
199,
533,
10444,
293,
4527,
11438,
26,
339,
347,
636,
826,
721
] | [
13350,
14,
19875,
25,
5772,
199,
199,
6906,
11694,
30926,
12,
376,
4514,
402,
314,
9006,
445,
9131,
1021,
199,
509,
314,
15332,
14702,
13225,
9079,
14,
199,
199,
1918,
859,
365,
9025,
543,
21685,
11811,
436,
21685,
9079,
14,
2047,
883,
2342,
12139,
2291,
199,
509,
12731,
5459,
402,
21685,
315,
7065,
14,
19875,
5772,
14,
199,
624,
199,
199,
3,
27694,
701,
3492,
651,
1933,
14385,
199,
3,
11176,
379,
701,
6848,
1393,
6423,
22043,
436,
27864,
869,
352,
1435,
370,
886,
282,
8034,
3906,
402,
199,
3,
257,
17196,
29314,
21025,
334,
8304,
314,
7086,
9,
199,
3,
299,
1376,
370,
21685,
9397,
436,
21685,
9079,
701,
2799,
18824,
5653,
5311,
29778,
199,
199,
363,
5792,
363,
275,
7880,
1304,
17351,
199,
199,
646,
747,
199,
646,
3873,
199,
646,
984,
199,
646,
295,
199,
199,
504,
7065,
14,
2550,
492,
334,
12012,
1208,
4858,
547,
12,
12577,
10397,
547,
12,
2892,
24562,
547,
12,
8003,
547,
12,
10967,
547,
9,
199,
504,
7065,
14,
67,
5772,
492,
445,
9131,
12,
3805,
63,
773,
63,
1419,
199,
504,
7065,
492,
943,
199,
504,
7065,
14,
1974,
492,
664,
63,
3246,
199,
199,
646,
485,
15658,
199,
199,
2872,
28144,
920,
275,
485,
15658,
14,
28144,
920,
199,
2872,
5081,
1197,
275,
485,
15658,
14,
5081,
1197,
199,
2872,
14432,
275,
485,
15658,
14,
14432,
199,
2872,
547,
275,
485,
15658,
14,
705,
199,
199,
40,
17434,
275,
6110,
15658,
14,
23802,
63,
28164,
12,
268,
485,
15658,
14,
23802,
63,
14211,
63,
3791,
12,
268,
485,
15658,
14,
23802,
63,
7486,
63,
20890,
12,
268,
485,
15658,
14,
23802,
63,
13748,
63,
5441,
9,
199,
199,
46,
14277,
63,
7941,
772,
275,
334,
1274,
14,
3246,
508,
283,
2676,
708,
7,
436,
984,
14,
13634,
690,
499,
538,
708,
9,
199,
692,
653,
14277,
63,
7941,
772,
26,
272,
327,
14702,
445,
4176,
365,
282,
4337,
13,
2075,
4223,
12,
880,
781,
1929,
370,
3648,
315,
272,
327,
314,
5226,
7086,
5246,
12,
340,
781,
3984,
3879,
282,
272,
327,
5049,
13,
2075,
2018,
641,
13036,
772,
272,
21685,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
15039,
21025,
60,
5,
16,
14,
17,
70,
2,
272,
812,
899,
56,
5786,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
9454,
32161,
60,
5,
16,
14,
17,
70,
2,
272,
20896,
14939,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
60,
12940,
15610,
83,
60,
8647,
2,
272,
18340,
63,
5825,
275,
519,
2,
10337,
60,
55,
583,
23313,
1716,
60,
12940,
4537,
7278,
16442,
2,
199,
2836,
26,
272,
21685,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
15039,
21025,
60,
5,
16,
14,
17,
70,
2,
272,
812,
899,
56,
5786,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
9454,
32161,
60,
5,
16,
14,
17,
70,
2,
272,
20896,
14939,
63,
5825,
275,
519,
2,
10337,
60,
12940,
60,
12940,
15610,
83,
60,
8647,
2,
272,
18340,
63,
5825,
275,
519,
2,
10337,
60,
12940,
4537,
7278,
16442,
2,
199,
199,
3,
437,
2341,
19272,
701,
664,
63,
3246,
342,
372,
1338,
370,
1338,
10226,
701,
199,
3,
283,
6737,
2936,
452,
14,
13475,
1370,
221,
3390,
282,
8059,
13,
2014,
1443,
13323,
3520,
334,
5902,
12,
283,
88,
1184,
63,
21778,
772,
7,
365,
199,
3,
314,
1215,
370,
8059,
13,
2014,
641,
671,
1184,
1347,
1337,
282,
1064,
772,
4959,
199,
2749,
619,
63,
2566,
63,
9454,
21367,
275,
469,
272,
283,
2676,
708,
7,
520,
283,
88,
1184,
297,
272,
283,
2676,
13,
21778,
772,
7,
520,
283,
21778,
772,
297,
272,
283,
2676,
13,
4674,
772,
7,
520,
283,
4674,
772,
297,
199,
93,
199,
199,
533,
5044,
26,
272,
408,
4433,
1021,
370,
1586,
1338,
687,
314,
7086,
272,
408,
339,
347,
664,
63,
585,
8,
1886,
12,
931,
12,
790,
304,
267,
367,
1300,
315,
869,
17434,
26,
288,
366,
275,
843,
14,
739,
63,
1459,
8,
1095,
12,
931,
9,
288,
340,
366,
436,
790,
315,
366,
26,
355,
372,
366,
59,
498,
61,
267,
746,
4067,
8,
498,
9,
272,
664,
63,
585,
275,
18990,
8,
362,
63,
585,
9,
339,
347,
1586,
63,
1612,
8,
1886,
12,
1300,
12,
790,
304,
267,
408,
1767,
769,
402,
7086,
2883,
1041,
267,
862,
26,
288,
2429,
275,
5044,
28144,
920,
8,
1095,
12,
790,
9,
267,
871,
5044,
547,
26,
288,
372,
488,
267,
491,
275,
942,
267,
284,
275,
378,
267,
1830,
715,
26,
288,
862,
26,
355,
1022,
275,
5044,
5081,
1197,
8,
2479,
12,
284,
9,
288,
871,
5044,
547,
26,
355,
2059,
288,
491,
14,
740,
8,
75,
9,
288,
284,
847,
413,
267,
372,
491,
272,
1586,
63,
1612,
275,
18990,
8,
739,
63,
1612,
9,
339,
347,
1586,
63,
1459,
8,
1886,
12,
1300,
12,
790,
304,
267,
408,
1767,
1211,
402,
7086,
2883,
436,
1338,
14,
398,
2900,
1561,
787,
6702,
370,
12141,
14,
267,
408,
267,
862,
26,
288,
2429,
275,
5044,
28144,
920,
8,
1095,
12,
790,
9,
267,
871,
5044,
547,
26,
288,
372,
488,
267,
366,
275,
1052,
267,
284,
275,
378,
267,
1830,
715,
26,
288,
862,
26,
355,
536,
12,
574,
12,
730,
275,
5044,
14432,
8,
2479,
12,
284,
9,
288,
871,
5044,
547,
26,
355,
2059,
288,
536,
275,
536,
14,
2325,
342,
288,
366,
59,
1886,
14,
3916,
63,
887,
1259,
8,
354,
1874,
275,
843,
14,
3916,
63,
887,
1259,
8,
585,
9,
288,
284,
847,
413,
267,
372,
366,
272,
1586,
63,
1459,
275,
18990,
8,
739,
63,
1459,
9,
339,
347,
3957,
63,
887,
1259,
8,
83,
304,
267,
9700,
275,
2519,
8,
83,
12,
298,
2708,
401,
488,
9,
267,
340,
9700,
365,
440,
488,
26,
288,
862,
26,
355,
308,
275,
9700,
480,
887,
1259,
531,
288,
871,
20872,
26,
355,
986,
267,
372,
308,
272,
3957,
63,
887,
1259,
275,
12822,
8,
3916,
63,
887,
1259,
9,
199,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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
realsobek/freeipa | ipaclient/remote_plugins/2_49/ping.py | 8 | 1648 | #
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
# pylint: disable=unused-import
import six
from . import Command, Method, Object
from ipalib import api, parameters, output
from ipalib.parameters import DefaultFrom
from ipalib.plugable import Registry
from ipalib.text import _
from ipapython.dn import DN
from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
__doc__ = _("""
Ping the remote IPA server to ensure it is running.
The ping command sends an echo request to an IPA server. The server
returns its version information. This is used by an IPA client
to confirm that the server is available and accepting requests.
The server from xmlrpc_uri in /etc/ipa/default.conf is contacted first.
If it does not respond then the client will contact any servers defined
by ldap SRV records in DNS.
EXAMPLES:
Ping an IPA server:
ipa ping
------------------------------------------
IPA server version 2.1.9. API version 2.20
------------------------------------------
Ping an IPA server verbosely:
ipa -v ping
ipa: INFO: trying https://ipa.example.com/ipa/xml
ipa: INFO: Forwarding 'ping' to server u'https://ipa.example.com/ipa/xml'
-----------------------------------------------------
IPA server version 2.1.9. API version 2.20
-----------------------------------------------------
""")
register = Registry()
@register()
class ping(Command):
__doc__ = _("Ping a remote server.")
has_output = (
output.Output(
'summary',
(unicode, type(None)),
doc=_(u'User-friendly description of action performed'),
),
)
| gpl-3.0 | [
3,
199,
3,
1898,
334,
35,
9,
7800,
221,
2868,
1772,
33,
23212,
1937,
9685,
367,
4190,
199,
3,
199,
199,
3,
4287,
26,
3507,
29,
8618,
13,
646,
199,
646,
3816,
199,
199,
504,
1275,
492,
5817,
12,
9075,
12,
6935,
199,
504,
3384,
25530,
492,
2986,
12,
2633,
12,
1072,
199,
504,
3384,
25530,
14,
3214,
492,
3758,
2532,
199,
504,
3384,
25530,
14,
13963,
461,
492,
20738,
199,
504,
3384,
25530,
14,
505,
492,
485,
199,
504,
18210,
1548,
14,
4272,
492,
24842,
199,
504,
18210,
1548,
14,
5797,
1974,
492,
10237,
985,
199,
199,
692,
3816,
14,
4521,
19,
26,
272,
2649,
275,
620,
199,
199,
363,
1301,
363,
275,
485,
4852,
199,
22638,
314,
3982,
3531,
33,
1654,
370,
4868,
652,
365,
3879,
14,
199,
199,
1918,
18249,
1414,
16178,
376,
11343,
1056,
370,
376,
3531,
33,
1654,
14,
710,
1654,
199,
5808,
2399,
1015,
2556,
14,
961,
365,
1202,
701,
376,
3531,
33,
1890,
199,
475,
12679,
626,
314,
1654,
365,
2808,
436,
32163,
4145,
14,
199,
199,
1918,
1654,
687,
15432,
63,
2302,
315,
1182,
6839,
15,
20014,
15,
885,
14,
2190,
365,
406,
502,
1522,
1642,
14,
199,
3917,
652,
1630,
440,
22722,
2066,
314,
1890,
911,
8966,
1263,
8037,
3247,
199,
991,
13727,
12765,
54,
5767,
315,
10237,
14,
199,
199,
8918,
26,
421,
510,
316,
376,
3531,
33,
1654,
26,
2043,
18210,
18249,
2043,
11016,
9460,
2043,
3531,
33,
1654,
1015,
499,
14,
17,
14,
25,
14,
3261,
1015,
499,
14,
1165,
2043,
11016,
9460,
421,
510,
316,
376,
3531,
33,
1654,
3376,
590,
26,
2043,
18210,
446,
86,
18249,
2043,
18210,
26,
24008,
26,
9936,
4178,
921,
20014,
14,
2694,
14,
957,
15,
20014,
15,
1652,
2043,
18210,
26,
24008,
26,
22536,
316,
283,
4073,
7,
370,
1654,
399,
7,
2859,
921,
20014,
14,
2694,
14,
957,
15,
20014,
15,
1652,
7,
2043,
9527,
9858,
2043,
3531,
33,
1654,
1015,
499,
14,
17,
14,
25,
14,
3261,
1015,
499,
14,
1165,
2043,
9527,
9858,
199,
6141,
199,
199,
2683,
275,
20738,
342,
421,
199,
32,
2683,
342,
199,
533,
18249,
8,
3110,
304,
272,
636,
1301,
363,
275,
3824,
22638,
282,
3982,
1654,
2685,
339,
965,
63,
1199,
275,
334,
267,
1072,
14,
2959,
8,
288,
283,
4705,
297,
288,
334,
2975,
12,
730,
8,
403,
1826,
288,
1382,
17441,
85,
7,
1899,
13,
17317,
1369,
402,
1595,
10585,
659,
267,
2318,
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
] | [
199,
3,
1898,
334,
35,
9,
7800,
221,
2868,
1772,
33,
23212,
1937,
9685,
367,
4190,
199,
3,
199,
199,
3,
4287,
26,
3507,
29,
8618,
13,
646,
199,
646,
3816,
199,
199,
504,
1275,
492,
5817,
12,
9075,
12,
6935,
199,
504,
3384,
25530,
492,
2986,
12,
2633,
12,
1072,
199,
504,
3384,
25530,
14,
3214,
492,
3758,
2532,
199,
504,
3384,
25530,
14,
13963,
461,
492,
20738,
199,
504,
3384,
25530,
14,
505,
492,
485,
199,
504,
18210,
1548,
14,
4272,
492,
24842,
199,
504,
18210,
1548,
14,
5797,
1974,
492,
10237,
985,
199,
199,
692,
3816,
14,
4521,
19,
26,
272,
2649,
275,
620,
199,
199,
363,
1301,
363,
275,
485,
4852,
199,
22638,
314,
3982,
3531,
33,
1654,
370,
4868,
652,
365,
3879,
14,
199,
199,
1918,
18249,
1414,
16178,
376,
11343,
1056,
370,
376,
3531,
33,
1654,
14,
710,
1654,
199,
5808,
2399,
1015,
2556,
14,
961,
365,
1202,
701,
376,
3531,
33,
1890,
199,
475,
12679,
626,
314,
1654,
365,
2808,
436,
32163,
4145,
14,
199,
199,
1918,
1654,
687,
15432,
63,
2302,
315,
1182,
6839,
15,
20014,
15,
885,
14,
2190,
365,
406,
502,
1522,
1642,
14,
199,
3917,
652,
1630,
440,
22722,
2066,
314,
1890,
911,
8966,
1263,
8037,
3247,
199,
991,
13727,
12765,
54,
5767,
315,
10237,
14,
199,
199,
8918,
26,
421,
510,
316,
376,
3531,
33,
1654,
26,
2043,
18210,
18249,
2043,
11016,
9460,
2043,
3531,
33,
1654,
1015,
499,
14,
17,
14,
25,
14,
3261,
1015,
499,
14,
1165,
2043,
11016,
9460,
421,
510,
316,
376,
3531,
33,
1654,
3376,
590,
26,
2043,
18210,
446,
86,
18249,
2043,
18210,
26,
24008,
26,
9936,
4178,
921,
20014,
14,
2694,
14,
957,
15,
20014,
15,
1652,
2043,
18210,
26,
24008,
26,
22536,
316,
283,
4073,
7,
370,
1654,
399,
7,
2859,
921,
20014,
14,
2694,
14,
957,
15,
20014,
15,
1652,
7,
2043,
9527,
9858,
2043,
3531,
33,
1654,
1015,
499,
14,
17,
14,
25,
14,
3261,
1015,
499,
14,
1165,
2043,
9527,
9858,
199,
6141,
199,
199,
2683,
275,
20738,
342,
421,
199,
32,
2683,
342,
199,
533,
18249,
8,
3110,
304,
272,
636,
1301,
363,
275,
3824,
22638,
282,
3982,
1654,
2685,
339,
965,
63,
1199,
275,
334,
267,
1072,
14,
2959,
8,
288,
283,
4705,
297,
288,
334,
2975,
12,
730,
8,
403,
1826,
288,
1382,
17441,
85,
7,
1899,
13,
17317,
1369,
402,
1595,
10585,
659,
267,
2318,
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,
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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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
public-ink/public-ink | server/appengine-staging/lib/graphql/type/__init__.py | 3 | 1366 | # flake8: noqa
from .definition import ( # no import order
GraphQLScalarType,
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType,
GraphQLEnumValue,
GraphQLInputObjectType,
GraphQLInputObjectField,
GraphQLList,
GraphQLNonNull,
get_named_type,
is_abstract_type,
is_composite_type,
is_input_type,
is_leaf_type,
is_type,
get_nullable_type,
is_output_type
)
from .directives import (
# "Enum" of Directive locations
DirectiveLocation,
# Directive definition
GraphQLDirective,
# Built-in directives defined by the Spec
specified_directives,
GraphQLSkipDirective,
GraphQLIncludeDirective,
GraphQLDeprecatedDirective,
# Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,
)
from .scalars import ( # no import order
GraphQLInt,
GraphQLFloat,
GraphQLString,
GraphQLBoolean,
GraphQLID,
)
from .schema import GraphQLSchema
from .introspection import (
# "Enum" of Type Kinds
TypeKind,
# GraphQL Types for introspection.
__Schema,
__Directive,
__DirectiveLocation,
__Type,
__Field,
__InputValue,
__EnumValue,
__TypeKind,
# Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef
)
| gpl-3.0 | [
3,
27510,
24,
26,
8151,
199,
504,
1275,
7463,
492,
334,
221,
327,
949,
492,
1865,
272,
11513,
2940,
13090,
804,
12,
272,
11513,
49,
30113,
804,
12,
272,
11513,
2940,
792,
12,
272,
11513,
2940,
5201,
12,
272,
11513,
2940,
4267,
804,
12,
272,
11513,
2940,
15540,
804,
12,
272,
11513,
49,
906,
1507,
804,
12,
272,
11513,
49,
906,
1507,
1110,
12,
272,
11513,
2940,
3205,
1692,
804,
12,
272,
11513,
2940,
3205,
1692,
792,
12,
272,
11513,
2940,
1296,
12,
272,
11513,
2940,
6932,
8849,
12,
272,
664,
63,
4579,
63,
466,
12,
272,
365,
63,
6198,
63,
466,
12,
272,
365,
63,
16907,
63,
466,
12,
272,
365,
63,
1210,
63,
466,
12,
272,
365,
63,
8914,
63,
466,
12,
272,
365,
63,
466,
12,
272,
664,
63,
16375,
63,
466,
12,
272,
365,
63,
1199,
63,
466,
199,
9,
199,
504,
1275,
23216,
492,
334,
272,
327,
298,
5081,
2,
402,
3757,
8374,
9918,
272,
3757,
8374,
6592,
12,
339,
327,
3757,
8374,
5492,
272,
11513,
2940,
29489,
12,
339,
327,
4779,
4803,
13,
262,
13502,
3247,
701,
314,
31511,
272,
2013,
63,
23216,
12,
272,
11513,
2940,
7738,
29489,
12,
272,
11513,
2940,
7826,
29489,
12,
272,
11513,
2940,
19727,
29489,
12,
339,
327,
19991,
1487,
6444,
799,
2660,
272,
6186,
63,
1093,
14246,
2594,
63,
907,
28883,
12,
199,
9,
199,
504,
1275,
4732,
4291,
492,
334,
221,
327,
949,
492,
1865,
272,
11513,
49,
2673,
343,
12,
272,
11513,
2940,
5136,
12,
272,
11513,
2940,
1558,
12,
272,
11513,
2940,
4082,
12,
272,
11513,
2940,
998,
12,
199,
9,
199,
504,
1275,
3629,
492,
11513,
2940,
6700,
199,
199,
504,
1275,
21627,
492,
334,
272,
327,
298,
5081,
2,
402,
2434,
1804,
18212,
272,
2434,
13028,
12,
339,
327,
11513,
2940,
18851,
367,
1109,
14254,
14,
272,
636,
6700,
12,
272,
636,
29489,
12,
272,
636,
29489,
6592,
12,
272,
636,
804,
12,
272,
636,
792,
12,
272,
636,
3205,
1110,
12,
272,
636,
14432,
12,
272,
636,
804,
13028,
12,
339,
327,
6288,
13,
698,
10269,
14,
272,
13268,
3396,
792,
6172,
12,
272,
2434,
3396,
792,
6172,
12,
272,
2434,
985,
3396,
792,
6172,
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
] | [
27510,
24,
26,
8151,
199,
504,
1275,
7463,
492,
334,
221,
327,
949,
492,
1865,
272,
11513,
2940,
13090,
804,
12,
272,
11513,
49,
30113,
804,
12,
272,
11513,
2940,
792,
12,
272,
11513,
2940,
5201,
12,
272,
11513,
2940,
4267,
804,
12,
272,
11513,
2940,
15540,
804,
12,
272,
11513,
49,
906,
1507,
804,
12,
272,
11513,
49,
906,
1507,
1110,
12,
272,
11513,
2940,
3205,
1692,
804,
12,
272,
11513,
2940,
3205,
1692,
792,
12,
272,
11513,
2940,
1296,
12,
272,
11513,
2940,
6932,
8849,
12,
272,
664,
63,
4579,
63,
466,
12,
272,
365,
63,
6198,
63,
466,
12,
272,
365,
63,
16907,
63,
466,
12,
272,
365,
63,
1210,
63,
466,
12,
272,
365,
63,
8914,
63,
466,
12,
272,
365,
63,
466,
12,
272,
664,
63,
16375,
63,
466,
12,
272,
365,
63,
1199,
63,
466,
199,
9,
199,
504,
1275,
23216,
492,
334,
272,
327,
298,
5081,
2,
402,
3757,
8374,
9918,
272,
3757,
8374,
6592,
12,
339,
327,
3757,
8374,
5492,
272,
11513,
2940,
29489,
12,
339,
327,
4779,
4803,
13,
262,
13502,
3247,
701,
314,
31511,
272,
2013,
63,
23216,
12,
272,
11513,
2940,
7738,
29489,
12,
272,
11513,
2940,
7826,
29489,
12,
272,
11513,
2940,
19727,
29489,
12,
339,
327,
19991,
1487,
6444,
799,
2660,
272,
6186,
63,
1093,
14246,
2594,
63,
907,
28883,
12,
199,
9,
199,
504,
1275,
4732,
4291,
492,
334,
221,
327,
949,
492,
1865,
272,
11513,
49,
2673,
343,
12,
272,
11513,
2940,
5136,
12,
272,
11513,
2940,
1558,
12,
272,
11513,
2940,
4082,
12,
272,
11513,
2940,
998,
12,
199,
9,
199,
504,
1275,
3629,
492,
11513,
2940,
6700,
199,
199,
504,
1275,
21627,
492,
334,
272,
327,
298,
5081,
2,
402,
2434,
1804,
18212,
272,
2434,
13028,
12,
339,
327,
11513,
2940,
18851,
367,
1109,
14254,
14,
272,
636,
6700,
12,
272,
636,
29489,
12,
272,
636,
29489,
6592,
12,
272,
636,
804,
12,
272,
636,
792,
12,
272,
636,
3205,
1110,
12,
272,
636,
14432,
12,
272,
636,
804,
13028,
12,
339,
327,
6288,
13,
698,
10269,
14,
272,
13268,
3396,
792,
6172,
12,
272,
2434,
3396,
792,
6172,
12,
272,
2434,
985,
3396,
792,
6172,
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,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
sdague/home-assistant | tests/components/mqtt/test_tag.py | 6 | 24527 | """The tests for MQTT tag scanner."""
import copy
import json
import pytest
from tests.async_mock import ANY, patch
from tests.common import (
async_fire_mqtt_message,
async_get_device_automations,
mock_device_registry,
mock_registry,
)
DEFAULT_CONFIG_DEVICE = {
"device": {"identifiers": ["0AFFD2"]},
"topic": "foobar/tag_scanned",
}
DEFAULT_CONFIG = {
"topic": "foobar/tag_scanned",
}
DEFAULT_CONFIG_JSON = {
"device": {"identifiers": ["0AFFD2"]},
"topic": "foobar/tag_scanned",
"value_template": "{{ value_json.PN532.UID }}",
}
DEFAULT_TAG_ID = "E9F35959"
DEFAULT_TAG_SCAN = "E9F35959"
DEFAULT_TAG_SCAN_JSON = (
'{"Time":"2020-09-28T17:02:10","PN532":{"UID":"E9F35959", "DATA":"ILOVETASMOTA"}}'
)
@pytest.fixture
def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass)
@pytest.fixture
def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass)
@pytest.fixture
def tag_mock():
"""Fixture to mock tag."""
with patch("homeassistant.components.tag.async_scan_tag") as mock_tag:
yield mock_tag
@pytest.mark.no_fail_on_log_exception
async def test_discover_bad_tag(hass, device_reg, entity_reg, mqtt_mock, tag_mock):
"""Test bad discovery message."""
config1 = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
# Test sending bad data
data0 = '{ "device":{"identifiers":["0AFFD2"]}, "topics": "foobar/tag_scanned" }'
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data0)
await hass.async_block_till_done()
assert device_reg.async_get_device({("mqtt", "0AFFD2")}, set()) is None
# Test sending correct data
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", json.dumps(config1))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_if_fires_on_mqtt_message_with_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning, with device."""
config = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_if_fires_on_mqtt_message_without_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning, without device."""
config = copy.deepcopy(DEFAULT_CONFIG)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
async def test_if_fires_on_mqtt_message_with_template(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning, with device."""
config = copy.deepcopy(DEFAULT_CONFIG_JSON)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN_JSON)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_strip_tag_id(hass, device_reg, mqtt_mock, tag_mock):
"""Test strip whitespace from tag_id."""
config = copy.deepcopy(DEFAULT_CONFIG)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", "123456 ")
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, "123456", None)
async def test_if_fires_on_mqtt_message_after_update_with_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning after update."""
config1 = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
config2 = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
config2["topic"] = "foobar/tag_scanned2"
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config1))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Update the tag scanner with different topic
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned2", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Update the tag scanner with same topic
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned2", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_if_fires_on_mqtt_message_after_update_without_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning after update."""
config1 = copy.deepcopy(DEFAULT_CONFIG)
config2 = copy.deepcopy(DEFAULT_CONFIG)
config2["topic"] = "foobar/tag_scanned2"
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config1))
await hass.async_block_till_done()
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
# Update the tag scanner with different topic
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned2", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
# Update the tag scanner with same topic
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned2", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
async def test_if_fires_on_mqtt_message_after_update_with_template(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning after update."""
config1 = copy.deepcopy(DEFAULT_CONFIG_JSON)
config2 = copy.deepcopy(DEFAULT_CONFIG_JSON)
config2["value_template"] = "{{ value_json.RDM6300.UID }}"
tag_scan_2 = '{"Time":"2020-09-28T17:02:10","RDM6300":{"UID":"E9F35959", "DATA":"ILOVETASMOTA"}}'
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config1))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN_JSON)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Update the tag scanner with different template
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN_JSON)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned", tag_scan_2)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Update the tag scanner with same template
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config2))
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN_JSON)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async_fire_mqtt_message(hass, "foobar/tag_scanned", tag_scan_2)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_no_resubscribe_same_topic(hass, device_reg, mqtt_mock):
"""Test subscription to topics without change."""
config = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
assert device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
call_count = mqtt_mock.async_subscribe.call_count
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
assert mqtt_mock.async_subscribe.call_count == call_count
async def test_not_fires_on_mqtt_message_after_remove_by_mqtt_with_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning after removal."""
config = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Remove the tag scanner
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", "")
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
# Rediscover the tag scanner
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
async def test_not_fires_on_mqtt_message_after_remove_by_mqtt_without_device(
hass, device_reg, mqtt_mock, tag_mock
):
"""Test tag scanning not firing after removal."""
config = copy.deepcopy(DEFAULT_CONFIG)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
# Remove the tag scanner
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", "")
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
# Rediscover the tag scanner
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, None)
async def test_not_fires_on_mqtt_message_after_remove_from_registry(
hass,
device_reg,
mqtt_mock,
tag_mock,
):
"""Test tag scanning after removal."""
config = copy.deepcopy(DEFAULT_CONFIG_DEVICE)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config))
await hass.async_block_till_done()
device_entry = device_reg.async_get_device({("mqtt", "0AFFD2")}, set())
# Fake tag scan.
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, DEFAULT_TAG_ID, device_entry.id)
# Remove the device
device_reg.async_remove_device(device_entry.id)
await hass.async_block_till_done()
tag_mock.reset_mock()
async_fire_mqtt_message(hass, "foobar/tag_scanned", DEFAULT_TAG_SCAN)
await hass.async_block_till_done()
tag_mock.assert_not_called()
async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT device registry integration."""
registry = await hass.helpers.device_registry.async_get_registry()
data = json.dumps(
{
"topic": "test-topic",
"device": {
"connections": [["mac", "02:5b:26:a8:dc:12"]],
"manufacturer": "Whatever",
"name": "Beer",
"model": "Glass",
"sw_version": "0.1-beta",
},
}
)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
device = registry.async_get_device(set(), {("mac", "02:5b:26:a8:dc:12")})
assert device is not None
assert device.connections == {("mac", "02:5b:26:a8:dc:12")}
assert device.manufacturer == "Whatever"
assert device.name == "Beer"
assert device.model == "Glass"
assert device.sw_version == "0.1-beta"
async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT device registry integration."""
registry = await hass.helpers.device_registry.async_get_registry()
data = json.dumps(
{
"topic": "test-topic",
"device": {
"identifiers": ["helloworld"],
"manufacturer": "Whatever",
"name": "Beer",
"model": "Glass",
"sw_version": "0.1-beta",
},
}
)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
device = registry.async_get_device({("mqtt", "helloworld")}, set())
assert device is not None
assert device.identifiers == {("mqtt", "helloworld")}
assert device.manufacturer == "Whatever"
assert device.name == "Beer"
assert device.model == "Glass"
assert device.sw_version == "0.1-beta"
async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
registry = await hass.helpers.device_registry.async_get_registry()
config = {
"topic": "test-topic",
"device": {
"identifiers": ["helloworld"],
"connections": [["mac", "02:5b:26:a8:dc:12"]],
"manufacturer": "Whatever",
"name": "Beer",
"model": "Glass",
"sw_version": "0.1-beta",
},
}
data = json.dumps(config)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
device = registry.async_get_device({("mqtt", "helloworld")}, set())
assert device is not None
assert device.name == "Beer"
config["device"]["name"] = "Milk"
data = json.dumps(config)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
device = registry.async_get_device({("mqtt", "helloworld")}, set())
assert device is not None
assert device.name == "Milk"
async def test_cleanup_tag(hass, device_reg, entity_reg, mqtt_mock):
"""Test tag discovery topic is cleaned when device is removed from registry."""
config = {
"topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
}
data = json.dumps(config)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
# Verify device registry entry is created
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
device_reg.async_remove_device(device_entry.id)
await hass.async_block_till_done()
await hass.async_block_till_done()
# Verify device registry entry is cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is None
# Verify retained discovery topic has been cleared
mqtt_mock.async_publish.assert_called_once_with(
"homeassistant/tag/bla/config", "", 0, True
)
async def test_cleanup_device(hass, device_reg, entity_reg, mqtt_mock):
"""Test removal from device registry when tag is removed."""
config = {
"topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
}
data = json.dumps(config)
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", data)
await hass.async_block_till_done()
# Verify device registry entry is created
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
async_fire_mqtt_message(hass, "homeassistant/tag/bla/config", "")
await hass.async_block_till_done()
# Verify device registry entry is cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is None
async def test_cleanup_device_several_tags(
hass, device_reg, entity_reg, mqtt_mock, tag_mock
):
"""Test removal from device registry when the last tag is removed."""
config1 = {
"topic": "test-topic1",
"device": {"identifiers": ["helloworld"]},
}
config2 = {
"topic": "test-topic2",
"device": {"identifiers": ["helloworld"]},
}
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", json.dumps(config1))
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/tag/bla2/config", json.dumps(config2))
await hass.async_block_till_done()
# Verify device registry entry is created
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", "")
await hass.async_block_till_done()
# Verify device registry entry is not cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
# Fake tag scan.
async_fire_mqtt_message(hass, "test-topic1", "12345")
async_fire_mqtt_message(hass, "test-topic2", "23456")
await hass.async_block_till_done()
tag_mock.assert_called_once_with(ANY, "23456", device_entry.id)
async_fire_mqtt_message(hass, "homeassistant/tag/bla2/config", "")
await hass.async_block_till_done()
# Verify device registry entry is cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is None
async def test_cleanup_device_with_entity_and_trigger_1(
hass, device_reg, entity_reg, mqtt_mock
):
"""Test removal from device registry for device with tag, entity and trigger.
Tag removed first, then trigger and entity.
"""
config1 = {
"topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
}
config2 = {
"automation_type": "trigger",
"topic": "test-topic",
"type": "foo",
"subtype": "bar",
"device": {"identifiers": ["helloworld"]},
}
config3 = {
"name": "test_binary_sensor",
"state_topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
"unique_id": "veryunique",
}
data1 = json.dumps(config1)
data2 = json.dumps(config2)
data3 = json.dumps(config3)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", data1)
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla2/config", data2)
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/binary_sensor/bla3/config", data3)
await hass.async_block_till_done()
# Verify device registry entry is created
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
assert len(triggers) == 3 # 2 binary_sensor triggers + device trigger
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", "")
await hass.async_block_till_done()
# Verify device registry entry is not cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla2/config", "")
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/binary_sensor/bla3/config", "")
await hass.async_block_till_done()
# Verify device registry entry is cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is None
async def test_cleanup_device_with_entity2(hass, device_reg, entity_reg, mqtt_mock):
"""Test removal from device registry for device with tag, entity and trigger.
Trigger and entity removed first, then tag.
"""
config1 = {
"topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
}
config2 = {
"automation_type": "trigger",
"topic": "test-topic",
"type": "foo",
"subtype": "bar",
"device": {"identifiers": ["helloworld"]},
}
config3 = {
"name": "test_binary_sensor",
"state_topic": "test-topic",
"device": {"identifiers": ["helloworld"]},
"unique_id": "veryunique",
}
data1 = json.dumps(config1)
data2 = json.dumps(config2)
data3 = json.dumps(config3)
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", data1)
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla2/config", data2)
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/binary_sensor/bla3/config", data3)
await hass.async_block_till_done()
# Verify device registry entry is created
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
assert len(triggers) == 3 # 2 binary_sensor triggers + device trigger
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla2/config", "")
await hass.async_block_till_done()
async_fire_mqtt_message(hass, "homeassistant/binary_sensor/bla3/config", "")
await hass.async_block_till_done()
# Verify device registry entry is not cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is not None
async_fire_mqtt_message(hass, "homeassistant/tag/bla1/config", "")
await hass.async_block_till_done()
# Verify device registry entry is cleared
device_entry = device_reg.async_get_device({("mqtt", "helloworld")}, set())
assert device_entry is None
| apache-2.0 | [
624,
1918,
2295,
367,
603,
49,
1481,
1947,
19121,
1041,
199,
646,
1331,
199,
646,
2022,
199,
199,
646,
4613,
199,
199,
504,
2295,
14,
4146,
63,
1805,
492,
1821,
12,
3371,
199,
504,
2295,
14,
2330,
492,
334,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
12,
272,
5316,
63,
362,
63,
1782,
63,
2495,
21953,
12,
272,
1683,
63,
1782,
63,
5189,
12,
272,
1683,
63,
5189,
12,
199,
9,
199,
199,
3472,
63,
5569,
63,
10555,
275,
469,
272,
298,
1782,
582,
2420,
14227,
582,
2097,
16,
33,
24192,
18,
19057,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
199,
93,
199,
199,
3472,
63,
5569,
275,
469,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
199,
93,
199,
199,
3472,
63,
5569,
63,
6243,
275,
469,
272,
298,
1782,
582,
2420,
14227,
582,
2097,
16,
33,
24192,
18,
19057,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
272,
298,
585,
63,
1160,
582,
7370,
574,
63,
1001,
14,
9060,
30102,
14,
6685,
3586,
401,
199,
93,
199,
199,
3472,
63,
6967,
63,
998,
275,
298,
37,
25,
38,
11444,
1427,
2,
199,
199,
3472,
63,
6967,
63,
24078,
275,
298,
37,
25,
38,
11444,
1427,
2,
199,
199,
3472,
63,
6967,
63,
24078,
63,
6243,
275,
334,
272,
17137,
1366,
5122,
13934,
13,
1643,
13,
1651,
52,
1196,
26,
996,
26,
709,
2266,
9060,
30102,
18517,
6685,
5122,
37,
25,
38,
11444,
1427,
401,
298,
3998,
5122,
1193,
30692,
775,
1179,
27235,
33,
3570,
6834,
199,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
2243,
63,
1135,
8,
5387,
304,
272,
408,
1767,
376,
2701,
12,
6511,
12,
7086,
1041,
272,
372,
1683,
63,
1782,
63,
5189,
8,
5387,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
4642,
63,
1135,
8,
5387,
304,
272,
408,
1767,
376,
2701,
12,
6511,
12,
7086,
1041,
272,
372,
1683,
63,
5189,
8,
5387,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
1947,
63,
1805,
837,
272,
408,
12812,
370,
1683,
1947,
1041,
272,
543,
3371,
480,
22799,
14,
4608,
14,
1450,
14,
4146,
63,
6282,
63,
1450,
531,
465,
1683,
63,
1450,
26,
267,
1995,
1683,
63,
1450,
421,
199,
32,
4462,
14,
1657,
14,
889,
63,
1633,
63,
265,
63,
793,
63,
1971,
199,
4146,
347,
511,
63,
18861,
63,
4087,
63,
1450,
8,
5387,
12,
2243,
63,
1135,
12,
4642,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
304,
272,
408,
774,
4875,
13172,
1245,
1041,
272,
1101,
17,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
63,
10555,
9,
339,
327,
1379,
10209,
4875,
666,
272,
666,
16,
275,
5041,
298,
1782,
18517,
14227,
582,
905,
16,
33,
24192,
18,
19057,
298,
11299,
582,
298,
9664,
15,
1450,
63,
551,
9386,
2,
789,
7,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
15,
888,
401,
666,
16,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
702,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
365,
488,
339,
327,
1379,
10209,
3211,
666,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
15,
888,
401,
2022,
14,
4180,
8,
888,
17,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
2243,
63,
2373,
275,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
272,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
12,
6186,
63,
6967,
63,
998,
12,
2243,
63,
2373,
14,
344,
9,
421,
199,
4146,
347,
511,
63,
692,
63,
329,
470,
63,
265,
63,
19214,
63,
1188,
63,
1045,
63,
1782,
8,
272,
6298,
12,
2243,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
199,
304,
272,
408,
774,
1947,
24928,
12,
543,
2243,
1041,
272,
1101,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
63,
10555,
9,
339,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
17,
15,
888,
401,
2022,
14,
4180,
8,
888,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
2243,
63,
2373,
275,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
339,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
12,
6186,
63,
6967,
63,
998,
12,
2243,
63,
2373,
14,
344,
9,
421,
199,
4146,
347,
511,
63,
692,
63,
329,
470,
63,
265,
63,
19214,
63,
1188,
63,
7395,
63,
1782,
8,
272,
6298,
12,
2243,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
199,
304,
272,
408,
774,
1947,
24928,
12,
1928,
2243,
1041,
272,
1101,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
9,
339,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
17,
15,
888,
401,
2022,
14,
4180,
8,
888,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
12
] | [
1918,
2295,
367,
603,
49,
1481,
1947,
19121,
1041,
199,
646,
1331,
199,
646,
2022,
199,
199,
646,
4613,
199,
199,
504,
2295,
14,
4146,
63,
1805,
492,
1821,
12,
3371,
199,
504,
2295,
14,
2330,
492,
334,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
12,
272,
5316,
63,
362,
63,
1782,
63,
2495,
21953,
12,
272,
1683,
63,
1782,
63,
5189,
12,
272,
1683,
63,
5189,
12,
199,
9,
199,
199,
3472,
63,
5569,
63,
10555,
275,
469,
272,
298,
1782,
582,
2420,
14227,
582,
2097,
16,
33,
24192,
18,
19057,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
199,
93,
199,
199,
3472,
63,
5569,
275,
469,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
199,
93,
199,
199,
3472,
63,
5569,
63,
6243,
275,
469,
272,
298,
1782,
582,
2420,
14227,
582,
2097,
16,
33,
24192,
18,
19057,
272,
298,
5746,
582,
298,
9664,
15,
1450,
63,
551,
9386,
401,
272,
298,
585,
63,
1160,
582,
7370,
574,
63,
1001,
14,
9060,
30102,
14,
6685,
3586,
401,
199,
93,
199,
199,
3472,
63,
6967,
63,
998,
275,
298,
37,
25,
38,
11444,
1427,
2,
199,
199,
3472,
63,
6967,
63,
24078,
275,
298,
37,
25,
38,
11444,
1427,
2,
199,
199,
3472,
63,
6967,
63,
24078,
63,
6243,
275,
334,
272,
17137,
1366,
5122,
13934,
13,
1643,
13,
1651,
52,
1196,
26,
996,
26,
709,
2266,
9060,
30102,
18517,
6685,
5122,
37,
25,
38,
11444,
1427,
401,
298,
3998,
5122,
1193,
30692,
775,
1179,
27235,
33,
3570,
6834,
199,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
2243,
63,
1135,
8,
5387,
304,
272,
408,
1767,
376,
2701,
12,
6511,
12,
7086,
1041,
272,
372,
1683,
63,
1782,
63,
5189,
8,
5387,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
4642,
63,
1135,
8,
5387,
304,
272,
408,
1767,
376,
2701,
12,
6511,
12,
7086,
1041,
272,
372,
1683,
63,
5189,
8,
5387,
9,
421,
199,
32,
4462,
14,
5997,
199,
318,
1947,
63,
1805,
837,
272,
408,
12812,
370,
1683,
1947,
1041,
272,
543,
3371,
480,
22799,
14,
4608,
14,
1450,
14,
4146,
63,
6282,
63,
1450,
531,
465,
1683,
63,
1450,
26,
267,
1995,
1683,
63,
1450,
421,
199,
32,
4462,
14,
1657,
14,
889,
63,
1633,
63,
265,
63,
793,
63,
1971,
199,
4146,
347,
511,
63,
18861,
63,
4087,
63,
1450,
8,
5387,
12,
2243,
63,
1135,
12,
4642,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
304,
272,
408,
774,
4875,
13172,
1245,
1041,
272,
1101,
17,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
63,
10555,
9,
339,
327,
1379,
10209,
4875,
666,
272,
666,
16,
275,
5041,
298,
1782,
18517,
14227,
582,
905,
16,
33,
24192,
18,
19057,
298,
11299,
582,
298,
9664,
15,
1450,
63,
551,
9386,
2,
789,
7,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
15,
888,
401,
666,
16,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
702,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
365,
488,
339,
327,
1379,
10209,
3211,
666,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
15,
888,
401,
2022,
14,
4180,
8,
888,
17,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
2243,
63,
2373,
275,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
272,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
12,
6186,
63,
6967,
63,
998,
12,
2243,
63,
2373,
14,
344,
9,
421,
199,
4146,
347,
511,
63,
692,
63,
329,
470,
63,
265,
63,
19214,
63,
1188,
63,
1045,
63,
1782,
8,
272,
6298,
12,
2243,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
199,
304,
272,
408,
774,
1947,
24928,
12,
543,
2243,
1041,
272,
1101,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
63,
10555,
9,
339,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
17,
15,
888,
401,
2022,
14,
4180,
8,
888,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
2243,
63,
2373,
275,
2243,
63,
1135,
14,
4146,
63,
362,
63,
1782,
2561,
480,
19214,
401,
298,
16,
33,
24192,
18,
25988,
663,
1012,
339,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
12,
6186,
63,
6967,
63,
998,
12,
2243,
63,
2373,
14,
344,
9,
421,
199,
4146,
347,
511,
63,
692,
63,
329,
470,
63,
265,
63,
19214,
63,
1188,
63,
7395,
63,
1782,
8,
272,
6298,
12,
2243,
63,
1135,
12,
22925,
63,
1805,
12,
1947,
63,
1805,
199,
304,
272,
408,
774,
1947,
24928,
12,
1928,
2243,
1041,
272,
1101,
275,
1331,
14,
8293,
8,
3472,
63,
5569,
9,
339,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
22799,
15,
1450,
15,
21244,
17,
15,
888,
401,
2022,
14,
4180,
8,
888,
430,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
327,
7777,
1947,
8000,
14,
272,
5316,
63,
8935,
63,
19214,
63,
1188,
8,
5387,
12,
298,
9664,
15,
1450,
63,
551,
9386,
401,
6186,
63,
6967,
63,
24078,
9,
272,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
272,
1947,
63,
1805,
14,
479,
63,
3527,
63,
5089,
63,
1045,
8,
8974,
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,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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
] |
digwanderlust/pants | src/python/pants/backend/android/distribution/android_distribution.py | 31 | 3997 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
from pants.util.dirutil import safe_mkdir
class AndroidDistribution(object):
"""Represent an Android SDK distribution."""
class DistributionError(Exception):
"""Indicate an invalid android distribution."""
_CACHED_SDK = {}
@classmethod
def cached(cls, path=None):
"""Return an AndroidDistribution and cache results.
:param string path: Optional path of an Android SDK installation.
:return: An android distribution.
:rtype: AndroidDistribution
"""
dist = cls._CACHED_SDK.get(path)
if not dist:
dist = cls.locate_sdk_path(path)
cls._CACHED_SDK[path] = dist
return dist
@classmethod
def locate_sdk_path(cls, path=None):
"""Locate an Android SDK by checking any passed path and then traditional environmental aliases.
:param string path: Optional local address of a SDK.
:return: An android distribution.
:rtype: AndroidDistribution
:raises: ``DistributionError`` if SDK cannot be found.
"""
def sdk_path(sdk_env_var):
"""Return the full path of environmental variable sdk_env_var."""
sdk = os.environ.get(sdk_env_var)
return os.path.abspath(sdk) if sdk else None
def search_path(path):
"""Find a Android SDK home directory."""
if path:
yield os.path.abspath(path)
yield sdk_path('ANDROID_HOME')
yield sdk_path('ANDROID_SDK_HOME')
yield sdk_path('ANDROID_SDK')
for path in filter(None, search_path(path)):
dist = cls(sdk_path=path)
return dist
raise cls.DistributionError('Failed to locate Android SDK. Please install '
'SDK and set ANDROID_HOME in your path.')
def __init__(self, sdk_path):
"""Create an Android distribution and cache tools for quick retrieval."""
self._sdk_path = sdk_path
self._validated_tools = {}
def register_android_tool(self, tool_path, workdir=None):
"""Return the full path for the tool at SDK location tool_path or of a copy under workdir.
All android tasks should request their tools using this method.
:param string tool_path: Path to tool, relative to the Android SDK root, e.g
'platforms/android-19/android.jar'.
:param string workdir: Location for the copied file. Pants will put a copy of the
android file under workdir.
:return: Full path to either the tool or a created copy of that tool.
:rtype: string
:raises: ``DistributionError`` if tool cannot be found.
"""
if tool_path not in self._validated_tools:
android_tool = self._get_tool_path(tool_path)
# If an android file is bound for the classpath it must be under buildroot, so create a copy.
if workdir:
copy_path = os.path.join(workdir, tool_path)
if not os.path.isfile(copy_path):
try:
safe_mkdir(os.path.dirname(copy_path))
shutil.copy(android_tool, copy_path)
except OSError as e:
raise self.DistributionError('Problem creating copy of the android tool: {}'.format(e))
self._validated_tools[tool_path] = copy_path
else:
self._validated_tools[tool_path] = android_tool
return self._validated_tools[tool_path]
def _get_tool_path(self, tool_path):
"""Return full path of tool if it is found on disk."""
android_tool = os.path.join(self._sdk_path, tool_path)
if os.path.isfile(android_tool):
return android_tool
else:
raise self.DistributionError('There is no {} installed. The Android SDK may need to be '
'updated.'.format(android_tool))
def __repr__(self):
return 'AndroidDistribution({})'.format(self._sdk_path)
| apache-2.0 | [
3,
2803,
29,
1624,
13,
24,
199,
3,
1898,
6927,
510,
2285,
2199,
8417,
334,
3239,
6483,
14,
1064,
680,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
3239,
5113,
680,
199,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
16952,
12,
6032,
63,
14129,
12,
870,
63,
1593,
12,
717,
2649,
63,
5955,
12,
543,
63,
6242,
9,
199,
199,
646,
747,
199,
646,
5145,
199,
199,
504,
18081,
14,
1974,
14,
694,
1974,
492,
5048,
63,
8215,
421,
199,
533,
14694,
8580,
8,
785,
304,
523,
408,
10755,
376,
14694,
15610,
4084,
1041,
819,
1021,
11839,
547,
8,
1726,
304,
272,
408,
607,
10188,
376,
3866,
15516,
4084,
1041,
819,
485,
3263,
22492,
63,
14939,
275,
1052,
819,
768,
3744,
523,
347,
6328,
8,
1886,
12,
931,
29,
403,
304,
272,
408,
1767,
376,
14694,
8580,
436,
2581,
2058,
14,
339,
520,
635,
1059,
931,
26,
4879,
931,
402,
376,
14694,
15610,
12096,
14,
272,
520,
1107,
26,
1626,
15516,
4084,
14,
272,
520,
4500,
26,
14694,
8580,
272,
408,
272,
2917,
275,
843,
423,
3263,
22492,
63,
14939,
14,
362,
8,
515,
9,
272,
340,
440,
2917,
26,
489,
2917,
275,
843,
14,
6280,
63,
9277,
63,
515,
8,
515,
9,
489,
843,
423,
3263,
22492,
63,
14939,
59,
515,
61,
275,
2917,
272,
372,
2917,
819,
768,
3744,
523,
347,
16592,
63,
9277,
63,
515,
8,
1886,
12,
931,
29,
403,
304,
272,
408,
3040,
323,
376,
14694,
15610,
701,
7907,
1263,
3032,
931,
436,
2066,
1468,
2603,
3734,
279,
5481,
14,
339,
520,
635,
1059,
931,
26,
4879,
2257,
2287,
402,
282,
15610,
14,
272,
520,
1107,
26,
1626,
15516,
4084,
14,
272,
520,
4500,
26,
14694,
8580,
272,
520,
3536,
26,
1124,
8580,
547,
1040,
340,
15610,
3913,
506,
1911,
14,
272,
408,
272,
347,
13628,
63,
515,
8,
9277,
63,
1813,
63,
1391,
304,
489,
408,
1767,
314,
2615,
931,
402,
3734,
279,
1750,
13628,
63,
1813,
63,
1391,
1041,
489,
13628,
275,
747,
14,
2314,
14,
362,
8,
9277,
63,
1813,
63,
1391,
9,
489,
372,
747,
14,
515,
14,
4832,
8,
9277,
9,
340,
13628,
587,
488,
339,
347,
2754,
63,
515,
8,
515,
304,
489,
408,
6591,
282,
14694,
15610,
5629,
2082,
1041,
489,
340,
931,
26,
267,
1995,
747,
14,
515,
14,
4832,
8,
515,
9,
489,
1995,
13628,
63,
515,
360,
25658,
63,
9524,
358,
489,
1995,
13628,
63,
515,
360,
25658,
63,
14939,
63,
9524,
358,
489,
1995,
13628,
63,
515,
360,
25658,
63,
14939,
358,
339,
367,
931,
315,
2457,
8,
403,
12,
2754,
63,
515,
8,
515,
2298,
489,
2917,
275,
843,
8,
9277,
63,
515,
29,
515,
9,
489,
372,
2917,
272,
746,
843,
14,
8580,
547,
360,
4276,
370,
16592,
14694,
15610,
14,
7754,
3907,
283,
1816,
283,
14939,
436,
663,
2401,
22045,
63,
9524,
315,
2195,
931,
2659,
819,
347,
636,
826,
721,
277,
12,
13628,
63,
515,
304,
272,
408,
2499,
376,
14694,
4084,
436,
2581,
7249,
367,
12530,
27157,
1041,
272,
291,
423,
9277,
63,
515,
275,
13628,
63,
515,
272,
291,
423,
24372,
63,
2537,
275,
1052,
819,
347,
2274,
63,
6238,
63,
3557,
8,
277,
12,
4744,
63,
515,
12,
1736,
694,
29,
403,
304,
272,
408,
1767,
314,
2615,
931,
367,
314,
4744,
737,
15610,
2909,
4744,
63,
515,
503,
402,
282,
1331,
1334,
1736,
694,
14,
339,
2900,
15516,
6527,
1077,
1056,
3932,
7249,
1808,
642,
1083,
14,
272,
520,
635,
1059,
4744,
63,
515,
26,
6912,
370,
4744,
12,
3847,
370,
314,
14694,
15610,
1738,
12,
325,
14,
71,
489,
283,
19601,
15,
6238,
13,
1167,
15,
6238,
14,
7338,
1370,
272,
520,
635,
1059,
1736,
694,
26,
12625,
367,
314,
8876,
570,
14,
510,
2285,
911,
5324,
282,
1331,
402,
314,
489,
15516,
570,
1334,
1736,
694,
14,
272,
520,
1107,
26,
16579,
931,
370,
1902,
314,
4744,
503,
282,
2737,
1331,
402,
626,
4744,
14,
272,
520,
4500,
26,
1059,
272,
520,
3536,
26,
1124,
8580,
547,
1040,
340,
4744,
3913,
506,
1911,
14,
272,
408,
272,
340,
4744,
63,
515,
440,
315,
291,
423,
24372,
63,
2537,
26,
489,
15516,
63,
3557,
275,
291,
423,
362,
63,
3557,
63,
515,
8,
3557,
63,
515,
9,
489,
327,
982,
376,
15516,
570,
365,
3914,
367,
314,
1021,
515,
652,
1471,
506,
1334,
1900,
1231,
12,
880,
1218,
282,
1331,
14,
489,
340,
1736,
694,
26,
267,
1331,
63,
515,
275,
747,
14,
515,
14,
904,
8,
19132,
12,
4744,
63,
515,
9,
267,
340,
440,
747,
14,
515,
14,
6292,
8,
1574,
63,
515,
304,
881,
862,
26,
288,
5048,
63,
8215,
8,
736,
14,
515,
14,
3475,
8,
1574,
63,
515,
430,
288,
5145,
14,
1574,
8,
6238,
63,
3557,
12,
1331,
63,
515,
9,
881,
871,
6440,
465,
325,
26,
288,
746,
291,
14,
8580,
547,
360,
16467,
6425,
1331,
402,
314,
15516,
4744,
26,
9499,
908,
8,
69,
430,
267,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
275,
1331,
63,
515,
489,
587,
26,
267,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
275,
15516,
63,
3557,
272,
372,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
819,
347,
485,
362,
63,
3557,
63,
515,
8,
277,
12,
4744,
63,
515,
304,
272,
408,
1767,
2615,
931,
402,
4744,
340,
652,
365,
1911,
641,
4543,
1041,
272,
15516,
63,
3557,
275,
747,
14,
515,
14,
904,
8,
277,
423,
9277,
63,
515,
12,
4744,
63,
515,
9,
272,
340,
747,
14,
515,
14,
6292,
8,
6238,
63,
3557,
304,
489,
372,
15516,
63,
3557,
272,
587,
26,
489,
746,
291,
14,
8580,
547,
360,
10924,
365,
949,
1052,
4903,
14,
710,
14694,
15610,
1443,
1929,
370,
506,
283,
3521,
283,
5334,
17374,
908,
8,
6238,
63,
3557,
430,
819,
347,
636,
2722,
721,
277,
304,
272,
372,
283,
20762,
8580,
14079,
1370,
908,
8,
277,
423,
9277,
63,
515,
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
] | [
2803,
29,
1624,
13,
24,
199,
3,
1898,
6927,
510,
2285,
2199,
8417,
334,
3239,
6483,
14,
1064,
680,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
3239,
5113,
680,
199,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
16952,
12,
6032,
63,
14129,
12,
870,
63,
1593,
12,
717,
2649,
63,
5955,
12,
543,
63,
6242,
9,
199,
199,
646,
747,
199,
646,
5145,
199,
199,
504,
18081,
14,
1974,
14,
694,
1974,
492,
5048,
63,
8215,
421,
199,
533,
14694,
8580,
8,
785,
304,
523,
408,
10755,
376,
14694,
15610,
4084,
1041,
819,
1021,
11839,
547,
8,
1726,
304,
272,
408,
607,
10188,
376,
3866,
15516,
4084,
1041,
819,
485,
3263,
22492,
63,
14939,
275,
1052,
819,
768,
3744,
523,
347,
6328,
8,
1886,
12,
931,
29,
403,
304,
272,
408,
1767,
376,
14694,
8580,
436,
2581,
2058,
14,
339,
520,
635,
1059,
931,
26,
4879,
931,
402,
376,
14694,
15610,
12096,
14,
272,
520,
1107,
26,
1626,
15516,
4084,
14,
272,
520,
4500,
26,
14694,
8580,
272,
408,
272,
2917,
275,
843,
423,
3263,
22492,
63,
14939,
14,
362,
8,
515,
9,
272,
340,
440,
2917,
26,
489,
2917,
275,
843,
14,
6280,
63,
9277,
63,
515,
8,
515,
9,
489,
843,
423,
3263,
22492,
63,
14939,
59,
515,
61,
275,
2917,
272,
372,
2917,
819,
768,
3744,
523,
347,
16592,
63,
9277,
63,
515,
8,
1886,
12,
931,
29,
403,
304,
272,
408,
3040,
323,
376,
14694,
15610,
701,
7907,
1263,
3032,
931,
436,
2066,
1468,
2603,
3734,
279,
5481,
14,
339,
520,
635,
1059,
931,
26,
4879,
2257,
2287,
402,
282,
15610,
14,
272,
520,
1107,
26,
1626,
15516,
4084,
14,
272,
520,
4500,
26,
14694,
8580,
272,
520,
3536,
26,
1124,
8580,
547,
1040,
340,
15610,
3913,
506,
1911,
14,
272,
408,
272,
347,
13628,
63,
515,
8,
9277,
63,
1813,
63,
1391,
304,
489,
408,
1767,
314,
2615,
931,
402,
3734,
279,
1750,
13628,
63,
1813,
63,
1391,
1041,
489,
13628,
275,
747,
14,
2314,
14,
362,
8,
9277,
63,
1813,
63,
1391,
9,
489,
372,
747,
14,
515,
14,
4832,
8,
9277,
9,
340,
13628,
587,
488,
339,
347,
2754,
63,
515,
8,
515,
304,
489,
408,
6591,
282,
14694,
15610,
5629,
2082,
1041,
489,
340,
931,
26,
267,
1995,
747,
14,
515,
14,
4832,
8,
515,
9,
489,
1995,
13628,
63,
515,
360,
25658,
63,
9524,
358,
489,
1995,
13628,
63,
515,
360,
25658,
63,
14939,
63,
9524,
358,
489,
1995,
13628,
63,
515,
360,
25658,
63,
14939,
358,
339,
367,
931,
315,
2457,
8,
403,
12,
2754,
63,
515,
8,
515,
2298,
489,
2917,
275,
843,
8,
9277,
63,
515,
29,
515,
9,
489,
372,
2917,
272,
746,
843,
14,
8580,
547,
360,
4276,
370,
16592,
14694,
15610,
14,
7754,
3907,
283,
1816,
283,
14939,
436,
663,
2401,
22045,
63,
9524,
315,
2195,
931,
2659,
819,
347,
636,
826,
721,
277,
12,
13628,
63,
515,
304,
272,
408,
2499,
376,
14694,
4084,
436,
2581,
7249,
367,
12530,
27157,
1041,
272,
291,
423,
9277,
63,
515,
275,
13628,
63,
515,
272,
291,
423,
24372,
63,
2537,
275,
1052,
819,
347,
2274,
63,
6238,
63,
3557,
8,
277,
12,
4744,
63,
515,
12,
1736,
694,
29,
403,
304,
272,
408,
1767,
314,
2615,
931,
367,
314,
4744,
737,
15610,
2909,
4744,
63,
515,
503,
402,
282,
1331,
1334,
1736,
694,
14,
339,
2900,
15516,
6527,
1077,
1056,
3932,
7249,
1808,
642,
1083,
14,
272,
520,
635,
1059,
4744,
63,
515,
26,
6912,
370,
4744,
12,
3847,
370,
314,
14694,
15610,
1738,
12,
325,
14,
71,
489,
283,
19601,
15,
6238,
13,
1167,
15,
6238,
14,
7338,
1370,
272,
520,
635,
1059,
1736,
694,
26,
12625,
367,
314,
8876,
570,
14,
510,
2285,
911,
5324,
282,
1331,
402,
314,
489,
15516,
570,
1334,
1736,
694,
14,
272,
520,
1107,
26,
16579,
931,
370,
1902,
314,
4744,
503,
282,
2737,
1331,
402,
626,
4744,
14,
272,
520,
4500,
26,
1059,
272,
520,
3536,
26,
1124,
8580,
547,
1040,
340,
4744,
3913,
506,
1911,
14,
272,
408,
272,
340,
4744,
63,
515,
440,
315,
291,
423,
24372,
63,
2537,
26,
489,
15516,
63,
3557,
275,
291,
423,
362,
63,
3557,
63,
515,
8,
3557,
63,
515,
9,
489,
327,
982,
376,
15516,
570,
365,
3914,
367,
314,
1021,
515,
652,
1471,
506,
1334,
1900,
1231,
12,
880,
1218,
282,
1331,
14,
489,
340,
1736,
694,
26,
267,
1331,
63,
515,
275,
747,
14,
515,
14,
904,
8,
19132,
12,
4744,
63,
515,
9,
267,
340,
440,
747,
14,
515,
14,
6292,
8,
1574,
63,
515,
304,
881,
862,
26,
288,
5048,
63,
8215,
8,
736,
14,
515,
14,
3475,
8,
1574,
63,
515,
430,
288,
5145,
14,
1574,
8,
6238,
63,
3557,
12,
1331,
63,
515,
9,
881,
871,
6440,
465,
325,
26,
288,
746,
291,
14,
8580,
547,
360,
16467,
6425,
1331,
402,
314,
15516,
4744,
26,
9499,
908,
8,
69,
430,
267,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
275,
1331,
63,
515,
489,
587,
26,
267,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
275,
15516,
63,
3557,
272,
372,
291,
423,
24372,
63,
2537,
59,
3557,
63,
515,
61,
819,
347,
485,
362,
63,
3557,
63,
515,
8,
277,
12,
4744,
63,
515,
304,
272,
408,
1767,
2615,
931,
402,
4744,
340,
652,
365,
1911,
641,
4543,
1041,
272,
15516,
63,
3557,
275,
747,
14,
515,
14,
904,
8,
277,
423,
9277,
63,
515,
12,
4744,
63,
515,
9,
272,
340,
747,
14,
515,
14,
6292,
8,
6238,
63,
3557,
304,
489,
372,
15516,
63,
3557,
272,
587,
26,
489,
746,
291,
14,
8580,
547,
360,
10924,
365,
949,
1052,
4903,
14,
710,
14694,
15610,
1443,
1929,
370,
506,
283,
3521,
283,
5334,
17374,
908,
8,
6238,
63,
3557,
430,
819,
347,
636,
2722,
721,
277,
304,
272,
372,
283,
20762,
8580,
14079,
1370,
908,
8,
277,
423,
9277,
63,
515,
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,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
xiawei0000/Kinectforactiondetect | ChalearnLAPSample.py | 1 | 41779 | # coding=gbk
#-------------------------------------------------------------------------------
# Name: Chalearn LAP sample
# Purpose: Provide easy access to Chalearn LAP challenge data samples
#
# Author: Xavier Baro
#
# Created: 21/01/2014
# Copyright: (c) Xavier Baro 2014
# Licence: <your licence>
#-------------------------------------------------------------------------------
import os
import zipfile
import shutil
import cv2
import numpy
import csv
from PIL import Image, ImageDraw
from scipy.misc import imresize
class Skeleton(object):
""" Class that represents the skeleton information """
"""¹Ç¼ÜÀ࣬ÊäÈë¹Ç¼ÜÊý¾Ý£¬½¨Á¢Àà"""
#define a class to encode skeleton data
def __init__(self,data):
""" Constructor. Reads skeleton information from given raw data """
# Create an object from raw data
self.joins=dict();
pos=0
self.joins['HipCenter']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['Spine']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['ShoulderCenter']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['Head']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['ShoulderLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['ElbowLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['WristLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['HandLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['ShoulderRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['ElbowRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['WristRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['HandRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['HipLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['KneeLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['AnkleLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['FootLeft']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['HipRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['KneeRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['AnkleRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
pos=pos+9
self.joins['FootRight']=(map(float,data[pos:pos+3]),map(float,data[pos+3:pos+7]),map(int,data[pos+7:pos+9]))
def getAllData(self):
""" Return a dictionary with all the information for each skeleton node """
return self.joins
def getWorldCoordinates(self):
""" Get World coordinates for each skeleton node """
skel=dict()
for key in self.joins.keys():
skel[key]=self.joins[key][0]
return skel
def getJoinOrientations(self):
""" Get orientations of all skeleton nodes """
skel=dict()
for key in self.joins.keys():
skel[key]=self.joins[key][1]
return skel
def getPixelCoordinates(self):
""" Get Pixel coordinates for each skeleton node """
skel=dict()
for key in self.joins.keys():
skel[key]=self.joins[key][2]
return skel
def toImage(self,width,height,bgColor):
""" Create an image for the skeleton information """
SkeletonConnectionMap = (['HipCenter','Spine'],['Spine','ShoulderCenter'],['ShoulderCenter','Head'],['ShoulderCenter','ShoulderLeft'], \
['ShoulderLeft','ElbowLeft'],['ElbowLeft','WristLeft'],['WristLeft','HandLeft'],['ShoulderCenter','ShoulderRight'], \
['ShoulderRight','ElbowRight'],['ElbowRight','WristRight'],['WristRight','HandRight'],['HipCenter','HipRight'], \
['HipRight','KneeRight'],['KneeRight','AnkleRight'],['AnkleRight','FootRight'],['HipCenter','HipLeft'], \
['HipLeft','KneeLeft'],['KneeLeft','AnkleLeft'],['AnkleLeft','FootLeft'])
im = Image.new('RGB', (width, height), bgColor)
draw = ImageDraw.Draw(im)
for link in SkeletonConnectionMap:
p=self.getPixelCoordinates()[link[1]]
p.extend(self.getPixelCoordinates()[link[0]])
draw.line(p, fill=(255,0,0), width=5)
for node in self.getPixelCoordinates().keys():
p=self.getPixelCoordinates()[node]
r=5
draw.ellipse((p[0]-r,p[1]-r,p[0]+r,p[1]+r),fill=(0,0,255))
del draw
image = numpy.array(im)
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
return image
##ÊÖÊÆÊý¾ÝµÄÀ࣬ÊäÈë·¾¶£¬½¨Á¢ÊÖÊÆÊý¾ÝÀà
class GestureSample(object):
""" Class that allows to access all the information for a certain gesture database sample """
#define class to access gesture data samples
#³õʼ»¯£¬¶ÁÈ¡Îļþ
def __init__ (self,fileName):
""" Constructor. Read the sample file and unzip it if it is necessary. All the data is loaded.
sample=GestureSample('Sample0001.zip')
"""
# Check the given file
if not os.path.exists(fileName): #or not os.path.isfile(fileName):
raise Exception("Sample path does not exist: " + fileName)
# Prepare sample information
self.fullFile = fileName
self.dataPath = os.path.split(fileName)[0]
self.file=os.path.split(fileName)[1]
self.seqID=os.path.splitext(self.file)[0]
self.samplePath=self.dataPath + os.path.sep + self.seqID;
#ÅжÏÊÇzip»¹ÊÇĿ¼
# Unzip sample if it is necessary
if os.path.isdir(self.samplePath) :
self.unzip = False
else:
self.unzip = True
zipFile=zipfile.ZipFile(self.fullFile,"r")
zipFile.extractall(self.samplePath)
# Open video access for RGB information
rgbVideoPath=self.samplePath + os.path.sep + self.seqID + '_color.mp4'
if not os.path.exists(rgbVideoPath):
raise Exception("Invalid sample file. RGB data is not available")
self.rgb = cv2.VideoCapture(rgbVideoPath)
while not self.rgb.isOpened():
self.rgb = cv2.VideoCapture(rgbVideoPath)
cv2.waitKey(500)
# Open video access for Depth information
depthVideoPath=self.samplePath + os.path.sep + self.seqID + '_depth.mp4'
if not os.path.exists(depthVideoPath):
raise Exception("Invalid sample file. Depth data is not available")
self.depth = cv2.VideoCapture(depthVideoPath)
while not self.depth.isOpened():
self.depth = cv2.VideoCapture(depthVideoPath)
cv2.waitKey(500)
# Open video access for User segmentation information
userVideoPath=self.samplePath + os.path.sep + self.seqID + '_user.mp4'
if not os.path.exists(userVideoPath):
raise Exception("Invalid sample file. User segmentation data is not available")
self.user = cv2.VideoCapture(userVideoPath)
while not self.user.isOpened():
self.user = cv2.VideoCapture(userVideoPath)
cv2.waitKey(500)
# Read skeleton data
skeletonPath=self.samplePath + os.path.sep + self.seqID + '_skeleton.csv'
if not os.path.exists(skeletonPath):
raise Exception("Invalid sample file. Skeleton data is not available")
self.skeletons=[]
with open(skeletonPath, 'rb') as csvfile:
filereader = csv.reader(csvfile, delimiter=',')
for row in filereader:
self.skeletons.append(Skeleton(row))
del filereader
# Read sample data
sampleDataPath=self.samplePath + os.path.sep + self.seqID + '_data.csv'
if not os.path.exists(sampleDataPath):
raise Exception("Invalid sample file. Sample data is not available")
self.data=dict()
with open(sampleDataPath, 'rb') as csvfile:
filereader = csv.reader(csvfile, delimiter=',')
for row in filereader:
self.data['numFrames']=int(row[0])
self.data['fps']=int(row[1])
self.data['maxDepth']=int(row[2])
del filereader
# Read labels data
labelsPath=self.samplePath + os.path.sep + self.seqID + '_labels.csv'
if not os.path.exists(labelsPath):
#warnings.warn("Labels are not available", Warning)
self.labels=[]
else:
self.labels=[]
with open(labelsPath, 'rb') as csvfile:
filereader = csv.reader(csvfile, delimiter=',')
for row in filereader:
self.labels.append(map(int,row))
del filereader
#Îö¹¹º¯Êý
def __del__(self):
""" Destructor. If the object unziped the sample, it remove the temporal data """
if self.unzip:
self.clean()
def clean(self):
""" Clean temporal unziped data """
del self.rgb;
del self.depth;
del self.user;
shutil.rmtree(self.samplePath)
#´ÓvideoÖжÁÈ¡Ò»Ö¡·µ»Ø
def getFrame(self,video, frameNum):
""" Get a single frame from given video object """
# Check frame number
# Get total number of frames
numFrames = video.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT)
# Check the given file
if frameNum<1 or frameNum>numFrames:
raise Exception("Invalid frame number <" + str(frameNum) + ">. Valid frames are values between 1 and " + str(int(numFrames)))
# Set the frame index
video.set(cv2.cv.CV_CAP_PROP_POS_FRAMES,frameNum-1)
ret,frame=video.read()
if ret==False:
raise Exception("Cannot read the frame")
return frame
#ÏÂÃæµÄº¯Êý¶¼ÊÇÕë¶ÔÊý¾Ý³ÉÔ±£¬µÄÌض¨Ö¡²Ù×÷µÄ
def getRGB(self, frameNum):
""" Get the RGB color image for the given frame """
#get RGB frame
return self.getFrame(self.rgb,frameNum)
#·µ»ØÉî¶Èͼ£¬Ê¹ÓÃ16int±£´æµÄ
def getDepth(self, frameNum):
""" Get the depth image for the given frame """
#get Depth frame
depthData=self.getFrame(self.depth,frameNum)
# Convert to grayscale
depthGray=cv2.cvtColor(depthData,cv2.cv.CV_RGB2GRAY)
# Convert to float point
depth=depthGray.astype(numpy.float32)
# Convert to depth values
depth=depth/255.0*float(self.data['maxDepth'])
depth=depth.round()
depth=depth.astype(numpy.uint16)
return depth
def getUser(self, frameNum):
""" Get user segmentation image for the given frame """
#get user segmentation frame
return self.getFrame(self.user,frameNum)
def getSkeleton(self, frameNum):
""" Get the skeleton information for a given frame. It returns a Skeleton object """
#get user skeleton for a given frame
# Check frame number
# Get total number of frames
numFrames = len(self.skeletons)
# Check the given file
if frameNum<1 or frameNum>numFrames:
raise Exception("Invalid frame number <" + str(frameNum) + ">. Valid frames are values between 1 and " + str(int(numFrames)))
return self.skeletons[frameNum-1]
def getSkeletonImage(self, frameNum):
""" Create an image with the skeleton image for a given frame """
return self.getSkeleton(frameNum).toImage(640,480,(255,255,255))
def getNumFrames(self):
""" Get the number of frames for this sample """
return self.data['numFrames']
#½«ËùÓеÄÒ»Ö¡Êý¾Ý ´ò°üµ½Ò»¸ö´óµÄ¾ØÕóÀï
def getComposedFrame(self, frameNum):
""" Get a composition of all the modalities for a given frame """
# get sample modalities
rgb=self.getRGB(frameNum)
depthValues=self.getDepth(frameNum)
user=self.getUser(frameNum)
skel=self.getSkeletonImage(frameNum)
# Build depth image
depth = depthValues.astype(numpy.float32)
depth = depth*255.0/float(self.data['maxDepth'])
depth = depth.round()
depth = depth.astype(numpy.uint8)
depth = cv2.applyColorMap(depth,cv2.COLORMAP_JET)
# Build final image
compSize1=(max(rgb.shape[0],depth.shape[0]),rgb.shape[1]+depth.shape[1])
compSize2=(max(user.shape[0],skel.shape[0]),user.shape[1]+skel.shape[1])
comp = numpy.zeros((compSize1[0]+ compSize2[0],max(compSize1[1],compSize2[1]),3), numpy.uint8)
# Create composition
comp[:rgb.shape[0],:rgb.shape[1],:]=rgb
comp[:depth.shape[0],rgb.shape[1]:rgb.shape[1]+depth.shape[1],:]=depth
comp[compSize1[0]:compSize1[0]+user.shape[0],:user.shape[1],:]=user
comp[compSize1[0]:compSize1[0]+skel.shape[0],user.shape[1]:user.shape[1]+skel.shape[1],:]=skel
return comp
def getComposedFrameOverlapUser(self, frameNum):
""" Get a composition of all the modalities for a given frame """
# get sample modalities
rgb=self.getRGB(frameNum)
depthValues=self.getDepth(frameNum)
user=self.getUser(frameNum)
mask = numpy.mean(user, axis=2) > 150
mask = numpy.tile(mask, (3,1,1))
mask = mask.transpose((1,2,0))
# Build depth image
depth = depthValues.astype(numpy.float32)
depth = depth*255.0/float(self.data['maxDepth'])
depth = depth.round()
depth = depth.astype(numpy.uint8)
depth = cv2.applyColorMap(depth,cv2.COLORMAP_JET)
# Build final image
compSize=(max(rgb.shape[0],depth.shape[0]),rgb.shape[1]+depth.shape[1])
comp = numpy.zeros((compSize[0]+ compSize[0],max(compSize[1],compSize[1]),3), numpy.uint8)
# Create composition
comp[:rgb.shape[0],:rgb.shape[1],:]=rgb
comp[:depth.shape[0],rgb.shape[1]:rgb.shape[1]+depth.shape[1],:]= depth
comp[compSize[0]:compSize[0]+user.shape[0],:user.shape[1],:]= mask * rgb
comp[compSize[0]:compSize[0]+user.shape[0],user.shape[1]:user.shape[1]+user.shape[1],:]= mask * depth
return comp
def getComposedFrame_480(self, frameNum, ratio=0.5, topCut=60, botCut=140):
""" Get a composition of all the modalities for a given frame """
# get sample modalities
rgb=self.getRGB(frameNum)
rgb = rgb[topCut:-topCut,botCut:-botCut,:]
rgb = imresize(rgb, ratio, interp='bilinear')
depthValues=self.getDepth(frameNum)
user=self.getUser(frameNum)
user = user[topCut:-topCut,botCut:-botCut,:]
user = imresize(user, ratio, interp='bilinear')
mask = numpy.mean(user, axis=2) > 150
mask = numpy.tile(mask, (3,1,1))
mask = mask.transpose((1,2,0))
# Build depth image
depth = depthValues.astype(numpy.float32)
depth = depth*255.0/float(self.data['maxDepth'])
depth = depth.round()
depth = depth[topCut:-topCut,botCut:-botCut]
depth = imresize(depth, ratio, interp='bilinear')
depth = depth.astype(numpy.uint8)
depth = cv2.applyColorMap(depth,cv2.COLORMAP_JET)
# Build final image
compSize=(max(rgb.shape[0],depth.shape[0]),rgb.shape[1]+depth.shape[1])
comp = numpy.zeros((compSize[0]+ compSize[0],max(compSize[1],compSize[1]),3), numpy.uint8)
# Create composition
comp[:rgb.shape[0],:rgb.shape[1],:]=rgb
comp[:depth.shape[0],rgb.shape[1]:rgb.shape[1]+depth.shape[1],:]= depth
comp[compSize[0]:compSize[0]+user.shape[0],:user.shape[1],:]= mask * rgb
comp[compSize[0]:compSize[0]+user.shape[0],user.shape[1]:user.shape[1]+user.shape[1],:]= mask * depth
return comp
def getDepth3DCNN(self, frameNum, ratio=0.5, topCut=60, botCut=140):
""" Get a composition of all the modalities for a given frame """
# get sample modalities
depthValues=self.getDepth(frameNum)
user=self.getUser(frameNum)
user = user[topCut:-topCut,botCut:-botCut,:]
user = imresize(user, ratio, interp='bilinear')
mask = numpy.mean(user, axis=2) > 150
# Build depth image
depth = depthValues.astype(numpy.float32)
depth = depth*255.0/float(self.data['maxDepth'])
depth = depth.round()
depth = depth[topCut:-topCut,botCut:-botCut]
depth = imresize(depth, ratio, interp='bilinear')
depth = depth.astype(numpy.uint8)
return mask * depth
def getDepthOverlapUser(self, frameNum, x_centre, y_centre, pixel_value, extractedFrameSize=224, upshift = 0):
""" Get a composition of all the modalities for a given frame """
halfFrameSize = extractedFrameSize/2
user=self.getUser(frameNum)
mask = numpy.mean(user, axis=2) > 150
ratio = pixel_value/ 3000
# Build depth image
# get sample modalities
depthValues=self.getDepth(frameNum)
depth = depthValues.astype(numpy.float32)
depth = depth*255.0/float(self.data['maxDepth'])
mask = imresize(mask, ratio, interp='nearest')
depth = imresize(depth, ratio, interp='bilinear')
depth_temp = depth * mask
depth_extracted = depth_temp[x_centre-halfFrameSize-upshift:x_centre+halfFrameSize-upshift, y_centre-halfFrameSize: y_centre+halfFrameSize]
depth = depth.round()
depth = depth.astype(numpy.uint8)
depth = cv2.applyColorMap(depth,cv2.COLORMAP_JET)
depth_extracted = depth_extracted.round()
depth_extracted = depth_extracted.astype(numpy.uint8)
depth_extracted = cv2.applyColorMap(depth_extracted,cv2.COLORMAP_JET)
# Build final image
compSize=(depth.shape[0],depth.shape[1])
comp = numpy.zeros((compSize[0] + extractedFrameSize,compSize[1]+compSize[1],3), numpy.uint8)
# Create composition
comp[:depth.shape[0],:depth.shape[1],:]=depth
mask_new = numpy.tile(mask, (3,1,1))
mask_new = mask_new.transpose((1,2,0))
comp[:depth.shape[0],depth.shape[1]:depth.shape[1]+depth.shape[1],:]= mask_new * depth
comp[compSize[0]:,:extractedFrameSize,:]= depth_extracted
return comp
def getDepthCentroid(self, startFrame, endFrame):
""" Get a composition of all the modalities for a given frame """
x_centre = []
y_centre = []
pixel_value = []
for frameNum in range(startFrame, endFrame):
user=self.getUser(frameNum)
depthValues=self.getDepth(frameNum)
depth = depthValues.astype(numpy.float32)
#depth = depth*255.0/float(self.data['maxDepth'])
mask = numpy.mean(user, axis=2) > 150
width, height = mask.shape
XX, YY, count, pixel_sum = 0, 0, 0, 0
for x in range(width):
for y in range(height):
if mask[x, y]:
XX += x
YY += y
count += 1
pixel_sum += depth[x, y]
if count>0:
x_centre.append(XX/count)
y_centre.append(YY/count)
pixel_value.append(pixel_sum/count)
return [numpy.mean(x_centre), numpy.mean(y_centre), numpy.mean(pixel_value)]
def getGestures(self):
""" Get the list of gesture for this sample. Each row is a gesture, with the format (gestureID,startFrame,endFrame) """
return self.labels
def getGestureName(self,gestureID):
""" Get the gesture label from a given gesture ID """
names=('vattene','vieniqui','perfetto','furbo','cheduepalle','chevuoi','daccordo','seipazzo', \
'combinato','freganiente','ok','cosatifarei','basta','prendere','noncenepiu','fame','tantotempo', \
'buonissimo','messidaccordo','sonostufo')
# Check the given file
if gestureID<1 or gestureID>20:
raise Exception("Invalid gesture ID <" + str(gestureID) + ">. Valid IDs are values between 1 and 20")
return names[gestureID-1]
def exportPredictions(self, prediction,predPath):
""" Export the given prediction to the correct file in the given predictions path """
if not os.path.exists(predPath):
os.makedirs(predPath)
output_filename = os.path.join(predPath, self.seqID + '_prediction.csv')
output_file = open(output_filename, 'wb')
for row in prediction:
output_file.write(repr(int(row[0])) + "," + repr(int(row[1])) + "," + repr(int(row[2])) + "\n")
output_file.close()
def play_video(self):
"""
play the video, Wudi adds this
"""
# Open video access for RGB information
rgbVideoPath=self.samplePath + os.path.sep + self.seqID + '_color.mp4'
if not os.path.exists(rgbVideoPath):
raise Exception("Invalid sample file. RGB data is not available")
self.rgb = cv2.VideoCapture(rgbVideoPath)
while (self.rgb.isOpened()):
ret, frame = self.rgb.read()
cv2.imshow('frame',frame)
if cv2.waitKey(5) & 0xFF == ord('q'):
break
self.rgb.release()
cv2.destroyAllWindows()
def evaluate(self,csvpathpred):
""" Evaluate this sample agains the ground truth file """
maxGestures=11
seqLength=self.getNumFrames()
# Get the list of gestures from the ground truth and frame activation
predGestures = []
binvec_pred = numpy.zeros((maxGestures, seqLength))
gtGestures = []
binvec_gt = numpy.zeros((maxGestures, seqLength))
with open(csvpathpred, 'rb') as csvfilegt:
csvgt = csv.reader(csvfilegt)
for row in csvgt:
binvec_pred[int(row[0])-1, int(row[1])-1:int(row[2])-1] = 1
predGestures.append(int(row[0]))
# Get the list of gestures from prediction and frame activation
for row in self.getActions():
binvec_gt[int(row[0])-1, int(row[1])-1:int(row[2])-1] = 1
gtGestures.append(int(row[0]))
# Get the list of gestures without repetitions for ground truth and predicton
gtGestures = numpy.unique(gtGestures)
predGestures = numpy.unique(predGestures)
# Find false positives
falsePos=numpy.setdiff1d(gtGestures, numpy.union1d(gtGestures,predGestures))
# Get overlaps for each gesture
overlaps = []
for idx in gtGestures:
intersec = sum(binvec_gt[idx-1] * binvec_pred[idx-1])
aux = binvec_gt[idx-1] + binvec_pred[idx-1]
union = sum(aux > 0)
overlaps.append(intersec/union)
# Use real gestures and false positive gestures to calculate the final score
return sum(overlaps)/(len(overlaps)+len(falsePos))
def get_shift_scale(self, template, ref_depth, start_frame=10, end_frame=20, debug_show=False):
"""
Wudi add this method for extracting normalizing depth wrt Sample0003
"""
from skimage.feature import match_template
Feature_all = numpy.zeros(shape=(480, 640, end_frame-start_frame), dtype=numpy.uint16 )
count = 0
for frame_num in range(start_frame,end_frame):
depth_original = self.getDepth(frame_num)
mask = numpy.mean(self.getUser(frame_num), axis=2) > 150
Feature_all[:, :, count] = depth_original * mask
count += 1
depth_image = Feature_all.mean(axis = 2)
depth_image_normalized = depth_image * 1.0 / float(self.data['maxDepth'])
depth_image_normalized /= depth_image_normalized.max()
result = match_template(depth_image_normalized, template, pad_input=True)
#############plot
x, y = numpy.unravel_index(numpy.argmax(result), result.shape)
shift = [depth_image.shape[0]/2-x, depth_image.shape[1]/2-y]
subsize = 25 # we use 25 by 25 region as a measurement for median of distance
minX = max(x - subsize,0)
minY = max(y - subsize,0)
maxX = min(x + subsize,depth_image.shape[0])
maxY = min(y + subsize,depth_image.shape[1])
subregion = depth_image[minX:maxX, minY:maxY]
distance = numpy.median(subregion[subregion>0])
scaling = distance*1.0 / ref_depth
from matplotlib import pyplot as plt
print "[x, y, shift, distance, scaling]"
print str([x, y, shift, distance, scaling])
if debug_show:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(ncols=4, figsize=(8, 4))
ax1.imshow(template)
ax1.set_axis_off()
ax1.set_title('template')
ax2.imshow(depth_image_normalized)
ax2.set_axis_off()
ax2.set_title('image')
# highlight matched region
hcoin, wcoin = template.shape
rect = plt.Rectangle((y-hcoin/2, x-wcoin/2), wcoin, hcoin, edgecolor='r', facecolor='none')
ax2.add_patch(rect)
import cv2
from scipy.misc import imresize
rows,cols = depth_image_normalized.shape
M = numpy.float32([[1,0, shift[1]],[0,1, shift[0]]])
affine_image = cv2.warpAffine(depth_image_normalized, M, (cols, rows))
resize_image = imresize(affine_image, scaling)
resize_image_median = cv2.medianBlur(resize_image,5)
ax3.imshow(resize_image_median)
ax3.set_axis_off()
ax3.set_title('image_transformed')
# highlight matched region
hcoin, wcoin = resize_image_median.shape
rect = plt.Rectangle((wcoin/2-160, hcoin/2-160), 320, 320, edgecolor='r', facecolor='none')
ax3.add_patch(rect)
ax4.imshow(result)
ax4.set_axis_off()
ax4.set_title('`match_template`\nresult')
# highlight matched region
ax4.autoscale(False)
ax4.plot(x, y, 'o', markeredgecolor='r', markerfacecolor='none', markersize=10)
plt.show()
return [shift, scaling]
def get_shift_scale_depth(self, shift, scale, framenumber, IM_SZ, show_flag=False):
"""
Wudi added this method to extract segmented depth frame,
by a shift and scale
"""
depth_original = self.getDepth(framenumber)
mask = numpy.mean(self.getUser(framenumber), axis=2) > 150
resize_final_out = numpy.zeros((IM_SZ,IM_SZ))
if mask.sum() < 1000: # Kinect detect nothing
print "skip "+ str(framenumber)
flag = False
else:
flag = True
depth_user = depth_original * mask
depth_user_normalized = depth_user * 1.0 / float(self.data['maxDepth'])
depth_user_normalized = depth_user_normalized *255 /depth_user_normalized.max()
rows,cols = depth_user_normalized.shape
M = numpy.float32([[1,0, shift[1]],[0,1, shift[0]]])
affine_image = cv2.warpAffine(depth_user_normalized, M,(cols, rows))
resize_image = imresize(affine_image, scale)
resize_image_median = cv2.medianBlur(resize_image,5)
rows, cols = resize_image_median.shape
image_crop = resize_image_median[rows/2-160:rows/2+160, cols/2-160:cols/2+160]
resize_final_out = imresize(image_crop, (IM_SZ,IM_SZ))
if show_flag: # show the segmented images here
cv2.imshow('image',image_crop)
cv2.waitKey(10)
return [resize_final_out, flag]
#¶¯×÷Êý¾ÝÀà
class ActionSample(object):
""" Class that allows to access all the information for a certain action database sample """
#define class to access actions data samples
def __init__ (self,fileName):
""" Constructor. Read the sample file and unzip it if it is necessary. All the data is loaded.
sample=ActionSample('Sec01.zip')
"""
# Check the given file
if not os.path.exists(fileName) and not os.path.isfile(fileName):
raise Exception("Sample path does not exist: " + fileName)
# Prepare sample information
self.fullFile = fileName
self.dataPath = os.path.split(fileName)[0]
self.file=os.path.split(fileName)[1]
self.seqID=os.path.splitext(self.file)[0]
self.samplePath=self.dataPath + os.path.sep + self.seqID;
# Unzip sample if it is necessary
if os.path.isdir(self.samplePath) :
self.unzip = False
else:
self.unzip = True
zipFile=zipfile.ZipFile(self.fullFile,"r")
zipFile.extractall(self.samplePath)
# Open video access for RGB information
rgbVideoPath=self.samplePath + os.path.sep + self.seqID + '_color.mp4'
if not os.path.exists(rgbVideoPath):
raise Exception("Invalid sample file. RGB data is not available")
self.rgb = cv2.VideoCapture(rgbVideoPath)
while not self.rgb.isOpened():
self.rgb = cv2.VideoCapture(rgbVideoPath)
cv2.waitKey(500)
# Read sample data
sampleDataPath=self.samplePath + os.path.sep + self.seqID + '_data.csv'
if not os.path.exists(sampleDataPath):
raise Exception("Invalid sample file. Sample data is not available")
self.data=dict()
with open(sampleDataPath, 'rb') as csvfile:
filereader = csv.reader(csvfile, delimiter=',')
for row in filereader:
self.data['numFrames']=int(row[0])
del filereader
# Read labels data
labelsPath=self.samplePath + os.path.sep + self.seqID + '_labels.csv'
self.labels=[]
if not os.path.exists(labelsPath):
warnings.warn("Labels are not available", Warning)
else:
with open(labelsPath, 'rb') as csvfile:
filereader = csv.reader(csvfile, delimiter=',')
for row in filereader:
self.labels.append(map(int,row))
del filereader
def __del__(self):
""" Destructor. If the object unziped the sample, it remove the temporal data """
if self.unzip:
self.clean()
def clean(self):
""" Clean temporal unziped data """
del self.rgb;
shutil.rmtree(self.samplePath)
def getFrame(self,video, frameNum):
""" Get a single frame from given video object """
# Check frame number
# Get total number of frames
numFrames = video.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT)
# Check the given file
if frameNum<1 or frameNum>numFrames:
raise Exception("Invalid frame number <" + str(frameNum) + ">. Valid frames are values between 1 and " + str(int(numFrames)))
# Set the frame index
video.set(cv2.cv.CV_CAP_PROP_POS_FRAMES,frameNum-1)
ret,frame=video.read()
if ret==False:
raise Exception("Cannot read the frame")
return frame
def getNumFrames(self):
""" Get the number of frames for this sample """
return self.data['numFrames']
def getRGB(self, frameNum):
""" Get the RGB color image for the given frame """
#get RGB frame
return self.getFrame(self.rgb,frameNum)
def getActions(self):
""" Get the list of gesture for this sample. Each row is an action, with the format (actionID,startFrame,endFrame) """
return self.labels
def getActionsName(self,actionID):
""" Get the action label from a given action ID """
names=('wave','point','clap','crouch','jump','walk','run','shake hands', \
'hug','kiss','fight')
# Check the given file
if actionID<1 or actionID>11:
raise Exception("Invalid action ID <" + str(actionID) + ">. Valid IDs are values between 1 and 11")
return names[actionID-1]
def exportPredictions(self, prediction,predPath):
""" Export the given prediction to the correct file in the given predictions path """
if not os.path.exists(predPath):
os.makedirs(predPath)
output_filename = os.path.join(predPath, self.seqID + '_prediction.csv')
output_file = open(output_filename, 'wb')
for row in prediction:
output_file.write(repr(int(row[0])) + "," + repr(int(row[1])) + "," + repr(int(row[2])) + "\n")
output_file.close()
def evaluate(self,csvpathpred):
""" Evaluate this sample agains the ground truth file """
maxGestures=11
seqLength=self.getNumFrames()
# Get the list of gestures from the ground truth and frame activation
predGestures = []
binvec_pred = numpy.zeros((maxGestures, seqLength))
gtGestures = []
binvec_gt = numpy.zeros((maxGestures, seqLength))
with open(csvpathpred, 'rb') as csvfilegt:
csvgt = csv.reader(csvfilegt)
for row in csvgt:
binvec_pred[int(row[0])-1, int(row[1])-1:int(row[2])-1] = 1
predGestures.append(int(row[0]))
# Get the list of gestures from prediction and frame activation
for row in self.getActions():
binvec_gt[int(row[0])-1, int(row[1])-1:int(row[2])-1] = 1
gtGestures.append(int(row[0]))
# Get the list of gestures without repetitions for ground truth and predicton
gtGestures = numpy.unique(gtGestures)
predGestures = numpy.unique(predGestures)
# Find false positives
falsePos=numpy.setdiff1d(gtGestures, numpy.union1d(gtGestures,predGestures))
# Get overlaps for each gesture
overlaps = []
for idx in gtGestures:
intersec = sum(binvec_gt[idx-1] * binvec_pred[idx-1])
aux = binvec_gt[idx-1] + binvec_pred[idx-1]
union = sum(aux > 0)
overlaps.append(intersec/union)
# Use real gestures and false positive gestures to calculate the final score
return sum(overlaps)/(len(overlaps)+len(falsePos))
#×Ë̬Êý¾ÝÀà
class PoseSample(object):
""" Class that allows to access all the information for a certain pose database sample """
#define class to access gesture data samples
def __init__ (self,fileName):
""" Constructor. Read the sample file and unzip it if it is necessary. All the data is loaded.
sample=PoseSample('Seq01.zip')
"""
# Check the given file
if not os.path.exists(fileName) and not os.path.isfile(fileName):
raise Exception("Sequence path does not exist: " + fileName)
# Prepare sample information
self.fullFile = fileName
self.dataPath = os.path.split(fileName)[0]
self.file=os.path.split(fileName)[1]
self.seqID=os.path.splitext(self.file)[0]
self.samplePath=self.dataPath + os.path.sep + self.seqID;
# Unzip sample if it is necessary
if os.path.isdir(self.samplePath):
self.unzip = False
else:
self.unzip = True
zipFile=zipfile.ZipFile(self.fullFile,"r")
zipFile.extractall(self.samplePath)
# Set path for rgb images
rgbPath=self.samplePath + os.path.sep + 'imagesjpg'+ os.path.sep
if not os.path.exists(rgbPath):
raise Exception("Invalid sample file. RGB data is not available")
self.rgbpath = rgbPath
# Set path for gt images
gtPath=self.samplePath + os.path.sep + 'maskspng'+ os.path.sep
if not os.path.exists(gtPath):
self.gtpath= "empty"
else:
self.gtpath = gtPath
frames=os.listdir(self.rgbpath)
self.numberFrames=len(frames)
def __del__(self):
""" Destructor. If the object unziped the sample, it remove the temporal data """
if self.unzip:
self.clean()
def clean(self):
""" Clean temporal unziped data """
shutil.rmtree(self.samplePath)
def getRGB(self, frameNum):
""" Get the RGB color image for the given frame """
#get RGB frame
if frameNum>self.numberFrames:
raise Exception("Number of frame has to be less than: "+ self.numberFrames)
framepath=self.rgbpath+self.seqID[3:5]+'_'+ '%04d' %frameNum+'.jpg'
if not os.path.isfile(framepath):
raise Exception("RGB file does not exist: " + framepath)
return cv2.imread(framepath)
def getNumFrames(self):
return self.numberFrames
def getLimb(self, frameNum, actorID,limbID):
""" Get the BW limb image for a certain frame and a certain limbID """
if self.gtpath == "empty":
raise Exception("Limb labels are not available for this sequence. This sequence belong to the validation set.")
else:
limbpath=self.gtpath+self.seqID[3:5]+'_'+ '%04d' %frameNum+'_'+str(actorID)+'_'+str(limbID)+'.png'
if frameNum>self.numberFrames:
raise Exception("Number of frame has to be less than: "+ self.numberFrames)
if actorID<1 or actorID>2:
raise Exception("Invalid actor ID <" + str(actorID) + ">. Valid frames are values between 1 and 2 ")
if limbID<1 or limbID>14:
raise Exception("Invalid limb ID <" + str(limbID) + ">. Valid frames are values between 1 and 14")
return cv2.imread(limbpath,cv2.CV_LOAD_IMAGE_GRAYSCALE)
def getLimbsName(self,limbID):
""" Get the limb label from a given limb ID """
names=('head','torso','lhand','rhand','lforearm','rforearm','larm','rarm', \
'lfoot','rfoot','lleg','rleg','lthigh','rthigh')
# Check the given file
if limbID<1 or limbID>14:
raise Exception("Invalid limb ID <" + str(limbID) + ">. Valid IDs are values between 1 and 14")
return names[limbID-1]
def overlap_images(self, gtimage, predimage):
""" this function computes the hit measure of overlap between two binary images im1 and im2 """
[ret, im1] = cv2.threshold(gtimage, 127, 255, cv2.THRESH_BINARY)
[ret, im2] = cv2.threshold(predimage, 127, 255, cv2.THRESH_BINARY)
intersec = cv2.bitwise_and(im1, im2)
intersec_val = float(numpy.sum(intersec))
union = cv2.bitwise_or(im1, im2)
union_val = float(numpy.sum(union))
if union_val == 0:
return 0
else:
if float(intersec_val / union_val)>0.5:
return 1
else:
return 0
def exportPredictions(self, prediction,frame,actor,limb,predPath):
""" Export the given prediction to the correct file in the given predictions path """
if not os.path.exists(predPath):
os.makedirs(predPath)
prediction_filename = predPath+os.path.sep+ self.seqID[3:5] +'_'+ '%04d' %frame +'_'+str(actor)+'_'+str(limb)+'_prediction.png'
cv2.imwrite(prediction_filename,prediction)
def evaluate(self, predpath):
""" Evaluate this sample agains the ground truth file """
# Get the list of videos from ground truth
gt_list = os.listdir(self.gtpath)
# For each sample on the GT, search the given prediction
score = 0.0
nevals = 0
for gtlimbimage in gt_list:
# Avoid double check, use only labels file
if not gtlimbimage.lower().endswith(".png"):
continue
# Build paths for prediction and ground truth files
aux = gtlimbimage.split('.')
parts = aux[0].split('_')
seqID = parts[0]
gtlimbimagepath = os.path.join(self.gtpath,gtlimbimage)
predlimbimagepath= os.path.join(predpath) + os.path.sep + seqID+'_'+parts[1]+'_'+parts[2]+'_'+parts[3]+"_prediction.png"
#check predfile exists
if not os.path.exists(predlimbimagepath) or not os.path.isfile(predlimbimagepath):
raise Exception("Invalid video limb prediction file. Not all limb predictions are available")
#Load images
gtimage=cv2.imread(gtlimbimagepath, cv2.CV_LOAD_IMAGE_GRAYSCALE)
predimage=cv2.imread(predlimbimagepath, cv2.CV_LOAD_IMAGE_GRAYSCALE)
if cv2.cv.CountNonZero(cv2.cv.fromarray(gtimage)) >= 1:
score += self.overlap_images(gtimage, predimage)
nevals += 1
#release videos and return mean overlap
return score/nevals
| mit | [
3,
2803,
29,
4908,
75,
199,
7656,
18964,
199,
3,
2812,
26,
263,
2799,
1895,
1060,
491,
1282,
2690,
199,
3,
23177,
4070,
26,
258,
22896,
8837,
2879,
370,
2799,
1895,
1060,
491,
1282,
14929,
666,
5845,
199,
3,
199,
3,
6529,
26,
420,
1323,
7194,
281,
12377,
79,
199,
3,
199,
3,
18208,
26,
258,
7829,
15,
614,
15,
7280,
199,
3,
1898,
26,
257,
334,
67,
9,
1323,
7194,
281,
12377,
79,
6927,
199,
3,
491,
530,
4894,
26,
258,
665,
12695,
23854,
4894,
30,
199,
7656,
18964,
199,
646,
747,
199,
646,
10392,
199,
646,
5145,
199,
646,
6277,
18,
199,
646,
2680,
199,
646,
7392,
199,
504,
14937,
492,
6047,
12,
6047,
9654,
199,
504,
7026,
14,
9923,
492,
3416,
8709,
4388,
199,
533,
428,
415,
17589,
8,
785,
304,
272,
408,
8089,
626,
8469,
314,
30537,
2556,
408,
272,
408,
127,
118,
128,
230,
127,
121,
128,
251,
128,
223,
26482,
127,
97,
127,
106,
128,
233,
13733,
128,
231,
128,
105,
127,
118,
128,
230,
127,
121,
128,
251,
128,
233,
128,
122,
127,
123,
128,
252,
127,
97,
127,
106,
127,
122,
127,
102,
128,
224,
127,
96,
128,
223,
26482,
624,
272,
327,
4640,
282,
1021,
370,
3752,
30537,
666,
272,
347,
636,
826,
721,
277,
12,
576,
304,
267,
408,
20297,
14,
26129,
30537,
2556,
687,
1627,
3066,
666,
408,
267,
327,
2790,
376,
909,
687,
3066,
666,
267,
291,
14,
20155,
29,
807,
7303,
267,
2086,
29,
16,
267,
291,
14,
20155,
459,
40,
711,
13551,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
5058,
1132,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
13551,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
11664,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
37,
6374,
583,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
4966,
270,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
13220,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
37,
6374,
583,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
4966,
270,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
13220,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
40,
711,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
43,
18682,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23
] | [
2803,
29,
4908,
75,
199,
7656,
18964,
199,
3,
2812,
26,
263,
2799,
1895,
1060,
491,
1282,
2690,
199,
3,
23177,
4070,
26,
258,
22896,
8837,
2879,
370,
2799,
1895,
1060,
491,
1282,
14929,
666,
5845,
199,
3,
199,
3,
6529,
26,
420,
1323,
7194,
281,
12377,
79,
199,
3,
199,
3,
18208,
26,
258,
7829,
15,
614,
15,
7280,
199,
3,
1898,
26,
257,
334,
67,
9,
1323,
7194,
281,
12377,
79,
6927,
199,
3,
491,
530,
4894,
26,
258,
665,
12695,
23854,
4894,
30,
199,
7656,
18964,
199,
646,
747,
199,
646,
10392,
199,
646,
5145,
199,
646,
6277,
18,
199,
646,
2680,
199,
646,
7392,
199,
504,
14937,
492,
6047,
12,
6047,
9654,
199,
504,
7026,
14,
9923,
492,
3416,
8709,
4388,
199,
533,
428,
415,
17589,
8,
785,
304,
272,
408,
8089,
626,
8469,
314,
30537,
2556,
408,
272,
408,
127,
118,
128,
230,
127,
121,
128,
251,
128,
223,
26482,
127,
97,
127,
106,
128,
233,
13733,
128,
231,
128,
105,
127,
118,
128,
230,
127,
121,
128,
251,
128,
233,
128,
122,
127,
123,
128,
252,
127,
97,
127,
106,
127,
122,
127,
102,
128,
224,
127,
96,
128,
223,
26482,
624,
272,
327,
4640,
282,
1021,
370,
3752,
30537,
666,
272,
347,
636,
826,
721,
277,
12,
576,
304,
267,
408,
20297,
14,
26129,
30537,
2556,
687,
1627,
3066,
666,
408,
267,
327,
2790,
376,
909,
687,
3066,
666,
267,
291,
14,
20155,
29,
807,
7303,
267,
2086,
29,
16,
267,
291,
14,
20155,
459,
40,
711,
13551,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
5058,
1132,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
13551,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
11664,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
37,
6374,
583,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
4966,
270,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
13220,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
51,
526,
348,
424,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
37,
6374,
583,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
4966,
270,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
13220,
9121,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
40,
711,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
26,
1712,
11,
25,
2459,
267,
2086,
29,
1712,
11,
25,
267,
291,
14,
20155,
459,
43,
18682,
8185,
418,
2687,
1130,
8,
1609,
12,
576,
59,
1712,
26,
1712,
11,
19,
2522,
1130,
8,
1609,
12,
576,
59,
1712,
11,
19,
26,
1712,
11,
23,
2522,
1130,
8,
442,
12,
576,
59,
1712,
11,
23,
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,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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
] |
icandigitbaby/openchange | script/bug-analysis/buganalysis/pkgshelper.py | 1 | 24843 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) Enrique J. Hernández 2014
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Helper methods to set the Package and Dependencies fields, if missing, from Apport crashes.
This is specific to Zentyal.
"""
from datetime import datetime
def map_package(report):
"""
Given a report, it will return the package and the version depending on the
DistroRelease and the ExecutableTimestamp fields specific from Zentyal repositories.
:param apport.report.Report report: the crash report
:returns: a tuple containing the package and the version of the package.
:rtype tuple:
"""
if 'DistroRelease' not in report or 'ExecutableTimestamp' not in report:
raise SystemError('No DistroRelease or ExecutableTimestamp to map the package')
distro_release = report['DistroRelease']
crash_date = datetime.fromtimestamp(int(report['ExecutableTimestamp']))
if distro_release == 'Ubuntu 14.04':
if crash_date >= datetime(2014, 5, 24, 1, 31): # Release date
return ('samba', '3:4.1.7+dfsg-2~zentyal2~64')
return ('samba', '3:4.1.7+dfsg-2~zentyal1~32')
elif distro_release == 'Ubuntu 13.10':
return ('samba', '2:4.1.6+dfsg-1~zentyal1~106')
elif distro_release == 'Ubuntu 12.04':
if crash_date < datetime(2013, 10, 2):
return ('samba4', '4.1.0rc3-zentyal3')
elif crash_date < datetime(2013, 12, 10, 13, 03):
return ('samba4', '4.1.0rc4-zentyal1')
elif crash_date < datetime(2013, 12, 17, 11, 34):
return ('samba4', '4.1.2-zentyal2')
elif crash_date < datetime(2014, 3, 5, 20, 16):
return ('samba4', '4.1.3-zentyal2')
elif crash_date < datetime(2014, 5, 30, 8, 41):
return ('samba4', '4.1.5-zentyal1')
else:
return ('samba4', '4.1.7-zentyal1')
else:
raise SystemError('Invalid Distro Release %s' % distro_release)
def map_dependencies(report):
"""
Given a report, it will return the dependencies from the package depending on the
DistroRelease fields specific from Zentyal repositories.
:param apport.report.Report report: the crash report
:returns: a list of the current dependencies packages
:rtype tuple:
"""
if 'DistroRelease' not in report:
raise SystemError('No DistroRelease to get the dependencies packages')
distro_release = report['DistroRelease']
if distro_release == 'Ubuntu 14.04':
return (
'adduser',
'apt-utils',
'attr',
'base-passwd',
'busybox-initramfs',
'ca-certificates',
'ckeditor',
'coreutils',
'cpio',
'cron',
'dbus',
'debconf',
'debconf-i18n',
'debianutils',
'dpkg',
'e2fslibs',
'e2fsprogs',
'file',
'findutils',
'gcc-4.8-base',
'gcc-4.9-base',
'gnustep-base-common',
'gnustep-base-runtime',
'gnustep-common',
'ifupdown',
'initramfs-tools',
'initramfs-tools-bin',
'initscripts',
'insserv',
'iproute2',
'isc-dhcp-client',
'isc-dhcp-common',
'javascript-common',
'klibc-utils',
'kmod',
'krb5-locales',
'libacl1',
'libaio1',
'libapache2-mod-wsgi',
'libapparmor1',
'libapt-inst1.5',
'libapt-pkg4.12',
'libarchive-extract-perl',
'libasn1-8-heimdal',
'libattr1',
'libaudit-common',
'libaudit1',
'libavahi-client3',
'libavahi-common-data',
'libavahi-common3',
'libblkid1',
'libbsd0',
'libbz2-1.0',
'libc6',
'libcap2',
'libcgmanager0',
'libcomerr2',
'libcups2',
'libcurl3-gnutls',
'libdb5.3',
'libdbus-1-3',
'libdebconfclient0',
'libdrm2',
'libevent-2.0-5',
'libexpat1',
'libffi6',
'libfile-copy-recursive-perl',
'libgcc1',
'libgcrypt11',
'libgdbm3',
'libglib2.0-0',
'libglib2.0-data',
'libgmp10',
'libgnustep-base1.24',
'libgnutls26',
'libgpg-error0',
'libgpm2',
'libgssapi-krb5-2',
'libgssapi3-heimdal',
'libhcrypto4-heimdal',
'libhdb9-heimdal',
'libheimbase1-heimdal',
'libheimntlm0-heimdal',
'libhx509-5-heimdal',
'libicu52',
'libidn11',
'libjs-jquery',
'libjs-jquery-ui',
'libjs-prototype',
'libjs-scriptaculous',
'libjs-sphinxdoc',
'libjs-swfobject',
'libjs-underscore',
'libjson-c2',
'libjson0',
'libk5crypto3',
'libkdc2-heimdal',
'libkeyutils1',
'libklibc',
'libkmod2',
'libkrb5-26-heimdal',
'libkrb5-3',
'libkrb5support0',
'liblasso3',
'libldap-2.4-2',
'libldb1',
'liblocale-gettext-perl',
'liblog-message-simple-perl',
'liblzma5',
'libmagic1',
'libmapi0',
'libmapiproxy0',
'libmapistore0',
'libmemcached10',
'libmodule-pluggable-perl',
'libmount1',
'libmysqlclient18',
'libncurses5',
'libncursesw5',
'libnih-dbus1',
'libnih1',
'libntdb1',
'libobjc4',
'libp11-kit0',
'libpam-modules',
'libpam-modules-bin',
'libpam-runtime',
'libpam-systemd',
'libpam0g',
'libpcre3',
'libplymouth2',
'libpng12-0',
'libpod-latex-perl',
'libpopt0',
'libpq5',
'libprocps3',
'libpython-stdlib',
'libpython2.7',
'libpython2.7-minimal',
'libpython2.7-stdlib',
'libreadline6',
'libroken18-heimdal',
'librtmp0',
'libsasl2-2',
'libsasl2-modules',
'libsasl2-modules-db',
'libsbjson2.3',
'libselinux1',
'libsemanage-common',
'libsemanage1',
'libsepol1',
'libslang2',
'libsope1',
'libsqlite3-0',
'libss2',
'libssl1.0.0',
'libstdc++6',
'libsystemd-daemon0',
'libsystemd-login0',
'libtalloc2',
'libtasn1-6',
'libtdb1',
'libterm-ui-perl',
'libtevent0',
'libtext-charwidth-perl',
'libtext-iconv-perl',
'libtext-soundex-perl',
'libtext-wrapi18n-perl',
'libtinfo5',
'libudev1',
'libustr-1.0-1',
'libuuid1',
'libwbclient0',
'libwind0-heimdal',
'libxml2',
'libxmlsec1',
'libxmlsec1-openssl',
'libxslt1.1',
'libxtables10',
'logrotate',
'lsb-base',
'makedev',
'memcached',
'mime-support',
'module-init-tools',
'mount',
'mountall',
'multiarch-support',
'mysql-common',
'netbase',
'openchange-ocsmanager',
'openchange-rpcproxy',
'openchangeproxy',
'openchangeserver',
'openssl',
'passwd',
'perl',
'perl-base',
'perl-modules',
'plymouth',
'plymouth-theme-ubuntu-text',
'procps',
'psmisc',
'python',
'python-beaker',
'python-bs4',
'python-chardet',
'python-crypto',
'python-decorator',
'python-dns',
'python-dnspython',
'python-formencode',
'python-ldb',
'python-lxml',
'python-mako',
'python-markupsafe',
'python-minimal',
'python-mysqldb',
'python-nose',
'python-ntdb',
'python-ocsmanager',
'python-openid',
'python-openssl',
'python-paste',
'python-pastedeploy',
'python-pastedeploy-tpl',
'python-pastescript',
'python-pkg-resources',
'python-pygments',
'python-pylons',
'python-repoze.lru',
'python-routes',
'python-rpclib',
'python-samba',
'python-scgi',
'python-setuptools',
'python-simplejson',
'python-six',
'python-spyne',
'python-sqlalchemy',
'python-sqlalchemy-ext',
'python-support',
'python-talloc',
'python-tdb',
'python-tempita',
'python-tz',
'python-waitress',
'python-weberror',
'python-webhelpers',
'python-webob',
'python-webtest',
'python2.7',
'python2.7-minimal',
'readline-common',
'samba',
'samba-common',
'samba-common-bin',
'samba-dsdb-modules',
'samba-libs',
'samba-vfs-modules',
'sed',
'sensible-utils',
'sgml-base',
'shared-mime-info',
'sogo',
'sogo-common',
'sogo-openchange',
'systemd-services',
'sysv-rc',
'sysvinit-utils',
'tar',
'tdb-tools',
'tmpreaper',
'tzdata',
'ucf',
'udev',
'unzip',
'update-inetd',
'upstart',
'util-linux',
'uuid-runtime',
'xml-core',
'zip',
'zlib1g'
)
elif distro_release == 'Ubuntu 13.10':
return (
'adduser',
'apt-utils',
'base-passwd',
'busybox-initramfs',
'ca-certificates',
'ckeditor',
'coreutils',
'cpio',
'cron',
'dbus',
'debconf',
'debconf-i18n',
'debianutils',
'dpkg',
'e2fslibs',
'e2fsprogs',
'file',
'findutils',
'gcc-4.8-base',
'gnustep-base-common',
'gnustep-base-runtime',
'gnustep-common',
'ifupdown',
'initramfs-tools',
'initramfs-tools-bin',
'initscripts',
'insserv',
'iproute2',
'isc-dhcp-client',
'isc-dhcp-common',
'klibc-utils',
'kmod',
'libacl1',
'libaio1',
'libapache2-mod-wsgi',
'libapparmor1',
'libapt-inst1.5',
'libapt-pkg4.12',
'libasn1-8-heimdal',
'libattr1',
'libaudit-common',
'libaudit1',
'libavahi-client3',
'libavahi-common-data',
'libavahi-common3',
'libblkid1',
'libbsd0',
'libbz2-1.0',
'libc6',
'libcap2',
'libclass-isa-perl',
'libcomerr2',
'libcups2',
'libcurl3-gnutls',
'libdb5.1',
'libdbus-1-3',
'libdrm2',
'libevent-2.0-5',
'libexpat1',
'libffi6',
'libfile-copy-recursive-perl',
'libgcc1',
'libgcrypt11',
'libgdbm3',
'libglib2.0-0',
'libgmp10',
'libgnustep-base1.24',
'libgnutls26',
'libgpg-error0',
'libgssapi-krb5-2',
'libgssapi3-heimdal',
'libhcrypto4-heimdal',
'libhdb9-heimdal',
'libheimbase1-heimdal',
'libheimntlm0-heimdal',
'libhx509-5-heimdal',
'libicu48',
'libidn11',
'libjs-jquery',
'libjs-jquery-ui',
'libjs-prototype',
'libjs-scriptaculous',
'libjs-sphinxdoc',
'libjs-underscore',
'libjson-c2',
'libjson0',
'libk5crypto3',
'libkdc2-heimdal',
'libkeyutils1',
'libklibc',
'libkmod2',
'libkrb5-26-heimdal',
'libkrb5-3',
'libkrb5support0',
'liblasso3',
'libldap-2.4-2',
'libldb1',
'liblocale-gettext-perl',
'liblzma5',
'libmagic1',
'libmapi0',
'libmapiproxy0',
'libmapistore0',
'libmemcached10',
'libmount1',
'libmysqlclient18',
'libncurses5',
'libncursesw5',
'libnih-dbus1',
'libnih1',
'libntdb1',
'libobjc4',
'libp11-kit0',
'libpam-modules',
'libpam-modules-bin',
'libpam-runtime',
'libpam-systemd',
'libpam0g',
'libpci3',
'libpcre3',
'libplymouth2',
'libpng12-0',
'libpopt0',
'libpq5',
'libprocps0',
'libpython-stdlib',
'libpython2.7',
'libpython2.7-minimal',
'libpython2.7-stdlib',
'libreadline6',
'libroken18-heimdal',
'librtmp0',
'libsasl2-2',
'libsasl2-modules',
'libsasl2-modules-db',
'libsbjson2.3',
'libselinux1',
'libsemanage-common',
'libsemanage1',
'libsepol1',
'libslang2',
'libsope1',
'libsqlite3-0',
'libss2',
'libssl1.0.0',
'libstdc++6',
'libswitch-perl',
'libsystemd-daemon0',
'libsystemd-login0',
'libtalloc2',
'libtasn1-3',
'libtdb1',
'libtevent0',
'libtext-charwidth-perl',
'libtext-iconv-perl',
'libtext-wrapi18n-perl',
'libtinfo5',
'libudev1',
'libusb-1.0-0',
'libustr-1.0-1',
'libuuid1',
'libwbclient0',
'libwind0-heimdal',
'libxml2',
'libxmlsec1',
'libxmlsec1-openssl',
'libxslt1.1',
'libxtables10',
'logrotate',
'lsb-base',
'makedev',
'memcached',
'mime-support',
'module-init-tools',
'mount',
'mountall',
'multiarch-support',
'mysql-common',
'netbase',
'openchange-ocsmanager',
'openchange-rpcproxy',
'openchangeproxy',
'openchangeserver',
'openssl',
'passwd',
'pciutils',
'perl',
'perl-base',
'perl-modules',
'plymouth',
'plymouth-theme-ubuntu-text',
'procps',
'psmisc',
'python',
'python-beaker',
'python-chardet',
'python-crypto',
'python-decorator',
'python-dnspython',
'python-formencode',
'python-ldb',
'python-lxml',
'python-mako',
'python-mapistore',
'python-markupsafe',
'python-minimal',
'python-mysqldb',
'python-nose',
'python-ntdb',
'python-ocsmanager',
'python-openssl',
'python-paste',
'python-pastedeploy',
'python-pastescript',
'python-pkg-resources',
'python-pygments',
'python-pylons',
'python-repoze.lru',
'python-routes',
'python-rpclib',
'python-samba',
'python-setuptools',
'python-simplejson',
'python-spyne',
'python-support',
'python-talloc',
'python-tdb',
'python-tempita',
'python-tz',
'python-weberror',
'python-webhelpers',
'python-webob',
'python-webtest',
'python2.7',
'python2.7-minimal',
'readline-common',
'samba',
'samba-common',
'samba-common-bin',
'samba-dsdb-modules',
'samba-libs',
'samba-vfs-modules',
'sed',
'sensible-utils',
'sgml-base',
'shared-mime-info',
'sogo',
'sogo-common',
'sogo-openchange',
'systemd-services',
'sysv-rc',
'sysvinit-utils',
'tar',
'tdb-tools',
'tmpreaper',
'tzdata',
'ucf',
'udev',
'update-inetd',
'upstart',
'usbutils',
'util-linux',
'xml-core',
'zip',
'zlib1g'
)
elif distro_release == 'Ubuntu 12.04':
return (
'adduser',
'apache2',
'apache2-utils',
'apache2.2-bin',
'apache2.2-common',
'autotools-dev',
'base-passwd',
'bind9-host',
'binutils',
'busybox-initramfs',
'ca-certificates',
'coreutils',
'cpio',
'cpp-4.6',
'debconf',
'debianutils',
'dnsutils',
'dpkg',
'findutils',
'gcc-4.6',
'gcc-4.6-base',
'gnustep-base-common',
'gnustep-base-runtime',
'gnustep-common',
'gnustep-make',
'gobjc-4.6',
'ifupdown',
'initramfs-tools',
'initramfs-tools-bin',
'initscripts',
'insserv',
'iproute',
'klibc-utils',
'libacl1',
'libapache2-mod-wsgi',
'libapr1',
'libaprutil1',
'libaprutil1-dbd-sqlite3',
'libaprutil1-ldap',
'libasn1-8-heimdal',
'libattr1',
'libavahi-client3',
'libavahi-common-data',
'libavahi-common3',
'libbind9-80',
'libblkid1',
'libbsd0',
'libbz2-1.0',
'libc-bin',
'libc-dev-bin',
'libc6',
'libc6-dev',
'libcap2',
'libclass-isa-perl',
'libcomerr2',
'libcups2',
'libcurl3',
'libdb5.1',
'libdbus-1-3',
'libdm0',
'libdns81',
'libdrm-intel1',
'libdrm-nouveau1a',
'libdrm-radeon1',
'libdrm2',
'libevent-2.0-5',
'libexpat1',
'libffi6',
'libgcc1',
'libgcrypt11',
'libgdbm3',
'libgeoip1',
'libglib2.0-0',
'libgmp10',
'libgnustep-base1.22',
'libgnutls26',
'libgomp1',
'libgpg-error0',
'libgssapi-krb5-2',
'libgssapi3-heimdal',
'libhcrypto4-heimdal',
'libheimbase1-heimdal',
'libheimntlm0-heimdal',
'libhx509-5-heimdal',
'libicu48',
'libidn11',
'libisc83',
'libisccc80',
'libisccfg82',
'libjs-prototype',
'libjs-scriptaculous',
'libk5crypto3',
'libkeyutils1',
'libklibc',
'libkrb5-26-heimdal',
'libkrb5-3',
'libkrb5support0',
'libldap-2.4-2',
'liblwres80',
'liblzma5',
'libmapi0',
'libmapiproxy0',
'libmapistore0',
'libmemcached6',
'libmount1',
'libmpc2',
'libmpfr4',
'libmysqlclient18',
'libncurses5',
'libncursesw5',
'libnih-dbus1',
'libnih1',
'libobjc3',
'libp11-kit0',
'libpam-modules',
'libpam-modules-bin',
'libpam0g',
'libpciaccess0',
'libpcre3',
'libplymouth2',
'libpng12-0',
'libpython2.7',
'libquadmath0',
'libreadline6',
'libroken18-heimdal',
'librtmp0',
'libsasl2-2',
'libsbjson2.3',
'libselinux1',
'libslang2',
'libsope-appserver4.9',
'libsope-core4.9',
'libsope-gdl1-4.9',
'libsope-ldap4.9',
'libsope-mime4.9',
'libsope-xml4.9',
'libsqlite3-0',
'libssl1.0.0',
'libstdc++6',
'libswitch-perl',
'libtasn1-3',
'libtinfo5',
'libudev0',
'libuuid1',
'libwind0-heimdal',
'libxml2',
'libxslt1.1',
'linux-libc-dev',
'lsb-base',
'makedev',
'memcached',
'mime-support',
'module-init-tools',
'mount',
'mountall',
'multiarch-support',
'mysql-common',
'ncurses-bin',
'openchange-ocsmanager',
'openchange-rpcproxy',
'openchangeproxy',
'openchangeserver',
'openssl',
'passwd',
'perl',
'perl-base',
'perl-modules',
'plymouth',
'procps',
'python',
'python-beaker',
'python-decorator',
'python-dnspython',
'python-formencode',
'python-lxml',
'python-mako',
'python-mapistore',
'python-markupsafe',
'python-minimal',
'python-mysqldb',
'python-nose',
'python-ocsmanager',
'python-paste',
'python-pastedeploy',
'python-pastescript',
'python-pkg-resources',
'python-pygments',
'python-pylons',
'python-routes',
'python-rpclib',
'python-setuptools',
'python-simplejson',
'python-spyne',
'python-support',
'python-tempita',
'python-tz',
'python-weberror',
'python-webhelpers',
'python-webob',
'python-webtest',
'python2.7',
'python2.7-minimal',
'readline-common',
'samba4',
'sed',
'sensible-utils',
'sgml-base',
'sogo',
'sogo-openchange',
'sope4.9-libxmlsaxdriver',
'sysv-rc',
'sysvinit-utils',
'tar',
'tmpreaper',
'tzdata',
'udev',
'upstart',
'util-linux',
'xml-core',
'xz-utils',
'zlib1g'
)
else:
raise SystemError('Invalid Distro Release %s' % distro_release)
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
1898,
334,
35,
9,
3447,
322,
544,
1603,
14,
18769,
78,
11302,
78,
271,
90,
6927,
199,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
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,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
199,
624,
199,
4433,
3102,
370,
663,
314,
15665,
436,
1487,
3209,
1504,
12,
340,
4124,
12,
687,
13450,
719,
2467,
9030,
14,
199,
199,
2765,
365,
2488,
370,
3107,
287,
369,
279,
14,
199,
624,
199,
504,
2197,
492,
2197,
421,
199,
318,
2341,
63,
2491,
8,
3070,
304,
272,
408,
272,
9138,
282,
3622,
12,
652,
911,
372,
314,
2559,
436,
314,
1015,
10298,
641,
314,
272,
10113,
293,
9625,
436,
314,
9434,
2964,
10239,
1504,
2488,
687,
3107,
287,
369,
279,
23737,
14,
339,
520,
635,
2771,
719,
14,
3070,
14,
7457,
3622,
26,
314,
12420,
3622,
272,
520,
5808,
26,
282,
2008,
3035,
314,
2559,
436,
314,
1015,
402,
314,
2559,
14,
272,
520,
4500,
2008,
26,
272,
408,
272,
340,
283,
12012,
293,
9625,
7,
440,
315,
3622,
503,
283,
18039,
10239,
7,
440,
315,
3622,
26,
267,
746,
6187,
547,
360,
1944,
10113,
293,
9625,
503,
9434,
2964,
10239,
370,
2341,
314,
2559,
358,
339,
20499,
63,
3221,
275,
3622,
459,
12012,
293,
9625,
418,
272,
12420,
63,
602,
275,
2197,
14,
18531,
8,
442,
8,
3070,
459,
18039,
10239,
5156,
272,
340,
20499,
63,
3221,
508,
283,
53,
19313,
4329,
14,
966,
356,
267,
340,
12420,
63,
602,
2356,
2197,
8,
7280,
12,
959,
12,
5504,
12,
413,
12,
7105,
304,
221,
327,
17646,
1434,
288,
372,
661,
21693,
297,
283,
19,
26,
20,
14,
17,
14,
23,
11,
1587,
1226,
13,
18,
94,
5193,
369,
279,
18,
94,
772,
358,
267,
372,
661,
21693,
297,
283,
19,
26,
20,
14,
17,
14,
23,
11,
1587,
1226,
13,
18,
94,
5193,
369,
279,
17,
94,
708,
358,
272,
916,
20499,
63,
3221,
508,
283,
53,
19313,
4944,
14,
709,
356,
267,
372,
661,
21693,
297,
283,
18,
26,
20,
14,
17,
14,
22,
11,
1587,
1226,
13,
17,
94,
5193,
369,
279,
17,
94,
7357,
358,
272,
916,
20499,
63,
3221,
508,
283,
53,
19313,
3144,
14,
966,
356,
267,
340,
12420,
63,
602,
665,
2197,
8,
6965,
12,
1616,
12,
499,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
16,
1195,
19,
13,
5193,
369,
279,
19,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
6965,
12,
3144,
12,
1616,
12,
4944,
12,
30569,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
16,
1195,
20,
13,
5193,
369,
279,
17,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
6965,
12,
3144,
12,
5557,
12,
4119,
12,
8177,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
18,
13,
5193,
369,
279,
18,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
7280,
12,
650,
12,
959,
12,
3388,
12,
3193,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
19,
13,
5193,
369,
279,
18,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
7280,
12,
959,
12,
4233,
12,
1695,
12,
13385,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
21,
13,
5193,
369,
279,
17,
358,
267,
587,
26,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
23,
13,
5193,
369,
279,
17,
358,
272,
587,
26,
267,
746,
6187,
547,
360,
3364,
10113,
293,
17646,
450,
83,
7,
450,
20499,
63,
3221,
9,
421,
199,
318,
2341,
63,
5714,
8,
3070,
304,
272,
408,
272,
9138,
282,
3622,
12,
652,
911,
372,
314,
5124,
687,
314,
2559,
10298,
641,
314,
272,
10113,
293,
9625,
1504,
2488,
687,
3107,
287,
369,
279,
23737,
14,
339,
520,
635,
2771,
719,
14,
3070,
14,
7457,
3622,
26,
314,
12420,
3622,
272,
520,
5808,
26,
282,
769,
402,
314,
1453,
5124,
6117,
272,
520,
4500,
2008,
26,
272,
408,
272,
340,
283,
12012,
293,
9625,
7,
440,
315,
3622,
26,
267,
746,
6187,
547,
360,
1944,
10113,
293,
9625,
370,
664,
314,
5124,
6117,
358,
339,
20499,
63,
3221,
275,
3622,
459,
12012,
293,
9625,
418,
272,
340,
20499,
63,
3221,
508,
283,
53,
19313,
4329,
14,
966,
356,
267,
372,
334,
288,
283,
525,
751,
297,
288,
283,
6182,
13,
1208,
297,
288,
283,
962,
297,
288,
283,
1095,
13,
12671,
297,
288,
283,
25265,
1977,
13,
826,
5975,
2319,
297,
288,
283,
696,
13,
16159,
297,
288,
283,
346,
7515,
297,
288,
283,
1018,
1208,
297,
288,
283,
67,
13937,
297,
288,
283,
14829,
297,
288,
283,
17066,
297,
288,
283,
16762,
2190,
297,
288,
283,
16762,
2190,
13,
73,
1085,
78,
297,
288,
283,
23204,
1208,
297,
288,
283,
68,
4600,
297,
288,
283,
69,
18,
2319,
8450,
297,
288,
283,
69,
18,
2319,
496,
458,
297,
288,
283,
493,
297,
288,
283,
1623,
1208,
297,
288,
283,
13112,
13,
20,
14,
24,
13,
1095,
297,
288,
283,
13112,
13,
20,
14,
25,
13,
1095,
297,
288,
283,
784,
527,
2852,
13,
1095,
13,
2330,
297,
288,
283,
784,
527,
2852,
13,
1095,
13,
7726,
297,
288,
283,
784,
527,
2852,
13,
2330,
297,
288,
283,
692,
384,
2110,
297,
288,
283,
826,
5975,
2319,
13,
2537,
297
] | [
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
1898,
334,
35,
9,
3447,
322,
544,
1603,
14,
18769,
78,
11302,
78,
271,
90,
6927,
199,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
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,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
199,
624,
199,
4433,
3102,
370,
663,
314,
15665,
436,
1487,
3209,
1504,
12,
340,
4124,
12,
687,
13450,
719,
2467,
9030,
14,
199,
199,
2765,
365,
2488,
370,
3107,
287,
369,
279,
14,
199,
624,
199,
504,
2197,
492,
2197,
421,
199,
318,
2341,
63,
2491,
8,
3070,
304,
272,
408,
272,
9138,
282,
3622,
12,
652,
911,
372,
314,
2559,
436,
314,
1015,
10298,
641,
314,
272,
10113,
293,
9625,
436,
314,
9434,
2964,
10239,
1504,
2488,
687,
3107,
287,
369,
279,
23737,
14,
339,
520,
635,
2771,
719,
14,
3070,
14,
7457,
3622,
26,
314,
12420,
3622,
272,
520,
5808,
26,
282,
2008,
3035,
314,
2559,
436,
314,
1015,
402,
314,
2559,
14,
272,
520,
4500,
2008,
26,
272,
408,
272,
340,
283,
12012,
293,
9625,
7,
440,
315,
3622,
503,
283,
18039,
10239,
7,
440,
315,
3622,
26,
267,
746,
6187,
547,
360,
1944,
10113,
293,
9625,
503,
9434,
2964,
10239,
370,
2341,
314,
2559,
358,
339,
20499,
63,
3221,
275,
3622,
459,
12012,
293,
9625,
418,
272,
12420,
63,
602,
275,
2197,
14,
18531,
8,
442,
8,
3070,
459,
18039,
10239,
5156,
272,
340,
20499,
63,
3221,
508,
283,
53,
19313,
4329,
14,
966,
356,
267,
340,
12420,
63,
602,
2356,
2197,
8,
7280,
12,
959,
12,
5504,
12,
413,
12,
7105,
304,
221,
327,
17646,
1434,
288,
372,
661,
21693,
297,
283,
19,
26,
20,
14,
17,
14,
23,
11,
1587,
1226,
13,
18,
94,
5193,
369,
279,
18,
94,
772,
358,
267,
372,
661,
21693,
297,
283,
19,
26,
20,
14,
17,
14,
23,
11,
1587,
1226,
13,
18,
94,
5193,
369,
279,
17,
94,
708,
358,
272,
916,
20499,
63,
3221,
508,
283,
53,
19313,
4944,
14,
709,
356,
267,
372,
661,
21693,
297,
283,
18,
26,
20,
14,
17,
14,
22,
11,
1587,
1226,
13,
17,
94,
5193,
369,
279,
17,
94,
7357,
358,
272,
916,
20499,
63,
3221,
508,
283,
53,
19313,
3144,
14,
966,
356,
267,
340,
12420,
63,
602,
665,
2197,
8,
6965,
12,
1616,
12,
499,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
16,
1195,
19,
13,
5193,
369,
279,
19,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
6965,
12,
3144,
12,
1616,
12,
4944,
12,
30569,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
16,
1195,
20,
13,
5193,
369,
279,
17,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
6965,
12,
3144,
12,
5557,
12,
4119,
12,
8177,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
18,
13,
5193,
369,
279,
18,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
7280,
12,
650,
12,
959,
12,
3388,
12,
3193,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
19,
13,
5193,
369,
279,
18,
358,
267,
916,
12420,
63,
602,
665,
2197,
8,
7280,
12,
959,
12,
4233,
12,
1695,
12,
13385,
304,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
21,
13,
5193,
369,
279,
17,
358,
267,
587,
26,
288,
372,
661,
21693,
20,
297,
283,
20,
14,
17,
14,
23,
13,
5193,
369,
279,
17,
358,
272,
587,
26,
267,
746,
6187,
547,
360,
3364,
10113,
293,
17646,
450,
83,
7,
450,
20499,
63,
3221,
9,
421,
199,
318,
2341,
63,
5714,
8,
3070,
304,
272,
408,
272,
9138,
282,
3622,
12,
652,
911,
372,
314,
5124,
687,
314,
2559,
10298,
641,
314,
272,
10113,
293,
9625,
1504,
2488,
687,
3107,
287,
369,
279,
23737,
14,
339,
520,
635,
2771,
719,
14,
3070,
14,
7457,
3622,
26,
314,
12420,
3622,
272,
520,
5808,
26,
282,
769,
402,
314,
1453,
5124,
6117,
272,
520,
4500,
2008,
26,
272,
408,
272,
340,
283,
12012,
293,
9625,
7,
440,
315,
3622,
26,
267,
746,
6187,
547,
360,
1944,
10113,
293,
9625,
370,
664,
314,
5124,
6117,
358,
339,
20499,
63,
3221,
275,
3622,
459,
12012,
293,
9625,
418,
272,
340,
20499,
63,
3221,
508,
283,
53,
19313,
4329,
14,
966,
356,
267,
372,
334,
288,
283,
525,
751,
297,
288,
283,
6182,
13,
1208,
297,
288,
283,
962,
297,
288,
283,
1095,
13,
12671,
297,
288,
283,
25265,
1977,
13,
826,
5975,
2319,
297,
288,
283,
696,
13,
16159,
297,
288,
283,
346,
7515,
297,
288,
283,
1018,
1208,
297,
288,
283,
67,
13937,
297,
288,
283,
14829,
297,
288,
283,
17066,
297,
288,
283,
16762,
2190,
297,
288,
283,
16762,
2190,
13,
73,
1085,
78,
297,
288,
283,
23204,
1208,
297,
288,
283,
68,
4600,
297,
288,
283,
69,
18,
2319,
8450,
297,
288,
283,
69,
18,
2319,
496,
458,
297,
288,
283,
493,
297,
288,
283,
1623,
1208,
297,
288,
283,
13112,
13,
20,
14,
24,
13,
1095,
297,
288,
283,
13112,
13,
20,
14,
25,
13,
1095,
297,
288,
283,
784,
527,
2852,
13,
1095,
13,
2330,
297,
288,
283,
784,
527,
2852,
13,
1095,
13,
7726,
297,
288,
283,
784,
527,
2852,
13,
2330,
297,
288,
283,
692,
384,
2110,
297,
288,
283,
826,
5975,
2319,
13,
2537,
297,
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,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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
] |
porcobosso/spark-ec2 | lib/boto-2.34.0/boto/ec2/instancetype.py | 152 | 2273 | # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# 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.ec2.ec2object import EC2Object
class InstanceType(EC2Object):
"""
Represents an EC2 VM Type
:ivar name: The name of the vm type
:ivar cores: The number of cpu cores for this vm type
:ivar memory: The amount of memory in megabytes for this vm type
:ivar disk: The amount of disk space in gigabytes for this vm type
"""
def __init__(self, connection=None, name=None, cores=None,
memory=None, disk=None):
super(InstanceType, self).__init__(connection)
self.connection = connection
self.name = name
self.cores = cores
self.memory = memory
self.disk = disk
def __repr__(self):
return 'InstanceType:%s-%s,%s,%s' % (self.name, self.cores,
self.memory, self.disk)
def endElement(self, name, value, connection):
if name == 'name':
self.name = value
elif name == 'cpu':
self.cores = value
elif name == 'disk':
self.disk = value
elif name == 'memory':
self.memory = value
else:
setattr(self, name, value)
| apache-2.0 | [
3,
1898,
334,
67,
9,
8315,
13,
8664,
603,
9414,
598,
26272,
1455,
921,
71,
26272,
14,
1308,
15,
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,
421,
199,
504,
6055,
14,
825,
18,
14,
825,
18,
785,
492,
15352,
18,
1692,
421,
199,
533,
10066,
804,
8,
4220,
18,
1692,
304,
272,
408,
272,
21591,
376,
15352,
18,
7525,
2434,
339,
520,
7725,
536,
26,
710,
536,
402,
314,
4169,
730,
272,
520,
7725,
23857,
26,
710,
1329,
402,
5033,
23857,
367,
642,
4169,
730,
272,
520,
7725,
4402,
26,
710,
5982,
402,
4402,
315,
562,
71,
27601,
367,
642,
4169,
730,
272,
520,
7725,
4543,
26,
710,
5982,
402,
4543,
4601,
315,
486,
528,
27601,
367,
642,
4169,
730,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1950,
29,
403,
12,
536,
29,
403,
12,
23857,
29,
403,
12,
326,
4402,
29,
403,
12,
4543,
29,
403,
304,
267,
1613,
8,
3244,
804,
12,
291,
2843,
826,
721,
2105,
9,
267,
291,
14,
2105,
275,
1950,
267,
291,
14,
354,
275,
536,
267,
291,
14,
4630,
275,
23857,
267,
291,
14,
4844,
275,
4402,
267,
291,
14,
4032,
275,
4543,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
283,
3244,
804,
2689,
83,
3295,
83,
8719,
83,
8719,
83,
7,
450,
334,
277,
14,
354,
12,
291,
14,
4630,
12,
6163,
291,
14,
4844,
12,
291,
14,
4032,
9,
339,
347,
28920,
8,
277,
12,
536,
12,
574,
12,
1950,
304,
267,
340,
536,
508,
283,
354,
356,
288,
291,
14,
354,
275,
574,
267,
916,
536,
508,
283,
3541,
356,
288,
291,
14,
4630,
275,
574,
267,
916,
536,
508,
283,
4032,
356,
288,
291,
14,
4032,
275,
574,
267,
916,
536,
508,
283,
4844,
356,
288,
291,
14,
4844,
275,
574,
267,
587,
26,
288,
5371,
8,
277,
12,
536,
12,
574,
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
] | [
1898,
334,
67,
9,
8315,
13,
8664,
603,
9414,
598,
26272,
1455,
921,
71,
26272,
14,
1308,
15,
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,
421,
199,
504,
6055,
14,
825,
18,
14,
825,
18,
785,
492,
15352,
18,
1692,
421,
199,
533,
10066,
804,
8,
4220,
18,
1692,
304,
272,
408,
272,
21591,
376,
15352,
18,
7525,
2434,
339,
520,
7725,
536,
26,
710,
536,
402,
314,
4169,
730,
272,
520,
7725,
23857,
26,
710,
1329,
402,
5033,
23857,
367,
642,
4169,
730,
272,
520,
7725,
4402,
26,
710,
5982,
402,
4402,
315,
562,
71,
27601,
367,
642,
4169,
730,
272,
520,
7725,
4543,
26,
710,
5982,
402,
4543,
4601,
315,
486,
528,
27601,
367,
642,
4169,
730,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1950,
29,
403,
12,
536,
29,
403,
12,
23857,
29,
403,
12,
326,
4402,
29,
403,
12,
4543,
29,
403,
304,
267,
1613,
8,
3244,
804,
12,
291,
2843,
826,
721,
2105,
9,
267,
291,
14,
2105,
275,
1950,
267,
291,
14,
354,
275,
536,
267,
291,
14,
4630,
275,
23857,
267,
291,
14,
4844,
275,
4402,
267,
291,
14,
4032,
275,
4543,
339,
347,
636,
2722,
721,
277,
304,
267,
372,
283,
3244,
804,
2689,
83,
3295,
83,
8719,
83,
8719,
83,
7,
450,
334,
277,
14,
354,
12,
291,
14,
4630,
12,
6163,
291,
14,
4844,
12,
291,
14,
4032,
9,
339,
347,
28920,
8,
277,
12,
536,
12,
574,
12,
1950,
304,
267,
340,
536,
508,
283,
354,
356,
288,
291,
14,
354,
275,
574,
267,
916,
536,
508,
283,
3541,
356,
288,
291,
14,
4630,
275,
574,
267,
916,
536,
508,
283,
4032,
356,
288,
291,
14,
4032,
275,
574,
267,
916,
536,
508,
283,
4844,
356,
288,
291,
14,
4844,
275,
574,
267,
587,
26,
288,
5371,
8,
277,
12,
536,
12,
574,
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,
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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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
] |
eckucukoglu/arm-linux-gnueabihf | lib/python2.7/unittest/test/test_program.py | 111 | 7555 | from cStringIO import StringIO
import os
import sys
import unittest
class Test_TestProgram(unittest.TestCase):
def test_discovery_from_dotted_path(self):
loader = unittest.TestLoader()
tests = [self]
expectedPath = os.path.abspath(os.path.dirname(unittest.test.__file__))
self.wasRun = False
def _find_tests(start_dir, pattern):
self.wasRun = True
self.assertEqual(start_dir, expectedPath)
return tests
loader._find_tests = _find_tests
suite = loader.discover('unittest.test')
self.assertTrue(self.wasRun)
self.assertEqual(suite._tests, tests)
# Horrible white box test
def testNoExit(self):
result = object()
test = object()
class FakeRunner(object):
def run(self, test):
self.test = test
return result
runner = FakeRunner()
oldParseArgs = unittest.TestProgram.parseArgs
def restoreParseArgs():
unittest.TestProgram.parseArgs = oldParseArgs
unittest.TestProgram.parseArgs = lambda *args: None
self.addCleanup(restoreParseArgs)
def removeTest():
del unittest.TestProgram.test
unittest.TestProgram.test = test
self.addCleanup(removeTest)
program = unittest.TestProgram(testRunner=runner, exit=False, verbosity=2)
self.assertEqual(program.result, result)
self.assertEqual(runner.test, test)
self.assertEqual(program.verbosity, 2)
class FooBar(unittest.TestCase):
def testPass(self):
assert True
def testFail(self):
assert False
class FooBarLoader(unittest.TestLoader):
"""Test loader that returns a suite containing FooBar."""
def loadTestsFromModule(self, module):
return self.suiteClass(
[self.loadTestsFromTestCase(Test_TestProgram.FooBar)])
def test_NonExit(self):
program = unittest.main(exit=False,
argv=["foobar"],
testRunner=unittest.TextTestRunner(stream=StringIO()),
testLoader=self.FooBarLoader())
self.assertTrue(hasattr(program, 'result'))
def test_Exit(self):
self.assertRaises(
SystemExit,
unittest.main,
argv=["foobar"],
testRunner=unittest.TextTestRunner(stream=StringIO()),
exit=True,
testLoader=self.FooBarLoader())
def test_ExitAsDefault(self):
self.assertRaises(
SystemExit,
unittest.main,
argv=["foobar"],
testRunner=unittest.TextTestRunner(stream=StringIO()),
testLoader=self.FooBarLoader())
class InitialisableProgram(unittest.TestProgram):
exit = False
result = None
verbosity = 1
defaultTest = None
testRunner = None
testLoader = unittest.defaultTestLoader
progName = 'test'
test = 'test'
def __init__(self, *args):
pass
RESULT = object()
class FakeRunner(object):
initArgs = None
test = None
raiseError = False
def __init__(self, **kwargs):
FakeRunner.initArgs = kwargs
if FakeRunner.raiseError:
FakeRunner.raiseError = False
raise TypeError
def run(self, test):
FakeRunner.test = test
return RESULT
class TestCommandLineArgs(unittest.TestCase):
def setUp(self):
self.program = InitialisableProgram()
self.program.createTests = lambda: None
FakeRunner.initArgs = None
FakeRunner.test = None
FakeRunner.raiseError = False
def testHelpAndUnknown(self):
program = self.program
def usageExit(msg=None):
program.msg = msg
program.exit = True
program.usageExit = usageExit
for opt in '-h', '-H', '--help':
program.exit = False
program.parseArgs([None, opt])
self.assertTrue(program.exit)
self.assertIsNone(program.msg)
program.parseArgs([None, '-$'])
self.assertTrue(program.exit)
self.assertIsNotNone(program.msg)
def testVerbosity(self):
program = self.program
for opt in '-q', '--quiet':
program.verbosity = 1
program.parseArgs([None, opt])
self.assertEqual(program.verbosity, 0)
for opt in '-v', '--verbose':
program.verbosity = 1
program.parseArgs([None, opt])
self.assertEqual(program.verbosity, 2)
def testBufferCatchFailfast(self):
program = self.program
for arg, attr in (('buffer', 'buffer'), ('failfast', 'failfast'),
('catch', 'catchbreak')):
if attr == 'catch' and not hasInstallHandler:
continue
short_opt = '-%s' % arg[0]
long_opt = '--%s' % arg
for opt in short_opt, long_opt:
setattr(program, attr, None)
program.parseArgs([None, opt])
self.assertTrue(getattr(program, attr))
for opt in short_opt, long_opt:
not_none = object()
setattr(program, attr, not_none)
program.parseArgs([None, opt])
self.assertEqual(getattr(program, attr), not_none)
def testRunTestsRunnerClass(self):
program = self.program
program.testRunner = FakeRunner
program.verbosity = 'verbosity'
program.failfast = 'failfast'
program.buffer = 'buffer'
program.runTests()
self.assertEqual(FakeRunner.initArgs, {'verbosity': 'verbosity',
'failfast': 'failfast',
'buffer': 'buffer'})
self.assertEqual(FakeRunner.test, 'test')
self.assertIs(program.result, RESULT)
def testRunTestsRunnerInstance(self):
program = self.program
program.testRunner = FakeRunner()
FakeRunner.initArgs = None
program.runTests()
# A new FakeRunner should not have been instantiated
self.assertIsNone(FakeRunner.initArgs)
self.assertEqual(FakeRunner.test, 'test')
self.assertIs(program.result, RESULT)
def testRunTestsOldRunnerClass(self):
program = self.program
FakeRunner.raiseError = True
program.testRunner = FakeRunner
program.verbosity = 'verbosity'
program.failfast = 'failfast'
program.buffer = 'buffer'
program.test = 'test'
program.runTests()
# If initializing raises a type error it should be retried
# without the new keyword arguments
self.assertEqual(FakeRunner.initArgs, {})
self.assertEqual(FakeRunner.test, 'test')
self.assertIs(program.result, RESULT)
def testCatchBreakInstallsHandler(self):
module = sys.modules['unittest.main']
original = module.installHandler
def restore():
module.installHandler = original
self.addCleanup(restore)
self.installed = False
def fakeInstallHandler():
self.installed = True
module.installHandler = fakeInstallHandler
program = self.program
program.catchbreak = True
program.testRunner = FakeRunner
program.runTests()
self.assertTrue(self.installed)
if __name__ == '__main__':
unittest.main()
| gpl-2.0 | [
504,
15073,
492,
5228,
199,
199,
646,
747,
199,
646,
984,
199,
646,
2882,
421,
199,
533,
1379,
63,
774,
9184,
8,
2796,
14,
1746,
304,
339,
347,
511,
63,
14859,
63,
504,
63,
19404,
63,
515,
8,
277,
304,
267,
5077,
275,
2882,
14,
15824,
342,
398,
2295,
275,
359,
277,
61,
267,
1420,
2042,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
8,
2796,
14,
396,
855,
493,
8964,
398,
291,
14,
10274,
2540,
275,
756,
267,
347,
485,
1623,
63,
2219,
8,
928,
63,
694,
12,
3851,
304,
288,
291,
14,
10274,
2540,
275,
715,
288,
291,
14,
629,
8,
928,
63,
694,
12,
1420,
2042,
9,
288,
372,
2295,
267,
5077,
423,
1623,
63,
2219,
275,
485,
1623,
63,
2219,
267,
5241,
275,
5077,
14,
18861,
360,
2796,
14,
396,
358,
267,
291,
14,
1815,
8,
277,
14,
10274,
2540,
9,
267,
291,
14,
629,
8,
5768,
423,
2219,
12,
2295,
9,
339,
327,
869,
269,
322,
830,
10424,
5689,
511,
272,
347,
511,
1944,
6699,
8,
277,
304,
267,
754,
275,
909,
342,
267,
511,
275,
909,
342,
398,
1021,
7777,
7446,
8,
785,
304,
288,
347,
1255,
8,
277,
12,
511,
304,
355,
291,
14,
396,
275,
511,
355,
372,
754,
398,
7876,
275,
7777,
7446,
342,
398,
2269,
4003,
6213,
275,
2882,
14,
774,
9184,
14,
1122,
6213,
267,
347,
9066,
4003,
6213,
837,
288,
2882,
14,
774,
9184,
14,
1122,
6213,
275,
2269,
4003,
6213,
267,
2882,
14,
774,
9184,
14,
1122,
6213,
275,
2400,
627,
589,
26,
488,
267,
291,
14,
12808,
8,
8011,
4003,
6213,
9,
398,
347,
2813,
774,
837,
288,
2150,
2882,
14,
774,
9184,
14,
396,
267,
2882,
14,
774,
9184,
14,
396,
275,
511,
267,
291,
14,
12808,
8,
2168,
774,
9,
398,
2240,
275,
2882,
14,
774,
9184,
8,
396,
7446,
29,
5933,
12,
4458,
29,
797,
12,
8661,
29,
18,
9,
398,
291,
14,
629,
8,
6815,
14,
1099,
12,
754,
9,
267,
291,
14,
629,
8,
5933,
14,
396,
12,
511,
9,
267,
291,
14,
629,
8,
6815,
14,
9833,
12,
499,
9,
339,
1021,
8024,
5281,
8,
2796,
14,
1746,
304,
267,
347,
511,
4986,
8,
277,
304,
288,
702,
715,
267,
347,
511,
4874,
8,
277,
304,
288,
702,
756,
339,
1021,
8024,
5281,
5455,
8,
2796,
14,
15824,
304,
267,
408,
774,
5077,
626,
2529,
282,
5241,
3035,
8024,
5281,
1041,
267,
347,
2248,
11519,
2377,
8,
277,
12,
859,
304,
288,
372,
291,
14,
27216,
8,
355,
359,
277,
14,
26946,
8,
774,
63,
774,
9184,
14,
5686,
5281,
3948,
2378,
347,
511,
63,
6932,
6699,
8,
277,
304,
267,
2240,
275,
2882,
14,
973,
8,
2224,
29,
797,
12,
1816,
9238,
6270,
9664,
2255,
1816,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
1816,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
267,
291,
14,
1815,
8,
11161,
8,
6815,
12,
283,
1099,
1333,
2378,
347,
511,
63,
6699,
8,
277,
304,
267,
291,
14,
1855,
8,
288,
14838,
12,
288,
2882,
14,
973,
12,
288,
9238,
6270,
9664,
2255,
288,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
288,
4458,
29,
549,
12,
288,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
2378,
347,
511,
63,
6699,
2822,
2698,
8,
277,
304,
267,
291,
14,
1855,
8,
288,
14838,
12,
288,
2882,
14,
973,
12,
288,
9238,
6270,
9664,
2255,
288,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
288,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
421,
199,
533,
6026,
374,
461,
9184,
8,
2796,
14,
774,
9184,
304,
272,
4458,
275,
756,
272,
754,
275,
488,
272,
8661,
275,
413,
272,
849,
774,
275,
488,
272,
511,
7446,
275,
488,
272,
511,
5455,
275,
2882,
14,
885,
15824,
272,
13205,
985,
275,
283,
396,
7,
272,
511,
275,
283,
396,
7,
272,
347,
636,
826,
721,
277,
12,
627,
589,
304,
267,
986,
199,
199,
9517,
275,
909,
342,
199,
199,
533,
7777,
7446,
8,
785,
304,
272,
4205,
6213,
275,
488,
272,
511,
275,
488,
272,
746,
547,
275,
756,
339,
347,
636,
826,
721,
277,
12,
1011,
958,
304,
267,
7777,
7446,
14,
826,
6213,
275,
2074,
267,
340,
7777,
7446,
14,
3730,
547,
26,
288,
7777,
7446,
14,
3730,
547,
275,
756,
288,
746,
3146,
339,
347,
1255,
8,
277,
12,
511,
304,
267,
7777,
7446,
14,
396,
275,
511,
267,
372,
20668,
199,
199,
533,
1379,
16926,
6213,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
6815,
275,
6026,
374,
461,
9184,
342,
267,
291,
14,
6815,
14,
981,
2925,
275,
2400,
26,
488,
267,
7777,
7446,
14,
826,
6213,
275,
488,
267,
7777,
7446,
14,
396,
275,
488,
267,
7777,
7446,
14,
3730,
547,
275,
756,
339,
347,
511,
8673,
3325,
5912,
8,
277,
304,
267,
2240,
275,
291,
14,
6815,
267,
347,
4503,
6699,
8,
1328,
29,
403,
304,
288,
2240,
14,
1328,
275,
1499,
288,
2240,
14,
2224,
275,
715,
267,
2240,
14,
3807,
6699,
275,
4503,
6699,
398,
367,
2450,
315,
2475,
72,
297,
2475,
40,
297,
2850,
3437,
356,
288,
2240,
14,
2224,
275,
756,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
1815,
8,
6815,
14,
2224,
9,
288,
291,
14,
7702,
8,
6815,
14,
1328,
9,
398,
2240,
14,
1122,
6213,
779,
403,
12,
2475,
4,
1105,
267,
291,
14,
1815,
8,
6815,
14,
2224,
9,
267,
291,
14,
10389,
8,
6815,
14,
1328,
9,
339,
347,
511,
3673,
5947,
8,
277,
304,
267,
2240,
275,
291,
14,
6815,
398,
367,
2450,
315,
2475,
81,
297,
2850,
10243,
356,
288,
2240,
14,
9833,
275,
413,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
629,
8,
6815,
14,
9833,
12,
378,
9,
398,
367,
2450,
315,
2475,
86,
297,
2850,
3832,
356,
288,
2240,
14,
9833,
275,
413,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
629,
8,
6815,
14,
9833,
12,
499,
9,
339,
347,
511,
3299,
26096,
1906,
20803
] | [
15073,
492,
5228,
199,
199,
646,
747,
199,
646,
984,
199,
646,
2882,
421,
199,
533,
1379,
63,
774,
9184,
8,
2796,
14,
1746,
304,
339,
347,
511,
63,
14859,
63,
504,
63,
19404,
63,
515,
8,
277,
304,
267,
5077,
275,
2882,
14,
15824,
342,
398,
2295,
275,
359,
277,
61,
267,
1420,
2042,
275,
747,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
3475,
8,
2796,
14,
396,
855,
493,
8964,
398,
291,
14,
10274,
2540,
275,
756,
267,
347,
485,
1623,
63,
2219,
8,
928,
63,
694,
12,
3851,
304,
288,
291,
14,
10274,
2540,
275,
715,
288,
291,
14,
629,
8,
928,
63,
694,
12,
1420,
2042,
9,
288,
372,
2295,
267,
5077,
423,
1623,
63,
2219,
275,
485,
1623,
63,
2219,
267,
5241,
275,
5077,
14,
18861,
360,
2796,
14,
396,
358,
267,
291,
14,
1815,
8,
277,
14,
10274,
2540,
9,
267,
291,
14,
629,
8,
5768,
423,
2219,
12,
2295,
9,
339,
327,
869,
269,
322,
830,
10424,
5689,
511,
272,
347,
511,
1944,
6699,
8,
277,
304,
267,
754,
275,
909,
342,
267,
511,
275,
909,
342,
398,
1021,
7777,
7446,
8,
785,
304,
288,
347,
1255,
8,
277,
12,
511,
304,
355,
291,
14,
396,
275,
511,
355,
372,
754,
398,
7876,
275,
7777,
7446,
342,
398,
2269,
4003,
6213,
275,
2882,
14,
774,
9184,
14,
1122,
6213,
267,
347,
9066,
4003,
6213,
837,
288,
2882,
14,
774,
9184,
14,
1122,
6213,
275,
2269,
4003,
6213,
267,
2882,
14,
774,
9184,
14,
1122,
6213,
275,
2400,
627,
589,
26,
488,
267,
291,
14,
12808,
8,
8011,
4003,
6213,
9,
398,
347,
2813,
774,
837,
288,
2150,
2882,
14,
774,
9184,
14,
396,
267,
2882,
14,
774,
9184,
14,
396,
275,
511,
267,
291,
14,
12808,
8,
2168,
774,
9,
398,
2240,
275,
2882,
14,
774,
9184,
8,
396,
7446,
29,
5933,
12,
4458,
29,
797,
12,
8661,
29,
18,
9,
398,
291,
14,
629,
8,
6815,
14,
1099,
12,
754,
9,
267,
291,
14,
629,
8,
5933,
14,
396,
12,
511,
9,
267,
291,
14,
629,
8,
6815,
14,
9833,
12,
499,
9,
339,
1021,
8024,
5281,
8,
2796,
14,
1746,
304,
267,
347,
511,
4986,
8,
277,
304,
288,
702,
715,
267,
347,
511,
4874,
8,
277,
304,
288,
702,
756,
339,
1021,
8024,
5281,
5455,
8,
2796,
14,
15824,
304,
267,
408,
774,
5077,
626,
2529,
282,
5241,
3035,
8024,
5281,
1041,
267,
347,
2248,
11519,
2377,
8,
277,
12,
859,
304,
288,
372,
291,
14,
27216,
8,
355,
359,
277,
14,
26946,
8,
774,
63,
774,
9184,
14,
5686,
5281,
3948,
2378,
347,
511,
63,
6932,
6699,
8,
277,
304,
267,
2240,
275,
2882,
14,
973,
8,
2224,
29,
797,
12,
1816,
9238,
6270,
9664,
2255,
1816,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
1816,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
267,
291,
14,
1815,
8,
11161,
8,
6815,
12,
283,
1099,
1333,
2378,
347,
511,
63,
6699,
8,
277,
304,
267,
291,
14,
1855,
8,
288,
14838,
12,
288,
2882,
14,
973,
12,
288,
9238,
6270,
9664,
2255,
288,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
288,
4458,
29,
549,
12,
288,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
2378,
347,
511,
63,
6699,
2822,
2698,
8,
277,
304,
267,
291,
14,
1855,
8,
288,
14838,
12,
288,
2882,
14,
973,
12,
288,
9238,
6270,
9664,
2255,
288,
511,
7446,
29,
2796,
14,
24285,
8,
1745,
29,
6424,
4000,
288,
511,
5455,
29,
277,
14,
5686,
5281,
5455,
1012,
421,
199,
533,
6026,
374,
461,
9184,
8,
2796,
14,
774,
9184,
304,
272,
4458,
275,
756,
272,
754,
275,
488,
272,
8661,
275,
413,
272,
849,
774,
275,
488,
272,
511,
7446,
275,
488,
272,
511,
5455,
275,
2882,
14,
885,
15824,
272,
13205,
985,
275,
283,
396,
7,
272,
511,
275,
283,
396,
7,
272,
347,
636,
826,
721,
277,
12,
627,
589,
304,
267,
986,
199,
199,
9517,
275,
909,
342,
199,
199,
533,
7777,
7446,
8,
785,
304,
272,
4205,
6213,
275,
488,
272,
511,
275,
488,
272,
746,
547,
275,
756,
339,
347,
636,
826,
721,
277,
12,
1011,
958,
304,
267,
7777,
7446,
14,
826,
6213,
275,
2074,
267,
340,
7777,
7446,
14,
3730,
547,
26,
288,
7777,
7446,
14,
3730,
547,
275,
756,
288,
746,
3146,
339,
347,
1255,
8,
277,
12,
511,
304,
267,
7777,
7446,
14,
396,
275,
511,
267,
372,
20668,
199,
199,
533,
1379,
16926,
6213,
8,
2796,
14,
1746,
304,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
6815,
275,
6026,
374,
461,
9184,
342,
267,
291,
14,
6815,
14,
981,
2925,
275,
2400,
26,
488,
267,
7777,
7446,
14,
826,
6213,
275,
488,
267,
7777,
7446,
14,
396,
275,
488,
267,
7777,
7446,
14,
3730,
547,
275,
756,
339,
347,
511,
8673,
3325,
5912,
8,
277,
304,
267,
2240,
275,
291,
14,
6815,
267,
347,
4503,
6699,
8,
1328,
29,
403,
304,
288,
2240,
14,
1328,
275,
1499,
288,
2240,
14,
2224,
275,
715,
267,
2240,
14,
3807,
6699,
275,
4503,
6699,
398,
367,
2450,
315,
2475,
72,
297,
2475,
40,
297,
2850,
3437,
356,
288,
2240,
14,
2224,
275,
756,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
1815,
8,
6815,
14,
2224,
9,
288,
291,
14,
7702,
8,
6815,
14,
1328,
9,
398,
2240,
14,
1122,
6213,
779,
403,
12,
2475,
4,
1105,
267,
291,
14,
1815,
8,
6815,
14,
2224,
9,
267,
291,
14,
10389,
8,
6815,
14,
1328,
9,
339,
347,
511,
3673,
5947,
8,
277,
304,
267,
2240,
275,
291,
14,
6815,
398,
367,
2450,
315,
2475,
81,
297,
2850,
10243,
356,
288,
2240,
14,
9833,
275,
413,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
629,
8,
6815,
14,
9833,
12,
378,
9,
398,
367,
2450,
315,
2475,
86,
297,
2850,
3832,
356,
288,
2240,
14,
9833,
275,
413,
288,
2240,
14,
1122,
6213,
779,
403,
12,
2450,
566,
288,
291,
14,
629,
8,
6815,
14,
9833,
12,
499,
9,
339,
347,
511,
3299,
26096,
1906,
20803,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
RossMcKenzie/ACJ | ACJ.py | 1 | 20954 | from __future__ import division
import random
import os
import numpy as np
import pickle
import datetime
import json
class Decision(object):
def __init__(self, pair, result, reviewer, time):
self.pair = pair
self.result = result
self.reviewer = reviewer
self.time = time
def dict(self):
return {'Pair':[str(self.pair[0]),str(self.pair[1])], 'Result':str(self.result), 'reviewer':str(self.reviewer), 'time':str(self.time)}
def ACJ(data, maxRounds, noOfChoices = 1, logPath = None, optionNames = ["Choice"]):
if noOfChoices < 2:
return UniACJ(data, maxRounds, logPath, optionNames)
else:
return MultiACJ(data, maxRounds, noOfChoices, logPath, optionNames)
class MultiACJ(object):
'''Holds multiple ACJ objects for running comparisons with multiple choices.
The first element of the list of acj objects keeps track of the used pairs.'''
def __init__(self, data, maxRounds, noOfChoices, logPath = None, optionNames = None):
self.data = list(data)
self.n = len(data)
self.round = 0
self.step = 0
self.noOfChoices = noOfChoices
self.acjs = [ACJ(data, maxRounds) for _ in range(noOfChoices)]
self.logPath = logPath
if optionNames == None:
self.optionNames = [str(i) for i in range(noOfChoices)]
else:
self.optionNames = optionNames
self.nextRound()
def getScript(self, ID):
'''Gets script with ID'''
return self.acjs[0].getScript(ID)
def getID(self, script):
'''Gets ID of script'''
return self.acjs[0].getID(script)
def infoPairs(self):
'''Returns pairs based on summed selection arrays from Progressive Adaptive Comparitive Judgement
Politt(2012) + Barrada, Olea, Ponsoda, and Abad (2010)'''
pairs = []
#Create
sA = np.zeros((self.n, self.n))
for acj in self.acjs:
sA = sA+acj.selectionArray()
while(np.max(sA)>0):
iA, iB = np.unravel_index(sA.argmax(), sA.shape)
pairs.append([self.data[iA], self.data[iB]])
sA[iA,:] = 0
sA[iB,:] = 0
sA[:,iA] = 0
sA[:,iB] = 0
return pairs
def nextRound(self):
'''Returns next round of pairs'''
roundList = self.infoPairs()
for acj in self.acjs:
acj.nextRound(roundList)
acj.step = 0
self.round = self.acjs[0].round
self.step = self.acjs[0].step
return self.acjs[0].roundList
def nextPair(self):
'''gets next pair from main acj'''
p = self.acjs[0].nextPair(startNext=False)
if p == -1:
if self.nextRound() != None:
p = self.acjs[0].nextPair(startNext=False)
else:
return None
self.step = self.acjs[0].step
return p
def nextIDPair(self):
'''Gets ID of next pair'''
pair = self.nextPair()
if pair == None:
return None
idPair = []
for p in pair:
idPair.append(self.getID(p))
return idPair
def WMS(self):
ret = []
for acj in self.acjs:
ret.append(acj.WMS())
return ret
def comp(self, pair, result = None, update = None, reviewer = 'Unknown', time = 0):
'''Adds in a result between a and b where true is a wins and False is b wins'''
if result == None:
result = [True for _ in range(self.noOfChoices)]
if self.noOfChoices != len(result):
raise StandardError('Results list needs to be noOfChoices in length')
for i in range(self.noOfChoices):
self.acjs[i].comp(pair, result[i], update, reviewer, time)
if self.logPath != None:
self.log(self.logPath, pair, result, reviewer, time)
def IDComp(self, idPair, result = None, update = None, reviewer = 'Unknown', time = 0):
'''Adds in a result between a and b where true is a wins and False is b wins. Uses IDs'''
pair = []
for p in idPair:
pair.append(self.getScript(p))
self.comp(pair, result, update, reviewer, time)
def rankings(self, value=True):
'''Returns current rankings
Default is by value but score can be used'''
rank = []
for acj in self.acjs:
rank.append(acj.rankings(value))
return rank
def reliability(self):
'''Calculates reliability'''
rel = []
for acj in self.acjs:
rel.append(acj.reliability()[0])
return rel
def log(self, path, pair, result, reviewer = 'Unknown', time = 0):
'''Writes out a log of a comparison'''
timestamp = datetime.datetime.now().strftime('_%Y_%m_%d_%H_%M_%S_%f')
with open(path+os.sep+str(reviewer)+timestamp+".log", 'w+') as file:
file.write("Reviewer:%s\n" % str(reviewer))
file.write("A:%s\n" % str(pair[0]))
file.write("B:%s\n" % str(pair[1]))
for i in range(len(result)):
file.write("Winner of %s:%s\n" %(self.optionNames[i], "A" if result[i] else "B"))
file.write("Time:%s\n" % str(time))
def JSONLog(self):
'''Write acjs states to JSON files'''
for acj in self.acjs:
acj.JSONLog()
def percentReturned(self):
return self.acjs[0].percentReturned()
def results(self):
'''Prints a list of scripts and thier value scaled between 0 and 100'''
rank = []
for r in self.rankings():
rank.append(list(zip(r[0], (r[1]-r[1].min())*100/(r[1].max()-r[1].min()))))
return rank
def decisionCount(self, reviewer):
return self.acjs[0].decisionCount(reviewer)
class UniACJ(object):
'''Base object to hold comparison data and run algorithm
script is used to refer to anything that is being ranked with ACJ
Dat is an array to hold the scripts with rows being [id, script, score, quality, trials]
Track is an array with each value representing number of times a winner (dim 0) has beaten the loser (dim 1)
Decisions keeps track of all the descisions madein descision objects
'''
def __init__(self, data, maxRounds, logPath = None, optionNames = None):
self.reviewers = []
self.optionNames = optionNames
self.noOfChoices = 1
self.round = 0
self.maxRounds = maxRounds
self.update = False
self.data = list(data)
self.dat = np.zeros((5, len(data)))
self.dat[0] = np.asarray(range(len(data)))
#self.dat[1] = np.asarray(data)
#self.dat[2] = np.zeros(len(data), dtype=float)
#self.dat[3] = np.zeros(len(data), dtype=float)
#self.dat[4] = np.zeros(len(data), dtype=float)
self.track = np.zeros((len(data), len(data)))
self.n = len(data)
self.swis = 5
self.roundList = []
self.step = -1
self.decay = 1
self.returned = []
self.logPath = logPath
self.decisions = []
def nextRound(self, extRoundList = None):
'''Returns next round of pairs'''
print("Hello")
self.round = self.round+1
self.step = 0
if self.round > self.maxRounds:
self.maxRounds = self.round
#print(self.round)
if self.round > 1:
self.updateAll()
if extRoundList == None:
self.roundList = self.infoPairs()
else:
self.roundList = extRoundList
self.returned = [False for i in range(len(self.roundList))]
return self.roundList
def polittNextRound(self):
self.round = self.round+1
if self.round > self.maxRounds:
self.roundList = None
elif self.round<2:
self.roundList = self.randomPairs()
elif self.round<2+self.swis:
self.updateAll()
self.roundList = self.scorePairs()
else:
#if self.round == 1+swis:
#self.dat[3] = (1/self.dat[1].size)*self.dat[2][:]
self.updateAll()
self.roundList = self.valuePairs()
return self.roundList
#return self.scorePairs()
def getID(self, script):
'''Gets ID of script'''
return self.data.index(script)
def getScript(self, ID):
'''Gets script with ID'''
return self.data[ID]
def nextPair(self, startNext = True):
'''Returns next pair. Will start new rounds automatically if startNext is true'''
self.step = self.step + 1
if self.step >= len(self.roundList):
if all(self.returned):
if (startNext):
self.nextRound()
#self.polittNextRound()
if self.roundList == None or self.roundList == []:
return None
else:
return -1
else:
o = [p for p in self.roundList if not self.returned[self.roundList.index(p)]]
return random.choice(o)
return self.roundList[self.step]
def nextIDPair(self, startNext = True):
'''Returns ID of next pair'''
pair = self.nextPair()
if pair == None:
return None
idPair = []
for p in pair:
idPair.append(self.getID(p))
return idPair
def singleProb(self, iA, iB):
prob = np.exp(self.dat[3][iA]-self.dat[3][iB])/(1+np.exp(self.dat[3][iA]-self.dat[3][iB]))
return prob
def prob(self, iA):
'''Returns a numpy array of the probability of A beating other values
Based on the Bradley-Terry-Luce model (Bradley and Terry 1952; Luce 1959)'''
probs = np.exp(self.dat[3][iA]-self.dat[3])/(1+np.exp(self.dat[3][iA]-self.dat[3]))
return probs
def fullProb(self):
'''Returns a 2D array of all probabilities of x beating y'''
pr = np.zeros((self.n, self.n))
for i in range(self.n):
pr[i] = self.dat[3][i]
return np.exp(pr-self.dat[3])/(1+np.exp(pr-self.dat[3]))
def fisher(self):
'''returns fisher info array'''
prob = self.fullProb()
return ((prob**2)*(1-prob)**2)+((prob.T**2)*(1-prob.T)**2)
def selectionArray(self):
'''Returns a selection array based on Progressive Adaptive Comparitive Judgement
Politt(2012) + Barrada, Olea, Ponsoda, and Abad (2010)'''
F = self.fisher()*np.logical_not(np.identity(self.n))
ran = np.random.rand(self.n, self.n)*np.max(F)
a = 0
b = 0
#Create array from fisher mixed with noise
for i in range(1, self.round+1):
a = a + (i-1)**self.decay
for i in range(1, self.maxRounds+1):
b = b + (i-1)**self.decay
W = a/b
S = ((1-W)*ran)+(W*F)
#Remove i=j and already compared scripts
return S*np.logical_not(np.identity(self.n))*np.logical_not(self.track+self.track.T)
def updateValue(self, iA):
'''Updates the value of script A using Newton's Method'''
scoreA = self.dat[2][iA]
valA = self.dat[3][iA]
probA = self.prob(iA)
x = np.sum(probA)-0.5#Subtract where i = a
y = np.sum(probA*(1-probA))-0.25#Subtract where i = a
if x == 0:
exit()
#print(self.dat[3])
return self.dat[3][iA]+((self.dat[2][iA]-x)/y)
#print(self.dat[3][iA])
#print("--------")
def updateAll(self):
'''Updates the value of all scripts using Newton's Method'''
newDat = np.zeros(self.dat[3].size)
for i in self.dat[0]:
newDat[i] = self.updateValue(i)
self.dat[3] = newDat[:]
def randomPairs(self, dat = None):
'''Returns a list of random pairs from dat'''
if dat == None:
dat = self.data
shufDat = np.array(dat, copy=True)
ranPairs = []
while len(shufDat)>1:
a = shufDat[0]
b = shufDat[1]
shufDat = shufDat[2:]
ranPairs.append([a,b])
return ranPairs
def scorePairs(self, dat = None, scores = None):
'''Returns random pairs with matching scores or close if no match'''
if dat == None:
dat = self.dat
shuf = np.array(dat[:3], copy=True)
np.random.shuffle(shuf.T)
shuf.T
shuf = shuf[:, np.argsort(shuf[2])]
pairs = []
i = 0
#Pairs matching scores
while i<(shuf[0].size-1):
aID = shuf[0][i]
bID = shuf[0][i+1]
if (self.track[aID][bID]+self.track[bID][aID])==0 and shuf[2][i]==shuf[2][i+1]:
pairs.append([self.data[shuf[0][i]], self.data[shuf[0][i+1]]])
shuf = np.delete(shuf, [i, i+1], 1)
else:
i = i+1
#Add on closest score couplings of unmatched scores
i = 0
while i<shuf[0].size-1:
aID = shuf[0][i]
j = i+1
while j<shuf[0].size:
bID = shuf[0][j]
if (self.track[aID][bID]+self.track[bID][aID])==0:
pairs.append([self.data[shuf[0][i]], self.data[shuf[0][j]]])
shuf = np.delete(shuf, [i, j], 1)
break
else:
j = j+1
if j == shuf[0].size:
i = i+1
return pairs
def valuePairs(self):
'''Returns pairs matched by close values Politt(2012)'''
shuf = np.array(self.dat, copy=True)#Transpose to shuffle columns rather than rows
np.random.shuffle(shuf.T)
shuf.T
pairs = []
i = 0
while i<shuf[0].size-1:
aID = shuf[0][i]
newShuf = shuf[:, np.argsort(np.abs(shuf[3] - shuf[3][i]))]
j = 0
while j<newShuf[0].size:
bID = newShuf[0][j]
if (self.track[aID][bID]+self.track[bID][aID])==0 and self.data[aID]!=self.data[bID]:
pairs.append([self.data[shuf[0][i]], self.data[newShuf[0][j]]])
iJ = np.where(shuf[0]==newShuf[0][j])[0][0]
shuf = np.delete(shuf, [i, iJ], 1)
break
else:
j = j+1
if j == shuf[0].size:
i = i+1
return pairs
def infoPairs(self):
'''Returns pairs based on selection array from Progressive Adaptive Comparitive Judgement
Politt(2012) + Barrada, Olea, Ponsoda, and Abad (2010)'''
pairs = []
#Create
sA = self.selectionArray()
while(np.max(sA)>0):
iA, iB = np.unravel_index(sA.argmax(), sA.shape)
pairs.append([self.data[iA], self.data[iB]])
sA[iA,:] = 0
sA[iB,:] = 0
sA[:,iA] = 0
sA[:,iB] = 0
return pairs
def rmse(self):
'''Calculate rmse'''
prob = self.fullProb()
y = 1/np.sqrt(np.sum(prob*(1-prob), axis=1)-0.25)
return np.sqrt(np.mean(np.square(y)))
def trueSD(self):
'''Calculate true standard deviation'''
sd = np.std(self.dat[3])
return ((sd**2)/(self.rmse()**2))**(0.5)
def reliability(self):
'''Calculates reliability'''
G = self.trueSD()/self.rmse()
return [(G**2)/(1+(G**2))]
def SR(self, pair, result):
'''Calculates the Squared Residual and weight of a decision'''
p = [self.getID(a) for a in pair]
if result:
prob = self.singleProb(p[0], p[1])
else:
prob = self.singleProb(p[1], p[0])
res = 1-prob
weight = prob*(1-prob)
SR = (res**2)
return SR, weight
def addDecision(self, pair, result, reviewer, time = 0):
'''Adds an SSR to the SSR array'''
self.decisions.append(Decision(pair, result,reviewer, time))
def revID(self, reviewer):
return self.reviewers.index(reviewer)
def WMS(self, decisions = None):
'''Builds data lists:
[reviewer] [sum of SR, sum of weights]
and uses it to make dict reviewer: WMS
WMS = Sum SR/Sum weights
also returns mean and std div'''
if decisions == None:
decisions = self.decisions
self.reviewers = []
SRs = []
weights = []
for dec in decisions:
if dec.reviewer not in self.reviewers:
self.reviewers.append(dec.reviewer)
SRs.append(0)
weights.append(0)
SR, weight = self.SR(dec.pair, dec.result)
revID = self.reviewers.index(dec.reviewer)
SRs[revID] = SRs[revID] + SR
weights[revID] = weights[revID] + weight
WMSs = []
WMSDict = {}
for i in range(len(self.reviewers)):
WMS = SRs[i]/weights[i]
WMSs.append(WMS)
WMSDict[self.reviewers[i]]=WMS
return WMSDict, np.mean(WMSs), np.std(WMSs)
def comp(self, pair, result = True, update = None, reviewer = 'Unknown', time = 0):
'''Adds in a result between a and b where true is a wins and False is b wins'''
self.addDecision(pair, result, reviewer, time)
if pair[::-1] in self.roundList:
pair = pair[::-1]
result = not result
if pair in self.roundList:
self.returned[self.roundList.index(pair)] = True
a = pair[0]
b = pair[1]
if update == None:
update = self.update
iA = self.data.index(a)
iB = self.data.index(b)
if result:
self.track[iA,iB] = 1
self.track[iB,iA] = 0
else:
self.track[iA,iB] = 0
self.track[iB,iA] = 1
self.dat[2,iA] = np.sum(self.track[iA,:])
self.dat[2,iB] = np.sum(self.track[iB,:])
self.dat[4,iA] = self.dat[4][iA]+1
self.dat[4,iB] = self.dat[4][iB]+1
if self.logPath != None:
self.log(self.logPath, pair, result, reviewer, time)
def IDComp(self, idPair, result = True, update = None, reviewer = 'Unknown', time=0):
'''Adds in a result between a and b where true is a wins and False is b wins, Uses IDs'''
pair = []
for p in idPair:
pair.append(self.getScript(p))
self.comp(pair, result, update, reviewer, time)
def percentReturned(self):
if len(self.returned) == 0:
return 0
return (sum(self.returned)/len(self.returned))*100
def log(self, path, pair, result, reviewer = 'Unknown', time = 0):
'''Writes out a log of a comparison'''
timestamp = datetime.datetime.now().strftime('_%Y_%m_%d_%H_%M_%S_%f')
with open(path+os.sep+str(reviewer)+timestamp+".log", 'w+') as file:
file.write("Reviewer:%s\n" % str(reviewer))
file.write("A:%s\n" % str(pair[0]))
file.write("B:%s\n" % str(pair[1]))
file.write("Winner:%s\n" %("A" if result else "B"))
file.write("Time:%s\n" % str(time))
def JSONLog(self, path = None):
'''Writes out a JSON containing data from ACJ'''
if path == None:
path = self.logPath
choice = self.optionNames[0].replace(" ", "_")
ACJDict = {"Criteria":choice, "Scripts":self.scriptDict(), "Reviewers":self.reviewerDict(), "Decisions":self.decisionList()}
with open(path+os.sep+"ACJ_"+choice+".json", 'w+') as file:
json.dump(ACJDict, file, indent=4)
def decisionCount(self, reviewer):
c = 0
for dec in self.decisions:
if (dec.reviewer == reviewer):
c = c + 1
return c
def reviewerDict(self):
revs = {}
WMSs, _, _ = self.WMS()
for rev in self.reviewers:
revDict = {'decisions':self.decisionCount(rev), 'WMS':WMSs[rev]}
revs[str(rev)]= revDict
print(len(revs))
return revs
def scriptDict(self):
scr = {}
r = self.results()[0]
for i in range(len(r)):
scrDict = {"Score":r[i][1]}
scr[str(r[i][0])] = scrDict
return scr
def decisionList(self):
dec = []
for d in self.decisions:
dec.append(d.dict())
return dec
def rankings(self, value=True):
'''Returns current rankings
Default is by value but score can be used'''
if value:
return [np.asarray(self.data)[np.argsort(self.dat[3])], self.dat[3][np.argsort(self.dat[3])]]
else:
return self.data[np.argsort(self.dat[2])]
def results(self):
'''Prints a list of scripts and thier value scaled between 0 and 100'''
r = self.rankings()
rank = list(zip(r[0], (r[1]-r[1].min())*100/(r[1].max()-r[1].min())))
return [rank]
| mit | [
504,
636,
2443,
363,
492,
4629,
199,
646,
2196,
199,
646,
747,
199,
646,
2680,
465,
980,
199,
646,
5927,
199,
646,
2197,
199,
646,
2022,
199,
199,
533,
1487,
3688,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
4092,
12,
754,
12,
11248,
281,
12,
900,
304,
267,
291,
14,
3852,
275,
4092,
267,
291,
14,
1099,
275,
754,
267,
291,
14,
23492,
275,
11248,
281,
267,
291,
14,
521,
275,
900,
339,
347,
1211,
8,
277,
304,
267,
372,
791,
12882,
15211,
495,
8,
277,
14,
3852,
59,
16,
2522,
495,
8,
277,
14,
3852,
59,
17,
27520,
283,
2889,
356,
495,
8,
277,
14,
1099,
395,
283,
23492,
356,
495,
8,
277,
14,
23492,
395,
283,
521,
356,
495,
8,
277,
14,
521,
6769,
199,
199,
318,
6570,
42,
8,
576,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
275,
413,
12,
943,
2042,
275,
488,
12,
945,
5866,
275,
2097,
9054,
21473,
272,
340,
949,
3466,
30806,
665,
499,
26,
267,
372,
1910,
73,
1348,
42,
8,
576,
12,
1390,
18579,
83,
12,
943,
2042,
12,
945,
5866,
9,
272,
587,
26,
267,
372,
6879,
1348,
42,
8,
576,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
12,
943,
2042,
12,
945,
5866,
9,
199,
199,
533,
6879,
1348,
42,
8,
785,
304,
272,
1449,
40,
8250,
3663,
6570,
42,
2251,
367,
3879,
20448,
543,
3663,
3415,
14,
272,
710,
1642,
1819,
402,
314,
769,
402,
1066,
74,
2251,
18578,
4426,
402,
314,
1202,
6342,
10595,
272,
347,
636,
826,
721,
277,
12,
666,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
12,
943,
2042,
275,
488,
12,
945,
5866,
275,
488,
304,
267,
291,
14,
576,
275,
769,
8,
576,
9,
267,
291,
14,
78,
275,
822,
8,
576,
9,
267,
291,
14,
2363,
275,
378,
267,
291,
14,
2926,
275,
378,
267,
291,
14,
889,
3466,
30806,
275,
949,
3466,
30806,
267,
291,
14,
645,
3596,
275,
359,
1348,
42,
8,
576,
12,
1390,
18579,
83,
9,
367,
485,
315,
1425,
8,
889,
3466,
30806,
1874,
267,
291,
14,
793,
2042,
275,
943,
2042,
267,
340,
945,
5866,
508,
488,
26,
288,
291,
14,
1422,
5866,
275,
359,
495,
8,
73,
9,
367,
284,
315,
1425,
8,
889,
3466,
30806,
1874,
267,
587,
26,
288,
291,
14,
1422,
5866,
275,
945,
5866,
288,
291,
14,
2184,
18579,
342,
339,
347,
664,
5229,
8,
277,
12,
2870,
304,
267,
1449,
14426,
2884,
543,
2870,
2344,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
362,
5229,
8,
998,
9,
339,
347,
664,
998,
8,
277,
12,
2884,
304,
267,
1449,
14426,
2870,
402,
2884,
2344,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
362,
998,
8,
1579,
9,
339,
347,
2256,
12882,
83,
8,
277,
304,
267,
1449,
3407,
6342,
4079,
641,
3089,
3594,
7267,
6572,
687,
2165,
25787,
4431,
22430,
3599,
759,
857,
1603,
16603,
434,
267,
4376,
1051,
84,
8,
7409,
9,
435,
12377,
345,
983,
12,
593,
274,
65,
12,
510,
4654,
364,
65,
12,
436,
437,
4087,
334,
6542,
9,
2344,
267,
6342,
275,
942,
267,
327,
2499,
267,
308,
33,
275,
980,
14,
4250,
1332,
277,
14,
78,
12,
291,
14,
78,
430,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
308,
33,
275,
308,
33,
11,
645,
74,
14,
5592,
3836,
342,
267,
1830,
8,
1590,
14,
988,
8,
83,
33,
13032,
16,
304,
288,
284,
33,
12,
284,
34,
275,
980,
14,
324,
11186,
63,
1080,
8,
83,
33,
14,
16383,
1062,
308,
33,
14,
1392,
9,
288,
6342,
14,
740,
779,
277,
14,
576,
59,
73,
33,
467,
291,
14,
576,
59,
17587,
3934,
288,
308,
33,
59,
73,
33,
21063,
275,
378,
288,
308,
33,
59,
17587,
21063,
275,
378,
288,
308,
33,
3981,
73,
33,
61,
275,
378,
288,
308,
33,
3981,
17587,
61,
275,
378,
267,
372,
6342,
339,
347,
2163,
18579,
8,
277,
304,
267,
1449,
3407,
2163,
6168,
402,
6342,
2344,
267,
6168,
1296,
275,
291,
14,
815,
12882,
83,
342,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
1066,
74,
14,
2184,
18579,
8,
2363,
1296,
9,
288,
1066,
74,
14,
2926,
275,
378,
267,
291,
14,
2363,
275,
291,
14,
645,
3596,
59,
16,
1055,
2363,
267,
291,
14,
2926,
275,
291,
14,
645,
3596,
59,
16,
1055,
2926,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
2363,
1296,
339,
347,
2163,
12882,
8,
277,
304,
267,
1449,
24894,
2163,
4092,
687,
2446,
1066,
74,
2344,
267,
299,
275,
291,
14,
645,
3596,
59,
16,
1055,
2184,
12882,
8,
928,
5765,
29,
797,
9,
267,
340,
299,
508,
446,
17,
26,
288,
340,
291,
14,
2184,
18579,
342,
1137,
488,
26,
355,
299,
275,
291,
14,
645,
3596,
59,
16,
1055,
2184,
12882,
8,
928,
5765,
29,
797,
9,
288,
587,
26,
355,
372,
488,
267,
291,
14,
2926,
275,
291,
14,
645,
3596,
59,
16,
1055,
2926,
267,
372,
299,
339,
347,
2163,
998,
12882,
8,
277,
304,
267,
1449,
14426,
2870,
402,
2163,
4092,
2344,
267,
4092,
275,
291,
14,
2184,
12882,
342,
267,
340,
4092,
508,
488,
26,
288,
372,
488,
267,
1305,
12882,
275,
942,
267,
367,
299,
315,
4092,
26,
288,
1305,
12882,
14,
740,
8,
277,
14,
362,
998,
8,
80,
430,
267,
372,
1305,
12882,
339,
347,
644,
3053,
8,
277,
304,
267,
2203,
275,
942,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
2203,
14,
740,
8,
645,
74,
14,
55,
3053,
1012,
267,
372,
2203,
2378,
347,
1013,
8,
277,
12,
4092,
12,
754,
275,
488,
12,
1678,
275,
488,
12,
11248,
281,
275,
283,
5912,
297,
900,
275,
378,
304,
267,
1449,
14995,
315,
282,
754,
3382,
282,
436,
330,
2382,
2549,
365,
282,
29431,
436,
756,
365,
330,
29431,
2344,
267,
340,
754,
508,
488,
26,
288,
754,
275,
359,
549,
367,
485,
315,
1425,
8,
277,
14,
889,
3466,
30806,
1874,
267,
340,
291,
14,
889,
3466,
30806,
1137,
822,
8,
1099,
304,
288,
746,
29912,
360,
6579,
769,
4839,
370,
506,
949,
3466,
30806,
315,
2582,
358,
267
] | [
636,
2443,
363,
492,
4629,
199,
646,
2196,
199,
646,
747,
199,
646,
2680,
465,
980,
199,
646,
5927,
199,
646,
2197,
199,
646,
2022,
199,
199,
533,
1487,
3688,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
4092,
12,
754,
12,
11248,
281,
12,
900,
304,
267,
291,
14,
3852,
275,
4092,
267,
291,
14,
1099,
275,
754,
267,
291,
14,
23492,
275,
11248,
281,
267,
291,
14,
521,
275,
900,
339,
347,
1211,
8,
277,
304,
267,
372,
791,
12882,
15211,
495,
8,
277,
14,
3852,
59,
16,
2522,
495,
8,
277,
14,
3852,
59,
17,
27520,
283,
2889,
356,
495,
8,
277,
14,
1099,
395,
283,
23492,
356,
495,
8,
277,
14,
23492,
395,
283,
521,
356,
495,
8,
277,
14,
521,
6769,
199,
199,
318,
6570,
42,
8,
576,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
275,
413,
12,
943,
2042,
275,
488,
12,
945,
5866,
275,
2097,
9054,
21473,
272,
340,
949,
3466,
30806,
665,
499,
26,
267,
372,
1910,
73,
1348,
42,
8,
576,
12,
1390,
18579,
83,
12,
943,
2042,
12,
945,
5866,
9,
272,
587,
26,
267,
372,
6879,
1348,
42,
8,
576,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
12,
943,
2042,
12,
945,
5866,
9,
199,
199,
533,
6879,
1348,
42,
8,
785,
304,
272,
1449,
40,
8250,
3663,
6570,
42,
2251,
367,
3879,
20448,
543,
3663,
3415,
14,
272,
710,
1642,
1819,
402,
314,
769,
402,
1066,
74,
2251,
18578,
4426,
402,
314,
1202,
6342,
10595,
272,
347,
636,
826,
721,
277,
12,
666,
12,
1390,
18579,
83,
12,
949,
3466,
30806,
12,
943,
2042,
275,
488,
12,
945,
5866,
275,
488,
304,
267,
291,
14,
576,
275,
769,
8,
576,
9,
267,
291,
14,
78,
275,
822,
8,
576,
9,
267,
291,
14,
2363,
275,
378,
267,
291,
14,
2926,
275,
378,
267,
291,
14,
889,
3466,
30806,
275,
949,
3466,
30806,
267,
291,
14,
645,
3596,
275,
359,
1348,
42,
8,
576,
12,
1390,
18579,
83,
9,
367,
485,
315,
1425,
8,
889,
3466,
30806,
1874,
267,
291,
14,
793,
2042,
275,
943,
2042,
267,
340,
945,
5866,
508,
488,
26,
288,
291,
14,
1422,
5866,
275,
359,
495,
8,
73,
9,
367,
284,
315,
1425,
8,
889,
3466,
30806,
1874,
267,
587,
26,
288,
291,
14,
1422,
5866,
275,
945,
5866,
288,
291,
14,
2184,
18579,
342,
339,
347,
664,
5229,
8,
277,
12,
2870,
304,
267,
1449,
14426,
2884,
543,
2870,
2344,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
362,
5229,
8,
998,
9,
339,
347,
664,
998,
8,
277,
12,
2884,
304,
267,
1449,
14426,
2870,
402,
2884,
2344,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
362,
998,
8,
1579,
9,
339,
347,
2256,
12882,
83,
8,
277,
304,
267,
1449,
3407,
6342,
4079,
641,
3089,
3594,
7267,
6572,
687,
2165,
25787,
4431,
22430,
3599,
759,
857,
1603,
16603,
434,
267,
4376,
1051,
84,
8,
7409,
9,
435,
12377,
345,
983,
12,
593,
274,
65,
12,
510,
4654,
364,
65,
12,
436,
437,
4087,
334,
6542,
9,
2344,
267,
6342,
275,
942,
267,
327,
2499,
267,
308,
33,
275,
980,
14,
4250,
1332,
277,
14,
78,
12,
291,
14,
78,
430,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
308,
33,
275,
308,
33,
11,
645,
74,
14,
5592,
3836,
342,
267,
1830,
8,
1590,
14,
988,
8,
83,
33,
13032,
16,
304,
288,
284,
33,
12,
284,
34,
275,
980,
14,
324,
11186,
63,
1080,
8,
83,
33,
14,
16383,
1062,
308,
33,
14,
1392,
9,
288,
6342,
14,
740,
779,
277,
14,
576,
59,
73,
33,
467,
291,
14,
576,
59,
17587,
3934,
288,
308,
33,
59,
73,
33,
21063,
275,
378,
288,
308,
33,
59,
17587,
21063,
275,
378,
288,
308,
33,
3981,
73,
33,
61,
275,
378,
288,
308,
33,
3981,
17587,
61,
275,
378,
267,
372,
6342,
339,
347,
2163,
18579,
8,
277,
304,
267,
1449,
3407,
2163,
6168,
402,
6342,
2344,
267,
6168,
1296,
275,
291,
14,
815,
12882,
83,
342,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
1066,
74,
14,
2184,
18579,
8,
2363,
1296,
9,
288,
1066,
74,
14,
2926,
275,
378,
267,
291,
14,
2363,
275,
291,
14,
645,
3596,
59,
16,
1055,
2363,
267,
291,
14,
2926,
275,
291,
14,
645,
3596,
59,
16,
1055,
2926,
267,
372,
291,
14,
645,
3596,
59,
16,
1055,
2363,
1296,
339,
347,
2163,
12882,
8,
277,
304,
267,
1449,
24894,
2163,
4092,
687,
2446,
1066,
74,
2344,
267,
299,
275,
291,
14,
645,
3596,
59,
16,
1055,
2184,
12882,
8,
928,
5765,
29,
797,
9,
267,
340,
299,
508,
446,
17,
26,
288,
340,
291,
14,
2184,
18579,
342,
1137,
488,
26,
355,
299,
275,
291,
14,
645,
3596,
59,
16,
1055,
2184,
12882,
8,
928,
5765,
29,
797,
9,
288,
587,
26,
355,
372,
488,
267,
291,
14,
2926,
275,
291,
14,
645,
3596,
59,
16,
1055,
2926,
267,
372,
299,
339,
347,
2163,
998,
12882,
8,
277,
304,
267,
1449,
14426,
2870,
402,
2163,
4092,
2344,
267,
4092,
275,
291,
14,
2184,
12882,
342,
267,
340,
4092,
508,
488,
26,
288,
372,
488,
267,
1305,
12882,
275,
942,
267,
367,
299,
315,
4092,
26,
288,
1305,
12882,
14,
740,
8,
277,
14,
362,
998,
8,
80,
430,
267,
372,
1305,
12882,
339,
347,
644,
3053,
8,
277,
304,
267,
2203,
275,
942,
267,
367,
1066,
74,
315,
291,
14,
645,
3596,
26,
288,
2203,
14,
740,
8,
645,
74,
14,
55,
3053,
1012,
267,
372,
2203,
2378,
347,
1013,
8,
277,
12,
4092,
12,
754,
275,
488,
12,
1678,
275,
488,
12,
11248,
281,
275,
283,
5912,
297,
900,
275,
378,
304,
267,
1449,
14995,
315,
282,
754,
3382,
282,
436,
330,
2382,
2549,
365,
282,
29431,
436,
756,
365,
330,
29431,
2344,
267,
340,
754,
508,
488,
26,
288,
754,
275,
359,
549,
367,
485,
315,
1425,
8,
277,
14,
889,
3466,
30806,
1874,
267,
340,
291,
14,
889,
3466,
30806,
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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
] |
andmos/ansible | lib/ansible/modules/network/cloudengine/ce_snmp_traps.py | 25 | 19335 | #!/usr/bin/python
#
# 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/>.
#
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: ce_snmp_traps
version_added: "2.4"
short_description: Manages SNMP traps configuration on HUAWEI CloudEngine switches.
description:
- Manages SNMP traps configurations on HUAWEI CloudEngine switches.
author:
- wangdezhuang (@QijunPan)
options:
feature_name:
description:
- Alarm feature name.
choices: ['aaa', 'arp', 'bfd', 'bgp', 'cfg', 'configuration', 'dad', 'devm',
'dhcpsnp', 'dldp', 'driver', 'efm', 'erps', 'error-down', 'fcoe',
'fei', 'fei_comm', 'fm', 'ifnet', 'info', 'ipsg', 'ipv6', 'isis',
'l3vpn', 'lacp', 'lcs', 'ldm', 'ldp', 'ldt', 'lldp', 'mpls_lspm',
'msdp', 'mstp', 'nd', 'netconf', 'nqa', 'nvo3', 'openflow', 'ospf',
'ospfv3', 'pim', 'pim-std', 'qos', 'radius', 'rm', 'rmon', 'securitytrap',
'smlktrap', 'snmp', 'ssh', 'stackmng', 'sysclock', 'sysom', 'system',
'tcp', 'telnet', 'trill', 'trunk', 'tty', 'vbst', 'vfs', 'virtual-perception',
'vrrp', 'vstm', 'all']
trap_name:
description:
- Alarm trap name.
interface_type:
description:
- Interface type.
choices: ['Ethernet', 'Eth-Trunk', 'Tunnel', 'NULL', 'LoopBack', 'Vlanif', '100GE',
'40GE', 'MTunnel', '10GE', 'GE', 'MEth', 'Vbdif', 'Nve']
interface_number:
description:
- Interface number.
port_number:
description:
- Source port number.
'''
EXAMPLES = '''
- name: CloudEngine snmp traps test
hosts: cloudengine
connection: local
gather_facts: no
vars:
cli:
host: "{{ inventory_hostname }}"
port: "{{ ansible_ssh_port }}"
username: "{{ username }}"
password: "{{ password }}"
transport: cli
tasks:
- name: "Config SNMP trap all enable"
ce_snmp_traps:
state: present
feature_name: all
provider: "{{ cli }}"
- name: "Config SNMP trap interface"
ce_snmp_traps:
state: present
interface_type: 40GE
interface_number: 2/0/1
provider: "{{ cli }}"
- name: "Config SNMP trap port"
ce_snmp_traps:
state: present
port_number: 2222
provider: "{{ cli }}"
'''
RETURN = '''
changed:
description: check to see if a change was made on the device
returned: always
type: bool
sample: true
proposed:
description: k/v pairs of parameters passed into module
returned: always
type: dict
sample: {"feature_name": "all",
"state": "present"}
existing:
description: k/v pairs of existing aaa server
returned: always
type: dict
sample: {"snmp-agent trap": [],
"undo snmp-agent trap": []}
end_state:
description: k/v pairs of aaa params after module execution
returned: always
type: dict
sample: {"snmp-agent trap": ["enable"],
"undo snmp-agent trap": []}
updates:
description: command sent to the device
returned: always
type: list
sample: ["snmp-agent trap enable"]
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.cloudengine.ce import get_config, load_config, ce_argument_spec, run_commands
class SnmpTraps(object):
""" Manages SNMP trap configuration """
def __init__(self, **kwargs):
""" Class init """
# module
argument_spec = kwargs["argument_spec"]
self.spec = argument_spec
self.module = AnsibleModule(
argument_spec=self.spec,
required_together=[("interface_type", "interface_number")],
supports_check_mode=True
)
# config
self.cur_cfg = dict()
self.cur_cfg["snmp-agent trap"] = []
self.cur_cfg["undo snmp-agent trap"] = []
# module args
self.state = self.module.params['state']
self.feature_name = self.module.params['feature_name']
self.trap_name = self.module.params['trap_name']
self.interface_type = self.module.params['interface_type']
self.interface_number = self.module.params['interface_number']
self.port_number = self.module.params['port_number']
# state
self.changed = False
self.updates_cmd = list()
self.results = dict()
self.proposed = dict()
self.existing = dict()
self.existing["snmp-agent trap"] = []
self.existing["undo snmp-agent trap"] = []
self.end_state = dict()
self.end_state["snmp-agent trap"] = []
self.end_state["undo snmp-agent trap"] = []
commands = list()
cmd1 = 'display interface brief'
commands.append(cmd1)
self.interface = run_commands(self.module, commands)
def check_args(self):
""" Check invalid args """
if self.port_number:
if self.port_number.isdigit():
if int(self.port_number) < 1025 or int(self.port_number) > 65535:
self.module.fail_json(
msg='Error: The value of port_number is out of [1025 - 65535].')
else:
self.module.fail_json(
msg='Error: The port_number is not digit.')
if self.interface_type and self.interface_number:
tmp_interface = self.interface_type + self.interface_number
if tmp_interface not in self.interface[0]:
self.module.fail_json(
msg='Error: The interface %s is not in the device.' % tmp_interface)
def get_proposed(self):
""" Get proposed state """
self.proposed["state"] = self.state
if self.feature_name:
self.proposed["feature_name"] = self.feature_name
if self.trap_name:
self.proposed["trap_name"] = self.trap_name
if self.interface_type:
self.proposed["interface_type"] = self.interface_type
if self.interface_number:
self.proposed["interface_number"] = self.interface_number
if self.port_number:
self.proposed["port_number"] = self.port_number
def get_existing(self):
""" Get existing state """
tmp_cfg = self.cli_get_config()
if tmp_cfg:
temp_cfg_lower = tmp_cfg.lower()
temp_data = tmp_cfg.split("\n")
temp_data_lower = temp_cfg_lower.split("\n")
for item in temp_data:
if "snmp-agent trap source-port " in item:
if self.port_number:
item_tmp = item.split("snmp-agent trap source-port ")
self.cur_cfg["trap source-port"] = item_tmp[1]
self.existing["trap source-port"] = item_tmp[1]
elif "snmp-agent trap source " in item:
if self.interface_type:
item_tmp = item.split("snmp-agent trap source ")
self.cur_cfg["trap source interface"] = item_tmp[1]
self.existing["trap source interface"] = item_tmp[1]
if self.feature_name:
for item in temp_data_lower:
if item == "snmp-agent trap enable":
self.cur_cfg["snmp-agent trap"].append("enable")
self.existing["snmp-agent trap"].append("enable")
elif item == "snmp-agent trap disable":
self.cur_cfg["snmp-agent trap"].append("disable")
self.existing["snmp-agent trap"].append("disable")
elif "undo snmp-agent trap enable " in item:
item_tmp = item.split("undo snmp-agent trap enable ")
self.cur_cfg[
"undo snmp-agent trap"].append(item_tmp[1])
self.existing[
"undo snmp-agent trap"].append(item_tmp[1])
elif "snmp-agent trap enable " in item:
item_tmp = item.split("snmp-agent trap enable ")
self.cur_cfg["snmp-agent trap"].append(item_tmp[1])
self.existing["snmp-agent trap"].append(item_tmp[1])
else:
del self.existing["snmp-agent trap"]
del self.existing["undo snmp-agent trap"]
def get_end_state(self):
""" Get end_state state """
tmp_cfg = self.cli_get_config()
if tmp_cfg:
temp_cfg_lower = tmp_cfg.lower()
temp_data = tmp_cfg.split("\n")
temp_data_lower = temp_cfg_lower.split("\n")
for item in temp_data:
if "snmp-agent trap source-port " in item:
if self.port_number:
item_tmp = item.split("snmp-agent trap source-port ")
self.end_state["trap source-port"] = item_tmp[1]
elif "snmp-agent trap source " in item:
if self.interface_type:
item_tmp = item.split("snmp-agent trap source ")
self.end_state["trap source interface"] = item_tmp[1]
if self.feature_name:
for item in temp_data_lower:
if item == "snmp-agent trap enable":
self.end_state["snmp-agent trap"].append("enable")
elif item == "snmp-agent trap disable":
self.end_state["snmp-agent trap"].append("disable")
elif "undo snmp-agent trap enable " in item:
item_tmp = item.split("undo snmp-agent trap enable ")
self.end_state[
"undo snmp-agent trap"].append(item_tmp[1])
elif "snmp-agent trap enable " in item:
item_tmp = item.split("snmp-agent trap enable ")
self.end_state["snmp-agent trap"].append(item_tmp[1])
else:
del self.end_state["snmp-agent trap"]
del self.end_state["undo snmp-agent trap"]
def cli_load_config(self, commands):
""" Load configure through cli """
if not self.module.check_mode:
load_config(self.module, commands)
def cli_get_config(self):
""" Get configure through cli """
regular = "| include snmp | include trap"
flags = list()
flags.append(regular)
tmp_cfg = get_config(self.module, flags)
return tmp_cfg
def set_trap_feature_name(self):
""" Set feature name for trap """
if self.feature_name == "all":
cmd = "snmp-agent trap enable"
else:
cmd = "snmp-agent trap enable feature-name %s" % self.feature_name
if self.trap_name:
cmd += " trap-name %s" % self.trap_name
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def undo_trap_feature_name(self):
""" Undo feature name for trap """
if self.feature_name == "all":
cmd = "undo snmp-agent trap enable"
else:
cmd = "undo snmp-agent trap enable feature-name %s" % self.feature_name
if self.trap_name:
cmd += " trap-name %s" % self.trap_name
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def set_trap_source_interface(self):
""" Set source interface for trap """
cmd = "snmp-agent trap source %s %s" % (
self.interface_type, self.interface_number)
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def undo_trap_source_interface(self):
""" Undo source interface for trap """
cmd = "undo snmp-agent trap source"
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def set_trap_source_port(self):
""" Set source port for trap """
cmd = "snmp-agent trap source-port %s" % self.port_number
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def undo_trap_source_port(self):
""" Undo source port for trap """
cmd = "undo snmp-agent trap source-port"
self.updates_cmd.append(cmd)
cmds = list()
cmds.append(cmd)
self.cli_load_config(cmds)
self.changed = True
def work(self):
""" The work function """
self.check_args()
self.get_proposed()
self.get_existing()
find_flag = False
find_undo_flag = False
tmp_interface = None
if self.state == "present":
if self.feature_name:
if self.trap_name:
tmp_cfg = "feature-name %s trap-name %s" % (
self.feature_name, self.trap_name.lower())
else:
tmp_cfg = "feature-name %s" % self.feature_name
find_undo_flag = False
if self.cur_cfg["undo snmp-agent trap"]:
for item in self.cur_cfg["undo snmp-agent trap"]:
if item == tmp_cfg:
find_undo_flag = True
elif tmp_cfg in item:
find_undo_flag = True
elif self.feature_name == "all":
find_undo_flag = True
if find_undo_flag:
self.set_trap_feature_name()
if not find_undo_flag:
find_flag = False
if self.cur_cfg["snmp-agent trap"]:
for item in self.cur_cfg["snmp-agent trap"]:
if item == "enable":
find_flag = True
elif item == tmp_cfg:
find_flag = True
if not find_flag:
self.set_trap_feature_name()
if self.interface_type:
find_flag = False
tmp_interface = self.interface_type + self.interface_number
if "trap source interface" in self.cur_cfg.keys():
if self.cur_cfg["trap source interface"] == tmp_interface:
find_flag = True
if not find_flag:
self.set_trap_source_interface()
if self.port_number:
find_flag = False
if "trap source-port" in self.cur_cfg.keys():
if self.cur_cfg["trap source-port"] == self.port_number:
find_flag = True
if not find_flag:
self.set_trap_source_port()
else:
if self.feature_name:
if self.trap_name:
tmp_cfg = "feature-name %s trap-name %s" % (
self.feature_name, self.trap_name.lower())
else:
tmp_cfg = "feature-name %s" % self.feature_name
find_flag = False
if self.cur_cfg["snmp-agent trap"]:
for item in self.cur_cfg["snmp-agent trap"]:
if item == tmp_cfg:
find_flag = True
elif item == "enable":
find_flag = True
elif tmp_cfg in item:
find_flag = True
else:
find_flag = True
find_undo_flag = False
if self.cur_cfg["undo snmp-agent trap"]:
for item in self.cur_cfg["undo snmp-agent trap"]:
if item == tmp_cfg:
find_undo_flag = True
elif tmp_cfg in item:
find_undo_flag = True
if find_undo_flag:
pass
elif find_flag:
self.undo_trap_feature_name()
if self.interface_type:
if "trap source interface" in self.cur_cfg.keys():
self.undo_trap_source_interface()
if self.port_number:
if "trap source-port" in self.cur_cfg.keys():
self.undo_trap_source_port()
self.get_end_state()
self.results['changed'] = self.changed
self.results['proposed'] = self.proposed
self.results['existing'] = self.existing
self.results['end_state'] = self.end_state
self.results['updates'] = self.updates_cmd
self.module.exit_json(**self.results)
def main():
""" Module main """
argument_spec = dict(
state=dict(choices=['present', 'absent'], default='present'),
feature_name=dict(choices=['aaa', 'arp', 'bfd', 'bgp', 'cfg', 'configuration', 'dad',
'devm', 'dhcpsnp', 'dldp', 'driver', 'efm', 'erps', 'error-down',
'fcoe', 'fei', 'fei_comm', 'fm', 'ifnet', 'info', 'ipsg', 'ipv6',
'isis', 'l3vpn', 'lacp', 'lcs', 'ldm', 'ldp', 'ldt', 'lldp',
'mpls_lspm', 'msdp', 'mstp', 'nd', 'netconf', 'nqa', 'nvo3',
'openflow', 'ospf', 'ospfv3', 'pim', 'pim-std', 'qos', 'radius',
'rm', 'rmon', 'securitytrap', 'smlktrap', 'snmp', 'ssh', 'stackmng',
'sysclock', 'sysom', 'system', 'tcp', 'telnet', 'trill', 'trunk',
'tty', 'vbst', 'vfs', 'virtual-perception', 'vrrp', 'vstm', 'all']),
trap_name=dict(type='str'),
interface_type=dict(choices=['Ethernet', 'Eth-Trunk', 'Tunnel', 'NULL', 'LoopBack', 'Vlanif',
'100GE', '40GE', 'MTunnel', '10GE', 'GE', 'MEth', 'Vbdif', 'Nve']),
interface_number=dict(type='str'),
port_number=dict(type='str')
)
argument_spec.update(ce_argument_spec)
module = SnmpTraps(argument_spec=argument_spec)
module.work()
if __name__ == '__main__':
main()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1548,
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,
3,
199,
199,
8490,
63,
8314,
275,
791,
2343,
63,
1023,
356,
283,
17,
14,
17,
297,
490,
283,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
936,
199,
199,
8948,
275,
1449,
199,
2595,
199,
578,
26,
10142,
63,
15523,
63,
1239,
1190,
199,
1023,
63,
3270,
26,
298,
18,
14,
20,
2,
199,
3612,
63,
1802,
26,
21612,
26549,
1468,
1190,
2897,
641,
869,
21659,
5408,
41,
8142,
8524,
24563,
14,
199,
1802,
26,
272,
446,
21612,
26549,
1468,
1190,
13422,
641,
869,
21659,
5408,
41,
8142,
8524,
24563,
14,
199,
2502,
26,
272,
446,
336,
621,
271,
3951,
85,
621,
8593,
49,
7879,
324,
19266,
9,
199,
1419,
26,
272,
3878,
63,
354,
26,
267,
1369,
26,
288,
446,
4580,
5362,
3878,
536,
14,
267,
3415,
26,
788,
11629,
297,
283,
12868,
297,
283,
21090,
297,
283,
10132,
297,
283,
4128,
297,
283,
4758,
297,
283,
25805,
297,
283,
2374,
77,
297,
326,
283,
7821,
67,
1190,
1590,
297,
283,
68,
17288,
297,
283,
3090,
297,
283,
2829,
77,
297,
283,
281,
1190,
297,
283,
705,
13,
2110,
297,
283,
70,
331,
69,
297,
326,
283,
771,
73,
297,
283,
771,
73,
63,
1404,
297,
283,
10886,
297,
283,
692,
846,
297,
283,
815,
297,
283,
711,
1226,
297,
283,
4774,
22,
297,
283,
9200,
297,
355,
283,
76,
19,
9702,
297,
283,
416,
1850,
297,
283,
76,
1259,
297,
283,
1447,
77,
297,
283,
17288,
297,
283,
1447,
84,
297,
283,
24319,
297,
283,
311,
478,
63,
478,
7073,
297,
355,
283,
706,
5780,
297,
283,
77,
20643,
297,
283,
977,
297,
283,
18242,
297,
283,
78,
7096,
297,
283,
78,
2392,
19,
297,
283,
1490,
1659,
297,
283,
18303,
297,
355,
283,
18303,
86,
19,
297,
283,
80,
1017,
297,
283,
80,
1017,
13,
1516,
297,
283,
12282,
297,
283,
8017,
297,
283,
5682,
297,
283,
82,
2106,
297,
283,
4416,
19510,
297,
355,
283,
83,
757,
75,
19510,
297,
283,
15523,
297,
283,
5510,
297,
283,
2340,
77,
2753,
297,
283,
1786,
551,
831,
297,
283,
1274,
676,
297,
283,
2253,
297,
355,
283,
8815,
297,
283,
31085,
297,
283,
599,
914,
297,
283,
13409,
297,
283,
4707,
297,
283,
18708,
270,
297,
283,
20970,
297,
283,
2065,
13,
529,
814,
297,
355,
283,
10922,
4599,
297,
283,
86,
270,
77,
297,
283,
452,
418,
272,
22514,
63,
354,
26,
267,
1369,
26,
288,
446,
4580,
5362,
22514,
536,
14,
272,
3217,
63,
466,
26,
267,
1369,
26,
288,
446,
14816,
730,
14,
267,
3415,
26,
788,
22056,
297,
283,
37,
273,
13,
20460,
75,
297,
283,
22664,
2715,
297,
283,
8084,
297,
283,
7382,
4540,
297,
283,
22657,
692,
297,
283,
1960,
4962,
297,
326,
283,
2167,
4962,
297,
283,
5747,
324,
2715,
297,
283,
709,
4962,
297,
283,
4962,
297,
283,
3635,
273,
297,
283,
54,
66,
7330,
297,
283,
46,
432,
418,
272,
3217,
63,
1955,
26,
267,
1369,
26,
288,
446,
14816,
1329,
14,
272,
1844,
63,
1955,
26,
267,
1369,
26,
288,
446,
5800,
1844,
1329,
14,
199,
2344,
199,
199,
8918,
275,
1449,
199,
199,
13,
536,
26,
8142,
8524,
20143,
1468,
1190,
511,
523,
7057,
26,
2463,
85,
848,
2598,
523,
1950,
26,
2257,
523,
13082,
63,
5047,
26,
949,
523,
6802,
26,
272,
5053,
26,
489,
1591,
26,
7370,
8200,
63,
4269,
7820,
489,
1844,
26,
7370,
3242,
63,
5510,
63,
719,
7820,
489,
3434,
26,
7370,
3434,
7820,
489,
2505,
26,
7370,
2505,
7820,
489,
7773,
26,
5053,
819,
6527,
26,
819,
446,
536,
26,
298,
2028,
26549,
22514,
1006,
4756,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
3878,
63,
354,
26,
1006,
489,
5022,
26,
7370,
5053,
7820,
819,
446,
536,
26,
298,
2028,
26549,
22514,
3217,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
3217,
63,
466,
26,
6335,
4962,
489,
3217,
63,
1955,
26,
499,
15,
16,
15,
17,
489,
5022,
26,
7370,
5053,
7820,
819,
446,
536,
26,
298,
2028,
26549,
22514,
1844,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
1844,
63,
1955,
26,
499,
9485,
489,
5022,
26,
7370,
5053,
7820,
199,
2344,
199,
199,
9677,
275,
1449,
199,
2489,
26,
272,
1369,
26,
1104,
370,
1937,
340,
282,
1570,
1990,
6326,
641,
314,
2243,
272,
2138,
26,
3544,
272,
730,
26,
2155,
272,
2690,
26,
2549,
199,
15676,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
2633,
3032,
1901,
859,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
4445,
63,
354,
582,
298,
452,
401,
1467,
298,
929,
582,
298,
1881,
3570,
199,
5952,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
3411,
32396,
1654,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
15523,
13,
4054,
22514,
582,
990,
1467,
298,
11833,
20143,
13,
4054,
22514,
582,
23455,
199,
500,
63,
929,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
32396,
1862,
2410,
859,
6451,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
15523,
13,
4054,
22514,
582
] | [
2647,
15,
1393,
15,
1548,
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,
3,
199,
199,
8490,
63,
8314,
275,
791,
2343,
63,
1023,
356,
283,
17,
14,
17,
297,
490,
283,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
936,
199,
199,
8948,
275,
1449,
199,
2595,
199,
578,
26,
10142,
63,
15523,
63,
1239,
1190,
199,
1023,
63,
3270,
26,
298,
18,
14,
20,
2,
199,
3612,
63,
1802,
26,
21612,
26549,
1468,
1190,
2897,
641,
869,
21659,
5408,
41,
8142,
8524,
24563,
14,
199,
1802,
26,
272,
446,
21612,
26549,
1468,
1190,
13422,
641,
869,
21659,
5408,
41,
8142,
8524,
24563,
14,
199,
2502,
26,
272,
446,
336,
621,
271,
3951,
85,
621,
8593,
49,
7879,
324,
19266,
9,
199,
1419,
26,
272,
3878,
63,
354,
26,
267,
1369,
26,
288,
446,
4580,
5362,
3878,
536,
14,
267,
3415,
26,
788,
11629,
297,
283,
12868,
297,
283,
21090,
297,
283,
10132,
297,
283,
4128,
297,
283,
4758,
297,
283,
25805,
297,
283,
2374,
77,
297,
326,
283,
7821,
67,
1190,
1590,
297,
283,
68,
17288,
297,
283,
3090,
297,
283,
2829,
77,
297,
283,
281,
1190,
297,
283,
705,
13,
2110,
297,
283,
70,
331,
69,
297,
326,
283,
771,
73,
297,
283,
771,
73,
63,
1404,
297,
283,
10886,
297,
283,
692,
846,
297,
283,
815,
297,
283,
711,
1226,
297,
283,
4774,
22,
297,
283,
9200,
297,
355,
283,
76,
19,
9702,
297,
283,
416,
1850,
297,
283,
76,
1259,
297,
283,
1447,
77,
297,
283,
17288,
297,
283,
1447,
84,
297,
283,
24319,
297,
283,
311,
478,
63,
478,
7073,
297,
355,
283,
706,
5780,
297,
283,
77,
20643,
297,
283,
977,
297,
283,
18242,
297,
283,
78,
7096,
297,
283,
78,
2392,
19,
297,
283,
1490,
1659,
297,
283,
18303,
297,
355,
283,
18303,
86,
19,
297,
283,
80,
1017,
297,
283,
80,
1017,
13,
1516,
297,
283,
12282,
297,
283,
8017,
297,
283,
5682,
297,
283,
82,
2106,
297,
283,
4416,
19510,
297,
355,
283,
83,
757,
75,
19510,
297,
283,
15523,
297,
283,
5510,
297,
283,
2340,
77,
2753,
297,
283,
1786,
551,
831,
297,
283,
1274,
676,
297,
283,
2253,
297,
355,
283,
8815,
297,
283,
31085,
297,
283,
599,
914,
297,
283,
13409,
297,
283,
4707,
297,
283,
18708,
270,
297,
283,
20970,
297,
283,
2065,
13,
529,
814,
297,
355,
283,
10922,
4599,
297,
283,
86,
270,
77,
297,
283,
452,
418,
272,
22514,
63,
354,
26,
267,
1369,
26,
288,
446,
4580,
5362,
22514,
536,
14,
272,
3217,
63,
466,
26,
267,
1369,
26,
288,
446,
14816,
730,
14,
267,
3415,
26,
788,
22056,
297,
283,
37,
273,
13,
20460,
75,
297,
283,
22664,
2715,
297,
283,
8084,
297,
283,
7382,
4540,
297,
283,
22657,
692,
297,
283,
1960,
4962,
297,
326,
283,
2167,
4962,
297,
283,
5747,
324,
2715,
297,
283,
709,
4962,
297,
283,
4962,
297,
283,
3635,
273,
297,
283,
54,
66,
7330,
297,
283,
46,
432,
418,
272,
3217,
63,
1955,
26,
267,
1369,
26,
288,
446,
14816,
1329,
14,
272,
1844,
63,
1955,
26,
267,
1369,
26,
288,
446,
5800,
1844,
1329,
14,
199,
2344,
199,
199,
8918,
275,
1449,
199,
199,
13,
536,
26,
8142,
8524,
20143,
1468,
1190,
511,
523,
7057,
26,
2463,
85,
848,
2598,
523,
1950,
26,
2257,
523,
13082,
63,
5047,
26,
949,
523,
6802,
26,
272,
5053,
26,
489,
1591,
26,
7370,
8200,
63,
4269,
7820,
489,
1844,
26,
7370,
3242,
63,
5510,
63,
719,
7820,
489,
3434,
26,
7370,
3434,
7820,
489,
2505,
26,
7370,
2505,
7820,
489,
7773,
26,
5053,
819,
6527,
26,
819,
446,
536,
26,
298,
2028,
26549,
22514,
1006,
4756,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
3878,
63,
354,
26,
1006,
489,
5022,
26,
7370,
5053,
7820,
819,
446,
536,
26,
298,
2028,
26549,
22514,
3217,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
3217,
63,
466,
26,
6335,
4962,
489,
3217,
63,
1955,
26,
499,
15,
16,
15,
17,
489,
5022,
26,
7370,
5053,
7820,
819,
446,
536,
26,
298,
2028,
26549,
22514,
1844,
2,
272,
10142,
63,
15523,
63,
1239,
1190,
26,
489,
1174,
26,
3451,
489,
1844,
63,
1955,
26,
499,
9485,
489,
5022,
26,
7370,
5053,
7820,
199,
2344,
199,
199,
9677,
275,
1449,
199,
2489,
26,
272,
1369,
26,
1104,
370,
1937,
340,
282,
1570,
1990,
6326,
641,
314,
2243,
272,
2138,
26,
3544,
272,
730,
26,
2155,
272,
2690,
26,
2549,
199,
15676,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
2633,
3032,
1901,
859,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
4445,
63,
354,
582,
298,
452,
401,
1467,
298,
929,
582,
298,
1881,
3570,
199,
5952,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
3411,
32396,
1654,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
15523,
13,
4054,
22514,
582,
990,
1467,
298,
11833,
20143,
13,
4054,
22514,
582,
23455,
199,
500,
63,
929,
26,
272,
1369,
26,
1022,
15,
86,
6342,
402,
32396,
1862,
2410,
859,
6451,
272,
2138,
26,
3544,
272,
730,
26,
1211,
272,
2690,
26,
2420,
15523,
13,
4054,
22514,
582,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
memtoko/django | django/db/migrations/loader.py | 56 | 15911 | from __future__ import unicode_literals
import os
import sys
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.db.migrations.graph import MigrationGraph, NodeNotFoundError
from django.db.migrations.recorder import MigrationRecorder
from django.utils import six
MIGRATIONS_MODULE_NAME = 'migrations'
class MigrationLoader(object):
"""
Loads migration files from disk, and their status from the database.
Migration files are expected to live in the "migrations" directory of
an app. Their names are entirely unimportant from a code perspective,
but will probably follow the 1234_name.py convention.
On initialization, this class will scan those directories, and open and
read the python files, looking for a class called Migration, which should
inherit from django.db.migrations.Migration. See
django.db.migrations.migration for what that looks like.
Some migrations will be marked as "replacing" another set of migrations.
These are loaded into a separate set of migrations away from the main ones.
If all the migrations they replace are either unapplied or missing from
disk, then they are injected into the main set, replacing the named migrations.
Any dependency pointers to the replaced migrations are re-pointed to the
new migration.
This does mean that this class MUST also talk to the database as well as
to disk, but this is probably fine. We're already not just operating
in memory.
"""
def __init__(self, connection, load=True, ignore_no_migrations=False):
self.connection = connection
self.disk_migrations = None
self.applied_migrations = None
self.ignore_no_migrations = ignore_no_migrations
if load:
self.build_graph()
@classmethod
def migrations_module(cls, app_label):
if app_label in settings.MIGRATION_MODULES:
return settings.MIGRATION_MODULES[app_label]
else:
app_package_name = apps.get_app_config(app_label).name
return '%s.%s' % (app_package_name, MIGRATIONS_MODULE_NAME)
def load_disk(self):
"""
Loads the migrations from all INSTALLED_APPS from disk.
"""
self.disk_migrations = {}
self.unmigrated_apps = set()
self.migrated_apps = set()
for app_config in apps.get_app_configs():
# Get the migrations module directory
module_name = self.migrations_module(app_config.label)
was_loaded = module_name in sys.modules
try:
module = import_module(module_name)
except ImportError as e:
# I hate doing this, but I don't want to squash other import errors.
# Might be better to try a directory check directly.
if "No module named" in str(e) and MIGRATIONS_MODULE_NAME in str(e):
self.unmigrated_apps.add(app_config.label)
continue
raise
else:
# PY3 will happily import empty dirs as namespaces.
if not hasattr(module, '__file__'):
continue
# Module is not a package (e.g. migrations.py).
if not hasattr(module, '__path__'):
continue
# Force a reload if it's already loaded (tests need this)
if was_loaded:
six.moves.reload_module(module)
self.migrated_apps.add(app_config.label)
directory = os.path.dirname(module.__file__)
# Scan for .py files
migration_names = set()
for name in os.listdir(directory):
if name.endswith(".py"):
import_name = name.rsplit(".", 1)[0]
if import_name[0] not in "_.~":
migration_names.add(import_name)
# Load them
south_style_migrations = False
for migration_name in migration_names:
try:
migration_module = import_module("%s.%s" % (module_name, migration_name))
except ImportError as e:
# Ignore South import errors, as we're triggering them
if "south" in str(e).lower():
south_style_migrations = True
break
raise
if not hasattr(migration_module, "Migration"):
raise BadMigrationError(
"Migration %s in app %s has no Migration class" % (migration_name, app_config.label)
)
# Ignore South-style migrations
if hasattr(migration_module.Migration, "forwards"):
south_style_migrations = True
break
self.disk_migrations[app_config.label, migration_name] = migration_module.Migration(migration_name, app_config.label)
if south_style_migrations:
self.unmigrated_apps.add(app_config.label)
def get_migration(self, app_label, name_prefix):
"Gets the migration exactly named, or raises `graph.NodeNotFoundError`"
return self.graph.nodes[app_label, name_prefix]
def get_migration_by_prefix(self, app_label, name_prefix):
"Returns the migration(s) which match the given app label and name _prefix_"
# Do the search
results = []
for l, n in self.disk_migrations:
if l == app_label and n.startswith(name_prefix):
results.append((l, n))
if len(results) > 1:
raise AmbiguityError(
"There is more than one migration for '%s' with the prefix '%s'" % (app_label, name_prefix)
)
elif len(results) == 0:
raise KeyError("There no migrations for '%s' with the prefix '%s'" % (app_label, name_prefix))
else:
return self.disk_migrations[results[0]]
def check_key(self, key, current_app):
if (key[1] != "__first__" and key[1] != "__latest__") or key in self.graph:
return key
# Special-case __first__, which means "the first migration" for
# migrated apps, and is ignored for unmigrated apps. It allows
# makemigrations to declare dependencies on apps before they even have
# migrations.
if key[0] == current_app:
# Ignore __first__ references to the same app (#22325)
return
if key[0] in self.unmigrated_apps:
# This app isn't migrated, but something depends on it.
# The models will get auto-added into the state, though
# so we're fine.
return
if key[0] in self.migrated_apps:
try:
if key[1] == "__first__":
return list(self.graph.root_nodes(key[0]))[0]
else: # "__latest__"
return list(self.graph.leaf_nodes(key[0]))[0]
except IndexError:
if self.ignore_no_migrations:
return None
else:
raise ValueError("Dependency on app with no migrations: %s" % key[0])
raise ValueError("Dependency on unknown app: %s" % key[0])
def build_graph(self):
"""
Builds a migration dependency graph using both the disk and database.
You'll need to rebuild the graph if you apply migrations. This isn't
usually a problem as generally migration stuff runs in a one-shot process.
"""
# Load disk data
self.load_disk()
# Load database data
if self.connection is None:
self.applied_migrations = set()
else:
recorder = MigrationRecorder(self.connection)
self.applied_migrations = recorder.applied_migrations()
# Do a first pass to separate out replacing and non-replacing migrations
normal = {}
replacing = {}
for key, migration in self.disk_migrations.items():
if migration.replaces:
replacing[key] = migration
else:
normal[key] = migration
# Calculate reverse dependencies - i.e., for each migration, what depends on it?
# This is just for dependency re-pointing when applying replacements,
# so we ignore run_before here.
reverse_dependencies = {}
for key, migration in normal.items():
for parent in migration.dependencies:
reverse_dependencies.setdefault(parent, set()).add(key)
# Remember the possible replacements to generate more meaningful error
# messages
reverse_replacements = {}
for key, migration in replacing.items():
for replaced in migration.replaces:
reverse_replacements.setdefault(replaced, set()).add(key)
# Carry out replacements if we can - that is, if all replaced migrations
# are either unapplied or missing.
for key, migration in replacing.items():
# Ensure this replacement migration is not in applied_migrations
self.applied_migrations.discard(key)
# Do the check. We can replace if all our replace targets are
# applied, or if all of them are unapplied.
applied_statuses = [(target in self.applied_migrations) for target in migration.replaces]
can_replace = all(applied_statuses) or (not any(applied_statuses))
if not can_replace:
continue
# Alright, time to replace. Step through the replaced migrations
# and remove, repointing dependencies if needs be.
for replaced in migration.replaces:
if replaced in normal:
# We don't care if the replaced migration doesn't exist;
# the usage pattern here is to delete things after a while.
del normal[replaced]
for child_key in reverse_dependencies.get(replaced, set()):
if child_key in migration.replaces:
continue
# child_key may appear in a replacement
if child_key in reverse_replacements:
for replaced_child_key in reverse_replacements[child_key]:
if replaced in replacing[replaced_child_key].dependencies:
replacing[replaced_child_key].dependencies.remove(replaced)
replacing[replaced_child_key].dependencies.append(key)
else:
normal[child_key].dependencies.remove(replaced)
normal[child_key].dependencies.append(key)
normal[key] = migration
# Mark the replacement as applied if all its replaced ones are
if all(applied_statuses):
self.applied_migrations.add(key)
# Finally, make a graph and load everything into it
self.graph = MigrationGraph()
for key, migration in normal.items():
self.graph.add_node(key, migration)
def _reraise_missing_dependency(migration, missing, exc):
"""
Checks if ``missing`` could have been replaced by any squash
migration but wasn't because the the squash migration was partially
applied before. In that case raise a more understandable exception.
#23556
"""
if missing in reverse_replacements:
candidates = reverse_replacements.get(missing, set())
is_replaced = any(candidate in self.graph.nodes for candidate in candidates)
if not is_replaced:
tries = ', '.join('%s.%s' % c for c in candidates)
exc_value = NodeNotFoundError(
"Migration {0} depends on nonexistent node ('{1}', '{2}'). "
"Django tried to replace migration {1}.{2} with any of [{3}] "
"but wasn't able to because some of the replaced migrations "
"are already applied.".format(
migration, missing[0], missing[1], tries
),
missing)
exc_value.__cause__ = exc
six.reraise(NodeNotFoundError, exc_value, sys.exc_info()[2])
raise exc
# Add all internal dependencies first to ensure __first__ dependencies
# find the correct root node.
for key, migration in normal.items():
for parent in migration.dependencies:
if parent[0] != key[0] or parent[1] == '__first__':
# Ignore __first__ references to the same app (#22325)
continue
try:
self.graph.add_dependency(migration, key, parent)
except NodeNotFoundError as e:
# Since we added "key" to the nodes before this implies
# "parent" is not in there. To make the raised exception
# more understandable we check if parent could have been
# replaced but hasn't (eg partially applied squashed
# migration)
_reraise_missing_dependency(migration, parent, e)
for key, migration in normal.items():
for parent in migration.dependencies:
if parent[0] == key[0]:
# Internal dependencies already added.
continue
parent = self.check_key(parent, key[0])
if parent is not None:
try:
self.graph.add_dependency(migration, key, parent)
except NodeNotFoundError as e:
# Since we added "key" to the nodes before this implies
# "parent" is not in there.
_reraise_missing_dependency(migration, parent, e)
for child in migration.run_before:
child = self.check_key(child, key[0])
if child is not None:
try:
self.graph.add_dependency(migration, child, key)
except NodeNotFoundError as e:
# Since we added "key" to the nodes before this implies
# "child" is not in there.
_reraise_missing_dependency(migration, child, e)
def detect_conflicts(self):
"""
Looks through the loaded graph and detects any conflicts - apps
with more than one leaf migration. Returns a dict of the app labels
that conflict with the migration names that conflict.
"""
seen_apps = {}
conflicting_apps = set()
for app_label, migration_name in self.graph.leaf_nodes():
if app_label in seen_apps:
conflicting_apps.add(app_label)
seen_apps.setdefault(app_label, set()).add(migration_name)
return {app_label: seen_apps[app_label] for app_label in conflicting_apps}
def project_state(self, nodes=None, at_end=True):
"""
Returns a ProjectState object representing the most recent state
that the migrations we loaded represent.
See graph.make_state for the meaning of "nodes" and "at_end"
"""
return self.graph.make_state(nodes=nodes, at_end=at_end, real_apps=list(self.unmigrated_apps))
class BadMigrationError(Exception):
"""
Raised when there's a bad migration (unreadable/bad format/etc.)
"""
pass
class AmbiguityError(Exception):
"""
Raised when more than one migration matches a name prefix
"""
pass
| bsd-3-clause | [
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
747,
199,
646,
984,
199,
504,
14802,
492,
492,
63,
578,
199,
199,
504,
1639,
14,
5181,
492,
8686,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
697,
14,
7685,
14,
2180,
492,
12090,
4578,
12,
5013,
10870,
199,
504,
1639,
14,
697,
14,
7685,
14,
27733,
492,
12090,
497,
16940,
199,
504,
1639,
14,
1208,
492,
3816,
199,
199,
22487,
50,
12969,
63,
10001,
63,
2339,
275,
283,
7685,
7,
421,
199,
533,
12090,
5455,
8,
785,
304,
272,
408,
272,
30367,
8367,
1584,
687,
4543,
12,
436,
3932,
2004,
687,
314,
3050,
14,
339,
12090,
1584,
787,
1420,
370,
12166,
315,
314,
298,
7685,
2,
2082,
402,
272,
376,
1145,
14,
710,
723,
1561,
787,
21926,
625,
19559,
687,
282,
1233,
1126,
16657,
12,
272,
1325,
911,
8646,
2035,
314,
14763,
63,
354,
14,
647,
16129,
14,
339,
4068,
11097,
12,
642,
1021,
911,
8000,
5204,
6602,
12,
436,
1551,
436,
272,
1586,
314,
2366,
1584,
12,
10023,
367,
282,
1021,
2797,
12090,
12,
1314,
1077,
272,
8287,
687,
1639,
14,
697,
14,
7685,
14,
9816,
14,
1666,
272,
1639,
14,
697,
14,
7685,
14,
8998,
367,
4052,
626,
10734,
2839,
14,
339,
6601,
6180,
911,
506,
11584,
465,
298,
1155,
13121,
2,
4573,
663,
402,
6180,
14,
272,
5723,
787,
6511,
1901,
282,
7396,
663,
402,
6180,
13437,
687,
314,
2446,
7869,
14,
272,
982,
1006,
314,
6180,
2985,
3350,
787,
1902,
625,
17250,
503,
4124,
687,
272,
4543,
12,
2066,
2985,
787,
26121,
1901,
314,
2446,
663,
12,
15810,
314,
4310,
6180,
14,
272,
6184,
5936,
21116,
370,
314,
8717,
6180,
787,
295,
13,
555,
9082,
370,
314,
272,
892,
8367,
14,
339,
961,
1630,
4615,
626,
642,
1021,
18095,
2597,
22811,
370,
314,
3050,
465,
5521,
465,
272,
370,
4543,
12,
1325,
642,
365,
8646,
15701,
14,
2136,
3984,
2575,
440,
2951,
17406,
272,
315,
4402,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1950,
12,
2248,
29,
549,
12,
3686,
63,
889,
63,
7685,
29,
797,
304,
267,
291,
14,
2105,
275,
1950,
267,
291,
14,
4032,
63,
7685,
275,
488,
267,
291,
14,
17250,
63,
7685,
275,
488,
267,
291,
14,
4247,
63,
889,
63,
7685,
275,
3686,
63,
889,
63,
7685,
267,
340,
2248,
26,
288,
291,
14,
1506,
63,
2180,
342,
339,
768,
3744,
272,
347,
6180,
63,
578,
8,
1886,
12,
1145,
63,
1302,
304,
267,
340,
1145,
63,
1302,
315,
2202,
14,
22487,
23743,
63,
21194,
26,
288,
372,
2202,
14,
22487,
23743,
63,
21194,
59,
571,
63,
1302,
61,
267,
587,
26,
288,
1145,
63,
2491,
63,
354,
275,
8686,
14,
362,
63,
571,
63,
888,
8,
571,
63,
1302,
680,
354,
288,
372,
1543,
83,
4111,
83,
7,
450,
334,
571,
63,
2491,
63,
354,
12,
603,
1277,
50,
12969,
63,
10001,
63,
2339,
9,
339,
347,
2248,
63,
4032,
8,
277,
304,
267,
408,
267,
30367,
314,
6180,
687,
1006,
31061,
63,
14219,
687,
4543,
14,
267,
408,
267,
291,
14,
4032,
63,
7685,
275,
1052,
267,
291,
14,
324,
31544,
63,
5181,
275,
663,
342,
267,
291,
14,
31544,
63,
5181,
275,
663,
342,
267,
367,
1145,
63,
888,
315,
8686,
14,
362,
63,
571,
63,
7532,
837,
288,
327,
2372,
314,
6180,
859,
2082,
288,
859,
63,
354,
275,
291,
14,
7685,
63,
578,
8,
571,
63,
888,
14,
1302,
9,
288,
1990,
63,
4591,
275,
859,
63,
354,
315,
984,
14,
3112,
288,
862,
26,
355,
859,
275,
492,
63,
578,
8,
578,
63,
354,
9,
288,
871,
3545,
465,
325,
26,
355,
327,
473,
394,
323,
9689,
642,
12,
1325,
473,
2793,
1133,
2934,
370,
12345,
1119,
1163,
492,
2552,
14,
355,
327,
603,
1070,
506,
8034,
370,
862,
282,
2082,
1104,
5370,
14,
355,
340,
298,
1944,
859,
4310,
2,
315,
620,
8,
69,
9,
436,
603,
1277,
50,
12969,
63,
10001,
63,
2339,
315,
620,
8,
69,
304,
490,
291,
14,
324,
31544,
63,
5181,
14,
525,
8,
571,
63,
888,
14,
1302,
9,
490,
1980,
355,
746,
288,
587,
26,
355,
327,
7843,
19,
911,
394,
571,
3444,
492,
2701,
7606,
465,
10747,
14,
355,
340,
440,
2688,
8,
578,
12,
2560,
493,
12168,
490,
1980,
355,
327,
5673,
365,
440,
282,
2559,
334,
69,
14,
71,
14,
6180,
14,
647,
680,
355,
340,
440,
2688,
8,
578,
12,
2560,
515,
12168,
490,
1980,
355,
327,
18771,
282,
13101,
340,
652,
1159,
2575,
6511,
334,
2219,
1929,
642,
9,
355,
340,
1990,
63,
4591,
26,
490,
3816,
14,
4912,
14,
9233,
63,
578,
8,
578,
9,
288,
291,
14,
31544,
63,
5181,
14,
525,
8,
571,
63,
888,
14,
1302,
9,
288,
2082,
275,
747,
14,
515,
14,
3475,
8,
578,
855,
493,
3368,
288,
327,
24833,
367,
1275,
647,
1584,
288,
8367,
63,
1247,
275,
663,
342,
288,
367,
536,
315,
747,
14,
7374,
8,
3619,
304,
355,
340,
536,
14,
4130,
9520,
647,
2349,
490,
492,
63,
354,
275,
536,
14,
13490,
30381,
413,
2788,
16,
61,
490,
340,
492,
63,
354,
59,
16,
61,
440,
315,
2668,
14,
94,
582,
717,
8367,
63,
1247,
14,
525,
8,
646,
63,
354,
9,
288,
327,
7190,
3062,
288,
12919,
63,
2487,
63,
7685,
275,
756,
288,
367,
8367,
63,
354,
315,
8367,
63,
1247,
26,
355,
862,
26,
490,
8367,
63,
578,
275,
492,
63,
578,
3647,
83,
4111,
83,
2,
450,
334,
578,
63,
354,
12,
8367,
63,
354,
430,
355,
871,
3545,
465,
325,
26,
490,
327,
14092,
23150,
492,
2552,
12,
465,
781,
3984,
6804,
316,
3062,
490,
340,
298,
22607,
2,
315,
620,
8,
69,
680,
2325,
837,
717,
12919,
63,
2487,
63,
7685,
275,
715,
717,
2059,
490,
746,
355,
340,
440,
2688,
8,
8998,
63,
578,
12,
298,
9816,
2349,
490,
746,
8857,
9816,
547,
8,
717,
298,
9816,
450,
83,
315,
1145,
450,
83,
965,
949,
12090,
1021,
2,
450,
334,
8998,
63,
354,
12,
1145,
63,
888,
14,
1302,
9,
490,
776,
355,
327,
14092,
23150,
13,
2487,
6180,
355,
340,
2688,
8,
8998,
63,
578,
14,
9816
] | [
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
747,
199,
646,
984,
199,
504,
14802,
492,
492,
63,
578,
199,
199,
504,
1639,
14,
5181,
492,
8686,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
697,
14,
7685,
14,
2180,
492,
12090,
4578,
12,
5013,
10870,
199,
504,
1639,
14,
697,
14,
7685,
14,
27733,
492,
12090,
497,
16940,
199,
504,
1639,
14,
1208,
492,
3816,
199,
199,
22487,
50,
12969,
63,
10001,
63,
2339,
275,
283,
7685,
7,
421,
199,
533,
12090,
5455,
8,
785,
304,
272,
408,
272,
30367,
8367,
1584,
687,
4543,
12,
436,
3932,
2004,
687,
314,
3050,
14,
339,
12090,
1584,
787,
1420,
370,
12166,
315,
314,
298,
7685,
2,
2082,
402,
272,
376,
1145,
14,
710,
723,
1561,
787,
21926,
625,
19559,
687,
282,
1233,
1126,
16657,
12,
272,
1325,
911,
8646,
2035,
314,
14763,
63,
354,
14,
647,
16129,
14,
339,
4068,
11097,
12,
642,
1021,
911,
8000,
5204,
6602,
12,
436,
1551,
436,
272,
1586,
314,
2366,
1584,
12,
10023,
367,
282,
1021,
2797,
12090,
12,
1314,
1077,
272,
8287,
687,
1639,
14,
697,
14,
7685,
14,
9816,
14,
1666,
272,
1639,
14,
697,
14,
7685,
14,
8998,
367,
4052,
626,
10734,
2839,
14,
339,
6601,
6180,
911,
506,
11584,
465,
298,
1155,
13121,
2,
4573,
663,
402,
6180,
14,
272,
5723,
787,
6511,
1901,
282,
7396,
663,
402,
6180,
13437,
687,
314,
2446,
7869,
14,
272,
982,
1006,
314,
6180,
2985,
3350,
787,
1902,
625,
17250,
503,
4124,
687,
272,
4543,
12,
2066,
2985,
787,
26121,
1901,
314,
2446,
663,
12,
15810,
314,
4310,
6180,
14,
272,
6184,
5936,
21116,
370,
314,
8717,
6180,
787,
295,
13,
555,
9082,
370,
314,
272,
892,
8367,
14,
339,
961,
1630,
4615,
626,
642,
1021,
18095,
2597,
22811,
370,
314,
3050,
465,
5521,
465,
272,
370,
4543,
12,
1325,
642,
365,
8646,
15701,
14,
2136,
3984,
2575,
440,
2951,
17406,
272,
315,
4402,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1950,
12,
2248,
29,
549,
12,
3686,
63,
889,
63,
7685,
29,
797,
304,
267,
291,
14,
2105,
275,
1950,
267,
291,
14,
4032,
63,
7685,
275,
488,
267,
291,
14,
17250,
63,
7685,
275,
488,
267,
291,
14,
4247,
63,
889,
63,
7685,
275,
3686,
63,
889,
63,
7685,
267,
340,
2248,
26,
288,
291,
14,
1506,
63,
2180,
342,
339,
768,
3744,
272,
347,
6180,
63,
578,
8,
1886,
12,
1145,
63,
1302,
304,
267,
340,
1145,
63,
1302,
315,
2202,
14,
22487,
23743,
63,
21194,
26,
288,
372,
2202,
14,
22487,
23743,
63,
21194,
59,
571,
63,
1302,
61,
267,
587,
26,
288,
1145,
63,
2491,
63,
354,
275,
8686,
14,
362,
63,
571,
63,
888,
8,
571,
63,
1302,
680,
354,
288,
372,
1543,
83,
4111,
83,
7,
450,
334,
571,
63,
2491,
63,
354,
12,
603,
1277,
50,
12969,
63,
10001,
63,
2339,
9,
339,
347,
2248,
63,
4032,
8,
277,
304,
267,
408,
267,
30367,
314,
6180,
687,
1006,
31061,
63,
14219,
687,
4543,
14,
267,
408,
267,
291,
14,
4032,
63,
7685,
275,
1052,
267,
291,
14,
324,
31544,
63,
5181,
275,
663,
342,
267,
291,
14,
31544,
63,
5181,
275,
663,
342,
267,
367,
1145,
63,
888,
315,
8686,
14,
362,
63,
571,
63,
7532,
837,
288,
327,
2372,
314,
6180,
859,
2082,
288,
859,
63,
354,
275,
291,
14,
7685,
63,
578,
8,
571,
63,
888,
14,
1302,
9,
288,
1990,
63,
4591,
275,
859,
63,
354,
315,
984,
14,
3112,
288,
862,
26,
355,
859,
275,
492,
63,
578,
8,
578,
63,
354,
9,
288,
871,
3545,
465,
325,
26,
355,
327,
473,
394,
323,
9689,
642,
12,
1325,
473,
2793,
1133,
2934,
370,
12345,
1119,
1163,
492,
2552,
14,
355,
327,
603,
1070,
506,
8034,
370,
862,
282,
2082,
1104,
5370,
14,
355,
340,
298,
1944,
859,
4310,
2,
315,
620,
8,
69,
9,
436,
603,
1277,
50,
12969,
63,
10001,
63,
2339,
315,
620,
8,
69,
304,
490,
291,
14,
324,
31544,
63,
5181,
14,
525,
8,
571,
63,
888,
14,
1302,
9,
490,
1980,
355,
746,
288,
587,
26,
355,
327,
7843,
19,
911,
394,
571,
3444,
492,
2701,
7606,
465,
10747,
14,
355,
340,
440,
2688,
8,
578,
12,
2560,
493,
12168,
490,
1980,
355,
327,
5673,
365,
440,
282,
2559,
334,
69,
14,
71,
14,
6180,
14,
647,
680,
355,
340,
440,
2688,
8,
578,
12,
2560,
515,
12168,
490,
1980,
355,
327,
18771,
282,
13101,
340,
652,
1159,
2575,
6511,
334,
2219,
1929,
642,
9,
355,
340,
1990,
63,
4591,
26,
490,
3816,
14,
4912,
14,
9233,
63,
578,
8,
578,
9,
288,
291,
14,
31544,
63,
5181,
14,
525,
8,
571,
63,
888,
14,
1302,
9,
288,
2082,
275,
747,
14,
515,
14,
3475,
8,
578,
855,
493,
3368,
288,
327,
24833,
367,
1275,
647,
1584,
288,
8367,
63,
1247,
275,
663,
342,
288,
367,
536,
315,
747,
14,
7374,
8,
3619,
304,
355,
340,
536,
14,
4130,
9520,
647,
2349,
490,
492,
63,
354,
275,
536,
14,
13490,
30381,
413,
2788,
16,
61,
490,
340,
492,
63,
354,
59,
16,
61,
440,
315,
2668,
14,
94,
582,
717,
8367,
63,
1247,
14,
525,
8,
646,
63,
354,
9,
288,
327,
7190,
3062,
288,
12919,
63,
2487,
63,
7685,
275,
756,
288,
367,
8367,
63,
354,
315,
8367,
63,
1247,
26,
355,
862,
26,
490,
8367,
63,
578,
275,
492,
63,
578,
3647,
83,
4111,
83,
2,
450,
334,
578,
63,
354,
12,
8367,
63,
354,
430,
355,
871,
3545,
465,
325,
26,
490,
327,
14092,
23150,
492,
2552,
12,
465,
781,
3984,
6804,
316,
3062,
490,
340,
298,
22607,
2,
315,
620,
8,
69,
680,
2325,
837,
717,
12919,
63,
2487,
63,
7685,
275,
715,
717,
2059,
490,
746,
355,
340,
440,
2688,
8,
8998,
63,
578,
12,
298,
9816,
2349,
490,
746,
8857,
9816,
547,
8,
717,
298,
9816,
450,
83,
315,
1145,
450,
83,
965,
949,
12090,
1021,
2,
450,
334,
8998,
63,
354,
12,
1145,
63,
888,
14,
1302,
9,
490,
776,
355,
327,
14092,
23150,
13,
2487,
6180,
355,
340,
2688,
8,
8998,
63,
578,
14,
9816,
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,
1
] |
cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/pip/utils/ui.py | 490 | 11597 | from __future__ import absolute_import
from __future__ import division
import itertools
import sys
from signal import signal, SIGINT, default_int_handler
import time
import contextlib
import logging
from pip.compat import WINDOWS
from pip.utils import format_size
from pip.utils.logging import get_indentation
from pip._vendor import six
from pip._vendor.progress.bar import Bar, IncrementalBar
from pip._vendor.progress.helpers import (WritelnMixin,
HIDE_CURSOR, SHOW_CURSOR)
from pip._vendor.progress.spinner import Spinner
try:
from pip._vendor import colorama
# Lots of different errors can come from this, including SystemError and
# ImportError.
except Exception:
colorama = None
logger = logging.getLogger(__name__)
def _select_progress_class(preferred, fallback):
encoding = getattr(preferred.file, "encoding", None)
# If we don't know what encoding this file is in, then we'll just assume
# that it doesn't support unicode and use the ASCII bar.
if not encoding:
return fallback
# Collect all of the possible characters we want to use with the preferred
# bar.
characters = [
getattr(preferred, "empty_fill", six.text_type()),
getattr(preferred, "fill", six.text_type()),
]
characters += list(getattr(preferred, "phases", []))
# Try to decode the characters we're using for the bar using the encoding
# of the given file, if this works then we'll assume that we can use the
# fancier bar and if not we'll fall back to the plaintext bar.
try:
six.text_type().join(characters).encode(encoding)
except UnicodeEncodeError:
return fallback
else:
return preferred
_BaseBar = _select_progress_class(IncrementalBar, Bar)
class InterruptibleMixin(object):
"""
Helper to ensure that self.finish() gets called on keyboard interrupt.
This allows downloads to be interrupted without leaving temporary state
(like hidden cursors) behind.
This class is similar to the progress library's existing SigIntMixin
helper, but as of version 1.2, that helper has the following problems:
1. It calls sys.exit().
2. It discards the existing SIGINT handler completely.
3. It leaves its own handler in place even after an uninterrupted finish,
which will have unexpected delayed effects if the user triggers an
unrelated keyboard interrupt some time after a progress-displaying
download has already completed, for example.
"""
def __init__(self, *args, **kwargs):
"""
Save the original SIGINT handler for later.
"""
super(InterruptibleMixin, self).__init__(*args, **kwargs)
self.original_handler = signal(SIGINT, self.handle_sigint)
# If signal() returns None, the previous handler was not installed from
# Python, and we cannot restore it. This probably should not happen,
# but if it does, we must restore something sensible instead, at least.
# The least bad option should be Python's default SIGINT handler, which
# just raises KeyboardInterrupt.
if self.original_handler is None:
self.original_handler = default_int_handler
def finish(self):
"""
Restore the original SIGINT handler after finishing.
This should happen regardless of whether the progress display finishes
normally, or gets interrupted.
"""
super(InterruptibleMixin, self).finish()
signal(SIGINT, self.original_handler)
def handle_sigint(self, signum, frame):
"""
Call self.finish() before delegating to the original SIGINT handler.
This handler should only be in place while the progress display is
active.
"""
self.finish()
self.original_handler(signum, frame)
class DownloadProgressMixin(object):
def __init__(self, *args, **kwargs):
super(DownloadProgressMixin, self).__init__(*args, **kwargs)
self.message = (" " * (get_indentation() + 2)) + self.message
@property
def downloaded(self):
return format_size(self.index)
@property
def download_speed(self):
# Avoid zero division errors...
if self.avg == 0.0:
return "..."
return format_size(1 / self.avg) + "/s"
@property
def pretty_eta(self):
if self.eta:
return "eta %s" % self.eta_td
return ""
def iter(self, it, n=1):
for x in it:
yield x
self.next(n)
self.finish()
class WindowsMixin(object):
def __init__(self, *args, **kwargs):
# The Windows terminal does not support the hide/show cursor ANSI codes
# even with colorama. So we'll ensure that hide_cursor is False on
# Windows.
# This call neds to go before the super() call, so that hide_cursor
# is set in time. The base progress bar class writes the "hide cursor"
# code to the terminal in its init, so if we don't set this soon
# enough, we get a "hide" with no corresponding "show"...
if WINDOWS and self.hide_cursor:
self.hide_cursor = False
super(WindowsMixin, self).__init__(*args, **kwargs)
# Check if we are running on Windows and we have the colorama module,
# if we do then wrap our file with it.
if WINDOWS and colorama:
self.file = colorama.AnsiToWin32(self.file)
# The progress code expects to be able to call self.file.isatty()
# but the colorama.AnsiToWin32() object doesn't have that, so we'll
# add it.
self.file.isatty = lambda: self.file.wrapped.isatty()
# The progress code expects to be able to call self.file.flush()
# but the colorama.AnsiToWin32() object doesn't have that, so we'll
# add it.
self.file.flush = lambda: self.file.wrapped.flush()
class DownloadProgressBar(WindowsMixin, InterruptibleMixin,
DownloadProgressMixin, _BaseBar):
file = sys.stdout
message = "%(percent)d%%"
suffix = "%(downloaded)s %(download_speed)s %(pretty_eta)s"
class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin,
DownloadProgressMixin, WritelnMixin, Spinner):
file = sys.stdout
suffix = "%(downloaded)s %(download_speed)s"
def next_phase(self):
if not hasattr(self, "_phaser"):
self._phaser = itertools.cycle(self.phases)
return next(self._phaser)
def update(self):
message = self.message % self
phase = self.next_phase()
suffix = self.suffix % self
line = ''.join([
message,
" " if message else "",
phase,
" " if suffix else "",
suffix,
])
self.writeln(line)
################################################################
# Generic "something is happening" spinners
#
# We don't even try using progress.spinner.Spinner here because it's actually
# simpler to reimplement from scratch than to coerce their code into doing
# what we need.
################################################################
@contextlib.contextmanager
def hidden_cursor(file):
# The Windows terminal does not support the hide/show cursor ANSI codes,
# even via colorama. So don't even try.
if WINDOWS:
yield
# We don't want to clutter the output with control characters if we're
# writing to a file, or if the user is running with --quiet.
# See https://github.com/pypa/pip/issues/3418
elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO:
yield
else:
file.write(HIDE_CURSOR)
try:
yield
finally:
file.write(SHOW_CURSOR)
class RateLimiter(object):
def __init__(self, min_update_interval_seconds):
self._min_update_interval_seconds = min_update_interval_seconds
self._last_update = 0
def ready(self):
now = time.time()
delta = now - self._last_update
return delta >= self._min_update_interval_seconds
def reset(self):
self._last_update = time.time()
class InteractiveSpinner(object):
def __init__(self, message, file=None, spin_chars="-\\|/",
# Empirically, 8 updates/second looks nice
min_update_interval_seconds=0.125):
self._message = message
if file is None:
file = sys.stdout
self._file = file
self._rate_limiter = RateLimiter(min_update_interval_seconds)
self._finished = False
self._spin_cycle = itertools.cycle(spin_chars)
self._file.write(" " * get_indentation() + self._message + " ... ")
self._width = 0
def _write(self, status):
assert not self._finished
# Erase what we wrote before by backspacing to the beginning, writing
# spaces to overwrite the old text, and then backspacing again
backup = "\b" * self._width
self._file.write(backup + " " * self._width + backup)
# Now we have a blank slate to add our status
self._file.write(status)
self._width = len(status)
self._file.flush()
self._rate_limiter.reset()
def spin(self):
if self._finished:
return
if not self._rate_limiter.ready():
return
self._write(next(self._spin_cycle))
def finish(self, final_status):
if self._finished:
return
self._write(final_status)
self._file.write("\n")
self._file.flush()
self._finished = True
# Used for dumb terminals, non-interactive installs (no tty), etc.
# We still print updates occasionally (once every 60 seconds by default) to
# act as a keep-alive for systems like Travis-CI that take lack-of-output as
# an indication that a task has frozen.
class NonInteractiveSpinner(object):
def __init__(self, message, min_update_interval_seconds=60):
self._message = message
self._finished = False
self._rate_limiter = RateLimiter(min_update_interval_seconds)
self._update("started")
def _update(self, status):
assert not self._finished
self._rate_limiter.reset()
logger.info("%s: %s", self._message, status)
def spin(self):
if self._finished:
return
if not self._rate_limiter.ready():
return
self._update("still running...")
def finish(self, final_status):
if self._finished:
return
self._update("finished with status '%s'" % (final_status,))
self._finished = True
@contextlib.contextmanager
def open_spinner(message):
# Interactive spinner goes directly to sys.stdout rather than being routed
# through the logging system, but it acts like it has level INFO,
# i.e. it's only displayed if we're at level INFO or better.
# Non-interactive spinner goes through the logging system, so it is always
# in sync with logging configuration.
if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO:
spinner = InteractiveSpinner(message)
else:
spinner = NonInteractiveSpinner(message)
try:
with hidden_cursor(sys.stdout):
yield spinner
except KeyboardInterrupt:
spinner.finish("canceled")
raise
except Exception:
spinner.finish("error")
raise
else:
spinner.finish("done")
| gpl-3.0 | [
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
199,
646,
7975,
199,
646,
984,
199,
504,
4673,
492,
4673,
12,
15522,
2919,
12,
849,
63,
442,
63,
2232,
199,
646,
900,
199,
646,
15502,
199,
646,
2050,
199,
199,
504,
7305,
14,
5819,
492,
20896,
1649,
5035,
199,
504,
7305,
14,
1208,
492,
1475,
63,
890,
199,
504,
7305,
14,
1208,
14,
4806,
492,
664,
63,
25152,
199,
504,
7305,
423,
9884,
492,
3816,
199,
504,
7305,
423,
9884,
14,
5734,
14,
1700,
492,
12377,
12,
14684,
5281,
199,
504,
7305,
423,
9884,
14,
5734,
14,
7546,
492,
334,
3534,
6066,
4256,
12,
5101,
869,
11259,
63,
31321,
12,
428,
16210,
63,
31321,
9,
199,
504,
7305,
423,
9884,
14,
5734,
14,
681,
5216,
492,
8360,
5216,
199,
199,
893,
26,
272,
687,
7305,
423,
9884,
492,
3164,
14541,
199,
3,
491,
16673,
402,
3365,
2552,
883,
11492,
687,
642,
12,
5893,
6187,
547,
436,
199,
3,
3545,
14,
199,
2590,
2186,
26,
272,
3164,
14541,
275,
488,
199,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
318,
485,
2416,
63,
5734,
63,
533,
8,
17477,
12,
9567,
304,
272,
2644,
275,
2519,
8,
17477,
14,
493,
12,
298,
2991,
401,
488,
9,
339,
327,
982,
781,
2793,
1133,
5715,
4052,
2644,
642,
570,
365,
315,
12,
2066,
781,
7171,
2951,
5534,
272,
327,
626,
652,
3181,
1133,
2291,
2649,
436,
675,
314,
10485,
4681,
14,
272,
340,
440,
2644,
26,
267,
372,
9567,
339,
327,
19649,
1006,
402,
314,
3962,
4110,
781,
2934,
370,
675,
543,
314,
14388,
272,
327,
4681,
14,
272,
4110,
275,
359,
267,
2519,
8,
17477,
12,
298,
1667,
63,
4498,
401,
3816,
14,
505,
63,
466,
4000,
267,
2519,
8,
17477,
12,
298,
4498,
401,
3816,
14,
505,
63,
466,
4000,
272,
1622,
272,
4110,
847,
769,
8,
5675,
8,
17477,
12,
298,
14236,
401,
15927,
339,
327,
7649,
370,
4849,
314,
4110,
781,
3984,
1808,
367,
314,
4681,
1808,
314,
2644,
272,
327,
402,
314,
1627,
570,
12,
340,
642,
5419,
2066,
781,
7171,
5534,
626,
781,
883,
675,
314,
272,
327,
13758,
559,
281,
4681,
436,
340,
440,
781,
7171,
11264,
1771,
370,
314,
18577,
4681,
14,
272,
862,
26,
267,
3816,
14,
505,
63,
466,
1252,
904,
8,
16516,
680,
2143,
8,
2991,
9,
272,
871,
24094,
26,
267,
372,
9567,
272,
587,
26,
267,
372,
14388,
421,
199,
63,
1563,
5281,
275,
485,
2416,
63,
5734,
63,
533,
8,
10287,
5281,
12,
12377,
9,
421,
199,
533,
6551,
5505,
21602,
4256,
8,
785,
304,
272,
408,
272,
11642,
370,
4868,
626,
291,
14,
8192,
342,
7545,
2797,
641,
18716,
26791,
14,
339,
961,
6127,
28242,
370,
506,
31366,
1928,
23188,
7937,
1174,
272,
334,
2930,
8752,
18809,
1384,
9,
22172,
14,
339,
961,
1021,
365,
8545,
370,
314,
6696,
3555,
1159,
3411,
14625,
3241,
4256,
272,
5922,
12,
1325,
465,
402,
1015,
413,
14,
18,
12,
626,
5922,
965,
314,
2569,
8826,
26,
339,
413,
14,
2779,
4882,
984,
14,
2224,
1252,
272,
499,
14,
2779,
4339,
5596,
314,
3411,
15522,
2919,
3016,
14793,
14,
272,
650,
14,
2779,
16733,
2399,
5705,
3016,
315,
4192,
2755,
2410,
376,
625,
1058,
15692,
9578,
12,
2126,
1314,
911,
1172,
10537,
24725,
22414,
340,
314,
922,
18899,
376,
2126,
625,
2407,
18716,
26791,
2005,
900,
2410,
282,
6696,
13,
2918,
316,
2126,
5235,
965,
2575,
9709,
12,
367,
2893,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
408,
267,
11063,
314,
3379,
15522,
2919,
3016,
367,
2945,
14,
267,
408,
267,
1613,
8,
2620,
5505,
21602,
4256,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
398,
291,
14,
5043,
63,
2232,
275,
4673,
8,
21223,
12,
291,
14,
2479,
63,
4093,
442,
9,
398,
327,
982,
4673,
342,
2529,
488,
12,
314,
4136,
3016,
1990,
440,
4903,
687,
267,
327,
2018,
12,
436,
781,
3913,
9066,
652,
14,
961,
8646,
1077,
440,
5992,
12,
267,
327,
1325,
340,
652,
1630,
12,
781,
1471,
9066,
6020,
27962,
3140,
12,
737,
5210,
14,
267,
327,
710,
5210,
4875,
945,
1077,
506,
2018,
1159,
849,
15522,
2919,
3016,
12,
1314,
267,
327,
2951,
6534,
13483,
14,
267,
340,
291,
14,
5043,
63,
2232,
365,
488,
26,
288,
291,
14,
5043,
63,
2232,
275,
849,
63,
442,
63,
2232,
339,
347,
9578,
8,
277,
304,
267,
408,
267,
22379,
314,
3379,
15522,
2919,
3016,
2410,
9578,
316,
14,
398,
961,
1077,
5992,
15270,
402,
3775,
314,
6696,
2929,
9578,
397,
267,
12252,
12,
503,
7545,
31366,
14,
267,
408,
267,
1613,
8,
2620,
5505,
21602,
4256,
12,
291,
680,
8192,
342,
267,
4673,
8,
21223,
12,
291,
14,
5043,
63,
2232,
9,
339,
347,
2429,
63,
4093,
442,
8,
277,
12,
2070,
453,
12,
2787,
304,
267,
408,
267,
6523,
291,
14,
8192,
342,
2544,
18703,
1958,
370,
314,
3379,
15522,
2919,
3016,
14,
398,
961,
3016,
1077,
1454,
506,
315,
4192,
1830,
314,
6696,
2929,
365,
267,
4702,
14,
267,
408,
267,
291,
14,
8192,
342,
267,
291,
14,
5043,
63,
2232,
8,
1037,
453,
12,
2787,
9,
421,
199,
533,
17955,
11504,
4256,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
1613,
8,
11950,
11504,
4256,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
267,
291,
14,
1188,
275,
1689,
298,
627,
334,
362,
63,
25152,
342,
435,
499,
430,
435,
291,
14,
1188,
339,
768,
1829,
272,
347,
13557,
8,
277,
304,
267,
372,
1475,
63,
890,
8,
277,
14,
1080,
9,
339,
768,
1829,
272,
347,
5235,
63,
7625,
8,
277,
304,
267,
327,
19503,
4697,
4629,
2552,
1396,
267,
340,
291,
14,
8595,
508,
378,
14,
16,
26,
288,
372,
298,
11500,
267,
372,
1475,
63,
890,
8,
17,
1182,
291,
14,
8595,
9,
435,
3286,
83,
2,
339,
768,
1829,
272,
347,
7268,
63,
1841,
8,
277,
304,
267,
340,
291,
14,
1841,
26,
288,
372,
298,
1841,
450,
83,
2,
450,
291,
14,
1841,
63,
2076,
267,
372,
3087,
339,
347
] | [
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
199,
646,
7975,
199,
646,
984,
199,
504,
4673,
492,
4673,
12,
15522,
2919,
12,
849,
63,
442,
63,
2232,
199,
646,
900,
199,
646,
15502,
199,
646,
2050,
199,
199,
504,
7305,
14,
5819,
492,
20896,
1649,
5035,
199,
504,
7305,
14,
1208,
492,
1475,
63,
890,
199,
504,
7305,
14,
1208,
14,
4806,
492,
664,
63,
25152,
199,
504,
7305,
423,
9884,
492,
3816,
199,
504,
7305,
423,
9884,
14,
5734,
14,
1700,
492,
12377,
12,
14684,
5281,
199,
504,
7305,
423,
9884,
14,
5734,
14,
7546,
492,
334,
3534,
6066,
4256,
12,
5101,
869,
11259,
63,
31321,
12,
428,
16210,
63,
31321,
9,
199,
504,
7305,
423,
9884,
14,
5734,
14,
681,
5216,
492,
8360,
5216,
199,
199,
893,
26,
272,
687,
7305,
423,
9884,
492,
3164,
14541,
199,
3,
491,
16673,
402,
3365,
2552,
883,
11492,
687,
642,
12,
5893,
6187,
547,
436,
199,
3,
3545,
14,
199,
2590,
2186,
26,
272,
3164,
14541,
275,
488,
199,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
318,
485,
2416,
63,
5734,
63,
533,
8,
17477,
12,
9567,
304,
272,
2644,
275,
2519,
8,
17477,
14,
493,
12,
298,
2991,
401,
488,
9,
339,
327,
982,
781,
2793,
1133,
5715,
4052,
2644,
642,
570,
365,
315,
12,
2066,
781,
7171,
2951,
5534,
272,
327,
626,
652,
3181,
1133,
2291,
2649,
436,
675,
314,
10485,
4681,
14,
272,
340,
440,
2644,
26,
267,
372,
9567,
339,
327,
19649,
1006,
402,
314,
3962,
4110,
781,
2934,
370,
675,
543,
314,
14388,
272,
327,
4681,
14,
272,
4110,
275,
359,
267,
2519,
8,
17477,
12,
298,
1667,
63,
4498,
401,
3816,
14,
505,
63,
466,
4000,
267,
2519,
8,
17477,
12,
298,
4498,
401,
3816,
14,
505,
63,
466,
4000,
272,
1622,
272,
4110,
847,
769,
8,
5675,
8,
17477,
12,
298,
14236,
401,
15927,
339,
327,
7649,
370,
4849,
314,
4110,
781,
3984,
1808,
367,
314,
4681,
1808,
314,
2644,
272,
327,
402,
314,
1627,
570,
12,
340,
642,
5419,
2066,
781,
7171,
5534,
626,
781,
883,
675,
314,
272,
327,
13758,
559,
281,
4681,
436,
340,
440,
781,
7171,
11264,
1771,
370,
314,
18577,
4681,
14,
272,
862,
26,
267,
3816,
14,
505,
63,
466,
1252,
904,
8,
16516,
680,
2143,
8,
2991,
9,
272,
871,
24094,
26,
267,
372,
9567,
272,
587,
26,
267,
372,
14388,
421,
199,
63,
1563,
5281,
275,
485,
2416,
63,
5734,
63,
533,
8,
10287,
5281,
12,
12377,
9,
421,
199,
533,
6551,
5505,
21602,
4256,
8,
785,
304,
272,
408,
272,
11642,
370,
4868,
626,
291,
14,
8192,
342,
7545,
2797,
641,
18716,
26791,
14,
339,
961,
6127,
28242,
370,
506,
31366,
1928,
23188,
7937,
1174,
272,
334,
2930,
8752,
18809,
1384,
9,
22172,
14,
339,
961,
1021,
365,
8545,
370,
314,
6696,
3555,
1159,
3411,
14625,
3241,
4256,
272,
5922,
12,
1325,
465,
402,
1015,
413,
14,
18,
12,
626,
5922,
965,
314,
2569,
8826,
26,
339,
413,
14,
2779,
4882,
984,
14,
2224,
1252,
272,
499,
14,
2779,
4339,
5596,
314,
3411,
15522,
2919,
3016,
14793,
14,
272,
650,
14,
2779,
16733,
2399,
5705,
3016,
315,
4192,
2755,
2410,
376,
625,
1058,
15692,
9578,
12,
2126,
1314,
911,
1172,
10537,
24725,
22414,
340,
314,
922,
18899,
376,
2126,
625,
2407,
18716,
26791,
2005,
900,
2410,
282,
6696,
13,
2918,
316,
2126,
5235,
965,
2575,
9709,
12,
367,
2893,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
408,
267,
11063,
314,
3379,
15522,
2919,
3016,
367,
2945,
14,
267,
408,
267,
1613,
8,
2620,
5505,
21602,
4256,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
398,
291,
14,
5043,
63,
2232,
275,
4673,
8,
21223,
12,
291,
14,
2479,
63,
4093,
442,
9,
398,
327,
982,
4673,
342,
2529,
488,
12,
314,
4136,
3016,
1990,
440,
4903,
687,
267,
327,
2018,
12,
436,
781,
3913,
9066,
652,
14,
961,
8646,
1077,
440,
5992,
12,
267,
327,
1325,
340,
652,
1630,
12,
781,
1471,
9066,
6020,
27962,
3140,
12,
737,
5210,
14,
267,
327,
710,
5210,
4875,
945,
1077,
506,
2018,
1159,
849,
15522,
2919,
3016,
12,
1314,
267,
327,
2951,
6534,
13483,
14,
267,
340,
291,
14,
5043,
63,
2232,
365,
488,
26,
288,
291,
14,
5043,
63,
2232,
275,
849,
63,
442,
63,
2232,
339,
347,
9578,
8,
277,
304,
267,
408,
267,
22379,
314,
3379,
15522,
2919,
3016,
2410,
9578,
316,
14,
398,
961,
1077,
5992,
15270,
402,
3775,
314,
6696,
2929,
9578,
397,
267,
12252,
12,
503,
7545,
31366,
14,
267,
408,
267,
1613,
8,
2620,
5505,
21602,
4256,
12,
291,
680,
8192,
342,
267,
4673,
8,
21223,
12,
291,
14,
5043,
63,
2232,
9,
339,
347,
2429,
63,
4093,
442,
8,
277,
12,
2070,
453,
12,
2787,
304,
267,
408,
267,
6523,
291,
14,
8192,
342,
2544,
18703,
1958,
370,
314,
3379,
15522,
2919,
3016,
14,
398,
961,
3016,
1077,
1454,
506,
315,
4192,
1830,
314,
6696,
2929,
365,
267,
4702,
14,
267,
408,
267,
291,
14,
8192,
342,
267,
291,
14,
5043,
63,
2232,
8,
1037,
453,
12,
2787,
9,
421,
199,
533,
17955,
11504,
4256,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
1613,
8,
11950,
11504,
4256,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
267,
291,
14,
1188,
275,
1689,
298,
627,
334,
362,
63,
25152,
342,
435,
499,
430,
435,
291,
14,
1188,
339,
768,
1829,
272,
347,
13557,
8,
277,
304,
267,
372,
1475,
63,
890,
8,
277,
14,
1080,
9,
339,
768,
1829,
272,
347,
5235,
63,
7625,
8,
277,
304,
267,
327,
19503,
4697,
4629,
2552,
1396,
267,
340,
291,
14,
8595,
508,
378,
14,
16,
26,
288,
372,
298,
11500,
267,
372,
1475,
63,
890,
8,
17,
1182,
291,
14,
8595,
9,
435,
3286,
83,
2,
339,
768,
1829,
272,
347,
7268,
63,
1841,
8,
277,
304,
267,
340,
291,
14,
1841,
26,
288,
372,
298,
1841,
450,
83,
2,
450,
291,
14,
1841,
63,
2076,
267,
372,
3087,
339,
347,
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,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
2ndQuadrant/ansible | lib/ansible/modules/network/fortios/fortios_log_syslogd_override_setting.py | 23 | 12526 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# the lib use python logging can get it if the following is set in your
# Ansible config.
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: fortios_log_syslogd_override_setting
short_description: Override settings for remote syslog server in Fortinet's FortiOS and FortiGate.
description:
- This module is able to configure a FortiGate or FortiOS by allowing the
user to set and modify log_syslogd feature and override_setting category.
Examples include all parameters and values need to be adjusted to datasources before usage.
Tested with FOS v6.0.2
version_added: "2.8"
author:
- Miguel Angel Munoz (@mamunozgonzalez)
- Nicolas Thomas (@thomnico)
notes:
- Requires fortiosapi library developed by Fortinet
- Run as a local_action in your playbook
requirements:
- fortiosapi>=0.9.8
options:
host:
description:
- FortiOS or FortiGate ip address.
required: true
username:
description:
- FortiOS or FortiGate username.
required: true
password:
description:
- FortiOS or FortiGate password.
default: ""
vdom:
description:
- Virtual domain, among those defined previously. A vdom is a
virtual instance of the FortiGate that can be configured and
used as a different unit.
default: root
https:
description:
- Indicates if the requests towards FortiGate must use HTTPS
protocol
type: bool
default: true
log_syslogd_override_setting:
description:
- Override settings for remote syslog server.
default: null
suboptions:
certificate:
description:
- Certificate used to communicate with Syslog server. Source certificate.local.name.
custom-field-name:
description:
- Custom field name for CEF format logging.
suboptions:
custom:
description:
- Field custom name.
id:
description:
- Entry ID.
required: true
name:
description:
- Field name.
enc-algorithm:
description:
- Enable/disable reliable syslogging with TLS encryption.
choices:
- high-medium
- high
- low
- disable
facility:
description:
- Remote syslog facility.
choices:
- kernel
- user
- mail
- daemon
- auth
- syslog
- lpr
- news
- uucp
- cron
- authpriv
- ftp
- ntp
- audit
- alert
- clock
- local0
- local1
- local2
- local3
- local4
- local5
- local6
- local7
format:
description:
- Log format.
choices:
- default
- csv
- cef
mode:
description:
- Remote syslog logging over UDP/Reliable TCP.
choices:
- udp
- legacy-reliable
- reliable
override:
description:
- Enable/disable override syslog settings.
choices:
- enable
- disable
port:
description:
- Server listen port.
server:
description:
- Address of remote syslog server.
source-ip:
description:
- Source IP address of syslog.
status:
description:
- Enable/disable remote syslog logging.
choices:
- enable
- disable
'''
EXAMPLES = '''
- hosts: localhost
vars:
host: "192.168.122.40"
username: "admin"
password: ""
vdom: "root"
tasks:
- name: Override settings for remote syslog server.
fortios_log_syslogd_override_setting:
host: "{{ host }}"
username: "{{ username }}"
password: "{{ password }}"
vdom: "{{ vdom }}"
https: "False"
log_syslogd_override_setting:
certificate: "<your_own_value> (source certificate.local.name)"
custom-field-name:
-
custom: "<your_own_value>"
id: "6"
name: "default_name_7"
enc-algorithm: "high-medium"
facility: "kernel"
format: "default"
mode: "udp"
override: "enable"
port: "13"
server: "192.168.100.40"
source-ip: "84.230.14.43"
status: "enable"
'''
RETURN = '''
build:
description: Build number of the fortigate image
returned: always
type: str
sample: '1547'
http_method:
description: Last method used to provision the content into FortiGate
returned: always
type: str
sample: 'PUT'
http_status:
description: Last result given by FortiGate on last operation applied
returned: always
type: str
sample: "200"
mkey:
description: Master key (id) used in the last call to FortiGate
returned: success
type: str
sample: "id"
name:
description: Name of the table used to fulfill the request
returned: always
type: str
sample: "urlfilter"
path:
description: Path of the table used to fulfill the request
returned: always
type: str
sample: "webfilter"
revision:
description: Internal revision number
returned: always
type: str
sample: "17.0.2.10658"
serial:
description: Serial number of the unit
returned: always
type: str
sample: "FGVMEVYYQT3AB5352"
status:
description: Indication of the operation's result
returned: always
type: str
sample: "success"
vdom:
description: Virtual domain used
returned: always
type: str
sample: "root"
version:
description: Version of the FortiGate
returned: always
type: str
sample: "v5.6.3"
'''
from ansible.module_utils.basic import AnsibleModule
fos = None
def login(data):
host = data['host']
username = data['username']
password = data['password']
fos.debug('on')
if 'https' in data and not data['https']:
fos.https('off')
else:
fos.https('on')
fos.login(host, username, password)
def filter_log_syslogd_override_setting_data(json):
option_list = ['certificate', 'custom-field-name', 'enc-algorithm',
'facility', 'format', 'mode',
'override', 'port', 'server',
'source-ip', 'status']
dictionary = {}
for attribute in option_list:
if attribute in json and json[attribute] is not None:
dictionary[attribute] = json[attribute]
return dictionary
def flatten_multilists_attributes(data):
multilist_attrs = []
for attr in multilist_attrs:
try:
path = "data['" + "']['".join(elem for elem in attr) + "']"
current_val = eval(path)
flattened_val = ' '.join(elem for elem in current_val)
exec(path + '= flattened_val')
except BaseException:
pass
return data
def log_syslogd_override_setting(data, fos):
vdom = data['vdom']
log_syslogd_override_setting_data = data['log_syslogd_override_setting']
flattened_data = flatten_multilists_attributes(log_syslogd_override_setting_data)
filtered_data = filter_log_syslogd_override_setting_data(flattened_data)
return fos.set('log.syslogd',
'override-setting',
data=filtered_data,
vdom=vdom)
def fortios_log_syslogd(data, fos):
login(data)
if data['log_syslogd_override_setting']:
resp = log_syslogd_override_setting(data, fos)
fos.logout()
return not resp['status'] == "success", resp['status'] == "success", resp
def main():
fields = {
"host": {"required": True, "type": "str"},
"username": {"required": True, "type": "str"},
"password": {"required": False, "type": "str", "no_log": True},
"vdom": {"required": False, "type": "str", "default": "root"},
"https": {"required": False, "type": "bool", "default": True},
"log_syslogd_override_setting": {
"required": False, "type": "dict",
"options": {
"certificate": {"required": False, "type": "str"},
"custom-field-name": {"required": False, "type": "list",
"options": {
"custom": {"required": False, "type": "str"},
"id": {"required": True, "type": "int"},
"name": {"required": False, "type": "str"}
}},
"enc-algorithm": {"required": False, "type": "str",
"choices": ["high-medium", "high", "low",
"disable"]},
"facility": {"required": False, "type": "str",
"choices": ["kernel", "user", "mail",
"daemon", "auth", "syslog",
"lpr", "news", "uucp",
"cron", "authpriv", "ftp",
"ntp", "audit", "alert",
"clock", "local0", "local1",
"local2", "local3", "local4",
"local5", "local6", "local7"]},
"format": {"required": False, "type": "str",
"choices": ["default", "csv", "cef"]},
"mode": {"required": False, "type": "str",
"choices": ["udp", "legacy-reliable", "reliable"]},
"override": {"required": False, "type": "str",
"choices": ["enable", "disable"]},
"port": {"required": False, "type": "int"},
"server": {"required": False, "type": "str"},
"source-ip": {"required": False, "type": "str"},
"status": {"required": False, "type": "str",
"choices": ["enable", "disable"]}
}
}
}
module = AnsibleModule(argument_spec=fields,
supports_check_mode=False)
try:
from fortiosapi import FortiOSAPI
except ImportError:
module.fail_json(msg="fortiosapi module is required")
global fos
fos = FortiOSAPI()
is_error, has_changed, result = fortios_log_syslogd(module.params, fos)
if not is_error:
module.exit_json(changed=has_changed, meta=result)
else:
module.fail_json(msg="Error in repo", meta=result)
if __name__ == '__main__':
main()
| gpl-3.0 | [
3381,
2647,
15,
1393,
15,
1548,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
870,
63,
1593,
9,
199,
3,
1898,
20312,
30205,
10811,
12,
3277,
14,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
2859,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
3,
314,
1973,
675,
2366,
2050,
883,
664,
652,
340,
314,
2569,
365,
663,
315,
2195,
199,
3,
2622,
1101,
14,
199,
199,
363,
6577,
363,
275,
730,
199,
199,
8490,
63,
8314,
275,
791,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
297,
490,
283,
2343,
63,
1023,
356,
283,
17,
14,
17,
936,
199,
199,
8948,
275,
1449,
199,
2595,
199,
578,
26,
19516,
63,
793,
63,
16878,
68,
63,
4415,
63,
6031,
199,
3612,
63,
1802,
26,
11041,
2202,
367,
3982,
22112,
1654,
315,
30205,
10811,
1159,
22913,
436,
20306,
14,
199,
1802,
26,
272,
446,
961,
859,
365,
7688,
370,
7908,
282,
20306,
503,
22913,
701,
17266,
314,
489,
922,
370,
663,
436,
2811,
943,
63,
16878,
68,
3878,
436,
4278,
63,
6031,
4637,
14,
489,
6058,
2387,
1006,
2633,
436,
1338,
1929,
370,
506,
19477,
370,
29289,
83,
2544,
4503,
14,
489,
30568,
543,
481,
3100,
373,
22,
14,
16,
14,
18,
199,
1023,
63,
3270,
26,
298,
18,
14,
24,
2,
199,
2502,
26,
272,
446,
28195,
13086,
1626,
24920,
603,
324,
26051,
8593,
391,
32368,
26051,
27719,
90,
1895,
90,
9,
272,
446,
30650,
761,
305,
27864,
8593,
273,
676,
8445,
331,
9,
199,
5983,
26,
272,
446,
15127,
19516,
1246,
3555,
477,
27813,
701,
30205,
10811,
272,
446,
3378,
465,
282,
2257,
63,
1287,
315,
2195,
15695,
199,
7538,
26,
272,
446,
19516,
1246,
8119,
16,
14,
25,
14,
24,
199,
1419,
26,
272,
1591,
26,
2126,
1369,
26,
288,
446,
22913,
503,
20306,
3384,
2287,
14,
2126,
1415,
26,
2549,
272,
3434,
26,
267,
1369,
26,
288,
446,
22913,
503,
20306,
3434,
14,
267,
1415,
26,
2549,
272,
2505,
26,
267,
1369,
26,
288,
446,
22913,
503,
20306,
2505,
14,
267,
849,
26,
3087,
272,
20822,
26,
267,
1369,
26,
288,
446,
13311,
2881,
12,
16885,
5204,
3247,
10889,
14,
437,
20822,
365,
282,
1598,
5791,
1256,
402,
314,
20306,
626,
883,
506,
7526,
436,
1598,
1202,
465,
282,
3365,
4137,
14,
267,
849,
26,
1738,
272,
4178,
26,
267,
1369,
26,
288,
446,
19334,
340,
314,
4145,
28354,
20306,
1471,
675,
14147,
1598,
4113,
267,
730,
26,
2155,
267,
849,
26,
2549,
272,
943,
63,
16878,
68,
63,
4415,
63,
6031,
26,
267,
1369,
26,
288,
446,
11041,
2202,
367,
3982,
22112,
1654,
14,
267,
849,
26,
2973,
267,
26265,
26,
288,
5897,
26,
355,
1369,
26,
490,
446,
12904,
1202,
370,
26808,
543,
28766,
793,
1654,
14,
5800,
5897,
14,
1832,
14,
354,
14,
288,
3537,
13,
698,
13,
354,
26,
355,
1369,
26,
490,
446,
8388,
901,
536,
367,
445,
14153,
1475,
2050,
14,
355,
26265,
26,
490,
3537,
26,
717,
1369,
26,
1169,
446,
5024,
3537,
536,
14,
490,
1305,
26,
717,
1369,
26,
1169,
446,
11855,
2870,
14,
717,
1415,
26,
2549,
490,
536,
26,
717,
1369,
26,
1169,
446,
5024,
536,
14,
288,
12011,
13,
8833,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
32150,
984,
4806,
543,
12213,
14396,
14,
355,
3415,
26,
490,
446,
4721,
13,
14345,
490,
446,
4721,
490,
446,
6465,
490,
446,
3507,
288,
21395,
26,
355,
1369,
26,
490,
446,
17283,
22112,
21395,
14,
355,
3415,
26,
490,
446,
5114,
490,
446,
922,
490,
446,
6016,
490,
446,
11128,
490,
446,
1790,
490,
446,
22112,
490,
446,
634,
2700,
490,
446,
19497,
490,
446,
399,
947,
80,
490,
446,
19818,
490,
446,
1790,
10605,
490,
446,
14904,
490,
446,
28581,
490,
446,
13968,
490,
446,
10459,
490,
446,
12516,
490,
446,
2257,
16,
490,
446,
2257,
17,
490,
446,
2257,
18,
490,
446,
2257,
19,
490,
446,
2257,
20,
490,
446,
2257,
21,
490,
446,
2257,
22,
490,
446,
2257,
23,
288,
1475,
26,
355,
1369,
26,
490,
446,
5297,
1475,
14,
355,
3415,
26,
490,
446,
849,
490,
446,
7392,
490,
446,
286,
2829,
288,
818,
26,
355,
1369,
26,
490,
446,
17283,
22112,
2050,
1806,
21802,
15,
497,
317,
461,
13488,
14,
355,
3415,
26,
490,
446,
18419,
490,
446,
12139,
13,
26557,
461,
490,
446,
32150,
288,
4278,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
4278,
22112,
2202,
14,
355,
3415,
26,
490,
446,
4756,
490,
446,
3507,
288,
1844,
26,
355,
1369,
26,
490,
446,
7146,
6938,
1844,
14,
288,
1654,
26,
355,
1369,
26,
490,
446,
9906,
402,
3982,
22112,
1654,
14,
288,
1350,
13,
711,
26,
355,
1369,
26,
490,
446,
5800,
3531,
2287,
402,
22112,
14,
288,
2004,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
3982,
22112,
2050,
14,
355,
3415,
26,
490,
446,
4756,
490,
446,
3507,
199,
2344,
199,
199,
8918,
275,
1449,
199,
13,
7057,
26,
11667,
523,
6802,
26,
2043,
1591,
26,
298,
5756,
14,
6568,
14,
7507,
14,
2167,
2,
2043,
3434,
26,
298,
2113,
2,
2043,
2505,
26,
3087,
2043,
20822,
26,
298,
1231,
2,
523,
6527,
26,
523,
446,
536,
26,
11041,
2202,
367,
3982,
22112,
1654,
14,
272,
19516,
63,
793,
63,
16878,
68,
63,
4415,
63,
6031,
26,
489,
1591,
26
] | [
2647,
15,
1393,
15,
1548,
199,
504,
636,
2443,
363,
492,
334,
6116,
63,
646,
12,
4629,
12,
870,
63,
1593,
9,
199,
3,
1898,
20312,
30205,
10811,
12,
3277,
14,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
2859,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
3,
314,
1973,
675,
2366,
2050,
883,
664,
652,
340,
314,
2569,
365,
663,
315,
2195,
199,
3,
2622,
1101,
14,
199,
199,
363,
6577,
363,
275,
730,
199,
199,
8490,
63,
8314,
275,
791,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
297,
490,
283,
2343,
63,
1023,
356,
283,
17,
14,
17,
936,
199,
199,
8948,
275,
1449,
199,
2595,
199,
578,
26,
19516,
63,
793,
63,
16878,
68,
63,
4415,
63,
6031,
199,
3612,
63,
1802,
26,
11041,
2202,
367,
3982,
22112,
1654,
315,
30205,
10811,
1159,
22913,
436,
20306,
14,
199,
1802,
26,
272,
446,
961,
859,
365,
7688,
370,
7908,
282,
20306,
503,
22913,
701,
17266,
314,
489,
922,
370,
663,
436,
2811,
943,
63,
16878,
68,
3878,
436,
4278,
63,
6031,
4637,
14,
489,
6058,
2387,
1006,
2633,
436,
1338,
1929,
370,
506,
19477,
370,
29289,
83,
2544,
4503,
14,
489,
30568,
543,
481,
3100,
373,
22,
14,
16,
14,
18,
199,
1023,
63,
3270,
26,
298,
18,
14,
24,
2,
199,
2502,
26,
272,
446,
28195,
13086,
1626,
24920,
603,
324,
26051,
8593,
391,
32368,
26051,
27719,
90,
1895,
90,
9,
272,
446,
30650,
761,
305,
27864,
8593,
273,
676,
8445,
331,
9,
199,
5983,
26,
272,
446,
15127,
19516,
1246,
3555,
477,
27813,
701,
30205,
10811,
272,
446,
3378,
465,
282,
2257,
63,
1287,
315,
2195,
15695,
199,
7538,
26,
272,
446,
19516,
1246,
8119,
16,
14,
25,
14,
24,
199,
1419,
26,
272,
1591,
26,
2126,
1369,
26,
288,
446,
22913,
503,
20306,
3384,
2287,
14,
2126,
1415,
26,
2549,
272,
3434,
26,
267,
1369,
26,
288,
446,
22913,
503,
20306,
3434,
14,
267,
1415,
26,
2549,
272,
2505,
26,
267,
1369,
26,
288,
446,
22913,
503,
20306,
2505,
14,
267,
849,
26,
3087,
272,
20822,
26,
267,
1369,
26,
288,
446,
13311,
2881,
12,
16885,
5204,
3247,
10889,
14,
437,
20822,
365,
282,
1598,
5791,
1256,
402,
314,
20306,
626,
883,
506,
7526,
436,
1598,
1202,
465,
282,
3365,
4137,
14,
267,
849,
26,
1738,
272,
4178,
26,
267,
1369,
26,
288,
446,
19334,
340,
314,
4145,
28354,
20306,
1471,
675,
14147,
1598,
4113,
267,
730,
26,
2155,
267,
849,
26,
2549,
272,
943,
63,
16878,
68,
63,
4415,
63,
6031,
26,
267,
1369,
26,
288,
446,
11041,
2202,
367,
3982,
22112,
1654,
14,
267,
849,
26,
2973,
267,
26265,
26,
288,
5897,
26,
355,
1369,
26,
490,
446,
12904,
1202,
370,
26808,
543,
28766,
793,
1654,
14,
5800,
5897,
14,
1832,
14,
354,
14,
288,
3537,
13,
698,
13,
354,
26,
355,
1369,
26,
490,
446,
8388,
901,
536,
367,
445,
14153,
1475,
2050,
14,
355,
26265,
26,
490,
3537,
26,
717,
1369,
26,
1169,
446,
5024,
3537,
536,
14,
490,
1305,
26,
717,
1369,
26,
1169,
446,
11855,
2870,
14,
717,
1415,
26,
2549,
490,
536,
26,
717,
1369,
26,
1169,
446,
5024,
536,
14,
288,
12011,
13,
8833,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
32150,
984,
4806,
543,
12213,
14396,
14,
355,
3415,
26,
490,
446,
4721,
13,
14345,
490,
446,
4721,
490,
446,
6465,
490,
446,
3507,
288,
21395,
26,
355,
1369,
26,
490,
446,
17283,
22112,
21395,
14,
355,
3415,
26,
490,
446,
5114,
490,
446,
922,
490,
446,
6016,
490,
446,
11128,
490,
446,
1790,
490,
446,
22112,
490,
446,
634,
2700,
490,
446,
19497,
490,
446,
399,
947,
80,
490,
446,
19818,
490,
446,
1790,
10605,
490,
446,
14904,
490,
446,
28581,
490,
446,
13968,
490,
446,
10459,
490,
446,
12516,
490,
446,
2257,
16,
490,
446,
2257,
17,
490,
446,
2257,
18,
490,
446,
2257,
19,
490,
446,
2257,
20,
490,
446,
2257,
21,
490,
446,
2257,
22,
490,
446,
2257,
23,
288,
1475,
26,
355,
1369,
26,
490,
446,
5297,
1475,
14,
355,
3415,
26,
490,
446,
849,
490,
446,
7392,
490,
446,
286,
2829,
288,
818,
26,
355,
1369,
26,
490,
446,
17283,
22112,
2050,
1806,
21802,
15,
497,
317,
461,
13488,
14,
355,
3415,
26,
490,
446,
18419,
490,
446,
12139,
13,
26557,
461,
490,
446,
32150,
288,
4278,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
4278,
22112,
2202,
14,
355,
3415,
26,
490,
446,
4756,
490,
446,
3507,
288,
1844,
26,
355,
1369,
26,
490,
446,
7146,
6938,
1844,
14,
288,
1654,
26,
355,
1369,
26,
490,
446,
9906,
402,
3982,
22112,
1654,
14,
288,
1350,
13,
711,
26,
355,
1369,
26,
490,
446,
5800,
3531,
2287,
402,
22112,
14,
288,
2004,
26,
355,
1369,
26,
490,
446,
12030,
15,
5993,
3982,
22112,
2050,
14,
355,
3415,
26,
490,
446,
4756,
490,
446,
3507,
199,
2344,
199,
199,
8918,
275,
1449,
199,
13,
7057,
26,
11667,
523,
6802,
26,
2043,
1591,
26,
298,
5756,
14,
6568,
14,
7507,
14,
2167,
2,
2043,
3434,
26,
298,
2113,
2,
2043,
2505,
26,
3087,
2043,
20822,
26,
298,
1231,
2,
523,
6527,
26,
523,
446,
536,
26,
11041,
2202,
367,
3982,
22112,
1654,
14,
272,
19516,
63,
793,
63,
16878,
68,
63,
4415,
63,
6031,
26,
489,
1591,
26,
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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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
gdreich/geonode | geonode/geoserver/tests.py | 12 | 16664 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
import base64
import json
from django.contrib.auth import get_user_model
from django.http import HttpRequest
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from guardian.shortcuts import assign_perm, get_anonymous_user
from geonode.geoserver.helpers import OGC_Servers_Handler
from geonode.base.populate_test_data import create_models
from geonode.layers.populate_layers_data import create_layer_data
from geonode.layers.models import Layer
class LayerTests(TestCase):
fixtures = ['initial_data.json', 'bobby']
def setUp(self):
self.user = 'admin'
self.passwd = 'admin'
create_models(type='layer')
create_layer_data()
def test_style_manager(self):
"""
Ensures the layer_style_manage route returns a 200.
"""
layer = Layer.objects.all()[0]
bob = get_user_model().objects.get(username='bobby')
assign_perm('change_layer_style', bob, layer)
logged_in = self.client.login(username='bobby', password='bob')
self.assertEquals(logged_in, True)
response = self.client.get(reverse('layer_style_manage', args=(layer.typename,)))
self.assertEqual(response.status_code, 200)
def test_feature_edit_check(self):
"""Verify that the feature_edit_check view is behaving as expected
"""
# Setup some layer names to work with
valid_layer_typename = Layer.objects.all()[0].typename
Layer.objects.all()[0].set_default_permissions()
invalid_layer_typename = "n0ch@nc3"
# Test that an invalid layer.typename is handled for properly
response = self.client.post(
reverse(
'feature_edit_check',
args=(
invalid_layer_typename,
)))
self.assertEquals(response.status_code, 404)
# First test un-authenticated
response = self.client.post(
reverse(
'feature_edit_check',
args=(
valid_layer_typename,
)))
response_json = json.loads(response.content)
self.assertEquals(response_json['authorized'], False)
# Next Test with a user that does NOT have the proper perms
logged_in = self.client.login(username='bobby', password='bob')
self.assertEquals(logged_in, True)
response = self.client.post(
reverse(
'feature_edit_check',
args=(
valid_layer_typename,
)))
response_json = json.loads(response.content)
self.assertEquals(response_json['authorized'], False)
# Login as a user with the proper permission and test the endpoint
logged_in = self.client.login(username='admin', password='admin')
self.assertEquals(logged_in, True)
response = self.client.post(
reverse(
'feature_edit_check',
args=(
valid_layer_typename,
)))
# Test that the method returns 401 because it's not a datastore
response_json = json.loads(response.content)
self.assertEquals(response_json['authorized'], False)
layer = Layer.objects.all()[0]
layer.storeType = "dataStore"
layer.save()
# Test that the method returns authorized=True if it's a datastore
if settings.OGC_SERVER['default']['DATASTORE']:
# The check was moved from the template into the view
response = self.client.post(
reverse(
'feature_edit_check',
args=(
valid_layer_typename,
)))
response_json = json.loads(response.content)
self.assertEquals(response_json['authorized'], True)
def test_layer_acls(self):
""" Verify that the layer_acls view is behaving as expected
"""
# Test that HTTP_AUTHORIZATION in request.META is working properly
valid_uname_pw = '%s:%s' % ('bobby', 'bob')
invalid_uname_pw = '%s:%s' % ('n0t', 'v@l1d')
valid_auth_headers = {
'HTTP_AUTHORIZATION': 'basic ' + base64.b64encode(valid_uname_pw),
}
invalid_auth_headers = {
'HTTP_AUTHORIZATION': 'basic ' +
base64.b64encode(invalid_uname_pw),
}
bob = get_user_model().objects.get(username='bobby')
layer_ca = Layer.objects.get(typename='geonode:CA')
assign_perm('change_layer_data', bob, layer_ca)
# Test that requesting when supplying the geoserver credentials returns
# the expected json
expected_result = {
u'email': u'bobby@bob.com',
u'fullname': u'bobby',
u'is_anonymous': False,
u'is_superuser': False,
u'name': u'bobby',
u'ro': [u'geonode:layer2',
u'geonode:mylayer',
u'geonode:foo',
u'geonode:whatever',
u'geonode:fooey',
u'geonode:quux',
u'geonode:fleem'],
u'rw': [u'geonode:CA']
}
response = self.client.get(reverse('layer_acls'), **valid_auth_headers)
response_json = json.loads(response.content)
# 'ro' and 'rw' are unsorted collections
self.assertEquals(sorted(expected_result), sorted(response_json))
# Test that requesting when supplying invalid credentials returns the
# appropriate error code
response = self.client.get(reverse('layer_acls'), **invalid_auth_headers)
self.assertEquals(response.status_code, 401)
# Test logging in using Djangos normal auth system
self.client.login(username='admin', password='admin')
# Basic check that the returned content is at least valid json
response = self.client.get(reverse('layer_acls'))
response_json = json.loads(response.content)
self.assertEquals('admin', response_json['fullname'])
self.assertEquals('', response_json['email'])
# TODO Lots more to do here once jj0hns0n understands the ACL system
# better
def test_resolve_user(self):
"""Verify that the resolve_user view is behaving as expected
"""
# Test that HTTP_AUTHORIZATION in request.META is working properly
valid_uname_pw = "%s:%s" % ('admin', 'admin')
invalid_uname_pw = "%s:%s" % ("n0t", "v@l1d")
valid_auth_headers = {
'HTTP_AUTHORIZATION': 'basic ' + base64.b64encode(valid_uname_pw),
}
invalid_auth_headers = {
'HTTP_AUTHORIZATION': 'basic ' +
base64.b64encode(invalid_uname_pw),
}
response = self.client.get(reverse('layer_resolve_user'), **valid_auth_headers)
response_json = json.loads(response.content)
self.assertEquals({'geoserver': False,
'superuser': True,
'user': 'admin',
'fullname': 'admin',
'email': ''},
response_json)
# Test that requesting when supplying invalid credentials returns the
# appropriate error code
response = self.client.get(reverse('layer_acls'), **invalid_auth_headers)
self.assertEquals(response.status_code, 401)
# Test logging in using Djangos normal auth system
self.client.login(username='admin', password='admin')
# Basic check that the returned content is at least valid json
response = self.client.get(reverse('layer_resolve_user'))
response_json = json.loads(response.content)
self.assertEquals('admin', response_json['user'])
self.assertEquals('admin', response_json['fullname'])
self.assertEquals('', response_json['email'])
class UtilsTests(TestCase):
def setUp(self):
self.OGC_DEFAULT_SETTINGS = {
'default': {
'BACKEND': 'geonode.geoserver',
'LOCATION': 'http://localhost:8080/geoserver/',
'USER': 'admin',
'PASSWORD': 'geoserver',
'MAPFISH_PRINT_ENABLED': True,
'PRINT_NG_ENABLED': True,
'GEONODE_SECURITY_ENABLED': True,
'GEOGIG_ENABLED': False,
'WMST_ENABLED': False,
'BACKEND_WRITE_ENABLED': True,
'WPS_ENABLED': False,
'DATASTORE': str(),
'GEOGIG_DATASTORE_DIR': str(),
}
}
self.UPLOADER_DEFAULT_SETTINGS = {
'BACKEND': 'geonode.rest',
'OPTIONS': {
'TIME_ENABLED': False,
'MOSAIC_ENABLED': False,
'GEOGIG_ENABLED': False}}
self.DATABASE_DEFAULT_SETTINGS = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'development.db'}}
def test_ogc_server_settings(self):
"""
Tests the OGC Servers Handler class.
"""
with override_settings(OGC_SERVER=self.OGC_DEFAULT_SETTINGS, UPLOADER=self.UPLOADER_DEFAULT_SETTINGS):
OGC_SERVER = self.OGC_DEFAULT_SETTINGS.copy()
OGC_SERVER.update(
{'PUBLIC_LOCATION': 'http://localhost:8080/geoserver/'})
ogc_settings = OGC_Servers_Handler(OGC_SERVER)['default']
default = OGC_SERVER.get('default')
self.assertEqual(ogc_settings.server, default)
self.assertEqual(ogc_settings.BACKEND, default.get('BACKEND'))
self.assertEqual(ogc_settings.LOCATION, default.get('LOCATION'))
self.assertEqual(
ogc_settings.PUBLIC_LOCATION,
default.get('PUBLIC_LOCATION'))
self.assertEqual(ogc_settings.USER, default.get('USER'))
self.assertEqual(ogc_settings.PASSWORD, default.get('PASSWORD'))
self.assertEqual(ogc_settings.DATASTORE, str())
self.assertEqual(ogc_settings.credentials, ('admin', 'geoserver'))
self.assertTrue(ogc_settings.MAPFISH_PRINT_ENABLED)
self.assertTrue(ogc_settings.PRINT_NG_ENABLED)
self.assertTrue(ogc_settings.GEONODE_SECURITY_ENABLED)
self.assertFalse(ogc_settings.GEOGIG_ENABLED)
self.assertFalse(ogc_settings.WMST_ENABLED)
self.assertTrue(ogc_settings.BACKEND_WRITE_ENABLED)
self.assertFalse(ogc_settings.WPS_ENABLED)
def test_ogc_server_defaults(self):
"""
Tests that OGC_SERVER_SETTINGS are built if they do not exist in the settings.
"""
OGC_SERVER = {'default': dict()}
defaults = self.OGC_DEFAULT_SETTINGS.get('default')
ogc_settings = OGC_Servers_Handler(OGC_SERVER)['default']
self.assertEqual(ogc_settings.server, defaults)
self.assertEqual(ogc_settings.rest, defaults['LOCATION'] + 'rest')
self.assertEqual(ogc_settings.ows, defaults['LOCATION'] + 'ows')
# Make sure we get None vs a KeyError when the key does not exist
self.assertIsNone(ogc_settings.SFDSDFDSF)
def test_importer_configuration(self):
"""
Tests that the OGC_Servers_Handler throws an ImproperlyConfigured exception when using the importer
backend without a vector database and a datastore configured.
"""
database_settings = self.DATABASE_DEFAULT_SETTINGS.copy()
ogc_server_settings = self.OGC_DEFAULT_SETTINGS.copy()
uploader_settings = self.UPLOADER_DEFAULT_SETTINGS.copy()
uploader_settings['BACKEND'] = 'geonode.importer'
self.assertTrue(['geonode_imports' not in database_settings.keys()])
with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
# Test the importer backend without specifying a datastore or
# corresponding database.
with self.assertRaises(ImproperlyConfigured):
OGC_Servers_Handler(ogc_server_settings)['default']
ogc_server_settings['default']['DATASTORE'] = 'geonode_imports'
# Test the importer backend with a datastore but no corresponding
# database.
with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
with self.assertRaises(ImproperlyConfigured):
OGC_Servers_Handler(ogc_server_settings)['default']
database_settings['geonode_imports'] = database_settings[
'default'].copy()
database_settings['geonode_imports'].update(
{'NAME': 'geonode_imports'})
# Test the importer backend with a datastore and a corresponding
# database, no exceptions should be thrown.
with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
OGC_Servers_Handler(ogc_server_settings)['default']
class SecurityTest(TestCase):
"""
Tests for the Geonode security app.
"""
def setUp(self):
self.admin, created = get_user_model().objects.get_or_create(
username='admin', password='admin', is_superuser=True)
def test_login_middleware(self):
"""
Tests the Geonode login required authentication middleware.
"""
from geonode.security.middleware import LoginRequiredMiddleware
middleware = LoginRequiredMiddleware()
white_list = [
reverse('account_ajax_login'),
reverse('account_confirm_email', kwargs=dict(key='test')),
reverse('account_login'),
reverse('account_password_reset'),
reverse('forgot_username'),
reverse('layer_acls'),
reverse('layer_resolve_user'),
]
black_list = [
reverse('account_signup'),
reverse('document_browse'),
reverse('maps_browse'),
reverse('layer_browse'),
reverse('layer_detail', kwargs=dict(layername='geonode:Test')),
reverse('layer_remove', kwargs=dict(layername='geonode:Test')),
reverse('profile_browse'),
]
request = HttpRequest()
request.user = get_anonymous_user()
# Requests should be redirected to the the `redirected_to` path when un-authenticated user attempts to visit
# a black-listed url.
for path in black_list:
request.path = path
response = middleware.process_request(request)
self.assertEqual(response.status_code, 302)
self.assertTrue(
response.get('Location').startswith(
middleware.redirect_to))
# The middleware should return None when an un-authenticated user
# attempts to visit a white-listed url.
for path in white_list:
request.path = path
response = middleware.process_request(request)
self.assertIsNone(
response,
msg="Middleware activated for white listed path: {0}".format(path))
self.client.login(username='admin', password='admin')
self.assertTrue(self.admin.is_authenticated())
request.user = self.admin
# The middleware should return None when an authenticated user attempts
# to visit a black-listed url.
for path in black_list:
request.path = path
response = middleware.process_request(request)
self.assertIsNone(response)
| gpl-3.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3949,
3,
199,
3,
199,
3,
1898,
334,
35,
9,
7800,
4403,
10748,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
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,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
3949,
3,
199,
199,
646,
1300,
772,
199,
646,
2022,
199,
199,
504,
1639,
14,
2828,
14,
1178,
492,
664,
63,
751,
63,
1238,
199,
504,
1639,
14,
1014,
492,
20730,
199,
504,
1639,
14,
1018,
14,
3924,
492,
11897,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
396,
492,
7640,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
396,
14,
1208,
492,
4278,
63,
1751,
199,
199,
504,
8129,
31186,
14,
17469,
492,
5090,
63,
8220,
12,
664,
63,
12628,
63,
751,
199,
199,
504,
2312,
29118,
14,
6721,
1000,
14,
7546,
492,
593,
7484,
63,
23637,
63,
2461,
199,
504,
2312,
29118,
14,
1095,
14,
13817,
63,
396,
63,
576,
492,
1218,
63,
992,
199,
504,
2312,
29118,
14,
4359,
14,
13817,
63,
4359,
63,
576,
492,
1218,
63,
1897,
63,
576,
199,
504,
2312,
29118,
14,
4359,
14,
992,
492,
11915,
421,
199,
533,
11915,
2925,
8,
1746,
304,
339,
15188,
275,
788,
2747,
63,
576,
14,
1001,
297,
283,
7913,
991,
418,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
751,
275,
283,
2113,
7,
267,
291,
14,
12671,
275,
283,
2113,
7,
267,
1218,
63,
992,
8,
466,
534,
1897,
358,
267,
1218,
63,
1897,
63,
576,
342,
339,
347,
511,
63,
2487,
63,
2609,
8,
277,
304,
267,
408,
267,
29652,
314,
4045,
63,
2487,
63,
9053,
7475,
2529,
282,
1926,
14,
267,
408,
267,
4045,
275,
11915,
14,
1462,
14,
452,
3430,
16,
61,
398,
26961,
275,
664,
63,
751,
63,
1238,
1252,
1462,
14,
362,
8,
2473,
534,
7913,
991,
358,
267,
5090,
63,
8220,
360,
1461,
63,
1897,
63,
2487,
297,
26961,
12,
4045,
9,
398,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
7913,
991,
297,
2505,
534,
7913,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
267,
1177,
275,
291,
14,
1258,
14,
362,
8,
4471,
360,
1897,
63,
2487,
63,
9053,
297,
1249,
2687,
1897,
14,
18596,
20097,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
1926,
9,
339,
347,
511,
63,
4445,
63,
3773,
63,
1074,
8,
277,
304,
267,
408,
7496,
626,
314,
3878,
63,
3773,
63,
1074,
2455,
365,
15179,
5519,
465,
1420,
267,
408,
398,
327,
12439,
2005,
4045,
1561,
370,
1736,
543,
267,
1686,
63,
1897,
63,
18596,
275,
11915,
14,
1462,
14,
452,
3430,
16,
1055,
18596,
267,
11915,
14,
1462,
14,
452,
3430,
16,
1055,
409,
63,
885,
63,
6060,
342,
267,
3866,
63,
1897,
63,
18596,
275,
298,
78,
16,
335,
32,
7966,
19,
2,
398,
327,
1379,
626,
376,
3866,
4045,
14,
18596,
365,
8860,
367,
7684,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
3866,
63,
1897,
63,
18596,
12,
355,
23183,
267,
291,
14,
2947,
8,
1310,
14,
1205,
63,
600,
12,
7901,
9,
398,
327,
7758,
511,
625,
13,
12177,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
327,
16840,
1379,
543,
282,
922,
626,
1630,
2845,
1172,
314,
5576,
17340,
267,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
7913,
991,
297,
2505,
534,
7913,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
327,
16430,
465,
282,
922,
543,
314,
5576,
4983,
436,
511,
314,
6037,
267,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
2113,
297,
2505,
534,
2113,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
398,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
398,
327,
1379,
626,
314,
1083,
2529,
13952,
2952,
652,
1159,
440,
282,
12007,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
4045,
275,
11915,
14,
1462,
14,
452,
3430,
16,
61,
267,
4045,
14,
1617,
804,
275,
298,
576,
5502,
2,
267,
4045,
14,
2117,
342,
398,
327,
1379,
626,
314,
1083,
2529,
18788,
29,
549,
340,
652,
1159,
282,
12007,
267,
340,
2202,
14,
47,
7484,
63,
6613,
459,
885,
2545,
3998,
16169,
2565,
288,
327,
710,
1104,
1990,
12155,
687,
314,
1978,
1901,
314,
2455,
288,
1177,
275,
291,
14,
1258
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3949,
3,
199,
3,
199,
3,
1898,
334,
35,
9,
7800,
4403,
10748,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
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,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
3949,
3,
199,
199,
646,
1300,
772,
199,
646,
2022,
199,
199,
504,
1639,
14,
2828,
14,
1178,
492,
664,
63,
751,
63,
1238,
199,
504,
1639,
14,
1014,
492,
20730,
199,
504,
1639,
14,
1018,
14,
3924,
492,
11897,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
396,
492,
7640,
199,
504,
1639,
14,
1018,
14,
16522,
492,
3837,
199,
504,
1639,
14,
396,
14,
1208,
492,
4278,
63,
1751,
199,
199,
504,
8129,
31186,
14,
17469,
492,
5090,
63,
8220,
12,
664,
63,
12628,
63,
751,
199,
199,
504,
2312,
29118,
14,
6721,
1000,
14,
7546,
492,
593,
7484,
63,
23637,
63,
2461,
199,
504,
2312,
29118,
14,
1095,
14,
13817,
63,
396,
63,
576,
492,
1218,
63,
992,
199,
504,
2312,
29118,
14,
4359,
14,
13817,
63,
4359,
63,
576,
492,
1218,
63,
1897,
63,
576,
199,
504,
2312,
29118,
14,
4359,
14,
992,
492,
11915,
421,
199,
533,
11915,
2925,
8,
1746,
304,
339,
15188,
275,
788,
2747,
63,
576,
14,
1001,
297,
283,
7913,
991,
418,
339,
347,
3613,
8,
277,
304,
267,
291,
14,
751,
275,
283,
2113,
7,
267,
291,
14,
12671,
275,
283,
2113,
7,
267,
1218,
63,
992,
8,
466,
534,
1897,
358,
267,
1218,
63,
1897,
63,
576,
342,
339,
347,
511,
63,
2487,
63,
2609,
8,
277,
304,
267,
408,
267,
29652,
314,
4045,
63,
2487,
63,
9053,
7475,
2529,
282,
1926,
14,
267,
408,
267,
4045,
275,
11915,
14,
1462,
14,
452,
3430,
16,
61,
398,
26961,
275,
664,
63,
751,
63,
1238,
1252,
1462,
14,
362,
8,
2473,
534,
7913,
991,
358,
267,
5090,
63,
8220,
360,
1461,
63,
1897,
63,
2487,
297,
26961,
12,
4045,
9,
398,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
7913,
991,
297,
2505,
534,
7913,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
267,
1177,
275,
291,
14,
1258,
14,
362,
8,
4471,
360,
1897,
63,
2487,
63,
9053,
297,
1249,
2687,
1897,
14,
18596,
20097,
267,
291,
14,
629,
8,
1310,
14,
1205,
63,
600,
12,
1926,
9,
339,
347,
511,
63,
4445,
63,
3773,
63,
1074,
8,
277,
304,
267,
408,
7496,
626,
314,
3878,
63,
3773,
63,
1074,
2455,
365,
15179,
5519,
465,
1420,
267,
408,
398,
327,
12439,
2005,
4045,
1561,
370,
1736,
543,
267,
1686,
63,
1897,
63,
18596,
275,
11915,
14,
1462,
14,
452,
3430,
16,
1055,
18596,
267,
11915,
14,
1462,
14,
452,
3430,
16,
1055,
409,
63,
885,
63,
6060,
342,
267,
3866,
63,
1897,
63,
18596,
275,
298,
78,
16,
335,
32,
7966,
19,
2,
398,
327,
1379,
626,
376,
3866,
4045,
14,
18596,
365,
8860,
367,
7684,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
3866,
63,
1897,
63,
18596,
12,
355,
23183,
267,
291,
14,
2947,
8,
1310,
14,
1205,
63,
600,
12,
7901,
9,
398,
327,
7758,
511,
625,
13,
12177,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
327,
16840,
1379,
543,
282,
922,
626,
1630,
2845,
1172,
314,
5576,
17340,
267,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
7913,
991,
297,
2505,
534,
7913,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
267,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
327,
16430,
465,
282,
922,
543,
314,
5576,
4983,
436,
511,
314,
6037,
267,
10367,
63,
262,
275,
291,
14,
1258,
14,
2886,
8,
2473,
534,
2113,
297,
2505,
534,
2113,
358,
267,
291,
14,
2947,
8,
12419,
63,
262,
12,
715,
9,
398,
1177,
275,
291,
14,
1258,
14,
1932,
8,
288,
3837,
8,
355,
283,
4445,
63,
3773,
63,
1074,
297,
355,
1249,
2687,
490,
1686,
63,
1897,
63,
18596,
12,
355,
23183,
398,
327,
1379,
626,
314,
1083,
2529,
13952,
2952,
652,
1159,
440,
282,
12007,
267,
1177,
63,
1001,
275,
2022,
14,
3640,
8,
1310,
14,
1317,
9,
267,
291,
14,
2947,
8,
1310,
63,
1001,
459,
11497,
995,
756,
9,
398,
4045,
275,
11915,
14,
1462,
14,
452,
3430,
16,
61,
267,
4045,
14,
1617,
804,
275,
298,
576,
5502,
2,
267,
4045,
14,
2117,
342,
398,
327,
1379,
626,
314,
1083,
2529,
18788,
29,
549,
340,
652,
1159,
282,
12007,
267,
340,
2202,
14,
47,
7484,
63,
6613,
459,
885,
2545,
3998,
16169,
2565,
288,
327,
710,
1104,
1990,
12155,
687,
314,
1978,
1901,
314,
2455,
288,
1177,
275,
291,
14,
1258,
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,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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
] |
alexei-matveev/ccp1gui | jobmanager/slaveprocess.py | 1 | 12014 | """
This collection of routines are alternatives to those
in subprocess.py but which create additional controlling
threads.
Since this feature is not needed in the GUI as a separate thread
is spawned of to handle each job they are no longer needed,
but retained for possible future use.
"""
import os,sys
if __name__ == "__main__":
# Need to add the gui directory to the python path so
# that all the modules can be imported
gui_path = os.path.split(os.path.dirname( os.path.realpath( __file__ ) ))[0]
sys.path.append(gui_path)
import threading
import subprocess
import time
import Queue
import unittest
import ccp1gui_subprocess
class SlavePipe(ccp1gui_subprocess.SubProcess):
"""Spawn a thread which then uses a pipe to run the commmand
This method runs the requested command in a subthread
the wait method can be used to check progress
however there is no kill available (no child pid)
... maybe there is a way to destroy the thread together with the child??
for consistency with spawn it would be ideal if stdin,out,err could
be provided to route these streams, at the moment they are echoed and saved in.
"""
def __init__(self,cmd,**kw):
ccp1gui_subprocess.SubProcess.__init__(self,cmd,**kw)
def run(self):
# create a Lock
self.lock = threading.RLock()
# Create the queues
self.queue = Queue.Queue()
self.status = ccp1gui_subprocess.SLAVE_PIPE
self.slavethread = SlaveThread(self.lock, self.queue, None, self.__slave_pipe_proc)
if self.debug:
print t.time(),'SlavePipe: slave thread starting'
self.slavethread.start()
if self.debug:
print t.time(),'SlavePipe thread started'
def wait(self,timeout=None):
"""Wait.. """
count = 0
if timeout:
tester = timeout
incr = 1
else:
tester = 1
incr = 0
while count < tester:
if timeout:
count = count + incr
try:
tt = self.queue.get(0)
if tt == ccp1gui_subprocess.CHILD_STDOUT:
tt2 = self.queue.get(0)
for x in tt2:
self.output.append(x)
print 'stdout>',x,
elif tt == ccp1gui_subprocess.CHILD_STDERR:
tt2 = self.queue.get(0)
for x in tt2:
self.err.append(x)
print 'stderr>',x,
elif tt == ccp1gui_subprocess.CHILD_EXITS:
code = self.queue.get(0)
if self.debug:
print t.time(),'done'
return code
except Queue.Empty:
if self.debug:
print t.time(), 'queue from slave empty, sleep .1'
time.sleep(0.1)
#print t.time(),'wait timed out'
def kill(self):
"""(not implemented) """
if self.debug:
print t.time(), 'kill'
print 'kill not available for SlavePipe class'
def get_output(self):
"""Retrieve any pending data on the pipe to the slave process """
while 1:
try:
tt = self.queue.get(0)
if tt == ccp1gui_subprocess.CHILD_STDOUT:
tt2 = self.queue.get(0)
for x in tt2:
self.output.append(x)
print 'stdout>',x,
elif tt == ccp1gui_subprocess.CHILD_STDERR:
tt2 = self.queue.get(0)
for x in tt2:
self.err.append(x)
print 'stderr>',x,
elif tt == ccp1gui_subprocess.CHILD_EXITS:
code = self.queue.get(0)
if self.debug:
print t.time(),'done'
return code
except Queue.Empty:
break
return self.output
def __slave_pipe_proc(self,lock,queue,queue1):
""" this is the code executed in the slave thread when a
(foreground) pipe is required
will return stdout and stderr over the queue
queue1 is not used
"""
cmd = self.cmd_as_string()
if self.debug:
print t.time(), 'invoke command',cmd
#(stdin,stdout,stderr) = os.popen3(cmd)
p =subprocess.Popen(cmd,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
(stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
if self.debug:
print t.time(),'command exits'
while 1:
if self.debug:
print t.time(),'read out'
txt = stdout.readlines()
if txt:
if self.debug:
print t.time(),'read out returns', txt[0],' etc'
queue.put(ccp1gui_subprocess.CHILD_STDOUT)
queue.put(txt)
else:
if self.debug:
print 'out is none'
txt2 = stderr.readlines()
if txt2:
if self.debug:
print t.time(),'read err returns', txt2[0],' etc'
queue.put(CHILD_STDERR)
queue.put(txt2)
else:
if self.debug:
print 'err is none'
if not txt or not txt2:
break
status = stdout.close()
if self.debug:
print 'stdout close status',status
status = stdin.close()
if self.debug:
print 'stdin close status',status
status = stderr.close()
if self.debug:
print 'stderr close status',status
if self.debug:
print t.time(),'put to close:', ccp1gui_subprocess.CHILD_EXITS
queue.put(ccp1gui_subprocess.CHILD_EXITS)
code = 0
queue.put(code)
class SlaveSpawn(ccp1gui_subprocess.SubProcess):
"""Use a pythonwin process or fork with controlling thread
2 queues connect launching thread to control thread
issues ...
spawn will need its streams, part
"""
def __init__(self,cmd,**kw):
ccp1gui_subprocess.SubProcess.__init__(self,cmd,**kw)
def run(self,stdin=None,stdout=None,stderr=None):
self.stdin=stdin
self.stdout=stdout
self.stderr=stderr
# create a Lock
self.lock = threading.RLock()
# Create the queues
self.queue = Queue.Queue()
self.queue1 = Queue.Queue()
self.status = ccp1gui_subprocess.SLAVE_SPAWN
self.slavethread = SlaveThread(self.lock, self.queue ,self.queue1,self.__slave_spawn_proc)
if self.debug:
print t.time(),'threadedSpawn: slave thread starting'
self.slavethread.start()
if self.debug:
print t.time(),'threadedSpawn returns'
def kill(self):
"""pass kill signal to controlling thread """
if self.debug:
print t.time(), 'queue.put ',ccp1gui_subprocess.KILL_CHILD
self.queue1.put(ccp1gui_subprocess.KILL_CHILD)
def __slave_spawn_proc(self,loc,queue,queue1):
""" this is the code executed in the slave thread
when a (background) spawn/fork is required
will return stdout and stderr over the queue
"""
if self.debug:
print t.time(), 'slave spawning', self.cmd_as_string()
self._spawn_child()
while 1:
if self.debug:
print t.time(),'check loop'
# check status of child
# this should return immediately
code = self._wait_child(timeout=0)
if self.debug:
print t.time(),'check code',code
if code != 999:
# child has exited pass back return code
queue.put(ccp1gui_subprocess.CHILD_EXITS)
queue.put(code)
# Attempt to execute any termination code
if self.on_end:
self.on_end()
break
# check for intervention
try:
if self.debug:
print t.time(), 'slave get'
tt = queue1.get(0)
if self.debug:
print t.time(), 'slave gets message for child', tt
if tt == ccp1gui_subprocess.KILL_CHILD:
code = self._kill_child()
break
except Queue.Empty:
if self.debug:
print t.time(), 'no child message sleeping'
time.sleep(0.1)
queue.put(ccp1gui_subprocess.CHILD_EXITS)
queue.put(code)
#
# Currently these are not set up
# here (cf the popen3 based one)
#
#status = stdout.close()
#status = stdin.close()
#status = stderr.close()
def wait(self,timeout=None):
"""wait for process to finish """
if self.debug:
print t.time(), 'wait'
count = 0
if timeout:
tester = timeout
incr = 1
else:
tester = 1
incr = 0
while count < tester:
if timeout:
count = count + incr
try:
tt = self.queue.get(0)
if tt == ccp1gui_subprocess.CHILD_STDOUT:
tt2 = self.queue.get(0)
for x in tt2:
print 'stdout>',x,
elif tt == ccp1gui_subprocess.CHILD_STDERR:
tt2 = self.queue.get(0)
for x in tt2:
print 'stderr>',x,
elif tt == ccp1gui_subprocess.CHILD_EXITS:
code = self.queue.get(0)
if self.debug:
print t.time(),'done'
return code
except Queue.Empty:
if self.debug:
print t.time(), 'queue from slave empty, sleep .1'
time.sleep(0.1)
#print t.time(),'wait timed out'
class SlaveThread(threading.Thread):
"""The slave thread runs separate thread
For control it has
- a lock (not used at the moment)
- a queue object to communicate with the GUI thread
- a procedure to run
"""
def __init__(self,lock,queue,queue1,proc):
threading.Thread.__init__(self,None,None,"JobMan")
self.lock = lock
self.queue = queue
self.queue1 = queue1
self.proc = proc
def run(self):
""" call the specified procedure"""
try:
code = self.proc(self.lock,self.queue,self.queue1)
except RuntimeError, e:
self.queue.put(ccp1gui_subprocess.RUNTIME_ERROR)
##########################################################
#
#
# Unittesting stuff goes here
#
#
##########################################################
class testSlaveSpawn(unittest.TestCase):
"""fork/pythonwin process management with extra process"""
# this is not longer needed for GUI operation
# it also has not been adapted to take cmd + args separately
# however it does seem to work
def testA(self):
"""check echo on local host using stdout redirection"""
self.proc = SlaveSpawn('echo a b',debug=0)
o = open('test.out','w')
self.proc.run(stdout=o)
self.proc.wait()
o.close()
o = open('test.out','r')
output = o.readlines()
print 'output=',output
self.assertEqual(output,['a b\n'])
if __name__ == "__main__":
# Run all tests automatically
unittest.main()
| gpl-2.0 | [
624,
199,
2765,
3245,
402,
14975,
787,
8679,
10661,
370,
5204,
199,
262,
3873,
14,
647,
1325,
1314,
1218,
4722,
30350,
199,
6962,
14,
199,
199,
24430,
642,
3878,
365,
440,
4346,
315,
314,
17160,
465,
282,
7396,
2462,
199,
374,
15187,
379,
402,
370,
2429,
1924,
3906,
2985,
787,
949,
8088,
4346,
12,
199,
7911,
30403,
367,
3962,
6466,
675,
14,
199,
199,
624,
199,
646,
747,
12,
1274,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
327,
14012,
370,
1050,
314,
11621,
2082,
370,
314,
2366,
931,
880,
5591,
327,
626,
1006,
314,
4621,
883,
506,
8439,
272,
11621,
63,
515,
275,
747,
14,
515,
14,
1294,
8,
736,
14,
515,
14,
3475,
8,
747,
14,
515,
14,
11091,
8,
636,
493,
363,
776,
5082,
59,
16,
61,
272,
984,
14,
515,
14,
740,
8,
5885,
63,
515,
9,
199,
199,
646,
5796,
199,
646,
3873,
199,
646,
900,
199,
646,
10703,
199,
646,
2882,
199,
199,
646,
286,
1850,
17,
5885,
63,
5781,
199,
199,
533,
428,
8007,
11867,
8,
67,
1850,
17,
5885,
63,
5781,
14,
2610,
3498,
304,
339,
408,
12739,
3501,
282,
2462,
1314,
2066,
4440,
282,
5200,
370,
1255,
314,
1923,
10333,
272,
961,
1083,
7858,
314,
5839,
1414,
315,
282,
1007,
2671,
272,
314,
3618,
1083,
883,
506,
1202,
370,
1104,
6696,
272,
13432,
2337,
365,
949,
14561,
2808,
334,
889,
1982,
4422,
9,
272,
2263,
11703,
2337,
365,
282,
4340,
370,
11972,
314,
2462,
10451,
543,
314,
1982,
10674,
339,
367,
17754,
543,
15187,
652,
3955,
506,
28264,
340,
9009,
12,
548,
12,
1508,
4293,
272,
506,
2741,
370,
7475,
3520,
13788,
12,
737,
314,
12427,
2985,
787,
11343,
379,
436,
6290,
315,
14,
339,
408,
272,
347,
636,
826,
721,
277,
12,
1760,
12663,
829,
304,
267,
286,
1850,
17,
5885,
63,
5781,
14,
2610,
3498,
855,
826,
721,
277,
12,
1760,
12663,
829,
9,
339,
347,
1255,
8,
277,
304,
398,
327,
1218,
282,
15536,
267,
291,
14,
831,
221,
275,
5796,
14,
30550,
342,
398,
327,
2790,
314,
21366,
267,
291,
14,
1825,
275,
10703,
14,
3737,
342,
398,
291,
14,
1205,
275,
286,
1850,
17,
5885,
63,
5781,
14,
4929,
26907,
63,
6089,
267,
291,
14,
12384,
2671,
275,
428,
8007,
4436,
8,
277,
14,
831,
12,
291,
14,
1825,
12,
488,
12,
291,
855,
12384,
63,
4990,
63,
4687,
9,
398,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
7,
28950,
11867,
26,
15494,
2462,
6617,
7,
267,
291,
14,
12384,
2671,
14,
928,
342,
267,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
7,
28950,
11867,
2462,
8239,
7,
339,
347,
3618,
8,
277,
12,
2593,
29,
403,
304,
267,
408,
7536,
703,
221,
408,
267,
2338,
275,
378,
267,
340,
2653,
26,
288,
17570,
275,
2653,
288,
315,
1556,
275,
413,
267,
587,
26,
288,
17570,
275,
413,
288,
315,
1556,
275,
378,
398,
1830,
2338,
665,
17570,
26,
288,
340,
2653,
26,
355,
2338,
275,
2338,
435,
315,
1556,
953,
862,
26,
355,
13638,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
355,
340,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
13850,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1199,
14,
740,
8,
88,
9,
717,
870,
221,
283,
2703,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
18472,
2666,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1508,
14,
740,
8,
88,
9,
717,
870,
221,
283,
3083,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
1438,
5930,
26,
490,
1233,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
340,
291,
14,
1757,
26,
717,
870,
307,
14,
521,
1062,
7,
4456,
7,
490,
372,
1233,
953,
871,
10703,
14,
4699,
26,
355,
340,
291,
14,
1757,
26,
490,
870,
307,
14,
521,
1062,
283,
1825,
687,
15494,
2701,
12,
9435,
1275,
17,
7,
355,
900,
14,
4532,
8,
16,
14,
17,
9,
267,
327,
1361,
307,
14,
521,
1062,
7,
2573,
18590,
734,
7,
339,
347,
14561,
8,
277,
304,
267,
408,
8,
1397,
6366,
9,
408,
267,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
283,
8997,
7,
267,
870,
283,
8997,
440,
2808,
367,
428,
8007,
11867,
1021,
7,
339,
347,
664,
63,
1199,
8,
277,
304,
267,
408,
15310,
1263,
9413,
666,
641,
314,
5200,
370,
314,
15494,
2112,
408,
398,
1830,
413,
26,
288,
862,
26,
355,
13638,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
355,
340,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
13850,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1199,
14,
740,
8,
88,
9,
717,
870,
221,
283,
2703,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
18472,
2666,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1508,
14,
740,
8,
88,
9,
717,
870,
221,
283,
3083,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
1438,
5930,
26,
490,
1233,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
340,
291,
14,
1757,
26,
717,
870,
307,
14,
521,
1062,
7,
4456,
7,
490,
372,
1233,
953,
871,
10703,
14,
4699,
26,
355,
2059,
398,
372,
291,
14,
1199,
339,
347,
636,
12384,
63,
4990,
63,
4687,
8,
277,
12,
831,
12,
1825,
12,
1825,
17,
304,
398,
408,
642,
365,
314,
1233,
7934,
315,
314,
15494,
2462,
1380,
282,
267,
334,
23801,
9,
5200,
365,
1415,
398,
911,
372,
3839,
436,
4635,
1806,
314,
4126,
267,
4126,
17,
365,
440,
1202,
267,
408,
267,
2088,
275,
291,
14,
1760,
63,
305,
63,
875,
342,
267,
340
] | [
199,
2765,
3245,
402,
14975,
787,
8679,
10661,
370,
5204,
199,
262,
3873,
14,
647,
1325,
1314,
1218,
4722,
30350,
199,
6962,
14,
199,
199,
24430,
642,
3878,
365,
440,
4346,
315,
314,
17160,
465,
282,
7396,
2462,
199,
374,
15187,
379,
402,
370,
2429,
1924,
3906,
2985,
787,
949,
8088,
4346,
12,
199,
7911,
30403,
367,
3962,
6466,
675,
14,
199,
199,
624,
199,
646,
747,
12,
1274,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
327,
14012,
370,
1050,
314,
11621,
2082,
370,
314,
2366,
931,
880,
5591,
327,
626,
1006,
314,
4621,
883,
506,
8439,
272,
11621,
63,
515,
275,
747,
14,
515,
14,
1294,
8,
736,
14,
515,
14,
3475,
8,
747,
14,
515,
14,
11091,
8,
636,
493,
363,
776,
5082,
59,
16,
61,
272,
984,
14,
515,
14,
740,
8,
5885,
63,
515,
9,
199,
199,
646,
5796,
199,
646,
3873,
199,
646,
900,
199,
646,
10703,
199,
646,
2882,
199,
199,
646,
286,
1850,
17,
5885,
63,
5781,
199,
199,
533,
428,
8007,
11867,
8,
67,
1850,
17,
5885,
63,
5781,
14,
2610,
3498,
304,
339,
408,
12739,
3501,
282,
2462,
1314,
2066,
4440,
282,
5200,
370,
1255,
314,
1923,
10333,
272,
961,
1083,
7858,
314,
5839,
1414,
315,
282,
1007,
2671,
272,
314,
3618,
1083,
883,
506,
1202,
370,
1104,
6696,
272,
13432,
2337,
365,
949,
14561,
2808,
334,
889,
1982,
4422,
9,
272,
2263,
11703,
2337,
365,
282,
4340,
370,
11972,
314,
2462,
10451,
543,
314,
1982,
10674,
339,
367,
17754,
543,
15187,
652,
3955,
506,
28264,
340,
9009,
12,
548,
12,
1508,
4293,
272,
506,
2741,
370,
7475,
3520,
13788,
12,
737,
314,
12427,
2985,
787,
11343,
379,
436,
6290,
315,
14,
339,
408,
272,
347,
636,
826,
721,
277,
12,
1760,
12663,
829,
304,
267,
286,
1850,
17,
5885,
63,
5781,
14,
2610,
3498,
855,
826,
721,
277,
12,
1760,
12663,
829,
9,
339,
347,
1255,
8,
277,
304,
398,
327,
1218,
282,
15536,
267,
291,
14,
831,
221,
275,
5796,
14,
30550,
342,
398,
327,
2790,
314,
21366,
267,
291,
14,
1825,
275,
10703,
14,
3737,
342,
398,
291,
14,
1205,
275,
286,
1850,
17,
5885,
63,
5781,
14,
4929,
26907,
63,
6089,
267,
291,
14,
12384,
2671,
275,
428,
8007,
4436,
8,
277,
14,
831,
12,
291,
14,
1825,
12,
488,
12,
291,
855,
12384,
63,
4990,
63,
4687,
9,
398,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
7,
28950,
11867,
26,
15494,
2462,
6617,
7,
267,
291,
14,
12384,
2671,
14,
928,
342,
267,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
7,
28950,
11867,
2462,
8239,
7,
339,
347,
3618,
8,
277,
12,
2593,
29,
403,
304,
267,
408,
7536,
703,
221,
408,
267,
2338,
275,
378,
267,
340,
2653,
26,
288,
17570,
275,
2653,
288,
315,
1556,
275,
413,
267,
587,
26,
288,
17570,
275,
413,
288,
315,
1556,
275,
378,
398,
1830,
2338,
665,
17570,
26,
288,
340,
2653,
26,
355,
2338,
275,
2338,
435,
315,
1556,
953,
862,
26,
355,
13638,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
355,
340,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
13850,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1199,
14,
740,
8,
88,
9,
717,
870,
221,
283,
2703,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
18472,
2666,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1508,
14,
740,
8,
88,
9,
717,
870,
221,
283,
3083,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
1438,
5930,
26,
490,
1233,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
340,
291,
14,
1757,
26,
717,
870,
307,
14,
521,
1062,
7,
4456,
7,
490,
372,
1233,
953,
871,
10703,
14,
4699,
26,
355,
340,
291,
14,
1757,
26,
490,
870,
307,
14,
521,
1062,
283,
1825,
687,
15494,
2701,
12,
9435,
1275,
17,
7,
355,
900,
14,
4532,
8,
16,
14,
17,
9,
267,
327,
1361,
307,
14,
521,
1062,
7,
2573,
18590,
734,
7,
339,
347,
14561,
8,
277,
304,
267,
408,
8,
1397,
6366,
9,
408,
267,
340,
291,
14,
1757,
26,
288,
870,
307,
14,
521,
1062,
283,
8997,
7,
267,
870,
283,
8997,
440,
2808,
367,
428,
8007,
11867,
1021,
7,
339,
347,
664,
63,
1199,
8,
277,
304,
267,
408,
15310,
1263,
9413,
666,
641,
314,
5200,
370,
314,
15494,
2112,
408,
398,
1830,
413,
26,
288,
862,
26,
355,
13638,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
355,
340,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
13850,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1199,
14,
740,
8,
88,
9,
717,
870,
221,
283,
2703,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
18472,
2666,
26,
490,
13638,
18,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
367,
671,
315,
13638,
18,
26,
717,
291,
14,
1508,
14,
740,
8,
88,
9,
717,
870,
221,
283,
3083,
4206,
88,
12,
2234,
916,
13638,
508,
286,
1850,
17,
5885,
63,
5781,
14,
30460,
63,
1438,
5930,
26,
490,
1233,
275,
291,
14,
1825,
14,
362,
8,
16,
9,
490,
340,
291,
14,
1757,
26,
717,
870,
307,
14,
521,
1062,
7,
4456,
7,
490,
372,
1233,
953,
871,
10703,
14,
4699,
26,
355,
2059,
398,
372,
291,
14,
1199,
339,
347,
636,
12384,
63,
4990,
63,
4687,
8,
277,
12,
831,
12,
1825,
12,
1825,
17,
304,
398,
408,
642,
365,
314,
1233,
7934,
315,
314,
15494,
2462,
1380,
282,
267,
334,
23801,
9,
5200,
365,
1415,
398,
911,
372,
3839,
436,
4635,
1806,
314,
4126,
267,
4126,
17,
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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
] |
kbussell/pydocusign | pydocusign/client.py | 1 | 20977 | """DocuSign client."""
from collections import namedtuple
import base64
import json
import logging
import os
import warnings
import requests
from pydocusign import exceptions
logger = logging.getLogger(__name__)
Response = namedtuple('Response', ['status_code', 'text'])
class DocuSignClient(object):
"""DocuSign client."""
def __init__(self,
root_url='',
username='',
password='',
integrator_key='',
account_id='',
account_url='',
app_token=None,
oauth2_token=None,
timeout=None):
"""Configure DocuSign client."""
#: Root URL of DocuSign API.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_ROOT_URL``
#: environment variable, if available, is used.
self.root_url = root_url
if not self.root_url:
self.root_url = os.environ.get('DOCUSIGN_ROOT_URL', '')
#: API username.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_USERNAME``
#: environment variable, if available, is used.
self.username = username
if not self.username:
self.username = os.environ.get('DOCUSIGN_USERNAME', '')
#: API password.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_PASSWORD``
#: environment variable, if available, is used.
self.password = password
if not self.password:
self.password = os.environ.get('DOCUSIGN_PASSWORD', '')
#: API integrator key.
#:
#: If not explicitely provided or empty, then
#: ``DOCUSIGN_INTEGRATOR_KEY`` environment variable, if available, is
#: used.
self.integrator_key = integrator_key
if not self.integrator_key:
self.integrator_key = os.environ.get('DOCUSIGN_INTEGRATOR_KEY',
'')
#: API account ID.
#: This attribute can be guessed via :meth:`login_information`.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_ACCOUNT_ID``
#: environment variable, if available, is used.
self.account_id = account_id
if not self.account_id:
self.account_id = os.environ.get('DOCUSIGN_ACCOUNT_ID', '')
#: API AppToken.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_APP_TOKEN``
#: environment variable, if available, is used.
self.app_token = app_token
if not self.app_token:
self.app_token = os.environ.get('DOCUSIGN_APP_TOKEN', '')
#: OAuth2 Token.
#:
#: If not explicitely provided or empty, then ``DOCUSIGN_OAUTH2_TOKEN``
#: environment variable, if available, is used.
self.oauth2_token = oauth2_token
if not self.oauth2_token:
self.oauth2_token = os.environ.get('DOCUSIGN_OAUTH2_TOKEN', '')
#: User's URL, i.e. the one mentioning :attr:`account_id`.
#: This attribute can be guessed via :meth:`login_information`.
self.account_url = account_url
if self.root_url and self.account_id and not self.account_url:
self.account_url = '{root}/accounts/{account}'.format(
root=self.root_url,
account=self.account_id)
# Connection timeout.
if timeout is None:
timeout = float(os.environ.get('DOCUSIGN_TIMEOUT', 30))
self.timeout = timeout
def get_timeout(self):
"""Return connection timeout."""
return self._timeout
def set_timeout(self, value):
"""Set connection timeout. Converts ``value`` to a float.
Raises :class:`ValueError` in case the value is lower than 0.001.
"""
if value < 0.001:
raise ValueError('Cannot set timeout lower than 0.001')
self._timeout = int(value * 1000) / 1000.
def del_timeout(self):
"""Remove timeout attribute."""
del self._timeout
timeout = property(
get_timeout,
set_timeout,
del_timeout,
"""Connection timeout, in seconds, for HTTP requests to DocuSign's API.
This is not timeout for full request, only connection.
Precision is limited to milliseconds:
>>> client = DocuSignClient(timeout=1.2345)
>>> client.timeout
1.234
Setting timeout lower than 0.001 is forbidden.
>>> client.timeout = 0.0009 # Doctest: +ELLIPSIS
Traceback (most recent call last):
...
ValueError: Cannot set timeout lower than 0.001
"""
)
def base_headers(self, sobo_email=None):
"""Return dictionary of base headers for all HTTP requests.
:param sobo_email: if specified, will set the appropriate header to act
on behalf of that user. The authenticated account must have the
appropriate permissions. See:
https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#SOBO/Send%20On%20Behalf%20Of%20Functionality%20in%20the%20DocuSign%20REST%20API.htm
"""
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
if self.oauth2_token:
headers['Authorization'] = 'Bearer ' + self.oauth2_token
if sobo_email:
headers['X-DocuSign-Act-As-User'] = sobo_email
else:
auth = {
'Username': self.username,
'Password': self.password,
'IntegratorKey': self.integrator_key,
}
if sobo_email:
auth['SendOnBehalfOf'] = sobo_email
headers['X-DocuSign-Authentication'] = json.dumps(auth)
return headers
def _request(self, url, method='GET', headers=None, data=None,
json_data=None, expected_status_code=200, sobo_email=None):
"""Shortcut to perform HTTP requests."""
do_url = '{root}{path}'.format(root=self.root_url, path=url)
do_request = getattr(requests, method.lower())
if headers is None:
headers = {}
do_headers = self.base_headers(sobo_email)
do_headers.update(headers)
if data is not None:
do_data = json.dumps(data)
else:
do_data = None
try:
response = do_request(do_url, headers=do_headers, data=do_data,
json=json_data, timeout=self.timeout)
except requests.exceptions.RequestException as exception:
msg = "DocuSign request error: " \
"{method} {url} failed ; " \
"Error: {exception}" \
.format(method=method, url=do_url, exception=exception)
logger.error(msg)
raise exceptions.DocuSignException(msg)
if response.status_code != expected_status_code:
msg = "DocuSign request failed: " \
"{method} {url} returned code {status} " \
"while expecting code {expected}; " \
"Message: {message} ; " \
.format(
method=method,
url=do_url,
status=response.status_code,
expected=expected_status_code,
message=response.text,
)
logger.error(msg)
raise exceptions.DocuSignException(msg)
if response.headers.get('Content-Type', '') \
.startswith('application/json'):
return response.json()
return response.text
def get(self, *args, **kwargs):
"""Shortcut to perform GET operations on DocuSign API."""
return self._request(method='GET', *args, **kwargs)
def post(self, *args, **kwargs):
"""Shortcut to perform POST operations on DocuSign API."""
return self._request(method='POST', *args, **kwargs)
def put(self, *args, **kwargs):
"""Shortcut to perform PUT operations on DocuSign API."""
return self._request(method='PUT', *args, **kwargs)
def delete(self, *args, **kwargs):
"""Shortcut to perform DELETE operations on DocuSign API."""
return self._request(method='DELETE', *args, **kwargs)
def login_information(self):
"""Return dictionary of /login_information.
Populate :attr:`account_id` and :attr:`account_url`.
"""
url = '/login_information'
headers = {
}
data = self.get(url, headers=headers)
self.account_id = data['loginAccounts'][0]['accountId']
self.account_url = '{root}/accounts/{account}'.format(
root=self.root_url,
account=self.account_id)
return data
@classmethod
def oauth2_token_request(cls, root_url, username, password,
integrator_key):
url = root_url + '/oauth2/token'
data = {
'grant_type': 'password',
'client_id': integrator_key,
'username': username,
'password': password,
'scope': 'api',
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.post(url, headers=headers, data=data)
if response.status_code != 200:
raise exceptions.DocuSignOAuth2Exception(response.json())
return response.json()['access_token']
@classmethod
def oauth2_token_revoke(cls, root_url, token):
url = root_url + '/oauth2/revoke'
data = {
'token': token,
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.post(url, headers=headers, data=data)
if response.status_code != 200:
raise exceptions.DocuSignOAuth2Exception(response.json())
def get_account_information(self, account_id=None):
"""Return dictionary of /accounts/:accountId.
Uses :attr:`account_id` (see :meth:`login_information`) if
``account_id`` is ``None``.
"""
if account_id is None:
account_id = self.account_id
url = self.account_url
else:
url = '/accounts/{accountId}/'.format(accountId=self.account_id)
return self.get(url)
def get_account_provisioning(self):
"""Return dictionary of /accounts/provisioning."""
url = '/accounts/provisioning'
headers = {
'X-DocuSign-AppToken': self.app_token,
}
return self.get(url, headers=headers)
def post_account(self, data):
"""Create account."""
url = '/accounts'
return self.post(url, data=data, expected_status_code=201)
def delete_account(self, accountId):
"""Create account."""
url = '/accounts/{accountId}'.format(accountId=accountId)
data = self.delete(url)
return data.strip() == ''
def _create_envelope_from_documents_request(self, envelope):
"""Return parts of the POST request for /envelopes.
.. warning::
Only one document is supported at the moment. This is a limitation
of `pydocusign`, not of `DocuSign`.
"""
data = envelope.to_dict()
documents = []
for document in envelope.documents:
documents.append({
"documentId": document.documentId,
"name": document.name,
"fileExtension": "pdf",
"documentBase64": base64.b64encode(
document.data.read()).decode('utf-8')
})
data['documents'] = documents
return data
def _create_envelope_from_template_request(self, envelope):
"""Return parts of the POST request for /envelopes,
for creating an envelope from a template.
"""
return envelope.to_dict()
def _create_envelope(self, envelope, data):
"""POST to /envelopes and return created envelope ID.
Called by ``create_envelope_from_document`` and
``create_envelope_from_template`` methods.
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes'.format(
accountId=self.account_id)
response_data = self._request(
url, method='POST', json_data=data, expected_status_code=201)
if not envelope.client:
envelope.client = self
if not envelope.envelopeId:
envelope.envelopeId = response_data['envelopeId']
return response_data['envelopeId']
def create_envelope_from_documents(self, envelope):
"""POST to /envelopes and return created envelope ID.
If ``envelope`` has no (or empty) ``envelopeId`` attribute, this
method sets the value.
If ``envelope`` has no (or empty) ``client`` attribute, this method
sets the value.
"""
data = self._create_envelope_from_documents_request(envelope)
return self._create_envelope(envelope, data)
def create_envelope_from_document(self, envelope):
warnings.warn("This method will be deprecated, use "
"create_envelope_from_documents instead.",
DeprecationWarning)
data = self._create_envelope_from_documents_request(envelope)
return self._create_envelope(envelope, data)
def create_envelope_from_template(self, envelope):
"""POST to /envelopes and return created envelope ID.
If ``envelope`` has no (or empty) ``envelopeId`` attribute, this
method sets the value.
If ``envelope`` has no (or empty) ``client`` attribute, this method
sets the value.
"""
data = self._create_envelope_from_template_request(envelope)
return self._create_envelope(envelope, data)
def void_envelope(self, envelopeId, voidedReason):
"""PUT to /{account}/envelopes/{envelopeId} with 'voided' status and
voidedReason, and return JSON."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
data = {
'status': 'voided',
'voidedReason': voidedReason
}
return self.put(url, data=data)
def get_envelope(self, envelopeId):
"""GET {account}/envelopes/{envelopeId} and return JSON."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
return self.get(url)
def get_envelope_recipients(self, envelopeId):
"""GET {account}/envelopes/{envelopeId}/recipients and return JSON."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/recipients' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
return self.get(url)
def post_recipient_view(self, authenticationMethod=None,
clientUserId='', email='', envelopeId='',
returnUrl='', userId='', userName=''):
"""POST to {account}/envelopes/{envelopeId}/views/recipient.
This is the method to start embedded signing for recipient.
Return JSON from DocuSign response.
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/views/recipient' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
if authenticationMethod is None:
authenticationMethod = 'none'
data = {
'authenticationMethod': authenticationMethod,
'clientUserId': clientUserId,
'email': email,
'envelopeId': envelopeId,
'returnUrl': returnUrl,
'userId': userId,
'userName': userName,
}
return self.post(url, data=data, expected_status_code=201)
def get_envelope_document_list(self, envelopeId):
"""GET the list of envelope's documents."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/documents' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
data = self.get(url)
return data['envelopeDocuments']
def get_envelope_document(self, envelopeId, documentId):
"""Download one document in envelope, return file-like object."""
if not self.account_url:
self.login_information()
url = '{root}/accounts/{accountId}/envelopes/{envelopeId}' \
'/documents/{documentId}' \
.format(root=self.root_url,
accountId=self.account_id,
envelopeId=envelopeId,
documentId=documentId)
headers = self.base_headers()
response = requests.get(url, headers=headers, stream=True)
return response.raw
def get_template(self, templateId):
"""GET the definition of the template."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/templates/{templateId}' \
.format(accountId=self.account_id,
templateId=templateId)
return self.get(url)
def get_connect_failures(self):
"""GET a list of DocuSign Connect failures."""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/connect/failures' \
.format(accountId=self.account_id)
return self.get(url)['failures']
def add_envelope_recipients(self, envelopeId, recipients,
resend_envelope=False):
"""Add one or more recipients to an envelope
DocuSign reference:
https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipients/create/
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/recipients' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
if resend_envelope:
url += '?resend_envelope=true'
data = {'signers': [recipient.to_dict() for recipient in recipients]}
return self.post(url, data=data)
def update_envelope_recipients(self, envelopeId, recipients,
resend_envelope=False):
"""Modify recipients in a draft envelope or correct recipient information
for an in process envelope
DocuSign reference:
https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipients/update/
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/recipients' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
if resend_envelope:
url += '?resend_envelope=true'
data = {'signers': [recipient.to_dict() for recipient in recipients]}
return self.put(url, data=data)
def delete_envelope_recipient(self, envelopeId, recipientId):
"""Deletes one or more recipients from a draft or sent envelope.
DocuSign reference:
https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipients/delete/
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/recipients/' \
'{recipientId}'.format(accountId=self.account_id,
envelopeId=envelopeId,
recipientId=recipientId)
return self.delete(url)
def delete_envelope_recipients(self, envelopeId, recipientIds):
"""Deletes one or more recipients from a draft or sent envelope.
DocuSign reference:
https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipients/deleteList/
"""
if not self.account_url:
self.login_information()
url = '/accounts/{accountId}/envelopes/{envelopeId}/recipients' \
.format(accountId=self.account_id,
envelopeId=envelopeId)
data = {'signers': [{'recipientId': id_} for id_ in recipientIds]}
return self.delete(url, data=data)
| bsd-3-clause | [
624,
3768,
85,
4940,
1890,
1041,
199,
504,
5055,
492,
12863,
199,
646,
1300,
772,
199,
646,
2022,
199,
646,
2050,
199,
646,
747,
199,
646,
3598,
199,
199,
646,
4145,
199,
199,
504,
29164,
85,
1037,
492,
4967,
421,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
199,
2364,
275,
12863,
360,
2364,
297,
788,
1205,
63,
600,
297,
283,
505,
1105,
421,
199,
533,
5454,
85,
4940,
3041,
8,
785,
304,
272,
408,
3768,
85,
4940,
1890,
1041,
272,
347,
636,
826,
721,
277,
12,
326,
1738,
63,
633,
4581,
326,
3434,
4581,
326,
2505,
4581,
326,
17806,
707,
63,
498,
4581,
326,
2933,
63,
344,
4581,
326,
2933,
63,
633,
4581,
326,
1145,
63,
1418,
29,
403,
12,
326,
9725,
18,
63,
1418,
29,
403,
12,
326,
2653,
29,
403,
304,
267,
408,
17324,
5454,
85,
4940,
1890,
1041,
267,
6079,
12826,
2851,
402,
5454,
85,
4940,
3261,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
5441,
63,
2632,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
1231,
63,
633,
275,
1738,
63,
633,
267,
340,
440,
291,
14,
1231,
63,
633,
26,
288,
291,
14,
1231,
63,
633,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
5441,
63,
2632,
297,
4074,
398,
6079,
3261,
3434,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
11958,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2473,
275,
3434,
267,
340,
440,
291,
14,
2473,
26,
288,
291,
14,
2473,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
11958,
297,
4074,
398,
6079,
3261,
2505,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
9032,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2060,
275,
2505,
267,
340,
440,
291,
14,
2060,
26,
288,
291,
14,
2060,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
9032,
297,
4074,
398,
6079,
3261,
17806,
707,
790,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
267,
6079,
1124,
16618,
1668,
3203,
63,
2919,
37,
3975,
6467,
63,
3078,
1040,
3734,
1750,
12,
340,
2808,
12,
365,
267,
6079,
1202,
14,
267,
291,
14,
25323,
707,
63,
498,
275,
17806,
707,
63,
498,
267,
340,
440,
291,
14,
25323,
707,
63,
498,
26,
288,
291,
14,
25323,
707,
63,
498,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
2919,
37,
3975,
6467,
63,
3078,
297,
1740,
4074,
267,
6079,
3261,
2933,
2870,
14,
267,
6079,
961,
2225,
883,
506,
29950,
4799,
520,
5247,
1705,
2886,
63,
11697,
2313,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
18928,
63,
998,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2048,
63,
344,
275,
2933,
63,
344,
267,
340,
440,
291,
14,
2048,
63,
344,
26,
288,
291,
14,
2048,
63,
344,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
18928,
63,
998,
297,
4074,
398,
6079,
3261,
4693,
3264,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
7121,
63,
8803,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
571,
63,
1418,
275,
1145,
63,
1418,
267,
340,
440,
291,
14,
571,
63,
1418,
26,
288,
291,
14,
571,
63,
1418,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
7121,
63,
8803,
297,
4074,
398,
6079,
11715,
18,
8767,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
24041,
18,
63,
8803,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
6126,
18,
63,
1418,
275,
9725,
18,
63,
1418,
267,
340,
440,
291,
14,
6126,
18,
63,
1418,
26,
288,
291,
14,
6126,
18,
63,
1418,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
24041,
18,
63,
8803,
297,
4074,
398,
6079,
2876,
1159,
2851,
12,
284,
14,
69,
14,
314,
1373,
20811,
316,
520,
962,
1705,
2048,
63,
344,
2313,
267,
6079,
961,
2225,
883,
506,
29950,
4799,
520,
5247,
1705,
2886,
63,
11697,
2313,
267,
291,
14,
2048,
63,
633,
275,
2933,
63,
633,
267,
340,
291,
14,
1231,
63,
633,
436,
291,
14,
2048,
63,
344,
436,
440,
291,
14,
2048,
63,
633,
26,
288,
291,
14,
2048,
63,
633,
275,
5041,
1231,
5995,
8370,
5321,
2048,
5285,
908,
8,
355,
1738,
29,
277,
14,
1231,
63,
633,
12,
355,
2933,
29,
277,
14,
2048,
63,
344,
9,
398,
327,
8113,
2653,
14,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
2069,
8,
736,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
8899,
297,
4233,
430,
267,
291,
14,
2593,
275,
2653,
339,
347,
664,
63,
2593,
8,
277,
304,
267,
408,
1767,
1950,
2653,
1041,
267,
372,
291,
423,
2593,
339,
347,
663,
63,
2593,
8,
277,
12,
574,
304,
267,
408,
1084,
1950,
2653,
14,
19107,
1124,
585,
1040,
370,
282,
2069,
14,
398,
6218,
520,
533,
1705,
3393,
64,
315,
1930,
314,
574,
365,
5117,
2419,
378,
14,
4587,
14,
398,
408,
267,
340,
574,
665,
378,
14,
4587,
26,
288,
746,
1722,
360,
6612,
663,
2653,
5117,
2419,
378,
14,
4587,
358,
267,
291,
423,
2593,
275,
1109,
8,
585,
627,
5198,
9,
1182,
5198,
14,
339,
347,
2150,
63,
2593,
8,
277,
304,
267,
408,
5587,
2653,
2225,
1041,
267,
2150,
291,
423,
2593,
339,
2653,
275,
3324,
8,
267,
664,
63,
2593,
12,
267,
663,
63,
2593,
12,
267,
2150,
63,
2593,
12,
267,
408,
3225,
2653,
12,
315,
4696,
12,
367,
3101,
4145,
370,
5454,
85,
4940,
1159,
3261,
14,
398
] | [
3768,
85,
4940,
1890,
1041,
199,
504,
5055,
492,
12863,
199,
646,
1300,
772,
199,
646,
2022,
199,
646,
2050,
199,
646,
747,
199,
646,
3598,
199,
199,
646,
4145,
199,
199,
504,
29164,
85,
1037,
492,
4967,
421,
199,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
199,
2364,
275,
12863,
360,
2364,
297,
788,
1205,
63,
600,
297,
283,
505,
1105,
421,
199,
533,
5454,
85,
4940,
3041,
8,
785,
304,
272,
408,
3768,
85,
4940,
1890,
1041,
272,
347,
636,
826,
721,
277,
12,
326,
1738,
63,
633,
4581,
326,
3434,
4581,
326,
2505,
4581,
326,
17806,
707,
63,
498,
4581,
326,
2933,
63,
344,
4581,
326,
2933,
63,
633,
4581,
326,
1145,
63,
1418,
29,
403,
12,
326,
9725,
18,
63,
1418,
29,
403,
12,
326,
2653,
29,
403,
304,
267,
408,
17324,
5454,
85,
4940,
1890,
1041,
267,
6079,
12826,
2851,
402,
5454,
85,
4940,
3261,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
5441,
63,
2632,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
1231,
63,
633,
275,
1738,
63,
633,
267,
340,
440,
291,
14,
1231,
63,
633,
26,
288,
291,
14,
1231,
63,
633,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
5441,
63,
2632,
297,
4074,
398,
6079,
3261,
3434,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
11958,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2473,
275,
3434,
267,
340,
440,
291,
14,
2473,
26,
288,
291,
14,
2473,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
11958,
297,
4074,
398,
6079,
3261,
2505,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
9032,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2060,
275,
2505,
267,
340,
440,
291,
14,
2060,
26,
288,
291,
14,
2060,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
9032,
297,
4074,
398,
6079,
3261,
17806,
707,
790,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
267,
6079,
1124,
16618,
1668,
3203,
63,
2919,
37,
3975,
6467,
63,
3078,
1040,
3734,
1750,
12,
340,
2808,
12,
365,
267,
6079,
1202,
14,
267,
291,
14,
25323,
707,
63,
498,
275,
17806,
707,
63,
498,
267,
340,
440,
291,
14,
25323,
707,
63,
498,
26,
288,
291,
14,
25323,
707,
63,
498,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
2919,
37,
3975,
6467,
63,
3078,
297,
1740,
4074,
267,
6079,
3261,
2933,
2870,
14,
267,
6079,
961,
2225,
883,
506,
29950,
4799,
520,
5247,
1705,
2886,
63,
11697,
2313,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
18928,
63,
998,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
2048,
63,
344,
275,
2933,
63,
344,
267,
340,
440,
291,
14,
2048,
63,
344,
26,
288,
291,
14,
2048,
63,
344,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
18928,
63,
998,
297,
4074,
398,
6079,
3261,
4693,
3264,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
7121,
63,
8803,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
571,
63,
1418,
275,
1145,
63,
1418,
267,
340,
440,
291,
14,
571,
63,
1418,
26,
288,
291,
14,
571,
63,
1418,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
7121,
63,
8803,
297,
4074,
398,
6079,
11715,
18,
8767,
14,
267,
6079,
267,
6079,
982,
440,
1437,
317,
25171,
590,
2741,
503,
2701,
12,
2066,
1124,
16618,
1668,
3203,
63,
24041,
18,
63,
8803,
1040,
267,
6079,
3734,
1750,
12,
340,
2808,
12,
365,
1202,
14,
267,
291,
14,
6126,
18,
63,
1418,
275,
9725,
18,
63,
1418,
267,
340,
440,
291,
14,
6126,
18,
63,
1418,
26,
288,
291,
14,
6126,
18,
63,
1418,
275,
747,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
24041,
18,
63,
8803,
297,
4074,
398,
6079,
2876,
1159,
2851,
12,
284,
14,
69,
14,
314,
1373,
20811,
316,
520,
962,
1705,
2048,
63,
344,
2313,
267,
6079,
961,
2225,
883,
506,
29950,
4799,
520,
5247,
1705,
2886,
63,
11697,
2313,
267,
291,
14,
2048,
63,
633,
275,
2933,
63,
633,
267,
340,
291,
14,
1231,
63,
633,
436,
291,
14,
2048,
63,
344,
436,
440,
291,
14,
2048,
63,
633,
26,
288,
291,
14,
2048,
63,
633,
275,
5041,
1231,
5995,
8370,
5321,
2048,
5285,
908,
8,
355,
1738,
29,
277,
14,
1231,
63,
633,
12,
355,
2933,
29,
277,
14,
2048,
63,
344,
9,
398,
327,
8113,
2653,
14,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
2069,
8,
736,
14,
2314,
14,
362,
360,
16618,
1668,
3203,
63,
8899,
297,
4233,
430,
267,
291,
14,
2593,
275,
2653,
339,
347,
664,
63,
2593,
8,
277,
304,
267,
408,
1767,
1950,
2653,
1041,
267,
372,
291,
423,
2593,
339,
347,
663,
63,
2593,
8,
277,
12,
574,
304,
267,
408,
1084,
1950,
2653,
14,
19107,
1124,
585,
1040,
370,
282,
2069,
14,
398,
6218,
520,
533,
1705,
3393,
64,
315,
1930,
314,
574,
365,
5117,
2419,
378,
14,
4587,
14,
398,
408,
267,
340,
574,
665,
378,
14,
4587,
26,
288,
746,
1722,
360,
6612,
663,
2653,
5117,
2419,
378,
14,
4587,
358,
267,
291,
423,
2593,
275,
1109,
8,
585,
627,
5198,
9,
1182,
5198,
14,
339,
347,
2150,
63,
2593,
8,
277,
304,
267,
408,
5587,
2653,
2225,
1041,
267,
2150,
291,
423,
2593,
339,
2653,
275,
3324,
8,
267,
664,
63,
2593,
12,
267,
663,
63,
2593,
12,
267,
2150,
63,
2593,
12,
267,
408,
3225,
2653,
12,
315,
4696,
12,
367,
3101,
4145,
370,
5454,
85,
4940,
1159,
3261,
14,
398,
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,
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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
] |
Thhhza/XlsxWriter | examples/chart_gradient.py | 9 | 1685 | #######################################################################
#
# An example of creating an Excel charts with gradient fills using
# Python and XlsxWriter.
#
# Copyright 2013-2015, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_gradient.xlsx')
worksheet = workbook.add_worksheet()
bold = workbook.add_format({'bold': 1})
# Add the worksheet data that the charts will refer to.
headings = ['Number', 'Batch 1', 'Batch 2']
data = [
[2, 3, 4, 5, 6, 7],
[10, 40, 50, 20, 10, 50],
[30, 60, 70, 50, 40, 30],
]
worksheet.write_row('A1', headings, bold)
worksheet.write_column('A2', data[0])
worksheet.write_column('B2', data[1])
worksheet.write_column('C2', data[2])
# Create a new column chart.
chart = workbook.add_chart({'type': 'column'})
# Configure the first series, including a gradient.
chart.add_series({
'name': '=Sheet1!$B$1',
'categories': '=Sheet1!$A$2:$A$7',
'values': '=Sheet1!$B$2:$B$7',
'gradient': {'colors': ['#963735', '#F1DCDB']}
})
# Configure the second series, including a gradient.
chart.add_series({
'name': '=Sheet1!$C$1',
'categories': '=Sheet1!$A$2:$A$7',
'values': '=Sheet1!$C$2:$C$7',
'gradient': {'colors': ['#E36C0A', '#FCEADA']}
})
# Set a gradient for the plotarea.
chart.set_plotarea({
'gradient': {'colors': ['#FFEFD1', '#F0EBD5', '#B69F66']}
})
# Add some axis labels.
chart.set_x_axis({'name': 'Test number'})
chart.set_y_axis({'name': 'Sample length (mm)'})
# Turn off the chart legend.
chart.set_legend({'none': True})
# Insert the chart into the worksheet.
worksheet.insert_chart('E2', chart)
workbook.close()
| bsd-2-clause | [
3060,
14776,
199,
3,
199,
3,
1626,
2893,
402,
6425,
376,
27832,
10943,
83,
543,
6709,
1794,
478,
1808,
199,
3,
2018,
436,
1323,
478,
88,
6261,
14,
199,
3,
199,
3,
1898,
6171,
13,
7806,
12,
17815,
22895,
46,
455,
17956,
12,
1335,
5466,
17811,
17956,
32,
1850,
290,
14,
1308,
199,
3,
199,
646,
671,
478,
88,
5491,
199,
199,
30765,
275,
671,
478,
88,
5491,
14,
6517,
2706,
360,
9019,
63,
7490,
14,
19023,
88,
358,
199,
29776,
275,
1736,
2706,
14,
525,
63,
29776,
342,
199,
9771,
275,
1736,
2706,
14,
525,
63,
908,
3252,
9771,
356,
413,
1552,
199,
199,
3,
2654,
314,
21127,
666,
626,
314,
10943,
83,
911,
10618,
370,
14,
199,
2993,
780,
275,
788,
3259,
297,
283,
8842,
413,
297,
283,
8842,
499,
418,
199,
576,
275,
359,
272,
359,
18,
12,
650,
12,
841,
12,
959,
12,
1227,
12,
1520,
467,
272,
359,
709,
12,
6335,
12,
5238,
12,
3388,
12,
1616,
12,
5238,
467,
272,
359,
1216,
12,
5212,
12,
10045,
12,
5238,
12,
6335,
12,
4233,
467,
199,
61,
199,
199,
29776,
14,
952,
63,
1143,
360,
33,
17,
297,
26967,
12,
17268,
9,
199,
29776,
14,
952,
63,
2301,
360,
33,
18,
297,
666,
59,
16,
566,
199,
29776,
14,
952,
63,
2301,
360,
34,
18,
297,
666,
59,
17,
566,
199,
29776,
14,
952,
63,
2301,
360,
35,
18,
297,
666,
59,
18,
566,
421,
199,
3,
2790,
282,
892,
2763,
10943,
14,
199,
9019,
275,
1736,
2706,
14,
525,
63,
9019,
3252,
466,
356,
283,
2301,
3071,
199,
199,
3,
15453,
314,
1642,
6779,
12,
5893,
282,
6709,
14,
199,
9019,
14,
525,
63,
5602,
2561,
272,
283,
354,
356,
755,
26143,
16715,
17,
1,
4,
34,
4,
17,
297,
272,
283,
8906,
356,
26143,
16715,
17,
1,
4,
33,
4,
18,
26,
4,
33,
4,
23,
297,
272,
283,
1459,
356,
258,
26143,
16715,
17,
1,
4,
34,
4,
18,
26,
4,
34,
4,
23,
297,
272,
283,
7490,
356,
257,
791,
7120,
356,
788,
3,
2534,
1401,
1276,
297,
3943,
38,
17,
5196,
2846,
12074,
199,
1552,
199,
199,
3,
15453,
314,
3499,
6779,
12,
5893,
282,
6709,
14,
199,
9019,
14,
525,
63,
5602,
2561,
272,
283,
354,
356,
755,
26143,
16715,
17,
1,
4,
35,
4,
17,
297,
272,
283,
8906,
356,
26143,
16715,
17,
1,
4,
33,
4,
18,
26,
4,
33,
4,
23,
297,
272,
283,
1459,
356,
258,
26143,
16715,
17,
1,
4,
35,
4,
18,
26,
4,
35,
4,
23,
297,
272,
283,
7490,
356,
257,
791,
7120,
356,
788,
3,
37,
1344,
35,
16,
33,
297,
3943,
38,
2089,
1554,
33,
12074,
199,
1552,
199,
199,
3,
2494,
282,
6709,
367,
314,
299,
320,
502,
8273,
14,
199,
9019,
14,
409,
63,
80,
320,
502,
8273,
2561,
272,
283,
7490,
356,
791,
7120,
356,
788,
3,
1665,
37,
7902,
17,
297,
3943,
38,
16,
37,
11156,
21,
297,
3943,
34,
1876,
38,
1272,
12074,
199,
1552,
421,
199,
3,
2654,
2005,
3114,
3628,
14,
199,
9019,
14,
409,
63,
88,
63,
3127,
3252,
354,
356,
283,
774,
1329,
3071,
199,
9019,
14,
409,
63,
89,
63,
3127,
3252,
354,
356,
283,
8176,
2582,
334,
596,
9,
3071,
199,
199,
3,
16147,
2331,
314,
10943,
15906,
14,
199,
9019,
14,
409,
63,
10231,
3252,
3592,
356,
715,
1552,
199,
199,
3,
15496,
314,
10943,
1901,
314,
21127,
14,
199,
29776,
14,
3176,
63,
9019,
360,
37,
18,
297,
10943,
9,
199,
199,
30765,
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
] | [
14776,
199,
3,
199,
3,
1626,
2893,
402,
6425,
376,
27832,
10943,
83,
543,
6709,
1794,
478,
1808,
199,
3,
2018,
436,
1323,
478,
88,
6261,
14,
199,
3,
199,
3,
1898,
6171,
13,
7806,
12,
17815,
22895,
46,
455,
17956,
12,
1335,
5466,
17811,
17956,
32,
1850,
290,
14,
1308,
199,
3,
199,
646,
671,
478,
88,
5491,
199,
199,
30765,
275,
671,
478,
88,
5491,
14,
6517,
2706,
360,
9019,
63,
7490,
14,
19023,
88,
358,
199,
29776,
275,
1736,
2706,
14,
525,
63,
29776,
342,
199,
9771,
275,
1736,
2706,
14,
525,
63,
908,
3252,
9771,
356,
413,
1552,
199,
199,
3,
2654,
314,
21127,
666,
626,
314,
10943,
83,
911,
10618,
370,
14,
199,
2993,
780,
275,
788,
3259,
297,
283,
8842,
413,
297,
283,
8842,
499,
418,
199,
576,
275,
359,
272,
359,
18,
12,
650,
12,
841,
12,
959,
12,
1227,
12,
1520,
467,
272,
359,
709,
12,
6335,
12,
5238,
12,
3388,
12,
1616,
12,
5238,
467,
272,
359,
1216,
12,
5212,
12,
10045,
12,
5238,
12,
6335,
12,
4233,
467,
199,
61,
199,
199,
29776,
14,
952,
63,
1143,
360,
33,
17,
297,
26967,
12,
17268,
9,
199,
29776,
14,
952,
63,
2301,
360,
33,
18,
297,
666,
59,
16,
566,
199,
29776,
14,
952,
63,
2301,
360,
34,
18,
297,
666,
59,
17,
566,
199,
29776,
14,
952,
63,
2301,
360,
35,
18,
297,
666,
59,
18,
566,
421,
199,
3,
2790,
282,
892,
2763,
10943,
14,
199,
9019,
275,
1736,
2706,
14,
525,
63,
9019,
3252,
466,
356,
283,
2301,
3071,
199,
199,
3,
15453,
314,
1642,
6779,
12,
5893,
282,
6709,
14,
199,
9019,
14,
525,
63,
5602,
2561,
272,
283,
354,
356,
755,
26143,
16715,
17,
1,
4,
34,
4,
17,
297,
272,
283,
8906,
356,
26143,
16715,
17,
1,
4,
33,
4,
18,
26,
4,
33,
4,
23,
297,
272,
283,
1459,
356,
258,
26143,
16715,
17,
1,
4,
34,
4,
18,
26,
4,
34,
4,
23,
297,
272,
283,
7490,
356,
257,
791,
7120,
356,
788,
3,
2534,
1401,
1276,
297,
3943,
38,
17,
5196,
2846,
12074,
199,
1552,
199,
199,
3,
15453,
314,
3499,
6779,
12,
5893,
282,
6709,
14,
199,
9019,
14,
525,
63,
5602,
2561,
272,
283,
354,
356,
755,
26143,
16715,
17,
1,
4,
35,
4,
17,
297,
272,
283,
8906,
356,
26143,
16715,
17,
1,
4,
33,
4,
18,
26,
4,
33,
4,
23,
297,
272,
283,
1459,
356,
258,
26143,
16715,
17,
1,
4,
35,
4,
18,
26,
4,
35,
4,
23,
297,
272,
283,
7490,
356,
257,
791,
7120,
356,
788,
3,
37,
1344,
35,
16,
33,
297,
3943,
38,
2089,
1554,
33,
12074,
199,
1552,
199,
199,
3,
2494,
282,
6709,
367,
314,
299,
320,
502,
8273,
14,
199,
9019,
14,
409,
63,
80,
320,
502,
8273,
2561,
272,
283,
7490,
356,
791,
7120,
356,
788,
3,
1665,
37,
7902,
17,
297,
3943,
38,
16,
37,
11156,
21,
297,
3943,
34,
1876,
38,
1272,
12074,
199,
1552,
421,
199,
3,
2654,
2005,
3114,
3628,
14,
199,
9019,
14,
409,
63,
88,
63,
3127,
3252,
354,
356,
283,
774,
1329,
3071,
199,
9019,
14,
409,
63,
89,
63,
3127,
3252,
354,
356,
283,
8176,
2582,
334,
596,
9,
3071,
199,
199,
3,
16147,
2331,
314,
10943,
15906,
14,
199,
9019,
14,
409,
63,
10231,
3252,
3592,
356,
715,
1552,
199,
199,
3,
15496,
314,
10943,
1901,
314,
21127,
14,
199,
29776,
14,
3176,
63,
9019,
360,
37,
18,
297,
10943,
9,
199,
199,
30765,
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,
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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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
] |
wangsai/oppia | core/platform/email/gae_email_services_test.py | 15 | 1874 | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for the GAE mail API wrapper."""
__author__ = 'Sean Lip'
from core.platform.email import gae_email_services
from core.tests import test_utils
import feconf
class EmailTests(test_utils.GenericTestBase):
"""Tests for sending emails."""
def test_sending_email_to_admin(self):
# Emails are not sent if the CAN_SEND_EMAILS_TO_ADMIN setting
# is not turned on.
with self.swap(feconf, 'CAN_SEND_EMAILS_TO_ADMIN', False):
gae_email_services.send_mail_to_admin(
'sender@example.com', 'subject', 'body')
messages = self.mail_stub.get_sent_messages(
to=feconf.ADMIN_EMAIL_ADDRESS)
self.assertEqual(0, len(messages))
with self.swap(feconf, 'CAN_SEND_EMAILS_TO_ADMIN', True):
gae_email_services.send_mail_to_admin(
'sender@example.com', 'subject', 'body')
messages = self.mail_stub.get_sent_messages(
to=feconf.ADMIN_EMAIL_ADDRESS)
self.assertEqual(1, len(messages))
self.assertEqual(feconf.ADMIN_EMAIL_ADDRESS, messages[0].to)
self.assertIn(
'(Sent from %s)' % self.EXPECTED_TEST_APP_ID,
messages[0].body.decode())
| apache-2.0 | [
3,
2803,
26,
2774,
13,
24,
199,
3,
199,
3,
1898,
6927,
710,
593,
802,
4674,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
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,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
13,
1311,
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,
624,
2925,
367,
314,
598,
12500,
6016,
3261,
4975,
1041,
199,
199,
363,
2502,
363,
275,
283,
1513,
290,
491,
711,
7,
421,
199,
504,
6170,
14,
3246,
14,
2123,
492,
486,
3624,
63,
2123,
63,
5950,
199,
504,
6170,
14,
2219,
492,
511,
63,
1208,
199,
646,
1964,
2190,
421,
199,
533,
11426,
2925,
8,
396,
63,
1208,
14,
9417,
14440,
304,
272,
408,
2925,
367,
10209,
14931,
1041,
339,
347,
511,
63,
24450,
63,
2123,
63,
475,
63,
2113,
8,
277,
304,
267,
327,
11426,
83,
787,
440,
4847,
340,
314,
29661,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
4260,
267,
327,
365,
440,
19136,
641,
14,
267,
543,
291,
14,
9286,
8,
771,
2190,
12,
283,
18988,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
297,
756,
304,
288,
486,
3624,
63,
2123,
63,
5950,
14,
2254,
63,
1198,
63,
475,
63,
2113,
8,
355,
283,
8114,
32,
2694,
14,
957,
297,
283,
5875,
297,
283,
2030,
358,
288,
3788,
275,
291,
14,
1198,
63,
5811,
14,
362,
63,
1150,
63,
3431,
8,
355,
370,
29,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
9,
288,
291,
14,
629,
8,
16,
12,
822,
8,
3431,
430,
398,
543,
291,
14,
9286,
8,
771,
2190,
12,
283,
18988,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
297,
715,
304,
288,
486,
3624,
63,
2123,
63,
5950,
14,
2254,
63,
1198,
63,
475,
63,
2113,
8,
355,
283,
8114,
32,
2694,
14,
957,
297,
283,
5875,
297,
283,
2030,
358,
288,
3788,
275,
291,
14,
1198,
63,
5811,
14,
362,
63,
1150,
63,
3431,
8,
355,
370,
29,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
9,
288,
291,
14,
629,
8,
17,
12,
822,
8,
3431,
430,
288,
291,
14,
629,
8,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
12,
3788,
59,
16,
1055,
475,
9,
288,
291,
14,
4080,
8,
355,
8189,
17367,
687,
450,
83,
3171,
450,
291,
14,
22358,
63,
2864,
63,
7121,
63,
998,
12,
355,
3788,
59,
16,
1055,
2030,
14,
2708,
1012,
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
] | [
2803,
26,
2774,
13,
24,
199,
3,
199,
3,
1898,
6927,
710,
593,
802,
4674,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
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,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
13,
1311,
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,
624,
2925,
367,
314,
598,
12500,
6016,
3261,
4975,
1041,
199,
199,
363,
2502,
363,
275,
283,
1513,
290,
491,
711,
7,
421,
199,
504,
6170,
14,
3246,
14,
2123,
492,
486,
3624,
63,
2123,
63,
5950,
199,
504,
6170,
14,
2219,
492,
511,
63,
1208,
199,
646,
1964,
2190,
421,
199,
533,
11426,
2925,
8,
396,
63,
1208,
14,
9417,
14440,
304,
272,
408,
2925,
367,
10209,
14931,
1041,
339,
347,
511,
63,
24450,
63,
2123,
63,
475,
63,
2113,
8,
277,
304,
267,
327,
11426,
83,
787,
440,
4847,
340,
314,
29661,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
4260,
267,
327,
365,
440,
19136,
641,
14,
267,
543,
291,
14,
9286,
8,
771,
2190,
12,
283,
18988,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
297,
756,
304,
288,
486,
3624,
63,
2123,
63,
5950,
14,
2254,
63,
1198,
63,
475,
63,
2113,
8,
355,
283,
8114,
32,
2694,
14,
957,
297,
283,
5875,
297,
283,
2030,
358,
288,
3788,
275,
291,
14,
1198,
63,
5811,
14,
362,
63,
1150,
63,
3431,
8,
355,
370,
29,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
9,
288,
291,
14,
629,
8,
16,
12,
822,
8,
3431,
430,
398,
543,
291,
14,
9286,
8,
771,
2190,
12,
283,
18988,
63,
20469,
63,
10089,
51,
63,
2566,
63,
14288,
297,
715,
304,
288,
486,
3624,
63,
2123,
63,
5950,
14,
2254,
63,
1198,
63,
475,
63,
2113,
8,
355,
283,
8114,
32,
2694,
14,
957,
297,
283,
5875,
297,
283,
2030,
358,
288,
3788,
275,
291,
14,
1198,
63,
5811,
14,
362,
63,
1150,
63,
3431,
8,
355,
370,
29,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
9,
288,
291,
14,
629,
8,
17,
12,
822,
8,
3431,
430,
288,
291,
14,
629,
8,
771,
2190,
14,
14288,
63,
10089,
63,
12368,
12,
3788,
59,
16,
1055,
475,
9,
288,
291,
14,
4080,
8,
355,
8189,
17367,
687,
450,
83,
3171,
450,
291,
14,
22358,
63,
2864,
63,
7121,
63,
998,
12,
355,
3788,
59,
16,
1055,
2030,
14,
2708,
1012,
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,
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,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 0x19
'Yin ', # 0x1a
'E ', # 0x1b
'Fen ', # 0x1c
'Ya ', # 0x1d
'Yao ', # 0x1e
'Song ', # 0x1f
'Shen ', # 0x20
'Yin ', # 0x21
'Xin ', # 0x22
'Jue ', # 0x23
'Xiao ', # 0x24
'Ne ', # 0x25
'Chen ', # 0x26
'You ', # 0x27
'Zhi ', # 0x28
'Xiong ', # 0x29
'Fang ', # 0x2a
'Xin ', # 0x2b
'Chao ', # 0x2c
'She ', # 0x2d
'Xian ', # 0x2e
'Sha ', # 0x2f
'Tun ', # 0x30
'Xu ', # 0x31
'Yi ', # 0x32
'Yi ', # 0x33
'Su ', # 0x34
'Chi ', # 0x35
'He ', # 0x36
'Shen ', # 0x37
'He ', # 0x38
'Xu ', # 0x39
'Zhen ', # 0x3a
'Zhu ', # 0x3b
'Zheng ', # 0x3c
'Gou ', # 0x3d
'Zi ', # 0x3e
'Zi ', # 0x3f
'Zhan ', # 0x40
'Gu ', # 0x41
'Fu ', # 0x42
'Quan ', # 0x43
'Die ', # 0x44
'Ling ', # 0x45
'Di ', # 0x46
'Yang ', # 0x47
'Li ', # 0x48
'Nao ', # 0x49
'Pan ', # 0x4a
'Zhou ', # 0x4b
'Gan ', # 0x4c
'Yi ', # 0x4d
'Ju ', # 0x4e
'Ao ', # 0x4f
'Zha ', # 0x50
'Tuo ', # 0x51
'Yi ', # 0x52
'Qu ', # 0x53
'Zhao ', # 0x54
'Ping ', # 0x55
'Bi ', # 0x56
'Xiong ', # 0x57
'Qu ', # 0x58
'Ba ', # 0x59
'Da ', # 0x5a
'Zu ', # 0x5b
'Tao ', # 0x5c
'Zhu ', # 0x5d
'Ci ', # 0x5e
'Zhe ', # 0x5f
'Yong ', # 0x60
'Xu ', # 0x61
'Xun ', # 0x62
'Yi ', # 0x63
'Huang ', # 0x64
'He ', # 0x65
'Shi ', # 0x66
'Cha ', # 0x67
'Jiao ', # 0x68
'Shi ', # 0x69
'Hen ', # 0x6a
'Cha ', # 0x6b
'Gou ', # 0x6c
'Gui ', # 0x6d
'Quan ', # 0x6e
'Hui ', # 0x6f
'Jie ', # 0x70
'Hua ', # 0x71
'Gai ', # 0x72
'Xiang ', # 0x73
'Wei ', # 0x74
'Shen ', # 0x75
'Chou ', # 0x76
'Tong ', # 0x77
'Mi ', # 0x78
'Zhan ', # 0x79
'Ming ', # 0x7a
'E ', # 0x7b
'Hui ', # 0x7c
'Yan ', # 0x7d
'Xiong ', # 0x7e
'Gua ', # 0x7f
'Er ', # 0x80
'Beng ', # 0x81
'Tiao ', # 0x82
'Chi ', # 0x83
'Lei ', # 0x84
'Zhu ', # 0x85
'Kuang ', # 0x86
'Kua ', # 0x87
'Wu ', # 0x88
'Yu ', # 0x89
'Teng ', # 0x8a
'Ji ', # 0x8b
'Zhi ', # 0x8c
'Ren ', # 0x8d
'Su ', # 0x8e
'Lang ', # 0x8f
'E ', # 0x90
'Kuang ', # 0x91
'E ', # 0x92
'Shi ', # 0x93
'Ting ', # 0x94
'Dan ', # 0x95
'Bo ', # 0x96
'Chan ', # 0x97
'You ', # 0x98
'Heng ', # 0x99
'Qiao ', # 0x9a
'Qin ', # 0x9b
'Shua ', # 0x9c
'An ', # 0x9d
'Yu ', # 0x9e
'Xiao ', # 0x9f
'Cheng ', # 0xa0
'Jie ', # 0xa1
'Xian ', # 0xa2
'Wu ', # 0xa3
'Wu ', # 0xa4
'Gao ', # 0xa5
'Song ', # 0xa6
'Pu ', # 0xa7
'Hui ', # 0xa8
'Jing ', # 0xa9
'Shuo ', # 0xaa
'Zhen ', # 0xab
'Shuo ', # 0xac
'Du ', # 0xad
'Yasashi ', # 0xae
'Chang ', # 0xaf
'Shui ', # 0xb0
'Jie ', # 0xb1
'Ke ', # 0xb2
'Qu ', # 0xb3
'Cong ', # 0xb4
'Xiao ', # 0xb5
'Sui ', # 0xb6
'Wang ', # 0xb7
'Xuan ', # 0xb8
'Fei ', # 0xb9
'Chi ', # 0xba
'Ta ', # 0xbb
'Yi ', # 0xbc
'Na ', # 0xbd
'Yin ', # 0xbe
'Diao ', # 0xbf
'Pi ', # 0xc0
'Chuo ', # 0xc1
'Chan ', # 0xc2
'Chen ', # 0xc3
'Zhun ', # 0xc4
'Ji ', # 0xc5
'Qi ', # 0xc6
'Tan ', # 0xc7
'Zhui ', # 0xc8
'Wei ', # 0xc9
'Ju ', # 0xca
'Qing ', # 0xcb
'Jian ', # 0xcc
'Zheng ', # 0xcd
'Ze ', # 0xce
'Zou ', # 0xcf
'Qian ', # 0xd0
'Zhuo ', # 0xd1
'Liang ', # 0xd2
'Jian ', # 0xd3
'Zhu ', # 0xd4
'Hao ', # 0xd5
'Lun ', # 0xd6
'Shen ', # 0xd7
'Biao ', # 0xd8
'Huai ', # 0xd9
'Pian ', # 0xda
'Yu ', # 0xdb
'Die ', # 0xdc
'Xu ', # 0xdd
'Pian ', # 0xde
'Shi ', # 0xdf
'Xuan ', # 0xe0
'Shi ', # 0xe1
'Hun ', # 0xe2
'Hua ', # 0xe3
'E ', # 0xe4
'Zhong ', # 0xe5
'Di ', # 0xe6
'Xie ', # 0xe7
'Fu ', # 0xe8
'Pu ', # 0xe9
'Ting ', # 0xea
'Jian ', # 0xeb
'Qi ', # 0xec
'Yu ', # 0xed
'Zi ', # 0xee
'Chuan ', # 0xef
'Xi ', # 0xf0
'Hui ', # 0xf1
'Yin ', # 0xf2
'An ', # 0xf3
'Xian ', # 0xf4
'Nan ', # 0xf5
'Chen ', # 0xf6
'Feng ', # 0xf7
'Zhu ', # 0xf8
'Yang ', # 0xf9
'Yan ', # 0xfa
'Heng ', # 0xfb
'Xuan ', # 0xfc
'Ge ', # 0xfd
'Nuo ', # 0xfe
'Qi ', # 0xff
)
| gpl-3.0 | [
576,
275,
334,
199,
7,
26797,
1656,
259,
327,
378,
88,
383,
199,
7,
26797,
1656,
259,
327,
378,
88,
614,
199,
7,
36,
316,
1656,
259,
327,
378,
88,
996,
199,
7,
19590,
1656,
259,
327,
378,
88,
1644,
199,
7,
19910,
85,
1656,
259,
327,
378,
88,
966,
199,
7,
19910,
85,
1656,
259,
327,
378,
88,
1717,
199,
7,
42,
18939,
1656,
259,
327,
378,
88,
1690,
199,
7,
40,
951,
1656,
259,
327,
378,
88,
1780,
199,
7,
16911,
1656,
259,
327,
378,
88,
2036,
199,
7,
29745,
1656,
259,
327,
378,
88,
1643,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
16,
65,
199,
7,
1341,
8035,
1656,
259,
327,
378,
88,
16,
66,
199,
7,
40,
951,
1656,
259,
327,
378,
88,
16,
67,
199,
7,
1049,
65,
1656,
259,
327,
378,
88,
16,
68,
199,
7,
52,
8035,
1656,
259,
327,
378,
88,
16,
69,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
16,
70,
199,
7,
42,
1873,
1656,
259,
327,
378,
88,
709,
199,
7,
21001,
1656,
259,
327,
378,
88,
845,
199,
7,
5349,
1656,
259,
327,
378,
88,
713,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
969,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
1079,
199,
7,
2662,
290,
1656,
259,
327,
378,
88,
1046,
199,
7,
19910,
1656,
259,
327,
378,
88,
975,
199,
7,
52,
13780,
1656,
259,
327,
378,
88,
1196,
199,
7,
16911,
1656,
259,
327,
378,
88,
1085,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
1167,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
17,
65,
199,
7,
37,
1656,
259,
327,
378,
88,
17,
66,
199,
7,
38,
287,
1656,
259,
327,
378,
88,
17,
67,
199,
7,
28786,
1656,
259,
327,
378,
88,
17,
68,
199,
7,
57,
8035,
1656,
259,
327,
378,
88,
17,
69,
199,
7,
51,
951,
1656,
259,
327,
378,
88,
17,
70,
199,
7,
2662,
287,
1656,
259,
327,
378,
88,
1165,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
2025,
199,
7,
56,
262,
1656,
259,
327,
378,
88,
1081,
199,
7,
42,
310,
1656,
259,
327,
378,
88,
1789,
199,
7,
56,
18939,
1656,
259,
327,
378,
88,
1194,
199,
7,
4698,
1656,
259,
327,
378,
88,
821,
199,
7,
1049,
287,
1656,
259,
327,
378,
88,
1479,
199,
7,
5556,
1656,
259,
327,
378,
88,
1465,
199,
7,
58,
5812,
1656,
259,
327,
378,
88,
1651,
199,
7,
14828,
951,
1656,
259,
327,
378,
88,
1398,
199,
7,
38,
621,
1656,
259,
327,
378,
88,
18,
65,
199,
7,
56,
262,
1656,
259,
327,
378,
88,
18,
66,
199,
7,
1049,
8035,
1656,
259,
327,
378,
88,
18,
67,
199,
7,
31306,
1656,
259,
327,
378,
88,
18,
68,
199,
7,
56,
5653,
1656,
259,
327,
378,
88,
18,
69,
199,
7,
23527,
1656,
259,
327,
378,
88,
18,
70,
199,
7,
22664,
1656,
259,
327,
378,
88,
1216,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
2192,
199,
7,
21001,
1656,
259,
327,
378,
88,
708,
199,
7,
21001,
1656,
259,
327,
378,
88,
1153,
199,
7,
27032,
1656,
259,
327,
378,
88,
1082,
199,
7,
29218,
1656,
259,
327,
378,
88,
1276,
199,
7,
1966,
1656,
259,
327,
378,
88,
1344,
199,
7,
2662,
287,
1656,
259,
327,
378,
88,
1401,
199,
7,
1966,
1656,
259,
327,
378,
88,
1703,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
1355,
199,
7,
12674,
287,
1656,
259,
327,
378,
88,
19,
65,
199,
7,
31183,
1656,
259,
327,
378,
88,
19,
66,
199,
7,
12674,
7420,
1656,
259,
327,
378,
88,
19,
67,
199,
7,
39,
810,
1656,
259,
327,
378,
88,
19,
68,
199,
7,
22534,
1656,
259,
327,
378,
88,
19,
69,
199,
7,
22534,
1656,
259,
327,
378,
88,
19,
70,
199,
7,
12674,
290,
1656,
259,
327,
378,
88,
2167,
199,
7,
11548,
1656,
259,
327,
378,
88,
2953,
199,
7,
19590,
1656,
259,
327,
378,
88,
2260,
199,
7,
2371,
290,
1656,
259,
327,
378,
88,
2824,
199,
7,
1341,
69,
1656,
259,
327,
378,
88,
1602,
199,
7,
44,
316,
1656,
259,
327,
378,
88,
2322,
199,
7,
1341,
1656,
259,
327,
378,
88,
2466,
199,
7,
57,
621,
1656,
259,
327,
378,
88,
2417,
199,
7,
13009,
1656,
259,
327,
378,
88,
2006,
199,
7,
46,
8035,
1656,
259,
327,
378,
88,
1887,
199,
7,
19266,
1656,
259,
327,
378,
88,
20,
65,
199,
7,
58,
11586,
1656,
259,
327,
378,
88,
20,
66,
199,
7,
39,
290,
1656,
259,
327,
378,
88,
20,
67,
199,
7,
21001,
1656,
259,
327,
378,
88,
20,
68,
199,
7,
24783,
1656,
259,
327,
378,
88,
20,
69,
199,
7,
31707,
1656,
259,
327,
378,
88,
20,
70,
199,
7,
58,
2411,
1656,
259,
327,
378,
88,
1400,
199,
7,
52,
13780,
1656,
259,
327,
378,
88,
2869,
199,
7,
21001,
1656,
259,
327,
378,
88,
2528,
199,
7,
2371,
1656,
259,
327,
378,
88,
2481,
199,
7,
58,
2411,
79,
1656,
259,
327,
378,
88,
1477,
199,
7,
22638,
1656,
259,
327,
378,
88,
1229,
199,
7,
17975,
1656,
259,
327,
378,
88,
1367,
199,
7,
14828,
951,
1656,
259,
327,
378,
88,
1641,
199,
7,
2371,
1656,
259,
327,
378,
88,
2010,
199,
7,
13864,
1656,
259,
327,
378,
88,
1427,
199,
7,
25014,
1656,
259,
327,
378,
88,
21,
65,
199,
7,
58,
85,
1656,
259,
327,
378,
88,
21,
66,
199,
7,
52,
8035,
1656,
259,
327,
378,
88,
21,
67,
199,
7,
31183,
1656,
259,
327,
378,
88,
21,
68,
199,
7,
28665,
1656,
259,
327,
378,
88,
21,
69,
199,
7,
58,
426,
1656,
259,
327,
378,
88,
21,
70,
199,
7,
57,
951,
1656,
259,
327,
378,
88,
2259,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
2976,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
2789,
199,
7,
21001,
1656,
259,
327,
378,
88,
2766,
199,
7,
25542,
621,
1656,
259,
327,
378,
88,
772,
199,
7,
1966,
1656,
259,
327,
378,
88,
2182,
199,
7,
2662,
73,
1656,
259,
327,
378
] | [
275,
334,
199,
7,
26797,
1656,
259,
327,
378,
88,
383,
199,
7,
26797,
1656,
259,
327,
378,
88,
614,
199,
7,
36,
316,
1656,
259,
327,
378,
88,
996,
199,
7,
19590,
1656,
259,
327,
378,
88,
1644,
199,
7,
19910,
85,
1656,
259,
327,
378,
88,
966,
199,
7,
19910,
85,
1656,
259,
327,
378,
88,
1717,
199,
7,
42,
18939,
1656,
259,
327,
378,
88,
1690,
199,
7,
40,
951,
1656,
259,
327,
378,
88,
1780,
199,
7,
16911,
1656,
259,
327,
378,
88,
2036,
199,
7,
29745,
1656,
259,
327,
378,
88,
1643,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
16,
65,
199,
7,
1341,
8035,
1656,
259,
327,
378,
88,
16,
66,
199,
7,
40,
951,
1656,
259,
327,
378,
88,
16,
67,
199,
7,
1049,
65,
1656,
259,
327,
378,
88,
16,
68,
199,
7,
52,
8035,
1656,
259,
327,
378,
88,
16,
69,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
16,
70,
199,
7,
42,
1873,
1656,
259,
327,
378,
88,
709,
199,
7,
21001,
1656,
259,
327,
378,
88,
845,
199,
7,
5349,
1656,
259,
327,
378,
88,
713,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
969,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
1079,
199,
7,
2662,
290,
1656,
259,
327,
378,
88,
1046,
199,
7,
19910,
1656,
259,
327,
378,
88,
975,
199,
7,
52,
13780,
1656,
259,
327,
378,
88,
1196,
199,
7,
16911,
1656,
259,
327,
378,
88,
1085,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
1167,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
17,
65,
199,
7,
37,
1656,
259,
327,
378,
88,
17,
66,
199,
7,
38,
287,
1656,
259,
327,
378,
88,
17,
67,
199,
7,
28786,
1656,
259,
327,
378,
88,
17,
68,
199,
7,
57,
8035,
1656,
259,
327,
378,
88,
17,
69,
199,
7,
51,
951,
1656,
259,
327,
378,
88,
17,
70,
199,
7,
2662,
287,
1656,
259,
327,
378,
88,
1165,
199,
7,
57,
262,
1656,
259,
327,
378,
88,
2025,
199,
7,
56,
262,
1656,
259,
327,
378,
88,
1081,
199,
7,
42,
310,
1656,
259,
327,
378,
88,
1789,
199,
7,
56,
18939,
1656,
259,
327,
378,
88,
1194,
199,
7,
4698,
1656,
259,
327,
378,
88,
821,
199,
7,
1049,
287,
1656,
259,
327,
378,
88,
1479,
199,
7,
5556,
1656,
259,
327,
378,
88,
1465,
199,
7,
58,
5812,
1656,
259,
327,
378,
88,
1651,
199,
7,
14828,
951,
1656,
259,
327,
378,
88,
1398,
199,
7,
38,
621,
1656,
259,
327,
378,
88,
18,
65,
199,
7,
56,
262,
1656,
259,
327,
378,
88,
18,
66,
199,
7,
1049,
8035,
1656,
259,
327,
378,
88,
18,
67,
199,
7,
31306,
1656,
259,
327,
378,
88,
18,
68,
199,
7,
56,
5653,
1656,
259,
327,
378,
88,
18,
69,
199,
7,
23527,
1656,
259,
327,
378,
88,
18,
70,
199,
7,
22664,
1656,
259,
327,
378,
88,
1216,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
2192,
199,
7,
21001,
1656,
259,
327,
378,
88,
708,
199,
7,
21001,
1656,
259,
327,
378,
88,
1153,
199,
7,
27032,
1656,
259,
327,
378,
88,
1082,
199,
7,
29218,
1656,
259,
327,
378,
88,
1276,
199,
7,
1966,
1656,
259,
327,
378,
88,
1344,
199,
7,
2662,
287,
1656,
259,
327,
378,
88,
1401,
199,
7,
1966,
1656,
259,
327,
378,
88,
1703,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
1355,
199,
7,
12674,
287,
1656,
259,
327,
378,
88,
19,
65,
199,
7,
31183,
1656,
259,
327,
378,
88,
19,
66,
199,
7,
12674,
7420,
1656,
259,
327,
378,
88,
19,
67,
199,
7,
39,
810,
1656,
259,
327,
378,
88,
19,
68,
199,
7,
22534,
1656,
259,
327,
378,
88,
19,
69,
199,
7,
22534,
1656,
259,
327,
378,
88,
19,
70,
199,
7,
12674,
290,
1656,
259,
327,
378,
88,
2167,
199,
7,
11548,
1656,
259,
327,
378,
88,
2953,
199,
7,
19590,
1656,
259,
327,
378,
88,
2260,
199,
7,
2371,
290,
1656,
259,
327,
378,
88,
2824,
199,
7,
1341,
69,
1656,
259,
327,
378,
88,
1602,
199,
7,
44,
316,
1656,
259,
327,
378,
88,
2322,
199,
7,
1341,
1656,
259,
327,
378,
88,
2466,
199,
7,
57,
621,
1656,
259,
327,
378,
88,
2417,
199,
7,
13009,
1656,
259,
327,
378,
88,
2006,
199,
7,
46,
8035,
1656,
259,
327,
378,
88,
1887,
199,
7,
19266,
1656,
259,
327,
378,
88,
20,
65,
199,
7,
58,
11586,
1656,
259,
327,
378,
88,
20,
66,
199,
7,
39,
290,
1656,
259,
327,
378,
88,
20,
67,
199,
7,
21001,
1656,
259,
327,
378,
88,
20,
68,
199,
7,
24783,
1656,
259,
327,
378,
88,
20,
69,
199,
7,
31707,
1656,
259,
327,
378,
88,
20,
70,
199,
7,
58,
2411,
1656,
259,
327,
378,
88,
1400,
199,
7,
52,
13780,
1656,
259,
327,
378,
88,
2869,
199,
7,
21001,
1656,
259,
327,
378,
88,
2528,
199,
7,
2371,
1656,
259,
327,
378,
88,
2481,
199,
7,
58,
2411,
79,
1656,
259,
327,
378,
88,
1477,
199,
7,
22638,
1656,
259,
327,
378,
88,
1229,
199,
7,
17975,
1656,
259,
327,
378,
88,
1367,
199,
7,
14828,
951,
1656,
259,
327,
378,
88,
1641,
199,
7,
2371,
1656,
259,
327,
378,
88,
2010,
199,
7,
13864,
1656,
259,
327,
378,
88,
1427,
199,
7,
25014,
1656,
259,
327,
378,
88,
21,
65,
199,
7,
58,
85,
1656,
259,
327,
378,
88,
21,
66,
199,
7,
52,
8035,
1656,
259,
327,
378,
88,
21,
67,
199,
7,
31183,
1656,
259,
327,
378,
88,
21,
68,
199,
7,
28665,
1656,
259,
327,
378,
88,
21,
69,
199,
7,
58,
426,
1656,
259,
327,
378,
88,
21,
70,
199,
7,
57,
951,
1656,
259,
327,
378,
88,
2259,
199,
7,
56,
85,
1656,
259,
327,
378,
88,
2976,
199,
7,
56,
324,
1656,
259,
327,
378,
88,
2789,
199,
7,
21001,
1656,
259,
327,
378,
88,
2766,
199,
7,
25542,
621,
1656,
259,
327,
378,
88,
772,
199,
7,
1966,
1656,
259,
327,
378,
88,
2182,
199,
7,
2662,
73,
1656,
259,
327,
378,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
rubencabrera/odoo | doc/conf.py | 184 | 8222 | # -*- coding: utf-8 -*-
import sys, os
import sphinx
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
DIR = os.path.dirname(__file__)
sys.path.append(
os.path.abspath(
os.path.join(DIR, '_extensions')))
# autodoc
sys.path.append(os.path.abspath(os.path.join(DIR, '..')))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '1.2'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.ifconfig',
'sphinx.ext.todo',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
'github_link',
'odoo',
'html_domain',
'exercise_admonition',
'patchqueue'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'odoo'
copyright = u'Odoo S.A.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '8.0'
# The full version, including alpha/beta/rc tags.
release = '8.0'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'odoo'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'odoo'
odoo_cover_default = 'banners/installing_odoo.jpg'
odoo_cover_external = {
'https://odoo.com/documentation/functional/accounting.html' : 'banners/m_accounting.jpg',
'https://odoo.com/documentation/functional/double-entry.html' : 'banners/m_1.jpg',
'https://odoo.com/documentation/functional/valuation.html' : 'banners/m_2.jpg',
}
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_extensions']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_add_permalinks = u''
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# FIXME: no sidebar on index?
html_sidebars = {
}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
latex_elements = {
'papersize': r'a4paper',
'preamble': u'''\\setcounter{tocdepth}{2}
''',
}
# default must be set otherwise ifconfig blows up
todo_include_todos = False
intersphinx_mapping = {
'python': ('https://docs.python.org/2/', None),
'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),
'sqlalchemy': ('http://docs.sqlalchemy.org/en/rel_0_9/', None),
'django': ('https://django.readthedocs.org/en/latest/', None),
}
github_user = 'odoo'
github_project = 'odoo'
# monkeypatch PHP lexer to not require <?php
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
lexers['php'] = PhpLexer(startinline=True)
def setup(app):
app.connect('html-page-context', canonicalize)
app.add_config_value('canonical_root', None, 'env')
app.add_config_value('canonical_branch', 'master', 'env')
app.connect('html-page-context', versionize)
app.add_config_value('versions', '', 'env')
app.connect('html-page-context', analytics)
app.add_config_value('google_analytics_key', '', 'env')
def canonicalize(app, pagename, templatename, context, doctree):
""" Adds a 'canonical' URL for the current document in the rendering
context. Requires the ``canonical_root`` setting being set. The canonical
branch is ``master`` but can be overridden using ``canonical_branch``.
"""
if not app.config.canonical_root:
return
context['canonical'] = _build_url(
app.config.canonical_root, app.config.canonical_branch, pagename)
def versionize(app, pagename, templatename, context, doctree):
""" Adds a version switcher below the menu, requires ``canonical_root``
and ``versions`` (an ordered, space-separated lists of all possible
versions).
"""
if not (app.config.canonical_root and app.config.versions):
return
context['versions'] = [
(vs, _build_url(app.config.canonical_root, vs, pagename))
for vs in app.config.versions.split(',')
if vs != app.config.version
]
def analytics(app, pagename, templatename, context, doctree):
if not app.config.google_analytics_key:
return
context['google_analytics_key'] = app.config.google_analytics_key
def _build_url(root, branch, pagename):
return "{canonical_url}{canonical_branch}/{canonical_page}".format(
canonical_url=root,
canonical_branch=branch,
canonical_page=(pagename + '.html').replace('index.html', '')
.replace('index/', ''),
)
| agpl-3.0 | [
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
984,
12,
747,
199,
646,
15882,
199,
199,
3,
982,
5478,
334,
269,
4621,
370,
2213,
543,
29973,
9,
787,
315,
4573,
2082,
12,
199,
3,
1050,
3520,
6602,
370,
984,
14,
515,
2348,
14,
982,
314,
2082,
365,
3847,
370,
314,
199,
3,
3794,
1738,
12,
675,
747,
14,
515,
14,
4832,
370,
1852,
652,
3679,
12,
2839,
9164,
2348,
14,
199,
3022,
275,
747,
14,
515,
14,
3475,
3460,
493,
3368,
199,
1274,
14,
515,
14,
740,
8,
272,
747,
14,
515,
14,
4832,
8,
267,
747,
14,
515,
14,
904,
8,
3022,
12,
2513,
5359,
7058,
199,
3,
29973,
199,
1274,
14,
515,
14,
740,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
904,
8,
3022,
12,
11541,
7058,
199,
199,
3,
1553,
1696,
2897,
9527,
9858,
199,
199,
3,
982,
2195,
3794,
4839,
282,
13460,
10229,
1015,
12,
1174,
652,
2348,
14,
199,
10065,
63,
8008,
275,
283,
17,
14,
18,
7,
199,
199,
3,
2654,
1263,
10229,
3329,
859,
1561,
2348,
12,
465,
3326,
14,
9322,
883,
506,
5478,
199,
3,
17262,
543,
10229,
334,
4579,
283,
8008,
14,
832,
24915,
503,
2195,
3537,
7869,
14,
199,
5359,
275,
359,
272,
283,
8008,
14,
832,
14,
692,
888,
297,
272,
283,
8008,
14,
832,
14,
11396,
297,
272,
283,
8008,
14,
832,
14,
28056,
297,
272,
283,
8008,
14,
832,
14,
1058,
8008,
297,
272,
283,
8008,
14,
832,
14,
1073,
600,
297,
272,
283,
5031,
63,
1073,
297,
272,
283,
22058,
297,
272,
283,
1360,
63,
2261,
297,
272,
283,
5273,
11900,
63,
350,
31722,
297,
272,
283,
2068,
1825,
7,
199,
61,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
7009,
2348,
12,
3847,
370,
642,
2082,
14,
199,
5876,
63,
515,
275,
4044,
5876,
418,
199,
199,
3,
710,
4739,
402,
1350,
6203,
14,
199,
1365,
63,
4511,
275,
1987,
8332,
7,
199,
199,
3,
710,
2644,
402,
1350,
1584,
14,
199,
3,
1365,
63,
2991,
275,
283,
1624,
13,
24,
13,
4093,
7,
199,
199,
3,
710,
5288,
28310,
2213,
14,
199,
4133,
63,
1301,
275,
283,
1080,
7,
199,
199,
3,
1696,
2556,
3595,
314,
2199,
14,
199,
1715,
275,
399,
7,
22058,
7,
199,
7307,
275,
399,
7,
47,
16766,
428,
14,
33,
3530,
199,
199,
3,
710,
1015,
2256,
367,
314,
2199,
1265,
3984,
29904,
12,
17795,
465,
8343,
367,
199,
3,
1204,
1023,
92,
436,
1204,
3221,
18712,
2597,
1202,
315,
7750,
1163,
9825,
23088,
314,
199,
3,
6137,
8247,
14,
199,
3,
199,
3,
710,
3974,
1323,
14,
57,
1015,
14,
199,
1023,
275,
283,
24,
14,
16,
7,
199,
3,
710,
2615,
1015,
12,
5893,
5131,
15,
5683,
15,
1195,
3762,
14,
199,
3221,
275,
283,
24,
14,
16,
7,
199,
199,
3,
6006,
787,
2877,
1511,
367,
15810,
1204,
8136,
25004,
1902,
12,
1265,
663,
11168,
370,
2005,
199,
3,
2222,
13,
3910,
574,
12,
2066,
652,
365,
1202,
26,
199,
3,
8136,
275,
2125,
199,
3,
19524,
12,
11168,
63,
5045,
365,
1202,
465,
314,
1475,
367,
282,
14053,
1240,
14,
199,
8136,
63,
5045,
275,
1543,
34,
450,
68,
12,
450,
57,
7,
199,
199,
3,
3820,
402,
7970,
12,
3847,
370,
1350,
2082,
12,
626,
1336,
1584,
436,
199,
3,
6602,
370,
3686,
1380,
10023,
367,
1350,
1584,
14,
199,
5473,
63,
7435,
275,
4044,
1506,
418,
199,
199,
3,
710,
20883,
849,
4719,
334,
2972,
367,
642,
9189,
26,
658,
505,
10522,
370,
675,
367,
1006,
8247,
14,
199,
3,
885,
63,
3756,
275,
488,
199,
199,
3,
982,
2549,
12,
26380,
911,
506,
11544,
370,
520,
1532,
26,
5423,
14,
8059,
13,
4443,
1318,
14,
199,
525,
63,
1593,
63,
25510,
275,
715,
199,
199,
3,
982,
2549,
12,
314,
1453,
859,
536,
911,
506,
20247,
370,
1006,
1369,
199,
3,
4137,
16194,
334,
10180,
465,
2508,
805,
32469,
199,
3,
525,
63,
578,
63,
1247,
275,
715,
199,
199,
3,
982,
2549,
12,
3420,
2502,
436,
28966,
13502,
911,
506,
9164,
315,
314,
199,
3,
1072,
14,
9322,
787,
5525,
701,
849,
14,
199,
3,
2384,
63,
8149,
275,
756,
199,
199,
3,
710,
536,
402,
314,
14493,
334,
7093,
22437,
9,
3449,
370,
675,
14,
199,
12173,
63,
2487,
275,
283,
22058,
7,
199,
199,
3,
437,
769,
402,
5525,
13158,
367,
859,
1478,
13351,
14,
199,
3,
27555,
63,
2330,
63,
1861,
275,
942,
421,
199,
3,
1553,
8394,
367,
4163,
1072,
9527,
2595,
199,
3,
710,
8879,
370,
675,
367,
4163,
436,
4163,
15456,
6497,
14,
221,
1666,
314,
3794,
367,
199,
3,
282,
769,
402,
6762,
17915,
14,
199,
1360,
63,
7915,
275,
283,
22058,
7,
199,
199,
22058,
63,
5899,
63,
885,
275,
283,
66,
27297,
15,
3174,
316,
63,
22058,
14,
8476,
7,
199,
22058,
63,
5899,
63,
5159,
275,
469,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
21609,
14,
1360,
7,
257,
520,
283,
66,
27297,
15,
77,
63,
21609,
14,
8476,
297,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
3157,
13,
2373,
14,
1360,
7,
520,
283,
66,
27297,
15,
77,
63,
17,
14,
8476,
297,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
27456,
14,
1360,
7,
259,
520,
283,
66,
27297,
15,
77,
63,
18,
14,
8476,
297,
199,
93,
199,
199,
3,
23978,
1511,
787,
8879,
13,
6100,
436,
17551,
314,
3648,
436,
23109,
402,
282,
8879,
199,
3,
9848,
14,
221,
2104,
282,
769,
402,
1511,
2808,
367,
1924,
8879,
12,
1937,
314,
199,
3,
3794,
14,
199,
3,
1360,
63,
7915,
63,
1419,
275,
1052,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
3537,
17915,
2348,
12,
3847,
370,
642,
2082,
14,
199,
1360,
63,
7915,
63,
515,
275,
4044,
5359,
418,
199,
199,
3,
710,
536,
367,
642,
663,
402,
10229,
8247,
14,
221,
982,
488,
12,
652,
4243,
370,
199,
3,
3886,
1715,
30,
373,
28,
3221,
30,
3794,
1674,
199,
3,
1360,
63,
1213,
275,
488,
199,
199,
3,
437,
18299,
2538,
367,
314,
19191,
4681,
14,
221,
3758
] | [
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
984,
12,
747,
199,
646,
15882,
199,
199,
3,
982,
5478,
334,
269,
4621,
370,
2213,
543,
29973,
9,
787,
315,
4573,
2082,
12,
199,
3,
1050,
3520,
6602,
370,
984,
14,
515,
2348,
14,
982,
314,
2082,
365,
3847,
370,
314,
199,
3,
3794,
1738,
12,
675,
747,
14,
515,
14,
4832,
370,
1852,
652,
3679,
12,
2839,
9164,
2348,
14,
199,
3022,
275,
747,
14,
515,
14,
3475,
3460,
493,
3368,
199,
1274,
14,
515,
14,
740,
8,
272,
747,
14,
515,
14,
4832,
8,
267,
747,
14,
515,
14,
904,
8,
3022,
12,
2513,
5359,
7058,
199,
3,
29973,
199,
1274,
14,
515,
14,
740,
8,
736,
14,
515,
14,
4832,
8,
736,
14,
515,
14,
904,
8,
3022,
12,
11541,
7058,
199,
199,
3,
1553,
1696,
2897,
9527,
9858,
199,
199,
3,
982,
2195,
3794,
4839,
282,
13460,
10229,
1015,
12,
1174,
652,
2348,
14,
199,
10065,
63,
8008,
275,
283,
17,
14,
18,
7,
199,
199,
3,
2654,
1263,
10229,
3329,
859,
1561,
2348,
12,
465,
3326,
14,
9322,
883,
506,
5478,
199,
3,
17262,
543,
10229,
334,
4579,
283,
8008,
14,
832,
24915,
503,
2195,
3537,
7869,
14,
199,
5359,
275,
359,
272,
283,
8008,
14,
832,
14,
692,
888,
297,
272,
283,
8008,
14,
832,
14,
11396,
297,
272,
283,
8008,
14,
832,
14,
28056,
297,
272,
283,
8008,
14,
832,
14,
1058,
8008,
297,
272,
283,
8008,
14,
832,
14,
1073,
600,
297,
272,
283,
5031,
63,
1073,
297,
272,
283,
22058,
297,
272,
283,
1360,
63,
2261,
297,
272,
283,
5273,
11900,
63,
350,
31722,
297,
272,
283,
2068,
1825,
7,
199,
61,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
7009,
2348,
12,
3847,
370,
642,
2082,
14,
199,
5876,
63,
515,
275,
4044,
5876,
418,
199,
199,
3,
710,
4739,
402,
1350,
6203,
14,
199,
1365,
63,
4511,
275,
1987,
8332,
7,
199,
199,
3,
710,
2644,
402,
1350,
1584,
14,
199,
3,
1365,
63,
2991,
275,
283,
1624,
13,
24,
13,
4093,
7,
199,
199,
3,
710,
5288,
28310,
2213,
14,
199,
4133,
63,
1301,
275,
283,
1080,
7,
199,
199,
3,
1696,
2556,
3595,
314,
2199,
14,
199,
1715,
275,
399,
7,
22058,
7,
199,
7307,
275,
399,
7,
47,
16766,
428,
14,
33,
3530,
199,
199,
3,
710,
1015,
2256,
367,
314,
2199,
1265,
3984,
29904,
12,
17795,
465,
8343,
367,
199,
3,
1204,
1023,
92,
436,
1204,
3221,
18712,
2597,
1202,
315,
7750,
1163,
9825,
23088,
314,
199,
3,
6137,
8247,
14,
199,
3,
199,
3,
710,
3974,
1323,
14,
57,
1015,
14,
199,
1023,
275,
283,
24,
14,
16,
7,
199,
3,
710,
2615,
1015,
12,
5893,
5131,
15,
5683,
15,
1195,
3762,
14,
199,
3221,
275,
283,
24,
14,
16,
7,
199,
199,
3,
6006,
787,
2877,
1511,
367,
15810,
1204,
8136,
25004,
1902,
12,
1265,
663,
11168,
370,
2005,
199,
3,
2222,
13,
3910,
574,
12,
2066,
652,
365,
1202,
26,
199,
3,
8136,
275,
2125,
199,
3,
19524,
12,
11168,
63,
5045,
365,
1202,
465,
314,
1475,
367,
282,
14053,
1240,
14,
199,
8136,
63,
5045,
275,
1543,
34,
450,
68,
12,
450,
57,
7,
199,
199,
3,
3820,
402,
7970,
12,
3847,
370,
1350,
2082,
12,
626,
1336,
1584,
436,
199,
3,
6602,
370,
3686,
1380,
10023,
367,
1350,
1584,
14,
199,
5473,
63,
7435,
275,
4044,
1506,
418,
199,
199,
3,
710,
20883,
849,
4719,
334,
2972,
367,
642,
9189,
26,
658,
505,
10522,
370,
675,
367,
1006,
8247,
14,
199,
3,
885,
63,
3756,
275,
488,
199,
199,
3,
982,
2549,
12,
26380,
911,
506,
11544,
370,
520,
1532,
26,
5423,
14,
8059,
13,
4443,
1318,
14,
199,
525,
63,
1593,
63,
25510,
275,
715,
199,
199,
3,
982,
2549,
12,
314,
1453,
859,
536,
911,
506,
20247,
370,
1006,
1369,
199,
3,
4137,
16194,
334,
10180,
465,
2508,
805,
32469,
199,
3,
525,
63,
578,
63,
1247,
275,
715,
199,
199,
3,
982,
2549,
12,
3420,
2502,
436,
28966,
13502,
911,
506,
9164,
315,
314,
199,
3,
1072,
14,
9322,
787,
5525,
701,
849,
14,
199,
3,
2384,
63,
8149,
275,
756,
199,
199,
3,
710,
536,
402,
314,
14493,
334,
7093,
22437,
9,
3449,
370,
675,
14,
199,
12173,
63,
2487,
275,
283,
22058,
7,
199,
199,
3,
437,
769,
402,
5525,
13158,
367,
859,
1478,
13351,
14,
199,
3,
27555,
63,
2330,
63,
1861,
275,
942,
421,
199,
3,
1553,
8394,
367,
4163,
1072,
9527,
2595,
199,
3,
710,
8879,
370,
675,
367,
4163,
436,
4163,
15456,
6497,
14,
221,
1666,
314,
3794,
367,
199,
3,
282,
769,
402,
6762,
17915,
14,
199,
1360,
63,
7915,
275,
283,
22058,
7,
199,
199,
22058,
63,
5899,
63,
885,
275,
283,
66,
27297,
15,
3174,
316,
63,
22058,
14,
8476,
7,
199,
22058,
63,
5899,
63,
5159,
275,
469,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
21609,
14,
1360,
7,
257,
520,
283,
66,
27297,
15,
77,
63,
21609,
14,
8476,
297,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
3157,
13,
2373,
14,
1360,
7,
520,
283,
66,
27297,
15,
77,
63,
17,
14,
8476,
297,
272,
283,
2859,
921,
22058,
14,
957,
15,
9970,
15,
15481,
15,
27456,
14,
1360,
7,
259,
520,
283,
66,
27297,
15,
77,
63,
18,
14,
8476,
297,
199,
93,
199,
199,
3,
23978,
1511,
787,
8879,
13,
6100,
436,
17551,
314,
3648,
436,
23109,
402,
282,
8879,
199,
3,
9848,
14,
221,
2104,
282,
769,
402,
1511,
2808,
367,
1924,
8879,
12,
1937,
314,
199,
3,
3794,
14,
199,
3,
1360,
63,
7915,
63,
1419,
275,
1052,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
3537,
17915,
2348,
12,
3847,
370,
642,
2082,
14,
199,
1360,
63,
7915,
63,
515,
275,
4044,
5359,
418,
199,
199,
3,
710,
536,
367,
642,
663,
402,
10229,
8247,
14,
221,
982,
488,
12,
652,
4243,
370,
199,
3,
3886,
1715,
30,
373,
28,
3221,
30,
3794,
1674,
199,
3,
1360,
63,
1213,
275,
488,
199,
199,
3,
437,
18299,
2538,
367,
314,
19191,
4681,
14,
221,
3758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,
1,
1
] |
heli522/scikit-learn | examples/cluster/plot_lena_ward_segmentation.py | 271 | 1998 | """
===============================================================
A demo of structured Ward hierarchical clustering on Lena image
===============================================================
Compute the segmentation of a 2D image with Ward hierarchical
clustering. The clustering is spatially constrained in order
for each segmented region to be in one piece.
"""
# Author : Vincent Michel, 2010
# Alexandre Gramfort, 2011
# License: BSD 3 clause
print(__doc__)
import time as time
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from sklearn.feature_extraction.image import grid_to_graph
from sklearn.cluster import AgglomerativeClustering
###############################################################################
# Generate data
lena = sp.misc.lena()
# Downsample the image by a factor of 4
lena = lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2] + lena[1::2, 1::2]
X = np.reshape(lena, (-1, 1))
###############################################################################
# Define the structure A of the data. Pixels connected to their neighbors.
connectivity = grid_to_graph(*lena.shape)
###############################################################################
# Compute clustering
print("Compute structured hierarchical clustering...")
st = time.time()
n_clusters = 15 # number of regions
ward = AgglomerativeClustering(n_clusters=n_clusters,
linkage='ward', connectivity=connectivity).fit(X)
label = np.reshape(ward.labels_, lena.shape)
print("Elapsed time: ", time.time() - st)
print("Number of pixels: ", label.size)
print("Number of clusters: ", np.unique(label).size)
###############################################################################
# Plot the results on an image
plt.figure(figsize=(5, 5))
plt.imshow(lena, cmap=plt.cm.gray)
for l in range(n_clusters):
plt.contour(label == l, contours=1,
colors=[plt.cm.spectral(l / float(n_clusters)), ])
plt.xticks(())
plt.yticks(())
plt.show()
| bsd-3-clause | [
624,
199,
12813,
16964,
199,
33,
14779,
402,
21781,
644,
1005,
24787,
19454,
641,
15757,
65,
1834,
199,
12813,
16964,
199,
199,
8564,
314,
27315,
402,
282,
499,
36,
1834,
543,
644,
1005,
24787,
199,
25802,
14,
710,
19454,
365,
5844,
9406,
28483,
315,
1865,
199,
509,
1924,
8812,
2509,
4897,
370,
506,
315,
1373,
14854,
14,
199,
624,
199,
199,
3,
6529,
520,
28882,
2946,
603,
1158,
352,
12,
7129,
199,
3,
3515,
22986,
28547,
27211,
10279,
12,
7760,
199,
3,
844,
26,
6289,
650,
8502,
199,
199,
1361,
3460,
1301,
3368,
199,
199,
646,
900,
465,
900,
199,
646,
2680,
465,
980,
199,
646,
7026,
465,
2249,
199,
646,
8027,
14,
13563,
465,
4488,
199,
504,
6357,
14,
4445,
63,
24020,
14,
1569,
492,
6068,
63,
475,
63,
2180,
199,
504,
6357,
14,
4201,
492,
18693,
320,
278,
30498,
31174,
199,
199,
11490,
199,
3,
7958,
666,
199,
552,
65,
275,
2249,
14,
9923,
14,
552,
65,
342,
199,
3,
577,
23311,
865,
314,
1834,
701,
282,
6535,
402,
841,
199,
552,
65,
275,
822,
65,
10345,
18,
12,
3800,
18,
61,
435,
822,
65,
59,
17,
447,
18,
12,
3800,
18,
61,
435,
822,
65,
10345,
18,
12,
413,
447,
18,
61,
435,
822,
65,
59,
17,
447,
18,
12,
413,
447,
18,
61,
199,
56,
275,
980,
14,
5217,
8,
552,
65,
12,
5868,
17,
12,
413,
430,
199,
199,
11490,
199,
3,
13930,
314,
5523,
437,
402,
314,
666,
14,
510,
5887,
83,
8539,
370,
3932,
15845,
14,
199,
22344,
275,
6068,
63,
475,
63,
2180,
2031,
552,
65,
14,
1392,
9,
199,
199,
11490,
199,
3,
8354,
19454,
199,
1361,
480,
8564,
21781,
24787,
19454,
12594,
199,
270,
275,
900,
14,
521,
342,
199,
78,
63,
9170,
275,
4114,
221,
327,
1329,
402,
16150,
199,
3079,
275,
18693,
320,
278,
30498,
31174,
8,
78,
63,
9170,
29,
78,
63,
9170,
12,
267,
26087,
534,
3079,
297,
20170,
29,
22344,
680,
3269,
8,
56,
9,
199,
1302,
275,
980,
14,
5217,
8,
3079,
14,
3512,
3131,
822,
65,
14,
1392,
9,
199,
1361,
480,
37,
9982,
900,
26,
3872,
900,
14,
521,
342,
446,
410,
9,
199,
1361,
480,
3259,
402,
11094,
26,
3872,
1768,
14,
890,
9,
199,
1361,
480,
3259,
402,
13865,
26,
3872,
980,
14,
3235,
8,
1302,
680,
890,
9,
199,
199,
11490,
199,
3,
14794,
314,
2058,
641,
376,
1834,
199,
6003,
14,
8941,
8,
23899,
2687,
21,
12,
959,
430,
199,
6003,
14,
20413,
8,
552,
65,
12,
14920,
29,
6003,
14,
4400,
14,
12150,
9,
199,
509,
634,
315,
1425,
8,
78,
63,
9170,
304,
272,
4488,
14,
17798,
8,
1302,
508,
634,
12,
23176,
83,
29,
17,
12,
355,
9229,
1524,
6003,
14,
4400,
14,
31738,
8,
76,
1182,
2069,
8,
78,
63,
9170,
1826,
4794,
199,
6003,
14,
26217,
30812,
199,
6003,
14,
30588,
30812,
199,
6003,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,
12813,
16964,
199,
33,
14779,
402,
21781,
644,
1005,
24787,
19454,
641,
15757,
65,
1834,
199,
12813,
16964,
199,
199,
8564,
314,
27315,
402,
282,
499,
36,
1834,
543,
644,
1005,
24787,
199,
25802,
14,
710,
19454,
365,
5844,
9406,
28483,
315,
1865,
199,
509,
1924,
8812,
2509,
4897,
370,
506,
315,
1373,
14854,
14,
199,
624,
199,
199,
3,
6529,
520,
28882,
2946,
603,
1158,
352,
12,
7129,
199,
3,
3515,
22986,
28547,
27211,
10279,
12,
7760,
199,
3,
844,
26,
6289,
650,
8502,
199,
199,
1361,
3460,
1301,
3368,
199,
199,
646,
900,
465,
900,
199,
646,
2680,
465,
980,
199,
646,
7026,
465,
2249,
199,
646,
8027,
14,
13563,
465,
4488,
199,
504,
6357,
14,
4445,
63,
24020,
14,
1569,
492,
6068,
63,
475,
63,
2180,
199,
504,
6357,
14,
4201,
492,
18693,
320,
278,
30498,
31174,
199,
199,
11490,
199,
3,
7958,
666,
199,
552,
65,
275,
2249,
14,
9923,
14,
552,
65,
342,
199,
3,
577,
23311,
865,
314,
1834,
701,
282,
6535,
402,
841,
199,
552,
65,
275,
822,
65,
10345,
18,
12,
3800,
18,
61,
435,
822,
65,
59,
17,
447,
18,
12,
3800,
18,
61,
435,
822,
65,
10345,
18,
12,
413,
447,
18,
61,
435,
822,
65,
59,
17,
447,
18,
12,
413,
447,
18,
61,
199,
56,
275,
980,
14,
5217,
8,
552,
65,
12,
5868,
17,
12,
413,
430,
199,
199,
11490,
199,
3,
13930,
314,
5523,
437,
402,
314,
666,
14,
510,
5887,
83,
8539,
370,
3932,
15845,
14,
199,
22344,
275,
6068,
63,
475,
63,
2180,
2031,
552,
65,
14,
1392,
9,
199,
199,
11490,
199,
3,
8354,
19454,
199,
1361,
480,
8564,
21781,
24787,
19454,
12594,
199,
270,
275,
900,
14,
521,
342,
199,
78,
63,
9170,
275,
4114,
221,
327,
1329,
402,
16150,
199,
3079,
275,
18693,
320,
278,
30498,
31174,
8,
78,
63,
9170,
29,
78,
63,
9170,
12,
267,
26087,
534,
3079,
297,
20170,
29,
22344,
680,
3269,
8,
56,
9,
199,
1302,
275,
980,
14,
5217,
8,
3079,
14,
3512,
3131,
822,
65,
14,
1392,
9,
199,
1361,
480,
37,
9982,
900,
26,
3872,
900,
14,
521,
342,
446,
410,
9,
199,
1361,
480,
3259,
402,
11094,
26,
3872,
1768,
14,
890,
9,
199,
1361,
480,
3259,
402,
13865,
26,
3872,
980,
14,
3235,
8,
1302,
680,
890,
9,
199,
199,
11490,
199,
3,
14794,
314,
2058,
641,
376,
1834,
199,
6003,
14,
8941,
8,
23899,
2687,
21,
12,
959,
430,
199,
6003,
14,
20413,
8,
552,
65,
12,
14920,
29,
6003,
14,
4400,
14,
12150,
9,
199,
509,
634,
315,
1425,
8,
78,
63,
9170,
304,
272,
4488,
14,
17798,
8,
1302,
508,
634,
12,
23176,
83,
29,
17,
12,
355,
9229,
1524,
6003,
14,
4400,
14,
31738,
8,
76,
1182,
2069,
8,
78,
63,
9170,
1826,
4794,
199,
6003,
14,
26217,
30812,
199,
6003,
14,
30588,
30812,
199,
6003,
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,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
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,
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
] |
kineticadb/kinetica-api-python | gpudb/packages/avro/avro_py2/ipc.py | 2 | 18070 | # 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.
"""
Support for inter-process calls.
"""
import httplib
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from avro import io
from avro import protocol
from avro import schema
#
# Constants
#
# Handshake schema is pulled in during build
HANDSHAKE_REQUEST_SCHEMA = schema.parse("""
{
"type": "record",
"name": "HandshakeRequest", "namespace":"org.apache.avro.ipc",
"fields": [
{"name": "clientHash",
"type": {"type": "fixed", "name": "MD5", "size": 16}},
{"name": "clientProtocol", "type": ["null", "string"]},
{"name": "serverHash", "type": "MD5"},
{"name": "meta", "type": ["null", {"type": "map", "values": "bytes"}]}
]
}
""")
HANDSHAKE_RESPONSE_SCHEMA = schema.parse("""
{
"type": "record",
"name": "HandshakeResponse", "namespace": "org.apache.avro.ipc",
"fields": [
{"name": "match",
"type": {"type": "enum", "name": "HandshakeMatch",
"symbols": ["BOTH", "CLIENT", "NONE"]}},
{"name": "serverProtocol",
"type": ["null", "string"]},
{"name": "serverHash",
"type": ["null", {"type": "fixed", "name": "MD5", "size": 16}]},
{"name": "meta",
"type": ["null", {"type": "map", "values": "bytes"}]}
]
}
""")
HANDSHAKE_REQUESTOR_WRITER = io.DatumWriter(HANDSHAKE_REQUEST_SCHEMA)
HANDSHAKE_REQUESTOR_READER = io.DatumReader(HANDSHAKE_RESPONSE_SCHEMA)
HANDSHAKE_RESPONDER_WRITER = io.DatumWriter(HANDSHAKE_RESPONSE_SCHEMA)
HANDSHAKE_RESPONDER_READER = io.DatumReader(HANDSHAKE_REQUEST_SCHEMA)
META_SCHEMA = schema.parse('{"type": "map", "values": "bytes"}')
META_WRITER = io.DatumWriter(META_SCHEMA)
META_READER = io.DatumReader(META_SCHEMA)
SYSTEM_ERROR_SCHEMA = schema.parse('["string"]')
# protocol cache
REMOTE_HASHES = {}
REMOTE_PROTOCOLS = {}
BIG_ENDIAN_INT_STRUCT = io.struct_class('!I')
BUFFER_HEADER_LENGTH = 4
BUFFER_SIZE = 8192
#
# Exceptions
#
class AvroRemoteException(schema.AvroException):
"""
Raised when an error message is sent by an Avro requestor or responder.
"""
def __init__(self, fail_msg=None):
schema.AvroException.__init__(self, fail_msg)
class ConnectionClosedException(schema.AvroException):
pass
#
# Base IPC Classes (Requestor/Responder)
#
class BaseRequestor(object):
"""Base class for the client side of a protocol interaction."""
def __init__(self, local_protocol, transceiver):
self._local_protocol = local_protocol
self._transceiver = transceiver
self._remote_protocol = None
self._remote_hash = None
self._send_protocol = None
# read-only properties
local_protocol = property(lambda self: self._local_protocol)
transceiver = property(lambda self: self._transceiver)
# read/write properties
def set_remote_protocol(self, new_remote_protocol):
self._remote_protocol = new_remote_protocol
REMOTE_PROTOCOLS[self.transceiver.remote_name] = self.remote_protocol
remote_protocol = property(lambda self: self._remote_protocol,
set_remote_protocol)
def set_remote_hash(self, new_remote_hash):
self._remote_hash = new_remote_hash
REMOTE_HASHES[self.transceiver.remote_name] = self.remote_hash
remote_hash = property(lambda self: self._remote_hash, set_remote_hash)
def set_send_protocol(self, new_send_protocol):
self._send_protocol = new_send_protocol
send_protocol = property(lambda self: self._send_protocol, set_send_protocol)
def request(self, message_name, request_datum):
"""
Writes a request message and reads a response or error message.
"""
# build handshake and call request
buffer_writer = StringIO()
buffer_encoder = io.BinaryEncoder(buffer_writer)
self.write_handshake_request(buffer_encoder)
self.write_call_request(message_name, request_datum, buffer_encoder)
# send the handshake and call request; block until call response
call_request = buffer_writer.getvalue()
return self.issue_request(call_request, message_name, request_datum)
def write_handshake_request(self, encoder):
local_hash = self.local_protocol.md5
remote_name = self.transceiver.remote_name
remote_hash = REMOTE_HASHES.get(remote_name)
if remote_hash is None:
remote_hash = local_hash
self.remote_protocol = self.local_protocol
request_datum = {}
request_datum['clientHash'] = local_hash
request_datum['serverHash'] = remote_hash
if self.send_protocol:
request_datum['clientProtocol'] = str(self.local_protocol)
HANDSHAKE_REQUESTOR_WRITER.write(request_datum, encoder)
def write_call_request(self, message_name, request_datum, encoder):
"""
The format of a call request is:
* request metadata, a map with values of type bytes
* the message name, an Avro string, followed by
* the message parameters. Parameters are serialized according to
the message's request declaration.
"""
# request metadata (not yet implemented)
request_metadata = {}
META_WRITER.write(request_metadata, encoder)
# message name
message = self.local_protocol.messages.get(message_name)
if message is None:
raise schema.AvroException('Unknown message: %s' % message_name)
encoder.write_utf8(message.name)
# message parameters
self.write_request(message.request, request_datum, encoder)
def write_request(self, request_schema, request_datum, encoder):
datum_writer = io.DatumWriter(request_schema)
datum_writer.write(request_datum, encoder)
def read_handshake_response(self, decoder):
handshake_response = HANDSHAKE_REQUESTOR_READER.read(decoder)
match = handshake_response.get('match')
if match == 'BOTH':
self.send_protocol = False
return True
elif match == 'CLIENT':
if self.send_protocol:
raise schema.AvroException('Handshake failure.')
self.remote_protocol = protocol.parse(
handshake_response.get('serverProtocol'))
self.remote_hash = handshake_response.get('serverHash')
self.send_protocol = False
return True
elif match == 'NONE':
if self.send_protocol:
raise schema.AvroException('Handshake failure.')
self.remote_protocol = protocol.parse(
handshake_response.get('serverProtocol'))
self.remote_hash = handshake_response.get('serverHash')
self.send_protocol = True
return False
else:
raise schema.AvroException('Unexpected match: %s' % match)
def read_call_response(self, message_name, decoder):
"""
The format of a call response is:
* response metadata, a map with values of type bytes
* a one-byte error flag boolean, followed by either:
o if the error flag is false,
the message response, serialized per the message's response schema.
o if the error flag is true,
the error, serialized per the message's error union schema.
"""
# response metadata
response_metadata = META_READER.read(decoder)
# remote response schema
remote_message_schema = self.remote_protocol.messages.get(message_name)
if remote_message_schema is None:
raise schema.AvroException('Unknown remote message: %s' % message_name)
# local response schema
local_message_schema = self.local_protocol.messages.get(message_name)
if local_message_schema is None:
raise schema.AvroException('Unknown local message: %s' % message_name)
# error flag
if not decoder.read_boolean():
writers_schema = remote_message_schema.response
readers_schema = local_message_schema.response
return self.read_response(writers_schema, readers_schema, decoder)
else:
writers_schema = remote_message_schema.errors
readers_schema = local_message_schema.errors
raise self.read_error(writers_schema, readers_schema, decoder)
def read_response(self, writers_schema, readers_schema, decoder):
datum_reader = io.DatumReader(writers_schema, readers_schema)
result = datum_reader.read(decoder)
return result
def read_error(self, writers_schema, readers_schema, decoder):
datum_reader = io.DatumReader(writers_schema, readers_schema)
return AvroRemoteException(datum_reader.read(decoder))
class Requestor(BaseRequestor):
def issue_request(self, call_request, message_name, request_datum):
call_response = self.transceiver.transceive(call_request)
# process the handshake and call response
buffer_decoder = io.BinaryDecoder(StringIO(call_response))
call_response_exists = self.read_handshake_response(buffer_decoder)
if call_response_exists:
return self.read_call_response(message_name, buffer_decoder)
else:
return self.request(message_name, request_datum)
class Responder(object):
"""Base class for the server side of a protocol interaction."""
def __init__(self, local_protocol):
self._local_protocol = local_protocol
self._local_hash = self.local_protocol.md5
self._protocol_cache = {}
self.set_protocol_cache(self.local_hash, self.local_protocol)
# read-only properties
local_protocol = property(lambda self: self._local_protocol)
local_hash = property(lambda self: self._local_hash)
protocol_cache = property(lambda self: self._protocol_cache)
# utility functions to manipulate protocol cache
def get_protocol_cache(self, hash):
return self.protocol_cache.get(hash)
def set_protocol_cache(self, hash, protocol):
self.protocol_cache[hash] = protocol
def respond(self, call_request):
"""
Called by a server to deserialize a request, compute and serialize
a response or error. Compare to 'handle()' in Thrift.
"""
buffer_reader = StringIO(call_request)
buffer_decoder = io.BinaryDecoder(buffer_reader)
buffer_writer = StringIO()
buffer_encoder = io.BinaryEncoder(buffer_writer)
error = None
response_metadata = {}
try:
remote_protocol = self.process_handshake(buffer_decoder, buffer_encoder)
# handshake failure
if remote_protocol is None:
return buffer_writer.getvalue()
# read request using remote protocol
request_metadata = META_READER.read(buffer_decoder)
remote_message_name = buffer_decoder.read_utf8()
# get remote and local request schemas so we can do
# schema resolution (one fine day)
remote_message = remote_protocol.messages.get(remote_message_name)
if remote_message is None:
fail_msg = 'Unknown remote message: %s' % remote_message_name
raise schema.AvroException(fail_msg)
local_message = self.local_protocol.messages.get(remote_message_name)
if local_message is None:
fail_msg = 'Unknown local message: %s' % remote_message_name
raise schema.AvroException(fail_msg)
writers_schema = remote_message.request
readers_schema = local_message.request
request = self.read_request(writers_schema, readers_schema,
buffer_decoder)
# perform server logic
try:
response = self.invoke(local_message, request)
except AvroRemoteException as e:
error = e
except Exception as e:
error = AvroRemoteException(str(e))
# write response using local protocol
META_WRITER.write(response_metadata, buffer_encoder)
buffer_encoder.write_boolean(error is not None)
if error is None:
writers_schema = local_message.response
self.write_response(writers_schema, response, buffer_encoder)
else:
writers_schema = local_message.errors
self.write_error(writers_schema, error, buffer_encoder)
except schema.AvroException as e:
error = AvroRemoteException(str(e))
buffer_encoder = io.BinaryEncoder(StringIO())
META_WRITER.write(response_metadata, buffer_encoder)
buffer_encoder.write_boolean(True)
self.write_error(SYSTEM_ERROR_SCHEMA, error, buffer_encoder)
return buffer_writer.getvalue()
def process_handshake(self, decoder, encoder):
handshake_request = HANDSHAKE_RESPONDER_READER.read(decoder)
handshake_response = {}
# determine the remote protocol
client_hash = handshake_request.get('clientHash')
client_protocol = handshake_request.get('clientProtocol')
remote_protocol = self.get_protocol_cache(client_hash)
if remote_protocol is None and client_protocol is not None:
remote_protocol = protocol.parse(client_protocol)
self.set_protocol_cache(client_hash, remote_protocol)
# evaluate remote's guess of the local protocol
server_hash = handshake_request.get('serverHash')
if self.local_hash == server_hash:
if remote_protocol is None:
handshake_response['match'] = 'NONE'
else:
handshake_response['match'] = 'BOTH'
else:
if remote_protocol is None:
handshake_response['match'] = 'NONE'
else:
handshake_response['match'] = 'CLIENT'
if handshake_response['match'] != 'BOTH':
handshake_response['serverProtocol'] = str(self.local_protocol)
handshake_response['serverHash'] = self.local_hash
HANDSHAKE_RESPONDER_WRITER.write(handshake_response, encoder)
return remote_protocol
def invoke(self, local_message, request):
"""
Aactual work done by server: cf. handler in thrift.
"""
pass
def read_request(self, writers_schema, readers_schema, decoder):
datum_reader = io.DatumReader(writers_schema, readers_schema)
return datum_reader.read(decoder)
def write_response(self, writers_schema, response_datum, encoder):
datum_writer = io.DatumWriter(writers_schema)
datum_writer.write(response_datum, encoder)
def write_error(self, writers_schema, error_exception, encoder):
datum_writer = io.DatumWriter(writers_schema)
datum_writer.write(str(error_exception), encoder)
#
# Utility classes
#
class FramedReader(object):
"""Wrapper around a file-like object to read framed data."""
def __init__(self, reader):
self._reader = reader
# read-only properties
reader = property(lambda self: self._reader)
def read_framed_message(self):
message = []
while True:
buffer = StringIO()
buffer_length = self._read_buffer_length()
if buffer_length == 0:
return ''.join(message)
while buffer.tell() < buffer_length:
chunk = self.reader.read(buffer_length - buffer.tell())
if chunk == '':
raise ConnectionClosedException("Reader read 0 bytes.")
buffer.write(chunk)
message.append(buffer.getvalue())
def _read_buffer_length(self):
read = self.reader.read(BUFFER_HEADER_LENGTH)
if read == '':
raise ConnectionClosedException("Reader read 0 bytes.")
return BIG_ENDIAN_INT_STRUCT.unpack(read)[0]
class FramedWriter(object):
"""Wrapper around a file-like object to write framed data."""
def __init__(self, writer):
self._writer = writer
# read-only properties
writer = property(lambda self: self._writer)
def write_framed_message(self, message):
message_length = len(message)
total_bytes_sent = 0
while message_length - total_bytes_sent > 0:
if message_length - total_bytes_sent > BUFFER_SIZE:
buffer_length = BUFFER_SIZE
else:
buffer_length = message_length - total_bytes_sent
self.write_buffer(message[total_bytes_sent:
(total_bytes_sent + buffer_length)])
total_bytes_sent += buffer_length
# A message is always terminated by a zero-length buffer.
self.write_buffer_length(0)
def write_buffer(self, chunk):
buffer_length = len(chunk)
self.write_buffer_length(buffer_length)
self.writer.write(chunk)
def write_buffer_length(self, n):
self.writer.write(BIG_ENDIAN_INT_STRUCT.pack(n))
#
# Transceiver Implementations
#
class HTTPTransceiver(object):
"""
A simple HTTP-based transceiver implementation.
Useful for clients but not for servers
"""
def __init__(self, host, port, req_resource='/'):
self.req_resource = req_resource
self.conn = httplib.HTTPConnection(host, port)
self.conn.connect()
# read-only properties
sock = property(lambda self: self.conn.sock)
remote_name = property(lambda self: self.sock.getsockname())
# read/write properties
def set_conn(self, new_conn):
self._conn = new_conn
conn = property(lambda self: self._conn, set_conn)
req_resource = '/'
def transceive(self, request):
self.write_framed_message(request)
result = self.read_framed_message()
return result
def read_framed_message(self):
response = self.conn.getresponse()
response_reader = FramedReader(response)
framed_message = response_reader.read_framed_message()
response.read() # ensure we're ready for subsequent requests
return framed_message
def write_framed_message(self, message):
req_method = 'POST'
req_headers = {'Content-Type': 'avro/binary'}
req_body_buffer = FramedWriter(StringIO())
req_body_buffer.write_framed_message(message)
req_body = req_body_buffer.writer.getvalue()
self.conn.request(req_method, self.req_resource, req_body, req_headers)
def close(self):
self.conn.close()
#
# Server Implementations (none yet)
#
| mit | [
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
221,
199,
3,
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,
624,
199,
11532,
367,
1640,
13,
1412,
4882,
14,
199,
624,
199,
646,
8809,
199,
893,
26,
523,
687,
15073,
492,
5228,
199,
2590,
3545,
26,
523,
687,
5228,
492,
5228,
199,
504,
2289,
293,
492,
5890,
199,
504,
2289,
293,
492,
4113,
199,
504,
2289,
293,
492,
4177,
199,
199,
3,
199,
3,
22296,
199,
3,
199,
199,
3,
27451,
4177,
365,
25239,
1146,
315,
5309,
1900,
199,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
275,
4177,
14,
1122,
4852,
199,
91,
272,
298,
466,
582,
298,
3059,
401,
272,
298,
354,
582,
298,
26392,
2017,
401,
298,
3251,
5122,
1308,
14,
3796,
14,
1214,
293,
14,
32352,
401,
272,
298,
955,
582,
359,
267,
2420,
354,
582,
298,
1258,
3476,
401,
507,
298,
466,
582,
2420,
466,
582,
298,
5964,
401,
298,
354,
582,
298,
5127,
21,
401,
298,
890,
582,
3193,
13459,
267,
2420,
354,
582,
298,
1258,
3658,
401,
298,
466,
582,
2097,
2307,
401,
298,
875,
19057,
267,
2420,
354,
582,
298,
1000,
3476,
401,
298,
466,
582,
298,
5127,
21,
6018,
523,
198,
6641,
354,
582,
298,
2024,
401,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
9420,
199,
1622,
199,
93,
199,
199,
6141,
199,
199,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
275,
4177,
14,
1122,
4852,
199,
91,
272,
298,
466,
582,
298,
3059,
401,
272,
298,
354,
582,
298,
26392,
2364,
401,
298,
3251,
582,
298,
1308,
14,
3796,
14,
1214,
293,
14,
32352,
401,
272,
298,
955,
582,
359,
267,
2420,
354,
582,
298,
1431,
401,
268,
298,
466,
582,
2420,
466,
582,
298,
4869,
401,
298,
354,
582,
298,
26392,
4486,
401,
2116,
298,
7450,
582,
2097,
28784,
401,
298,
9901,
401,
298,
9185,
23965,
267,
2420,
354,
582,
298,
1000,
3658,
401,
268,
298,
466,
582,
2097,
2307,
401,
298,
875,
19057,
267,
2420,
354,
582,
298,
1000,
3476,
401,
268,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
5964,
401,
298,
354,
582,
298,
5127,
21,
401,
298,
890,
582,
3193,
11049,
1386,
523,
198,
6641,
354,
582,
298,
2024,
401,
268,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
9420,
272,
1622,
199,
93,
199,
199,
6141,
199,
199,
40,
20033,
6294,
2430,
63,
6780,
726,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
6780,
726,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
11073,
615,
11733,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
11073,
615,
11733,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
9,
199,
199,
10614,
63,
10926,
275,
4177,
14,
1122,
360,
6641,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
358,
199,
10614,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
10614,
63,
10926,
9,
199,
10614,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
10614,
63,
10926,
9,
199,
199,
12711,
63,
3170,
63,
10926,
275,
4177,
14,
1122,
360,
905,
875,
937,
358,
199,
199,
3,
4113,
2581,
199,
16058,
63,
14395,
654,
275,
1052,
199,
16058,
63,
9583,
51,
275,
1052,
199,
199,
18643,
63,
21046,
63,
2919,
63,
8893,
275,
5890,
14,
1820,
63,
533,
16157,
41,
358,
199,
10960,
63,
7311,
63,
9127,
275,
841,
199,
10960,
63,
4305,
275,
28828,
199,
199,
3,
199,
3,
24873,
199,
3,
199,
199,
533,
16599,
293,
6713,
1726,
8,
3629,
14,
6651,
293,
1726,
304,
523,
408,
523,
24997,
1380,
376,
1125,
1245,
365,
4847,
701,
376,
16599,
293,
1056,
269,
503,
9163,
424,
14,
523,
408,
523,
347,
636,
826,
721,
277,
12,
2449,
63,
1328,
29,
403,
304,
272,
4177,
14,
6651,
293,
1726,
855,
826,
721,
277,
12,
2449,
63,
1328,
9,
199,
199,
533,
8113,
15190,
1726,
8,
3629,
14,
6651,
293,
1726,
304,
523,
986,
199,
199,
3,
199,
3,
3523,
3531,
35,
27939,
334,
2017,
269,
15,
1322,
23621,
9,
199,
3,
199,
199,
533,
3523,
2017,
269,
8,
785,
304,
523,
408,
1563,
1021,
367,
314,
1890,
5366,
402,
282,
4113,
18752,
1041,
523,
347,
636,
826,
721,
277,
12,
2257,
63,
3922,
12,
1752,
6594,
304,
272,
291,
423,
1832,
63,
3922,
275,
2257,
63,
3922,
272,
291,
423,
1515,
6594,
275,
1752,
6594,
272,
291,
423,
3846,
63,
3922,
275,
488,
272,
291,
423,
3846,
63,
2227,
275,
488,
272,
291,
423,
2254,
63,
3922,
275,
488,
819,
327,
1586,
13,
2118,
4382,
523,
2257,
63,
3922,
275,
3324,
8,
2734,
291,
26,
291,
423,
1832,
63,
3922,
9,
523,
1752,
6594,
275,
3324,
8,
2734,
291,
26,
291,
423,
1515,
6594,
9,
819,
327,
1586,
15,
952,
4382,
523,
347,
663,
63,
3846,
63,
3922
] | [
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
221,
199,
3,
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,
624,
199,
11532,
367,
1640,
13,
1412,
4882,
14,
199,
624,
199,
646,
8809,
199,
893,
26,
523,
687,
15073,
492,
5228,
199,
2590,
3545,
26,
523,
687,
5228,
492,
5228,
199,
504,
2289,
293,
492,
5890,
199,
504,
2289,
293,
492,
4113,
199,
504,
2289,
293,
492,
4177,
199,
199,
3,
199,
3,
22296,
199,
3,
199,
199,
3,
27451,
4177,
365,
25239,
1146,
315,
5309,
1900,
199,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
275,
4177,
14,
1122,
4852,
199,
91,
272,
298,
466,
582,
298,
3059,
401,
272,
298,
354,
582,
298,
26392,
2017,
401,
298,
3251,
5122,
1308,
14,
3796,
14,
1214,
293,
14,
32352,
401,
272,
298,
955,
582,
359,
267,
2420,
354,
582,
298,
1258,
3476,
401,
507,
298,
466,
582,
2420,
466,
582,
298,
5964,
401,
298,
354,
582,
298,
5127,
21,
401,
298,
890,
582,
3193,
13459,
267,
2420,
354,
582,
298,
1258,
3658,
401,
298,
466,
582,
2097,
2307,
401,
298,
875,
19057,
267,
2420,
354,
582,
298,
1000,
3476,
401,
298,
466,
582,
298,
5127,
21,
6018,
523,
198,
6641,
354,
582,
298,
2024,
401,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
9420,
199,
1622,
199,
93,
199,
199,
6141,
199,
199,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
275,
4177,
14,
1122,
4852,
199,
91,
272,
298,
466,
582,
298,
3059,
401,
272,
298,
354,
582,
298,
26392,
2364,
401,
298,
3251,
582,
298,
1308,
14,
3796,
14,
1214,
293,
14,
32352,
401,
272,
298,
955,
582,
359,
267,
2420,
354,
582,
298,
1431,
401,
268,
298,
466,
582,
2420,
466,
582,
298,
4869,
401,
298,
354,
582,
298,
26392,
4486,
401,
2116,
298,
7450,
582,
2097,
28784,
401,
298,
9901,
401,
298,
9185,
23965,
267,
2420,
354,
582,
298,
1000,
3658,
401,
268,
298,
466,
582,
2097,
2307,
401,
298,
875,
19057,
267,
2420,
354,
582,
298,
1000,
3476,
401,
268,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
5964,
401,
298,
354,
582,
298,
5127,
21,
401,
298,
890,
582,
3193,
11049,
1386,
523,
198,
6641,
354,
582,
298,
2024,
401,
268,
298,
466,
582,
2097,
2307,
401,
2420,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
9420,
272,
1622,
199,
93,
199,
199,
6141,
199,
199,
40,
20033,
6294,
2430,
63,
6780,
726,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
6780,
726,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
11073,
615,
11733,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
40,
20033,
6294,
2430,
63,
12801,
63,
10926,
9,
199,
40,
20033,
6294,
2430,
63,
11073,
615,
11733,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
40,
20033,
6294,
2430,
63,
6780,
63,
10926,
9,
199,
199,
10614,
63,
10926,
275,
4177,
14,
1122,
360,
6641,
466,
582,
298,
1130,
401,
298,
1459,
582,
298,
2394,
3570,
358,
199,
10614,
63,
6524,
11084,
275,
5890,
14,
6456,
6261,
8,
10614,
63,
10926,
9,
199,
10614,
63,
5670,
540,
275,
5890,
14,
6456,
5929,
8,
10614,
63,
10926,
9,
199,
199,
12711,
63,
3170,
63,
10926,
275,
4177,
14,
1122,
360,
905,
875,
937,
358,
199,
199,
3,
4113,
2581,
199,
16058,
63,
14395,
654,
275,
1052,
199,
16058,
63,
9583,
51,
275,
1052,
199,
199,
18643,
63,
21046,
63,
2919,
63,
8893,
275,
5890,
14,
1820,
63,
533,
16157,
41,
358,
199,
10960,
63,
7311,
63,
9127,
275,
841,
199,
10960,
63,
4305,
275,
28828,
199,
199,
3,
199,
3,
24873,
199,
3,
199,
199,
533,
16599,
293,
6713,
1726,
8,
3629,
14,
6651,
293,
1726,
304,
523,
408,
523,
24997,
1380,
376,
1125,
1245,
365,
4847,
701,
376,
16599,
293,
1056,
269,
503,
9163,
424,
14,
523,
408,
523,
347,
636,
826,
721,
277,
12,
2449,
63,
1328,
29,
403,
304,
272,
4177,
14,
6651,
293,
1726,
855,
826,
721,
277,
12,
2449,
63,
1328,
9,
199,
199,
533,
8113,
15190,
1726,
8,
3629,
14,
6651,
293,
1726,
304,
523,
986,
199,
199,
3,
199,
3,
3523,
3531,
35,
27939,
334,
2017,
269,
15,
1322,
23621,
9,
199,
3,
199,
199,
533,
3523,
2017,
269,
8,
785,
304,
523,
408,
1563,
1021,
367,
314,
1890,
5366,
402,
282,
4113,
18752,
1041,
523,
347,
636,
826,
721,
277,
12,
2257,
63,
3922,
12,
1752,
6594,
304,
272,
291,
423,
1832,
63,
3922,
275,
2257,
63,
3922,
272,
291,
423,
1515,
6594,
275,
1752,
6594,
272,
291,
423,
3846,
63,
3922,
275,
488,
272,
291,
423,
3846,
63,
2227,
275,
488,
272,
291,
423,
2254,
63,
3922,
275,
488,
819,
327,
1586,
13,
2118,
4382,
523,
2257,
63,
3922,
275,
3324,
8,
2734,
291,
26,
291,
423,
1832,
63,
3922,
9,
523,
1752,
6594,
275,
3324,
8,
2734,
291,
26,
291,
423,
1515,
6594,
9,
819,
327,
1586,
15,
952,
4382,
523,
347,
663,
63,
3846,
63,
3922,
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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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
] |
chfoo/cloaked-octo-nemesis | visibli/visibli_url_grab.py | 1 | 14609 | '''Grab Visibli hex shortcodes'''
# Copyright 2013 Christopher Foo <chris.foo@gmail.com>
# Licensed under GPLv3. See COPYING.txt for details.
import argparse
import base64
import collections
import gzip
import html.parser
import http.client
import logging
import logging.handlers
import math
import os
import queue
import random
import re
import sqlite3
import threading
import time
import atexit
_logger = logging.getLogger(__name__)
class UnexpectedResult(ValueError):
pass
class UserAgent(object):
def __init__(self, filename):
self.strings = []
with open(filename, 'rt') as f:
while True:
line = f.readline().strip()
if not line:
break
self.strings.append(line)
self.strings = tuple(self.strings)
_logger.info('Initialized with %d user agents', len(self.strings))
class AbsSineyRateFunc(object):
def __init__(self, avg_rate=1.0):
self._avg_rate = avg_rate
self._amplitude = 1.0 / self._avg_rate * 5.6
self._x = 1.0
def get(self):
y = abs(self._amplitude * math.sin(self._x) * math.sin(self._x ** 2)
/ self._x)
self._x += 0.05
if self._x > 2 * math.pi:
self._x = 1.0
return y
class HTTPClientProcessor(threading.Thread):
def __init__(self, request_queue, response_queue, host, port):
threading.Thread.__init__(self)
self.daemon = True
self._request_queue = request_queue
self._response_queue = response_queue
self._http_client = http.client.HTTPConnection(host, port)
self.start()
def run(self):
while True:
path, headers, shortcode = self._request_queue.get()
try:
_logger.debug('Get %s %s', path, headers)
self._http_client.request('GET', path, headers=headers)
response = self._http_client.getresponse()
except http.client.HTTPException:
_logger.exception('Got an http error.')
self._http_client.close()
time.sleep(120)
else:
_logger.debug('Got response %s %s',
response.status, response.reason)
data = response.read()
self._response_queue.put((response, data, shortcode))
class InsertQueue(threading.Thread):
def __init__(self, db_path):
threading.Thread.__init__(self)
self.daemon = True
self._queue = queue.Queue(maxsize=100)
self._event = threading.Event()
self._running = True
self._db_path = db_path
self.start()
def run(self):
self._db = sqlite3.connect(self._db_path)
while self._running:
self._process()
self._event.wait(timeout=10)
def _process(self):
with self._db:
while True:
try:
statement, values = self._queue.get_nowait()
except queue.Empty:
break
_logger.debug('Executing statement')
self._db.execute(statement, values)
def stop(self):
self._running = False
self._event.set()
def add(self, statement, values):
self._queue.put((statement, values))
class VisibliHexURLGrab(object):
def __init__(self, sequential=False, reverse_sequential=False,
avg_items_per_sec=0.5, database_dir='', user_agent_filename=None,
http_client_threads=2, save_reports=False):
db_path = os.path.join(database_dir, 'visibli.db')
self.database_dir = database_dir
self.db = sqlite3.connect(db_path)
self.db.execute('PRAGMA journal_mode=WAL')
with self.db:
self.db.execute('''CREATE TABLE IF NOT EXISTS visibli_hex
(shortcode INTEGER PRIMARY KEY ASC, url TEXT, not_exist INTEGER)
''')
self.host = 'localhost'
self.port = 8123
self.save_reports = save_reports
self.request_queue = queue.Queue(maxsize=1)
self.response_queue = queue.Queue(maxsize=10)
self.http_clients = self.new_clients(http_client_threads)
self.throttle_time = 1
self.sequential = sequential
self.reverse_sequential = reverse_sequential
self.seq_num = 0xffffff if self.reverse_sequential else 0
self.session_count = 0
#self.total_count = self.get_count() or 0
self.total_count = 0
self.user_agent = UserAgent(user_agent_filename)
self.headers = {
'Accept-Encoding': 'gzip',
'Host': 'links.sharedby.co',
}
self.average_deque = collections.deque(maxlen=100)
self.rate_func = AbsSineyRateFunc(avg_items_per_sec)
self.miss_count = 0
self.hit_count = 0
self.insert_queue = InsertQueue(db_path)
atexit.register(self.insert_queue.stop)
def new_clients(self, http_client_threads=2):
return [HTTPClientProcessor(self.request_queue, self.response_queue,
self.host, self.port)
for dummy in range(http_client_threads)]
def shortcode_to_int(self, shortcode):
return int.from_bytes(shortcode, byteorder='big', signed=False)
def new_shortcode(self):
while True:
if self.sequential or self.reverse_sequential:
s = '{:06x}'.format(self.seq_num)
shortcode = base64.b16decode(s.encode(), casefold=True)
if self.reverse_sequential:
self.seq_num -= 1
if self.seq_num < 0:
return None
else:
self.seq_num += 1
if self.seq_num > 0xffffff:
return None
else:
shortcode = os.urandom(3)
rows = self.db.execute('SELECT 1 FROM visibli_hex WHERE '
'shortcode = ? LIMIT 1', [self.shortcode_to_int(shortcode)])
if not len(list(rows)):
return shortcode
def run(self):
self.check_proxy_tor()
while True:
if not self.insert_queue.is_alive():
raise Exception('Insert queue died!')
shortcode = self.new_shortcode()
if shortcode is None:
break
shortcode_str = base64.b16encode(shortcode).lower().decode()
path = 'http://links.sharedby.co/links/{}'.format(shortcode_str)
headers = self.get_headers()
while True:
try:
self.request_queue.put_nowait((path, headers, shortcode))
except queue.Full:
self.read_responses()
else:
break
if self.session_count % 10 == 0:
_logger.info('Session={}, hit={}, total={}, {:.3f} u/s'.format(
self.session_count, self.hit_count,
self.session_count + self.total_count,
self.calc_avg()))
t = self.rate_func.get()
_logger.debug('Sleep {:.3f}'.format(t))
time.sleep(t)
self.read_responses()
_logger.info('Shutting down...')
time.sleep(30)
self.read_responses()
self.insert_queue.stop()
self.insert_queue.join()
def get_headers(self):
d = dict(self.headers)
d['User-Agent'] = random.choice(self.user_agent.strings)
return d
def read_responses(self):
while True:
try:
response, data, shortcode = self.response_queue.get(block=True,
timeout=0.05)
except queue.Empty:
break
self.session_count += 1
shortcode_str = base64.b16encode(shortcode).lower().decode()
try:
url = self.read_response(response, data)
except UnexpectedResult as e:
_logger.warn('Unexpected result %s', e)
if self.save_reports:
try:
self.write_report(e, shortcode_str, response, data)
except:
_logger.exception('Error writing report')
self.throttle(None, force=True)
continue
if not url:
self.add_no_url(shortcode)
self.miss_count += 1
else:
self.add_url(shortcode, url)
self.miss_count = 0
self.hit_count += 1
_logger.info('%s->%s...', shortcode_str,
url[:30] if url else '(none)')
self.throttle(response.status)
def read_response(self, response, data):
if response.getheader('Content-Encoding') == 'gzip':
_logger.debug('Got gzip data')
data = gzip.decompress(data)
if response.status == 301:
url = response.getheader('Location')
return url
elif response.status == 200:
match = re.search(br'<iframe id="[^"]+" src="([^"]+)">', data)
if not match:
raise UnexpectedResult('No iframe found')
url = match.group(1).decode()
url = html.parser.HTMLParser().unescape(url)
return url
elif response.status == 302:
location = response.getheader('Location')
# if location and 'sharedby' not in location \
# and 'visibli' not in location:
if location and location.startswith('http://yahoo.com'):
raise UnexpectedResult(
'Weird 302 redirect to {}'.format(location))
elif not location:
raise UnexpectedResult('No redirect location')
return
else:
raise UnexpectedResult('Unexpected status {}'.format(
response.status))
def throttle(self, status_code, force=False):
if force or 400 <= status_code <= 499 or 500 <= status_code <= 999 \
or self.miss_count > 2:
_logger.info('Throttle %d seconds', self.throttle_time)
time.sleep(self.throttle_time)
self.throttle_time *= 2
self.throttle_time = min(3600, self.throttle_time)
else:
self.throttle_time /= 2
self.throttle_time = min(600, self.throttle_time)
self.throttle_time = max(1, self.throttle_time)
def add_url(self, shortcode, url):
_logger.debug('Insert %s %s', shortcode, url)
self.insert_queue.add('INSERT OR IGNORE INTO visibli_hex VALUES (?, ?, ?)',
[self.shortcode_to_int(shortcode), url, None])
def add_no_url(self, shortcode):
_logger.debug('Mark no url %s', shortcode)
self.insert_queue.add('INSERT OR IGNORE INTO visibli_hex VALUES (?, ?, ?)',
[self.shortcode_to_int(shortcode), None, 1])
def get_count(self):
for row in self.db.execute('SELECT COUNT(ROWID) FROM visibli_hex '
'LIMIT 1'):
return int(row[0])
def calc_avg(self):
self.average_deque.append((self.session_count, time.time()))
try:
avg = ((self.session_count - self.average_deque[0][0])
/ (time.time() - self.average_deque[0][1]))
except ArithmeticError:
avg = 0
return avg
def check_proxy_tor(self):
http_client = http.client.HTTPConnection(self.host, self.port)
http_client.request('GET', 'http://check.torproject.org/',
headers={'Host': 'check.torproject.org'})
response = http_client.getresponse()
data = response.read()
_logger.debug('Check proxy got data=%s', data.decode())
if response.status != 200:
raise UnexpectedResult('Check tor page returned %d',
response.status)
if b'Congratulations. Your browser is configured to use Tor.' \
not in data:
raise UnexpectedResult('Not configured to use tor')
_logger.info('Using tor proxy')
def write_report(self, error, shortcode_str, response, data):
path = os.path.join(self.database_dir,
'report_{:.04f}'.format(time.time()))
_logger.debug('Writing report to %s', path)
with open(path, 'wt') as f:
f.write('Error ')
f.write(str(error))
f.write('\n')
f.write('Code ')
f.write(shortcode_str)
f.write('\n')
f.write(str(response.status))
f.write(response.reason)
f.write('\n')
f.write(str(response.getheaders()))
f.write('\n\nData\n\n')
f.write(str(data))
f.write('\n\nEnd Report\n')
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('--sequential', action='store_true')
arg_parser.add_argument('--reverse-sequential', action='store_true')
arg_parser.add_argument('--save-reports', action='store_true')
arg_parser.add_argument('--average-rate', type=float, default=1.0)
arg_parser.add_argument('--quiet', action='store_true')
arg_parser.add_argument('--database-dir', default=os.getcwd())
arg_parser.add_argument('--log-dir', default=os.getcwd())
arg_parser.add_argument('--user-agent-file',
default=os.path.join(os.getcwd(), 'user-agents.txt'))
arg_parser.add_argument('--threads', type=int, default=2)
args = arg_parser.parse_args()
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
if not args.quiet:
console = logging.StreamHandler()
console.setLevel(logging.INFO)
console.setFormatter(
logging.Formatter('%(levelname)s %(message)s'))
root_logger.addHandler(console)
log_filename = os.path.join(args.log_dir, 'visibli_url_grab.log')
file_log = logging.handlers.RotatingFileHandler(log_filename,
maxBytes=1048576, backupCount=9)
file_log.setLevel(logging.DEBUG)
file_log.setFormatter(logging.Formatter(
'%(asctime)s %(name)s:%(lineno)d %(levelname)s %(message)s'))
root_logger.addHandler(file_log)
o = VisibliHexURLGrab(sequential=args.sequential,
reverse_sequential=args.reverse_sequential,
database_dir=args.database_dir,
avg_items_per_sec=args.average_rate,
user_agent_filename=args.user_agent_file,
http_client_threads=args.threads,
save_reports=args.save_reports,)
o.run()
| gpl-3.0 | [
2344,
5761,
66,
6561,
6637,
317,
6318,
3974,
6021,
2344,
199,
3,
1898,
6171,
2799,
322,
2379,
2523,
8024,
665,
335,
5719,
14,
1421,
32,
6799,
14,
957,
30,
199,
3,
3909,
1334,
14629,
86,
19,
14,
1666,
9685,
14,
2424,
367,
2436,
14,
199,
646,
7534,
199,
646,
1300,
772,
199,
646,
5055,
199,
646,
11756,
199,
646,
3517,
14,
2087,
199,
646,
1455,
14,
1258,
199,
646,
2050,
199,
646,
2050,
14,
5586,
199,
646,
3473,
199,
646,
747,
199,
646,
4126,
199,
646,
2196,
199,
646,
295,
199,
646,
11723,
19,
199,
646,
5796,
199,
646,
900,
199,
646,
19840,
421,
199,
63,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
25345,
2889,
8,
3393,
304,
272,
986,
421,
199,
533,
2876,
7788,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1788,
304,
267,
291,
14,
5465,
275,
942,
398,
543,
1551,
8,
1501,
12,
283,
2591,
358,
465,
289,
26,
288,
1830,
715,
26,
355,
1004,
275,
289,
14,
6407,
1252,
1913,
342,
2234,
340,
440,
1004,
26,
490,
2059,
2234,
291,
14,
5465,
14,
740,
8,
604,
9,
398,
291,
14,
5465,
275,
2008,
8,
277,
14,
5465,
9,
267,
485,
2921,
14,
815,
360,
23031,
543,
450,
68,
922,
22867,
297,
822,
8,
277,
14,
5465,
430,
421,
199,
533,
20319,
51,
1132,
89,
6621,
7465,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
12402,
63,
1866,
29,
17,
14,
16,
304,
267,
291,
423,
8595,
63,
1866,
275,
12402,
63,
1866,
267,
291,
423,
31928,
275,
413,
14,
16,
1182,
291,
423,
8595,
63,
1866,
627,
959,
14,
22,
267,
291,
423,
88,
275,
413,
14,
16,
339,
347,
664,
8,
277,
304,
267,
612,
275,
2853,
8,
277,
423,
31928,
627,
3473,
14,
5911,
8,
277,
423,
88,
9,
627,
3473,
14,
5911,
8,
277,
423,
88,
1011,
499,
9,
288,
1182,
291,
423,
88,
9,
267,
291,
423,
88,
847,
378,
14,
1717,
398,
340,
291,
423,
88,
690,
499,
627,
3473,
14,
1038,
26,
288,
291,
423,
88,
275,
413,
14,
16,
398,
372,
612,
421,
199,
533,
3101,
3041,
10438,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
1056,
63,
1825,
12,
1177,
63,
1825,
12,
1591,
12,
1844,
304,
267,
5796,
14,
4436,
855,
826,
721,
277,
9,
267,
291,
14,
10824,
275,
715,
267,
291,
423,
1069,
63,
1825,
275,
1056,
63,
1825,
267,
291,
423,
1310,
63,
1825,
275,
1177,
63,
1825,
267,
291,
423,
1014,
63,
1258,
275,
1455,
14,
1258,
14,
19114,
8,
1102,
12,
1844,
9,
398,
291,
14,
928,
342,
339,
347,
1255,
8,
277,
304,
267,
1830,
715,
26,
288,
931,
12,
2323,
12,
3974,
600,
275,
291,
423,
1069,
63,
1825,
14,
362,
342,
953,
862,
26,
355,
485,
2921,
14,
1757,
360,
1002,
450,
83,
450,
83,
297,
931,
12,
2323,
9,
355,
291,
423,
1014,
63,
1258,
14,
1069,
360,
2970,
297,
931,
12,
2323,
29,
2139,
9,
355,
1177,
275,
291,
423,
1014,
63,
1258,
14,
25006,
342,
288,
871,
1455,
14,
1258,
14,
26871,
26,
355,
485,
2921,
14,
1971,
360,
13662,
376,
1455,
1125,
2659,
355,
291,
423,
1014,
63,
1258,
14,
1600,
342,
355,
900,
14,
4532,
8,
6708,
9,
288,
587,
26,
355,
485,
2921,
14,
1757,
360,
13662,
1177,
450,
83,
450,
83,
297,
490,
1177,
14,
1205,
12,
1177,
14,
5764,
9,
355,
666,
275,
1177,
14,
739,
342,
355,
291,
423,
1310,
63,
1825,
14,
524,
1332,
1310,
12,
666,
12,
3974,
600,
430,
421,
199,
533,
15496,
3737,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
1592,
63,
515,
304,
267,
5796,
14,
4436,
855,
826,
721,
277,
9,
267,
291,
14,
10824,
275,
715,
267,
291,
423,
1825,
275,
4126,
14,
3737,
8,
13634,
29,
1960,
9,
267,
291,
423,
1430,
275,
5796,
14,
2390,
342,
267,
291,
423,
5720,
275,
715,
267,
291,
423,
697,
63,
515,
275,
1592,
63,
515,
398,
291,
14,
928,
342,
339,
347,
1255,
8,
277,
304,
267,
291,
423,
697,
275,
11723,
19,
14,
2242,
8,
277,
423,
697,
63,
515,
9,
398,
1830,
291,
423,
5720,
26,
288,
291,
423,
1412,
342,
288,
291,
423,
1430,
14,
2573,
8,
2593,
29,
709,
9,
339,
347,
485,
1412,
8,
277,
304,
267,
543,
291,
423,
697,
26,
288,
1830,
715,
26,
355,
862,
26,
490,
5164,
12,
1338,
275,
291,
423,
1825,
14,
362,
63,
20870,
342,
355,
871,
4126,
14,
4699,
26,
490,
2059,
2234,
485,
2921,
14,
1757,
360,
4858,
4655,
5164,
358,
355,
291,
423,
697,
14,
2526,
8,
6242,
12,
1338,
9,
339,
347,
3631,
8,
277,
304,
267,
291,
423,
5720,
275,
756,
267,
291,
423,
1430,
14,
409,
342,
339,
347,
1050,
8,
277,
12,
5164,
12,
1338,
304,
267,
291,
423,
1825,
14,
524,
1332,
6242,
12,
1338,
430,
421,
199,
533,
6561,
6637,
317,
10373,
2632,
5761,
66,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
23381,
29,
797,
12,
3837,
63,
16211,
29,
797,
12,
272,
12402,
63,
1744,
63,
529,
63,
3321,
29,
16,
14,
21,
12,
3050,
63,
694,
4581,
922,
63,
4054,
63,
1501,
29,
403,
12,
272,
1455,
63,
1258,
63,
6962,
29,
18,
12,
3354,
63,
15629,
29,
797,
304,
267,
1592,
63,
515,
275,
747,
14,
515,
14,
904,
8,
4659,
63,
694,
12,
283,
433,
6637,
317,
14,
697,
358,
267,
291,
14,
4659,
63,
694,
275,
3050,
63,
694,
267,
291,
14,
697,
275,
11723,
19,
14,
2242,
8,
697,
63,
515,
9,
267,
291,
14,
697,
14,
2526,
360,
3311,
1254,
2054,
9605,
63,
632,
29,
55,
748,
358,
398,
543,
291,
14,
697,
26,
288,
291,
14,
697,
14,
2526,
10505,
8366,
9934,
8036,
2845,
23875,
1321,
6637,
317,
63,
4097,
288,
334,
3612,
600,
17086,
19770,
9301,
20955,
12,
1166,
11951,
12,
440,
63,
4494,
17086,
9,
288,
21464,
398,
291,
14,
1102,
275,
283,
5967,
7,
267,
291,
14,
719,
275,
1695,
4288,
267,
291,
14,
2117,
63,
15629,
275,
3354,
63,
15629,
267,
291,
14,
1069
] | [
5761,
66,
6561,
6637,
317,
6318,
3974,
6021,
2344,
199,
3,
1898,
6171,
2799,
322,
2379,
2523,
8024,
665,
335,
5719,
14,
1421,
32,
6799,
14,
957,
30,
199,
3,
3909,
1334,
14629,
86,
19,
14,
1666,
9685,
14,
2424,
367,
2436,
14,
199,
646,
7534,
199,
646,
1300,
772,
199,
646,
5055,
199,
646,
11756,
199,
646,
3517,
14,
2087,
199,
646,
1455,
14,
1258,
199,
646,
2050,
199,
646,
2050,
14,
5586,
199,
646,
3473,
199,
646,
747,
199,
646,
4126,
199,
646,
2196,
199,
646,
295,
199,
646,
11723,
19,
199,
646,
5796,
199,
646,
900,
199,
646,
19840,
421,
199,
63,
2921,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
25345,
2889,
8,
3393,
304,
272,
986,
421,
199,
533,
2876,
7788,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1788,
304,
267,
291,
14,
5465,
275,
942,
398,
543,
1551,
8,
1501,
12,
283,
2591,
358,
465,
289,
26,
288,
1830,
715,
26,
355,
1004,
275,
289,
14,
6407,
1252,
1913,
342,
2234,
340,
440,
1004,
26,
490,
2059,
2234,
291,
14,
5465,
14,
740,
8,
604,
9,
398,
291,
14,
5465,
275,
2008,
8,
277,
14,
5465,
9,
267,
485,
2921,
14,
815,
360,
23031,
543,
450,
68,
922,
22867,
297,
822,
8,
277,
14,
5465,
430,
421,
199,
533,
20319,
51,
1132,
89,
6621,
7465,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
12402,
63,
1866,
29,
17,
14,
16,
304,
267,
291,
423,
8595,
63,
1866,
275,
12402,
63,
1866,
267,
291,
423,
31928,
275,
413,
14,
16,
1182,
291,
423,
8595,
63,
1866,
627,
959,
14,
22,
267,
291,
423,
88,
275,
413,
14,
16,
339,
347,
664,
8,
277,
304,
267,
612,
275,
2853,
8,
277,
423,
31928,
627,
3473,
14,
5911,
8,
277,
423,
88,
9,
627,
3473,
14,
5911,
8,
277,
423,
88,
1011,
499,
9,
288,
1182,
291,
423,
88,
9,
267,
291,
423,
88,
847,
378,
14,
1717,
398,
340,
291,
423,
88,
690,
499,
627,
3473,
14,
1038,
26,
288,
291,
423,
88,
275,
413,
14,
16,
398,
372,
612,
421,
199,
533,
3101,
3041,
10438,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
1056,
63,
1825,
12,
1177,
63,
1825,
12,
1591,
12,
1844,
304,
267,
5796,
14,
4436,
855,
826,
721,
277,
9,
267,
291,
14,
10824,
275,
715,
267,
291,
423,
1069,
63,
1825,
275,
1056,
63,
1825,
267,
291,
423,
1310,
63,
1825,
275,
1177,
63,
1825,
267,
291,
423,
1014,
63,
1258,
275,
1455,
14,
1258,
14,
19114,
8,
1102,
12,
1844,
9,
398,
291,
14,
928,
342,
339,
347,
1255,
8,
277,
304,
267,
1830,
715,
26,
288,
931,
12,
2323,
12,
3974,
600,
275,
291,
423,
1069,
63,
1825,
14,
362,
342,
953,
862,
26,
355,
485,
2921,
14,
1757,
360,
1002,
450,
83,
450,
83,
297,
931,
12,
2323,
9,
355,
291,
423,
1014,
63,
1258,
14,
1069,
360,
2970,
297,
931,
12,
2323,
29,
2139,
9,
355,
1177,
275,
291,
423,
1014,
63,
1258,
14,
25006,
342,
288,
871,
1455,
14,
1258,
14,
26871,
26,
355,
485,
2921,
14,
1971,
360,
13662,
376,
1455,
1125,
2659,
355,
291,
423,
1014,
63,
1258,
14,
1600,
342,
355,
900,
14,
4532,
8,
6708,
9,
288,
587,
26,
355,
485,
2921,
14,
1757,
360,
13662,
1177,
450,
83,
450,
83,
297,
490,
1177,
14,
1205,
12,
1177,
14,
5764,
9,
355,
666,
275,
1177,
14,
739,
342,
355,
291,
423,
1310,
63,
1825,
14,
524,
1332,
1310,
12,
666,
12,
3974,
600,
430,
421,
199,
533,
15496,
3737,
8,
12562,
14,
4436,
304,
272,
347,
636,
826,
721,
277,
12,
1592,
63,
515,
304,
267,
5796,
14,
4436,
855,
826,
721,
277,
9,
267,
291,
14,
10824,
275,
715,
267,
291,
423,
1825,
275,
4126,
14,
3737,
8,
13634,
29,
1960,
9,
267,
291,
423,
1430,
275,
5796,
14,
2390,
342,
267,
291,
423,
5720,
275,
715,
267,
291,
423,
697,
63,
515,
275,
1592,
63,
515,
398,
291,
14,
928,
342,
339,
347,
1255,
8,
277,
304,
267,
291,
423,
697,
275,
11723,
19,
14,
2242,
8,
277,
423,
697,
63,
515,
9,
398,
1830,
291,
423,
5720,
26,
288,
291,
423,
1412,
342,
288,
291,
423,
1430,
14,
2573,
8,
2593,
29,
709,
9,
339,
347,
485,
1412,
8,
277,
304,
267,
543,
291,
423,
697,
26,
288,
1830,
715,
26,
355,
862,
26,
490,
5164,
12,
1338,
275,
291,
423,
1825,
14,
362,
63,
20870,
342,
355,
871,
4126,
14,
4699,
26,
490,
2059,
2234,
485,
2921,
14,
1757,
360,
4858,
4655,
5164,
358,
355,
291,
423,
697,
14,
2526,
8,
6242,
12,
1338,
9,
339,
347,
3631,
8,
277,
304,
267,
291,
423,
5720,
275,
756,
267,
291,
423,
1430,
14,
409,
342,
339,
347,
1050,
8,
277,
12,
5164,
12,
1338,
304,
267,
291,
423,
1825,
14,
524,
1332,
6242,
12,
1338,
430,
421,
199,
533,
6561,
6637,
317,
10373,
2632,
5761,
66,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
23381,
29,
797,
12,
3837,
63,
16211,
29,
797,
12,
272,
12402,
63,
1744,
63,
529,
63,
3321,
29,
16,
14,
21,
12,
3050,
63,
694,
4581,
922,
63,
4054,
63,
1501,
29,
403,
12,
272,
1455,
63,
1258,
63,
6962,
29,
18,
12,
3354,
63,
15629,
29,
797,
304,
267,
1592,
63,
515,
275,
747,
14,
515,
14,
904,
8,
4659,
63,
694,
12,
283,
433,
6637,
317,
14,
697,
358,
267,
291,
14,
4659,
63,
694,
275,
3050,
63,
694,
267,
291,
14,
697,
275,
11723,
19,
14,
2242,
8,
697,
63,
515,
9,
267,
291,
14,
697,
14,
2526,
360,
3311,
1254,
2054,
9605,
63,
632,
29,
55,
748,
358,
398,
543,
291,
14,
697,
26,
288,
291,
14,
697,
14,
2526,
10505,
8366,
9934,
8036,
2845,
23875,
1321,
6637,
317,
63,
4097,
288,
334,
3612,
600,
17086,
19770,
9301,
20955,
12,
1166,
11951,
12,
440,
63,
4494,
17086,
9,
288,
21464,
398,
291,
14,
1102,
275,
283,
5967,
7,
267,
291,
14,
719,
275,
1695,
4288,
267,
291,
14,
2117,
63,
15629,
275,
3354,
63,
15629,
267,
291,
14,
1069,
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,
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